From 704ce7f78e87d05afcfd1444361a36ce43b6158e Mon Sep 17 00:00:00 2001 From: RISCi_ATOM Date: Sat, 17 Dec 2016 17:41:05 -0500 Subject: [PATCH] First Commit --- CONTRIBUTING.md | 114 + LICENSE | 340 + README.md | 26 + admin/debootstrap/Makefile | 56 + admin/debootstrap/files/pkgdetails.c | 347 + .../debootstrap/patches/100-busybox_fix.patch | 11 + admin/htop/Makefile | 54 + .../100-fix-libtool-version-check.patch | 11 + admin/monit/Makefile | 95 + admin/monit/files/monit.init | 15 + .../patches/001-fix-default-piddir.patch | 18 + admin/muninlite/Makefile | 54 + admin/muninlite/files/etc/xinetd.d/munin | 10 + admin/muninlite/patches/001-fix_disks.patch | 10 + admin/muninlite/patches/002-hostname.patch | 11 + .../patches/100-fix-no-ethtool.patch | 21 + .../patches/110-fix-uptime-days.patch | 12 + admin/muninlite/patches/200-add-tap-dev.patch | 20 + .../patches/210-add-bridge-devs.patch | 24 + .../patches/220-modify-ifname-parser.patch | 22 + .../230-fix-available-interface-parsing.patch | 20 + admin/netdata/Makefile | 68 + admin/netdata/files/netdata.conf | 43 + admin/netdata/files/netdata.init | 21 + ...-disable_external_plugins_by_default.patch | 26 + admin/sudo/Makefile | 98 + admin/sudo/files/sudo.init | 11 + .../patches/010-cross-compile-fixes.patch | 16 + admin/sudo/patches/020-no-owner-change.patch | 12 + .../patches/030-musl-fix-missing-header.patch | 12 + admin/zabbix/Makefile | 235 + admin/zabbix/files/mac80211 | 27 + admin/zabbix/files/network | 9 + admin/zabbix/files/wifi | 25 + admin/zabbix/files/zabbix_agentd.init | 23 + admin/zabbix/files/zabbix_helper_mac80211.c | 77 + .../patches/002-fix-res_send-on-uclibc.patch | 35 + admin/zabbix/patches/002-uclibc_loadavg.patch | 48 + .../003-change-user-and-foreground.patch | 17 + .../patches/010-change-agentd-config.patch | 65 + admin/zabbix/patches/100-musl-compat.patch | 23 + devel/autoconf/Makefile | 70 + devel/automake/Makefile | 65 + devel/diffutils/Makefile | 62 + devel/gcc/Makefile | 167 + devel/gcc/README | 10 + .../001-revert_register_mode_search.patch | 65 + devel/gcc/patches/002-case_insensitive.patch | 14 + ...t-choke-when-building-32bit-on-64bit.patch | 14 + .../gcc/patches/003-mpfr-longlong-mips.patch | 38 + devel/gcc/patches/010-documentation.patch | 23 + devel/gcc/patches/020-no-plt-backport.patch | 28 + .../patches/040-fix-mips-ICE-PR-68400.patch | 23 + devel/gcc/patches/100-uclibc-conf.patch | 33 + devel/gcc/patches/200-musl_config.patch | 309 + devel/gcc/patches/201-musl_arm.patch | 43 + devel/gcc/patches/202-musl_mips.patch | 35 + devel/gcc/patches/203-musl_powerpc.patch | 209 + devel/gcc/patches/204-musl_sh.patch | 39 + devel/gcc/patches/205-musl_x86.patch | 41 + devel/gcc/patches/206-musl_aarch64.patch | 31 + devel/gcc/patches/207-musl_fixincludes.patch | 30 + devel/gcc/patches/209-musl_libstdc++.patch | 72 + devel/gcc/patches/230-musl_libssp.patch | 13 + devel/gcc/patches/240-musl-libitm-fixes.patch | 61 + devel/gcc/patches/250-add-musl.patch | 120 + .../gcc/patches/260-musl-add-unwind-fix.patch | 34 + .../270-musl-add-powerpc-softfloat-fix.patch | 24 + .../300-mips_Os_cpu_rtx_cost_model.patch | 14 + .../patches/800-arm_v5te_no_ldrd_strd.patch | 11 + .../patches/810-arm-softfloat-libgcc.patch | 25 + devel/gcc/patches/820-libgcc_pic.patch | 36 + .../gcc/patches/830-arm_unbreak_armv4t.patch | 13 + .../840-armv4_pass_fix-v4bx_to_ld.patch | 19 + devel/gcc/patches/850-use_shared_libgcc.patch | 47 + devel/gcc/patches/851-libgcc_no_compat.patch | 12 + devel/gcc/patches/870-ppc_no_crtsavres.patch | 11 + devel/gcc/patches/880-no_java_section.patch | 11 + devel/gcc/patches/900-bad-mips16-crt.patch | 9 + devel/gcc/patches/910-mbsd_multi.patch | 222 + .../patches/920-specs_nonfatal_getenv.patch | 15 + .../patches/930-fix-mips-noexecstack.patch | 111 + devel/gcc/patches/930-osdefines.patch | 13 + .../patches/940-no-clobber-stamp-bits.patch | 11 + .../950-cpp_file_path_translation.patch | 182 + devel/gcc/patches/960-go_libm.patch | 11 + devel/gcc/patches/970-warn_bug.patch | 11 + devel/libtool-bin/Makefile | 52 + devel/lpc21isp/Makefile | 42 + devel/lttng-modules/Makefile | 45 + .../patches/001-mm_page_alloc_extfrag.patch | 10 + devel/lttng-tools/Makefile | 60 + .../lttng-tools/patches/100-musl-compat.patch | 23 + .../lttng-tools/patches/200-use-extern.patch | 423 + devel/m4/Makefile | 41 + devel/make/Makefile | 46 + devel/patch/Makefile | 48 + devel/pkg-config/Makefile | 49 + ipv6/aiccu/Makefile | 70 + ipv6/aiccu/files/aiccu.hotplug | 3 + ipv6/aiccu/files/aiccu.sh | 121 + ipv6/aiccu/patches/100-cross_compile.patch | 101 + ipv6/aiccu/patches/200-add_dn_skipname.patch | 68 + ipv6/aiccu/patches/300-resolver-uclibc.patch | 29 + ipv6/aiccu/patches/400-musl-compat.patch | 31 + ipv6/aiccu/patches/500-gnutls_3.4.patch | 22 + ipv6/tayga/Makefile | 49 + ipv6/tayga/files/tayga-proto.sh | 96 + ipv6/tayga/files/tayga.hotplug | 37 + ipv6/tayga/files/tayga.sh | 152 + .../patches/001-configure_unset_CFLAGS.patch | 11 + .../002-bigendian_wrong_checksum.patch | 53 + kernel/exfat-nofuse/Makefile | 51 + kernel/mtd-rw/Makefile | 49 + lang/chardet/Makefile | 53 + lang/django-appconf/Makefile | 48 + lang/django-compressor/Makefile | 49 + lang/django-constance/Makefile | 48 + lang/django-jsonfield/Makefile | 48 + lang/django-picklefield/Makefile | 48 + lang/django-postoffice/Makefile | 49 + lang/django-restframework/Makefile | 49 + lang/django-statici18n/Makefile | 48 + lang/django/Makefile | 65 + lang/dkjson/Makefile | 49 + lang/erlang/Makefile | 339 + .../patches/101-emulator_includes.patch | 11 + lang/erlang/patches/102-musl_compat.patch | 11 + lang/erlang/patches/103-disable_emacs.patch | 11 + lang/et_xmlfile/Makefile | 48 + lang/flup/Makefile | 48 + lang/gunicorn/Makefile | 53 + lang/jamvm/Makefile | 67 + lang/jdcal/Makefile | 48 + lang/json4lua/Makefile | 52 + lang/lpeg/Makefile | 48 + lang/lua-bencode/Makefile | 50 + lang/lua-cjson/Makefile | 56 + lang/lua-copas/Makefile | 62 + lang/lua-copas/patches/makefile.patch | 15 + lang/lua-coxpcall/Makefile | 59 + lang/lua-coxpcall/patches/config.patch | 4 + lang/lua-lsqlite3/Makefile | 58 + lang/lua-lzlib/Makefile | 48 + .../patches/001-allow_optim_flags.patch | 12 + lang/lua-md5/Makefile | 75 + lang/lua-md5/patches/config.patch | 19 + lang/lua-md5/patches/makefile.patch | 10 + lang/lua-mobdebug/Makefile | 56 + lang/lua-openssl/Makefile | 42 + .../patches/0001-Revise-Makefile.patch | 135 + .../patches/0010-Fix-Linkage.patch | 36 + .../0020-support-OPENSSL_NO_SSL3_METHOD.patch | 41 + .../0030-support-OPENSSL_NO_COMP.patch | 20 + lang/lua-penlight/Makefile | 46 + lang/lua-rings/Makefile | 54 + lang/lua-rings/patches/config.patch | 28 + lang/lua-rings/patches/makefile.patch | 11 + lang/lua-rs232/Makefile | 62 + lang/lua-sha2/Makefile | 52 + lang/lua-sha2/patches/001-makefile.patch | 14 + lang/lua-wsapi/Makefile | 95 + lang/lua-xavante/Makefile | 58 + lang/luabitop/Makefile | 53 + lang/luaexpat/Makefile | 56 + lang/luaexpat/files/compat-5.1r5/compat-5.1.c | 97 + lang/luaexpat/files/compat-5.1r5/compat-5.1.h | 13 + .../files/compat-5.1r5/compat-5.1.lua | 267 + lang/luafilesystem/Makefile | 66 + lang/luai2c/Makefile | 45 + lang/lualanes/Makefile | 57 + lang/lualanes/patches/100-musl-compat.patch | 13 + lang/luaposix/Makefile | 61 + lang/luaposix/patches/100-eglibc-compat.patch | 30 + .../luaposix/patches/101-disable-curses.patch | 32 + .../102-disable-compat-deprecated.diff | 20 + lang/luarocks/Makefile | 58 + .../patches/01_dont_modify_bin_shebang.diff | 13 + lang/luasec/Makefile | 61 + lang/luasoap/Makefile | 56 + lang/luasocket/Makefile | 63 + .../patches/0001-Add-interface-support.patch | 237 + lang/luasql/Makefile | 118 + lang/lzmq/Makefile | 48 + lang/micropython-lib/Makefile | 55 + lang/micropython/Makefile | 57 + .../patches/000-Makefile-no-errors | 13 + lang/node-arduino-firmata/Makefile | 68 + .../arduino-firmata/lib/arduino-firmata.js | 306 + .../patches/000-new-serialport.patch | 10 + lang/node-cylon/Makefile | 99 + lang/node-cylon/patches/0001-serialport.patch | 12 + lang/node-hid/Makefile | 65 + lang/node-serialport/Makefile | 65 + lang/node/Makefile | 94 + lang/node/patches/001-hardfloat.patch | 12 + lang/node/patches/002-addr_info.patch | 10 + lang/node/patches/003-path.patch | 12 + lang/openpyxl/Makefile | 48 + lang/perl-cgi/Makefile | 48 + lang/perl-compress-bzip2/Makefile | 48 + lang/perl-dbi/Makefile | 65 + lang/perl-device-serialport/Makefile | 53 + lang/perl-device-usb/Makefile | 73 + lang/perl-device-usb/README.patches | 8 + .../patches/100-fix_buildsystem.patch | 20 + .../110-just_assume_libusb_is_there.diff | 30 + .../patches/120-use_libusb_0_1.patch | 13 + .../130-provide-proper-library-paths.patch | 13 + .../140-avoid-libusb-name-conflicts.patch | 219 + lang/perl-encode-locale/Makefile | 48 + lang/perl-file-listing/Makefile | 48 + lang/perl-file-sharedir-install/Makefile | 64 + lang/perl-html-form/Makefile | 48 + lang/perl-html-parser/Makefile | 48 + lang/perl-html-tagset/Makefile | 48 + lang/perl-html-tree/Makefile | 49 + lang/perl-http-cookies/Makefile | 48 + lang/perl-http-daemon/Makefile | 48 + lang/perl-http-date/Makefile | 48 + lang/perl-http-message/Makefile | 48 + lang/perl-http-negotiate/Makefile | 48 + lang/perl-http-server-simple/Makefile | 48 + lang/perl-inline-c/Makefile | 65 + .../100-inline_c-no_compile_hack.patch | 11 + ...ne_c-make_system_typemap_overridable.patch | 46 + lang/perl-inline/Makefile | 65 + lang/perl-io-html/Makefile | 48 + lang/perl-lockfile-simple/Makefile | 48 + lang/perl-lwp-mediatypes/Makefile | 48 + lang/perl-net-http/Makefile | 48 + lang/perl-net-telnet/Makefile | 48 + lang/perl-parse-recdescent/Makefile | 64 + lang/perl-sub-uplevel/Makefile | 48 + lang/perl-test-harness/Makefile | 48 + lang/perl-test-warn/Makefile | 48 + lang/perl-uri/Makefile | 48 + lang/perl-www-mechanize/Makefile | 48 + lang/perl-www-robotrules/Makefile | 48 + lang/perl-www/Makefile | 48 + lang/perl-xml-parser/Makefile | 86 + .../patches/010-xml-parser-expat-use-ppport.h | 7476 +++++ ...xml-parser-expat-lib-inc-path-anchor.patch | 12 + lang/perl/Config.in | 20 + lang/perl/Makefile | 184 + lang/perl/README.patches | 9 + lang/perl/files/README.config | 59 + lang/perl/files/architecture.config | 121 + lang/perl/files/arm.config | 19 + lang/perl/files/armeb.config | 19 + lang/perl/files/base.config | 1005 + lang/perl/files/i486.config | 28 + lang/perl/files/libc.config | 47 + lang/perl/files/mips.config | 19 + lang/perl/files/mips64.config | 19 + lang/perl/files/mipsel.config | 19 + lang/perl/files/misc.config | 11 + lang/perl/files/perl-run_tests.sh | 81 + lang/perl/files/perlconfig.pl | 313 + lang/perl/files/powerpc.config | 19 + lang/perl/files/signal.config | 18 + lang/perl/files/threads.config | 197 + lang/perl/files/version.config | 38 + lang/perl/files/x86_64.config | 28 + lang/perl/patches/010-musl-compat.patch | 11 + ...st-libc-dir-moved-debian+derivatives.patch | 27 + ...x-cross-compile-endianness-detection.patch | 22 + .../patches/110-always_use_miniperl.patch | 27 + lang/perl/patches/300-add-relink-hack.patch | 6 + lang/perl/patches/310-recompile-hack.patch | 16 + ...e_fetch_count_t-handle_missing_crypt.patch | 26 + .../710-threads_join-skip_ps_on_busybox.patch | 81 + lang/perl/patches/900-CVE-2015-8607.patch | 57 + lang/perl/patches/901-CVE-2016-2381.patch | 102 + lang/perl/perlbase.mk | 1559 + lang/perl/perlmod.mk | 162 + lang/php7-pecl-dio/Makefile | 34 + .../patches/0000-unify-line-endings.patch | 3110 ++ .../patches/0001-fix-svn-prop.patch | 32 + .../patches/0002-fix-Wunused-variable.patch | 39 + .../0003-Fix-Wmaybe-uninitialized.patch | 39 + ...arning-Wunused-but-set-variable-sorr.patch | 42 + ...E-file-as-requested-in-Request-65869.patch | 91 + ...CH_RESOURCE-macro-with-zend_fetch_re.patch | 117 + ...ISTER_RESOURCE-with-zend_register_re.patch | 66 + ...ETURN_STRINGL-takes-only-2-arguments.patch | 34 + ...nd_hash_find-with-zend_hash_str_find.patch | 125 + .../0010-Replace-dio_convert_to_long.patch | 240 + ...dopt-to-changed-stream-API-interface.patch | 89 + ...cient-macros-TSRMLS_CC-and-TSRMLS_DC.patch | 829 + .../0013-Fix-tests-for-legacy-interface.patch | 69 + ...ges-from-changed-stream-API-interfac.patch | 54 + .../patches/0015-Add-.gitignore.patch | 48 + .../0016-Add-additional-baudrates.patch | 44 + lang/php7-pecl-http/Makefile | 46 + .../patches/100_config9-m4.patch | 22 + lang/php7-pecl-libevent/Makefile | 38 + .../patches/010-libevent2.patch | 16 + lang/php7-pecl-propro/Makefile | 43 + lang/php7-pecl-raphf/Makefile | 43 + lang/php7/Makefile | 593 + lang/php7/files/php.ini | 152 + lang/php7/files/php7-fastcgi.config | 3 + lang/php7/files/php7-fastcgi.init | 29 + lang/php7/files/php7-fpm-www.conf | 392 + lang/php7/files/php7-fpm.conf | 121 + lang/php7/files/php7-fpm.config | 2 + lang/php7/files/php7-fpm.init | 28 + ...-use-of-the-system-timezone-database.patch | 673 + .../patches/0016-dont-gitclean-in-build.patch | 19 + .../patches/0032-Use-system-timezone.patch | 43 + ...ove-build-timestamps-from-generated-.patch | 131 + ...ation-icon-to-not-expose-the-reader-.patch | 25 + ...fix_membar_producer_link_error_gcc3x.patch | 11 + ...xt-opcache-fix-detection-of-shm-mmap.patch | 159 + lang/php7/patches/1002-gd-iconv.patch | 14 + .../1003-Fix-dl-cross-compiling-issue.patch | 59 + .../patches/1004-disable-phar-command.patch | 32 + lang/php7/pecl.mk | 44 + lang/pillow/Makefile | 53 + lang/pillow/patches/010-fix-paths.patch | 182 + lang/python-attrs/Makefile | 47 + lang/python-cffi/Makefile | 57 + lang/python-crcmod/Makefile | 50 + lang/python-crypto/Makefile | 54 + .../patches/001-no-host-paths.patch | 11 + .../patches/002-fix-endianness-detect.patch | 13 + lang/python-cryptography/Makefile | 53 + lang/python-dateutil/Makefile | 48 + lang/python-dns/Makefile | 46 + lang/python-egenix-mx-base/Makefile | 55 + lang/python-enum34/Makefile | 51 + .../python-enum34/patches/001-omit-docs.patch | 19 + lang/python-gmpy/Makefile | 44 + lang/python-gmpy2/Makefile | 49 + lang/python-idna/Makefile | 48 + lang/python-ipaddress/Makefile | 44 + lang/python-ldap/Makefile | 59 + lang/python-ldap/patches/010-setup_cfg.patch | 16 + lang/python-mysql/Makefile | 50 + .../python-mysql/patches/010-threadsafe.patch | 11 + lang/python-packages/Makefile | 131 + lang/python-packages/README.md | 72 + lang/python-parsley/Makefile | 43 + .../patches/001-omit-tests.patch | 12 + lang/python-pcapy/Makefile | 47 + lang/python-pip/Makefile | 76 + lang/python-pip/files/pip.conf | 3 + lang/python-ply/Makefile | 58 + lang/python-psycopg2/Makefile | 55 + lang/python-pyasn1-modules/Makefile | 46 + lang/python-pyasn1/Makefile | 48 + lang/python-pycparser/Makefile | 59 + .../patches/001-use-external-ply.patch | 41 + lang/python-pyopenssl/Makefile | 45 + lang/python-pyptlib/Makefile | 46 + lang/python-pyserial/Makefile | 50 + lang/python-service-identity/Makefile | 46 + lang/python-setuptools/Makefile | 78 + .../patches/0001-remove-windows-support.patch | 20 + .../0002-fix-pyvenv-environment-get.patch | 13 + lang/python-six/Makefile | 48 + lang/python-txsocksx/Makefile | 49 + .../patches/001-omit-tests.patch | 11 + .../patches/002-do-not-use-vcversioner.patch | 29 + lang/python-urllib3/Makefile | 49 + lang/python-yaml/Makefile | 43 + lang/python/Makefile | 253 + lang/python/files/config.site | 12 + lang/python/files/python-host.mk | 80 + lang/python/files/python-package-codecs.mk | 23 + lang/python/files/python-package-compiler.mk | 16 + lang/python/files/python-package-ctypes.mk | 18 + lang/python/files/python-package-db.mk | 18 + lang/python/files/python-package-decimal.mk | 16 + lang/python/files/python-package-dev.mk | 27 + lang/python/files/python-package-distutils.mk | 16 + lang/python/files/python-package-email.mk | 16 + lang/python/files/python-package-gdbm.mk | 16 + lang/python/files/python-package-lib2to3.mk | 18 + lang/python/files/python-package-logging.mk | 16 + .../files/python-package-multiprocessing.mk | 17 + lang/python/files/python-package-ncurses.mk | 18 + lang/python/files/python-package-openssl.mk | 17 + lang/python/files/python-package-pydoc.mk | 18 + lang/python/files/python-package-sqlite3.mk | 17 + lang/python/files/python-package-unittest.mk | 16 + lang/python/files/python-package-xml.mk | 20 + lang/python/files/python-package.mk | 135 + lang/python/files/python-version.mk | 10 + lang/python/patches/001-enable-zlib.patch | 25 + ...dd-include-dirs-when-cross-compiling.patch | 14 + .../003-do-not-compile-tests-at-build.patch | 20 + .../004-do-not-write-bytes-codes.patch | 22 + .../005-fix-libffi-x86-64-configure.patch | 31 + .../006-remove-debian-multiarch-support.patch | 14 + .../007-distutils-do-not-adjust-path.patch | 10 + .../008-distutils-use-python-sysroot.patch | 54 + ...t-use-dblib_dir-when-cross-compiling.patch | 34 + ...add-rt-lib-dirs-when-cross-compiling.patch | 15 + .../patches/011-do-not-prefer-ncursesw.patch | 15 + lang/python3-bottle/Makefile | 51 + lang/python3-pip/Makefile | 61 + .../0001-remove-self-version-checking.patch | 70 + lang/python3-setuptools/Makefile | 61 + .../patches/0001-remove-windows-support.patch | 20 + .../0002-fix-pyvenv-environment-get.patch | 13 + lang/python3/Makefile | 249 + lang/python3/files/config.site | 12 + lang/python3/files/python3-package-asyncio.mk | 16 + lang/python3/files/python3-package-codecs.mk | 22 + lang/python3/files/python3-package-ctypes.mk | 18 + lang/python3/files/python3-package-dbm.mk | 17 + lang/python3/files/python3-package-decimal.mk | 17 + lang/python3/files/python3-package-dev.mk | 25 + .../files/python3-package-distutils.mk | 16 + lang/python3/files/python3-package-email.mk | 16 + lang/python3/files/python3-package-gdbm.mk | 16 + lang/python3/files/python3-package-lib2to3.mk | 16 + lang/python3/files/python3-package-logging.mk | 16 + lang/python3/files/python3-package-lzma.mk | 17 + .../files/python3-package-multiprocessing.mk | 17 + lang/python3/files/python3-package-ncurses.mk | 18 + lang/python3/files/python3-package-openssl.mk | 17 + lang/python3/files/python3-package-pydoc.mk | 18 + lang/python3/files/python3-package-sqlite3.mk | 17 + .../python3/files/python3-package-unittest.mk | 16 + lang/python3/files/python3-package-xml.mk | 19 + lang/python3/files/python3-package.mk | 129 + lang/python3/patches/001-enable-zlib.patch | 25 + ...dd-include-dirs-when-cross-compiling.patch | 14 + .../003-do-not-run-distutils-tests.patch | 46 + .../004-do-not-write-bytes-codes.patch | 22 + .../005-fix-libffi-x86-64-configure.patch | 31 + .../006-remove-debian-multiarch-support.patch | 12 + .../007-distutils-do-not-adjust-path.patch | 10 + ...add-rt-lib-dirs-when-cross-compiling.patch | 15 + .../patches/011-do-not-prefer-ncursesw.patch | 15 + .../012-disable-wcsftime-detection.patch | 13 + .../014-remove-platform-so-suffix.patch | 26 + .../patches/015-abort-on-failed-modules.patch | 12 + lang/pytz/Makefile | 48 + lang/rcssmin/Makefile | 57 + lang/ruby/Makefile | 750 + lang/ruby/files/ruby | 5 + .../001-acinclude.m4_rename_aclocal.m4.patch | 152 + lang/ruby/ruby_find_pkgsdeps | 266 + lang/ruby/ruby_missingfiles | 28 + lang/simplejson/Makefile | 48 + lang/tcl/Makefile | 73 + .../100-disable_tzdata_and_msgs_install.patch | 22 + lang/tcl/patches/200-fix_mips_build.patch | 20 + lang/twisted/Makefile | 58 + .../patches/001-fix-zsh-completion.patch | 10 + lang/twisted/patches/002-omit-tests.patch | 41 + lang/uuid/Makefile | 51 + lang/vala/Makefile | 93 + lang/zope-interface/Makefile | 56 + libs/alsa-lib/Makefile | 91 + libs/alsa-lib/patches/001-link_fix.patch | 22 + ...5-fix_include_file_redirect_warnings.patch | 142 + libs/apr-util/Makefile | 82 + .../patches/001-automake-compat.patch | 21 + libs/apr/Makefile | 79 + libs/apr/patches/001-autoconf-compat.patch | 26 + libs/apr/patches/101-fix_apr_time_now.patch | 13 + .../patches/201-upgrade-and-fix-1.5.1.patch | 51 + libs/avahi/Makefile | 406 + libs/avahi/files/avahi-daemon.conf | 28 + libs/avahi/files/avahi-daemon.init | 23 + libs/avahi/files/netifd-autoip.sh | 20 + libs/avahi/files/service-http | 10 + libs/avahi/files/service-ssh | 9 + .../010-step_back_autotools-no-gettext.patch | 80 + .../011-fix-poll-h-warnings-on-musl.patch | 65 + libs/avro/Makefile | 56 + libs/boost/Makefile | 459 + libs/boost/patches/01_fiber_fix.patch | 25 + libs/c-ares/Makefile | 54 + libs/check/Makefile | 61 + libs/classpath/Makefile | 90 + .../patches/010-double-memleak.patch | 91 + libs/confuse/Makefile | 79 + libs/cyrus-sasl/Makefile | 112 + libs/db47/Makefile | 100 + libs/db47/patches/010-patch.4.7.25.1.patch | 55 + libs/db47/patches/020-patch.4.7.25.2.patch | 42 + libs/db47/patches/030-patch.4.7.25.3.patch | 211 + libs/db47/patches/040-patch.4.7.25.4.patch | 118 + .../patches/100-repmgr-format-security.patch | 11 + libs/dmx_usb_module/Makefile | 56 + .../patches/001-dmx_usb_Makefile.patch | 13 + libs/dtndht/Makefile | 46 + libs/dtndht/patches/001-musl_header.patch | 30 + libs/elektra/Makefile | 409 + libs/expat/Makefile | 69 + libs/faad2/Config.in | 12 + libs/faad2/Makefile | 114 + libs/fcgi/Makefile | 82 + .../fcgi/patches/100-fcgio-int-type-fix.patch | 38 + libs/fcgi/patches/110-no_examples.patch | 24 + libs/fcgi/patches/120-stdio.patch | 12 + libs/fftw3/Makefile | 119 + libs/fftw3/patches/001-makefile.patch | 20 + libs/file/Makefile | 97 + libs/flac/Makefile | 75 + .../patches/001-no-docs-and-examples.patch | 25 + libs/flac/patches/002-no-utility.patch | 13 + libs/flac/patches/005-gcc_debug_options.patch | 17 + libs/flac/patches/010-automake-compat.patch | 11 + .../020-fix-musl-sigemptyset-x86.patch | 11 + libs/freetype/Makefile | 84 + libs/gdbm/Makefile | 69 + libs/giflib/Makefile | 60 + libs/giflib/patches/100-no-docs.patch | 10 + libs/glib2/Makefile | 109 + libs/glib2/patches/001-automake-compat.patch | 11 + ...ppress-string-format-literal-warning.patch | 24 + libs/glpk/Makefile | 66 + libs/gnutls/Config.in | 56 + libs/gnutls/Makefile | 246 + libs/gperf/Makefile | 47 + libs/hidapi/Makefile | 77 + .../patches/010-add-iconv-linkage.patch | 22 + libs/hiredis/Makefile | 55 + libs/ibrcommon/Makefile | 49 + .../patches/001-fix-build-with-musl.patch | 23 + libs/ibrdtn/Makefile | 50 + libs/icu/Makefile | 93 + .../000-dont-cpy-files-from-topdirs.patch | 12 + libs/intltool/Makefile | 40 + .../100-optional-perl-xml-parser.patch | 22 + libs/jansson/Makefile | 52 + libs/ldns/Makefile | 84 + .../patches/001-perl5-defined-array.patch | 11 + libs/libaio/Makefile | 63 + libs/libaio/patches/001_arches.patch | 566 + libs/libaio/patches/002_arches_sh.patch | 139 + libs/libaio/patches/003_arches_sparc64.patch | 117 + libs/libaio/patches/004_arches_x32.patch | 65 + libs/libaio/patches/005_arches_mips.patch | 63 + .../patches/006_arches_mips_fix_padding.patch | 37 + libs/libantlr3c/Makefile | 55 + libs/libao/Makefile | 67 + libs/libarchive/Makefile | 97 + libs/libartnet/Makefile | 60 + libs/libartnet/patches/001-bswap_16.patch | 12 + libs/libaudiofile/Makefile | 71 + libs/libavl/Makefile | 55 + .../patches/010-update_GNUmakefile.patch | 45 + libs/libcanfestival/Makefile | 69 + .../patches/001-sigval-ref-fix.patch | 11 + .../patches/002-makefile-gcc-linker.patch | 33 + .../patches/003-makefile-skip-examples.patch | 20 + libs/libcap/Makefile | 56 + libs/libcap/patches/100-portability.patch | 19 + libs/libcoap/Makefile | 62 + libs/libdaemon/Makefile | 72 + .../patches/001-daemon_set_verbosity.patch | 30 + libs/libdaq/Makefile | 74 + libs/libdaq/patches/001-compile.patch | 18 + libs/libdaq/patches/100-musl-compat.patch | 42 + libs/libdbi-drivers/Makefile | 105 + .../patches/001_libsqlite3_fix.patch | 11 + libs/libdbi/Makefile | 57 + libs/libdmapsharing/Makefile | 72 + .../patches/001-disable_pixbuf.patch | 22 + .../patches/002-disable_tests.patch | 8 + .../patches/003-make_unit_test_optional.patch | 17 + libs/libdnet/Makefile | 89 + libs/libdnet/patches/001-compile.patch | 20 + libs/libdnet/patches/002-config.patch | 23 + libs/libdouble-conversion/Makefile | 68 + libs/libdrm/Makefile | 69 + .../000-remove-dep-on-pthread-stubs.patch | 101 + libs/libedit/Makefile | 54 + libs/libesmtp/Makefile | 55 + libs/libestr/Makefile | 53 + libs/libev/Makefile | 59 + libs/libevdev/Makefile | 57 + ...010-no-clock-monotonic-raw-in-uclibc.patch | 14 + libs/libevent/Makefile | 67 + libs/libevhtp/Makefile | 51 + .../patches/010-strcmp-endianness-fix.patch | 49 + libs/libexif/Makefile | 63 + libs/libexif/patches/100-no_doc.patch | 12 + libs/libextractor/Makefile | 140 + .../001-backport-support-for-giflib-5-1.patch | 26 + libs/libfastjson/Makefile | 55 + libs/libffi/Makefile | 82 + .../patches/002-fix-toolexeclibdir-path.patch | 31 + .../patches/100-fix_mips_softfloat.patch | 176 + libs/libftdi/Makefile | 64 + .../patches/100-fix-x86_64-build.patch | 11 + .../101-fix-cmake-version-packagekit.patch | 29 + .../102-fix-cmake-include-examples.patch | 11 + libs/libftdi1/Makefile | 93 + .../patches/100-fix-x86_64-build.patch | 11 + libs/libgcrypt/Makefile | 68 + .../libgcrypt/patches/001-no_docs_tests.patch | 28 + libs/libgd/Makefile | 81 + libs/libgd/patches/101-gdlib-config.patch | 20 + libs/libgd/patches/200-uclibc-ceill.patch | 24 + libs/libgee/Makefile | 73 + .../libgee-0.18.0-no-introspection.patch | 101 + libs/libgpg-error/Makefile | 79 + libs/libgpg-error/patches/001-gcc5.patch | 54 + libs/libhttp-parser/Makefile | 60 + libs/libical/Makefile | 62 + libs/libid3tag/Makefile | 65 + libs/libidn/Makefile | 95 + .../002-disable-po-docs-examples.patch | 22 + .../patches/010-fix-idn-error-usage.patch | 119 + libs/libimobiledevice/Makefile | 96 + libs/libinput/Makefile | 63 + libs/libinput/patches/001-no-locale.patch | 22 + libs/libinput/patches/002-static_assert.patch | 14 + libs/libjpeg/Makefile | 91 + libs/liblo/Makefile | 70 + libs/liblo/patches/001-fix-musl-include.patch | 11 + libs/liblz4/Makefile | 58 + libs/libmad/Makefile | 79 + .../001-mips_removal_h_constraint.patch | 70 + libs/libmcrypt/Makefile | 65 + libs/libmicrohttpd/Makefile | 94 + libs/libmms/Makefile | 63 + libs/libmodbus/Makefile | 56 + libs/libmpdclient/Makefile | 69 + libs/libmpeg2/Makefile | 60 + .../libmpeg2/patches/101-ppc_no_altivec.patch | 66 + .../patches/102-arm_data_preload_check.patch | 19 + libs/libnatpmp/Makefile | 87 + .../patches/001-install_declspec.patch | 11 + libs/libnet-1.2.x/Makefile | 71 + .../patches/100-musl-compat.patch | 16 + libs/libnetfilter-acct/Makefile | 70 + libs/libnopoll/Makefile | 58 + libs/libogg/Makefile | 59 + libs/liboil/Makefile | 70 + libs/liboping/Makefile | 84 + libs/liboping/patches/01-no-werror.patch | 11 + libs/libowfat/Makefile | 61 + libs/libowfat/patches/001-fixbuild.patch | 11 + libs/libp11/Makefile | 61 + libs/libp11/patches/001-fix-install.patch | 69 + libs/libpam/Makefile | 73 + libs/libpam/files/pam.conf | 15 + libs/libpam/files/pam.d/common-account | 20 + libs/libpam/files/pam.d/common-auth | 21 + libs/libpam/files/pam.d/common-password | 28 + libs/libpam/files/pam.d/common-session | 25 + .../files/pam.d/common-session-noninteractive | 25 + libs/libpam/files/pam.d/other | 16 + ...uild-always-use-lib-instead-of-lib64.patch | 36 + ..._rhosts-if-neither-ruserok-nor-ruser.patch | 77 + ..._lastlog-when-logwtmp-is-not-availab.patch | 60 + ...when-crypt-is-not-part-of-crypt_libs.patch | 28 + .../patches/0005-build-fix-doc-build.patch | 133 + ...pilation-in-case-rpc-rpc.h-is-missin.patch | 29 + ...innetgr-is-available-at-compile-time.patch | 106 + libs/libplist/Makefile | 105 + libs/libpng/Makefile | 68 + libs/libpng/patches/100-config_fix.patch | 10 + libs/libradcli/Config.in | 10 + libs/libradcli/Makefile | 75 + libs/libsamplerate/Makefile | 55 + libs/libsearpc/Makefile | 64 + libs/libseccomp/Makefile | 74 + ...100-dont-use-linux-prctl.h-with-musl.patch | 14 + libs/libshout/Makefile | 92 + libs/libshout/patches/120-vorbis-c.patch | 11 + .../patches/140-no_example_doc_win32.patch | 17 + libs/libsigc++/Makefile | 63 + .../patches/001-no_doc_tests_examples.patch | 22 + libs/libsndfile/Makefile | 65 + libs/libsodium/Makefile | 72 + libs/libsoup/Makefile | 78 + libs/libsoxr/Makefile | 65 + libs/libssh2/Makefile | 58 + libs/libstrophe/Config.in | 14 + libs/libstrophe/Makefile | 66 + libs/libtalloc/Makefile | 112 + libs/libtasn1/Makefile | 59 + libs/libtheora/Makefile | 68 + .../libtheora/patches/001-no_docs_tests.patch | 33 + libs/libtheora/patches/002-no_sdl_check.patch | 14 + libs/libtorrent/Makefile | 69 + .../patches/100-fix_cross_compile.patch | 41 + libs/libuecc/Makefile | 47 + libs/libugpio/Makefile | 72 + libs/libunistring/Makefile | 59 + libs/libupnp/Makefile | 76 + libs/libupnpp/Makefile | 51 + libs/liburcu/Makefile | 53 + libs/libusbmuxd/Makefile | 90 + libs/libuv/Makefile | 73 + libs/libuvc/Makefile | 53 + libs/libv4l/Makefile | 116 + .../patches/020-add-missing-includes.patch | 28 + .../patches/030-dont-call-getsubopt.patch | 28 + libs/libvorbis/Makefile | 65 + libs/libvorbisidec/Makefile | 62 + libs/libvpx/Makefile | 82 + libs/libx264/Makefile | 83 + libs/libxerces-c/Makefile | 91 + libs/libxml2/Makefile | 139 + libs/libxslt/Makefile | 152 + libs/libzdb/Makefile | 89 + .../patches/010-cross-compile-fixes.patch | 186 + .../020-filterh-use-host-built-version.patch | 20 + libs/lttng-ust/Makefile | 51 + .../lttng-ust/patches/001-no_docs_tests.patch | 11 + libs/lttng-ust/patches/002-examples.patch | 18 + libs/mtdev/Makefile | 56 + libs/mxml/Makefile | 56 + libs/mxml/patches/001-targets.patch | 11 + libs/nacl/Makefile | 49 + libs/nacl/do-openwrt | 206 + libs/neon/Makefile | 78 + libs/openldap/Makefile | 151 + libs/openldap/files/ldap.init | 19 + .../patches/001-automake-compat.patch | 323 + .../patches/002-no-doc-and-tests-subdir.patch | 5 + libs/openldap/patches/020-autofs-schema.patch | 26 + libs/openldap/patches/750-no-strip.patch | 22 + libs/opus/Makefile | 68 + libs/p11-kit/Makefile | 59 + libs/p11-kit/files/opensc.module | 1 + libs/pcre/Makefile | 101 + libs/poco/Makefile | 64 + libs/poco/patches/100-configure.patch | 15 + libs/poco/patches/200-strerror.patch | 11 + libs/postgresql/Makefile | 231 + libs/postgresql/files/postgresql.config | 2 + libs/postgresql/files/postgresql.init | 78 + libs/postgresql/files/postgresql.sh | 60 + .../patches/001-configure_fixes.patch | 11 + libs/postgresql/patches/200-ranlib.patch | 10 + .../patches/800-busybox-default-pager.patch | 13 + .../patches/900-pg_ctl-setuid.patch | 109 + libs/protobuf-c/Makefile | 62 + libs/protobuf/Makefile | 78 + .../protobuf/patches/001-mipseb-compile.patch | 11 + .../patches/003-mips2andHigher-compile.patch | 11 + libs/pthsem/Makefile | 68 + libs/pthsem/patches/001-linux3x-fix.patch | 12 + libs/pthsem/patches/002-fix-signal.h | 22 + libs/qrencode/Makefile | 90 + libs/qrencode/patches/001-disable-png.patch | 306 + libs/quasselc/Makefile | 64 + .../patches/001-respect-cflags-ldflags.patch | 18 + libs/sbc/Makefile | 57 + libs/speex/Makefile | 105 + libs/sqlite3/Makefile | 107 + libs/tcp_wrappers/Makefile | 69 + .../patches/001-debian_subset.patch | 936 + .../tcp_wrappers/patches/002-opt_cflags.patch | 12 + .../patches/003-scaffold_malloc.patch | 17 + .../patches/004-ipv4_prefix.patch | 72 + .../patches/005-no--lnsl-on-musl.patch | 22 + libs/tdb/Makefile | 56 + libs/tdb/patches/001-printf-fix.patch | 41 + libs/tiff/Makefile | 109 + libs/tiff/patches/001-autoconf-compat.patch | 33 + .../002-CVE-2015-8665_and_CVE-2015-8683.patch | 136 + ...-of-bound_writes_in_decode_functions.patch | 193 + ...ial_out-of-bound_write_in_NeXTDecode.patch | 72 + libs/tiff/patches/005-fix-ftell-macro.patch | 11 + libs/tinycdb/Makefile | 39 + libs/tinycdb/patches/100-Makefile.patch | 25 + libs/unixodbc/Makefile | 117 + libs/unixodbc/files/unixodbc_conf.h | 22 + libs/vips/Makefile | 82 + libs/vips/patches/001-no_cpp.patch | 154 + libs/xmlrpc-c/Makefile | 226 + libs/xmlrpc-c/patches/001-config.mk.in.patch | 11 + .../patches/002-automake-compat.patch | 13 + libs/xr_usb_serial_common/Makefile | 41 + libs/yajl/Makefile | 59 + .../100-link-reformatter-uclibc-libm.patch | 11 + .../patches/101-link-perf-uclibc-libm.patch | 8 + libs/yaml/Makefile | 51 + libs/zmq/Makefile | 93 + ...sable_pedantic_on_linux_with_ulibc++.patch | 14 + ...0-map_with_const_string_with_ublic++.patch | 41 + .../030-streamoff_missing_with_ulibc++.patch | 10 + .../040-fix_GNUC_conditional_for_GCC5.patch | 11 + .../patches/100-fix-cxx-include-order.patch | 84 + mail/alpine/Makefile | 123 + .../100-no-openssl-check-cross-compile.patch | 29 + mail/bogofilter/Makefile | 58 + mail/bogofilter/files/postfix-bogofilter | 43 + mail/emailrelay/Makefile | 116 + mail/emailrelay/files/emailrelay.auth | 16 + mail/emailrelay/files/emailrelay.init | 15 + mail/emailrelay/patches/010-ssl3-fix.patch | 13 + mail/fdm/Config.in | 10 + mail/fdm/Makefile | 86 + mail/fdm/files/etc/fdm.conf | 36 + mail/fdm/patches/001-base64-fix.patch | 14 + mail/fdm/patches/002-base64-fix.patch | 20 + mail/fdm/patches/010-musl_WAIT_ANY.patch | 13 + mail/fdm/patches/020-musl_GLOB_BRACE.patch | 22 + mail/fdm/patches/030-musl_ACCESSPERMS.patch | 11 + mail/fdm/src/compat/b64_ntop.c | 183 + mail/fdm/src/compat/b64_pton.c | 393 + mail/mailman/Makefile | 126 + mail/mailman/files/mailman.init | 22 + mail/mailman/patches/100-postfix.patch | 12 + .../mailman/patches/200-nohostdnspython.patch | 68 + mail/mailman/patches/300-targetpython.patch | 12 + mail/mailman/patches/400-modules.patch | 35 + mail/mailsend/Makefile | 73 + mail/msmtp-scripts/Makefile | 141 + mail/msmtp-scripts/files/msmtpq-ng-mta.init | 17 + mail/msmtp-scripts/files/msmtpq-ng.rc | 18 + mail/msmtp/Makefile | 147 + mail/mutt/Makefile | 54 + mail/mutt/patches/0001-no-po-and-docs.patch | 27 + mail/mutt/patches/100-CVE-2014-9116.patch | 31 + mail/postfix/Makefile | 267 + mail/postfix/files/main.cf.default | 856 + mail/postfix/files/postfix.init | 81 + mail/postfix/patches/100-fsstat.patch | 12 + mail/postfix/patches/200-manpages.patch | 80 + .../patches/300-bdb_hash_segfault.patch | 14 + mail/postfix/patches/400-cdb.patch | 14 + mail/postfix/patches/500-crosscompile.patch | 27 + mail/postfix/patches/600-nopostconf.patch | 44 + mail/postfix/patches/700-defaultconfig.patch | 93 + mail/postfix/patches/800-fmt.patch | 12 + mail/ssmtp/Makefile | 59 + mail/ssmtp/patches/002-fix_pointer.patch | 466 + .../patches/004-remove_dead-letter.patch | 94 + mail/ssmtp/patches/006-add_ip-header.patch | 21 + mail/ssmtp/patches/008-remove_garbage.patch | 18 + .../patches/010-fix_message-header.patch | 92 + multimedia/crtmpserver/Makefile | 98 + multimedia/crtmpserver/files/crtmpserver.init | 30 + .../patches/010-link-crypt-for-lua.patch | 11 + .../crtmpserver/patches/020-add-rpath.patch | 13 + .../patches/030-default-config.patch | 51 + .../crtmpserver/patches/040-use-select.patch | 11 + .../050-add-missing-make-defines.patch | 41 + .../patches/060-add-missing-includes.patch | 26 + .../patches/070-missing-include-gcc-47.patch | 10 + .../patches/080-disable-apple-streaming.patch | 12 + .../patches/080-musl-uint32_t.patch | 91 + multimedia/ffmpeg/Config.in | 477 + multimedia/ffmpeg/Makefile | 644 + multimedia/fswebcam/Makefile | 50 + multimedia/grilo-plugins/Makefile | 89 + ...1-dmap-Add-album-disc-number-mapping.patch | 58 + multimedia/grilo/Makefile | 75 + multimedia/grilo/files/grilo-0.3.vapi | 1033 + multimedia/grilo/files/grilo-net-0.3.vapi | 43 + multimedia/gst1-libav/Config.in | 279 + multimedia/gst1-libav/Makefile | 198 + multimedia/gst1-plugins-bad/Makefile | 277 + .../patches/001-no-translations.patch | 26 + .../patches/002-no-tests.patch | 57 + multimedia/gst1-plugins-base/Makefile | 291 + .../patches/001-no-translations.patch | 28 + .../patches/002-no-tests.patch | 44 + .../patches/003-no-docs.patch | 30 + multimedia/gst1-plugins-good/Makefile | 237 + .../patches/001-no-translations.patch | 20 + .../patches/002-no-tests.patch | 34 + .../patches/003-no-docs.patch | 22 + multimedia/gst1-plugins-ugly/Makefile | 177 + .../patches/001-no-translations.patch | 23 + .../patches/002-no-tests.patch | 23 + .../patches/003-no-docs.patch | 23 + multimedia/gstreamer1/Makefile | 237 + .../patches/001-no-translations.patch | 28 + .../gstreamer1/patches/002-no-tests.patch | 44 + .../gstreamer1/patches/003-no-docs.patch | 39 + ...10-gstplugin-use-lazy-symbol-binding.patch | 20 + multimedia/icecast/Makefile | 96 + multimedia/icecast/files/icecast.init | 23 + multimedia/icecast/libvorbisidec.mk | 41 + .../patches/001-icecast-2.4.0-tremor.patch | 155 + .../patches/010-fix_libcurl_test_crap.patch | 11 + .../020-icecast_config_for_openwrt.patch | 25 + multimedia/ices/Makefile | 51 + multimedia/minidlna/Makefile | 85 + multimedia/minidlna/files/minidlna.config | 17 + multimedia/minidlna/files/minidlna.init | 97 + .../minidlna/patches/010-libav-fix.patch | 19 + multimedia/mjpg-streamer/Config.in | 36 + multimedia/mjpg-streamer/Makefile | 112 + .../mjpg-streamer/files/mjpg-streamer.config | 15 + .../mjpg-streamer/files/mjpg-streamer.hotplug | 10 + .../mjpg-streamer/files/mjpg-streamer.init | 97 + .../patches/005-musl_compatibility.patch | 13 + .../010-enable_additional_plugins.patch | 17 + .../020-remove_gcc_debug_options.patch | 33 + .../030-allow_16_char_device_names.patch | 11 + ...used-variable-from-struct-v4l2_buffe.patch | 87 + ...-leaking-data-via-struct-v4l2_buffer.patch | 242 + .../patches/050-fix-yuv-capture.patch | 58 + .../patches/060-fix-sigtrap-in-v4l2uvc.patch | 11 + multimedia/motion/Makefile | 58 + .../motion/patches/100-musl-compat.patch | 49 + multimedia/oggfwd/Makefile | 50 + multimedia/tvheadend/Config.in | 17 + multimedia/tvheadend/Makefile | 98 + multimedia/tvheadend/files/tvheadend.config | 13 + multimedia/tvheadend/files/tvheadend.init | 71 + multimedia/xupnpd/Makefile | 75 + multimedia/xupnpd/files/xupnpd.init | 15 + .../xupnpd/patches/100-default_config.patch | 15 + .../xupnpd/patches/101-root_dir_param.patch | 83 + multimedia/youtube-dl/Makefile | 45 + net/acme/Makefile | 97 + net/acme/files/acme-cbi.lua | 65 + net/acme/files/acme-controller.lua | 7 + net/acme/files/acme.config | 11 + net/acme/files/acme.init | 34 + net/acme/files/run.sh | 181 + net/acme/files/uci-defaults-acme | 11 + net/adblock/Makefile | 69 + net/adblock/files/README.md | 268 + net/adblock/files/adblock-helper.sh | 753 + net/adblock/files/adblock-update.sh | 278 + net/adblock/files/adblock.blacklist | 0 net/adblock/files/adblock.conf | 150 + net/adblock/files/adblock.hotplug | 24 + net/adblock/files/adblock.init | 173 + net/adblock/files/adblock.whitelist | 0 net/adblock/files/www/adblock/index.html | 8 + net/addrwatch/Makefile | 52 + net/addrwatch/files/addrwatch.config | 12 + net/addrwatch/files/addrwatch.init | 74 + .../patches/001-fix-sys_siglist.patch | 32 + .../patches/002-fix-uclibc-sysconf.patch | 11 + net/aggregate/Makefile | 47 + net/aircrack-ng/Makefile | 74 + net/announce/Makefile | 57 + net/apache/Makefile | 165 + net/apache/patches/001-Makefile_in.patch | 14 + net/apache/patches/002-test_char_h.patch | 26 + net/apache/patches/003-logdir_fix.patch | 33 + net/apache/patches/004-pidfile_fix.patch | 11 + net/apache/patches/005-httpd_conf.patch | 60 + net/apache/patches/006-remove-ssl3.patch | 13 + net/apcupsd/Makefile | 106 + net/apcupsd/files/apccontrol | 146 + net/apcupsd/files/apcupsd.conf | 322 + net/apcupsd/files/apcupsd.css | 64 + net/apcupsd/files/apcupsd.init | 12 + net/apcupsd/files/apcupsd_mail.conf | 7 + net/apcupsd/files/changeme | 17 + net/apcupsd/files/commfailure | 17 + net/apcupsd/files/commok | 17 + net/apcupsd/files/hosts.conf | 19 + net/apcupsd/files/multimon.conf | 63 + net/apcupsd/files/offbattery | 17 + net/apcupsd/files/onbattery | 17 + net/apcupsd/patches/010-fix-usb.patch | 8 + net/apinger/Makefile | 67 + net/apinger/files/apinger.init | 18 + net/apinger/patches/001-autoreconf.patch | 13 + net/apinger/patches/002-run_as_user.patch | 11 + net/apinger/patches/003-no_docs.patch | 11 + net/aria2/Config.in | 45 + net/aria2/Makefile | 81 + net/aria2/files/aria2.conf | 10 + net/aria2/files/aria2.init | 112 + net/arp-scan/Makefile | 47 + net/arp-scan/patches/001-cross_compile.patch | 10 + net/atftp/Makefile | 57 + .../01-missing-u_char-type-patch.patch | 13 + ...ix-invalid-read-in-tftp_send_request.patch | 13 + ...ix-undefined-reference-linker-errors.patch | 55 + net/autossh/Makefile | 52 + net/autossh/files/autossh.config | 5 + net/autossh/files/autossh.hotplug | 14 + net/autossh/files/autossh.init | 30 + net/bcp38/Makefile | 62 + net/bcp38/files/bcp38.config | 22 + net/bcp38/files/bcp38.defaults | 13 + net/bcp38/files/run.sh | 104 + net/bind/Config.in | 17 + net/bind/Makefile | 220 + net/bind/files/bind/db.0 | 12 + net/bind/files/bind/db.127 | 13 + net/bind/files/bind/db.255 | 12 + net/bind/files/bind/db.local | 13 + net/bind/files/bind/db.root | 90 + net/bind/files/bind/named.conf.example | 45 + net/bind/files/named.init | 35 + net/bind/patches/001-no-tests.patch | 26 + net/bind/patches/002-autoconf-ar-fix.patch | 31 + net/bmon/Makefile | 51 + net/bridge-utils/Makefile | 59 + .../patches/001-libbridge_cflags.patch | 11 + .../010-fix_struct_in6_addr_usage.patch | 10 + .../patches/100-musl-compat.patch | 11 + net/bwm-ng/Config.in | 35 + net/bwm-ng/Makefile | 61 + net/cgi-io/Makefile | 44 + net/cgi-io/src/CMakeLists.txt | 19 + net/cgi-io/src/main.c | 644 + net/cgi-io/src/multipart_parser.c | 309 + net/cgi-io/src/multipart_parser.h | 48 + net/chaosvpn/Makefile | 56 + net/chaosvpn/files/chaosvpn.hotplug | 3 + net/chaosvpn/files/chaosvpn.init | 31 + net/chrony/Makefile | 76 + net/chrony/files/chrony.conf | 7 + net/chrony/files/chrony.config | 14 + net/chrony/files/chrony.hotplug | 44 + net/chrony/files/chronyd.init | 76 + net/chrony/patches/001-freebind_uclibc.patch | 13 + net/cifs-utils/Makefile | 45 + .../patches/001-fix-musl-build.patch | 30 + net/clamav/Makefile | 120 + net/clamav/files/bytecode.cvd | Bin 0 -> 68662 bytes net/clamav/files/clamav.config | 34 + net/clamav/files/clamav.init | 116 + net/clamav/files/freshclam.config | 7 + net/clamav/files/freshclam.init | 63 + net/clamav/patches/001-compile.patch | 10 + net/coova-chilli/Config.in | 52 + net/coova-chilli/Makefile | 150 + net/coova-chilli/files/chilli.config | 233 + net/coova-chilli/files/chilli.firewall | 41 + net/coova-chilli/files/chilli.hotplug | 7 + net/coova-chilli/files/chilli.init | 61 + .../100-fix-sysinfo-redeclaration.patch | 24 + .../patches/200-fix_compile_kmod.patch | 17 + .../201-fix_dereferencing_pointers.patch | 49 + .../patches/300-fix-compile-with-cyassl.patch | 28 + .../patches/400-fix-compile-with-musl.patch | 61 + net/cshark/Makefile | 75 + net/ctorrent-svn/Makefile | 98 + .../patches/100-compile-fix.patch | 88 + net/ctorrent-svn/patches/300-negative.patch | 14 + .../patches/400-musl-compat.patch | 10 + net/ctorrent/Makefile | 84 + net/ctorrent/patches/100-CVE-2009-1759.patch | 364 + net/ctorrent/patches/100-negative-ints.patch | 13 + net/ctorrent/patches/200-musl-compat.patch | 10 + net/daemonlogger/Makefile | 47 + net/dansguardian/Makefile | 78 + net/dansguardian/files/dansguardian.config | 71 + net/dansguardian/files/dansguardian.init | 190 + net/dansguardian/files/dansguardianf1.conf | 348 + net/dansguardian/patches/001-compile.patch | 29 + net/darkstat/Makefile | 66 + net/darkstat/files/darkstat.config | 20 + net/darkstat/files/darkstat.init | 97 + .../patches/100-do-not-use-NI_IDN.patch | 12 + net/davfs2/Makefile | 71 + net/davfs2/files/davfs2.conf | 9 + net/davfs2/patches/010-main_code_fix.patch | 22 + net/davfs2/patches/100-musl-compat.patch | 194 + ...vfs2-1.5.4-no-forced-stack-protector.patch | 12 + net/ddns-scripts/Makefile | 364 + net/ddns-scripts/files/ddns.config | 32 + net/ddns-scripts/files/ddns.defaults | 99 + net/ddns-scripts/files/ddns.hotplug | 11 + net/ddns-scripts/files/ddns.init | 27 + .../files/dynamic_dns_functions.sh | 1357 + .../files/dynamic_dns_lucihelper.sh | 171 + net/ddns-scripts/files/dynamic_dns_updater.sh | 419 + net/ddns-scripts/files/services | 173 + net/ddns-scripts/files/services_ipv6 | 99 + .../files/update_cloudflare_com_v1.sh | 144 + .../files/update_cloudflare_com_v4.sh | 178 + .../files/update_godaddy_com_v1.sh | 163 + net/ddns-scripts/files/update_no-ip_com.sh | 52 + net/ddns-scripts/files/update_nsupdate.sh | 48 + net/ddns-scripts/samples/ddns.config_sample | 314 + net/ddns-scripts/samples/getlocalip_sample.sh | 35 + net/ddns-scripts/samples/update_sample.sh | 41 + net/ddns-scripts/tools/public_suffix_list.sh | 39 + net/dhcp-forwarder/Makefile | 74 + net/dhcp-forwarder/files/dhcp-fwd.init | 25 + net/dhcpcd/Makefile | 63 + net/dhcpcd/files/dhcpcd.init | 24 + net/dhcpcd/patches/001-fix-musl.patch | 13 + net/dmapd/Makefile | 66 + net/dmapd/files/dmapd.init | 28 + net/dmapd/patches/001-dmapd_conf.patch | 11 + .../002-make_unit_test_optionnal.patch | 17 + net/dnscrypt-proxy/Makefile | 117 + .../files/dnscrypt-proxy.config | 17 + net/dnscrypt-proxy/files/dnscrypt-proxy.init | 34 + .../files/dnscrypt-resolvers.csv | 75 + net/e2guardian/Makefile | 83 + net/e2guardian/files/e2guardian.config | 69 + net/e2guardian/files/e2guardian.init | 212 + net/e2guardian/files/e2guardianf1.conf | 430 + net/esniper/Makefile | 42 + net/etherwake/Makefile | 55 + net/etherwake/files/etherwake.config | 28 + net/etherwake/files/etherwake.init | 132 + .../patches/100-no_ether_hostton.patch | 37 + .../patches/110-format_security_fix.patch | 19 + net/etherwake/patches/120-musl-compat.patch | 17 + net/ethtool/Config.in | 7 + net/ethtool/Makefile | 57 + net/fakeidentd/Makefile | 48 + net/fakeidentd/files/fakeidentd.init | 12 + net/fastd/Config.in | 114 + net/fastd/Makefile | 205 + net/fastd/files/fastd.upgrade | 1 + net/fossil/Makefile | 72 + net/fossil/files/fossil.config | 5 + net/fossil/files/fossil.init | 54 + net/fossil/patches/001-no_https.patch | 22 + net/freeradius2/Config.in | 14 + net/freeradius2/Makefile | 636 + net/freeradius2/files/radiusd.init | 29 + .../patches/001-fix-makefile.patch | 12 + net/freeradius2/patches/002-config.patch | 613 + .../patches/004-ldap_configure.patch | 4257 +++ .../patches/008-honor_ccpflags.patch | 17 + .../patches/010-disbale-openssl-check.patch | 40 + net/freeradius3/Config.in | 14 + net/freeradius3/Makefile | 606 + net/freeradius3/files/radiusd.init | 28 + net/fwknop/Config.in | 12 + net/fwknop/Makefile | 129 + net/fwknop/files/fwknopd | 9 + net/fwknop/files/fwknopd.init | 96 + net/git/Makefile | 145 + net/git/patches/200-disable_fasthash.patch | 12 + .../patches/300-configure_for_crosscompiling | 32 + .../patches/400-imapsend_without_curl.patch | 11 + net/gitolite/Makefile | 61 + .../patches/100-fix-missing-hooks-dir.patch | 27 + net/gnunet/Makefile | 431 + .../files/gnunet-dhtcache-heap.defaults | 8 + .../files/gnunet-dhtcache-pgsql.defaults | 8 + .../files/gnunet-dhtcache-sqlite.defaults | 11 + net/gnunet/files/gnunet-fs-heap.defaults | 8 + net/gnunet/files/gnunet-fs-pgsql.defaults | 8 + net/gnunet/files/gnunet-fs-sqlite.defaults | 11 + net/gnunet/files/gnunet-gns-flat.defaults | 16 + net/gnunet/files/gnunet-gns-pgsql.defaults | 10 + net/gnunet/files/gnunet-gns-sqlite.defaults | 16 + net/gnunet/files/gnunet-gns.defaults | 51 + .../files/gnunet-peerstore-flat.defaults | 11 + .../files/gnunet-peerstore-sqlite.defaults | 11 + net/gnunet/files/gnunet-pgsql.defaults | 9 + net/gnunet/files/gnunet-proto.sh | 51 + net/gnunet/files/gnunet-social-pgsql.defaults | 8 + .../files/gnunet-social-sqlite.defaults | 11 + net/gnunet/files/gnunet-vpn.defaults | 34 + net/gnunet/files/gnunet.defaults | 14 + net/gnunet/files/gnunet.init | 107 + net/gnunet/files/gnunet.upgrade | 1 + net/gnurl/Makefile | 122 + net/gnurl/patches/200-no_docs_tests.patch | 22 + net/haproxy/Makefile | 183 + net/haproxy/files/haproxy.cfg | 100 + net/haproxy/files/haproxy.hotplug | 8 + net/haproxy/files/haproxy.init | 25 + ...BUG-MINOR-Fix-OSX-compilation-errors.patch | 53 + ...ayed-PCRE-version-is-running-release.patch | 31 + ...3-MINOR-show-Built-with-PCRE-version.patch | 49 + ...4-MINOR-show-Running-on-zlib-version.patch | 25 + ...5-MINOR-Add-fe_req_rate-sample-fetch.patch | 66 + ...EDIUM-make-SO_REUSEPORT-configurable.patch | 134 + ...se-sess-and-not-s-sess-in-action_sto.patch | 29 + ...ake-smp_fetch_var-more-robust-agains.patch | 47 + ...mp_fetch_var-doesn-t-depend-on-HTTP-.patch | 31 + ...G-MINOR-ssl-Check-malloc-return-code.patch | 29 + ...event-multiple-entries-for-the-same-.patch | 70 + ...d-make-the-wrapper-return-a-non-null.patch | 31 + ...d-always-restore-signals-before-exec.patch | 117 + ...systemd-check-return-value-of-calloc.patch | 41 + ...-systemd-report-it-when-execve-fails.patch | 41 + ...md-let-the-wrapper-know-that-haproxy.patch | 144 + ...col-fix-some-build-errors-on-OpenBSD.patch | 32 + ...requires-to-include-sys-uio.h-on-Ope.patch | 32 + ...-not-include-netinet-ip.h-for-IP_TTL.patch | 32 + ...ove-the-last-strcat-and-eliminate-a-.patch | 48 + ...e-unused-hap_fd_isset-which-causes-a.patch | 39 + ...INOR-cfgparse-few-memory-leaks-fixes.patch | 48 + ...w-linking-to-device-atlas-library-fi.patch | 33 + ...description-of-st-parameter-in-man-p.patch | 32 + ...-on-shutdown-wake-up-the-appctx-not-.patch | 39 + ...-fix-use-after-free-in-peer_session_.patch | 64 + ...md-wrapper-return-correct-exit-codes.patch | 70 + ...tate-properly-restore-the-DRAIN-stat.patch | 72 + ...ate-allow-to-have-both-CMAINT-and-FD.patch | 33 + ...rs-properly-propagate-the-maintenanc.patch | 172 + ...-set-var-converter-because-of-a-typo.patch | 37 + net/horst/Makefile | 51 + net/htpdate/Makefile | 60 + net/htpdate/files/htpdate.default | 1 + net/htpdate/files/htpdate.init | 19 + net/htpdate/patches/100-adjtimex.patch | 20 + net/https-dns-proxy/Makefile | 32 + .../files/https_dns_proxy.config | 5 + .../files/https_dns_proxy.init | 32 + net/ibrdtn-tools/Makefile | 51 + net/ibrdtnd/Makefile | 62 + net/ibrdtnd/files/build-config.sh | 173 + net/ibrdtnd/files/ibrdtn.init | 71 + net/ibrdtnd/files/ibrdtn.uci | 176 + net/ibrdtnd/files/mkcontainer.sh | 43 + net/ibrdtnd/files/mountcontainer.sh | 122 + net/ibrdtnd/files/safety-wrapper.sh | 172 + net/ibrdtnd/files/systemcheck.sh | 101 + net/iodine/Makefile | 73 + net/iodine/files/iodined.config | 5 + net/iodine/files/iodined.init | 27 + net/iodine/patches/010-cross-compile.patch | 24 + .../patches/100-musl-compatibility.patch | 26 + net/iotivity/Makefile | 315 + net/iotivity/files/etc/iotivity/ReadMe.txt | 2 + .../files/etc/iotivity/oic_svr_db.cbor | Bin 0 -> 1132 bytes .../files/etc/iotivity/oic_svr_db.json | 138 + net/iotivity/patches/001-no_unit_test.patch | 153 + .../patches/002-do-not-chck-for-boost.patch | 29 + net/iotivity/patches/004-use-env.patch | 38 + ...-not-set-architecture-specific-flags.patch | 60 + .../021-add-some-more-architectures.patch | 35 + .../patches/030-remove-check-for-curl.patch | 55 + .../patches/040-remove-provisioning.patch | 24 + ...capsulation-deactivate-test-covergae.patch | 38 + ...ding-of-permission-attribute-from-co.patch | 39 + ...endianness-dependency-for-credential.patch | 87 + ...ption-when-reading-inetgers-from-cbo.patch | 93 + ...ainer-Backported-init-fix-to-1.1-rel.patch | 36 + net/iotivity/patches/140-remove-glib2.patch | 35 + ...le-try-to-load-security-configuratio.patch | 44 + net/ipsec-tools/Makefile | 102 + net/ipsec-tools/files/functions.sh | 137 + net/ipsec-tools/files/p1client-down | 41 + net/ipsec-tools/files/p1client-up | 41 + net/ipsec-tools/files/racoon | 109 + net/ipsec-tools/files/racoon.init | 475 + net/ipsec-tools/files/vpnctl | 19 + .../patches/001-ipsec-tools-def-psk.patch | 24 + net/ipsec-tools/patches/001-no_libfl.patch | 22 + net/ipsec-tools/patches/002-patch8-utmp.patch | 72 + .../patches/003-microsoft-fqdn-in-main.patch | 13 + net/ipsec-tools/patches/005-isakmp-fix.patch | 11 + .../patches/006-linux-3.7-compat.patch | 50 + .../patches/007-force_have_policy_fwd.patch | 12 + .../008-racoon-fix_dereference_crash.patch | 16 + net/ipsec-tools/patches/009-musl-compat.patch | 187 + net/iptraf-ng/Makefile | 64 + net/irssi/Makefile | 97 + net/isc-dhcp/Makefile | 241 + net/isc-dhcp/files/dhclient-script | 281 + net/isc-dhcp/files/dhclient.init | 30 + net/isc-dhcp/files/dhclient6.conf | 2 + net/isc-dhcp/files/dhclient6.init | 30 + net/isc-dhcp/files/dhcpd.conf | 13 + net/isc-dhcp/files/dhcpd.init | 33 + net/isc-dhcp/files/dhcpd6.conf | 30 + net/isc-dhcp/files/dhcpd6.init | 33 + net/isc-dhcp/files/dhcrelay4.init | 53 + net/isc-dhcp/files/dhcrelay6.init | 42 + net/isc-dhcp/files/etc/config/dhcrelay | 27 + net/isc-dhcp/patches/000-compile.patch | 30 + .../100-relay-rfc3527-link-selection.patch | 100 + net/isc-dhcp/patches/510-bind-CC.patch | 19 + net/keepalived/Makefile | 68 + net/keepalived/files/keepalived.init | 14 + net/keepalived/patches/100-musl-compat.patch | 10 + .../patches/101-update-struct-msghdr.patch | 43 + net/kismet/Makefile | 142 + net/kismet/files/kismet.conf | 304 + net/kismet/files/kismet_drone.conf | 69 + net/kismet/files/kismet_drone.config | 2 + net/kismet/files/kismet_drone.init | 26 + net/kismet/files/kismet_server.config | 2 + net/kismet/files/kismet_server.init | 26 + .../010-dont-add-host-include-paths.patch | 12 + .../patches/020-musl-include-fixes.patch | 32 + net/knot/Makefile | 307 + net/knot/files/knotd.init | 39 + net/knot/files/runtests.sh | 8 + net/knot/patches/01_zscanner_tests.patch | 25 + net/knot/patches/02_knot.conf.patch | 13 + net/knot/patches/03_contrib_files.patch | 15 + net/knot/patches/04_cookies_big_endian.patch | 217 + net/knxd/Makefile | 103 + net/knxd/files/knxd.config | 43 + net/knxd/files/knxd.init | 73 + net/knxd/patches/0099-openwrt.patch | 8 + net/kplex/Makefile | 52 + net/kplex/files/kplex.init | 19 + net/krb5/Makefile | 129 + net/krb5/files/krb5kdc | 19 + ...001-fix-uninitialized-warning-errors.patch | 55 + net/l7-protocols/Makefile | 87 + .../patches/100-testing_crosscompile.patch | 27 + .../patches/101-testing-timeit.patch | 102 + .../patches/102-testing-doallspeeds.patch | 16 + net/lcdringer/Makefile | 54 + net/lcdringer/files/lcdringer.init | 16 + net/lftp/Makefile | 78 + net/lighttpd/Makefile | 188 + net/lighttpd/files/lighttpd.conf | 32 + net/lighttpd/files/lighttpd.init | 20 + net/linknx/Makefile | 66 + net/linknx/files/linknx.config | 8 + net/linknx/files/linknx.init | 23 + net/linknx/files/linknx.xml.dist | 16 + net/linuxptp/Makefile | 57 + net/linuxptp/patches/001-musl-fix.patch | 21 + net/lispmob/Makefile | 56 + net/lispmob/patches/001-fix-musl-build.patch | 31 + net/lksctp-tools/Makefile | 92 + net/luci-app-bcp38/Makefile | 57 + net/luci-app-bcp38/files/bcp38-cbi.lua | 58 + net/luci-app-bcp38/files/bcp38-controller.lua | 7 + net/luci-app-bcp38/files/uci-defaults-bcp38 | 11 + net/luci-app-clamav/Makefile | 53 + .../files/controller/clamav-controller.lua | 22 + .../files/model/cbi/clamav-cbi.lua | 178 + net/luci-app-e2guardian/Makefile | 53 + .../files/e2guardian-cbi.lua | 399 + .../files/e2guardian-controller.lua | 22 + net/luci-app-squid/Makefile | 53 + net/luci-app-squid/files/squid-cbi.lua | 67 + net/luci-app-squid/files/squid-controller.lua | 21 + net/mac-telnet/Makefile | 71 + net/mac-telnet/files/mactelnet.config | 9 + net/mac-telnet/files/mactelnet.init | 80 + net/mdnsresponder/Makefile | 164 + net/mdnsresponder/files/mDNSResponder.conf | 4 + net/mdnsresponder/files/mDNSResponder.init | 14 + net/mdnsresponder/files/mdnsd.init | 14 + .../patches/001-cross_compile.patch | 115 + .../patches/100-linux_fixes.patch | 403 + .../patches/114-fix_posix_build.patch | 11 + net/memcached/Makefile | 72 + net/memcached/files/memcached.config | 6 + net/memcached/files/memcached.init | 27 + net/memcached/patches/100-fix_iov_max.patch | 25 + net/mii-tool/Makefile | 53 + net/mini_snmpd/Makefile | 66 + net/mini_snmpd/files/mini_snmpd.config | 26 + net/mini_snmpd/files/mini_snmpd.init | 240 + net/miniupnpc/Makefile | 73 + .../patches/100-no_minixml_test.patch | 13 + .../patches/200-miniupnpc_desc.patch | 11 + net/mtr/Makefile | 73 + net/mtr/patches/100-disabled-ipv6-fix.patch | 49 + net/mwan3-luci/Makefile | 41 + .../etc/hotplug.d/iface/16-mwancustombak | 38 + .../files/etc/uci-defaults/mwan-luci | 14 + .../usr/lib/lua/luci/controller/mwan3.lua | 322 + .../model/cbi/mwan/advanced_hotplugscript.lua | 55 + .../model/cbi/mwan/advanced_mwanconfig.lua | 32 + .../model/cbi/mwan/advanced_networkconfig.lua | 32 + .../lib/lua/luci/model/cbi/mwan/interface.lua | 266 + .../luci/model/cbi/mwan/interfaceconfig.lua | 190 + .../lib/lua/luci/model/cbi/mwan/member.lua | 46 + .../lua/luci/model/cbi/mwan/memberconfig.lua | 47 + .../lib/lua/luci/model/cbi/mwan/policy.lua | 95 + .../lua/luci/model/cbi/mwan/policyconfig.lua | 65 + .../usr/lib/lua/luci/model/cbi/mwan/rule.lua | 141 + .../lua/luci/model/cbi/mwan/ruleconfig.lua | 113 + .../lua/luci/view/admin_status/index/mwan.htm | 1 + .../luci/view/mwan/advanced_diagnostics.htm | 128 + .../luci/view/mwan/advanced_hotplugscript.htm | 23 + .../luci/view/mwan/advanced_mwanconfig.htm | 23 + .../luci/view/mwan/advanced_networkconfig.htm | 23 + .../view/mwan/advanced_troubleshooting.htm | 71 + .../usr/lib/lua/luci/view/mwan/config_css.htm | 34 + .../view/mwan/openwrt_overview_status.htm | 83 + .../lua/luci/view/mwan/overview_detailed.htm | 51 + .../lua/luci/view/mwan/overview_interface.htm | 122 + net/mwan3/Makefile | 45 + net/mwan3/files/etc/config/mwan3 | 73 + net/mwan3/files/etc/hotplug.d/iface/15-mwan3 | 60 + net/mwan3/files/lib/mwan3/mwan3.sh | 806 + net/mwan3/files/usr/sbin/mwan3 | 182 + net/mwan3/files/usr/sbin/mwan3track | 65 + net/nbd/Makefile | 88 + net/nbd/files/nbd-client.conf | 9 + net/nbd/files/nbd-client.init | 69 + net/nbd/files/nbd-server.conf | 31 + net/nbd/files/nbd-server.init | 112 + net/ncp/Makefile | 49 + net/net-snmp/Makefile | 257 + net/net-snmp/files/snmpd.conf | 82 + net/net-snmp/files/snmpd.init | 241 + .../patches/100-debian-statistics.patch | 22 + .../patches/110-debian-makefiles.patch | 40 + .../patches/120-debian-searchdirs.patch | 14 + .../patches/130-debian-extramibs.patch | 6261 ++++ net/net-snmp/patches/160-no_ldconfig.patch | 11 + net/net-snmp/patches/170-ldflags.patch | 11 + net/net-snmp/patches/750-ieee802dot11.patch | 6156 ++++ .../patches/800-format-security.patch | 29 + net/net-snmp/patches/900-musl-compat.patch | 14 + net/netatalk/Makefile | 97 + net/netatalk/files/afpd.init | 23 + .../patches/001-automake-compat.patch | 9 + .../patches/002-ld_library_path.patch | 26 + net/netcat/Makefile | 65 + .../patches/001-netcat_flag_count.patch | 22 + net/netdiscover/Makefile | 42 + net/netperf/Makefile | 51 + net/netperf/files/netserver.init | 12 + net/nfs-kernel-server/Makefile | 158 + net/nfs-kernel-server/files/nfsd.exports | 1 + net/nfs-kernel-server/files/nfsd.init | 38 + .../patches/100-no_malloc_h.patch | 10 + .../patches/101-musl-getservbyport.patch | 18 + net/nginx/Config.in | 185 + net/nginx/Makefile | 270 + net/nginx/files/nginx.init | 17 + .../100-no_by_lua_block.patch | 195 + net/nginx/patches/101-feature_test_fix.patch | 107 + net/nginx/patches/102-sizeof_test_fix.patch | 27 + net/nginx/patches/103-sys_nerr.patch | 12 + net/nginx/patches/200-config.patch | 18 + net/nginx/patches/300-max-processes.patch | 11 + net/ngircd/Makefile | 109 + net/ngircd/files/ngircd.init | 11 + net/nmap/Makefile | 145 + .../patches/001-fix-missing-includes.patch | 14 + net/nsd/Makefile | 135 + net/nsd/files/nsd.init | 16 + net/ntpclient/Makefile | 57 + net/ntpclient/files/ntpclient.config | 23 + net/ntpclient/files/ntpclient.hotplug | 78 + net/ntpclient/patches/100-daemon.patch | 22 + net/ntpd/Makefile | 160 + net/ntpd/files/ntp.conf | 26 + net/ntpd/files/ntpd.hotplug | 10 + net/ntpd/files/ntpd.init | 18 + net/ntpd/files/ntpdate.init | 13 + net/ntripcaster/Makefile | 49 + net/ntripclient/Makefile | 48 + net/ntripclient/patches/100-musl-compat.patch | 10 + net/ntripserver/Makefile | 49 + net/nut/Config.in | 100 + net/nut/Makefile | 352 + net/nut/files/nut-monitor.init | 21 + net/nut/files/nut-server.init | 23 + net/nut/files/nut.service | 34 + net/obfsproxy/Makefile | 59 + net/obfsproxy/files/obfsproxy.conf | 57 + net/obfsproxy/files/obfsproxy.init | 158 + net/obfsproxy/patches/001-exclude-tests.patch | 13 + .../patches/002-fix-python-path.patch | 16 + .../003-remove-argparse-dependency-test.patch | 12 + .../patches/004-add-syslog-support.patch | 51 + net/ocserv/Config.in | 26 + net/ocserv/Makefile | 111 + net/ocserv/README | 198 + net/ocserv/files/config | 17 + net/ocserv/files/ocserv.conf.template | 391 + net/ocserv/files/ocserv.init | 212 + net/ocserv/files/ocserv.upgrade | 8 + net/ocserv/patches/001-makefile-fix.patch | 47 + net/opennhrp/Makefile | 60 + net/opennhrp/files/opennhrp.init | 15 + net/opennhrp/patches/100-musl-compat.patch | 20 + net/openssh/Makefile | 291 + net/openssh/files/sftp-ssh.service | 9 + net/openssh/files/sshd.init | 42 + net/openssh/files/sshd.pam | 41 + net/openssh/files/sshd.pam-access | 4 + ...00-openssh-7.3_p1-NEWKEYS_null_deref.patch | 27 + ...er-the-KEXINIT-handler-after-receive.patch | 18 + .../130-implicit_memset_decl_fix.patch | 12 + .../patches/140-pam_uclibc_pthreads_fix.patch | 84 + net/openssh/patches/200-dscp-qos.patch | 21 + net/opentracker/Makefile | 106 + net/opentracker/files/opentracker.init | 16 + net/opentracker/files/opentracker6.init | 16 + net/opentracker/patches/100-makefile.patch | 30 + net/openvswitch/Makefile | 214 + .../files/etc/init.d/openvswitch.init | 41 + ...linux-Use-unsigned-int-for-ifi_flags.patch | 28 + ...-interface-flag-survive-internal-por.patch | 41 + .../patches/0004-musl-compatibility.patch | 39 + ...08-add-back-old-gfp-this-node-define.patch | 19 + .../patches/0009-fix-test-ovn.patch | 11 + ...nsure-that-thread-stacks-are-always-.patch | 75 + .../patches/0011-kernel-4-4-support.patch | 279 + net/p910nd/Makefile | 59 + net/p910nd/files/p910nd.config | 5 + net/p910nd/files/p910nd.init | 45 + net/pingcheck/Makefile | 55 + net/pingcheck/pingcheck.init | 15 + net/polipo/Makefile | 59 + net/polipo/files/polipo.config | 42 + net/polipo/files/polipo.init | 150 + net/port-mirroring/Makefile | 44 + net/portmap/Makefile | 53 + net/portmap/files/portmap.init | 13 + net/portmap/patches/101-no_pie.patch | 12 + net/pppossh/Makefile | 37 + net/pppossh/README.md | 68 + net/pppossh/files/pppossh.sh | 72 + net/pptpd/Makefile | 69 + net/pptpd/files/options.pptpd | 21 + net/pptpd/files/pptpd.conf | 4 + net/pptpd/files/pptpd.config | 8 + net/pptpd/files/pptpd.init | 72 + net/pptpd/patches/001-bad_pqueue_debug.patch | 18 + net/pptpd/patches/002-makefile_fix.patch | 11 + net/pptpd/patches/003-opt_flags.patch | 11 + net/pptpd/patches/100-musl-compat.patch | 38 + net/privoxy/Config.in | 115 + net/privoxy/Makefile | 164 + net/privoxy/files/privoxy.config | 44 + net/privoxy/files/privoxy.hotplug | 20 + net/privoxy/files/privoxy.init | 175 + net/privoxy/files/privoxy.upgrade | 4 + net/prosody/Makefile | 124 + net/prosody/files/prosody.cfg.lua | 170 + net/prosody/files/prosody.init | 46 + net/quassel-irssi/Makefile | 52 + .../patches/001-respect-cflags.patch | 22 + .../patches/002-use-cc-var.patch | 13 + .../003-use-pkgconfig-ldflags-quasselc.patch | 13 + net/radicale/Makefile | 146 + net/radicale/files/config.template | 30 + net/radicale/files/logging.template | 47 + net/radicale/files/radicale.config | 200 + net/radicale/files/radicale.hotplug | 18 + net/radicale/files/radicale.init | 236 + net/radicale/files/radicale.rights | 49 + net/radicale/files/radicale.upgrade | 4 + net/radicale/files/radicale.users | 6 + ...-Run-as-user-group-radicale-radicale.patch | 30 + net/radsecproxy/Makefile | 60 + net/radsecproxy/files/radsecproxy.conf | 43 + net/radsecproxy/files/radsecproxy.init | 142 + .../patches/100-missing-return.patch | 58 + .../patches/200-logdest-on-foreground.patch | 31 + net/reaver/Makefile | 53 + .../0001-wpscrack-big-endian-fixes.patch | 565 + ...directory-for-storing-and-loading-se.patch | 53 + ...less-useless-spaces-in-output-to-fit.patch | 38 + ...0004-Fixed-probe-request-bug-in-wash.patch | 46 + ...sys-types.h-for-definition-of-u_char.patch | 27 + .../0101-pcap-use-65536-as-snaplen.patch | 11 + net/redsocks/Makefile | 58 + net/redsocks/files/redsocks.conf | 108 + net/redsocks/files/redsocks.init | 36 + .../0006-fix_default_config_location.patch | 17 + net/remserial/Makefile | 34 + net/rp-pppoe/Makefile | 147 + net/rp-pppoe/files/ppp/options | 10 + net/rp-pppoe/files/ppp/pap-secrets | 2 + net/rp-pppoe/files/ppp/pppoe-server-options | 9 + net/rp-pppoe/files/ppp_defs.h | 11 + net/rp-pppoe/files/pppoe-relay.default | 10 + net/rp-pppoe/files/pppoe-relay.init | 72 + net/rp-pppoe/files/pppoe-server.default | 10 + net/rp-pppoe/files/pppoe-server.init | 74 + net/rp-pppoe/files/pppoe.config | 23 + net/rp-pppoe/patches/100-configure.patch | 36 + net/rp-pppoe/patches/110-Makefile.patch | 11 + .../120-use-linux-ether-not-netinet.patch | 40 + net/rsync/Config.in | 25 + net/rsync/Makefile | 104 + net/rsync/files/rsyncd.conf | 16 + net/rsync/files/rsyncd.init | 14 + net/rsyslog/Makefile | 57 + net/rsyslog/files/rsyslog.conf | 18 + net/rsyslog/files/rsyslog.init | 12 + net/rtorrent/Makefile | 92 + .../patches/100-fix-cross_compile.patch | 30 + net/rtorrent/patches/120-fix-ncurses.patch | 11 + net/scapy/Makefile | 56 + net/seafile-ccnet/Makefile | 75 + net/seafile-ccnet/patches/010-Makefile.patch | 31 + net/seafile-seahub/Makefile | 60 + .../patches/010-default-config.patch | 30 + .../patches/020-Makefile-fixes.patch | 28 + net/seafile-server/Config.in | 16 + net/seafile-server/Makefile | 150 + net/seafile-server/files/seafile.conf | 12 + net/seafile-server/files/seafile.init | 157 + net/seafile-server/files/seahub.init | 226 + .../patches/020-script-patches.patch | 77 + .../030-pidfiles-in-same-directory.patch | 24 + .../patches/040-seafile-admin.patch | 61 + .../050-libseafile-makefile-fixes.patch | 43 + .../patches/060-timestamps-as-int64.patch | 39 + .../patches/070-fuse-mount.patch | 21 + net/ser2net/Makefile | 51 + net/shadowsocks-client/Makefile | 39 + net/shadowsocks-client/files/sslocal.config | 7 + net/shadowsocks-client/files/sslocal.init | 52 + net/shadowsocks-libev/Makefile | 91 + net/shadowsocks-libev/files/firewall.include | 6 + .../files/shadowsocks-libev.config | 15 + .../files/shadowsocks-libev.init | 156 + net/shadowsocks-libev/files/ss-rules | 219 + net/siit/Makefile | 42 + net/siit/src/Makefile | 5 + net/siit/src/siit.c | 1429 + net/siit/src/siit.h | 61 + net/sipgrep/Makefile | 47 + net/smartsnmpd/Makefile | 75 + net/smartsnmpd/files/mibs/dummy.lua | 24 + net/smartsnmpd/files/mibs/interfaces.lua | 125 + net/smartsnmpd/files/mibs/system.lua | 176 + net/smartsnmpd/files/smartsnmpd.conf | 21 + net/smartsnmpd/files/smartsnmpd.init | 47 + net/sngrep/Makefile | 50 + net/snort/Config.in | 11 + net/snort/Makefile | 156 + net/snort/files/snort.config | 3 + net/snort/files/snort.init | 40 + net/snort/patches/001-compile.patch | 105 + net/snort/patches/100-autoconf-fixes.patch | 17 + net/socat/Makefile | 81 + net/socat/files/socat.config | 5 + net/socat/files/socat.init | 39 + net/socat/patches/100-musl-compat.patch | 23 + net/softflowd/Makefile | 54 + net/softflowd/files/softflowd.config | 14 + net/softflowd/files/softflowd.init | 58 + net/spawn-fcgi/Makefile | 42 + net/sqm-scripts-extra/Makefile | 47 + .../test_LAN_dual-isolate__piece_of_cake.qos | 102 + ...t_LAN_dual-isolate__piece_of_cake.qos.help | 12 + ...test_LAN_triple-isolate__piece_of_cake.qos | 102 + ...LAN_triple-isolate__piece_of_cake.qos.help | 12 + .../test_WAN_dual-isolate__piece_of_cake.qos | 89 + ...t_WAN_dual-isolate__piece_of_cake.qos.help | 10 + ...test_WAN_triple-isolate__piece_of_cake.qos | 89 + ...WAN_triple-isolate__piece_of_cake.qos.help | 10 + .../src/test_triple_isolated_llt_cake.qos | 82 + .../test_triple_isolated_llt_cake.qos.help | 3 + net/sqm-scripts/Makefile | 87 + net/squid/Makefile | 134 + net/squid/files/squid.conf | 44 + net/squid/files/squid.config | 8 + net/squid/files/squid.init | 60 + net/squid/patches/001-cross_compile.patch | 24 + net/squid/patches/100-mime.patch | 30 + net/sshfs/Makefile | 62 + net/sshtunnel/Makefile | 45 + net/sshtunnel/files/sshtunnel.init | 213 + net/sshtunnel/files/uci_sshtunnel | 63 + net/sslh/Makefile | 55 + net/sslh/files/sslh.config | 30 + net/sslh/files/sslh.init | 62 + net/sslh/patches/001-no_sslh_select.patch | 29 + net/sslh/patches/002-no_regex_probes.patch | 90 + net/sstp-client/Makefile | 53 + net/sstp-client/files/etc/ppp/chap-secrets | 4 + .../etc/ppp/peers/peer-sstp-example-nopty.txt | 14 + .../files/etc/ppp/peers/peer-sstp-example.txt | 15 + net/sstp-client/patches/100-musl-compat.patch | 33 + net/strongswan/Config.in | 16 + net/strongswan/Makefile | 576 + net/strongswan/files/ipsec.init | 20 + net/strongswan/files/ipsec.secrets | 1 + net/strongswan/files/ipsec.user | 6 + net/strongswan/patches/101-musl-fixes.patch | 83 + net/strongswan/patches/201-kmodloader.patch | 28 + net/strongswan/patches/203-uci.patch | 20 + net/strongswan/patches/210-sleep.patch | 11 + .../300-include-ipsec-user-script.patch | 17 + .../patches/305-minimal_dh_plugin.patch | 221 + net/stunnel/Makefile | 79 + net/stunnel/files/stunnel.conf | 45 + net/stunnel/files/stunnel.init | 12 + net/subversion/Makefile | 141 + net/subversion/files/subversion.config | 3 + net/subversion/files/subversion.init | 37 + .../patches/301-cross-compilation-macos.patch | 97 + net/tcpproxy/Makefile | 85 + net/tcpproxy/files/tcpproxy.config | 26 + net/tcpproxy/files/tcpproxy.init | 96 + .../patches/001-ragel_generated.patch | 1378 + net/tcpreplay/Makefile | 158 + net/tgt/Makefile | 62 + net/tgt/files/etc/config/tgt | 64 + net/tgt/files/etc/init.d/tgt | 237 + net/tgt/patches/020-usr_Makefile.patch | 51 + net/tgt/patches/030-Makefile.patch | 11 + net/tgt/patches/100-musl-compat.patch | 30 + net/tinc/Makefile | 60 + net/tinc/files/tinc.config | 56 + net/tinc/files/tinc.init | 239 + net/tinc/files/tinc.upgrade | 1 + net/tinyproxy/Makefile | 51 + net/tinyproxy/files/tinyproxy.config | 251 + net/tinyproxy/files/tinyproxy.init | 142 + .../patches/010-no-docs-and-tests.patch | 86 + .../patches/020-config_and_pid-path.patch | 13 + .../030-allow_bind_in_transparent_mode.patch | 22 + net/tinyproxy/patches/120-fix_INET6.patch | 38 + ...2-3505-tiniproxy-randomized-hashmaps.patch | 101 + ...VE-2012-3505-tinyproxy-limit-headers.patch | 44 + net/tor/Makefile | 100 + net/tor/files/tor.init | 26 + net/tor/patches/001-torrc.patch | 21 + net/transmission/Makefile | 193 + net/transmission/files/transmission.config | 74 + net/transmission/files/transmission.init | 134 + .../patches/020-use-internal-miniupnp.patch | 11 + .../patches/030-fix-musl-build.patch | 30 + net/travelmate/Makefile | 53 + net/travelmate/files/README.md | 138 + net/travelmate/files/travelmate.conf | 7 + net/travelmate/files/travelmate.init | 25 + net/travelmate/files/travelmate.sh | 281 + net/u2pnpd/Makefile | 63 + net/u2pnpd/files/u2pnpd.config | 11 + net/u2pnpd/files/u2pnpd.defaults | 10 + net/u2pnpd/files/u2pnpd.init | 62 + net/uanytun/Makefile | 175 + net/uanytun/files/uanytun-nocrypt.config | 88 + net/uanytun/files/uanytun.config | 116 + net/uanytun/files/uanytun.init | 104 + net/udpxy/Makefile | 64 + net/udpxy/files/udpxy.conf | 15 + net/udpxy/files/udpxy.init | 67 + net/ulogd/Makefile | 210 + net/ulogd/files/ulogd.init | 12 + net/ulogd/patches/100-musl-compat.patch | 57 + net/umurmur/Makefile | 103 + ...-check-for-POLARSSL_VERSION_FEATURES.patch | 17 + net/unbound/Makefile | 190 + net/unbound/files/README.md | 128 + net/unbound/files/dnsmasq.sh | 182 + net/unbound/files/iptools.sh | 140 + net/unbound/files/root.key | 1 + net/unbound/files/rootzone.sh | 119 + net/unbound/files/unbound.iface | 20 + net/unbound/files/unbound.init | 46 + net/unbound/files/unbound.ntpd | 28 + net/unbound/files/unbound.sh | 532 + net/unbound/files/unbound.uci | 20 + net/unbound/patches/001-conf.patch | 95 + net/usbip/Makefile | 109 + net/usbip/patches-2.0/100-musl-compat.patch | 11 + net/usbip/patches/001-upstream_svn_r99.diff | 11 + net/usbip/patches/002-upstream_svn_r152.patch | 229 + net/vncrepeater/Makefile | 70 + .../patches/001-uclibcxx_linking.patch | 39 + net/vncrepeater/patches/002-cfg-path.patch | 38 + net/vnstat/Makefile | 110 + net/vnstat/files/vnstat.config | 5 + net/vnstat/files/vnstat.defaults | 13 + net/vnstat/files/vnstat.init | 89 + net/vnstat/patches/001-conf.patch | 19 + net/vnstat/patches/002-no_install_strip.patch | 35 + net/vnstat/patches/003-no_install_uname.patch | 15 + net/vnstat/patches/100-musl-compat.patch | 10 + net/vpnc-scripts/Makefile | 37 + net/vpnc-scripts/files/vpnc-script | 219 + net/vpnc/Config.in | 18 + net/vpnc/Makefile | 94 + net/vpnc/README | 41 + net/vpnc/files/vpnc.sh | 110 + net/vpnc/files/vpnc.upgrade | 2 + net/vpnc/patches/001-cross.patch | 42 + net/vpnc/patches/100-musl-compat.patch | 42 + net/vsftpd/Makefile | 94 + net/vsftpd/files/vsftpd.conf | 30 + net/vsftpd/files/vsftpd.init | 13 + net/vsftpd/patches/001-destdir.patch | 47 + net/vsftpd/patches/002-find_libs.patch | 13 + net/vsftpd/patches/003-chroot.patch | 11 + .../patches/004-disable-capabilities.patch | 12 + net/vsftpd/patches/005-disable-pam.patch | 11 + .../patches/006-musl-compatibility.patch | 13 + net/vsftpd/patches/007-CVE-2015-1419.patch | 98 + net/wavemon/Makefile | 58 + net/wavemon/patches/musl-fix.patch | 21 + net/webui-aria2/Makefile | 56 + net/wget/Makefile | 99 + net/wifidog/Makefile | 103 + net/wifidog/files/wifidog.init | 22 + net/wifischedule/LICENSE | 11 + net/wifischedule/Makefile | 51 + net/wifischedule/README.md | 86 + net/wifischedule/net/etc/config/wifi_schedule | 19 + net/wifischedule/net/usr/bin/wifi_schedule.sh | 321 + net/wireguard/Makefile | 108 + net/wireguard/files/wireguard.sh | 176 + net/wshaper/Makefile | 58 + net/wshaper/files/wshaper.config | 4 + net/wshaper/files/wshaper.htb | 166 + net/wshaper/files/wshaper.iface | 3 + net/wshaper/files/wshaper.init | 10 + net/xinetd/Makefile | 66 + net/xinetd/files/xinetd.conf | 6 + net/xinetd/files/xinetd.init | 15 + net/xinetd/patches/001-ar.patch | 66 + net/xinetd/patches/002-destdir.patch | 27 + net/xinetd/patches/003-rpc_fix.patch | 19 + net/xinetd/patches/004-ident-bind.patch | 42 + net/xl2tpd/Makefile | 90 + net/xl2tpd/README | 23 + net/xl2tpd/files/l2tp.sh | 127 + net/xl2tpd/files/options.xl2tpd | 13 + net/xl2tpd/files/xl2tp-secrets | 5 + net/xl2tpd/files/xl2tpd.conf | 23 + net/xl2tpd/files/xl2tpd.conf.sample | 73 + net/xl2tpd/files/xl2tpd.init | 24 + .../patches/100-makefile_opt_flags.patch | 12 + .../patches/110-makefile_dont_build_pfc.patch | 43 + .../patches/120-no-bsd-signal-in-musl.patch | 11 + net/yaaw/Makefile | 51 + net/znc/Config.in | 18 + net/znc/Makefile | 313 + net/znc/files/znc.conf | 29 + net/znc/files/znc.init | 183 + .../100-move_rootcheck_after_config.patch | 52 + net/znc/patches/101-Reduce_rebuild_time.patch | 39 + ...socket-Add-some-ifdef-feature-checks.patch | 71 + .../104-disable-empty-modules-check.patch | 15 + net/znc/patches/110-add-playback-module.patch | 291 + sound/alsa-utils/Makefile | 89 + .../patches/100-uClibc-compat.patch | 23 + sound/espeak/Makefile | 57 + sound/espeak/patches/101-portaudio.patch | 2093 ++ sound/forked-daapd/Makefile | 75 + sound/forked-daapd/files/forked-daapd.conf | 187 + sound/forked-daapd/files/forked-daapd.init | 15 + .../patches/010-include_pregen.patch | 23739 ++++++++++++++++ sound/lame/Makefile | 84 + sound/lame/patches/001-automake-compat.patch | 33 + sound/madplay/Makefile | 85 + .../patches/0001-switch-to-new-alsa-api.patch | 173 + .../patches/010-use_correct_shell.patch | 30 + sound/mocp/Makefile | 66 + sound/mpc/Makefile | 58 + sound/mpc/files/pls-handler.sh | 5 + sound/mpd/Makefile | 229 + sound/mpd/files/mpd.init | 30 + sound/mpd/files/mpd.service | 9 + .../patches/210-support_raw_pcm_streams.patch | 10 + ...20-handle_slow_server_stream_startup.patch | 16 + sound/mpg123/Makefile | 102 + sound/pianod/Makefile | 110 + sound/pianod/files/pianod.init | 42 + .../005-Remove_svn_version_query.patch | 11 + .../010-Configure_add_SSL_options.patch | 42 + ...Use_package_config_h_for_all_modules.patch | 59 + .../030-Waitress_add_polarssl_variant.patch | 333 + sound/portaudio/Makefile | 70 + sound/pulseaudio/Makefile | 195 + sound/pulseaudio/files/pulseaudio.init | 29 + .../patches/001-no_default_64mb_alloc.patch | 11 + sound/shairplay/Makefile | 50 + sound/shairplay/files/shairplay.config | 10 + sound/shairplay/files/shairplay.init | 51 + .../shairplay/patches/001-key_file_dir.patch | 11 + .../patches/002-libavahi-compat-dnssd.patch | 11 + .../patches/003-fix_big-endian.patch | 11 + sound/shairport-sync/Makefile | 126 + .../files/shairport-sync.config | 61 + .../shairport-sync/files/shairport-sync.init | 142 + sound/shairport/Makefile | 60 + sound/shairport/files/shairport.config | 36 + sound/shairport/files/shairport.init | 104 + .../patches/001-disable_pulseaudio.patch | 12 + sound/shine/Makefile | 64 + .../shine/patches/001-fix_mips64_bswap.patch | 11 + sound/sox/Makefile | 89 + sound/sox/patches/001-cross_compile.patch | 22 + .../patches/010-fix_uclibc_build_issue.patch | 19 + sound/sox/patches/020-ffmpeg-0.11.patch | 129 + sound/sox/patches/020-ffmpeg-2.x.patch | 72 + sound/squeezelite/Makefile | 146 + sound/squeezelite/files/squeezelite.conf | 13 + sound/squeezelite/files/squeezelite.init | 142 + .../patches/005-respect_LDFLAGS.patch | 56 + .../010-select_broadcast_interface.patch | 356 + sound/squeezelite/patches/020-no_mpg123.patch | 83 + .../patches/030-fix_musl_compatibilty.patch | 14 + .../patches/040-clear_dynlink_errors.patch | 105 + sound/svox/Makefile | 61 + ...nf-building-of-library-using-libtool.patch | 113 + .../0002-gitignore-for-autotools-files.patch | 51 + ...t-text-to-.wav-using-svox-text-to-sp.patch | 399 + .../svox/patches/0004-add-header-files.patch | 59 + .../patches/0005-Install-lang-files.patch | 32 + sound/svox/patches/0006-Set-picolangdir.patch | 40 + sound/svox/patches/0008-64bits.patch | 26 + sound/svox/patches/0009-Fix-link-order.patch | 21 + sound/svox/patches/0010-platform.patch | 30 + sound/svox/patches/0011-subdir.patch | 12 + sound/svox/patches/0012-no-headers.patch | 46 + sound/upmpdcli/Config.in | 17 + sound/upmpdcli/Makefile | 63 + sound/upmpdcli/files/upmpdcli.config | 15 + sound/upmpdcli/files/upmpdcli.init | 51 + sound/upmpdcli/files/upmpdcli.png | Bin 0 -> 1640 bytes .../patches/010-Add_icon_config.patch | 11 + utils/acl/Makefile | 88 + .../patches/100-no-gettext_configure.patch | 21 + .../acl/patches/101-no-gettext_autogen.patch | 9 + .../acl/patches/102-no-gettext_Makefile.patch | 13 + utils/acpid/Makefile | 68 + utils/acpid/files/acpid.hotplug | 7 + utils/acpid/files/acpid.init | 25 + utils/acpid/files/default | 5 + .../acpid/patches/002-dont-use-isfdtype.patch | 21 + utils/ap51-flash/Makefile | 58 + utils/ap51-flash/files/ap51-flash.config | 6 + utils/ap51-flash/files/ap51-flash.init | 50 + utils/ap51-flash/files/ap51-flash.sh | 21 + utils/at/Makefile | 59 + utils/at/files/atd.init | 26 + .../patches/100-remove-glibc-assumption.patch | 59 + utils/at/patches/110-getloadavg.patch | 14 + utils/attr/Makefile | 93 + .../patches/100-no-gettext_configure.patch | 21 + .../attr/patches/101-no-gettext_autogen.patch | 9 + .../patches/102-no-gettext_Makefile.patch | 13 + utils/avrdude/Makefile | 60 + .../patches/010-configure-fixups.patch | 18 + utils/avrdude/patches/100-musl-compat.patch | 60 + utils/bandwidthd-php/Makefile | 51 + .../files/bandwidthd-php.config | 7 + .../bandwidthd-php/files/bandwidthd-php.init | 75 + utils/bandwidthd-php/files/details.php | 102 + utils/bandwidthd-php/files/footer.php | 3 + utils/bandwidthd-php/files/graph.php | 457 + utils/bandwidthd-php/files/include.php | 54 + utils/bandwidthd-php/files/index.php | 197 + utils/bandwidthd-php/files/legend.gif | Bin 0 -> 1649 bytes utils/bandwidthd-php/files/logo.gif | Bin 0 -> 9431 bytes utils/bandwidthd/Makefile | 124 + .../bandwidthd/files/bandwidthd-pgsql.config | 13 + utils/bandwidthd/files/bandwidthd-pgsql.init | 90 + utils/bandwidthd/files/bandwidthd.config | 11 + utils/bandwidthd/files/bandwidthd.init | 88 + utils/bandwidthd/files/logo.gif | Bin 0 -> 9431 bytes .../patches/010-dont-add-host-paths.patch | 36 + .../patches/100-fix_config_file_location | 31 + utils/banhosts/Makefile | 40 + utils/banhosts/files/updatebanhost | 19 + utils/bash/Makefile | 74 + utils/bash/patches/001-compile-fix.patch | 15 + .../patches/002-force-internal-readline.patch | 24 + .../patches/101-upstream-bash43-001.patch | 49 + .../patches/102-upstream-bash43-002.patch | 49 + .../patches/103-upstream-bash43-003.patch | 39 + .../patches/104-upstream-bash43-004.patch | 38 + .../patches/105-upstream-bash43-005.patch | 50 + .../patches/106-upstream-bash43-006.patch | 39 + .../patches/107-upstream-bash43-007.patch | 45 + .../patches/108-upstream-bash43-008.patch | 148 + .../patches/109-upstream-bash43-009.patch | 51 + .../patches/110-upstream-bash43-010.patch | 145 + .../patches/111-upstream-bash43-011.patch | 40 + .../patches/112-upstream-bash43-012.patch | 38 + .../patches/113-upstream-bash43-013.patch | 52 + .../patches/114-upstream-bash43-014.patch | 95 + .../patches/115-upstream-bash43-015.patch | 48 + .../patches/116-upstream-bash43-016.patch | 121 + .../patches/117-upstream-bash43-017.patch | 41 + .../patches/118-upstream-bash43-018.patch | 38 + .../patches/119-upstream-bash43-019.patch | 75 + .../patches/120-upstream-bash43-020.patch | 93 + .../patches/121-upstream-bash43-021.patch | 46 + .../patches/122-upstream-bash43-022.patch | 47 + .../patches/123-upstream-bash43-023.patch | 78 + .../patches/124-upstream-bash43-024.patch | 45 + .../patches/125-upstream-bash43-025.patch | 110 + .../patches/126-upstream-bash43-026.patch | 54 + .../patches/127-upstream-bash43-027.patch | 176 + .../patches/128-upstream-bash43-028.patch | 1526 + .../patches/129-upstream-bash43-029.patch | 50 + .../patches/130-upstream-bash43-030.patch | 1396 + .../patches/131-upstream-bash43-031.patch | 96 + .../patches/132-upstream-bash43-032.patch | 42 + .../patches/133-upstream-bash43-033.patch | 201 + .../patches/134-upstream-bash43-034.patch | 74 + .../patches/135-upstream-bash43-035.patch | 48 + .../patches/136-upstream-bash43-036.patch | 48 + .../patches/137-upstream-bash43-037.patch | 38 + .../patches/138-upstream-bash43-038.patch | 67 + .../patches/139-upstream-bash43-039.patch | 52 + .../patches/140-upstream-bash43-040.patch | 38 + .../patches/141-upstream-bash43-041.patch | 67 + .../patches/142-upstream-bash43-042.patch | 50 + utils/bash/patches/900-no_doc.patch | 13 + utils/bc/Makefile | 65 + utils/bc/patches/001-disable-doc.patch | 21 + utils/bluelog/Makefile | 108 + utils/bluelog/files/bluelog.init | 13 + .../100-gen-oui-fix-tempfile-use-mirror.patch | 31 + utils/bluez/Makefile | 159 + utils/bluez/files/bluetooth.config | 15 + utils/bluez/files/bluetooth.dbus | 37 + utils/bluez/files/bluetoothd.init | 13 + utils/bluez/files/givepin | 14 + ...01-bcm43xx-Add-bcm43xx-3wire-variant.patch | 21 + ...-speed-must-be-reset-after-the-firmw.patch | 33 + ...ncrease-firmware-load-timeout-to-30s.patch | 20 + ...-the-43xx-firmware-into-lib-firmware.patch | 20 + utils/bluez/patches/200-uart-speed.patch | 40 + utils/bluez/patches/201-readline.patch | 48 + utils/bonnie++/Makefile | 53 + .../patches/001-cross_compile_fix.patch | 38 + .../002-add-verbose-error-messages.patch | 47 + utils/btrfs-progs/Makefile | 65 + utils/btrfs-progs/files/btrfs-scan.init | 9 + ...d_join-instead-of-pthread_tryjoin_np.patch | 11 + utils/canutils/Makefile | 116 + utils/ccid/Makefile | 52 + utils/ccrypt/Makefile | 42 + utils/ccrypt/patches/001-no-intl.patch | 89 + utils/cmdpad/Makefile | 61 + utils/cmdpad/files/cmdpad.init | 14 + utils/cmdpad/patches/100-Makefile.patch | 35 + .../cmdpad/patches/120-kernel26-compat.patch | 15 + utils/cmdpad/patches/130-no_zombie.patch | 18 + utils/cmdpad/patches/140-compile_fix.patch | 11 + utils/collectd/Makefile | 367 + utils/collectd/files/collectd.conf | 39 + utils/collectd/files/collectd.init | 15 + .../001-undefined-AM_PATH_LIBGCRYPT.patch | 4 + .../collectd/patches/003-remove-werror.patch | 22 + .../100-rrdtool-add-rrasingle-option.patch | 57 + .../collectd/patches/140-fix-fqdnlookup.patch | 11 + .../patches/200-fix-git-describe-error.patch | 11 + .../patches/300-delay-first-read-cycle.patch | 11 + .../patches/400-fix-olsrd-get-all.patch | 11 + .../patches/600-fix-libmodbus-detection.patch | 40 + .../patches/900-add-iwinfo-plugin.patch | 276 + .../patches/920-fix-ping-droprate.patch | 11 + utils/coreutils/Makefile | 115 + .../patches/001-no_docs_man_tests.patch | 89 + .../patches/002-fix_compile_with_uclibc.patch | 12 + utils/crelay/Makefile | 74 + utils/crelay/files/crelay.init | 24 + .../crelay/patches/010-link_with_ftdi1.patch | 11 + utils/cryptodev-linux/Makefile | 75 + utils/cryptodev-linux/files/cryptodev.modules | 1 + utils/cryptsetup/Makefile | 79 + utils/dbus/Makefile | 214 + utils/dbus/files/dbus-launch | 12 + utils/dbus/files/dbus.init | 17 + utils/dbus/patches/100-fix-poll-select.patch | 13 + utils/dfu-programmer/Makefile | 46 + utils/dmidecode/Makefile | 48 + utils/dosfstools/Makefile | 52 + ...64-32-heads-sectors-for-targets-smal.patch | 34 + ..._CHECK_LIB-for-iconv-library-linking.patch | 27 + utils/dump1090/Makefile | 79 + utils/dump1090/files/dump1090.config | 50 + utils/dump1090/files/dump1090.default | 16 + utils/dump1090/files/dump1090.init | 105 + utils/dvtm/Makefile | 42 + utils/eudev/Config.in | 68 + utils/eudev/Makefile | 144 + .../0001-mtd_probe-uses-stdint_h.patch | 12 + utils/evtest/Makefile | 45 + utils/f2fs-tools/Makefile | 90 + utils/f2fs-tools/patches/001-compile.patch | 19 + .../patches/010-include-byteswap-h.patch | 10 + ...fs-allow-to-build-without-libselinux.patch | 100 + utils/findutils/Makefile | 88 + utils/flashrom/Makefile | 111 + utils/flashrom/flashrom.mk | 99 + .../patches/0001-fix_internal_bitbang.patch | 11 + .../patches/0002-fix-io-h-include.patch | 12 + utils/flent-tools/Makefile | 51 + utils/fontconfig/Makefile | 64 + utils/gammu/Makefile | 72 + utils/gammu/files/gammu | 5 + utils/gammu/files/gammu.init | 116 + .../patches/001-iconv-disabling-option.patch | 51 + .../patches/002-no-fstack-protector.patch | 11 + .../patches/003-cmake-cross-toolchain.patch | 43 + .../patches/004-cmake_libdbi_optional.patch | 34 + utils/gammu/patches/010-utils-shell-fix.patch | 16 + utils/gkermit/Makefile | 58 + utils/gnupg/Makefile | 91 + utils/gpsd/Makefile | 148 + utils/gpsd/files/gpsd.config | 5 + utils/gpsd/files/gpsd.hotplug | 16 + utils/gpsd/files/gpsd.init | 32 + .../gpsd/patches/0001-Remove-a-BSD-ism.patch | 42 + utils/gptfdisk/Makefile | 87 + utils/grep/Makefile | 60 + utils/gzip/Makefile | 64 + utils/haserl/Config.in | 35 + utils/haserl/Makefile | 57 + .../patches/100-replace-lua2c-with-sed.patch | 82 + .../patches/101-adjust-script-size.patch | 11 + utils/haveged/Makefile | 65 + utils/haveged/files/haveged.init | 16 + utils/hd-idle/Makefile | 55 + utils/hd-idle/files/hd-idle.config | 5 + utils/hd-idle/files/hd-idle.init | 72 + utils/hdparm/Makefile | 42 + utils/hfsprogs/Makefile | 81 + utils/hfsprogs/files/hfsfsck.sh | 30 + ...01-Create-short-Makefiles-for-Debian.patch | 93 + ...002-Add-exclude-Darwin-specific-code.patch | 1407 + ...de-files-absent-from-the-upstream-pa.patch | 1024 + ...004-Fix-compilation-on-64-bit-arches.patch | 131 + ...Remove-Apple-specific-p-from-strings.patch | 291 + .../0006-Adjust-types-for-printing.patch | 37 + .../0007-Fix-path-for-HFS-wrapper-block.patch | 23 + .../0008-Provide-command-line-option-a.patch | 40 + .../0009-Rename-dprintf-to-dbg_printf.patch | 187 + ...10-Rename-custom-macro-nil-with-NULL.patch | 1319 + utils/hfsprogs/patches/0011-Fix-types.patch | 71 + ...t-creating-UUIDs-for-new-filesystems.patch | 50 + .../hfsprogs/patches/0013-Fix-manpages.patch | 157 + .../patches/0014-uClibc_no_loadavg.patch | 15 + .../patches/0015-sysctl-only-on-glibc.patch | 91 + utils/hub-ctrl/Makefile | 53 + utils/i2c-tools/Makefile | 125 + utils/joe/Makefile | 60 + utils/joe/files/joerc | 783 + utils/klish/Makefile | 91 + .../klish/patches/010-shell_execute_fix.patch | 16 + utils/kmod/Makefile | 93 + .../kmod/patches/001-fix_pkgconfig_file.patch | 22 + utils/lcd4linux/Config.in | 490 + utils/lcd4linux/Makefile | 309 + utils/lcd4linux/files/lcd4linux.init | 15 + .../patches/100-drv_RouterBoard.patch | 11 + .../patches/110-uclibc-logarithm-fix.patch | 11 + .../120-remove-as-needed-linker-option.patch | 11 + .../patches/140-no_repnop_T6963.patch | 22 + .../patches/150-addlibmpdclient.patch | 2624 ++ utils/lcd4linux/patches/160-uinput_defs.patch | 24 + .../170-add-generic-spidev-driver.patch | 195 + ...ecify-drv_generic_graphic_real_clear.patch | 45 + .../patches/172-add-TEW673GRU-driver.patch | 552 + .../patches/173-glcd2usb-bigendian-fix.patch | 20 + utils/less/Makefile | 93 + utils/lm-sensors/Makefile | 117 + utils/lm-sensors/files/sensors.conf | 117 + .../lm-sensors/patches/100-musl-compat.patch | 44 + utils/logrotate/Makefile | 62 + utils/logrotate/files/logrotate.conf | 30 + utils/lrzsz/Makefile | 58 + .../patches/100-install_delete_fix.patch | 19 + utils/lsof/Makefile | 68 + utils/lsof/patches/001-lsof_makefile.patch | 13 + utils/lsof/patches/002-lsof_noportmap.patch | 18 + utils/lsof/patches/003-lsof_selinux.patch | 13 + utils/lsof/patches/004-lsof_ccv.patch | 14 + utils/luci-app-lxc/Makefile | 68 + utils/luci-app-lxc/files/controller/lxc.lua | 167 + utils/luci-app-lxc/files/lxc.config | 6 + utils/luci-app-lxc/files/model/cbi/lxc.lua | 31 + utils/luci-app-lxc/files/view/lxc.htm | 458 + .../www/luci-static/resources/cbi/green.gif | Bin 0 -> 310 bytes .../www/luci-static/resources/cbi/purple.gif | Bin 0 -> 317 bytes .../www/luci-static/resources/cbi/red.gif | Bin 0 -> 320 bytes utils/lvm2/Makefile | 95 + utils/lvm2/files/lvm2.init | 14 + utils/lvm2/patches/000-compile.patch | 11 + utils/lvm2/patches/001-include_fix.patch | 11 + utils/lvm2/patches/002-const-stdio.patch | 43 + utils/lvm2/patches/003-no-mallinfo.patch | 45 + ...04-device-include-goto-lable-as-well.patch | 26 + utils/lxc/Config.in | 37 + utils/lxc/Makefile | 280 + utils/lxc/files/lxc-auto.config | 5 + utils/lxc/files/lxc-auto.init | 60 + utils/lxc/files/lxc.conf | 1 + utils/lxc/patches/010-compile.patch | 33 + utils/lxc/patches/015-getline.patch | 15 + utils/lxc/patches/020-lxc-checkconfig.patch | 20 + .../025-remove-unsupported-option.patch | 19 + utils/lxc/patches/030-lxc-download.patch | 43 + utils/lxc/patches/035-fix-undefined-lfd.patch | 20 + utils/macchanger/Makefile | 45 + .../patches/0001-fix-build-with-musl.patch | 13 + utils/mbtools/Makefile | 60 + ...00-fix-unit-test-server-return-value.patch | 10 + utils/mc/Config.in | 59 + utils/mc/Makefile | 127 + utils/mc/patches/010-subshell.patch | 11 + utils/minicom/Makefile | 46 + .../patches/100-fix_iconv_include.patch | 12 + .../patches/101-fix_music_includes.patch | 14 + .../patches/102-fix_musl_compatibility.patch | 13 + utils/mksh/Makefile | 89 + utils/mksh/patches/100-dot_mkshrc | 46 + utils/mktorrent/Makefile | 41 + utils/mmc-utils/Makefile | 56 + ...perly-set-fortify-source-in-makefile.patch | 9 + utils/mmc-utils/patches/002-mmc-ll64.patch | 12 + utils/mpack/Makefile | 45 + utils/mt-st/Makefile | 51 + utils/mysql/Makefile | 189 + utils/mysql/conf/my.cnf | 54 + utils/mysql/files/mysqld.init | 30 + utils/mysql/patches/100-fix_hostname.patch | 11 + utils/mysql/patches/110-cross_compile.patch | 179 + utils/mysql/patches/120-bison-compat.patch | 3290 +++ utils/nano/Makefile | 56 + utils/ncdu/Makefile | 49 + utils/ntfs-3g/Makefile | 234 + ...001-fuseint-fix-path-mounted-on-musl.patch | 30 + utils/oath-toolkit/Makefile | 49 + utils/open-plc-utils/Makefile | 108 + .../patches/100-musl-compat.patch | 33 + utils/open2300/Makefile | 67 + utils/open2300/files/open2300.conf | 65 + utils/open2300/patches/001-crosscompile.patch | 139 + utils/openobex/Makefile | 89 + utils/openobex/patches/001-cxx.patch | 10 + utils/openocd/Makefile | 79 + utils/opensc/Makefile | 224 + utils/opus-tools/Makefile | 47 + utils/owfs/Config.in | 49 + utils/owfs/Makefile | 300 + utils/owfs/files/owfs.conf | 10 + utils/owfs/files/owfs.init | 82 + utils/owfs/files/owftpd.conf | 8 + utils/owfs/files/owftpd.init | 81 + utils/owfs/files/owhttpd.conf | 8 + utils/owfs/files/owhttpd.init | 81 + utils/owfs/files/owserver.conf | 8 + utils/owfs/files/owserver.init | 81 + ...-netlink-w1-status-message-detection.patch | 30 + .../101-fix-no-reset-routine-segfault.patch | 13 + utils/pciutils/Makefile | 73 + .../patches/100-remove-no-timestamping.patch | 11 + utils/pciutils/patches/101-no-strip.patch | 11 + .../pciutils/patches/102-compressed-ids.patch | 31 + .../patches/103-relative-path-ids.patch | 11 + utils/pciutils/patches/104-resolv.patch | 11 + utils/pciutils/patches/105-fix-host.patch | 11 + utils/pcsc-lite/Makefile | 101 + utils/pcsc-lite/files/pcscd.init | 15 + utils/picocom/Makefile | 46 + utils/picocom/patches/100-musl-compat.patch | 17 + utils/pps-tools/Makefile | 49 + utils/procps-ng/Makefile | 99 + .../procps-ng/patches/100-no-tests-docs.patch | 26 + utils/pv/Makefile | 46 + utils/qemu/Makefile | 253 + utils/qemu/files/00-virtio-ports.hotplug | 19 + utils/qemu/files/10-qemu-ga.hotplug | 15 + utils/qemu/files/bridge.conf | 1 + utils/qemu/files/qemu-ga.init | 15 + .../0001-allow-disable-fortify-source.patch | 11 + ...setting-language-type-for-_asm-files.patch | 11 + .../0003-disable-avx2_opt-with-musl.patch | 14 + ...4-pixman-fix-detection-of-mips-dspr2.patch | 10 + .../0005-pixman-arm-neon-assembler-fix.patch | 17 + .../0006-libvixl-cxx-macro-isnan.patch | 55 + utils/relayctl/Makefile | 47 + utils/relayctl/patches/0001-ftdi1.patch | 26 + utils/rng-tools/Makefile | 63 + utils/rng-tools/files/rngd.init | 26 + utils/rng-tools/files/rngd.uci_defaults | 8 + utils/rpcd-mod-lxc/Makefile | 37 + utils/rpcd-mod-lxc/files/CMakeLists.txt | 19 + utils/rpcd-mod-lxc/files/lxc.c | 504 + utils/rrdtool1/Makefile | 135 + .../patches/001-no_ordering_cd_joke.patch | 21 + utils/rrdtool1/patches/002-no_timezone.patch | 24 + .../rrdtool1/patches/020-x86-float-cast.patch | 13 + .../rrdtool1/patches/030-pod2man-stderr.patch | 11 + utils/rtklib/Makefile | 96 + utils/rtl-ais/Makefile | 53 + utils/rtl-ais/files/rtl_ais.init | 38 + utils/rtl-ais/files/uci_rtl_ais | 3 + utils/rtl-sdr/Makefile | 96 + utils/rtl-sdr/files/rtl_tcp.config | 12 + utils/rtl-sdr/files/rtl_tcp.init | 64 + utils/sane-backends/Makefile | 358 + utils/sane-backends/files/xinet.d_sane-port | 14 + .../patches/002-remove-uneeded.patch | 11 + .../patches/020-fix_pieusb.patch | 16 + utils/sane-backends/patches/030-musl.patch | 73 + .../patches/031-fix_uclibc.patch | 38 + ...emove_linked_libs_for_unused_preload.patch | 11 + utils/screen/Makefile | 57 + utils/screen/files/etc/screenrc | 1 + .../patches/100-cross_compile_fix.patch | 64 + ...10-do_not_add_srcdir_to_include_path.patch | 11 + utils/screen/patches/200-musl-compat.patch | 57 + utils/serialconsole/Makefile | 41 + utils/shadow/Makefile | 146 + utils/shadow/patches/001-busybox_ash.patch | 11 + .../patches/002-disable-ruser-lookup.patch | 10 + .../patches/003-fix-disabling-subids.patch | 32 + .../patches/004-fix-su-controoling-term.patch | 16 + utils/sispmctl/Makefile | 56 + utils/sispmctl/patches/001-fix-includes.patch | 25 + utils/slide-switch/Makefile | 60 + utils/smartmontools/Makefile | 91 + utils/smartmontools/files/smartd.conf | 1 + utils/smartmontools/files/smartd.init | 16 + utils/smstools3/Makefile | 68 + utils/smstools3/files/smstools3.conf | 20 + utils/smstools3/files/smstools3.init | 152 + utils/smstools3/patches/001-smsd.patch | 13 + utils/smstools3/patches/002-Makefile.patch | 20 + utils/sockread/Makefile | 35 + utils/sockread/src/Makefile | 11 + utils/sockread/src/main.c | 63 + utils/spi-tools/Makefile | 48 + utils/squashfs-tools/Config.in | 17 + utils/squashfs-tools/Makefile | 87 + ...ix-fnmatch.h-compatibility-with-musl.patch | 120 + ...pseudo.c-add-explicit-stat.h-include.patch | 25 + ...c-get-inline-functions-work-with-C99.patch | 154 + utils/stm32flash/Makefile | 41 + utils/stoken/Makefile | 78 + utils/stress/Makefile | 49 + utils/sumo/Makefile | 63 + utils/sumo/files/sumo.sh | 6 + utils/sumo/patches/100-configure_fix.patch | 14 + utils/swig/Makefile | 40 + utils/sysstat/Makefile | 66 + utils/sysstat/files/sysstat.config | 7 + utils/sysstat/files/sysstat.init | 49 + utils/sysstat/patches/100-musl-compat.patch | 30 + utils/tar/Makefile | 108 + utils/taskwarrior/Makefile | 48 + utils/tcsh/Makefile | 61 + utils/tmux/Makefile | 49 + .../tmux/patches/100-b64_ntop-conflict.patch | 41 + utils/tracertools/Makefile | 42 + utils/triggerhappy/Makefile | 58 + .../files/triggerhappy-example.conf | 14 + utils/triggerhappy/files/triggerhappy.hotplug | 15 + utils/triggerhappy/files/triggerhappy.init | 10 + utils/unzip/Makefile | 74 + .../001-CVE-2014-8139-crc-overflow.patch | 49 + .../002-CVE-2014-8140-test-compr-eb.patch | 23 + .../003-CVE-2014-8141-getzip64data.patch | 133 + .../004-CVE-2014-9636-test-compr-eb.patch | 25 + .../005-CVE-2015-7696-heap-overflow.patch | 21 + .../006-CVE-2015-7697-infinite-loop.patch | 15 + ...007-integer-underflow-csiz_decrypted.patch | 21 + utils/usbmuxd/Makefile | 52 + utils/uvcdynctrl/Makefile | 87 + utils/vim/Makefile | 194 + utils/vim/files/vimrc | 12 + utils/vim/files/vimrc.full | 30 + utils/vim/patches/001-compile.patch | 41 + .../002-remove_helptags_generation.patch | 10 + utils/watchcat/Makefile | 45 + utils/watchcat/files/initd_watchcat | 109 + utils/watchcat/files/uci_defaults_watchcat | 10 + utils/watchcat/files/watchcat.sh | 77 + utils/wifitoggle/Makefile | 46 + utils/wifitoggle/files/wifitoggle.config | 13 + utils/wifitoggle/files/wifitoggle.hotplug | 174 + utils/xz/Makefile | 117 + utils/yunbridge/Makefile | 48 + utils/yunbridge/files/etc/config/yunbridge | 6 + utils/yunbridge/files/etc/init.d/yunbridge | 22 + utils/yunbridge/files/sbin/yunbridge | 6 + .../files/usr/bin/pretty-wifi-info.lua | 75 + .../lib/lua/luci/controller/arduino/index.lua | 414 + .../files/usr/lib/lua/luci/sha256.lua | 199 + utils/yunbridge/patches/000-scripts.patch | 18 + utils/zile/Makefile | 56 + .../010-remove_gets_definition_warning.patch | 11 + utils/zip/Makefile | 61 + utils/zoneinfo/Makefile | 242 + utils/zsh/Makefile | 83 + 2369 files changed, 227946 insertions(+) create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 admin/debootstrap/Makefile create mode 100644 admin/debootstrap/files/pkgdetails.c create mode 100644 admin/debootstrap/patches/100-busybox_fix.patch create mode 100644 admin/htop/Makefile create mode 100644 admin/htop/patches/100-fix-libtool-version-check.patch create mode 100644 admin/monit/Makefile create mode 100644 admin/monit/files/monit.init create mode 100644 admin/monit/patches/001-fix-default-piddir.patch create mode 100644 admin/muninlite/Makefile create mode 100644 admin/muninlite/files/etc/xinetd.d/munin create mode 100644 admin/muninlite/patches/001-fix_disks.patch create mode 100644 admin/muninlite/patches/002-hostname.patch create mode 100644 admin/muninlite/patches/100-fix-no-ethtool.patch create mode 100644 admin/muninlite/patches/110-fix-uptime-days.patch create mode 100644 admin/muninlite/patches/200-add-tap-dev.patch create mode 100644 admin/muninlite/patches/210-add-bridge-devs.patch create mode 100644 admin/muninlite/patches/220-modify-ifname-parser.patch create mode 100644 admin/muninlite/patches/230-fix-available-interface-parsing.patch create mode 100644 admin/netdata/Makefile create mode 100644 admin/netdata/files/netdata.conf create mode 100644 admin/netdata/files/netdata.init create mode 100644 admin/netdata/patches/001-disable_external_plugins_by_default.patch create mode 100644 admin/sudo/Makefile create mode 100755 admin/sudo/files/sudo.init create mode 100644 admin/sudo/patches/010-cross-compile-fixes.patch create mode 100644 admin/sudo/patches/020-no-owner-change.patch create mode 100644 admin/sudo/patches/030-musl-fix-missing-header.patch create mode 100644 admin/zabbix/Makefile create mode 100644 admin/zabbix/files/mac80211 create mode 100644 admin/zabbix/files/network create mode 100644 admin/zabbix/files/wifi create mode 100755 admin/zabbix/files/zabbix_agentd.init create mode 100644 admin/zabbix/files/zabbix_helper_mac80211.c create mode 100644 admin/zabbix/patches/002-fix-res_send-on-uclibc.patch create mode 100644 admin/zabbix/patches/002-uclibc_loadavg.patch create mode 100644 admin/zabbix/patches/003-change-user-and-foreground.patch create mode 100644 admin/zabbix/patches/010-change-agentd-config.patch create mode 100644 admin/zabbix/patches/100-musl-compat.patch create mode 100644 devel/autoconf/Makefile create mode 100644 devel/automake/Makefile create mode 100644 devel/diffutils/Makefile create mode 100644 devel/gcc/Makefile create mode 100644 devel/gcc/README create mode 100644 devel/gcc/patches/001-revert_register_mode_search.patch create mode 100644 devel/gcc/patches/002-case_insensitive.patch create mode 100644 devel/gcc/patches/002-dont-choke-when-building-32bit-on-64bit.patch create mode 100644 devel/gcc/patches/003-mpfr-longlong-mips.patch create mode 100644 devel/gcc/patches/010-documentation.patch create mode 100644 devel/gcc/patches/020-no-plt-backport.patch create mode 100644 devel/gcc/patches/040-fix-mips-ICE-PR-68400.patch create mode 100644 devel/gcc/patches/100-uclibc-conf.patch create mode 100644 devel/gcc/patches/200-musl_config.patch create mode 100644 devel/gcc/patches/201-musl_arm.patch create mode 100644 devel/gcc/patches/202-musl_mips.patch create mode 100644 devel/gcc/patches/203-musl_powerpc.patch create mode 100644 devel/gcc/patches/204-musl_sh.patch create mode 100644 devel/gcc/patches/205-musl_x86.patch create mode 100644 devel/gcc/patches/206-musl_aarch64.patch create mode 100644 devel/gcc/patches/207-musl_fixincludes.patch create mode 100644 devel/gcc/patches/209-musl_libstdc++.patch create mode 100644 devel/gcc/patches/230-musl_libssp.patch create mode 100644 devel/gcc/patches/240-musl-libitm-fixes.patch create mode 100644 devel/gcc/patches/250-add-musl.patch create mode 100644 devel/gcc/patches/260-musl-add-unwind-fix.patch create mode 100644 devel/gcc/patches/270-musl-add-powerpc-softfloat-fix.patch create mode 100644 devel/gcc/patches/300-mips_Os_cpu_rtx_cost_model.patch create mode 100644 devel/gcc/patches/800-arm_v5te_no_ldrd_strd.patch create mode 100644 devel/gcc/patches/810-arm-softfloat-libgcc.patch create mode 100644 devel/gcc/patches/820-libgcc_pic.patch create mode 100644 devel/gcc/patches/830-arm_unbreak_armv4t.patch create mode 100644 devel/gcc/patches/840-armv4_pass_fix-v4bx_to_ld.patch create mode 100644 devel/gcc/patches/850-use_shared_libgcc.patch create mode 100644 devel/gcc/patches/851-libgcc_no_compat.patch create mode 100644 devel/gcc/patches/870-ppc_no_crtsavres.patch create mode 100644 devel/gcc/patches/880-no_java_section.patch create mode 100644 devel/gcc/patches/900-bad-mips16-crt.patch create mode 100644 devel/gcc/patches/910-mbsd_multi.patch create mode 100644 devel/gcc/patches/920-specs_nonfatal_getenv.patch create mode 100644 devel/gcc/patches/930-fix-mips-noexecstack.patch create mode 100644 devel/gcc/patches/930-osdefines.patch create mode 100644 devel/gcc/patches/940-no-clobber-stamp-bits.patch create mode 100644 devel/gcc/patches/950-cpp_file_path_translation.patch create mode 100644 devel/gcc/patches/960-go_libm.patch create mode 100644 devel/gcc/patches/970-warn_bug.patch create mode 100644 devel/libtool-bin/Makefile create mode 100644 devel/lpc21isp/Makefile create mode 100644 devel/lttng-modules/Makefile create mode 100644 devel/lttng-modules/patches/001-mm_page_alloc_extfrag.patch create mode 100644 devel/lttng-tools/Makefile create mode 100644 devel/lttng-tools/patches/100-musl-compat.patch create mode 100644 devel/lttng-tools/patches/200-use-extern.patch create mode 100644 devel/m4/Makefile create mode 100644 devel/make/Makefile create mode 100644 devel/patch/Makefile create mode 100644 devel/pkg-config/Makefile create mode 100644 ipv6/aiccu/Makefile create mode 100644 ipv6/aiccu/files/aiccu.hotplug create mode 100755 ipv6/aiccu/files/aiccu.sh create mode 100644 ipv6/aiccu/patches/100-cross_compile.patch create mode 100644 ipv6/aiccu/patches/200-add_dn_skipname.patch create mode 100644 ipv6/aiccu/patches/300-resolver-uclibc.patch create mode 100644 ipv6/aiccu/patches/400-musl-compat.patch create mode 100644 ipv6/aiccu/patches/500-gnutls_3.4.patch create mode 100644 ipv6/tayga/Makefile create mode 100755 ipv6/tayga/files/tayga-proto.sh create mode 100644 ipv6/tayga/files/tayga.hotplug create mode 100644 ipv6/tayga/files/tayga.sh create mode 100644 ipv6/tayga/patches/001-configure_unset_CFLAGS.patch create mode 100644 ipv6/tayga/patches/002-bigendian_wrong_checksum.patch create mode 100644 kernel/exfat-nofuse/Makefile create mode 100644 kernel/mtd-rw/Makefile create mode 100644 lang/chardet/Makefile create mode 100644 lang/django-appconf/Makefile create mode 100644 lang/django-compressor/Makefile create mode 100644 lang/django-constance/Makefile create mode 100644 lang/django-jsonfield/Makefile create mode 100644 lang/django-picklefield/Makefile create mode 100644 lang/django-postoffice/Makefile create mode 100644 lang/django-restframework/Makefile create mode 100644 lang/django-statici18n/Makefile create mode 100644 lang/django/Makefile create mode 100644 lang/dkjson/Makefile create mode 100644 lang/erlang/Makefile create mode 100644 lang/erlang/patches/101-emulator_includes.patch create mode 100644 lang/erlang/patches/102-musl_compat.patch create mode 100644 lang/erlang/patches/103-disable_emacs.patch create mode 100644 lang/et_xmlfile/Makefile create mode 100644 lang/flup/Makefile create mode 100644 lang/gunicorn/Makefile create mode 100644 lang/jamvm/Makefile create mode 100644 lang/jdcal/Makefile create mode 100644 lang/json4lua/Makefile create mode 100644 lang/lpeg/Makefile create mode 100644 lang/lua-bencode/Makefile create mode 100644 lang/lua-cjson/Makefile create mode 100644 lang/lua-copas/Makefile create mode 100644 lang/lua-copas/patches/makefile.patch create mode 100644 lang/lua-coxpcall/Makefile create mode 100644 lang/lua-coxpcall/patches/config.patch create mode 100644 lang/lua-lsqlite3/Makefile create mode 100644 lang/lua-lzlib/Makefile create mode 100644 lang/lua-lzlib/patches/001-allow_optim_flags.patch create mode 100644 lang/lua-md5/Makefile create mode 100644 lang/lua-md5/patches/config.patch create mode 100644 lang/lua-md5/patches/makefile.patch create mode 100644 lang/lua-mobdebug/Makefile create mode 100644 lang/lua-openssl/Makefile create mode 100644 lang/lua-openssl/patches/0001-Revise-Makefile.patch create mode 100644 lang/lua-openssl/patches/0010-Fix-Linkage.patch create mode 100644 lang/lua-openssl/patches/0020-support-OPENSSL_NO_SSL3_METHOD.patch create mode 100644 lang/lua-openssl/patches/0030-support-OPENSSL_NO_COMP.patch create mode 100644 lang/lua-penlight/Makefile create mode 100644 lang/lua-rings/Makefile create mode 100644 lang/lua-rings/patches/config.patch create mode 100644 lang/lua-rings/patches/makefile.patch create mode 100644 lang/lua-rs232/Makefile create mode 100644 lang/lua-sha2/Makefile create mode 100644 lang/lua-sha2/patches/001-makefile.patch create mode 100644 lang/lua-wsapi/Makefile create mode 100644 lang/lua-xavante/Makefile create mode 100644 lang/luabitop/Makefile create mode 100644 lang/luaexpat/Makefile create mode 100644 lang/luaexpat/files/compat-5.1r5/compat-5.1.c create mode 100644 lang/luaexpat/files/compat-5.1r5/compat-5.1.h create mode 100644 lang/luaexpat/files/compat-5.1r5/compat-5.1.lua create mode 100644 lang/luafilesystem/Makefile create mode 100755 lang/luai2c/Makefile create mode 100644 lang/lualanes/Makefile create mode 100644 lang/lualanes/patches/100-musl-compat.patch create mode 100644 lang/luaposix/Makefile create mode 100644 lang/luaposix/patches/100-eglibc-compat.patch create mode 100644 lang/luaposix/patches/101-disable-curses.patch create mode 100644 lang/luaposix/patches/102-disable-compat-deprecated.diff create mode 100644 lang/luarocks/Makefile create mode 100644 lang/luarocks/patches/01_dont_modify_bin_shebang.diff create mode 100644 lang/luasec/Makefile create mode 100644 lang/luasoap/Makefile create mode 100644 lang/luasocket/Makefile create mode 100644 lang/luasocket/patches/0001-Add-interface-support.patch create mode 100644 lang/luasql/Makefile create mode 100644 lang/lzmq/Makefile create mode 100644 lang/micropython-lib/Makefile create mode 100644 lang/micropython/Makefile create mode 100644 lang/micropython/patches/000-Makefile-no-errors create mode 100644 lang/node-arduino-firmata/Makefile create mode 100644 lang/node-arduino-firmata/files/usr/lib/node/arduino-firmata/lib/arduino-firmata.js create mode 100644 lang/node-arduino-firmata/patches/000-new-serialport.patch create mode 100644 lang/node-cylon/Makefile create mode 100644 lang/node-cylon/patches/0001-serialport.patch create mode 100644 lang/node-hid/Makefile create mode 100644 lang/node-serialport/Makefile create mode 100644 lang/node/Makefile create mode 100644 lang/node/patches/001-hardfloat.patch create mode 100644 lang/node/patches/002-addr_info.patch create mode 100644 lang/node/patches/003-path.patch create mode 100644 lang/openpyxl/Makefile create mode 100644 lang/perl-cgi/Makefile create mode 100644 lang/perl-compress-bzip2/Makefile create mode 100644 lang/perl-dbi/Makefile create mode 100644 lang/perl-device-serialport/Makefile create mode 100644 lang/perl-device-usb/Makefile create mode 100644 lang/perl-device-usb/README.patches create mode 100644 lang/perl-device-usb/patches/100-fix_buildsystem.patch create mode 100644 lang/perl-device-usb/patches/110-just_assume_libusb_is_there.diff create mode 100644 lang/perl-device-usb/patches/120-use_libusb_0_1.patch create mode 100644 lang/perl-device-usb/patches/130-provide-proper-library-paths.patch create mode 100644 lang/perl-device-usb/patches/140-avoid-libusb-name-conflicts.patch create mode 100644 lang/perl-encode-locale/Makefile create mode 100644 lang/perl-file-listing/Makefile create mode 100644 lang/perl-file-sharedir-install/Makefile create mode 100644 lang/perl-html-form/Makefile create mode 100644 lang/perl-html-parser/Makefile create mode 100644 lang/perl-html-tagset/Makefile create mode 100644 lang/perl-html-tree/Makefile create mode 100644 lang/perl-http-cookies/Makefile create mode 100644 lang/perl-http-daemon/Makefile create mode 100644 lang/perl-http-date/Makefile create mode 100644 lang/perl-http-message/Makefile create mode 100644 lang/perl-http-negotiate/Makefile create mode 100644 lang/perl-http-server-simple/Makefile create mode 100644 lang/perl-inline-c/Makefile create mode 100644 lang/perl-inline-c/patches/100-inline_c-no_compile_hack.patch create mode 100644 lang/perl-inline-c/patches/110-inline_c-make_system_typemap_overridable.patch create mode 100644 lang/perl-inline/Makefile create mode 100644 lang/perl-io-html/Makefile create mode 100644 lang/perl-lockfile-simple/Makefile create mode 100644 lang/perl-lwp-mediatypes/Makefile create mode 100644 lang/perl-net-http/Makefile create mode 100644 lang/perl-net-telnet/Makefile create mode 100644 lang/perl-parse-recdescent/Makefile create mode 100644 lang/perl-sub-uplevel/Makefile create mode 100644 lang/perl-test-harness/Makefile create mode 100644 lang/perl-test-warn/Makefile create mode 100644 lang/perl-uri/Makefile create mode 100644 lang/perl-www-mechanize/Makefile create mode 100644 lang/perl-www-robotrules/Makefile create mode 100644 lang/perl-www/Makefile create mode 100644 lang/perl-xml-parser/Makefile create mode 100644 lang/perl-xml-parser/patches/010-xml-parser-expat-use-ppport.h create mode 100644 lang/perl-xml-parser/patches/020-xml-parser-expat-lib-inc-path-anchor.patch create mode 100644 lang/perl/Config.in create mode 100644 lang/perl/Makefile create mode 100644 lang/perl/README.patches create mode 100644 lang/perl/files/README.config create mode 100644 lang/perl/files/architecture.config create mode 100644 lang/perl/files/arm.config create mode 100644 lang/perl/files/armeb.config create mode 100644 lang/perl/files/base.config create mode 100644 lang/perl/files/i486.config create mode 100644 lang/perl/files/libc.config create mode 100644 lang/perl/files/mips.config create mode 100644 lang/perl/files/mips64.config create mode 100644 lang/perl/files/mipsel.config create mode 100644 lang/perl/files/misc.config create mode 100755 lang/perl/files/perl-run_tests.sh create mode 100644 lang/perl/files/perlconfig.pl create mode 100644 lang/perl/files/powerpc.config create mode 100644 lang/perl/files/signal.config create mode 100644 lang/perl/files/threads.config create mode 100644 lang/perl/files/version.config create mode 100644 lang/perl/files/x86_64.config create mode 100644 lang/perl/patches/010-musl-compat.patch create mode 100644 lang/perl/patches/020-host-libc-dir-moved-debian+derivatives.patch create mode 100644 lang/perl/patches/100-fix-cross-compile-endianness-detection.patch create mode 100644 lang/perl/patches/110-always_use_miniperl.patch create mode 100644 lang/perl/patches/300-add-relink-hack.patch create mode 100644 lang/perl/patches/310-recompile-hack.patch create mode 100644 lang/perl/patches/700-tie_fetch_count_t-handle_missing_crypt.patch create mode 100644 lang/perl/patches/710-threads_join-skip_ps_on_busybox.patch create mode 100644 lang/perl/patches/900-CVE-2015-8607.patch create mode 100644 lang/perl/patches/901-CVE-2016-2381.patch create mode 100644 lang/perl/perlbase.mk create mode 100644 lang/perl/perlmod.mk create mode 100644 lang/php7-pecl-dio/Makefile create mode 100644 lang/php7-pecl-dio/patches/0000-unify-line-endings.patch create mode 100644 lang/php7-pecl-dio/patches/0001-fix-svn-prop.patch create mode 100644 lang/php7-pecl-dio/patches/0002-fix-Wunused-variable.patch create mode 100644 lang/php7-pecl-dio/patches/0003-Fix-Wmaybe-uninitialized.patch create mode 100644 lang/php7-pecl-dio/patches/0004-Fix-last-build-warning-Wunused-but-set-variable-sorr.patch create mode 100644 lang/php7-pecl-dio/patches/0005-Added-LICENCE-file-as-requested-in-Request-65869.patch create mode 100644 lang/php7-pecl-dio/patches/0006-Replace-ZEND_FETCH_RESOURCE-macro-with-zend_fetch_re.patch create mode 100644 lang/php7-pecl-dio/patches/0007-Replace-ZEND_REGISTER_RESOURCE-with-zend_register_re.patch create mode 100644 lang/php7-pecl-dio/patches/0008-RETURN_STRINGL-takes-only-2-arguments.patch create mode 100644 lang/php7-pecl-dio/patches/0009-Replace-zend_hash_find-with-zend_hash_str_find.patch create mode 100644 lang/php7-pecl-dio/patches/0010-Replace-dio_convert_to_long.patch create mode 100644 lang/php7-pecl-dio/patches/0011-Adopt-to-changed-stream-API-interface.patch create mode 100644 lang/php7-pecl-dio/patches/0012-Remove-ancient-macros-TSRMLS_CC-and-TSRMLS_DC.patch create mode 100644 lang/php7-pecl-dio/patches/0013-Fix-tests-for-legacy-interface.patch create mode 100644 lang/php7-pecl-dio/patches/0014-Add-missing-changes-from-changed-stream-API-interfac.patch create mode 100644 lang/php7-pecl-dio/patches/0015-Add-.gitignore.patch create mode 100644 lang/php7-pecl-dio/patches/0016-Add-additional-baudrates.patch create mode 100644 lang/php7-pecl-http/Makefile create mode 100644 lang/php7-pecl-http/patches/100_config9-m4.patch create mode 100644 lang/php7-pecl-libevent/Makefile create mode 100644 lang/php7-pecl-libevent/patches/010-libevent2.patch create mode 100644 lang/php7-pecl-propro/Makefile create mode 100644 lang/php7-pecl-raphf/Makefile create mode 100644 lang/php7/Makefile create mode 100644 lang/php7/files/php.ini create mode 100644 lang/php7/files/php7-fastcgi.config create mode 100644 lang/php7/files/php7-fastcgi.init create mode 100644 lang/php7/files/php7-fpm-www.conf create mode 100644 lang/php7/files/php7-fpm.conf create mode 100644 lang/php7/files/php7-fpm.config create mode 100644 lang/php7/files/php7-fpm.init create mode 100644 lang/php7/patches/0013-Add-support-for-use-of-the-system-timezone-database.patch create mode 100644 lang/php7/patches/0016-dont-gitclean-in-build.patch create mode 100644 lang/php7/patches/0032-Use-system-timezone.patch create mode 100644 lang/php7/patches/0041-Add-patch-to-remove-build-timestamps-from-generated-.patch create mode 100644 lang/php7/patches/0042-Remove-W3C-validation-icon-to-not-expose-the-reader-.patch create mode 100644 lang/php7/patches/1000-fix_membar_producer_link_error_gcc3x.patch create mode 100644 lang/php7/patches/1001-ext-opcache-fix-detection-of-shm-mmap.patch create mode 100644 lang/php7/patches/1002-gd-iconv.patch create mode 100644 lang/php7/patches/1003-Fix-dl-cross-compiling-issue.patch create mode 100644 lang/php7/patches/1004-disable-phar-command.patch create mode 100644 lang/php7/pecl.mk create mode 100644 lang/pillow/Makefile create mode 100644 lang/pillow/patches/010-fix-paths.patch create mode 100644 lang/python-attrs/Makefile create mode 100644 lang/python-cffi/Makefile create mode 100644 lang/python-crcmod/Makefile create mode 100644 lang/python-crypto/Makefile create mode 100644 lang/python-crypto/patches/001-no-host-paths.patch create mode 100644 lang/python-crypto/patches/002-fix-endianness-detect.patch create mode 100644 lang/python-cryptography/Makefile create mode 100644 lang/python-dateutil/Makefile create mode 100644 lang/python-dns/Makefile create mode 100644 lang/python-egenix-mx-base/Makefile create mode 100644 lang/python-enum34/Makefile create mode 100644 lang/python-enum34/patches/001-omit-docs.patch create mode 100644 lang/python-gmpy/Makefile create mode 100644 lang/python-gmpy2/Makefile create mode 100644 lang/python-idna/Makefile create mode 100644 lang/python-ipaddress/Makefile create mode 100644 lang/python-ldap/Makefile create mode 100644 lang/python-ldap/patches/010-setup_cfg.patch create mode 100644 lang/python-mysql/Makefile create mode 100644 lang/python-mysql/patches/010-threadsafe.patch create mode 100644 lang/python-packages/Makefile create mode 100644 lang/python-packages/README.md create mode 100644 lang/python-parsley/Makefile create mode 100644 lang/python-parsley/patches/001-omit-tests.patch create mode 100644 lang/python-pcapy/Makefile create mode 100644 lang/python-pip/Makefile create mode 100644 lang/python-pip/files/pip.conf create mode 100644 lang/python-ply/Makefile create mode 100644 lang/python-psycopg2/Makefile create mode 100644 lang/python-pyasn1-modules/Makefile create mode 100644 lang/python-pyasn1/Makefile create mode 100644 lang/python-pycparser/Makefile create mode 100644 lang/python-pycparser/patches/001-use-external-ply.patch create mode 100644 lang/python-pyopenssl/Makefile create mode 100644 lang/python-pyptlib/Makefile create mode 100644 lang/python-pyserial/Makefile create mode 100644 lang/python-service-identity/Makefile create mode 100644 lang/python-setuptools/Makefile create mode 100644 lang/python-setuptools/patches/0001-remove-windows-support.patch create mode 100644 lang/python-setuptools/patches/0002-fix-pyvenv-environment-get.patch create mode 100644 lang/python-six/Makefile create mode 100644 lang/python-txsocksx/Makefile create mode 100644 lang/python-txsocksx/patches/001-omit-tests.patch create mode 100644 lang/python-txsocksx/patches/002-do-not-use-vcversioner.patch create mode 100644 lang/python-urllib3/Makefile create mode 100644 lang/python-yaml/Makefile create mode 100644 lang/python/Makefile create mode 100644 lang/python/files/config.site create mode 100644 lang/python/files/python-host.mk create mode 100644 lang/python/files/python-package-codecs.mk create mode 100644 lang/python/files/python-package-compiler.mk create mode 100644 lang/python/files/python-package-ctypes.mk create mode 100644 lang/python/files/python-package-db.mk create mode 100644 lang/python/files/python-package-decimal.mk create mode 100644 lang/python/files/python-package-dev.mk create mode 100644 lang/python/files/python-package-distutils.mk create mode 100644 lang/python/files/python-package-email.mk create mode 100644 lang/python/files/python-package-gdbm.mk create mode 100644 lang/python/files/python-package-lib2to3.mk create mode 100644 lang/python/files/python-package-logging.mk create mode 100644 lang/python/files/python-package-multiprocessing.mk create mode 100644 lang/python/files/python-package-ncurses.mk create mode 100644 lang/python/files/python-package-openssl.mk create mode 100644 lang/python/files/python-package-pydoc.mk create mode 100644 lang/python/files/python-package-sqlite3.mk create mode 100644 lang/python/files/python-package-unittest.mk create mode 100644 lang/python/files/python-package-xml.mk create mode 100644 lang/python/files/python-package.mk create mode 100644 lang/python/files/python-version.mk create mode 100644 lang/python/patches/001-enable-zlib.patch create mode 100644 lang/python/patches/002-do-not-add-include-dirs-when-cross-compiling.patch create mode 100644 lang/python/patches/003-do-not-compile-tests-at-build.patch create mode 100644 lang/python/patches/004-do-not-write-bytes-codes.patch create mode 100644 lang/python/patches/005-fix-libffi-x86-64-configure.patch create mode 100644 lang/python/patches/006-remove-debian-multiarch-support.patch create mode 100644 lang/python/patches/007-distutils-do-not-adjust-path.patch create mode 100644 lang/python/patches/008-distutils-use-python-sysroot.patch create mode 100644 lang/python/patches/009-do-not-use-dblib_dir-when-cross-compiling.patch create mode 100644 lang/python/patches/010-do-not-add-rt-lib-dirs-when-cross-compiling.patch create mode 100644 lang/python/patches/011-do-not-prefer-ncursesw.patch create mode 100644 lang/python3-bottle/Makefile create mode 100644 lang/python3-pip/Makefile create mode 100644 lang/python3-pip/patches/0001-remove-self-version-checking.patch create mode 100644 lang/python3-setuptools/Makefile create mode 100644 lang/python3-setuptools/patches/0001-remove-windows-support.patch create mode 100644 lang/python3-setuptools/patches/0002-fix-pyvenv-environment-get.patch create mode 100644 lang/python3/Makefile create mode 100644 lang/python3/files/config.site create mode 100644 lang/python3/files/python3-package-asyncio.mk create mode 100644 lang/python3/files/python3-package-codecs.mk create mode 100644 lang/python3/files/python3-package-ctypes.mk create mode 100644 lang/python3/files/python3-package-dbm.mk create mode 100644 lang/python3/files/python3-package-decimal.mk create mode 100644 lang/python3/files/python3-package-dev.mk create mode 100644 lang/python3/files/python3-package-distutils.mk create mode 100644 lang/python3/files/python3-package-email.mk create mode 100644 lang/python3/files/python3-package-gdbm.mk create mode 100644 lang/python3/files/python3-package-lib2to3.mk create mode 100644 lang/python3/files/python3-package-logging.mk create mode 100644 lang/python3/files/python3-package-lzma.mk create mode 100644 lang/python3/files/python3-package-multiprocessing.mk create mode 100644 lang/python3/files/python3-package-ncurses.mk create mode 100644 lang/python3/files/python3-package-openssl.mk create mode 100644 lang/python3/files/python3-package-pydoc.mk create mode 100644 lang/python3/files/python3-package-sqlite3.mk create mode 100644 lang/python3/files/python3-package-unittest.mk create mode 100644 lang/python3/files/python3-package-xml.mk create mode 100644 lang/python3/files/python3-package.mk create mode 100644 lang/python3/patches/001-enable-zlib.patch create mode 100644 lang/python3/patches/002-do-not-add-include-dirs-when-cross-compiling.patch create mode 100644 lang/python3/patches/003-do-not-run-distutils-tests.patch create mode 100644 lang/python3/patches/004-do-not-write-bytes-codes.patch create mode 100644 lang/python3/patches/005-fix-libffi-x86-64-configure.patch create mode 100644 lang/python3/patches/006-remove-debian-multiarch-support.patch create mode 100644 lang/python3/patches/007-distutils-do-not-adjust-path.patch create mode 100644 lang/python3/patches/010-do-not-add-rt-lib-dirs-when-cross-compiling.patch create mode 100644 lang/python3/patches/011-do-not-prefer-ncursesw.patch create mode 100644 lang/python3/patches/012-disable-wcsftime-detection.patch create mode 100644 lang/python3/patches/014-remove-platform-so-suffix.patch create mode 100644 lang/python3/patches/015-abort-on-failed-modules.patch create mode 100644 lang/pytz/Makefile create mode 100644 lang/rcssmin/Makefile create mode 100644 lang/ruby/Makefile create mode 100644 lang/ruby/files/ruby create mode 100644 lang/ruby/patches/001-acinclude.m4_rename_aclocal.m4.patch create mode 100644 lang/ruby/ruby_find_pkgsdeps create mode 100644 lang/ruby/ruby_missingfiles create mode 100644 lang/simplejson/Makefile create mode 100644 lang/tcl/Makefile create mode 100644 lang/tcl/patches/100-disable_tzdata_and_msgs_install.patch create mode 100644 lang/tcl/patches/200-fix_mips_build.patch create mode 100644 lang/twisted/Makefile create mode 100644 lang/twisted/patches/001-fix-zsh-completion.patch create mode 100644 lang/twisted/patches/002-omit-tests.patch create mode 100644 lang/uuid/Makefile create mode 100644 lang/vala/Makefile create mode 100644 lang/zope-interface/Makefile create mode 100644 libs/alsa-lib/Makefile create mode 100644 libs/alsa-lib/patches/001-link_fix.patch create mode 100644 libs/alsa-lib/patches/005-fix_include_file_redirect_warnings.patch create mode 100644 libs/apr-util/Makefile create mode 100644 libs/apr-util/patches/001-automake-compat.patch create mode 100644 libs/apr/Makefile create mode 100644 libs/apr/patches/001-autoconf-compat.patch create mode 100644 libs/apr/patches/101-fix_apr_time_now.patch create mode 100644 libs/apr/patches/201-upgrade-and-fix-1.5.1.patch create mode 100644 libs/avahi/Makefile create mode 100644 libs/avahi/files/avahi-daemon.conf create mode 100644 libs/avahi/files/avahi-daemon.init create mode 100755 libs/avahi/files/netifd-autoip.sh create mode 100644 libs/avahi/files/service-http create mode 100644 libs/avahi/files/service-ssh create mode 100644 libs/avahi/patches/010-step_back_autotools-no-gettext.patch create mode 100644 libs/avahi/patches/011-fix-poll-h-warnings-on-musl.patch create mode 100644 libs/avro/Makefile create mode 100644 libs/boost/Makefile create mode 100644 libs/boost/patches/01_fiber_fix.patch create mode 100644 libs/c-ares/Makefile create mode 100644 libs/check/Makefile create mode 100644 libs/classpath/Makefile create mode 100644 libs/classpath/patches/010-double-memleak.patch create mode 100644 libs/confuse/Makefile create mode 100644 libs/cyrus-sasl/Makefile create mode 100644 libs/db47/Makefile create mode 100644 libs/db47/patches/010-patch.4.7.25.1.patch create mode 100644 libs/db47/patches/020-patch.4.7.25.2.patch create mode 100644 libs/db47/patches/030-patch.4.7.25.3.patch create mode 100644 libs/db47/patches/040-patch.4.7.25.4.patch create mode 100644 libs/db47/patches/100-repmgr-format-security.patch create mode 100644 libs/dmx_usb_module/Makefile create mode 100644 libs/dmx_usb_module/patches/001-dmx_usb_Makefile.patch create mode 100644 libs/dtndht/Makefile create mode 100644 libs/dtndht/patches/001-musl_header.patch create mode 100644 libs/elektra/Makefile create mode 100644 libs/expat/Makefile create mode 100644 libs/faad2/Config.in create mode 100644 libs/faad2/Makefile create mode 100644 libs/fcgi/Makefile create mode 100644 libs/fcgi/patches/100-fcgio-int-type-fix.patch create mode 100644 libs/fcgi/patches/110-no_examples.patch create mode 100644 libs/fcgi/patches/120-stdio.patch create mode 100644 libs/fftw3/Makefile create mode 100644 libs/fftw3/patches/001-makefile.patch create mode 100644 libs/file/Makefile create mode 100644 libs/flac/Makefile create mode 100644 libs/flac/patches/001-no-docs-and-examples.patch create mode 100644 libs/flac/patches/002-no-utility.patch create mode 100644 libs/flac/patches/005-gcc_debug_options.patch create mode 100644 libs/flac/patches/010-automake-compat.patch create mode 100644 libs/flac/patches/020-fix-musl-sigemptyset-x86.patch create mode 100644 libs/freetype/Makefile create mode 100644 libs/gdbm/Makefile create mode 100644 libs/giflib/Makefile create mode 100644 libs/giflib/patches/100-no-docs.patch create mode 100644 libs/glib2/Makefile create mode 100644 libs/glib2/patches/001-automake-compat.patch create mode 100644 libs/glib2/patches/002-gdate-Suppress-string-format-literal-warning.patch create mode 100644 libs/glpk/Makefile create mode 100644 libs/gnutls/Config.in create mode 100644 libs/gnutls/Makefile create mode 100644 libs/gperf/Makefile create mode 100644 libs/hidapi/Makefile create mode 100644 libs/hidapi/patches/010-add-iconv-linkage.patch create mode 100644 libs/hiredis/Makefile create mode 100644 libs/ibrcommon/Makefile create mode 100644 libs/ibrcommon/patches/001-fix-build-with-musl.patch create mode 100644 libs/ibrdtn/Makefile create mode 100644 libs/icu/Makefile create mode 100644 libs/icu/patches/000-dont-cpy-files-from-topdirs.patch create mode 100644 libs/intltool/Makefile create mode 100644 libs/intltool/patches/100-optional-perl-xml-parser.patch create mode 100644 libs/jansson/Makefile create mode 100644 libs/ldns/Makefile create mode 100644 libs/ldns/patches/001-perl5-defined-array.patch create mode 100644 libs/libaio/Makefile create mode 100644 libs/libaio/patches/001_arches.patch create mode 100644 libs/libaio/patches/002_arches_sh.patch create mode 100644 libs/libaio/patches/003_arches_sparc64.patch create mode 100644 libs/libaio/patches/004_arches_x32.patch create mode 100644 libs/libaio/patches/005_arches_mips.patch create mode 100644 libs/libaio/patches/006_arches_mips_fix_padding.patch create mode 100644 libs/libantlr3c/Makefile create mode 100644 libs/libao/Makefile create mode 100644 libs/libarchive/Makefile create mode 100644 libs/libartnet/Makefile create mode 100644 libs/libartnet/patches/001-bswap_16.patch create mode 100644 libs/libaudiofile/Makefile create mode 100644 libs/libavl/Makefile create mode 100644 libs/libavl/patches/010-update_GNUmakefile.patch create mode 100644 libs/libcanfestival/Makefile create mode 100644 libs/libcanfestival/patches/001-sigval-ref-fix.patch create mode 100644 libs/libcanfestival/patches/002-makefile-gcc-linker.patch create mode 100644 libs/libcanfestival/patches/003-makefile-skip-examples.patch create mode 100644 libs/libcap/Makefile create mode 100644 libs/libcap/patches/100-portability.patch create mode 100644 libs/libcoap/Makefile create mode 100644 libs/libdaemon/Makefile create mode 100644 libs/libdaemon/patches/001-daemon_set_verbosity.patch create mode 100644 libs/libdaq/Makefile create mode 100644 libs/libdaq/patches/001-compile.patch create mode 100644 libs/libdaq/patches/100-musl-compat.patch create mode 100644 libs/libdbi-drivers/Makefile create mode 100644 libs/libdbi-drivers/patches/001_libsqlite3_fix.patch create mode 100644 libs/libdbi/Makefile create mode 100644 libs/libdmapsharing/Makefile create mode 100644 libs/libdmapsharing/patches/001-disable_pixbuf.patch create mode 100644 libs/libdmapsharing/patches/002-disable_tests.patch create mode 100644 libs/libdmapsharing/patches/003-make_unit_test_optional.patch create mode 100644 libs/libdnet/Makefile create mode 100644 libs/libdnet/patches/001-compile.patch create mode 100644 libs/libdnet/patches/002-config.patch create mode 100644 libs/libdouble-conversion/Makefile create mode 100644 libs/libdrm/Makefile create mode 100644 libs/libdrm/patches/000-remove-dep-on-pthread-stubs.patch create mode 100644 libs/libedit/Makefile create mode 100644 libs/libesmtp/Makefile create mode 100644 libs/libestr/Makefile create mode 100644 libs/libev/Makefile create mode 100644 libs/libevdev/Makefile create mode 100644 libs/libevdev/patches/010-no-clock-monotonic-raw-in-uclibc.patch create mode 100644 libs/libevent/Makefile create mode 100644 libs/libevhtp/Makefile create mode 100644 libs/libevhtp/patches/010-strcmp-endianness-fix.patch create mode 100644 libs/libexif/Makefile create mode 100644 libs/libexif/patches/100-no_doc.patch create mode 100644 libs/libextractor/Makefile create mode 100644 libs/libextractor/patches/001-backport-support-for-giflib-5-1.patch create mode 100644 libs/libfastjson/Makefile create mode 100644 libs/libffi/Makefile create mode 100644 libs/libffi/patches/002-fix-toolexeclibdir-path.patch create mode 100644 libs/libffi/patches/100-fix_mips_softfloat.patch create mode 100644 libs/libftdi/Makefile create mode 100644 libs/libftdi/patches/100-fix-x86_64-build.patch create mode 100644 libs/libftdi/patches/101-fix-cmake-version-packagekit.patch create mode 100644 libs/libftdi/patches/102-fix-cmake-include-examples.patch create mode 100644 libs/libftdi1/Makefile create mode 100644 libs/libftdi1/patches/100-fix-x86_64-build.patch create mode 100644 libs/libgcrypt/Makefile create mode 100644 libs/libgcrypt/patches/001-no_docs_tests.patch create mode 100644 libs/libgd/Makefile create mode 100644 libs/libgd/patches/101-gdlib-config.patch create mode 100644 libs/libgd/patches/200-uclibc-ceill.patch create mode 100644 libs/libgee/Makefile create mode 100644 libs/libgee/patches/libgee-0.18.0-no-introspection.patch create mode 100644 libs/libgpg-error/Makefile create mode 100644 libs/libgpg-error/patches/001-gcc5.patch create mode 100644 libs/libhttp-parser/Makefile create mode 100644 libs/libical/Makefile create mode 100644 libs/libid3tag/Makefile create mode 100644 libs/libidn/Makefile create mode 100644 libs/libidn/patches/002-disable-po-docs-examples.patch create mode 100644 libs/libidn/patches/010-fix-idn-error-usage.patch create mode 100644 libs/libimobiledevice/Makefile create mode 100644 libs/libinput/Makefile create mode 100644 libs/libinput/patches/001-no-locale.patch create mode 100644 libs/libinput/patches/002-static_assert.patch create mode 100644 libs/libjpeg/Makefile create mode 100644 libs/liblo/Makefile create mode 100644 libs/liblo/patches/001-fix-musl-include.patch create mode 100644 libs/liblz4/Makefile create mode 100644 libs/libmad/Makefile create mode 100644 libs/libmad/patches/001-mips_removal_h_constraint.patch create mode 100644 libs/libmcrypt/Makefile create mode 100644 libs/libmicrohttpd/Makefile create mode 100644 libs/libmms/Makefile create mode 100644 libs/libmodbus/Makefile create mode 100644 libs/libmpdclient/Makefile create mode 100644 libs/libmpeg2/Makefile create mode 100644 libs/libmpeg2/patches/101-ppc_no_altivec.patch create mode 100644 libs/libmpeg2/patches/102-arm_data_preload_check.patch create mode 100644 libs/libnatpmp/Makefile create mode 100644 libs/libnatpmp/patches/001-install_declspec.patch create mode 100644 libs/libnet-1.2.x/Makefile create mode 100644 libs/libnet-1.2.x/patches/100-musl-compat.patch create mode 100644 libs/libnetfilter-acct/Makefile create mode 100644 libs/libnopoll/Makefile create mode 100644 libs/libogg/Makefile create mode 100644 libs/liboil/Makefile create mode 100644 libs/liboping/Makefile create mode 100644 libs/liboping/patches/01-no-werror.patch create mode 100644 libs/libowfat/Makefile create mode 100644 libs/libowfat/patches/001-fixbuild.patch create mode 100644 libs/libp11/Makefile create mode 100644 libs/libp11/patches/001-fix-install.patch create mode 100644 libs/libpam/Makefile create mode 100644 libs/libpam/files/pam.conf create mode 100644 libs/libpam/files/pam.d/common-account create mode 100644 libs/libpam/files/pam.d/common-auth create mode 100644 libs/libpam/files/pam.d/common-password create mode 100644 libs/libpam/files/pam.d/common-session create mode 100644 libs/libpam/files/pam.d/common-session-noninteractive create mode 100644 libs/libpam/files/pam.d/other create mode 100644 libs/libpam/patches/0001-build-always-use-lib-instead-of-lib64.patch create mode 100644 libs/libpam/patches/0002-build-ignore-pam_rhosts-if-neither-ruserok-nor-ruser.patch create mode 100644 libs/libpam/patches/0003-build-ignore-pam_lastlog-when-logwtmp-is-not-availab.patch create mode 100644 libs/libpam/patches/0004-build-fix-build-when-crypt-is-not-part-of-crypt_libs.patch create mode 100644 libs/libpam/patches/0005-build-fix-doc-build.patch create mode 100644 libs/libpam/patches/0006-pam_unix-fix-compilation-in-case-rpc-rpc.h-is-missin.patch create mode 100644 libs/libpam/patches/0007-Check-if-innetgr-is-available-at-compile-time.patch create mode 100644 libs/libplist/Makefile create mode 100644 libs/libpng/Makefile create mode 100644 libs/libpng/patches/100-config_fix.patch create mode 100644 libs/libradcli/Config.in create mode 100644 libs/libradcli/Makefile create mode 100644 libs/libsamplerate/Makefile create mode 100644 libs/libsearpc/Makefile create mode 100644 libs/libseccomp/Makefile create mode 100644 libs/libseccomp/patches/100-dont-use-linux-prctl.h-with-musl.patch create mode 100644 libs/libshout/Makefile create mode 100644 libs/libshout/patches/120-vorbis-c.patch create mode 100644 libs/libshout/patches/140-no_example_doc_win32.patch create mode 100644 libs/libsigc++/Makefile create mode 100644 libs/libsigc++/patches/001-no_doc_tests_examples.patch create mode 100644 libs/libsndfile/Makefile create mode 100644 libs/libsodium/Makefile create mode 100644 libs/libsoup/Makefile create mode 100644 libs/libsoxr/Makefile create mode 100644 libs/libssh2/Makefile create mode 100644 libs/libstrophe/Config.in create mode 100644 libs/libstrophe/Makefile create mode 100644 libs/libtalloc/Makefile create mode 100644 libs/libtasn1/Makefile create mode 100644 libs/libtheora/Makefile create mode 100644 libs/libtheora/patches/001-no_docs_tests.patch create mode 100644 libs/libtheora/patches/002-no_sdl_check.patch create mode 100644 libs/libtorrent/Makefile create mode 100644 libs/libtorrent/patches/100-fix_cross_compile.patch create mode 100644 libs/libuecc/Makefile create mode 100644 libs/libugpio/Makefile create mode 100644 libs/libunistring/Makefile create mode 100644 libs/libupnp/Makefile create mode 100644 libs/libupnpp/Makefile create mode 100644 libs/liburcu/Makefile create mode 100644 libs/libusbmuxd/Makefile create mode 100644 libs/libuv/Makefile create mode 100644 libs/libuvc/Makefile create mode 100644 libs/libv4l/Makefile create mode 100644 libs/libv4l/patches/020-add-missing-includes.patch create mode 100644 libs/libv4l/patches/030-dont-call-getsubopt.patch create mode 100644 libs/libvorbis/Makefile create mode 100644 libs/libvorbisidec/Makefile create mode 100644 libs/libvpx/Makefile create mode 100644 libs/libx264/Makefile create mode 100644 libs/libxerces-c/Makefile create mode 100644 libs/libxml2/Makefile create mode 100644 libs/libxslt/Makefile create mode 100644 libs/libzdb/Makefile create mode 100644 libs/libzdb/patches/010-cross-compile-fixes.patch create mode 100644 libs/libzdb/patches/020-filterh-use-host-built-version.patch create mode 100644 libs/lttng-ust/Makefile create mode 100644 libs/lttng-ust/patches/001-no_docs_tests.patch create mode 100644 libs/lttng-ust/patches/002-examples.patch create mode 100644 libs/mtdev/Makefile create mode 100644 libs/mxml/Makefile create mode 100644 libs/mxml/patches/001-targets.patch create mode 100644 libs/nacl/Makefile create mode 100755 libs/nacl/do-openwrt create mode 100644 libs/neon/Makefile create mode 100644 libs/openldap/Makefile create mode 100644 libs/openldap/files/ldap.init create mode 100644 libs/openldap/patches/001-automake-compat.patch create mode 100644 libs/openldap/patches/002-no-doc-and-tests-subdir.patch create mode 100644 libs/openldap/patches/020-autofs-schema.patch create mode 100644 libs/openldap/patches/750-no-strip.patch create mode 100644 libs/opus/Makefile create mode 100644 libs/p11-kit/Makefile create mode 100644 libs/p11-kit/files/opensc.module create mode 100644 libs/pcre/Makefile create mode 100644 libs/poco/Makefile create mode 100644 libs/poco/patches/100-configure.patch create mode 100644 libs/poco/patches/200-strerror.patch create mode 100644 libs/postgresql/Makefile create mode 100644 libs/postgresql/files/postgresql.config create mode 100644 libs/postgresql/files/postgresql.init create mode 100644 libs/postgresql/files/postgresql.sh create mode 100644 libs/postgresql/patches/001-configure_fixes.patch create mode 100644 libs/postgresql/patches/200-ranlib.patch create mode 100644 libs/postgresql/patches/800-busybox-default-pager.patch create mode 100644 libs/postgresql/patches/900-pg_ctl-setuid.patch create mode 100644 libs/protobuf-c/Makefile create mode 100644 libs/protobuf/Makefile create mode 100644 libs/protobuf/patches/001-mipseb-compile.patch create mode 100644 libs/protobuf/patches/003-mips2andHigher-compile.patch create mode 100644 libs/pthsem/Makefile create mode 100644 libs/pthsem/patches/001-linux3x-fix.patch create mode 100644 libs/pthsem/patches/002-fix-signal.h create mode 100644 libs/qrencode/Makefile create mode 100644 libs/qrencode/patches/001-disable-png.patch create mode 100644 libs/quasselc/Makefile create mode 100644 libs/quasselc/patches/001-respect-cflags-ldflags.patch create mode 100644 libs/sbc/Makefile create mode 100644 libs/speex/Makefile create mode 100644 libs/sqlite3/Makefile create mode 100644 libs/tcp_wrappers/Makefile create mode 100644 libs/tcp_wrappers/patches/001-debian_subset.patch create mode 100644 libs/tcp_wrappers/patches/002-opt_cflags.patch create mode 100644 libs/tcp_wrappers/patches/003-scaffold_malloc.patch create mode 100644 libs/tcp_wrappers/patches/004-ipv4_prefix.patch create mode 100644 libs/tcp_wrappers/patches/005-no--lnsl-on-musl.patch create mode 100644 libs/tdb/Makefile create mode 100644 libs/tdb/patches/001-printf-fix.patch create mode 100644 libs/tiff/Makefile create mode 100644 libs/tiff/patches/001-autoconf-compat.patch create mode 100644 libs/tiff/patches/002-CVE-2015-8665_and_CVE-2015-8683.patch create mode 100644 libs/tiff/patches/003-fix_potential_out-of-bound_writes_in_decode_functions.patch create mode 100644 libs/tiff/patches/004-fix_potential_out-of-bound_write_in_NeXTDecode.patch create mode 100644 libs/tiff/patches/005-fix-ftell-macro.patch create mode 100644 libs/tinycdb/Makefile create mode 100644 libs/tinycdb/patches/100-Makefile.patch create mode 100644 libs/unixodbc/Makefile create mode 100644 libs/unixodbc/files/unixodbc_conf.h create mode 100644 libs/vips/Makefile create mode 100644 libs/vips/patches/001-no_cpp.patch create mode 100644 libs/xmlrpc-c/Makefile create mode 100644 libs/xmlrpc-c/patches/001-config.mk.in.patch create mode 100644 libs/xmlrpc-c/patches/002-automake-compat.patch create mode 100644 libs/xr_usb_serial_common/Makefile create mode 100644 libs/yajl/Makefile create mode 100644 libs/yajl/patches/100-link-reformatter-uclibc-libm.patch create mode 100644 libs/yajl/patches/101-link-perf-uclibc-libm.patch create mode 100644 libs/yaml/Makefile create mode 100644 libs/zmq/Makefile create mode 100644 libs/zmq/patches/010-disable_pedantic_on_linux_with_ulibc++.patch create mode 100644 libs/zmq/patches/020-map_with_const_string_with_ublic++.patch create mode 100644 libs/zmq/patches/030-streamoff_missing_with_ulibc++.patch create mode 100644 libs/zmq/patches/040-fix_GNUC_conditional_for_GCC5.patch create mode 100644 libs/zmq/patches/100-fix-cxx-include-order.patch create mode 100644 mail/alpine/Makefile create mode 100644 mail/alpine/patches/100-no-openssl-check-cross-compile.patch create mode 100644 mail/bogofilter/Makefile create mode 100755 mail/bogofilter/files/postfix-bogofilter create mode 100644 mail/emailrelay/Makefile create mode 100644 mail/emailrelay/files/emailrelay.auth create mode 100644 mail/emailrelay/files/emailrelay.init create mode 100644 mail/emailrelay/patches/010-ssl3-fix.patch create mode 100644 mail/fdm/Config.in create mode 100644 mail/fdm/Makefile create mode 100644 mail/fdm/files/etc/fdm.conf create mode 100644 mail/fdm/patches/001-base64-fix.patch create mode 100644 mail/fdm/patches/002-base64-fix.patch create mode 100644 mail/fdm/patches/010-musl_WAIT_ANY.patch create mode 100644 mail/fdm/patches/020-musl_GLOB_BRACE.patch create mode 100644 mail/fdm/patches/030-musl_ACCESSPERMS.patch create mode 100644 mail/fdm/src/compat/b64_ntop.c create mode 100644 mail/fdm/src/compat/b64_pton.c create mode 100644 mail/mailman/Makefile create mode 100644 mail/mailman/files/mailman.init create mode 100644 mail/mailman/patches/100-postfix.patch create mode 100644 mail/mailman/patches/200-nohostdnspython.patch create mode 100644 mail/mailman/patches/300-targetpython.patch create mode 100644 mail/mailman/patches/400-modules.patch create mode 100644 mail/mailsend/Makefile create mode 100644 mail/msmtp-scripts/Makefile create mode 100644 mail/msmtp-scripts/files/msmtpq-ng-mta.init create mode 100644 mail/msmtp-scripts/files/msmtpq-ng.rc create mode 100644 mail/msmtp/Makefile create mode 100644 mail/mutt/Makefile create mode 100644 mail/mutt/patches/0001-no-po-and-docs.patch create mode 100644 mail/mutt/patches/100-CVE-2014-9116.patch create mode 100644 mail/postfix/Makefile create mode 100644 mail/postfix/files/main.cf.default create mode 100644 mail/postfix/files/postfix.init create mode 100644 mail/postfix/patches/100-fsstat.patch create mode 100644 mail/postfix/patches/200-manpages.patch create mode 100644 mail/postfix/patches/300-bdb_hash_segfault.patch create mode 100644 mail/postfix/patches/400-cdb.patch create mode 100644 mail/postfix/patches/500-crosscompile.patch create mode 100644 mail/postfix/patches/600-nopostconf.patch create mode 100644 mail/postfix/patches/700-defaultconfig.patch create mode 100644 mail/postfix/patches/800-fmt.patch create mode 100644 mail/ssmtp/Makefile create mode 100644 mail/ssmtp/patches/002-fix_pointer.patch create mode 100644 mail/ssmtp/patches/004-remove_dead-letter.patch create mode 100644 mail/ssmtp/patches/006-add_ip-header.patch create mode 100644 mail/ssmtp/patches/008-remove_garbage.patch create mode 100644 mail/ssmtp/patches/010-fix_message-header.patch create mode 100644 multimedia/crtmpserver/Makefile create mode 100644 multimedia/crtmpserver/files/crtmpserver.init create mode 100644 multimedia/crtmpserver/patches/010-link-crypt-for-lua.patch create mode 100644 multimedia/crtmpserver/patches/020-add-rpath.patch create mode 100644 multimedia/crtmpserver/patches/030-default-config.patch create mode 100644 multimedia/crtmpserver/patches/040-use-select.patch create mode 100644 multimedia/crtmpserver/patches/050-add-missing-make-defines.patch create mode 100644 multimedia/crtmpserver/patches/060-add-missing-includes.patch create mode 100644 multimedia/crtmpserver/patches/070-missing-include-gcc-47.patch create mode 100644 multimedia/crtmpserver/patches/080-disable-apple-streaming.patch create mode 100644 multimedia/crtmpserver/patches/080-musl-uint32_t.patch create mode 100644 multimedia/ffmpeg/Config.in create mode 100644 multimedia/ffmpeg/Makefile create mode 100644 multimedia/fswebcam/Makefile create mode 100644 multimedia/grilo-plugins/Makefile create mode 100644 multimedia/grilo-plugins/patches/0001-dmap-Add-album-disc-number-mapping.patch create mode 100644 multimedia/grilo/Makefile create mode 100644 multimedia/grilo/files/grilo-0.3.vapi create mode 100644 multimedia/grilo/files/grilo-net-0.3.vapi create mode 100644 multimedia/gst1-libav/Config.in create mode 100644 multimedia/gst1-libav/Makefile create mode 100644 multimedia/gst1-plugins-bad/Makefile create mode 100644 multimedia/gst1-plugins-bad/patches/001-no-translations.patch create mode 100644 multimedia/gst1-plugins-bad/patches/002-no-tests.patch create mode 100644 multimedia/gst1-plugins-base/Makefile create mode 100644 multimedia/gst1-plugins-base/patches/001-no-translations.patch create mode 100644 multimedia/gst1-plugins-base/patches/002-no-tests.patch create mode 100644 multimedia/gst1-plugins-base/patches/003-no-docs.patch create mode 100644 multimedia/gst1-plugins-good/Makefile create mode 100644 multimedia/gst1-plugins-good/patches/001-no-translations.patch create mode 100644 multimedia/gst1-plugins-good/patches/002-no-tests.patch create mode 100644 multimedia/gst1-plugins-good/patches/003-no-docs.patch create mode 100644 multimedia/gst1-plugins-ugly/Makefile create mode 100644 multimedia/gst1-plugins-ugly/patches/001-no-translations.patch create mode 100644 multimedia/gst1-plugins-ugly/patches/002-no-tests.patch create mode 100644 multimedia/gst1-plugins-ugly/patches/003-no-docs.patch create mode 100644 multimedia/gstreamer1/Makefile create mode 100644 multimedia/gstreamer1/patches/001-no-translations.patch create mode 100644 multimedia/gstreamer1/patches/002-no-tests.patch create mode 100644 multimedia/gstreamer1/patches/003-no-docs.patch create mode 100644 multimedia/gstreamer1/patches/010-gstplugin-use-lazy-symbol-binding.patch create mode 100644 multimedia/icecast/Makefile create mode 100755 multimedia/icecast/files/icecast.init create mode 100644 multimedia/icecast/libvorbisidec.mk create mode 100644 multimedia/icecast/patches/001-icecast-2.4.0-tremor.patch create mode 100644 multimedia/icecast/patches/010-fix_libcurl_test_crap.patch create mode 100644 multimedia/icecast/patches/020-icecast_config_for_openwrt.patch create mode 100644 multimedia/ices/Makefile create mode 100644 multimedia/minidlna/Makefile create mode 100644 multimedia/minidlna/files/minidlna.config create mode 100644 multimedia/minidlna/files/minidlna.init create mode 100644 multimedia/minidlna/patches/010-libav-fix.patch create mode 100644 multimedia/mjpg-streamer/Config.in create mode 100644 multimedia/mjpg-streamer/Makefile create mode 100644 multimedia/mjpg-streamer/files/mjpg-streamer.config create mode 100644 multimedia/mjpg-streamer/files/mjpg-streamer.hotplug create mode 100644 multimedia/mjpg-streamer/files/mjpg-streamer.init create mode 100644 multimedia/mjpg-streamer/patches/005-musl_compatibility.patch create mode 100644 multimedia/mjpg-streamer/patches/010-enable_additional_plugins.patch create mode 100644 multimedia/mjpg-streamer/patches/020-remove_gcc_debug_options.patch create mode 100644 multimedia/mjpg-streamer/patches/030-allow_16_char_device_names.patch create mode 100644 multimedia/mjpg-streamer/patches/040-Buffer-the-bytesused-variable-from-struct-v4l2_buffe.patch create mode 100644 multimedia/mjpg-streamer/patches/041-Stop-leaking-data-via-struct-v4l2_buffer.patch create mode 100644 multimedia/mjpg-streamer/patches/050-fix-yuv-capture.patch create mode 100644 multimedia/mjpg-streamer/patches/060-fix-sigtrap-in-v4l2uvc.patch create mode 100644 multimedia/motion/Makefile create mode 100644 multimedia/motion/patches/100-musl-compat.patch create mode 100644 multimedia/oggfwd/Makefile create mode 100644 multimedia/tvheadend/Config.in create mode 100644 multimedia/tvheadend/Makefile create mode 100644 multimedia/tvheadend/files/tvheadend.config create mode 100644 multimedia/tvheadend/files/tvheadend.init create mode 100644 multimedia/xupnpd/Makefile create mode 100644 multimedia/xupnpd/files/xupnpd.init create mode 100644 multimedia/xupnpd/patches/100-default_config.patch create mode 100644 multimedia/xupnpd/patches/101-root_dir_param.patch create mode 100644 multimedia/youtube-dl/Makefile create mode 100644 net/acme/Makefile create mode 100644 net/acme/files/acme-cbi.lua create mode 100644 net/acme/files/acme-controller.lua create mode 100644 net/acme/files/acme.config create mode 100644 net/acme/files/acme.init create mode 100644 net/acme/files/run.sh create mode 100644 net/acme/files/uci-defaults-acme create mode 100644 net/adblock/Makefile create mode 100644 net/adblock/files/README.md create mode 100644 net/adblock/files/adblock-helper.sh create mode 100755 net/adblock/files/adblock-update.sh create mode 100644 net/adblock/files/adblock.blacklist create mode 100644 net/adblock/files/adblock.conf create mode 100644 net/adblock/files/adblock.hotplug create mode 100755 net/adblock/files/adblock.init create mode 100644 net/adblock/files/adblock.whitelist create mode 100644 net/adblock/files/www/adblock/index.html create mode 100644 net/addrwatch/Makefile create mode 100644 net/addrwatch/files/addrwatch.config create mode 100644 net/addrwatch/files/addrwatch.init create mode 100644 net/addrwatch/patches/001-fix-sys_siglist.patch create mode 100644 net/addrwatch/patches/002-fix-uclibc-sysconf.patch create mode 100644 net/aggregate/Makefile create mode 100644 net/aircrack-ng/Makefile create mode 100644 net/announce/Makefile create mode 100644 net/apache/Makefile create mode 100644 net/apache/patches/001-Makefile_in.patch create mode 100644 net/apache/patches/002-test_char_h.patch create mode 100644 net/apache/patches/003-logdir_fix.patch create mode 100644 net/apache/patches/004-pidfile_fix.patch create mode 100644 net/apache/patches/005-httpd_conf.patch create mode 100644 net/apache/patches/006-remove-ssl3.patch create mode 100644 net/apcupsd/Makefile create mode 100644 net/apcupsd/files/apccontrol create mode 100644 net/apcupsd/files/apcupsd.conf create mode 100644 net/apcupsd/files/apcupsd.css create mode 100644 net/apcupsd/files/apcupsd.init create mode 100644 net/apcupsd/files/apcupsd_mail.conf create mode 100644 net/apcupsd/files/changeme create mode 100644 net/apcupsd/files/commfailure create mode 100644 net/apcupsd/files/commok create mode 100644 net/apcupsd/files/hosts.conf create mode 100644 net/apcupsd/files/multimon.conf create mode 100644 net/apcupsd/files/offbattery create mode 100644 net/apcupsd/files/onbattery create mode 100644 net/apcupsd/patches/010-fix-usb.patch create mode 100644 net/apinger/Makefile create mode 100644 net/apinger/files/apinger.init create mode 100644 net/apinger/patches/001-autoreconf.patch create mode 100644 net/apinger/patches/002-run_as_user.patch create mode 100644 net/apinger/patches/003-no_docs.patch create mode 100644 net/aria2/Config.in create mode 100644 net/aria2/Makefile create mode 100644 net/aria2/files/aria2.conf create mode 100755 net/aria2/files/aria2.init create mode 100644 net/arp-scan/Makefile create mode 100644 net/arp-scan/patches/001-cross_compile.patch create mode 100644 net/atftp/Makefile create mode 100644 net/atftp/patches/01-missing-u_char-type-patch.patch create mode 100644 net/atftp/patches/02-fix-invalid-read-in-tftp_send_request.patch create mode 100644 net/atftp/patches/03-Fix-undefined-reference-linker-errors.patch create mode 100644 net/autossh/Makefile create mode 100644 net/autossh/files/autossh.config create mode 100644 net/autossh/files/autossh.hotplug create mode 100644 net/autossh/files/autossh.init create mode 100644 net/bcp38/Makefile create mode 100644 net/bcp38/files/bcp38.config create mode 100644 net/bcp38/files/bcp38.defaults create mode 100755 net/bcp38/files/run.sh create mode 100644 net/bind/Config.in create mode 100644 net/bind/Makefile create mode 100644 net/bind/files/bind/db.0 create mode 100644 net/bind/files/bind/db.127 create mode 100644 net/bind/files/bind/db.255 create mode 100644 net/bind/files/bind/db.local create mode 100644 net/bind/files/bind/db.root create mode 100644 net/bind/files/bind/named.conf.example create mode 100644 net/bind/files/named.init create mode 100644 net/bind/patches/001-no-tests.patch create mode 100644 net/bind/patches/002-autoconf-ar-fix.patch create mode 100644 net/bmon/Makefile create mode 100644 net/bridge-utils/Makefile create mode 100644 net/bridge-utils/patches/001-libbridge_cflags.patch create mode 100644 net/bridge-utils/patches/010-fix_struct_in6_addr_usage.patch create mode 100644 net/bridge-utils/patches/100-musl-compat.patch create mode 100644 net/bwm-ng/Config.in create mode 100644 net/bwm-ng/Makefile create mode 100644 net/cgi-io/Makefile create mode 100644 net/cgi-io/src/CMakeLists.txt create mode 100644 net/cgi-io/src/main.c create mode 100644 net/cgi-io/src/multipart_parser.c create mode 100644 net/cgi-io/src/multipart_parser.h create mode 100644 net/chaosvpn/Makefile create mode 100755 net/chaosvpn/files/chaosvpn.hotplug create mode 100755 net/chaosvpn/files/chaosvpn.init create mode 100644 net/chrony/Makefile create mode 100644 net/chrony/files/chrony.conf create mode 100644 net/chrony/files/chrony.config create mode 100644 net/chrony/files/chrony.hotplug create mode 100644 net/chrony/files/chronyd.init create mode 100644 net/chrony/patches/001-freebind_uclibc.patch create mode 100644 net/cifs-utils/Makefile create mode 100644 net/cifs-utils/patches/001-fix-musl-build.patch create mode 100644 net/clamav/Makefile create mode 100644 net/clamav/files/bytecode.cvd create mode 100644 net/clamav/files/clamav.config create mode 100644 net/clamav/files/clamav.init create mode 100644 net/clamav/files/freshclam.config create mode 100644 net/clamav/files/freshclam.init create mode 100644 net/clamav/patches/001-compile.patch create mode 100644 net/coova-chilli/Config.in create mode 100644 net/coova-chilli/Makefile create mode 100644 net/coova-chilli/files/chilli.config create mode 100644 net/coova-chilli/files/chilli.firewall create mode 100644 net/coova-chilli/files/chilli.hotplug create mode 100644 net/coova-chilli/files/chilli.init create mode 100644 net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch create mode 100644 net/coova-chilli/patches/200-fix_compile_kmod.patch create mode 100644 net/coova-chilli/patches/201-fix_dereferencing_pointers.patch create mode 100644 net/coova-chilli/patches/300-fix-compile-with-cyassl.patch create mode 100644 net/coova-chilli/patches/400-fix-compile-with-musl.patch create mode 100644 net/cshark/Makefile create mode 100644 net/ctorrent-svn/Makefile create mode 100644 net/ctorrent-svn/patches/100-compile-fix.patch create mode 100644 net/ctorrent-svn/patches/300-negative.patch create mode 100644 net/ctorrent-svn/patches/400-musl-compat.patch create mode 100644 net/ctorrent/Makefile create mode 100644 net/ctorrent/patches/100-CVE-2009-1759.patch create mode 100644 net/ctorrent/patches/100-negative-ints.patch create mode 100644 net/ctorrent/patches/200-musl-compat.patch create mode 100644 net/daemonlogger/Makefile create mode 100644 net/dansguardian/Makefile create mode 100644 net/dansguardian/files/dansguardian.config create mode 100644 net/dansguardian/files/dansguardian.init create mode 100644 net/dansguardian/files/dansguardianf1.conf create mode 100644 net/dansguardian/patches/001-compile.patch create mode 100644 net/darkstat/Makefile create mode 100644 net/darkstat/files/darkstat.config create mode 100755 net/darkstat/files/darkstat.init create mode 100644 net/darkstat/patches/100-do-not-use-NI_IDN.patch create mode 100644 net/davfs2/Makefile create mode 100644 net/davfs2/files/davfs2.conf create mode 100644 net/davfs2/patches/010-main_code_fix.patch create mode 100644 net/davfs2/patches/100-musl-compat.patch create mode 100644 net/davfs2/patches/200-davfs2-1.5.4-no-forced-stack-protector.patch create mode 100755 net/ddns-scripts/Makefile create mode 100644 net/ddns-scripts/files/ddns.config create mode 100755 net/ddns-scripts/files/ddns.defaults create mode 100755 net/ddns-scripts/files/ddns.hotplug create mode 100755 net/ddns-scripts/files/ddns.init create mode 100755 net/ddns-scripts/files/dynamic_dns_functions.sh create mode 100755 net/ddns-scripts/files/dynamic_dns_lucihelper.sh create mode 100755 net/ddns-scripts/files/dynamic_dns_updater.sh create mode 100644 net/ddns-scripts/files/services create mode 100644 net/ddns-scripts/files/services_ipv6 create mode 100755 net/ddns-scripts/files/update_cloudflare_com_v1.sh create mode 100755 net/ddns-scripts/files/update_cloudflare_com_v4.sh create mode 100755 net/ddns-scripts/files/update_godaddy_com_v1.sh create mode 100755 net/ddns-scripts/files/update_no-ip_com.sh create mode 100755 net/ddns-scripts/files/update_nsupdate.sh create mode 100644 net/ddns-scripts/samples/ddns.config_sample create mode 100755 net/ddns-scripts/samples/getlocalip_sample.sh create mode 100644 net/ddns-scripts/samples/update_sample.sh create mode 100755 net/ddns-scripts/tools/public_suffix_list.sh create mode 100644 net/dhcp-forwarder/Makefile create mode 100644 net/dhcp-forwarder/files/dhcp-fwd.init create mode 100644 net/dhcpcd/Makefile create mode 100755 net/dhcpcd/files/dhcpcd.init create mode 100644 net/dhcpcd/patches/001-fix-musl.patch create mode 100644 net/dmapd/Makefile create mode 100644 net/dmapd/files/dmapd.init create mode 100644 net/dmapd/patches/001-dmapd_conf.patch create mode 100644 net/dmapd/patches/002-make_unit_test_optionnal.patch create mode 100644 net/dnscrypt-proxy/Makefile create mode 100644 net/dnscrypt-proxy/files/dnscrypt-proxy.config create mode 100644 net/dnscrypt-proxy/files/dnscrypt-proxy.init create mode 100644 net/dnscrypt-proxy/files/dnscrypt-resolvers.csv create mode 100644 net/e2guardian/Makefile create mode 100644 net/e2guardian/files/e2guardian.config create mode 100644 net/e2guardian/files/e2guardian.init create mode 100644 net/e2guardian/files/e2guardianf1.conf create mode 100644 net/esniper/Makefile create mode 100644 net/etherwake/Makefile create mode 100644 net/etherwake/files/etherwake.config create mode 100644 net/etherwake/files/etherwake.init create mode 100644 net/etherwake/patches/100-no_ether_hostton.patch create mode 100644 net/etherwake/patches/110-format_security_fix.patch create mode 100644 net/etherwake/patches/120-musl-compat.patch create mode 100644 net/ethtool/Config.in create mode 100644 net/ethtool/Makefile create mode 100644 net/fakeidentd/Makefile create mode 100644 net/fakeidentd/files/fakeidentd.init create mode 100644 net/fastd/Config.in create mode 100644 net/fastd/Makefile create mode 100644 net/fastd/files/fastd.upgrade create mode 100644 net/fossil/Makefile create mode 100644 net/fossil/files/fossil.config create mode 100644 net/fossil/files/fossil.init create mode 100644 net/fossil/patches/001-no_https.patch create mode 100644 net/freeradius2/Config.in create mode 100644 net/freeradius2/Makefile create mode 100644 net/freeradius2/files/radiusd.init create mode 100644 net/freeradius2/patches/001-fix-makefile.patch create mode 100644 net/freeradius2/patches/002-config.patch create mode 100644 net/freeradius2/patches/004-ldap_configure.patch create mode 100644 net/freeradius2/patches/008-honor_ccpflags.patch create mode 100644 net/freeradius2/patches/010-disbale-openssl-check.patch create mode 100644 net/freeradius3/Config.in create mode 100644 net/freeradius3/Makefile create mode 100644 net/freeradius3/files/radiusd.init create mode 100644 net/fwknop/Config.in create mode 100644 net/fwknop/Makefile create mode 100644 net/fwknop/files/fwknopd create mode 100644 net/fwknop/files/fwknopd.init create mode 100644 net/git/Makefile create mode 100644 net/git/patches/200-disable_fasthash.patch create mode 100644 net/git/patches/300-configure_for_crosscompiling create mode 100644 net/git/patches/400-imapsend_without_curl.patch create mode 100644 net/gitolite/Makefile create mode 100644 net/gitolite/patches/100-fix-missing-hooks-dir.patch create mode 100644 net/gnunet/Makefile create mode 100644 net/gnunet/files/gnunet-dhtcache-heap.defaults create mode 100644 net/gnunet/files/gnunet-dhtcache-pgsql.defaults create mode 100644 net/gnunet/files/gnunet-dhtcache-sqlite.defaults create mode 100644 net/gnunet/files/gnunet-fs-heap.defaults create mode 100644 net/gnunet/files/gnunet-fs-pgsql.defaults create mode 100644 net/gnunet/files/gnunet-fs-sqlite.defaults create mode 100644 net/gnunet/files/gnunet-gns-flat.defaults create mode 100644 net/gnunet/files/gnunet-gns-pgsql.defaults create mode 100644 net/gnunet/files/gnunet-gns-sqlite.defaults create mode 100644 net/gnunet/files/gnunet-gns.defaults create mode 100644 net/gnunet/files/gnunet-peerstore-flat.defaults create mode 100644 net/gnunet/files/gnunet-peerstore-sqlite.defaults create mode 100644 net/gnunet/files/gnunet-pgsql.defaults create mode 100644 net/gnunet/files/gnunet-proto.sh create mode 100644 net/gnunet/files/gnunet-social-pgsql.defaults create mode 100644 net/gnunet/files/gnunet-social-sqlite.defaults create mode 100644 net/gnunet/files/gnunet-vpn.defaults create mode 100644 net/gnunet/files/gnunet.defaults create mode 100755 net/gnunet/files/gnunet.init create mode 100644 net/gnunet/files/gnunet.upgrade create mode 100644 net/gnurl/Makefile create mode 100644 net/gnurl/patches/200-no_docs_tests.patch create mode 100644 net/haproxy/Makefile create mode 100644 net/haproxy/files/haproxy.cfg create mode 100644 net/haproxy/files/haproxy.hotplug create mode 100644 net/haproxy/files/haproxy.init create mode 100644 net/haproxy/patches/0001-BUG-MINOR-Fix-OSX-compilation-errors.patch create mode 100644 net/haproxy/patches/0002-BUG-MINOR-displayed-PCRE-version-is-running-release.patch create mode 100644 net/haproxy/patches/0003-MINOR-show-Built-with-PCRE-version.patch create mode 100644 net/haproxy/patches/0004-MINOR-show-Running-on-zlib-version.patch create mode 100644 net/haproxy/patches/0005-MINOR-Add-fe_req_rate-sample-fetch.patch create mode 100644 net/haproxy/patches/0006-MEDIUM-make-SO_REUSEPORT-configurable.patch create mode 100644 net/haproxy/patches/0007-BUG-MINOR-vars-use-sess-and-not-s-sess-in-action_sto.patch create mode 100644 net/haproxy/patches/0008-BUG-MINOR-vars-make-smp_fetch_var-more-robust-agains.patch create mode 100644 net/haproxy/patches/0009-BUG-MINOR-vars-smp_fetch_var-doesn-t-depend-on-HTTP-.patch create mode 100644 net/haproxy/patches/0010-BUG-MINOR-ssl-Check-malloc-return-code.patch create mode 100644 net/haproxy/patches/0011-BUG-MINOR-ssl-prevent-multiple-entries-for-the-same-.patch create mode 100644 net/haproxy/patches/0012-BUG-MINOR-systemd-make-the-wrapper-return-a-non-null.patch create mode 100644 net/haproxy/patches/0013-BUG-MINOR-systemd-always-restore-signals-before-exec.patch create mode 100644 net/haproxy/patches/0014-BUG-MINOR-systemd-check-return-value-of-calloc.patch create mode 100644 net/haproxy/patches/0015-MINOR-systemd-report-it-when-execve-fails.patch create mode 100644 net/haproxy/patches/0016-BUG-MEDIUM-systemd-let-the-wrapper-know-that-haproxy.patch create mode 100644 net/haproxy/patches/0017-BUILD-protocol-fix-some-build-errors-on-OpenBSD.patch create mode 100644 net/haproxy/patches/0018-BUILD-log-iovec-requires-to-include-sys-uio.h-on-Ope.patch create mode 100644 net/haproxy/patches/0019-BUILD-tcp-do-not-include-netinet-ip.h-for-IP_TTL.patch create mode 100644 net/haproxy/patches/0020-BUILD-checks-remove-the-last-strcat-and-eliminate-a-.patch create mode 100644 net/haproxy/patches/0021-BUILD-poll-remove-unused-hap_fd_isset-which-causes-a.patch create mode 100644 net/haproxy/patches/0022-MINOR-cfgparse-few-memory-leaks-fixes.patch create mode 100644 net/haproxy/patches/0023-MINOR-build-Allow-linking-to-device-atlas-library-fi.patch create mode 100644 net/haproxy/patches/0024-DOC-Fix-typo-in-description-of-st-parameter-in-man-p.patch create mode 100644 net/haproxy/patches/0025-BUG-MEDIUM-peers-on-shutdown-wake-up-the-appctx-not-.patch create mode 100644 net/haproxy/patches/0026-BUG-MEDIUM-peers-fix-use-after-free-in-peer_session_.patch create mode 100644 net/haproxy/patches/0027-BUG-MEDIUM-systemd-wrapper-return-correct-exit-codes.patch create mode 100644 net/haproxy/patches/0028-BUG-MEDIUM-srv-state-properly-restore-the-DRAIN-stat.patch create mode 100644 net/haproxy/patches/0029-BUG-MINOR-srv-state-allow-to-have-both-CMAINT-and-FD.patch create mode 100644 net/haproxy/patches/0030-BUG-MEDIUM-servers-properly-propagate-the-maintenanc.patch create mode 100644 net/haproxy/patches/0031-BUG-vars-Fix-set-var-converter-because-of-a-typo.patch create mode 100644 net/horst/Makefile create mode 100644 net/htpdate/Makefile create mode 100644 net/htpdate/files/htpdate.default create mode 100644 net/htpdate/files/htpdate.init create mode 100644 net/htpdate/patches/100-adjtimex.patch create mode 100644 net/https-dns-proxy/Makefile create mode 100644 net/https-dns-proxy/files/https_dns_proxy.config create mode 100644 net/https-dns-proxy/files/https_dns_proxy.init create mode 100644 net/ibrdtn-tools/Makefile create mode 100644 net/ibrdtnd/Makefile create mode 100644 net/ibrdtnd/files/build-config.sh create mode 100644 net/ibrdtnd/files/ibrdtn.init create mode 100644 net/ibrdtnd/files/ibrdtn.uci create mode 100644 net/ibrdtnd/files/mkcontainer.sh create mode 100644 net/ibrdtnd/files/mountcontainer.sh create mode 100644 net/ibrdtnd/files/safety-wrapper.sh create mode 100644 net/ibrdtnd/files/systemcheck.sh create mode 100644 net/iodine/Makefile create mode 100644 net/iodine/files/iodined.config create mode 100644 net/iodine/files/iodined.init create mode 100644 net/iodine/patches/010-cross-compile.patch create mode 100644 net/iodine/patches/100-musl-compatibility.patch create mode 100644 net/iotivity/Makefile create mode 100644 net/iotivity/files/etc/iotivity/ReadMe.txt create mode 100644 net/iotivity/files/etc/iotivity/oic_svr_db.cbor create mode 100644 net/iotivity/files/etc/iotivity/oic_svr_db.json create mode 100644 net/iotivity/patches/001-no_unit_test.patch create mode 100644 net/iotivity/patches/002-do-not-chck-for-boost.patch create mode 100644 net/iotivity/patches/004-use-env.patch create mode 100644 net/iotivity/patches/020-Do-not-set-architecture-specific-flags.patch create mode 100644 net/iotivity/patches/021-add-some-more-architectures.patch create mode 100644 net/iotivity/patches/030-remove-check-for-curl.patch create mode 100644 net/iotivity/patches/040-remove-provisioning.patch create mode 100644 net/iotivity/patches/054-resource-encapsulation-deactivate-test-covergae.patch create mode 100644 net/iotivity/patches/060-security-fix-reading-of-permission-attribute-from-co.patch create mode 100644 net/iotivity/patches/061-Remove-the-endianness-dependency-for-credential.patch create mode 100644 net/iotivity/patches/062-Fix-memory-corruption-when-reading-inetgers-from-cbo.patch create mode 100644 net/iotivity/patches/070-Resource-container-Backported-init-fix-to-1.1-rel.patch create mode 100644 net/iotivity/patches/140-remove-glib2.patch create mode 100644 net/iotivity/patches/200-examples-OICMiddle-try-to-load-security-configuratio.patch create mode 100644 net/ipsec-tools/Makefile create mode 100644 net/ipsec-tools/files/functions.sh create mode 100644 net/ipsec-tools/files/p1client-down create mode 100644 net/ipsec-tools/files/p1client-up create mode 100644 net/ipsec-tools/files/racoon create mode 100644 net/ipsec-tools/files/racoon.init create mode 100644 net/ipsec-tools/files/vpnctl create mode 100644 net/ipsec-tools/patches/001-ipsec-tools-def-psk.patch create mode 100644 net/ipsec-tools/patches/001-no_libfl.patch create mode 100644 net/ipsec-tools/patches/002-patch8-utmp.patch create mode 100644 net/ipsec-tools/patches/003-microsoft-fqdn-in-main.patch create mode 100644 net/ipsec-tools/patches/005-isakmp-fix.patch create mode 100644 net/ipsec-tools/patches/006-linux-3.7-compat.patch create mode 100644 net/ipsec-tools/patches/007-force_have_policy_fwd.patch create mode 100644 net/ipsec-tools/patches/008-racoon-fix_dereference_crash.patch create mode 100644 net/ipsec-tools/patches/009-musl-compat.patch create mode 100644 net/iptraf-ng/Makefile create mode 100644 net/irssi/Makefile create mode 100644 net/isc-dhcp/Makefile create mode 100644 net/isc-dhcp/files/dhclient-script create mode 100644 net/isc-dhcp/files/dhclient.init create mode 100644 net/isc-dhcp/files/dhclient6.conf create mode 100644 net/isc-dhcp/files/dhclient6.init create mode 100644 net/isc-dhcp/files/dhcpd.conf create mode 100644 net/isc-dhcp/files/dhcpd.init create mode 100644 net/isc-dhcp/files/dhcpd6.conf create mode 100644 net/isc-dhcp/files/dhcpd6.init create mode 100644 net/isc-dhcp/files/dhcrelay4.init create mode 100644 net/isc-dhcp/files/dhcrelay6.init create mode 100644 net/isc-dhcp/files/etc/config/dhcrelay create mode 100644 net/isc-dhcp/patches/000-compile.patch create mode 100644 net/isc-dhcp/patches/100-relay-rfc3527-link-selection.patch create mode 100644 net/isc-dhcp/patches/510-bind-CC.patch create mode 100644 net/keepalived/Makefile create mode 100644 net/keepalived/files/keepalived.init create mode 100644 net/keepalived/patches/100-musl-compat.patch create mode 100644 net/keepalived/patches/101-update-struct-msghdr.patch create mode 100644 net/kismet/Makefile create mode 100644 net/kismet/files/kismet.conf create mode 100644 net/kismet/files/kismet_drone.conf create mode 100644 net/kismet/files/kismet_drone.config create mode 100755 net/kismet/files/kismet_drone.init create mode 100644 net/kismet/files/kismet_server.config create mode 100755 net/kismet/files/kismet_server.init create mode 100644 net/kismet/patches/010-dont-add-host-include-paths.patch create mode 100644 net/kismet/patches/020-musl-include-fixes.patch create mode 100644 net/knot/Makefile create mode 100644 net/knot/files/knotd.init create mode 100644 net/knot/files/runtests.sh create mode 100644 net/knot/patches/01_zscanner_tests.patch create mode 100644 net/knot/patches/02_knot.conf.patch create mode 100644 net/knot/patches/03_contrib_files.patch create mode 100644 net/knot/patches/04_cookies_big_endian.patch create mode 100644 net/knxd/Makefile create mode 100644 net/knxd/files/knxd.config create mode 100644 net/knxd/files/knxd.init create mode 100644 net/knxd/patches/0099-openwrt.patch create mode 100644 net/kplex/Makefile create mode 100644 net/kplex/files/kplex.init create mode 100644 net/krb5/Makefile create mode 100644 net/krb5/files/krb5kdc create mode 100644 net/krb5/patches/001-fix-uninitialized-warning-errors.patch create mode 100644 net/l7-protocols/Makefile create mode 100644 net/l7-protocols/patches/100-testing_crosscompile.patch create mode 100644 net/l7-protocols/patches/101-testing-timeit.patch create mode 100644 net/l7-protocols/patches/102-testing-doallspeeds.patch create mode 100644 net/lcdringer/Makefile create mode 100644 net/lcdringer/files/lcdringer.init create mode 100644 net/lftp/Makefile create mode 100644 net/lighttpd/Makefile create mode 100644 net/lighttpd/files/lighttpd.conf create mode 100644 net/lighttpd/files/lighttpd.init create mode 100644 net/linknx/Makefile create mode 100644 net/linknx/files/linknx.config create mode 100644 net/linknx/files/linknx.init create mode 100644 net/linknx/files/linknx.xml.dist create mode 100644 net/linuxptp/Makefile create mode 100644 net/linuxptp/patches/001-musl-fix.patch create mode 100644 net/lispmob/Makefile create mode 100644 net/lispmob/patches/001-fix-musl-build.patch create mode 100644 net/lksctp-tools/Makefile create mode 100644 net/luci-app-bcp38/Makefile create mode 100644 net/luci-app-bcp38/files/bcp38-cbi.lua create mode 100644 net/luci-app-bcp38/files/bcp38-controller.lua create mode 100755 net/luci-app-bcp38/files/uci-defaults-bcp38 create mode 100644 net/luci-app-clamav/Makefile create mode 100644 net/luci-app-clamav/files/controller/clamav-controller.lua create mode 100644 net/luci-app-clamav/files/model/cbi/clamav-cbi.lua create mode 100644 net/luci-app-e2guardian/Makefile create mode 100644 net/luci-app-e2guardian/files/e2guardian-cbi.lua create mode 100644 net/luci-app-e2guardian/files/e2guardian-controller.lua create mode 100644 net/luci-app-squid/Makefile create mode 100644 net/luci-app-squid/files/squid-cbi.lua create mode 100644 net/luci-app-squid/files/squid-controller.lua create mode 100644 net/mac-telnet/Makefile create mode 100644 net/mac-telnet/files/mactelnet.config create mode 100755 net/mac-telnet/files/mactelnet.init create mode 100644 net/mdnsresponder/Makefile create mode 100644 net/mdnsresponder/files/mDNSResponder.conf create mode 100644 net/mdnsresponder/files/mDNSResponder.init create mode 100755 net/mdnsresponder/files/mdnsd.init create mode 100644 net/mdnsresponder/patches/001-cross_compile.patch create mode 100644 net/mdnsresponder/patches/100-linux_fixes.patch create mode 100644 net/mdnsresponder/patches/114-fix_posix_build.patch create mode 100644 net/memcached/Makefile create mode 100644 net/memcached/files/memcached.config create mode 100644 net/memcached/files/memcached.init create mode 100644 net/memcached/patches/100-fix_iov_max.patch create mode 100644 net/mii-tool/Makefile create mode 100644 net/mini_snmpd/Makefile create mode 100644 net/mini_snmpd/files/mini_snmpd.config create mode 100644 net/mini_snmpd/files/mini_snmpd.init create mode 100644 net/miniupnpc/Makefile create mode 100644 net/miniupnpc/patches/100-no_minixml_test.patch create mode 100644 net/miniupnpc/patches/200-miniupnpc_desc.patch create mode 100644 net/mtr/Makefile create mode 100644 net/mtr/patches/100-disabled-ipv6-fix.patch create mode 100644 net/mwan3-luci/Makefile create mode 100755 net/mwan3-luci/files/etc/hotplug.d/iface/16-mwancustombak create mode 100755 net/mwan3-luci/files/etc/uci-defaults/mwan-luci create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/controller/mwan3.lua create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/advanced_hotplugscript.lua create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/advanced_mwanconfig.lua create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/advanced_networkconfig.lua create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interface.lua create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interfaceconfig.lua create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/member.lua create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/memberconfig.lua create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/policy.lua create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/policyconfig.lua create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/rule.lua create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/ruleconfig.lua create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/view/admin_status/index/mwan.htm create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_diagnostics.htm create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_hotplugscript.htm create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_mwanconfig.htm create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_networkconfig.htm create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_troubleshooting.htm create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/config_css.htm create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/openwrt_overview_status.htm create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/overview_detailed.htm create mode 100644 net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/overview_interface.htm create mode 100644 net/mwan3/Makefile create mode 100644 net/mwan3/files/etc/config/mwan3 create mode 100644 net/mwan3/files/etc/hotplug.d/iface/15-mwan3 create mode 100644 net/mwan3/files/lib/mwan3/mwan3.sh create mode 100755 net/mwan3/files/usr/sbin/mwan3 create mode 100755 net/mwan3/files/usr/sbin/mwan3track create mode 100644 net/nbd/Makefile create mode 100644 net/nbd/files/nbd-client.conf create mode 100644 net/nbd/files/nbd-client.init create mode 100644 net/nbd/files/nbd-server.conf create mode 100644 net/nbd/files/nbd-server.init create mode 100644 net/ncp/Makefile create mode 100644 net/net-snmp/Makefile create mode 100644 net/net-snmp/files/snmpd.conf create mode 100644 net/net-snmp/files/snmpd.init create mode 100644 net/net-snmp/patches/100-debian-statistics.patch create mode 100644 net/net-snmp/patches/110-debian-makefiles.patch create mode 100644 net/net-snmp/patches/120-debian-searchdirs.patch create mode 100644 net/net-snmp/patches/130-debian-extramibs.patch create mode 100644 net/net-snmp/patches/160-no_ldconfig.patch create mode 100644 net/net-snmp/patches/170-ldflags.patch create mode 100644 net/net-snmp/patches/750-ieee802dot11.patch create mode 100644 net/net-snmp/patches/800-format-security.patch create mode 100644 net/net-snmp/patches/900-musl-compat.patch create mode 100644 net/netatalk/Makefile create mode 100644 net/netatalk/files/afpd.init create mode 100644 net/netatalk/patches/001-automake-compat.patch create mode 100644 net/netatalk/patches/002-ld_library_path.patch create mode 100644 net/netcat/Makefile create mode 100644 net/netcat/patches/001-netcat_flag_count.patch create mode 100644 net/netdiscover/Makefile create mode 100644 net/netperf/Makefile create mode 100644 net/netperf/files/netserver.init create mode 100644 net/nfs-kernel-server/Makefile create mode 100644 net/nfs-kernel-server/files/nfsd.exports create mode 100644 net/nfs-kernel-server/files/nfsd.init create mode 100644 net/nfs-kernel-server/patches/100-no_malloc_h.patch create mode 100644 net/nfs-kernel-server/patches/101-musl-getservbyport.patch create mode 100644 net/nginx/Config.in create mode 100644 net/nginx/Makefile create mode 100644 net/nginx/files/nginx.init create mode 100644 net/nginx/patches-lua-nginx/100-no_by_lua_block.patch create mode 100644 net/nginx/patches/101-feature_test_fix.patch create mode 100644 net/nginx/patches/102-sizeof_test_fix.patch create mode 100644 net/nginx/patches/103-sys_nerr.patch create mode 100644 net/nginx/patches/200-config.patch create mode 100644 net/nginx/patches/300-max-processes.patch create mode 100644 net/ngircd/Makefile create mode 100644 net/ngircd/files/ngircd.init create mode 100644 net/nmap/Makefile create mode 100644 net/nmap/patches/001-fix-missing-includes.patch create mode 100644 net/nsd/Makefile create mode 100644 net/nsd/files/nsd.init create mode 100644 net/ntpclient/Makefile create mode 100644 net/ntpclient/files/ntpclient.config create mode 100644 net/ntpclient/files/ntpclient.hotplug create mode 100644 net/ntpclient/patches/100-daemon.patch create mode 100644 net/ntpd/Makefile create mode 100644 net/ntpd/files/ntp.conf create mode 100644 net/ntpd/files/ntpd.hotplug create mode 100644 net/ntpd/files/ntpd.init create mode 100644 net/ntpd/files/ntpdate.init create mode 100644 net/ntripcaster/Makefile create mode 100644 net/ntripclient/Makefile create mode 100644 net/ntripclient/patches/100-musl-compat.patch create mode 100644 net/ntripserver/Makefile create mode 100644 net/nut/Config.in create mode 100644 net/nut/Makefile create mode 100755 net/nut/files/nut-monitor.init create mode 100755 net/nut/files/nut-server.init create mode 100644 net/nut/files/nut.service create mode 100644 net/obfsproxy/Makefile create mode 100644 net/obfsproxy/files/obfsproxy.conf create mode 100644 net/obfsproxy/files/obfsproxy.init create mode 100644 net/obfsproxy/patches/001-exclude-tests.patch create mode 100644 net/obfsproxy/patches/002-fix-python-path.patch create mode 100644 net/obfsproxy/patches/003-remove-argparse-dependency-test.patch create mode 100644 net/obfsproxy/patches/004-add-syslog-support.patch create mode 100644 net/ocserv/Config.in create mode 100644 net/ocserv/Makefile create mode 100644 net/ocserv/README create mode 100644 net/ocserv/files/config create mode 100644 net/ocserv/files/ocserv.conf.template create mode 100644 net/ocserv/files/ocserv.init create mode 100644 net/ocserv/files/ocserv.upgrade create mode 100644 net/ocserv/patches/001-makefile-fix.patch create mode 100644 net/opennhrp/Makefile create mode 100644 net/opennhrp/files/opennhrp.init create mode 100644 net/opennhrp/patches/100-musl-compat.patch create mode 100644 net/openssh/Makefile create mode 100644 net/openssh/files/sftp-ssh.service create mode 100644 net/openssh/files/sshd.init create mode 100644 net/openssh/files/sshd.pam create mode 100644 net/openssh/files/sshd.pam-access create mode 100644 net/openssh/patches/100-openssh-7.3_p1-NEWKEYS_null_deref.patch create mode 100644 net/openssh/patches/101-Unregister-the-KEXINIT-handler-after-receive.patch create mode 100644 net/openssh/patches/130-implicit_memset_decl_fix.patch create mode 100644 net/openssh/patches/140-pam_uclibc_pthreads_fix.patch create mode 100644 net/openssh/patches/200-dscp-qos.patch create mode 100644 net/opentracker/Makefile create mode 100755 net/opentracker/files/opentracker.init create mode 100755 net/opentracker/files/opentracker6.init create mode 100644 net/opentracker/patches/100-makefile.patch create mode 100644 net/openvswitch/Makefile create mode 100644 net/openvswitch/files/etc/init.d/openvswitch.init create mode 100644 net/openvswitch/patches/0001-netdev-linux-Use-unsigned-int-for-ifi_flags.patch create mode 100644 net/openvswitch/patches/0002-netdev-linux-Let-interface-flag-survive-internal-por.patch create mode 100644 net/openvswitch/patches/0004-musl-compatibility.patch create mode 100644 net/openvswitch/patches/0008-add-back-old-gfp-this-node-define.patch create mode 100644 net/openvswitch/patches/0009-fix-test-ovn.patch create mode 100644 net/openvswitch/patches/0010-lib-ovs-thread-Ensure-that-thread-stacks-are-always-.patch create mode 100644 net/openvswitch/patches/0011-kernel-4-4-support.patch create mode 100644 net/p910nd/Makefile create mode 100644 net/p910nd/files/p910nd.config create mode 100644 net/p910nd/files/p910nd.init create mode 100644 net/pingcheck/Makefile create mode 100755 net/pingcheck/pingcheck.init create mode 100644 net/polipo/Makefile create mode 100644 net/polipo/files/polipo.config create mode 100644 net/polipo/files/polipo.init create mode 100644 net/port-mirroring/Makefile create mode 100644 net/portmap/Makefile create mode 100644 net/portmap/files/portmap.init create mode 100644 net/portmap/patches/101-no_pie.patch create mode 100644 net/pppossh/Makefile create mode 100644 net/pppossh/README.md create mode 100644 net/pppossh/files/pppossh.sh create mode 100644 net/pptpd/Makefile create mode 100644 net/pptpd/files/options.pptpd create mode 100644 net/pptpd/files/pptpd.conf create mode 100644 net/pptpd/files/pptpd.config create mode 100644 net/pptpd/files/pptpd.init create mode 100644 net/pptpd/patches/001-bad_pqueue_debug.patch create mode 100644 net/pptpd/patches/002-makefile_fix.patch create mode 100644 net/pptpd/patches/003-opt_flags.patch create mode 100644 net/pptpd/patches/100-musl-compat.patch create mode 100644 net/privoxy/Config.in create mode 100644 net/privoxy/Makefile create mode 100644 net/privoxy/files/privoxy.config create mode 100644 net/privoxy/files/privoxy.hotplug create mode 100644 net/privoxy/files/privoxy.init create mode 100644 net/privoxy/files/privoxy.upgrade create mode 100644 net/prosody/Makefile create mode 100644 net/prosody/files/prosody.cfg.lua create mode 100644 net/prosody/files/prosody.init create mode 100644 net/quassel-irssi/Makefile create mode 100644 net/quassel-irssi/patches/001-respect-cflags.patch create mode 100644 net/quassel-irssi/patches/002-use-cc-var.patch create mode 100644 net/quassel-irssi/patches/003-use-pkgconfig-ldflags-quasselc.patch create mode 100644 net/radicale/Makefile create mode 100644 net/radicale/files/config.template create mode 100644 net/radicale/files/logging.template create mode 100644 net/radicale/files/radicale.config create mode 100644 net/radicale/files/radicale.hotplug create mode 100755 net/radicale/files/radicale.init create mode 100644 net/radicale/files/radicale.rights create mode 100644 net/radicale/files/radicale.upgrade create mode 100644 net/radicale/files/radicale.users create mode 100644 net/radicale/patches/010-Run-as-user-group-radicale-radicale.patch create mode 100644 net/radsecproxy/Makefile create mode 100644 net/radsecproxy/files/radsecproxy.conf create mode 100644 net/radsecproxy/files/radsecproxy.init create mode 100644 net/radsecproxy/patches/100-missing-return.patch create mode 100644 net/radsecproxy/patches/200-logdest-on-foreground.patch create mode 100644 net/reaver/Makefile create mode 100644 net/reaver/patches/0001-wpscrack-big-endian-fixes.patch create mode 100644 net/reaver/patches/0002-Use-the-current-directory-for-storing-and-loading-se.patch create mode 100644 net/reaver/patches/0003-wash-wpsmon-use-less-useless-spaces-in-output-to-fit.patch create mode 100644 net/reaver/patches/0004-Fixed-probe-request-bug-in-wash.patch create mode 100644 net/reaver/patches/0100-Include-sys-types.h-for-definition-of-u_char.patch create mode 100644 net/reaver/patches/0101-pcap-use-65536-as-snaplen.patch create mode 100644 net/redsocks/Makefile create mode 100644 net/redsocks/files/redsocks.conf create mode 100644 net/redsocks/files/redsocks.init create mode 100644 net/redsocks/patches/0006-fix_default_config_location.patch create mode 100644 net/remserial/Makefile create mode 100644 net/rp-pppoe/Makefile create mode 100644 net/rp-pppoe/files/ppp/options create mode 100644 net/rp-pppoe/files/ppp/pap-secrets create mode 100644 net/rp-pppoe/files/ppp/pppoe-server-options create mode 100644 net/rp-pppoe/files/ppp_defs.h create mode 100644 net/rp-pppoe/files/pppoe-relay.default create mode 100755 net/rp-pppoe/files/pppoe-relay.init create mode 100644 net/rp-pppoe/files/pppoe-server.default create mode 100755 net/rp-pppoe/files/pppoe-server.init create mode 100644 net/rp-pppoe/files/pppoe.config create mode 100644 net/rp-pppoe/patches/100-configure.patch create mode 100644 net/rp-pppoe/patches/110-Makefile.patch create mode 100644 net/rp-pppoe/patches/120-use-linux-ether-not-netinet.patch create mode 100644 net/rsync/Config.in create mode 100644 net/rsync/Makefile create mode 100644 net/rsync/files/rsyncd.conf create mode 100644 net/rsync/files/rsyncd.init create mode 100644 net/rsyslog/Makefile create mode 100644 net/rsyslog/files/rsyslog.conf create mode 100644 net/rsyslog/files/rsyslog.init create mode 100644 net/rtorrent/Makefile create mode 100644 net/rtorrent/patches/100-fix-cross_compile.patch create mode 100644 net/rtorrent/patches/120-fix-ncurses.patch create mode 100644 net/scapy/Makefile create mode 100644 net/seafile-ccnet/Makefile create mode 100644 net/seafile-ccnet/patches/010-Makefile.patch create mode 100644 net/seafile-seahub/Makefile create mode 100644 net/seafile-seahub/patches/010-default-config.patch create mode 100644 net/seafile-seahub/patches/020-Makefile-fixes.patch create mode 100644 net/seafile-server/Config.in create mode 100644 net/seafile-server/Makefile create mode 100644 net/seafile-server/files/seafile.conf create mode 100755 net/seafile-server/files/seafile.init create mode 100755 net/seafile-server/files/seahub.init create mode 100644 net/seafile-server/patches/020-script-patches.patch create mode 100644 net/seafile-server/patches/030-pidfiles-in-same-directory.patch create mode 100644 net/seafile-server/patches/040-seafile-admin.patch create mode 100644 net/seafile-server/patches/050-libseafile-makefile-fixes.patch create mode 100644 net/seafile-server/patches/060-timestamps-as-int64.patch create mode 100644 net/seafile-server/patches/070-fuse-mount.patch create mode 100644 net/ser2net/Makefile create mode 100644 net/shadowsocks-client/Makefile create mode 100644 net/shadowsocks-client/files/sslocal.config create mode 100755 net/shadowsocks-client/files/sslocal.init create mode 100644 net/shadowsocks-libev/Makefile create mode 100644 net/shadowsocks-libev/files/firewall.include create mode 100644 net/shadowsocks-libev/files/shadowsocks-libev.config create mode 100644 net/shadowsocks-libev/files/shadowsocks-libev.init create mode 100644 net/shadowsocks-libev/files/ss-rules create mode 100644 net/siit/Makefile create mode 100644 net/siit/src/Makefile create mode 100644 net/siit/src/siit.c create mode 100644 net/siit/src/siit.h create mode 100644 net/sipgrep/Makefile create mode 100644 net/smartsnmpd/Makefile create mode 100644 net/smartsnmpd/files/mibs/dummy.lua create mode 100644 net/smartsnmpd/files/mibs/interfaces.lua create mode 100644 net/smartsnmpd/files/mibs/system.lua create mode 100644 net/smartsnmpd/files/smartsnmpd.conf create mode 100755 net/smartsnmpd/files/smartsnmpd.init create mode 100644 net/sngrep/Makefile create mode 100644 net/snort/Config.in create mode 100644 net/snort/Makefile create mode 100644 net/snort/files/snort.config create mode 100644 net/snort/files/snort.init create mode 100644 net/snort/patches/001-compile.patch create mode 100644 net/snort/patches/100-autoconf-fixes.patch create mode 100644 net/socat/Makefile create mode 100644 net/socat/files/socat.config create mode 100644 net/socat/files/socat.init create mode 100644 net/socat/patches/100-musl-compat.patch create mode 100644 net/softflowd/Makefile create mode 100644 net/softflowd/files/softflowd.config create mode 100755 net/softflowd/files/softflowd.init create mode 100644 net/spawn-fcgi/Makefile create mode 100644 net/sqm-scripts-extra/Makefile create mode 100644 net/sqm-scripts-extra/src/test_LAN_dual-isolate__piece_of_cake.qos create mode 100644 net/sqm-scripts-extra/src/test_LAN_dual-isolate__piece_of_cake.qos.help create mode 100644 net/sqm-scripts-extra/src/test_LAN_triple-isolate__piece_of_cake.qos create mode 100644 net/sqm-scripts-extra/src/test_LAN_triple-isolate__piece_of_cake.qos.help create mode 100644 net/sqm-scripts-extra/src/test_WAN_dual-isolate__piece_of_cake.qos create mode 100644 net/sqm-scripts-extra/src/test_WAN_dual-isolate__piece_of_cake.qos.help create mode 100644 net/sqm-scripts-extra/src/test_WAN_triple-isolate__piece_of_cake.qos create mode 100644 net/sqm-scripts-extra/src/test_WAN_triple-isolate__piece_of_cake.qos.help create mode 100644 net/sqm-scripts-extra/src/test_triple_isolated_llt_cake.qos create mode 100644 net/sqm-scripts-extra/src/test_triple_isolated_llt_cake.qos.help create mode 100644 net/sqm-scripts/Makefile create mode 100644 net/squid/Makefile create mode 100644 net/squid/files/squid.conf create mode 100644 net/squid/files/squid.config create mode 100644 net/squid/files/squid.init create mode 100644 net/squid/patches/001-cross_compile.patch create mode 100644 net/squid/patches/100-mime.patch create mode 100644 net/sshfs/Makefile create mode 100644 net/sshtunnel/Makefile create mode 100644 net/sshtunnel/files/sshtunnel.init create mode 100644 net/sshtunnel/files/uci_sshtunnel create mode 100644 net/sslh/Makefile create mode 100644 net/sslh/files/sslh.config create mode 100644 net/sslh/files/sslh.init create mode 100644 net/sslh/patches/001-no_sslh_select.patch create mode 100644 net/sslh/patches/002-no_regex_probes.patch create mode 100644 net/sstp-client/Makefile create mode 100644 net/sstp-client/files/etc/ppp/chap-secrets create mode 100644 net/sstp-client/files/etc/ppp/peers/peer-sstp-example-nopty.txt create mode 100644 net/sstp-client/files/etc/ppp/peers/peer-sstp-example.txt create mode 100644 net/sstp-client/patches/100-musl-compat.patch create mode 100644 net/strongswan/Config.in create mode 100644 net/strongswan/Makefile create mode 100644 net/strongswan/files/ipsec.init create mode 100644 net/strongswan/files/ipsec.secrets create mode 100644 net/strongswan/files/ipsec.user create mode 100644 net/strongswan/patches/101-musl-fixes.patch create mode 100644 net/strongswan/patches/201-kmodloader.patch create mode 100644 net/strongswan/patches/203-uci.patch create mode 100644 net/strongswan/patches/210-sleep.patch create mode 100644 net/strongswan/patches/300-include-ipsec-user-script.patch create mode 100644 net/strongswan/patches/305-minimal_dh_plugin.patch create mode 100644 net/stunnel/Makefile create mode 100644 net/stunnel/files/stunnel.conf create mode 100644 net/stunnel/files/stunnel.init create mode 100644 net/subversion/Makefile create mode 100644 net/subversion/files/subversion.config create mode 100644 net/subversion/files/subversion.init create mode 100644 net/subversion/patches/301-cross-compilation-macos.patch create mode 100644 net/tcpproxy/Makefile create mode 100644 net/tcpproxy/files/tcpproxy.config create mode 100644 net/tcpproxy/files/tcpproxy.init create mode 100644 net/tcpproxy/patches/001-ragel_generated.patch create mode 100644 net/tcpreplay/Makefile create mode 100644 net/tgt/Makefile create mode 100644 net/tgt/files/etc/config/tgt create mode 100755 net/tgt/files/etc/init.d/tgt create mode 100644 net/tgt/patches/020-usr_Makefile.patch create mode 100644 net/tgt/patches/030-Makefile.patch create mode 100644 net/tgt/patches/100-musl-compat.patch create mode 100644 net/tinc/Makefile create mode 100644 net/tinc/files/tinc.config create mode 100644 net/tinc/files/tinc.init create mode 100644 net/tinc/files/tinc.upgrade create mode 100644 net/tinyproxy/Makefile create mode 100644 net/tinyproxy/files/tinyproxy.config create mode 100644 net/tinyproxy/files/tinyproxy.init create mode 100644 net/tinyproxy/patches/010-no-docs-and-tests.patch create mode 100644 net/tinyproxy/patches/020-config_and_pid-path.patch create mode 100644 net/tinyproxy/patches/030-allow_bind_in_transparent_mode.patch create mode 100644 net/tinyproxy/patches/120-fix_INET6.patch create mode 100644 net/tinyproxy/patches/CVE-2012-3505-tiniproxy-randomized-hashmaps.patch create mode 100644 net/tinyproxy/patches/CVE-2012-3505-tinyproxy-limit-headers.patch create mode 100644 net/tor/Makefile create mode 100644 net/tor/files/tor.init create mode 100644 net/tor/patches/001-torrc.patch create mode 100644 net/transmission/Makefile create mode 100644 net/transmission/files/transmission.config create mode 100644 net/transmission/files/transmission.init create mode 100644 net/transmission/patches/020-use-internal-miniupnp.patch create mode 100644 net/transmission/patches/030-fix-musl-build.patch create mode 100644 net/travelmate/Makefile create mode 100644 net/travelmate/files/README.md create mode 100644 net/travelmate/files/travelmate.conf create mode 100755 net/travelmate/files/travelmate.init create mode 100755 net/travelmate/files/travelmate.sh create mode 100644 net/u2pnpd/Makefile create mode 100644 net/u2pnpd/files/u2pnpd.config create mode 100644 net/u2pnpd/files/u2pnpd.defaults create mode 100644 net/u2pnpd/files/u2pnpd.init create mode 100644 net/uanytun/Makefile create mode 100644 net/uanytun/files/uanytun-nocrypt.config create mode 100644 net/uanytun/files/uanytun.config create mode 100644 net/uanytun/files/uanytun.init create mode 100644 net/udpxy/Makefile create mode 100644 net/udpxy/files/udpxy.conf create mode 100644 net/udpxy/files/udpxy.init create mode 100644 net/ulogd/Makefile create mode 100644 net/ulogd/files/ulogd.init create mode 100644 net/ulogd/patches/100-musl-compat.patch create mode 100644 net/umurmur/Makefile create mode 100644 net/umurmur/patches/10-Add-compile-time-check-for-POLARSSL_VERSION_FEATURES.patch create mode 100644 net/unbound/Makefile create mode 100644 net/unbound/files/README.md create mode 100644 net/unbound/files/dnsmasq.sh create mode 100644 net/unbound/files/iptools.sh create mode 100644 net/unbound/files/root.key create mode 100644 net/unbound/files/rootzone.sh create mode 100755 net/unbound/files/unbound.iface create mode 100755 net/unbound/files/unbound.init create mode 100755 net/unbound/files/unbound.ntpd create mode 100644 net/unbound/files/unbound.sh create mode 100644 net/unbound/files/unbound.uci create mode 100644 net/unbound/patches/001-conf.patch create mode 100644 net/usbip/Makefile create mode 100644 net/usbip/patches-2.0/100-musl-compat.patch create mode 100644 net/usbip/patches/001-upstream_svn_r99.diff create mode 100644 net/usbip/patches/002-upstream_svn_r152.patch create mode 100644 net/vncrepeater/Makefile create mode 100644 net/vncrepeater/patches/001-uclibcxx_linking.patch create mode 100644 net/vncrepeater/patches/002-cfg-path.patch create mode 100644 net/vnstat/Makefile create mode 100644 net/vnstat/files/vnstat.config create mode 100644 net/vnstat/files/vnstat.defaults create mode 100644 net/vnstat/files/vnstat.init create mode 100644 net/vnstat/patches/001-conf.patch create mode 100644 net/vnstat/patches/002-no_install_strip.patch create mode 100644 net/vnstat/patches/003-no_install_uname.patch create mode 100644 net/vnstat/patches/100-musl-compat.patch create mode 100644 net/vpnc-scripts/Makefile create mode 100755 net/vpnc-scripts/files/vpnc-script create mode 100644 net/vpnc/Config.in create mode 100644 net/vpnc/Makefile create mode 100644 net/vpnc/README create mode 100755 net/vpnc/files/vpnc.sh create mode 100644 net/vpnc/files/vpnc.upgrade create mode 100644 net/vpnc/patches/001-cross.patch create mode 100644 net/vpnc/patches/100-musl-compat.patch create mode 100644 net/vsftpd/Makefile create mode 100644 net/vsftpd/files/vsftpd.conf create mode 100644 net/vsftpd/files/vsftpd.init create mode 100644 net/vsftpd/patches/001-destdir.patch create mode 100644 net/vsftpd/patches/002-find_libs.patch create mode 100644 net/vsftpd/patches/003-chroot.patch create mode 100644 net/vsftpd/patches/004-disable-capabilities.patch create mode 100644 net/vsftpd/patches/005-disable-pam.patch create mode 100644 net/vsftpd/patches/006-musl-compatibility.patch create mode 100644 net/vsftpd/patches/007-CVE-2015-1419.patch create mode 100644 net/wavemon/Makefile create mode 100644 net/wavemon/patches/musl-fix.patch create mode 100644 net/webui-aria2/Makefile create mode 100644 net/wget/Makefile create mode 100644 net/wifidog/Makefile create mode 100644 net/wifidog/files/wifidog.init create mode 100644 net/wifischedule/LICENSE create mode 100644 net/wifischedule/Makefile create mode 100644 net/wifischedule/README.md create mode 100644 net/wifischedule/net/etc/config/wifi_schedule create mode 100755 net/wifischedule/net/usr/bin/wifi_schedule.sh create mode 100644 net/wireguard/Makefile create mode 100644 net/wireguard/files/wireguard.sh create mode 100644 net/wshaper/Makefile create mode 100644 net/wshaper/files/wshaper.config create mode 100755 net/wshaper/files/wshaper.htb create mode 100644 net/wshaper/files/wshaper.iface create mode 100644 net/wshaper/files/wshaper.init create mode 100644 net/xinetd/Makefile create mode 100644 net/xinetd/files/xinetd.conf create mode 100644 net/xinetd/files/xinetd.init create mode 100644 net/xinetd/patches/001-ar.patch create mode 100644 net/xinetd/patches/002-destdir.patch create mode 100644 net/xinetd/patches/003-rpc_fix.patch create mode 100644 net/xinetd/patches/004-ident-bind.patch create mode 100644 net/xl2tpd/Makefile create mode 100644 net/xl2tpd/README create mode 100644 net/xl2tpd/files/l2tp.sh create mode 100644 net/xl2tpd/files/options.xl2tpd create mode 100644 net/xl2tpd/files/xl2tp-secrets create mode 100644 net/xl2tpd/files/xl2tpd.conf create mode 100644 net/xl2tpd/files/xl2tpd.conf.sample create mode 100644 net/xl2tpd/files/xl2tpd.init create mode 100644 net/xl2tpd/patches/100-makefile_opt_flags.patch create mode 100644 net/xl2tpd/patches/110-makefile_dont_build_pfc.patch create mode 100644 net/xl2tpd/patches/120-no-bsd-signal-in-musl.patch create mode 100644 net/yaaw/Makefile create mode 100644 net/znc/Config.in create mode 100644 net/znc/Makefile create mode 100644 net/znc/files/znc.conf create mode 100644 net/znc/files/znc.init create mode 100644 net/znc/patches/100-move_rootcheck_after_config.patch create mode 100644 net/znc/patches/101-Reduce_rebuild_time.patch create mode 100644 net/znc/patches/103-Csocket-Add-some-ifdef-feature-checks.patch create mode 100644 net/znc/patches/104-disable-empty-modules-check.patch create mode 100644 net/znc/patches/110-add-playback-module.patch create mode 100644 sound/alsa-utils/Makefile create mode 100644 sound/alsa-utils/patches/100-uClibc-compat.patch create mode 100644 sound/espeak/Makefile create mode 100644 sound/espeak/patches/101-portaudio.patch create mode 100644 sound/forked-daapd/Makefile create mode 100644 sound/forked-daapd/files/forked-daapd.conf create mode 100644 sound/forked-daapd/files/forked-daapd.init create mode 100644 sound/forked-daapd/patches/010-include_pregen.patch create mode 100644 sound/lame/Makefile create mode 100644 sound/lame/patches/001-automake-compat.patch create mode 100644 sound/madplay/Makefile create mode 100644 sound/madplay/patches/0001-switch-to-new-alsa-api.patch create mode 100644 sound/madplay/patches/010-use_correct_shell.patch create mode 100644 sound/mocp/Makefile create mode 100644 sound/mpc/Makefile create mode 100644 sound/mpc/files/pls-handler.sh create mode 100644 sound/mpd/Makefile create mode 100644 sound/mpd/files/mpd.init create mode 100644 sound/mpd/files/mpd.service create mode 100644 sound/mpd/patches/210-support_raw_pcm_streams.patch create mode 100644 sound/mpd/patches/220-handle_slow_server_stream_startup.patch create mode 100644 sound/mpg123/Makefile create mode 100644 sound/pianod/Makefile create mode 100644 sound/pianod/files/pianod.init create mode 100644 sound/pianod/patches/005-Remove_svn_version_query.patch create mode 100644 sound/pianod/patches/010-Configure_add_SSL_options.patch create mode 100644 sound/pianod/patches/020-Use_package_config_h_for_all_modules.patch create mode 100644 sound/pianod/patches/030-Waitress_add_polarssl_variant.patch create mode 100644 sound/portaudio/Makefile create mode 100644 sound/pulseaudio/Makefile create mode 100644 sound/pulseaudio/files/pulseaudio.init create mode 100644 sound/pulseaudio/patches/001-no_default_64mb_alloc.patch create mode 100644 sound/shairplay/Makefile create mode 100644 sound/shairplay/files/shairplay.config create mode 100644 sound/shairplay/files/shairplay.init create mode 100644 sound/shairplay/patches/001-key_file_dir.patch create mode 100644 sound/shairplay/patches/002-libavahi-compat-dnssd.patch create mode 100644 sound/shairplay/patches/003-fix_big-endian.patch create mode 100644 sound/shairport-sync/Makefile create mode 100644 sound/shairport-sync/files/shairport-sync.config create mode 100644 sound/shairport-sync/files/shairport-sync.init create mode 100644 sound/shairport/Makefile create mode 100644 sound/shairport/files/shairport.config create mode 100644 sound/shairport/files/shairport.init create mode 100644 sound/shairport/patches/001-disable_pulseaudio.patch create mode 100644 sound/shine/Makefile create mode 100644 sound/shine/patches/001-fix_mips64_bswap.patch create mode 100644 sound/sox/Makefile create mode 100644 sound/sox/patches/001-cross_compile.patch create mode 100644 sound/sox/patches/010-fix_uclibc_build_issue.patch create mode 100644 sound/sox/patches/020-ffmpeg-0.11.patch create mode 100644 sound/sox/patches/020-ffmpeg-2.x.patch create mode 100644 sound/squeezelite/Makefile create mode 100644 sound/squeezelite/files/squeezelite.conf create mode 100644 sound/squeezelite/files/squeezelite.init create mode 100644 sound/squeezelite/patches/005-respect_LDFLAGS.patch create mode 100644 sound/squeezelite/patches/010-select_broadcast_interface.patch create mode 100644 sound/squeezelite/patches/020-no_mpg123.patch create mode 100644 sound/squeezelite/patches/030-fix_musl_compatibilty.patch create mode 100644 sound/squeezelite/patches/040-clear_dynlink_errors.patch create mode 100644 sound/svox/Makefile create mode 100644 sound/svox/patches/0001-autoconf-building-of-library-using-libtool.patch create mode 100644 sound/svox/patches/0002-gitignore-for-autotools-files.patch create mode 100644 sound/svox/patches/0003-pico2wave-Convert-text-to-.wav-using-svox-text-to-sp.patch create mode 100644 sound/svox/patches/0004-add-header-files.patch create mode 100644 sound/svox/patches/0005-Install-lang-files.patch create mode 100644 sound/svox/patches/0006-Set-picolangdir.patch create mode 100644 sound/svox/patches/0008-64bits.patch create mode 100644 sound/svox/patches/0009-Fix-link-order.patch create mode 100644 sound/svox/patches/0010-platform.patch create mode 100644 sound/svox/patches/0011-subdir.patch create mode 100644 sound/svox/patches/0012-no-headers.patch create mode 100644 sound/upmpdcli/Config.in create mode 100644 sound/upmpdcli/Makefile create mode 100644 sound/upmpdcli/files/upmpdcli.config create mode 100644 sound/upmpdcli/files/upmpdcli.init create mode 100644 sound/upmpdcli/files/upmpdcli.png create mode 100644 sound/upmpdcli/patches/010-Add_icon_config.patch create mode 100644 utils/acl/Makefile create mode 100644 utils/acl/patches/100-no-gettext_configure.patch create mode 100644 utils/acl/patches/101-no-gettext_autogen.patch create mode 100644 utils/acl/patches/102-no-gettext_Makefile.patch create mode 100644 utils/acpid/Makefile create mode 100644 utils/acpid/files/acpid.hotplug create mode 100644 utils/acpid/files/acpid.init create mode 100644 utils/acpid/files/default create mode 100644 utils/acpid/patches/002-dont-use-isfdtype.patch create mode 100644 utils/ap51-flash/Makefile create mode 100644 utils/ap51-flash/files/ap51-flash.config create mode 100644 utils/ap51-flash/files/ap51-flash.init create mode 100755 utils/ap51-flash/files/ap51-flash.sh create mode 100644 utils/at/Makefile create mode 100755 utils/at/files/atd.init create mode 100644 utils/at/patches/100-remove-glibc-assumption.patch create mode 100644 utils/at/patches/110-getloadavg.patch create mode 100644 utils/attr/Makefile create mode 100644 utils/attr/patches/100-no-gettext_configure.patch create mode 100644 utils/attr/patches/101-no-gettext_autogen.patch create mode 100644 utils/attr/patches/102-no-gettext_Makefile.patch create mode 100644 utils/avrdude/Makefile create mode 100644 utils/avrdude/patches/010-configure-fixups.patch create mode 100644 utils/avrdude/patches/100-musl-compat.patch create mode 100644 utils/bandwidthd-php/Makefile create mode 100644 utils/bandwidthd-php/files/bandwidthd-php.config create mode 100755 utils/bandwidthd-php/files/bandwidthd-php.init create mode 100644 utils/bandwidthd-php/files/details.php create mode 100644 utils/bandwidthd-php/files/footer.php create mode 100644 utils/bandwidthd-php/files/graph.php create mode 100644 utils/bandwidthd-php/files/include.php create mode 100644 utils/bandwidthd-php/files/index.php create mode 100644 utils/bandwidthd-php/files/legend.gif create mode 100644 utils/bandwidthd-php/files/logo.gif create mode 100644 utils/bandwidthd/Makefile create mode 100644 utils/bandwidthd/files/bandwidthd-pgsql.config create mode 100644 utils/bandwidthd/files/bandwidthd-pgsql.init create mode 100644 utils/bandwidthd/files/bandwidthd.config create mode 100644 utils/bandwidthd/files/bandwidthd.init create mode 100644 utils/bandwidthd/files/logo.gif create mode 100644 utils/bandwidthd/patches/010-dont-add-host-paths.patch create mode 100644 utils/bandwidthd/patches/100-fix_config_file_location create mode 100644 utils/banhosts/Makefile create mode 100644 utils/banhosts/files/updatebanhost create mode 100644 utils/bash/Makefile create mode 100644 utils/bash/patches/001-compile-fix.patch create mode 100644 utils/bash/patches/002-force-internal-readline.patch create mode 100644 utils/bash/patches/101-upstream-bash43-001.patch create mode 100644 utils/bash/patches/102-upstream-bash43-002.patch create mode 100644 utils/bash/patches/103-upstream-bash43-003.patch create mode 100644 utils/bash/patches/104-upstream-bash43-004.patch create mode 100644 utils/bash/patches/105-upstream-bash43-005.patch create mode 100644 utils/bash/patches/106-upstream-bash43-006.patch create mode 100644 utils/bash/patches/107-upstream-bash43-007.patch create mode 100644 utils/bash/patches/108-upstream-bash43-008.patch create mode 100644 utils/bash/patches/109-upstream-bash43-009.patch create mode 100644 utils/bash/patches/110-upstream-bash43-010.patch create mode 100644 utils/bash/patches/111-upstream-bash43-011.patch create mode 100644 utils/bash/patches/112-upstream-bash43-012.patch create mode 100644 utils/bash/patches/113-upstream-bash43-013.patch create mode 100644 utils/bash/patches/114-upstream-bash43-014.patch create mode 100644 utils/bash/patches/115-upstream-bash43-015.patch create mode 100644 utils/bash/patches/116-upstream-bash43-016.patch create mode 100644 utils/bash/patches/117-upstream-bash43-017.patch create mode 100644 utils/bash/patches/118-upstream-bash43-018.patch create mode 100644 utils/bash/patches/119-upstream-bash43-019.patch create mode 100644 utils/bash/patches/120-upstream-bash43-020.patch create mode 100644 utils/bash/patches/121-upstream-bash43-021.patch create mode 100644 utils/bash/patches/122-upstream-bash43-022.patch create mode 100644 utils/bash/patches/123-upstream-bash43-023.patch create mode 100644 utils/bash/patches/124-upstream-bash43-024.patch create mode 100644 utils/bash/patches/125-upstream-bash43-025.patch create mode 100644 utils/bash/patches/126-upstream-bash43-026.patch create mode 100644 utils/bash/patches/127-upstream-bash43-027.patch create mode 100644 utils/bash/patches/128-upstream-bash43-028.patch create mode 100644 utils/bash/patches/129-upstream-bash43-029.patch create mode 100644 utils/bash/patches/130-upstream-bash43-030.patch create mode 100644 utils/bash/patches/131-upstream-bash43-031.patch create mode 100644 utils/bash/patches/132-upstream-bash43-032.patch create mode 100644 utils/bash/patches/133-upstream-bash43-033.patch create mode 100644 utils/bash/patches/134-upstream-bash43-034.patch create mode 100644 utils/bash/patches/135-upstream-bash43-035.patch create mode 100644 utils/bash/patches/136-upstream-bash43-036.patch create mode 100644 utils/bash/patches/137-upstream-bash43-037.patch create mode 100644 utils/bash/patches/138-upstream-bash43-038.patch create mode 100644 utils/bash/patches/139-upstream-bash43-039.patch create mode 100644 utils/bash/patches/140-upstream-bash43-040.patch create mode 100644 utils/bash/patches/141-upstream-bash43-041.patch create mode 100644 utils/bash/patches/142-upstream-bash43-042.patch create mode 100644 utils/bash/patches/900-no_doc.patch create mode 100644 utils/bc/Makefile create mode 100644 utils/bc/patches/001-disable-doc.patch create mode 100644 utils/bluelog/Makefile create mode 100644 utils/bluelog/files/bluelog.init create mode 100644 utils/bluelog/patches/100-gen-oui-fix-tempfile-use-mirror.patch create mode 100644 utils/bluez/Makefile create mode 100644 utils/bluez/files/bluetooth.config create mode 100644 utils/bluez/files/bluetooth.dbus create mode 100644 utils/bluez/files/bluetoothd.init create mode 100644 utils/bluez/files/givepin create mode 100644 utils/bluez/patches/001-bcm43xx-Add-bcm43xx-3wire-variant.patch create mode 100644 utils/bluez/patches/002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch create mode 100644 utils/bluez/patches/003-Increase-firmware-load-timeout-to-30s.patch create mode 100644 utils/bluez/patches/004-Move-the-43xx-firmware-into-lib-firmware.patch create mode 100644 utils/bluez/patches/200-uart-speed.patch create mode 100644 utils/bluez/patches/201-readline.patch create mode 100644 utils/bonnie++/Makefile create mode 100644 utils/bonnie++/patches/001-cross_compile_fix.patch create mode 100644 utils/bonnie++/patches/002-add-verbose-error-messages.patch create mode 100644 utils/btrfs-progs/Makefile create mode 100644 utils/btrfs-progs/files/btrfs-scan.init create mode 100644 utils/btrfs-progs/patches/0001-use-pthread_join-instead-of-pthread_tryjoin_np.patch create mode 100644 utils/canutils/Makefile create mode 100644 utils/ccid/Makefile create mode 100644 utils/ccrypt/Makefile create mode 100644 utils/ccrypt/patches/001-no-intl.patch create mode 100644 utils/cmdpad/Makefile create mode 100644 utils/cmdpad/files/cmdpad.init create mode 100644 utils/cmdpad/patches/100-Makefile.patch create mode 100644 utils/cmdpad/patches/120-kernel26-compat.patch create mode 100644 utils/cmdpad/patches/130-no_zombie.patch create mode 100644 utils/cmdpad/patches/140-compile_fix.patch create mode 100644 utils/collectd/Makefile create mode 100644 utils/collectd/files/collectd.conf create mode 100644 utils/collectd/files/collectd.init create mode 100644 utils/collectd/patches/001-undefined-AM_PATH_LIBGCRYPT.patch create mode 100644 utils/collectd/patches/003-remove-werror.patch create mode 100644 utils/collectd/patches/100-rrdtool-add-rrasingle-option.patch create mode 100644 utils/collectd/patches/140-fix-fqdnlookup.patch create mode 100644 utils/collectd/patches/200-fix-git-describe-error.patch create mode 100644 utils/collectd/patches/300-delay-first-read-cycle.patch create mode 100644 utils/collectd/patches/400-fix-olsrd-get-all.patch create mode 100644 utils/collectd/patches/600-fix-libmodbus-detection.patch create mode 100644 utils/collectd/patches/900-add-iwinfo-plugin.patch create mode 100644 utils/collectd/patches/920-fix-ping-droprate.patch create mode 100644 utils/coreutils/Makefile create mode 100644 utils/coreutils/patches/001-no_docs_man_tests.patch create mode 100644 utils/coreutils/patches/002-fix_compile_with_uclibc.patch create mode 100644 utils/crelay/Makefile create mode 100644 utils/crelay/files/crelay.init create mode 100644 utils/crelay/patches/010-link_with_ftdi1.patch create mode 100644 utils/cryptodev-linux/Makefile create mode 100644 utils/cryptodev-linux/files/cryptodev.modules create mode 100644 utils/cryptsetup/Makefile create mode 100644 utils/dbus/Makefile create mode 100644 utils/dbus/files/dbus-launch create mode 100644 utils/dbus/files/dbus.init create mode 100644 utils/dbus/patches/100-fix-poll-select.patch create mode 100644 utils/dfu-programmer/Makefile create mode 100644 utils/dmidecode/Makefile create mode 100644 utils/dosfstools/Makefile create mode 100644 utils/dosfstools/patches/0001-mkfs-Default-to-64-32-heads-sectors-for-targets-smal.patch create mode 100644 utils/dosfstools/patches/0002-Switch-to-AC_CHECK_LIB-for-iconv-library-linking.patch create mode 100644 utils/dump1090/Makefile create mode 100644 utils/dump1090/files/dump1090.config create mode 100644 utils/dump1090/files/dump1090.default create mode 100644 utils/dump1090/files/dump1090.init create mode 100644 utils/dvtm/Makefile create mode 100644 utils/eudev/Config.in create mode 100644 utils/eudev/Makefile create mode 100644 utils/eudev/patches/0001-mtd_probe-uses-stdint_h.patch create mode 100644 utils/evtest/Makefile create mode 100644 utils/f2fs-tools/Makefile create mode 100644 utils/f2fs-tools/patches/001-compile.patch create mode 100644 utils/f2fs-tools/patches/010-include-byteswap-h.patch create mode 100644 utils/f2fs-tools/patches/020-sload.f2fs-allow-to-build-without-libselinux.patch create mode 100644 utils/findutils/Makefile create mode 100644 utils/flashrom/Makefile create mode 100644 utils/flashrom/flashrom.mk create mode 100644 utils/flashrom/patches/0001-fix_internal_bitbang.patch create mode 100644 utils/flashrom/patches/0002-fix-io-h-include.patch create mode 100644 utils/flent-tools/Makefile create mode 100644 utils/fontconfig/Makefile create mode 100644 utils/gammu/Makefile create mode 100644 utils/gammu/files/gammu create mode 100755 utils/gammu/files/gammu.init create mode 100644 utils/gammu/patches/001-iconv-disabling-option.patch create mode 100644 utils/gammu/patches/002-no-fstack-protector.patch create mode 100644 utils/gammu/patches/003-cmake-cross-toolchain.patch create mode 100644 utils/gammu/patches/004-cmake_libdbi_optional.patch create mode 100644 utils/gammu/patches/010-utils-shell-fix.patch create mode 100644 utils/gkermit/Makefile create mode 100644 utils/gnupg/Makefile create mode 100644 utils/gpsd/Makefile create mode 100644 utils/gpsd/files/gpsd.config create mode 100644 utils/gpsd/files/gpsd.hotplug create mode 100644 utils/gpsd/files/gpsd.init create mode 100644 utils/gpsd/patches/0001-Remove-a-BSD-ism.patch create mode 100644 utils/gptfdisk/Makefile create mode 100644 utils/grep/Makefile create mode 100644 utils/gzip/Makefile create mode 100644 utils/haserl/Config.in create mode 100644 utils/haserl/Makefile create mode 100644 utils/haserl/patches/100-replace-lua2c-with-sed.patch create mode 100644 utils/haserl/patches/101-adjust-script-size.patch create mode 100644 utils/haveged/Makefile create mode 100644 utils/haveged/files/haveged.init create mode 100644 utils/hd-idle/Makefile create mode 100644 utils/hd-idle/files/hd-idle.config create mode 100644 utils/hd-idle/files/hd-idle.init create mode 100644 utils/hdparm/Makefile create mode 100644 utils/hfsprogs/Makefile create mode 100644 utils/hfsprogs/files/hfsfsck.sh create mode 100644 utils/hfsprogs/patches/0001-Create-short-Makefiles-for-Debian.patch create mode 100644 utils/hfsprogs/patches/0002-Add-exclude-Darwin-specific-code.patch create mode 100644 utils/hfsprogs/patches/0003-Add-helper-include-files-absent-from-the-upstream-pa.patch create mode 100644 utils/hfsprogs/patches/0004-Fix-compilation-on-64-bit-arches.patch create mode 100644 utils/hfsprogs/patches/0005-Remove-Apple-specific-p-from-strings.patch create mode 100644 utils/hfsprogs/patches/0006-Adjust-types-for-printing.patch create mode 100644 utils/hfsprogs/patches/0007-Fix-path-for-HFS-wrapper-block.patch create mode 100644 utils/hfsprogs/patches/0008-Provide-command-line-option-a.patch create mode 100644 utils/hfsprogs/patches/0009-Rename-dprintf-to-dbg_printf.patch create mode 100644 utils/hfsprogs/patches/0010-Rename-custom-macro-nil-with-NULL.patch create mode 100644 utils/hfsprogs/patches/0011-Fix-types.patch create mode 100644 utils/hfsprogs/patches/0012-Fix-mkfs-not-creating-UUIDs-for-new-filesystems.patch create mode 100644 utils/hfsprogs/patches/0013-Fix-manpages.patch create mode 100644 utils/hfsprogs/patches/0014-uClibc_no_loadavg.patch create mode 100644 utils/hfsprogs/patches/0015-sysctl-only-on-glibc.patch create mode 100644 utils/hub-ctrl/Makefile create mode 100644 utils/i2c-tools/Makefile create mode 100644 utils/joe/Makefile create mode 100644 utils/joe/files/joerc create mode 100644 utils/klish/Makefile create mode 100644 utils/klish/patches/010-shell_execute_fix.patch create mode 100644 utils/kmod/Makefile create mode 100644 utils/kmod/patches/001-fix_pkgconfig_file.patch create mode 100644 utils/lcd4linux/Config.in create mode 100644 utils/lcd4linux/Makefile create mode 100644 utils/lcd4linux/files/lcd4linux.init create mode 100644 utils/lcd4linux/patches/100-drv_RouterBoard.patch create mode 100644 utils/lcd4linux/patches/110-uclibc-logarithm-fix.patch create mode 100644 utils/lcd4linux/patches/120-remove-as-needed-linker-option.patch create mode 100644 utils/lcd4linux/patches/140-no_repnop_T6963.patch create mode 100644 utils/lcd4linux/patches/150-addlibmpdclient.patch create mode 100644 utils/lcd4linux/patches/160-uinput_defs.patch create mode 100644 utils/lcd4linux/patches/170-add-generic-spidev-driver.patch create mode 100644 utils/lcd4linux/patches/171-allow-to-specify-drv_generic_graphic_real_clear.patch create mode 100644 utils/lcd4linux/patches/172-add-TEW673GRU-driver.patch create mode 100644 utils/lcd4linux/patches/173-glcd2usb-bigendian-fix.patch create mode 100644 utils/less/Makefile create mode 100644 utils/lm-sensors/Makefile create mode 100644 utils/lm-sensors/files/sensors.conf create mode 100644 utils/lm-sensors/patches/100-musl-compat.patch create mode 100644 utils/logrotate/Makefile create mode 100644 utils/logrotate/files/logrotate.conf create mode 100644 utils/lrzsz/Makefile create mode 100644 utils/lrzsz/patches/100-install_delete_fix.patch create mode 100644 utils/lsof/Makefile create mode 100644 utils/lsof/patches/001-lsof_makefile.patch create mode 100644 utils/lsof/patches/002-lsof_noportmap.patch create mode 100644 utils/lsof/patches/003-lsof_selinux.patch create mode 100644 utils/lsof/patches/004-lsof_ccv.patch create mode 100644 utils/luci-app-lxc/Makefile create mode 100644 utils/luci-app-lxc/files/controller/lxc.lua create mode 100644 utils/luci-app-lxc/files/lxc.config create mode 100644 utils/luci-app-lxc/files/model/cbi/lxc.lua create mode 100644 utils/luci-app-lxc/files/view/lxc.htm create mode 100644 utils/luci-app-lxc/files/www/luci-static/resources/cbi/green.gif create mode 100644 utils/luci-app-lxc/files/www/luci-static/resources/cbi/purple.gif create mode 100644 utils/luci-app-lxc/files/www/luci-static/resources/cbi/red.gif create mode 100644 utils/lvm2/Makefile create mode 100644 utils/lvm2/files/lvm2.init create mode 100644 utils/lvm2/patches/000-compile.patch create mode 100644 utils/lvm2/patches/001-include_fix.patch create mode 100644 utils/lvm2/patches/002-const-stdio.patch create mode 100644 utils/lvm2/patches/003-no-mallinfo.patch create mode 100644 utils/lvm2/patches/004-device-include-goto-lable-as-well.patch create mode 100644 utils/lxc/Config.in create mode 100644 utils/lxc/Makefile create mode 100644 utils/lxc/files/lxc-auto.config create mode 100755 utils/lxc/files/lxc-auto.init create mode 100644 utils/lxc/files/lxc.conf create mode 100644 utils/lxc/patches/010-compile.patch create mode 100644 utils/lxc/patches/015-getline.patch create mode 100644 utils/lxc/patches/020-lxc-checkconfig.patch create mode 100644 utils/lxc/patches/025-remove-unsupported-option.patch create mode 100644 utils/lxc/patches/030-lxc-download.patch create mode 100644 utils/lxc/patches/035-fix-undefined-lfd.patch create mode 100644 utils/macchanger/Makefile create mode 100644 utils/macchanger/patches/0001-fix-build-with-musl.patch create mode 100644 utils/mbtools/Makefile create mode 100644 utils/mbtools/patches/100-fix-unit-test-server-return-value.patch create mode 100644 utils/mc/Config.in create mode 100644 utils/mc/Makefile create mode 100644 utils/mc/patches/010-subshell.patch create mode 100644 utils/minicom/Makefile create mode 100644 utils/minicom/patches/100-fix_iconv_include.patch create mode 100644 utils/minicom/patches/101-fix_music_includes.patch create mode 100644 utils/minicom/patches/102-fix_musl_compatibility.patch create mode 100644 utils/mksh/Makefile create mode 100644 utils/mksh/patches/100-dot_mkshrc create mode 100644 utils/mktorrent/Makefile create mode 100644 utils/mmc-utils/Makefile create mode 100644 utils/mmc-utils/patches/001-properly-set-fortify-source-in-makefile.patch create mode 100644 utils/mmc-utils/patches/002-mmc-ll64.patch create mode 100644 utils/mpack/Makefile create mode 100644 utils/mt-st/Makefile create mode 100644 utils/mysql/Makefile create mode 100644 utils/mysql/conf/my.cnf create mode 100644 utils/mysql/files/mysqld.init create mode 100644 utils/mysql/patches/100-fix_hostname.patch create mode 100644 utils/mysql/patches/110-cross_compile.patch create mode 100644 utils/mysql/patches/120-bison-compat.patch create mode 100644 utils/nano/Makefile create mode 100644 utils/ncdu/Makefile create mode 100644 utils/ntfs-3g/Makefile create mode 100644 utils/ntfs-3g/patches/001-fuseint-fix-path-mounted-on-musl.patch create mode 100644 utils/oath-toolkit/Makefile create mode 100644 utils/open-plc-utils/Makefile create mode 100644 utils/open-plc-utils/patches/100-musl-compat.patch create mode 100644 utils/open2300/Makefile create mode 100644 utils/open2300/files/open2300.conf create mode 100644 utils/open2300/patches/001-crosscompile.patch create mode 100644 utils/openobex/Makefile create mode 100644 utils/openobex/patches/001-cxx.patch create mode 100644 utils/openocd/Makefile create mode 100644 utils/opensc/Makefile create mode 100644 utils/opus-tools/Makefile create mode 100644 utils/owfs/Config.in create mode 100644 utils/owfs/Makefile create mode 100644 utils/owfs/files/owfs.conf create mode 100644 utils/owfs/files/owfs.init create mode 100644 utils/owfs/files/owftpd.conf create mode 100644 utils/owfs/files/owftpd.init create mode 100644 utils/owfs/files/owhttpd.conf create mode 100644 utils/owfs/files/owhttpd.init create mode 100644 utils/owfs/files/owserver.conf create mode 100644 utils/owfs/files/owserver.init create mode 100644 utils/owfs/patches/100-fix-netlink-w1-status-message-detection.patch create mode 100644 utils/owfs/patches/101-fix-no-reset-routine-segfault.patch create mode 100644 utils/pciutils/Makefile create mode 100644 utils/pciutils/patches/100-remove-no-timestamping.patch create mode 100644 utils/pciutils/patches/101-no-strip.patch create mode 100644 utils/pciutils/patches/102-compressed-ids.patch create mode 100644 utils/pciutils/patches/103-relative-path-ids.patch create mode 100644 utils/pciutils/patches/104-resolv.patch create mode 100644 utils/pciutils/patches/105-fix-host.patch create mode 100644 utils/pcsc-lite/Makefile create mode 100644 utils/pcsc-lite/files/pcscd.init create mode 100644 utils/picocom/Makefile create mode 100644 utils/picocom/patches/100-musl-compat.patch create mode 100644 utils/pps-tools/Makefile create mode 100644 utils/procps-ng/Makefile create mode 100644 utils/procps-ng/patches/100-no-tests-docs.patch create mode 100644 utils/pv/Makefile create mode 100644 utils/qemu/Makefile create mode 100755 utils/qemu/files/00-virtio-ports.hotplug create mode 100755 utils/qemu/files/10-qemu-ga.hotplug create mode 100644 utils/qemu/files/bridge.conf create mode 100755 utils/qemu/files/qemu-ga.init create mode 100644 utils/qemu/patches/0001-allow-disable-fortify-source.patch create mode 100644 utils/qemu/patches/0002-setting-language-type-for-_asm-files.patch create mode 100644 utils/qemu/patches/0003-disable-avx2_opt-with-musl.patch create mode 100644 utils/qemu/patches/0004-pixman-fix-detection-of-mips-dspr2.patch create mode 100644 utils/qemu/patches/0005-pixman-arm-neon-assembler-fix.patch create mode 100644 utils/qemu/patches/0006-libvixl-cxx-macro-isnan.patch create mode 100644 utils/relayctl/Makefile create mode 100644 utils/relayctl/patches/0001-ftdi1.patch create mode 100644 utils/rng-tools/Makefile create mode 100644 utils/rng-tools/files/rngd.init create mode 100644 utils/rng-tools/files/rngd.uci_defaults create mode 100644 utils/rpcd-mod-lxc/Makefile create mode 100644 utils/rpcd-mod-lxc/files/CMakeLists.txt create mode 100644 utils/rpcd-mod-lxc/files/lxc.c create mode 100644 utils/rrdtool1/Makefile create mode 100644 utils/rrdtool1/patches/001-no_ordering_cd_joke.patch create mode 100644 utils/rrdtool1/patches/002-no_timezone.patch create mode 100644 utils/rrdtool1/patches/020-x86-float-cast.patch create mode 100644 utils/rrdtool1/patches/030-pod2man-stderr.patch create mode 100644 utils/rtklib/Makefile create mode 100644 utils/rtl-ais/Makefile create mode 100644 utils/rtl-ais/files/rtl_ais.init create mode 100644 utils/rtl-ais/files/uci_rtl_ais create mode 100644 utils/rtl-sdr/Makefile create mode 100644 utils/rtl-sdr/files/rtl_tcp.config create mode 100755 utils/rtl-sdr/files/rtl_tcp.init create mode 100644 utils/sane-backends/Makefile create mode 100644 utils/sane-backends/files/xinet.d_sane-port create mode 100644 utils/sane-backends/patches/002-remove-uneeded.patch create mode 100644 utils/sane-backends/patches/020-fix_pieusb.patch create mode 100644 utils/sane-backends/patches/030-musl.patch create mode 100644 utils/sane-backends/patches/031-fix_uclibc.patch create mode 100644 utils/sane-backends/patches/050-remove_linked_libs_for_unused_preload.patch create mode 100644 utils/screen/Makefile create mode 100644 utils/screen/files/etc/screenrc create mode 100644 utils/screen/patches/100-cross_compile_fix.patch create mode 100644 utils/screen/patches/110-do_not_add_srcdir_to_include_path.patch create mode 100644 utils/screen/patches/200-musl-compat.patch create mode 100644 utils/serialconsole/Makefile create mode 100644 utils/shadow/Makefile create mode 100644 utils/shadow/patches/001-busybox_ash.patch create mode 100644 utils/shadow/patches/002-disable-ruser-lookup.patch create mode 100644 utils/shadow/patches/003-fix-disabling-subids.patch create mode 100644 utils/shadow/patches/004-fix-su-controoling-term.patch create mode 100644 utils/sispmctl/Makefile create mode 100644 utils/sispmctl/patches/001-fix-includes.patch create mode 100644 utils/slide-switch/Makefile create mode 100644 utils/smartmontools/Makefile create mode 100644 utils/smartmontools/files/smartd.conf create mode 100644 utils/smartmontools/files/smartd.init create mode 100644 utils/smstools3/Makefile create mode 100644 utils/smstools3/files/smstools3.conf create mode 100644 utils/smstools3/files/smstools3.init create mode 100644 utils/smstools3/patches/001-smsd.patch create mode 100644 utils/smstools3/patches/002-Makefile.patch create mode 100644 utils/sockread/Makefile create mode 100644 utils/sockread/src/Makefile create mode 100644 utils/sockread/src/main.c create mode 100644 utils/spi-tools/Makefile create mode 100644 utils/squashfs-tools/Config.in create mode 100644 utils/squashfs-tools/Makefile create mode 100644 utils/squashfs-tools/patches/0001-squashfs-tools-fix-fnmatch.h-compatibility-with-musl.patch create mode 100644 utils/squashfs-tools/patches/0002-pseudo.c-add-explicit-stat.h-include.patch create mode 100644 utils/squashfs-tools/patches/0003-mksquashfs.c-get-inline-functions-work-with-C99.patch create mode 100644 utils/stm32flash/Makefile create mode 100644 utils/stoken/Makefile create mode 100644 utils/stress/Makefile create mode 100644 utils/sumo/Makefile create mode 100644 utils/sumo/files/sumo.sh create mode 100644 utils/sumo/patches/100-configure_fix.patch create mode 100644 utils/swig/Makefile create mode 100644 utils/sysstat/Makefile create mode 100644 utils/sysstat/files/sysstat.config create mode 100755 utils/sysstat/files/sysstat.init create mode 100644 utils/sysstat/patches/100-musl-compat.patch create mode 100644 utils/tar/Makefile create mode 100644 utils/taskwarrior/Makefile create mode 100644 utils/tcsh/Makefile create mode 100644 utils/tmux/Makefile create mode 100644 utils/tmux/patches/100-b64_ntop-conflict.patch create mode 100644 utils/tracertools/Makefile create mode 100644 utils/triggerhappy/Makefile create mode 100644 utils/triggerhappy/files/triggerhappy-example.conf create mode 100644 utils/triggerhappy/files/triggerhappy.hotplug create mode 100644 utils/triggerhappy/files/triggerhappy.init create mode 100644 utils/unzip/Makefile create mode 100644 utils/unzip/patches/001-CVE-2014-8139-crc-overflow.patch create mode 100644 utils/unzip/patches/002-CVE-2014-8140-test-compr-eb.patch create mode 100644 utils/unzip/patches/003-CVE-2014-8141-getzip64data.patch create mode 100644 utils/unzip/patches/004-CVE-2014-9636-test-compr-eb.patch create mode 100644 utils/unzip/patches/005-CVE-2015-7696-heap-overflow.patch create mode 100644 utils/unzip/patches/006-CVE-2015-7697-infinite-loop.patch create mode 100644 utils/unzip/patches/007-integer-underflow-csiz_decrypted.patch create mode 100644 utils/usbmuxd/Makefile create mode 100644 utils/uvcdynctrl/Makefile create mode 100644 utils/vim/Makefile create mode 100644 utils/vim/files/vimrc create mode 100644 utils/vim/files/vimrc.full create mode 100644 utils/vim/patches/001-compile.patch create mode 100644 utils/vim/patches/002-remove_helptags_generation.patch create mode 100644 utils/watchcat/Makefile create mode 100644 utils/watchcat/files/initd_watchcat create mode 100644 utils/watchcat/files/uci_defaults_watchcat create mode 100644 utils/watchcat/files/watchcat.sh create mode 100644 utils/wifitoggle/Makefile create mode 100755 utils/wifitoggle/files/wifitoggle.config create mode 100755 utils/wifitoggle/files/wifitoggle.hotplug create mode 100644 utils/xz/Makefile create mode 100644 utils/yunbridge/Makefile create mode 100644 utils/yunbridge/files/etc/config/yunbridge create mode 100755 utils/yunbridge/files/etc/init.d/yunbridge create mode 100755 utils/yunbridge/files/sbin/yunbridge create mode 100755 utils/yunbridge/files/usr/bin/pretty-wifi-info.lua create mode 100644 utils/yunbridge/files/usr/lib/lua/luci/controller/arduino/index.lua create mode 100644 utils/yunbridge/files/usr/lib/lua/luci/sha256.lua create mode 100644 utils/yunbridge/patches/000-scripts.patch create mode 100644 utils/zile/Makefile create mode 100644 utils/zile/patches/010-remove_gets_definition_warning.patch create mode 100644 utils/zip/Makefile create mode 100644 utils/zoneinfo/Makefile create mode 100644 utils/zsh/Makefile diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..29ba5db --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,114 @@ +# Contributing Guidelines +(See for overall format and construction) + + +### Basic guidelines + +All packages you commit or submit by pull-request should follow these simple guidelines: +* Package a version which is still maintained by the upstream author. +* Will be updated regularly to maintained and supported versions. +* Have no dependencies outside the OpenWrt core packages or this repository feed. +* Have been tested to compile with the correct includes and dependencies. Please also test with "Compile with full language support" found under "General Build Settings" set if language support is relevant to your package. +* Do NOT use a rolling source file (e.g. foo-latest.tar.gz) or the head of a branch as source for the package since that would create unpredictable builds which change over time. +* Best of all -- it works as expected! + +#### Makefile contents should contain: + +* An up-to-date copyright notice. Use OpenWrt if no other present or supply your own. +* A (PKG_)MAINTAINER definition listing either yourself or another person in the field. + (E.g.: PKG_MAINTAINER:= Joe D. Hacker `) +* A PKG_LICENSE tag declaring the main license of the package. + (E.g.: PKG_LICENSE:=GPL-2.0+) Please use SPDX identifiers if possible (see list at the bottom). +* An optional PKG_LICENSE_FILES tag including the filenames of the license-files in the source-package. + (E.g.: PKG_LICENSE_FILES:=COPYING) +* PKG_RELEASE should be initially set to 1 or reset to 1 if the software version is changed. You should increment it if the package itself has changed. For example, modifying a support script, changing configure options like --disable* or --enable* switches, or if you changed something in the package which causes the resulting binaries to be different. Changes like correcting md5sums, changing mirror URLs, adding a maintainer field or updating a comment or copyright year in a Makefile do not require a change to PKG_RELEASE. + +#### Commits in your pull-requests should: + +* Have a useful description prefixed with the package name + (E.g.: "foopkg: Add libzot dependency") +* Include Signed-off-by in the comment + (See ) + +### Advice on pull requests: + +Pull requests are the easiest way to contribute changes to git repos at Github. They are the preferred contribution method, as they offer a nice way for commenting and amending the proposed changes. + +* You need a local "fork" of the Github repo. +* Use a "feature branch" for your changes. That separates the changes in the pull request from your other changes and makes it easy to edit/amend commits in the pull request. Workflow using "feature_x" as the example: + - Update your local git fork to the tip (of the master, usually) + - Create the feature branch with `git checkout -b feature_x` + - Edit changes and commit them locally + - Push them to your Github fork by `git push -u origin feature_x`. That creates the "feature_x" branch at your Github fork and sets it as the remote of this branch + - When you now visit Github, you should see a proposal to create a pull request + +* If you later need to add new commits to the pull request, you can simply commit the changes to the local branch and then use `git push` to automatically update the pull request. + +* If you need to change something in the existing pull request (e.g. to add a missing signed-off-by line to the commit message), you can use `git push -f` to overwrite the original commits. That is easy and safe when using a feature branch. Example workflow: + - Checkout the feature branch by `git checkout feature_x` + - Edit changes and commit them locally. If you are just updating the commit message in the last commit, you can use `git commit --amend` to do that + - If you added several new commits or made other changes that require cleaning up, you can use `git rebase -i HEAD~X` (X = number of commits to edit) to possibly squash some commits + - Push the changed commits to Github with `git push -f` to overwrite the original commits in the "feature_x" branch with the new ones. The pull request gets automatically updated + +### If you have commit access: + +* Do NOT use git push --force. +* Do NOT commit to other maintainer's packages without their consent. +* Use Pull Requests if you are unsure and to suggest changes to other maintainers. + +#### Gaining commit access: + +* We will gladly grant commit access to responsible contributors who have made + useful pull requests and / or feedback or patches to this repository or + OpenWrt in general. Please include your request for commit access in your + next pull request or ticket. + +### Release Branches: + +* Branches named "for-XX.YY" (e.g. for-14.07) are release branches. +* These branches are built with the respective OpenWrt release and are created + during the release stabilisation phase. +* Please ONLY cherry-pick or commit security and bug-fixes to these branches. +* Do NOT add new packages and do NOT do major upgrades of packages here. +* If you are unsure if your change is suitable, please use a pull request. + +### Common LICENSE tags (short list) +(Complete list can be found at: ) + +| Full Name | Identifier | +|---|:---| +|Apache License 1.0|Apache-1.0| +|Apache License 1.1|Apache-1.1| +|Apache License 2.0|Apache-2.0| +|Artistic License 1.0|Artistic-1.0| +|Artistic License 1.0 (Perl)|Artistic-1.0-Perl| +|Artistic License 1.0 w/clause 8|Artistic-1.0-cl8| +|Artistic License 2.0|Artistic-2.0| +|BSD 2-clause "Simplified" License|BSD-2-Clause| +|BSD 2-clause FreeBSD License|BSD-2-Clause-FreeBSD| +|BSD 2-clause NetBSD License|BSD-2-Clause-NetBSD| +|BSD 3-clause "New" or "Revised" License|BSD-3-Clause| +|BSD 3-clause Clear License|BSD-3-Clause-Clear| +|BSD 4-clause "Original" or "Old" License|BSD-4-Clause| +|BSD Protection License|BSD-Protection| +|BSD with attribution|BSD-3-Clause-Attribution| +|BSD-4-Clause (University of California-Specific)|BSD-4-Clause-UC| +|GNU General Public License v1.0 only|GPL-1.0| +|GNU General Public License v1.0 or later|GPL-1.0+| +|GNU General Public License v2.0 only|GPL-2.0| +|GNU General Public License v2.0 or later|GPL-2.0+| +|GNU General Public License v3.0 only|GPL-3.0| +|GNU General Public License v3.0 or later|GPL-3.0+| +|GNU Lesser General Public License v2.1 only|LGPL-2.1| +|GNU Lesser General Public License v2.1 or later|LGPL-2.1+| +|GNU Lesser General Public License v3.0 only|LGPL-3.0| +|GNU Lesser General Public License v3.0 or later|LGPL-3.0+| +|GNU Library General Public License v2 only|LGPL-2.0| +|GNU Library General Public License v2 or later|LGPL-2.0+| +|Fair License|Fair| +|ISC License|ISC| +|MIT License|MIT| +|No Limit Public License|NLPL| +|OpenSSL License|OpenSSL| +|X11 License|X11| +|zlib License|Zlib| diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..d908a86 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# OpenWrt packages feed + +## Description + +This is the OpenWrt "packages"-feed containing community-maintained build scripts, options and patches for applications, modules and libraries used within OpenWrt. + +Installation of pre-built packages is handled directly by the **opkg** utility within your running OpenWrt system or by using the [OpenWrt SDK](http://wiki.openwrt.org/doc/howto/obtain.firmware.sdk) on a build system. + +## Usage + +This repository is intended to be layered on-top of an OpenWrt buildroot. If you do not have an OpenWrt buildroot installed, see the documentation at: [OpenWrt Buildroot – Installation](http://wiki.openwrt.org/doc/howto/buildroot.exigence) on the OpenWrt support site. + +This feed is enabled by default. To install all its package definitions, run: +``` +./scripts/feeds update packages +./scripts/feeds install -a -p packages +``` + +## License + +See [LICENSE](LICENSE) file. + +## Package Guidelines + +See [CONTRIBUTING.md](CONTRIBUTING.md) file. + diff --git a/admin/debootstrap/Makefile b/admin/debootstrap/Makefile new file mode 100644 index 0000000..a7d45c2 --- /dev/null +++ b/admin/debootstrap/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2010 Gianluigi Tiesi +# 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:=debootstrap +PKG_VERSION:=1.0.83 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Daniel Golle + +PKG_SOURCE:=$(PKG_NAME)-udeb_$(PKG_VERSION)_all.udeb +PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/d/debootstrap +PKG_MD5SUM:=877fe5281a0e424bd6c71d121cbb725b8f56694e66558cd47c20c3aa87ceff72 +PKG_LICENSE:=Unique +PKG_LICENSE_FILES:=debian/copyright + +UNPACK_CMD=ar -p "$(DL_DIR)/$(PKG_SOURCE)" data.tar.xz | xzcat | tar -C $(1) -xf - + +include $(INCLUDE_DIR)/package.mk + +define Package/debootstrap + SECTION:=admin + CATEGORY:=Administration + TITLE:=Bootstrap a basic Debian system + URL:=http://wiki.debian.org/Debootstrap + DEPENDS:= +coreutils +coreutils-chroot +coreutils-sha1sum +ar +xz +endef + +define Package/debootstrap/description + debootstrap is used to create a Debian base system from scratch, without + requiring the availability of dpkg or apt. It does this by downloading .deb + files from a mirror site, and carefully unpacking them into a directory which + can eventually be chrooted into. +endef + +define Build/Compile +# file pkgdetails.c was imported from debian package base-installer version 1.130 + $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) ./files/pkgdetails.c -o $(PKG_BUILD_DIR)/usr/share/debootstrap/pkgdetails +endef + +define Package/debootstrap/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/sbin/$(PKG_NAME) $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/share/debootstrap + $(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/share/debootstrap/pkgdetails $(1)/usr/share/debootstrap + $(INSTALL_DATA) $(PKG_BUILD_DIR)/usr/share/debootstrap/functions $(1)/usr/share/debootstrap + $(INSTALL_DIR) $(1)/usr/share/debootstrap/scripts + $(CP) $(PKG_BUILD_DIR)/usr/share/debootstrap/scripts/* $(1)/usr/share/debootstrap/scripts +endef + +$(eval $(call BuildPackage,debootstrap)) diff --git a/admin/debootstrap/files/pkgdetails.c b/admin/debootstrap/files/pkgdetails.c new file mode 100644 index 0000000..99ee190 --- /dev/null +++ b/admin/debootstrap/files/pkgdetails.c @@ -0,0 +1,347 @@ +#include +#include +#include +#include +#include +#include + +#define MAX_LINE 1000 +#define MAX_PKGS 100 + +char *checksum_field=NULL; + +static void oom_die(void) +{ + fputs("Out of memory!\n", stderr); + exit(1); +} + +static char *xvasprintf(const char *fmt, va_list ap) { + char *ret; + + if (vasprintf (&ret, fmt, ap) < 0) { + if (errno == ENOMEM) + oom_die(); + return NULL; + } + return ret; +} + +static char *xasprintf(const char *fmt, ...) { + va_list ap; + char *ret; + + va_start(ap, fmt); + ret = xvasprintf(fmt, ap); + va_end(ap); + return ret; +} + +static char *fieldcpy(char *dst, char *fld) { + while (*fld && *fld != ':') + fld++; + if (!*(fld++)) + return NULL; + while (isspace(*fld)) fld++; + return strcpy(dst, fld); +} + +static void outputdeps(char *deps) { + char *pch = deps; + + while (1) { + while (isspace(*pch)) pch++; + if (!*pch) break; + + while (*pch && *pch != '(' && *pch != '|' && *pch != ',' + && !isspace(*pch)) + { + fputc(*pch++, stdout); + } + fputc('\n', stdout); + while (*pch && *pch++ != ',') (void)NULL; + } +} + +static void dogetdeps(char *pkgsfile, char **in_pkgs, int pkgc) { + char buf[MAX_LINE]; + char cur_pkg[MAX_LINE]; + char cur_deps[MAX_LINE]; + char cur_predeps[MAX_LINE]; + char prev_pkg[MAX_LINE]; + char *pkgs[MAX_PKGS]; + int i; + int skip; + FILE *f; + int output_pkg = -1; + + cur_pkg[0] = cur_deps[0] = cur_predeps[0] = prev_pkg[0] = '\0'; + + for (i = 0; i < pkgc; i++) pkgs[i] = in_pkgs[i]; + + f = fopen(pkgsfile, "r"); + if (f == NULL) { + perror(pkgsfile); + exit(1); + } + + skip = 1; + while (fgets(buf, sizeof(buf), f)) { + if (*buf && buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0'; + if (strncasecmp(buf, "Package:", 8) == 0) { + int any = 0; + skip = 1; + fieldcpy(cur_pkg, buf); + if (strcmp(cur_pkg, prev_pkg) != 0) { + if (output_pkg != -1) + pkgs[output_pkg] = NULL; + if (cur_deps[0]) + outputdeps(cur_deps); + if (cur_predeps[0]) + outputdeps(cur_predeps); + strcpy(prev_pkg, cur_pkg); + } + cur_deps[0] = cur_predeps[0] = '\0'; + output_pkg = -1; + for (i = 0; i < pkgc; i++) { + if (!pkgs[i]) continue; + any = 1; + if (strcmp(cur_pkg, pkgs[i]) == 0) { + skip = 0; + output_pkg = i; + break; + } + } + if (!any) break; + } else if (!skip && strncasecmp(buf, "Depends:", 8) == 0) + fieldcpy(cur_deps, buf); + else if (!skip && strncasecmp(buf, "Pre-Depends:", 12) == 0) + fieldcpy(cur_predeps, buf); + } + if (cur_deps[0]) + outputdeps(cur_deps); + if (cur_predeps[0]) + outputdeps(cur_predeps); + fclose(f); +} + +static void dopkgmirrorpkgs(int uniq, char *mirror, char *pkgsfile, + char *fieldname, char **in_pkgs, int pkgc) +{ + char buf[MAX_LINE]; + char cur_field[MAX_LINE]; + char cur_pkg[MAX_LINE]; + char cur_ver[MAX_LINE]; + char cur_arch[MAX_LINE]; + char cur_size[MAX_LINE]; + char cur_checksum[MAX_LINE]; + char cur_filename[MAX_LINE]; + char prev_pkg[MAX_LINE]; + char *pkgs[MAX_PKGS]; + int i; + FILE *f; + char *output = NULL; + int output_pkg = -1; + + cur_field[0] = cur_pkg[0] = cur_ver[0] = cur_arch[0] = cur_filename[0] = prev_pkg[0] = '\0'; + + for (i = 0; i < pkgc; i++) pkgs[i] = in_pkgs[i]; + + f = fopen(pkgsfile, "r"); + if (f == NULL) { + perror(pkgsfile); + exit(1); + } + while (fgets(buf, sizeof(buf), f)) { + if (*buf && buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0'; + if (strncasecmp(buf, fieldname, strlen(fieldname)) == 0) { + fieldcpy(cur_field, buf); + } + if (strncasecmp(buf, "Package:", 8) == 0) { + fieldcpy(cur_pkg, buf); + if (strcmp(cur_pkg, prev_pkg) != 0) { + if (output) + fputs(output, stdout); + if (uniq && output_pkg != -1) + pkgs[output_pkg] = NULL; + strcpy(prev_pkg, cur_pkg); + } + free(output); + output = NULL; + output_pkg = -1; + } else if (strncasecmp(buf, "Version:", 8) == 0) { + fieldcpy(cur_ver, buf); + } else if (strncasecmp(buf, "Architecture:", 13) == 0) { + fieldcpy(cur_arch, buf); + } else if (strncasecmp(buf, "Size:", 5) == 0) { + fieldcpy(cur_size, buf); + } else if (strncasecmp(buf, checksum_field, strlen(checksum_field)) == 0 + && buf[strlen(checksum_field)] == ':') { + fieldcpy(cur_checksum, buf); + } else if (strncasecmp(buf, "Filename:", 9) == 0) { + fieldcpy(cur_filename, buf); + } else if (!*buf) { + int any = 0; + for (i = 0; i < pkgc; i++) { + if (!pkgs[i]) continue; + any = 1; + if (strcmp(cur_field, pkgs[i]) == 0) { + free(output); + output = xasprintf("%s %s %s %s %s %s %s\n", cur_pkg, cur_ver, cur_arch, mirror, cur_filename, cur_checksum, cur_size); + output_pkg = i; + break; + } + } + if (!any) break; + cur_field[0] = '\0'; + } + } + if (output) + fputs(output, stdout); + if (uniq && output_pkg != -1) + pkgs[output_pkg] = NULL; + fclose(f); + + /* any that weren't found are returned as "pkg -" */ + if (uniq) { + for (i = 0; i < pkgc; i++) { + if (pkgs[i]) { + printf("%s -\n", pkgs[i]); + } + } + } +} + +static void dopkgstanzas(char *pkgsfile, char **pkgs, int pkgc) +{ + char buf[MAX_LINE]; + char *accum; + size_t accum_size = 0, accum_alloc = MAX_LINE * 2; + char cur_pkg[MAX_LINE]; + FILE *f; + + accum = malloc(accum_alloc); + if (!accum) + oom_die(); + + f = fopen(pkgsfile, "r"); + if (f == NULL) { + perror(pkgsfile); + free(accum); + exit(1); + } + while (fgets(buf, sizeof(buf), f)) { + if (*buf) { + size_t len = strlen(buf); + if (accum_size + len + 1 > accum_alloc) { + accum_alloc = (accum_size + len + 1) * 2; + accum = realloc(accum, accum_alloc); + if (!accum) + oom_die(); + } + strcpy(accum + accum_size, buf); + accum_size += len; + } + if (*buf && buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0'; + if (strncasecmp(buf, "Package:", 8) == 0) { + fieldcpy(cur_pkg, buf); + } else if (!*buf) { + int i; + for (i = 0; i < pkgc; i++) { + if (!pkgs[i]) continue; + if (strcmp(cur_pkg, pkgs[i]) == 0) { + fputs(accum, stdout); + if (accum[accum_size - 1] != '\n') + fputs("\n\n", stdout); + else if (accum[accum_size - 2] != '\n') + fputc('\n', stdout); + break; + } + } + *accum = '\0'; + accum_size = 0; + } + } + fclose(f); + + free(accum); +} + +static int dotranslatewgetpercent(int low, int high, int end, char *str) { + int ch; + int val, lastval; + + /* print out anything that looks like a % on its own line, appropriately + * scaled */ + + lastval = val = 0; + while ( (ch = getchar()) != EOF ) { + if (isdigit(ch)) { + val *= 10; val += ch - '0'; + } else if (ch == '%') { + float f = (float) val / 100.0 * (high - low) + low; + if (str) { + printf("P: %d %d %s\n", (int) f, end, str); + } else { + printf("P: %d %d\n", (int) f, end); + } + lastval = val; + } else { + val = 0; + } + } + return lastval == 100; +} + +int main(int argc, char *argv[]) { + checksum_field=getenv("DEBOOTSTRAP_CHECKSUM_FIELD"); + if (checksum_field == NULL) { + checksum_field="MD5sum"; + } + + if ((argc == 6 || argc == 5) && strcmp(argv[1], "WGET%") == 0) { + if (dotranslatewgetpercent(atoi(argv[2]), atoi(argv[3]), + atoi(argv[4]), argc == 6 ? argv[5] : NULL)) + { + exit(0); + } else { + exit(1); + } + } else if (argc >= 4 && strcmp(argv[1], "GETDEPS") == 0) { + int i; + for (i = 3; argc - i > MAX_PKGS; i += MAX_PKGS) { + dogetdeps(argv[2], argv+i, MAX_PKGS); + } + dogetdeps(argv[2], argv+i, argc-i); + exit(0); + } else if (argc >= 5 && strcmp(argv[1], "PKGS") == 0) { + int i; + for (i = 4; argc - i > MAX_PKGS; i += MAX_PKGS) { + dopkgmirrorpkgs(1, argv[2], argv[3], "Package:", argv+i, MAX_PKGS); + } + dopkgmirrorpkgs(1, argv[2], argv[3], "Package:", argv+i, argc-i); + exit(0); + } else if (argc >= 6 && strcmp(argv[1], "FIELD") == 0) { + int i; + for (i = 5; argc - i > MAX_PKGS; i += MAX_PKGS) { + dopkgmirrorpkgs(0, argv[3], argv[4], argv[2], argv+i, MAX_PKGS); + } + dopkgmirrorpkgs(0, argv[3], argv[4], argv[2], argv+i, argc-i); + exit(0); + } else if (argc >= 4 && strcmp(argv[1], "STANZAS") == 0) { + int i; + for (i = 3; argc - i > MAX_PKGS; i += MAX_PKGS) { + dopkgstanzas(argv[2], argv+i, MAX_PKGS); + } + dopkgstanzas(argv[2], argv+i, argc-i); + exit(0); + } else { + fprintf(stderr, "usage: %s PKGS mirror packagesfile pkgs..\n", argv[0]); + fprintf(stderr, " or: %s FIELD field mirror packagesfile pkgs..\n", + argv[0]); + fprintf(stderr, " or: %s GETDEPS packagesfile pkgs..\n", argv[0]); + fprintf(stderr, " or: %s STANZAS packagesfile pkgs..\n", argv[0]); + fprintf(stderr, " or: %s WGET%% low high end reason\n", argv[0]); + exit(1); + } +} diff --git a/admin/debootstrap/patches/100-busybox_fix.patch b/admin/debootstrap/patches/100-busybox_fix.patch new file mode 100644 index 0000000..5e8db05 --- /dev/null +++ b/admin/debootstrap/patches/100-busybox_fix.patch @@ -0,0 +1,11 @@ +--- a/usr/share/debootstrap/functions ++++ b/usr/share/debootstrap/functions +@@ -859,8 +859,6 @@ choose_extractor () { + + if [ -n "$EXTRACTOR_OVERRIDE" ]; then + extractor="$EXTRACTOR_OVERRIDE" +- elif type dpkg-deb >/dev/null 2>&1; then +- extractor="dpkg-deb" + else + extractor="ar" + fi diff --git a/admin/htop/Makefile b/admin/htop/Makefile new file mode 100644 index 0000000..010f36d --- /dev/null +++ b/admin/htop/Makefile @@ -0,0 +1,54 @@ +# +# Copyright (C) 2007-2016 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:=htop +PKG_VERSION:=2.0.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://hisham.hm/htop/releases/$(PKG_VERSION)/ +PKG_MD5SUM:=7d354d904bad591a931ad57e99fea84a + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/htop + SECTION:=admin + CATEGORY:=Administration + TITLE:=Interactive processes viewer + DEPENDS:=+libncurses + URL:=http://htop.sourceforge.net/ + MAINTAINER:=Etienne CHAMPETIER +endef + +define Package/htop/description + Htop is an ncursed-based process viewer similar to top, but + it allows to scroll the list vertically and horizontally to + see all processes and their full command lines. +endef + +CONFIGURE_ARGS += \ + --disable-unicode \ + --disable-hwloc + +CONFIGURE_VARS += \ + ac_cv_file__proc_stat=yes \ + ac_cv_file__proc_meminfo=yes + +define Package/htop/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,htop)) diff --git a/admin/htop/patches/100-fix-libtool-version-check.patch b/admin/htop/patches/100-fix-libtool-version-check.patch new file mode 100644 index 0000000..c786213 --- /dev/null +++ b/admin/htop/patches/100-fix-libtool-version-check.patch @@ -0,0 +1,11 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -2,7 +2,7 @@ + # Process this file with autoconf to produce a configure script. + + AC_PREREQ(2.65) +-LT_PREREQ([2.4.2]) ++LT_PREREQ([2.4.0]) + AC_INIT([htop],[2.0.2],[hisham@gobolinux.org]) + + SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}" diff --git a/admin/monit/Makefile b/admin/monit/Makefile new file mode 100644 index 0000000..4f8c14a --- /dev/null +++ b/admin/monit/Makefile @@ -0,0 +1,95 @@ +# +# 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:=monit +PKG_VERSION:=5.18 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://mmonit.com/monit/dist +PKG_MD5SUM:=a1bfac0fbb83439435f8616200d2364d + +PKG_LICENSE:=AGPL-3.0 +PKG_LICENSE_FILES:=COPYING + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/monit/Default + SECTION:=admin + CATEGORY:=Administration + DEPENDS:= +libpthread + TITLE:=System services monitoring utility + URL:=http://mmonit.com/monit/ + MAINTAINER:=Etienne CHAMPETIER +endef + +define Package/monit/Default/description + An utility for monitoring services on a Unix system +endef + +define Package/monit +$(call Package/monit/Default) + DEPENDS+= +libopenssl + TITLE+= (with SSL support) + VARIANT:=ssl +endef + +define Package/monit/description +$(call Package/monit/Default/description) + This package is built with SSL support. +endef + +define Package/monit-nossl +$(call Package/monit/Default) + TITLE+= (without SSL support) + VARIANT:=nossl +endef + +define Package/monit-nossl/description +$(call Package/monit/Default/description) + This package is built without SSL support. +endef + +CONFIGURE_ARGS += \ + --without-pam \ + libmonit_cv_setjmp_available=yes \ + libmonit_cv_vsnprintf_c99_conformant=yes + +ifeq ($(BUILD_VARIANT),ssl) + CONFIGURE_ARGS += \ + --with-ssl \ + --with-ssl-dir="$(STAGING_DIR)/usr" +endif + +ifeq ($(BUILD_VARIANT),nossl) + CONFIGURE_ARGS += \ + --without-ssl +endif + +define Package/monit/conffiles +/etc/monitrc +endef + +define Package/monit/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_BUILD_DIR)/monitrc $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/monit.init $(1)/etc/init.d/monit + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/monit $(1)/usr/bin/ +endef + +Package/monit-nossl/conffiles = $(Package/monit/conffiles) +Package/monit-nossl/install = $(Package/monit/install) + +$(eval $(call BuildPackage,monit)) +$(eval $(call BuildPackage,monit-nossl)) diff --git a/admin/monit/files/monit.init b/admin/monit/files/monit.init new file mode 100644 index 0000000..2bb3609 --- /dev/null +++ b/admin/monit/files/monit.init @@ -0,0 +1,15 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014 OpenWrt.org + +START=60 +USE_PROCD=1 +PROG=/usr/bin/monit + +start_service() { + [ -f /etc/monitrc ] || { echo "monit: /etc/monitrc is missing"; return 1; } + chmod 0600 /etc/monitrc + procd_open_instance + # -I runs in foreground, as procd requires + procd_set_param command "$PROG" -I + procd_close_instance +} diff --git a/admin/monit/patches/001-fix-default-piddir.patch b/admin/monit/patches/001-fix-default-piddir.patch new file mode 100644 index 0000000..7af871f --- /dev/null +++ b/admin/monit/patches/001-fix-default-piddir.patch @@ -0,0 +1,18 @@ +--- a/configure ++++ b/configure +@@ -13849,14 +13849,7 @@ fi + # Find the right directory to put the root-mode PID file in + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pid file location" >&5 + $as_echo_n "checking pid file location... " >&6; } +-if test -d "/run" +-then +- piddir="/run" +-elif test -d "/var/run"; then +- piddir="/var/run" +-elif test -d "/etc"; then +- piddir="/etc" +-fi ++piddir="/var/run" + + + cat >>confdefs.h <<_ACEOF diff --git a/admin/muninlite/Makefile b/admin/muninlite/Makefile new file mode 100644 index 0000000..ef7e11d --- /dev/null +++ b/admin/muninlite/Makefile @@ -0,0 +1,54 @@ +# +# 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:=muninlite +PKG_VERSION:=1.0.4 +PKG_RELEASE:=8 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/$(PKG_NAME) +PKG_MD5SUM:=a8cc86f0cc536a6c22dc298f4ed55339 +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define Package/muninlite + SECTION:=admin + CATEGORY:=Administration + DEPENDS:=+xinetd + TITLE:=Munin node implemented in shell + URL:=http://sourceforge.net/projects/muninlite/ + PKG_MAINTAINER:=Jonathan McCrohan +endef + +define Package/muninlite/Default/description + Munin node implemented in shell. + Munin is a monitoring system for Unix networks. +endef + +define Package/muninlite/install + $(INSTALL_DIR) $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/munin-node $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/xinetd.d + $(INSTALL_DATA) ./files/etc/xinetd.d/munin $(1)/etc/xinetd.d/ +endef + +define Package/muninlite/conffiles +/etc/xinetd.d/munin +endef + +define Build/Configure +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) +endef + +$(eval $(call BuildPackage,muninlite)) diff --git a/admin/muninlite/files/etc/xinetd.d/munin b/admin/muninlite/files/etc/xinetd.d/munin new file mode 100644 index 0000000..012d71b --- /dev/null +++ b/admin/muninlite/files/etc/xinetd.d/munin @@ -0,0 +1,10 @@ +service munin +{ + socket_type = stream + protocol = tcp + wait = no + user = root + group = root + server = /usr/sbin/munin-node + disable = no +} diff --git a/admin/muninlite/patches/001-fix_disks.patch b/admin/muninlite/patches/001-fix_disks.patch new file mode 100644 index 0000000..a2264a8 --- /dev/null +++ b/admin/muninlite/patches/001-fix_disks.patch @@ -0,0 +1,10 @@ +--- a/plugins/df ++++ b/plugins/df +@@ -19,6 +19,6 @@ fetch_df() { + do + PINFO=$(df -P $PART | tail -1); + PNAME=$(echo $PINFO | cut -d\ -f1 | sed 's/[\/.-]/_/g') +- echo "$PNAME.value" $(echo $PINFO | cut -f5 -d\ | sed -e 's/\%//g') ++ echo "$PNAME.value" $(echo $PINFO | sed -e 's/\%//g' -e 's/ */ /g' | cut -f5 -d' ') + done + } diff --git a/admin/muninlite/patches/002-hostname.patch b/admin/muninlite/patches/002-hostname.patch new file mode 100644 index 0000000..5d87168 --- /dev/null +++ b/admin/muninlite/patches/002-hostname.patch @@ -0,0 +1,11 @@ +--- a/munin-node.in ++++ b/munin-node.in +@@ -113,7 +113,7 @@ PLUGINS=$RES + + # ===== MAIN LOOP ===== + FUNCTIONS="list nodes config fetch version quit" +-HOSTNAME=$(hostname -f 2>/dev/null || hostname) ++HOSTNAME=$(/sbin/uci get "system.@system[0].hostname" 2>/dev/null || cat /proc/sys/kernel/hostname) + echo "# munin node at $HOSTNAME" + while read arg0 arg1 + do diff --git a/admin/muninlite/patches/100-fix-no-ethtool.patch b/admin/muninlite/patches/100-fix-no-ethtool.patch new file mode 100644 index 0000000..88f7e30 --- /dev/null +++ b/admin/muninlite/patches/100-fix-no-ethtool.patch @@ -0,0 +1,21 @@ +--- a/plugins/if_ ++++ b/plugins/if_ +@@ -15,10 +15,14 @@ config_if() { + echo "up.min 0" + echo "up.negative down" + echo "up.cdef up,8,*" +- if ethtool $1 | grep -q Speed; then +- MAX=$(($(ethtool $1 | grep Speed | sed -e 's/[[:space:]]\{1,\}/ /g' -e 's/^ //' -e 's/M.*//' | cut -d\ -f2) * 1000000)) +- echo "up.max $MAX" +- echo "down.max $MAX" ++ if [ -n "$(which ethtool)" ]; then ++ if [ -x "$(which ethtool)" ]; then ++ if ethtool $1 | grep -q Speed; then ++ MAX=$(($(ethtool $1 | grep Speed | sed -e 's/[[:space:]]\{1,\}/ /g' -e 's/^ //' -e 's/M.*//' | cut -d\ -f2) * 1000000)) ++ echo "up.max $MAX" ++ echo "down.max $MAX" ++ fi ++ fi + fi + } + fetch_if() { diff --git a/admin/muninlite/patches/110-fix-uptime-days.patch b/admin/muninlite/patches/110-fix-uptime-days.patch new file mode 100644 index 0000000..d9aa43f --- /dev/null +++ b/admin/muninlite/patches/110-fix-uptime-days.patch @@ -0,0 +1,12 @@ +--- a/plugins/uptime ++++ b/plugins/uptime +@@ -4,8 +4,7 @@ config_uptime() { + echo "graph_vlabel uptime in days" + echo "uptime.label uptime" + echo "uptime.draw AREA" +- echo "uptime.cdef uptime,86400,/" + } + fetch_uptime() { +- echo "uptime.value" $(cut -d\ -f1 /proc/uptime) ++ awk '{printf "uptime.value %.2f",$1/86400; print ""}' /proc/uptime + } diff --git a/admin/muninlite/patches/200-add-tap-dev.patch b/admin/muninlite/patches/200-add-tap-dev.patch new file mode 100644 index 0000000..fa46ce6 --- /dev/null +++ b/admin/muninlite/patches/200-add-tap-dev.patch @@ -0,0 +1,20 @@ +--- a/munin-node.in ++++ b/munin-node.in +@@ -72,7 +72,7 @@ RES="" + for PLUG in $PLUGINS + do + if [ "$PLUG" = "if_" ]; then +- for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); ++ for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); + do + INTERRES=$(echo $INTER | sed 's/\./VLAN/') + RES="$RES if_$INTERRES" +@@ -80,7 +80,7 @@ do + eval "config_if_${INTERRES}() { config_if $INTER $@; };" + done + elif [ "$PLUG" = "if_err_" ]; then +- for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); ++ for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); + do + INTERRES=$(echo $INTER | sed 's/\./VLAN/') + RES="$RES if_err_$INTERRES" diff --git a/admin/muninlite/patches/210-add-bridge-devs.patch b/admin/muninlite/patches/210-add-bridge-devs.patch new file mode 100644 index 0000000..1a76e97 --- /dev/null +++ b/admin/muninlite/patches/210-add-bridge-devs.patch @@ -0,0 +1,24 @@ +--- a/munin-node.in ++++ b/munin-node.in +@@ -72,17 +72,17 @@ RES="" + for PLUG in $PLUGINS + do + if [ "$PLUG" = "if_" ]; then +- for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); ++ for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\|br-\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); + do +- INTERRES=$(echo $INTER | sed 's/\./VLAN/') ++ INTERRES=$(echo $INTER | sed -e 's/\./VLAN/' -e 's/\-/_/') + RES="$RES if_$INTERRES" + eval "fetch_if_${INTERRES}() { fetch_if $INTER $@; };" + eval "config_if_${INTERRES}() { config_if $INTER $@; };" + done + elif [ "$PLUG" = "if_err_" ]; then +- for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); ++ for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\|br-\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); + do +- INTERRES=$(echo $INTER | sed 's/\./VLAN/') ++ INTERRES=$(echo $INTER | sed -e 's/\./VLAN/' -e 's/\-/_/') + RES="$RES if_err_$INTERRES" + eval "fetch_if_err_${INTERRES}() { fetch_if_err $INTER $@; };" + eval "config_if_err_${INTERRES}() { config_if_err $INTER $@; };" diff --git a/admin/muninlite/patches/220-modify-ifname-parser.patch b/admin/muninlite/patches/220-modify-ifname-parser.patch new file mode 100644 index 0000000..6a2ba23 --- /dev/null +++ b/admin/muninlite/patches/220-modify-ifname-parser.patch @@ -0,0 +1,22 @@ +--- a/plugins/if_ ++++ b/plugins/if_ +@@ -26,7 +26,7 @@ config_if() { + fi + } + fetch_if() { +- IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g') ++ IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ */ /g' -e 's/^[ \t]*//') + echo "down.value" $(echo $IINFO | cut -d\ -f1) + echo "up.value" $(echo $IINFO | cut -d\ -f9) + } +--- a/plugins/if_err_ ++++ b/plugins/if_err_ +@@ -15,7 +15,7 @@ config_if_err() { + echo "trans.warning 1" + } + fetch_if_err() { +- IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g') ++ IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ */ /g' -e 's/^[ \t]*//') + echo "rcvd.value" $(echo $IINFO | cut -d\ -f3) + echo "trans.value" $(echo $IINFO | cut -d\ -f11) + } diff --git a/admin/muninlite/patches/230-fix-available-interface-parsing.patch b/admin/muninlite/patches/230-fix-available-interface-parsing.patch new file mode 100644 index 0000000..2f227e5 --- /dev/null +++ b/admin/muninlite/patches/230-fix-available-interface-parsing.patch @@ -0,0 +1,20 @@ +--- a/munin-node.in ++++ b/munin-node.in +@@ -72,7 +72,7 @@ RES="" + for PLUG in $PLUGINS + do + if [ "$PLUG" = "if_" ]; then +- for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\|br-\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); ++ for INTER in $(grep -E '^ *(ppp|eth|wlan|ath|ra|ipsec|tap|br-)[^:]{1,}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); + do + INTERRES=$(echo $INTER | sed -e 's/\./VLAN/' -e 's/\-/_/') + RES="$RES if_$INTERRES" +@@ -80,7 +80,7 @@ do + eval "config_if_${INTERRES}() { config_if $INTER $@; };" + done + elif [ "$PLUG" = "if_err_" ]; then +- for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\|br-\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); ++ for INTER in $(grep -E '^ *(ppp|eth|wlan|ath|ra|ipsec|tap|br-)[^:]{1,}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); + do + INTERRES=$(echo $INTER | sed -e 's/\./VLAN/' -e 's/\-/_/') + RES="$RES if_err_$INTERRES" diff --git a/admin/netdata/Makefile b/admin/netdata/Makefile new file mode 100644 index 0000000..022ef8b --- /dev/null +++ b/admin/netdata/Makefile @@ -0,0 +1,68 @@ +# +# Copyright (C) 2008-2016 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:=netdata +PKG_VERSION:=1.4.0 +PKG_RELEASE:=3 +PKG_MAINTAINER:=Daniel Engberg +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=COPYING + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=http://firehol.org/download/netdata/releases/v$(PKG_VERSION) +PKG_SOURCE_VERSION:=3028b87ee19e8550df6b9decc49733d595e0bd6e + +PKG_INSTALL:=1 +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/netdata + SECTION:=admin + CATEGORY:=Administration + DEPENDS:=+zlib +libuuid + TITLE:=Real-time performance monitoring tool + URL:=http://netdata.firehol.org/ +endef + +define Package/netdata/description + netdata is a highly optimized Linux daemon providing real-time performance + monitoring for Linux systems, applications and SNMP devices over the web. +endef + +define Package/netdata/conffiles +/etc/netdata/ +endef + +define Package/netdata/install + mkdir -p $(1)/etc/netdata + $(CP) $(PKG_INSTALL_DIR)/etc/netdata $(1)/etc + $(CP) ./files/netdata.conf $(1)/etc/netdata + mkdir -p $(1)/usr/share/netdata + $(CP) $(PKG_INSTALL_DIR)/usr/share/netdata $(1)/usr/share + rm $(1)/usr/share/netdata/web/images/animated.gif + rm -rf $(1)/usr/share/netdata/web/old + rm $(1)/usr/share/netdata/web/demo*html + rm $(1)/usr/share/netdata/web/fonts/*.svg + rm $(1)/usr/share/netdata/web/fonts/*.ttf + rm $(1)/usr/share/netdata/web/fonts/*.woff + rm $(1)/usr/share/netdata/web/fonts/*.otf + mkdir -p $(1)/usr/lib/netdata + $(CP) $(PKG_INSTALL_DIR)/usr/lib/netdata $(1)/usr/lib + rm $(1)/usr/lib/netdata/python.d/python-modules-installer.sh + rm -rf $(1)/usr/lib/netdata/python.d/python_modules/pyyaml2 + rm -rf $(1)/usr/lib/netdata/python.d/python_modules/pyyaml3 + chmod 4755 $(1)/usr/lib/netdata/plugins.d/apps.plugin + mkdir -p $(1)/etc/init.d + $(INSTALL_BIN) ./files/netdata.init $(1)/etc/init.d/netdata + mkdir -p $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/netdata $(1)/usr/sbin +endef + +$(eval $(call BuildPackage,netdata)) diff --git a/admin/netdata/files/netdata.conf b/admin/netdata/files/netdata.conf new file mode 100644 index 0000000..8c5c56b --- /dev/null +++ b/admin/netdata/files/netdata.conf @@ -0,0 +1,43 @@ +### NetData Configuration + +### Notes about plugins +### +### charts.d - REQUIRES Bash, enable here and edit charts.d.conf +### apps - none atm +### node.d - REQUIRES node.js +### tc - QoS stats (if wanted) +### cgcroups - No support in OpenWRT/LEDE by default +### health - Disabled by default +### KSM - No support in OpenWRT/LEDE by default +### python.d - REQUIRES python and PyYAML, edit python.d.conf to enable + +[global] + run as user = nobody + web files owner = root + web files group = root + update every = 2 + history = 1800 + access log = none + debug log = syslog + error log = syslog + memory mode = ram + +[plugins] + charts.d = no + apps = no + node.d = no + tc = no + cgroups = no + +[health] + enabled = no + +[plugin:proc] + /proc/net/softnet_stat = no + /proc/net/snmp = no + /sys/kernel/mm/ksm = no + /proc/net/netstat = no + /proc/net/ip_vs_stats = no + /proc/net/stat/synproxy = no + /proc/net/rpc/nfsd = no + /proc/net/rpc/nfs = no diff --git a/admin/netdata/files/netdata.init b/admin/netdata/files/netdata.init new file mode 100644 index 0000000..d4be0a7 --- /dev/null +++ b/admin/netdata/files/netdata.init @@ -0,0 +1,21 @@ +#!/bin/sh /etc/rc.common + +START=99 +USE_PROCD=1 + +APPBINARY=/usr/sbin/netdata +CONFIGFILE=/etc/netdata/netdata.conf + + start_service() { + mkdir -m 0755 -p /var/cache/netdata + chown nobody /var/cache/netdata + mkdir -m 0755 -p /var/lib/netdata + chown nobody /var/lib/netdata + mkdir -m 0755 -p /var/log/netdata + chown nobody /var/log/netdata + procd_open_instance + procd_set_param command $APPBINARY -nd -c $CONFIGFILE + procd_set_param file $CONFIGFILE + procd_set_param respawn + procd_close_instance + } diff --git a/admin/netdata/patches/001-disable_external_plugins_by_default.patch b/admin/netdata/patches/001-disable_external_plugins_by_default.patch new file mode 100644 index 0000000..cf9dc83 --- /dev/null +++ b/admin/netdata/patches/001-disable_external_plugins_by_default.patch @@ -0,0 +1,26 @@ +diff --git a/conf.d/charts.d.conf b/conf.d/charts.d.conf +index acb2a6f..8111859 100644 +--- a/conf.d/charts.d.conf ++++ b/conf.d/charts.d.conf +@@ -30,7 +30,7 @@ + + # the default enable/disable for all charts.d collectors + # the default is "yes" +-# enable_all_charts="yes" ++enable_all_charts="no" + + # BY DEFAULT ENABLED MODULES + # ap=yes +diff --git a/conf.d/python.d.conf b/conf.d/python.d.conf +index 940bd91..78e2f0a 100644 +--- a/conf.d/python.d.conf ++++ b/conf.d/python.d.conf +@@ -7,7 +7,7 @@ + # + + # Enable / disable the whole python.d.plugin (all its modules) +-enabled: yes ++enabled: no + + # Prevent log flood + # Define how many log messages can be written to log file in one log_interval diff --git a/admin/sudo/Makefile b/admin/sudo/Makefile new file mode 100644 index 0000000..0555161 --- /dev/null +++ b/admin/sudo/Makefile @@ -0,0 +1,98 @@ +# +# Copyright (C) 2006-2015 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:=sudo +PKG_VERSION:=1.8.14p3 +PKG_RELEASE:=1 +PKG_LICENSE:=ISC +PKG_LICENSE_FILES:=doc/LICENSE + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.sudo.ws/dist +PKG_MD5SUM:=93dbd1e47c136179ff1b01494c1c0e75 + +PKG_INSTALL:=1 + +PKG_BUILD_DEPENDS:=sudo/host + +include $(INCLUDE_DIR)/package.mk + +define Package/sudo + SECTION:=admin + CATEGORY:=Administration + TITLE:=Delegate authority to run commands + URL:=http://www.sudo.ws/ + MAINTAINER:=Gergely Kiss +endef + +define Package/sudo/description + Sudo (su "do") allows a system administrator to delegate authority to + give certain users (or groups of users) the ability to run some (or + all) commands as root or another user while providing an audit trail of + the commands and their arguments. +endef + +define Package/sudo/conffiles +/etc/sudoers +/etc/sudoers.d/ +endef + +CONFIGURE_ARGS+= \ + --without-pam \ + --disable-pam-session \ + --with-editor=/bin/vi \ + --without-lecture \ + --disable-zlib \ + --with-rundir=/var/lib/sudo \ + --with-vardir=/var/lib/sudo + +CONFIGURE_VARS+= \ + sudo_cv_uid_t_len=10 \ + sudo_cv_func_unsetenv_void=no + +include $(INCLUDE_DIR)/host-build.mk + +define Host/Compile + cd $(HOST_BUILD_DIR)/lib/util; \ + $(MAKE) mksiglist; $(MAKE) mksigname +endef + +define Host/Install + $(INSTALL_DIR) $(HOST_BUILD_PREFIX)/bin + $(CP) $(HOST_BUILD_DIR)/lib/util/mksig{list,name} $(HOST_BUILD_PREFIX)/bin/ +endef + +$(eval $(call HostBuild)) + +define Package/sudo/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/sudo $(1)/usr/bin/ + chmod 4755 $(1)/usr/bin/sudo + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/visudo $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc + $(CP) $(PKG_INSTALL_DIR)/etc/sudoers $(1)/etc/ + chmod 0440 $(1)/etc/sudoers + $(INSTALL_DIR) $(1)/etc/sudoers.d + $(INSTALL_DIR) $(1)/usr/lib/sudo + $(CP) $(PKG_INSTALL_DIR)/usr/lib/sudo/*.so* $(1)/usr/lib/sudo/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/sudo.init $(1)/etc/init.d/sudo +endef + +define Package/sudo/postinst +#!/bin/sh + +[ -n "$$IPKG_INSTROOT" ] || { + /etc/init.d/sudo enable + /etc/init.d/sudo start +} +endef + +$(eval $(call BuildPackage,sudo)) diff --git a/admin/sudo/files/sudo.init b/admin/sudo/files/sudo.init new file mode 100755 index 0000000..705fe84 --- /dev/null +++ b/admin/sudo/files/sudo.init @@ -0,0 +1,11 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014 OpenWrt.org + +START=99 + +start() { + [ -d /var/lib/sudo ] || { + mkdir -m 0755 -p /var/lib/sudo + chmod 0700 /var/lib/sudo + } +} diff --git a/admin/sudo/patches/010-cross-compile-fixes.patch b/admin/sudo/patches/010-cross-compile-fixes.patch new file mode 100644 index 0000000..b9c1e79 --- /dev/null +++ b/admin/sudo/patches/010-cross-compile-fixes.patch @@ -0,0 +1,16 @@ +diff -rupN sudo-1.8.11p2.orig/lib/util/Makefile.in sudo-1.8.11p2/lib/util/Makefile.in +--- sudo-1.8.11p2.orig/lib/util/Makefile.in 2014-10-07 22:26:20.000000000 +0200 ++++ sudo-1.8.11p2/lib/util/Makefile.in 2014-12-09 21:44:35.610041162 +0100 +@@ -142,10 +142,10 @@ libsudo_util.la: $(LTOBJS) @LT_LDDEP@ + esac + + siglist.c: mksiglist +- ./mksiglist > $@ ++ mksiglist > $@ + + signame.c: mksigname +- ./mksigname > $@ ++ mksigname > $@ + + mksiglist: $(srcdir)/mksiglist.c $(srcdir)/mksiglist.h $(incdir)/sudo_compat.h $(top_builddir)/config.h + $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/mksiglist.c -o $@ diff --git a/admin/sudo/patches/020-no-owner-change.patch b/admin/sudo/patches/020-no-owner-change.patch new file mode 100644 index 0000000..417e95d --- /dev/null +++ b/admin/sudo/patches/020-no-owner-change.patch @@ -0,0 +1,12 @@ +diff -rupN sudo-1.8.11p2.orig/Makefile.in sudo-1.8.11p2/Makefile.in +--- sudo-1.8.11p2.orig/Makefile.in 2014-10-07 22:26:20.000000000 +0200 ++++ sudo-1.8.11p2/Makefile.in 2014-12-09 22:00:27.256934143 +0100 +@@ -62,7 +62,7 @@ SHELL = @SHELL@ + SED = @SED@ + + INSTALL = $(SHELL) $(top_srcdir)/install-sh -c +-INSTALL_OWNER = -o $(install_uid) -g $(install_gid) ++INSTALL_OWNER = + + ECHO_N = @ECHO_N@ + ECHO_C = @ECHO_C@ diff --git a/admin/sudo/patches/030-musl-fix-missing-header.patch b/admin/sudo/patches/030-musl-fix-missing-header.patch new file mode 100644 index 0000000..efb7d87 --- /dev/null +++ b/admin/sudo/patches/030-musl-fix-missing-header.patch @@ -0,0 +1,12 @@ +diff -rupN sudo-1.8.14p3.orig/include/sudo_util.h sudo-1.8.14p3/include/sudo_util.h +--- sudo-1.8.14p3.orig/include/sudo_util.h 2015-07-22 14:22:49.000000000 +0200 ++++ sudo-1.8.14p3/include/sudo_util.h 2015-08-30 18:41:24.509814946 +0200 +@@ -23,6 +23,8 @@ + # include "compat/stdbool.h" + #endif /* HAVE_STDBOOL_H */ + ++#include ++ + /* + * Macros for operating on struct timeval. + */ diff --git a/admin/zabbix/Makefile b/admin/zabbix/Makefile new file mode 100644 index 0000000..f66c237 --- /dev/null +++ b/admin/zabbix/Makefile @@ -0,0 +1,235 @@ +# +# Copyright (C) 2006-2015 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:=zabbix +PKG_VERSION:=3.0.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/zabbix +PKG_MD5SUM:=7c45d37000e67d75042695344c9937e0 + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/zabbix/Default + SECTION:=admin + CATEGORY:=Administration + TITLE:=Zabbix + URL:=http://www.zabbix.com/ + SUBMENU:=zabbix + MAINTAINER:=Etienne CHAMPETIER + USERID:=zabbix=53:zabbix=53 + DEPENDS += $(ICONV_DEPENDS) +endef + +define Package/zabbix-agentd + $(call Package/zabbix/Default) + TITLE+= agentd +endef + +define Package/zabbix-extra-mac80211 + $(call Package/zabbix/Default) + TITLE+= discovery/userparameters for mac80211 + DEPENDS = +zabbix-agentd @PACKAGE_MAC80211_DEBUGFS @KERNEL_DEBUG_FS +endef + +define Package/zabbix-extra-network + $(call Package/zabbix/Default) + TITLE+= discovery/userparameters for network + DEPENDS = +zabbix-agentd +libuci-lua +lua +endef + +define Package/zabbix-extra-wifi + $(call Package/zabbix/Default) + TITLE+= discovery/userparameters for wifi + DEPENDS = +zabbix-agentd +libiwinfo-lua +libuci-lua +lua +endef + +define Package/zabbix-sender + $(call Package/zabbix/Default) + TITLE+= sender +endef + +define Package/zabbix-get + $(call Package/zabbix/Default) + TITLE+= get +endef + +define Package/zabbix-server + $(call Package/zabbix/Default) + TITLE+= server + DEPENDS += +libsqlite3 +endef + +define Package/zabbix-proxy + $(call Package/zabbix/Default) + TITLE+= proxy + DEPENDS += +libsqlite3 +endef + +define Package/zabbix-extra-mac80211/description +An extra package for zabbix-agentd that adds a discovery rule for mac80211 wifi phy and many userparameters. +It contains an suid helper to allow zabbix-agentd to still run as zabbix user and not as root. +See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates. +endef + +define Package/zabbix-extra-network/description +An extra package for zabbix-agentd that adds a discovery rule for openwrt network interfaces. +The idea here is to discover only interfaces listed in /etc/config/network (discover br-lan and not eth0.1 and wlan0) +See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates. +endef + +define Package/zabbix-extra-wifi/description +An extra package for zabbix-agentd that adds a discovery rule for wifi interfaces and many userparameters. +As it uses libiwinfo, it works with all wifi devices supported by openwrt. +See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates. +endef + +CONFIGURE_ARGS+= \ + --enable-agent \ + --enable-server \ + --enable-proxy \ + $(call autoconf_bool,CONFIG_IPV6,ipv6) \ + --disable-java \ + --with-sqlite3="$(STAGING_DIR)/usr" + +MAKE_FLAGS += ARCH="linux" + +define Package/zabbix/install/sbin + $(INSTALL_DIR) \ + $(1)/usr/sbin + + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/sbin/zabbix_$(2) \ + $(1)/usr/sbin/ +endef + +define Package/zabbix/install/bin + $(INSTALL_DIR) \ + $(1)/usr/bin + + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/zabbix_$(2) \ + $(1)/usr/bin/ +endef + +define Package/zabbix/install/etc + $(INSTALL_DIR) \ + $(1)/etc + + $(INSTALL_CONF) \ + $(PKG_INSTALL_DIR)/etc/zabbix_$(2).conf \ + $(1)/etc/ +endef + +define Package/zabbix/install/init.d + $(INSTALL_DIR) \ + $(1)/etc/init.d + + $(INSTALL_BIN) \ + ./files/zabbix_$(2).init \ + $(1)/etc/init.d/zabbix_$(2) +endef + +define Package/zabbix/install/zabbix.conf.d + $(INSTALL_DIR) \ + $(1)/etc/zabbix_agentd.conf.d + + $(INSTALL_BIN) \ + ./files/$(2) \ + $(1)/etc/zabbix_agentd.conf.d/$(2) +endef + +define Package/zabbix-agentd/conffiles +/etc/zabbix_agentd.conf +endef +define Package/zabbix-server/conffiles +/etc/zabbix_server.conf +endef +define Package/zabbix-proxy/conffiles +/etc/zabbix_proxy.conf +endef + +ifdef CONFIG_PACKAGE_zabbix-extra-mac80211 +define Build/Prepare/zabbix-extra-mac80211 + mkdir -p $(PKG_BUILD_DIR)/zabbix-extra-mac80211 + $(CP) ./files/zabbix_helper_mac80211.c $(PKG_BUILD_DIR)/zabbix-extra-mac80211/ +endef + +define Build/Compile/zabbix-extra-mac80211 + $(TARGET_CC) $(TARGET_CFLAGS) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211.c -o $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211 +endef +endif + +define Build/Prepare + $(call Build/Prepare/Default) + $(call Build/Prepare/zabbix-extra-mac80211) +endef + +define Build/Compile + $(call Build/Compile/Default) + $(call Build/Compile/zabbix-extra-mac80211) +endef + +define Package/zabbix-agentd/install + $(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d + $(call Package/zabbix/install/sbin,$(1),agentd) + $(call Package/zabbix/install/etc,$(1),agentd) + $(call Package/zabbix/install/init.d,$(1),agentd) +endef + +define Package/zabbix-extra-mac80211/install + $(call Package/zabbix/install/zabbix.conf.d,$(1),mac80211) + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211 $(1)/usr/bin/ + chmod 4755 $(1)/usr/bin/zabbix_helper_mac80211 +endef + +define Package/zabbix-extra-network/install + $(call Package/zabbix/install/zabbix.conf.d,$(1),network) +endef + +define Package/zabbix-extra-wifi/install + $(call Package/zabbix/install/zabbix.conf.d,$(1),wifi) +endef + +define Package/zabbix-sender/install + $(call Package/zabbix/install/bin,$(1),sender) +endef + +define Package/zabbix-get/install + $(call Package/zabbix/install/bin,$(1),get) +endef + +define Package/zabbix-server/install + $(call Package/zabbix/install/sbin,$(1),server) + $(call Package/zabbix/install/etc,$(1),server) +endef + +define Package/zabbix-proxy/install + $(call Package/zabbix/install/sbin,$(1),proxy) + $(call Package/zabbix/install/etc,$(1),proxy) +endef + +$(eval $(call BuildPackage,zabbix-agentd)) +$(eval $(call BuildPackage,zabbix-extra-mac80211)) +$(eval $(call BuildPackage,zabbix-extra-network)) +$(eval $(call BuildPackage,zabbix-extra-wifi)) +$(eval $(call BuildPackage,zabbix-sender)) +$(eval $(call BuildPackage,zabbix-server)) +$(eval $(call BuildPackage,zabbix-proxy)) +$(eval $(call BuildPackage,zabbix-get)) diff --git a/admin/zabbix/files/mac80211 b/admin/zabbix/files/mac80211 new file mode 100644 index 0000000..afa50ae --- /dev/null +++ b/admin/zabbix/files/mac80211 @@ -0,0 +1,27 @@ +#see http://wiki.openwrt.org/doc/howto/zabbix for ready to use templates + +# If you want to know the exact meaning of an UserParameter, you can search in the ieee80211 standard: +# http://standards.ieee.org/getieee802/download/802.11-2012.pdf +# example: for mac80211.ACKFailureCount search for dot11ACKFailureCount (page 2145) + +# mac80211 phy discovery (like 'phy0') +# example: {"data":[{"{#PHY}":"phy0"}]} +# +UserParameter=mac80211.phydiscovery,zabbix_helper_mac80211 discovery + +#phy statistics (you need {#PHY} as parameter) +# +UserParameter=mac80211.ACKFailureCount[*],zabbix_helper_mac80211 $1 dot11ACKFailureCount +UserParameter=mac80211.FCSErrorCount[*],zabbix_helper_mac80211 $1 dot11FCSErrorCount +UserParameter=mac80211.RTSFailureCount[*],zabbix_helper_mac80211 $1 dot11RTSFailureCount +UserParameter=mac80211.RTSSuccessCount[*],zabbix_helper_mac80211 $1 dot11RTSSuccessCount +UserParameter=mac80211.FailedCount[*],zabbix_helper_mac80211 $1 failed_count +UserParameter=mac80211.FrameDuplicateCount[*],zabbix_helper_mac80211 $1 frame_duplicate_count +UserParameter=mac80211.MulticastReceivedFrameCount[*],zabbix_helper_mac80211 $1 multicast_received_frame_count +UserParameter=mac80211.MulticastTransmittedFrameCount[*],zabbix_helper_mac80211 $1 multicast_transmitted_frame_count +UserParameter=mac80211.MultipleRetryCount[*],zabbix_helper_mac80211 $1 multiple_retry_count +UserParameter=mac80211.ReceivedFragmentCount[*],zabbix_helper_mac80211 $1 received_fragment_count +UserParameter=mac80211.RetryCount[*],zabbix_helper_mac80211 $1 retry_count +UserParameter=mac80211.TransmittedFragmentCount[*],zabbix_helper_mac80211 $1 transmitted_fragment_count +UserParameter=mac80211.TransmittedFrameCount[*],zabbix_helper_mac80211 $1 transmitted_frame_count + diff --git a/admin/zabbix/files/network b/admin/zabbix/files/network new file mode 100644 index 0000000..b68e2a5 --- /dev/null +++ b/admin/zabbix/files/network @@ -0,0 +1,9 @@ +#see http://wiki.openwrt.org/doc/howto/zabbix for ready to use templates + +# network interface discovery +# example: {"data":[{"{#IF}":"lo", "{#NET}":"loopback"},{"{#IF}":"br-lan", "{#NET}":"lan"},{"{#IF}":"eth0.1", "{#NET}":"wan"}]} +# +UserParameter=netowrt.discovery,lua -l uci -e 'x = uci.cursor(nil, "/var/state");list = "{\"data\":[";x:foreach("network", "interface", function(s) list=list.."{\"{#IF}\":\""..s.ifname.."\", \"{#NET}\":\""..s[".name"].."\"}," end); list=string.gsub(list,",$",""); print(list.."]}")' + + + diff --git a/admin/zabbix/files/wifi b/admin/zabbix/files/wifi new file mode 100644 index 0000000..f03d9b4 --- /dev/null +++ b/admin/zabbix/files/wifi @@ -0,0 +1,25 @@ +#see http://wiki.openwrt.org/doc/howto/zabbix for ready to use templates + +# wifi interface discovery +# example: {"data":[{"{#IF}":"wlan0", "{#MODE}":"ap", "{#SSID}":"Openwrt", "{#NET}":"lan", "{#DEV}":"radio0", "{#ENC}":"psk2+ccmp", "{#TYPE}":"mac80211", "{#HWMODE}":"11ng", "{#CHANNEL}":"11", "{#BSSID}":"xx:xx:xx:xx:xx:xx"}]} +# ubus call only work as root so you need to run zabbix as root to use wifi.ifdiscovery +UserParameter=wifi.ifdiscovery, lua -l ubus -l iwinfo -e 'u=ubus.connect();list="{\"data\":[";stat=u:call("network.wireless", "status", {});for dev, dev_table in pairs(stat) do for i, iface in pairs(dev_table["interfaces"]) do c=iface["config"];i=iface["ifname"];t=iwinfo.type(i);iw=iwinfo[t];e = iw.encryption(i);e = e and e.description or "None";n = table.concat(c["network"]," ");list=list.."{\"{#IF}\":\""..i.."\", \"{#MODE}\":\""..iw.mode(i).."\", \"{#SSID}\":\""..c["ssid"].."\", \"{#NET}\":\""..n.."\", \"{#DEV}\":\""..dev.."\", \"{#ENC}\":\""..e.."\", \"{#TYPE}\":\""..t.."\", \"{#HWMODE}\":\"".."?".."\", \"{#CHANNEL}\":\""..iw.channel(i).."\", \"{#BSSID}\":\""..iw.bssid(i).."\"},";end;end;list=string.gsub(list,",$","");print(list.."]}")' + + +#iwinfo info (you need {#IF} as parameter, like 'wlan0') +UserParameter=wifi.iwinfo.channel[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].channel('$1'))" +UserParameter=wifi.iwinfo.frequency[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].frequency('$1'))" +UserParameter=wifi.iwinfo.txpower[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].txpower('$1'))" +UserParameter=wifi.iwinfo.bitrate[*],lua -l iwinfo -e "b = iwinfo[iwinfo.type('$1')].bitrate('$1'); print(b or '0')" +UserParameter=wifi.iwinfo.signal[*],lua -l iwinfo -e "s = iwinfo[iwinfo.type('$1')].signal('$1'); print(s or '-255')" +UserParameter=wifi.iwinfo.noise[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].noise('$1'))" +UserParameter=wifi.iwinfo.quality[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].quality('$1'))" +UserParameter=wifi.iwinfo.quality_max[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].quality_max('$1'))" +UserParameter=wifi.iwinfo.mode[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].mode('$1'))" +UserParameter=wifi.iwinfo.ssid[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].ssid('$1'))" +UserParameter=wifi.iwinfo.bssid[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].bssid('$1'))" +UserParameter=wifi.iwinfo.country[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].country('$1'))" +UserParameter=wifi.iwinfo.nbusers[*],lua -l iwinfo -e "n = 0; for _,_ in pairs(iwinfo[iwinfo.type('$1')].assoclist('$1')) do n = n + 1 end; print(n)" +UserParameter=wifi.iwinfo.encryption[*],lua -l iwinfo -e "e = iwinfo[iwinfo.type('$1')].encryption('$1'); print(e and e.description or 'None')" +UserParameter=wifi.iwinfo.hwmode[*],lua -l iwinfo -e "x=iwinfo[iwinfo.type('$1')].hwmodelist('$1'); print((x.a and 'a' or '')..(x.b and 'b' or '')..(x.g and 'g' or '')..(x.n and 'n' or ''))" + diff --git a/admin/zabbix/files/zabbix_agentd.init b/admin/zabbix/files/zabbix_agentd.init new file mode 100755 index 0000000..ea88634 --- /dev/null +++ b/admin/zabbix/files/zabbix_agentd.init @@ -0,0 +1,23 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008-2011 OpenWrt.org + +START=60 + +USE_PROCD=1 +PROG=/usr/sbin/zabbix_agentd +CONFIG=/etc/zabbix_agentd.conf + +start_service() { + # Sometimes the agentd config was installed in /etc/zabbix/zabbix_agentd.conf + [ -f /etc/zabbix/zabbix_agentd.conf ] && mv /etc/zabbix/zabbix_agentd.conf ${CONFIG} + + [ -f ${CONFIG} ] || return 1 + + procd_open_instance + procd_set_param command ${PROG} -c ${CONFIG} -f + procd_set_param respawn + procd_set_param stdout 1 + procd_set_param stderr 1 + procd_close_instance +} + diff --git a/admin/zabbix/files/zabbix_helper_mac80211.c b/admin/zabbix/files/zabbix_helper_mac80211.c new file mode 100644 index 0000000..1442d27 --- /dev/null +++ b/admin/zabbix/files/zabbix_helper_mac80211.c @@ -0,0 +1,77 @@ +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include + +int discovery() +{ + DIR *dir; + struct dirent *ent; + bool comma = false; + if ((dir = opendir ("/sys/kernel/debug/ieee80211/")) != NULL) { + printf("{\"data\":["); + while ((ent = readdir (dir)) != NULL) { + if (strcmp(".", ent->d_name) && strcmp("..", ent->d_name)) { + if (comma) + printf(","); + printf("{\"{#PHY}\":\"%s\"}", ent->d_name); + comma = true; + } + } + printf("]}\n"); + closedir(dir); + } else { + perror(""); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} + +int get_param(char *phy, char *stat) +{ + char *filename = NULL; + FILE *f = NULL; + phy = basename(phy); + stat = basename(stat); + if (asprintf(&filename, "/sys/kernel/debug/ieee80211/%s/statistics/%s", phy, stat) > 0) + f = fopen(filename, "r"); + + if (f != NULL) { + char temp[256]; + while (fgets(temp, 256, f) != NULL) + printf("%s",temp); + + fclose(f); + } else { + perror(""); + return EXIT_FAILURE; + } + free(filename); + return EXIT_SUCCESS; +} + +int usage(char *name) +{ + fprintf(stderr, "Usage:\n"); + fprintf(stderr, " %s discovery\n", name); + fprintf(stderr, " => print mac80211.phydiscovery discovery rule\n"); + fprintf(stderr, " %s PHY STAT\n", name); + fprintf(stderr, " => cat /sys/kernel/debug/ieee80211/PHY/statistics/STAT as root\n"); + return EXIT_FAILURE; +} + +int main(int argc, char *argv[]) +{ + + switch (argc) { + case 2: + return discovery(); + case 3: + return get_param(argv[1], argv[2]); + default: + return usage(argv[0]); + } +} diff --git a/admin/zabbix/patches/002-fix-res_send-on-uclibc.patch b/admin/zabbix/patches/002-fix-res_send-on-uclibc.patch new file mode 100644 index 0000000..f4b5d33 --- /dev/null +++ b/admin/zabbix/patches/002-fix-res_send-on-uclibc.patch @@ -0,0 +1,35 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -161,6 +161,10 @@ if test "x$found_resolv" != "xyes"; then + AC_MSG_ERROR([Unable to do DNS lookups (libresolv check failed)]) + fi + LIBS="${LIBS} ${RESOLV_LIBS}" ++AC_SEARCH_LIBS([res_mkquery], [], [AC_DEFINE([HAVE_RES_MKQUERY], 1, [Define if res_mkquery exists])]) ++AC_SEARCH_LIBS([__res_mkquery], [], [AC_DEFINE([HAVE_RES_MKQUERY], 1, [Define if res_mkquery exists])]) ++AC_SEARCH_LIBS([res_send], [], [AC_DEFINE([HAVE_RES_SEND], 1, [Define if res_send exists])]) ++AC_SEARCH_LIBS([__res_send], [], [AC_DEFINE([HAVE_RES_SEND], 1, [Define if res_send exists])]) + + dnl ***************************************************************** + dnl * * +--- a/src/libs/zbxsysinfo/common/net.c ++++ b/src/libs/zbxsysinfo/common/net.c +@@ -471,6 +471,7 @@ static int dns_query(AGENT_REQUEST *requ + return SYSINFO_RET_FAIL; + } + ++#if defined(HAVE_RES_MKQUERY) && defined(HAVE_RES_SEND) + if (-1 == (res = res_mkquery(QUERY, zone, C_IN, type, NULL, 0, NULL, buf, sizeof(buf)))) + { + SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Cannot create DNS query: %s", zbx_strerror(errno))); +@@ -505,6 +506,11 @@ static int dns_query(AGENT_REQUEST *requ + _res.retry = retry; + + res = res_send(buf, res, answer.buffer, sizeof(answer.buffer)); ++#else /* defined(HAVE_RES_QUERY) && defined(HAVE_RES_SEND) */ ++ /* retrand and retry are ignored */ ++ if (-1 == (res = res_query(zone, C_IN, type, answer.buffer, sizeof(answer.buffer)))) ++ return SYSINFO_RET_FAIL; ++#endif + + _res.options = saved_options; + _res.retrans = saved_retrans; diff --git a/admin/zabbix/patches/002-uclibc_loadavg.patch b/admin/zabbix/patches/002-uclibc_loadavg.patch new file mode 100644 index 0000000..ce62d06 --- /dev/null +++ b/admin/zabbix/patches/002-uclibc_loadavg.patch @@ -0,0 +1,48 @@ +--- a/src/libs/zbxsysinfo/linux/cpu.c ++++ b/src/libs/zbxsysinfo/linux/cpu.c +@@ -22,6 +22,45 @@ + #include "stats.h" + #include "log.h" + ++ ++/* uclibc and dietlibc do not have this junk -ReneR */ ++#if defined (__UCLIBC__) || defined (__dietlibc__) ++static int getloadavg (double loadavg[], int nelem) ++{ ++ int fd; ++ ++ fd = open ("/proc/loadavg", O_RDONLY); ++ if (fd < 0) ++ return -1; ++ else ++ { ++ char buf[65], *p; ++ ssize_t nread; ++ int i; ++ ++ nread = read (fd, buf, sizeof buf - 1); ++ close (fd); ++ if (nread <= 0) ++ return -1; ++ buf[nread - 1] = '\0'; ++ ++ if (nelem > 3) ++ nelem = 3; ++ p = buf; ++ for (i = 0; i < nelem; ++i) ++ { ++ char *endp; ++ loadavg[i] = strtod (p, &endp); ++ if (endp == p) ++ return -1; ++ p = endp; ++ } ++ ++ return i; ++ } ++} ++#endif ++ + int SYSTEM_CPU_NUM(AGENT_REQUEST *request, AGENT_RESULT *result) + { + char *type; diff --git a/admin/zabbix/patches/003-change-user-and-foreground.patch b/admin/zabbix/patches/003-change-user-and-foreground.patch new file mode 100644 index 0000000..6779e47 --- /dev/null +++ b/admin/zabbix/patches/003-change-user-and-foreground.patch @@ -0,0 +1,17 @@ +--- a/src/libs/zbxnix/daemon.c ++++ b/src/libs/zbxnix/daemon.c +@@ -300,11 +300,14 @@ int daemon_start(int allow_root, const c + + if (0 == allow_root && 0 == getuid()) /* running as root? */ + { ++#if 0 ++/* allow changing user and foreground */ + if (0 != (flags & ZBX_TASK_FLAG_FOREGROUND)) + { + zbx_error("cannot run as root!"); + exit(EXIT_FAILURE); + } ++#endif + + if (NULL == user) + user = "zabbix"; diff --git a/admin/zabbix/patches/010-change-agentd-config.patch b/admin/zabbix/patches/010-change-agentd-config.patch new file mode 100644 index 0000000..8b16b28 --- /dev/null +++ b/admin/zabbix/patches/010-change-agentd-config.patch @@ -0,0 +1,65 @@ +--- a/conf/zabbix_agentd.conf ++++ b/conf/zabbix_agentd.conf +@@ -3,12 +3,11 @@ + + ############ GENERAL PARAMETERS ################# + +-### Option: PidFile +-# Name of PID file. +-# +-# Mandatory: no +-# Default: +-# PidFile=/tmp/zabbix_agentd.pid ++# We do not need PidFile with procd ++# PidFile=/var/run/zabbix_agentd.pid ++ ++# use syslog ++LogType=system + + ### Option: LogType + # Specifies where log messages are written to: +@@ -27,8 +26,6 @@ + # Default: + # LogFile= + +-LogFile=/tmp/zabbix_agentd.log +- + ### Option: LogFileSize + # Maximum size of log file in MB. + # 0 - disable automatic log rotation. +@@ -114,6 +111,7 @@ Server=127.0.0.1 + # Range: 0-100 + # Default: + # StartAgents=3 ++StartAgents=1 + + ##### Active checks related + +@@ -129,8 +127,6 @@ Server=127.0.0.1 + # Default: + # ServerActive= + +-ServerActive=127.0.0.1 +- + ### Option: Hostname + # Unique, case sensitive hostname. + # Required for active checks and must match hostname as configured on the server. +@@ -140,8 +136,6 @@ ServerActive=127.0.0.1 + # Default: + # Hostname= + +-Hostname=Zabbix server +- + ### Option: HostnameItem + # Item used for generating Hostname if it is undefined. Ignored if Hostname is defined. + # Does not support UserParameters or aliases. +@@ -259,8 +253,8 @@ Hostname=Zabbix server + # Include= + + # Include=/usr/local/etc/zabbix_agentd.userparams.conf +-# Include=/usr/local/etc/zabbix_agentd.conf.d/ + # Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf ++Include=/etc/zabbix_agentd.conf.d/ + + ####### USER-DEFINED MONITORED PARAMETERS ####### + diff --git a/admin/zabbix/patches/100-musl-compat.patch b/admin/zabbix/patches/100-musl-compat.patch new file mode 100644 index 0000000..61aeb9e --- /dev/null +++ b/admin/zabbix/patches/100-musl-compat.patch @@ -0,0 +1,23 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -51,7 +51,7 @@ AC_CHECK_HEADERS(stdio.h stdlib.h string + syslog.h time.h errno.h sys/types.h sys/stat.h netinet/in.h \ + math.h sys/socket.h dirent.h ctype.h \ + mtent.h fcntl.h sys/param.h arpa/inet.h \ +- sys/vfs.h sys/pstat.h sys/sysinfo.h sys/statvfs.h sys/statfs.h \ ++ sys/vfs.h sys/pstat.h sys/statvfs.h sys/statfs.h \ + sys/socket.h sys/loadavg.h arpa/inet.h \ + sys/vmmeter.h strings.h vm/vm_param.h \ + sys/time.h kstat.h sys/syscall.h sys/sysmacros.h \ +@@ -63,6 +63,11 @@ AC_CHECK_HEADERS(stdio.h stdlib.h string + Winber.h lber.h ws2tcpip.h inttypes.h sys/file.h grp.h \ + execinfo.h libperfstat.h sys/systemcfg.h sys/mnttab.h mntent.h sys/times.h \ + dlfcn.h sys/utsname.h) ++AC_CHECK_HEADERS(sys/sysinfo.h, [], [], [ ++#ifdef HAVE_LINUX_KERNEL_H ++# include ++#endif ++]) + AC_CHECK_HEADERS(resolv.h, [], [], [ + #ifdef HAVE_SYS_TYPES_H + # include diff --git a/devel/autoconf/Makefile b/devel/autoconf/Makefile new file mode 100644 index 0000000..598654d --- /dev/null +++ b/devel/autoconf/Makefile @@ -0,0 +1,70 @@ +# +# Copyright (C) 2015 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:=autoconf +PKG_VERSION:=2.69 +PKG_RELEASE:=2 + +PKG_SOURCE_URL:=@GNU/autoconf +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_MD5SUM:=50f97f4159805e374639a73e2636f22e +PKG_MAINTAINER:=Heinrich Schuchardt +PKG_LICENSE:=GPL-3.0+ + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +CONFIGURE_VARS += M4=m4 EMACS=no + +define Package/autoconf + SECTION:=devel + CATEGORY:=Development + TITLE:=autoconf + URL:=https://www.gnu.org/software/autoconf/ + DEPENDS:=+m4 +perl +perlbase-data +perlbase-file +perlbase-getopt \ + +perlbase-dynaloader +perlbase-text +endef + +define Package/autoconf/description + Autoconf is an extensible package of M4 macros that produce shell scripts to + automatically configure software source code packages. +endef + +define Build/Install + $(SED) 's/@PERL@/\/usr\/bin\/perl/g' $(PKG_BUILD_DIR)/bin/Makefile.in + $(call Build/Install/Default) +endef + +define Package/autoconf/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/share/autoconf + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/autoconf/INSTALL \ + $(1)/usr/share/autoconf/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/autoconf/autom4te.cfg \ + $(1)/usr/share/autoconf/ + $(INSTALL_DIR) $(1)/usr/share/autoconf/Autom4te + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/autoconf/Autom4te/* \ + $(1)/usr/share/autoconf/Autom4te/ + $(INSTALL_DIR) $(1)/usr/share/autoconf/autoconf + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/autoconf/autoconf/* \ + $(1)/usr/share/autoconf/autoconf/ + $(INSTALL_DIR) $(1)/usr/share/autoconf/autoscan + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/autoconf/autoscan/* \ + $(1)/usr/share/autoconf/autoscan/ + $(INSTALL_DIR) $(1)/usr/share/autoconf/autotest + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/autoconf/autotest/* \ + $(1)/usr/share/autoconf/autotest/ + $(INSTALL_DIR) $(1)/usr/share/autoconf/m4sugar + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/autoconf/m4sugar/* \ + $(1)/usr/share/autoconf/m4sugar/ +endef + +$(eval $(call BuildPackage,autoconf)) diff --git a/devel/automake/Makefile b/devel/automake/Makefile new file mode 100644 index 0000000..8357011 --- /dev/null +++ b/devel/automake/Makefile @@ -0,0 +1,65 @@ +# +# Copyright (C) 2015-2016 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:=automake +PKG_VERSION:=1.15 +PKG_RELEASE:=4 + +PKG_SOURCE_URL:=@GNU/automake +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_MD5SUM:=9a1ddb0e053474d9d1105cfe39b0c48d +PKG_MAINTAINER:=Heinrich Schuchardt +PKG_LICENSE:=GPL-3.0+ + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/automake + SECTION:=devel + CATEGORY:=Development + TITLE:=automake + URL:=https://www.gnu.org/software/automake/ + DEPENDS:=+autoconf +perlbase-thread +perlbase-attributes +endef + +define Package/automake/description + Automake is a tool for automatically generating Makefile.in files compliant + with the GNU Coding Standards. +endef + +FIX_PATHS = $(SED) '1c \#!/usr/bin/perl' -e 's| /[^ ]*/bin/perl| /usr/bin/perl|g' + +define Package/automake/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/automake-$(PKG_VERSION) \ + $(1)/usr/bin/automake-$(PKG_VERSION) + $(LN) automake-$(PKG_VERSION) $(1)/usr/bin/automake + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/aclocal-$(PKG_VERSION) \ + $(1)/usr/bin/aclocal-$(PKG_VERSION) + $(LN) aclocal-$(PKG_VERSION) $(1)/usr/bin/aclocal + $(FIX_PATHS) $(1)/usr/bin/automake-$(PKG_VERSION) + $(FIX_PATHS) $(1)/usr/bin/aclocal-$(PKG_VERSION) + $(INSTALL_DIR) $(1)/usr/share/automake-$(PKG_VERSION) + + for dir in \ + automake-$(PKG_VERSION) automake-$(PKG_VERSION)/Automake \ + automake-$(PKG_VERSION)/am aclocal \ + aclocal-$(PKG_VERSION) aclocal-$(PKG_VERSION)/internal \ + ; do \ + $(INSTALL_DIR) $(1)/usr/share/$$$$dir; \ + for file in $$$$(cd $(PKG_INSTALL_DIR) && \ + find usr/share/$$$$dir -maxdepth 1 -type f); do \ + $(INSTALL_DATA) $$(PKG_INSTALL_DIR)/$$$$file \ + $(1)/$$$$file; \ + done; \ + done +endef + +$(eval $(call BuildPackage,automake)) diff --git a/devel/diffutils/Makefile b/devel/diffutils/Makefile new file mode 100644 index 0000000..fb00a42 --- /dev/null +++ b/devel/diffutils/Makefile @@ -0,0 +1,62 @@ +# +# Copyright (C) 2008-2015 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:=diffutils +PKG_VERSION:=3.3 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@GNU/diffutils +PKG_MD5SUM:=99180208ec2a82ce71f55b0d7389f1b3 +PKG_MAINTAINER:=Roger D +PKG_LICENSE:=GPL-3.0 + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/diffutils + SECTION:=devel + CATEGORY:=Development + DEPENDS:=+USE_GLIBC:librt + TITLE:=diffutils + URL:=http://www.gnu.org/software/diffutils/ +endef + +define Package/diffutils/description + The Diffutils package contains programs that show the differences between + files or directories. +endef + +CONFIGURE_VARS += \ + ac_cv_func_mempcpy=n +TARGET_CFLAGS += --std=gnu99 + +define Package/diffutils/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{sdiff,diff3,diff,cmp} $(1)/usr/bin/ +endef + +define Package/diffutils/preinst +#!/bin/sh +for x in sdiff diff3 diff cmp; do + [ -L "$${IPKG_INSTROOT}/usr/bin/$$x" ] && rm -f "$${IPKG_INSTROOT}/usr/bin/$$x" +done +exit 0 +endef + +define Package/diffutils/postrm +#!/bin/sh +for x in sdiff diff3 diff cmp; do + /bin/busybox $$x -h 2>&1 | grep -q BusyBox && ln -sf ../../bin/busybox /usr/bin/$$x +done +exit 0 +endef + +$(eval $(call BuildPackage,diffutils)) diff --git a/devel/gcc/Makefile b/devel/gcc/Makefile new file mode 100644 index 0000000..b23b7ab --- /dev/null +++ b/devel/gcc/Makefile @@ -0,0 +1,167 @@ +# +# Copyright (C) 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:=gcc +PKG_VERSION:=5.4.0 +PKG_RELEASE:=1 +PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION) +PKG_MD5SUM:=4c626ac2a83ef30dfb9260e6f59c2b30 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_INSTALL:=1 +PKG_FIXUP:=libtool +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +TARGET_LANGUAGES:="c,c++" +BUGURL=https://dev.openwrt.org/ +PKGVERSION=OpenWrt GCC $(PKG_VERSION) + +# not using sstrip here as this fucks up the .so's somehow +STRIP:=$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)strip +RSTRIP:= \ + NM="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)nm" \ + STRIP="$(STRIP)" \ + STRIP_KMOD="$(STRIP) --strip-debug" \ + $(SCRIPT_DIR)/rstrip.sh + + +define Package/gcc + SECTION:=devel + CATEGORY:=Development + TITLE:=gcc + MAINTAINER:=Noble Pepper + DEPENDS:= +binutils +libstdcpp +endef + +define Package/gcc/description + build a native toolchain for compiling on target +endef + +GMPSRC=gmp-4.3.2 + +define Download/gmp + URL:=ftp://gcc.gnu.org/pub/gcc/infrastructure/ + FILE:=$(GMPSRC).tar.bz2 + MD5SUM:=dd60683d7057917e34630b4a787932e8 +endef +$(eval $(call Download,gmp)) + +MPCSRC=mpc-0.8.1 + +define Download/mpc + URL:=ftp://gcc.gnu.org/pub/gcc/infrastructure/ + FILE:=$(MPCSRC).tar.gz + MD5SUM:=5b34aa804d514cc295414a963aedb6bf +endef +$(eval $(call Download,mpc)) + +MPFRSRC=mpfr-2.4.2 + +define Download/mpfr + URL:=ftp://gcc.gnu.org/pub/gcc/infrastructure/ + FILE:=$(MPFRSRC).tar.bz2 + MD5SUM:=89e59fe665e2b3ad44a6789f40b059a0 +endef +$(eval $(call Download,mpfr)) + +define Build/Prepare + $(PKG_UNPACK) +# we have to download and unpack additional stuff before patching + tar -C $(PKG_BUILD_DIR) -xvjf $(DL_DIR)/$(GMPSRC).tar.bz2 + ln -sf $(PKG_BUILD_DIR)/$(GMPSRC) $(PKG_BUILD_DIR)/gmp + tar -C $(PKG_BUILD_DIR) -xvzf $(DL_DIR)/$(MPCSRC).tar.gz + ln -sf $(PKG_BUILD_DIR)/$(MPCSRC) $(PKG_BUILD_DIR)/mpc + tar -C $(PKG_BUILD_DIR) -xvjf $(DL_DIR)/$(MPFRSRC).tar.bz2 + ln -sf $(PKG_BUILD_DIR)/$(MPFRSRC) $(PKG_BUILD_DIR)/mpfr + $(Build/Patch) +# poor man's fix for `none-openwrt-linux' not recognized when building with musl + cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/mpfr/ + cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/gmp/ + cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/mpc/ +endef + + +define Build/Configure + (cd $(PKG_BUILD_DIR); rm -f config.cache; \ + SHELL="$(BASH)" \ + $(TARGET_CONFIGURE_OPTS) \ + $(PKG_BUILD_DIR)/configure \ + $(CONFIGURE_ARGS) \ + --build=$(GNU_HOST_NAME) \ + --host=$(REAL_GNU_TARGET_NAME) \ + --target=$(REAL_GNU_TARGET_NAME) \ + --enable-languages=$(TARGET_LANGUAGES) \ + --with-bugurl=$(BUGURL) \ + --with-pkgversion="$(PKGVERSION)" \ + --enable-shared \ + $(if $(CONFIG_LIBC_USE_GLIBC),--enable,--disable)-__cxa_atexit \ + --with-default-libstdcxx-abi=gcc4-compatible \ + --enable-target-optspace \ + --with-gnu-ld \ + --disable-nls \ + --disable-libsanitizer \ + --disable-libvtv \ + --disable-libcilkrts \ + --disable-libmudflap \ + --disable-multilib \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libssp \ + --disable-decimal-float \ + --disable-libstdcxx-pch \ + --with-host-libstdcxx=-lstdc++ \ + --prefix=/usr \ + --libexecdir=/usr/lib \ + --with-local-prefix=/usr \ + $(SOFT_FLOAT_CONFIG_OPTION) \ + $(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \ + ); +endef + +define Build/Compile + export SHELL="$(BASH)"; $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" $(MAKE_ARGS) all install +endef + +ENVCFLAGS:="$(TARGET_OPTIMIZATION) $(EXTRA_OPTIMIZATION) +ifeq ($(CONFIG_SOFT_FLOAT),y) + ifeq ($(CONFIG_arm),y) + ENVCFLAGS+= -mfloat-abi=soft + else + ENVCFLAGS+= -msoft-float + endif +endif +ENVCFLAGS+=" + +ENVLDFLAGS:="-Wl,-rpath=/usr/lib -Wl,--dynamic-linker=/usr/lib/$(DYNLINKER) -L/usr/lib" + +define Package/gcc/install + $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION) + cp -ar $(PKG_INSTALL_DIR)/usr/include $(1)/usr + cp -a $(PKG_INSTALL_DIR)/usr/bin/{$(REAL_GNU_TARGET_NAME)-{g++,gcc},cpp,gcov} $(1)/usr/bin + ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/c++ + ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/g++ + ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-c++ + ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/gcc + ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc-$(PKG_VERSION) + cp -ar $(PKG_INSTALL_DIR)/usr/lib/gcc $(1)/usr/lib + cp -ar $(TOOLCHAIN_DIR)/include $(1)/usr + cp -a $(TOOLCHAIN_DIR)/lib/*.{o,so*} $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION) + cp -a $(TOOLCHAIN_DIR)/lib/*nonshared*.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION) + cp -a $(TOOLCHAIN_DIR)/lib/libm.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION) + rm -f $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/libgo* + rm -f $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/libcc1* + echo '#!/bin/sh' > $(1)/usr/bin/gcc_env.sh + echo 'export LDFLAGS=$(ENVLDFLAGS)' >> $(1)/usr/bin/gcc_env.sh + echo 'export CFLAGS=$(ENVCFLAGS)' >> $(1)/usr/bin/gcc_env.sh + chmod +x $(1)/usr/bin/gcc_env.sh +endef + +$(eval $(call BuildPackage,gcc)) diff --git a/devel/gcc/README b/devel/gcc/README new file mode 100644 index 0000000..58db474 --- /dev/null +++ b/devel/gcc/README @@ -0,0 +1,10 @@ +Native GCC that runs on target. + +To save disk space, this GCC only supports dynamic linking on the target box, +there are no static libraries shipped except libgcc.a on those architectures +that need it. + +For now, this was only tested on arm (EABI) and mips targets. Others to be +done... + + Christian Beier diff --git a/devel/gcc/patches/001-revert_register_mode_search.patch b/devel/gcc/patches/001-revert_register_mode_search.patch new file mode 100644 index 0000000..06373eb --- /dev/null +++ b/devel/gcc/patches/001-revert_register_mode_search.patch @@ -0,0 +1,65 @@ +Revert of: + +commit 275035b56823b26d5fb7e90fad945b998648edf2 +Author: bergner +Date: Thu Sep 5 14:09:07 2013 +0000 + + PR target/58139 + * reginfo.c (choose_hard_reg_mode): Scan through all mode classes + looking for widest mode. + + + git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202286 138bc75d-0d04-0410-961f-82ee72b054a4 + + +--- a/gcc/reginfo.c ++++ b/gcc/reginfo.c +@@ -665,35 +665,40 @@ choose_hard_reg_mode (unsigned int regno + mode = GET_MODE_WIDER_MODE (mode)) + if ((unsigned) hard_regno_nregs[regno][mode] == nregs + && HARD_REGNO_MODE_OK (regno, mode) +- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) +- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) ++ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) + found_mode = mode; + ++ if (found_mode != VOIDmode) ++ return found_mode; ++ + for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT); + mode != VOIDmode; + mode = GET_MODE_WIDER_MODE (mode)) + if ((unsigned) hard_regno_nregs[regno][mode] == nregs + && HARD_REGNO_MODE_OK (regno, mode) +- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) +- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) ++ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) + found_mode = mode; + ++ if (found_mode != VOIDmode) ++ return found_mode; ++ + for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT); + mode != VOIDmode; + mode = GET_MODE_WIDER_MODE (mode)) + if ((unsigned) hard_regno_nregs[regno][mode] == nregs + && HARD_REGNO_MODE_OK (regno, mode) +- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) +- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) ++ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) + found_mode = mode; + ++ if (found_mode != VOIDmode) ++ return found_mode; ++ + for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT); + mode != VOIDmode; + mode = GET_MODE_WIDER_MODE (mode)) + if ((unsigned) hard_regno_nregs[regno][mode] == nregs + && HARD_REGNO_MODE_OK (regno, mode) +- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) +- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) ++ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) + found_mode = mode; + + if (found_mode != VOIDmode) diff --git a/devel/gcc/patches/002-case_insensitive.patch b/devel/gcc/patches/002-case_insensitive.patch new file mode 100644 index 0000000..b3d2dbe --- /dev/null +++ b/devel/gcc/patches/002-case_insensitive.patch @@ -0,0 +1,14 @@ +--- a/include/filenames.h ++++ b/include/filenames.h +@@ -43,11 +43,6 @@ extern "C" { + # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c) + # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f) + #else /* not DOSish */ +-# if defined(__APPLE__) +-# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM +-# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1 +-# endif +-# endif /* __APPLE__ */ + # define HAS_DRIVE_SPEC(f) (0) + # define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c) + # define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f) diff --git a/devel/gcc/patches/002-dont-choke-when-building-32bit-on-64bit.patch b/devel/gcc/patches/002-dont-choke-when-building-32bit-on-64bit.patch new file mode 100644 index 0000000..a00cbcd --- /dev/null +++ b/devel/gcc/patches/002-dont-choke-when-building-32bit-on-64bit.patch @@ -0,0 +1,14 @@ +--- a/gcc/real.h ++++ b/gcc/real.h +@@ -75,9 +75,10 @@ + + (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ? 1 : 0)) /* round up */ + + /* Verify the guess. */ ++#ifndef __LP64__ + extern char test_real_width + [sizeof (REAL_VALUE_TYPE) <= REAL_WIDTH * sizeof (HOST_WIDE_INT) ? 1 : -1]; +- ++#endif + /* Calculate the format for CONST_DOUBLE. We need as many slots as + are necessary to overlay a REAL_VALUE_TYPE on them. This could be + as many as four (32-bit HOST_WIDE_INT, 128-bit REAL_VALUE_TYPE). diff --git a/devel/gcc/patches/003-mpfr-longlong-mips.patch b/devel/gcc/patches/003-mpfr-longlong-mips.patch new file mode 100644 index 0000000..0ab9fe5 --- /dev/null +++ b/devel/gcc/patches/003-mpfr-longlong-mips.patch @@ -0,0 +1,38 @@ +diff -Naurd mpfr-2.4.2-a/mpfr-longlong.h mpfr-2.4.2-b/mpfr-longlong.h +--- -a/mpfr-2.4.2/mpfr-longlong.h 2009-11-30 02:43:08.000000000 +0000 ++++ -b/mpfr-2.4.2/mpfr-longlong.h 2009-12-18 12:04:29.000000000 +0000 +@@ -1011,7 +1011,15 @@ + #endif /* __m88000__ */ + + #if defined (__mips) && W_TYPE_SIZE == 32 +-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7 ++#if (__GNUC__ >= 5) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 4) ++#define umul_ppmm(w1, w0, u, v) \ ++ do { \ ++ UDItype _r; \ ++ _r = (UDItype) u * v; \ ++ (w1) = _r >> 32; \ ++ (w0) = (USItype) _r; \ ++ } while (0) ++#elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7 + #define umul_ppmm(w1, w0, u, v) \ + __asm__ ("multu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v)) + #else +@@ -1024,7 +1032,16 @@ + #endif /* __mips */ + + #if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64 +-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7 ++#if (__GNUC__ >= 5) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 4) ++typedef unsigned int UTItype __attribute__ ((mode (TI))); ++#define umul_ppmm(w1, w0, u, v) \ ++ do { \ ++ UTItype _r; \ ++ _r = (UTItype) u * v; \ ++ (w1) = _r >> 64; \ ++ (w0) = (UDItype) _r; \ ++ } while (0) ++#elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7 + #define umul_ppmm(w1, w0, u, v) \ + __asm__ ("dmultu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v)) + #else diff --git a/devel/gcc/patches/010-documentation.patch b/devel/gcc/patches/010-documentation.patch new file mode 100644 index 0000000..07064a9 --- /dev/null +++ b/devel/gcc/patches/010-documentation.patch @@ -0,0 +1,23 @@ +--- a/gcc/Makefile.in ++++ b/gcc/Makefile.in +@@ -2941,18 +2941,10 @@ doc/gcc.info: $(TEXI_GCC_FILES) + doc/gccint.info: $(TEXI_GCCINT_FILES) + doc/cppinternals.info: $(TEXI_CPPINT_FILES) + +-doc/%.info: %.texi +- if [ x$(BUILD_INFO) = xinfo ]; then \ +- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \ +- -I $(gcc_docdir)/include -o $@ $<; \ +- fi ++doc/%.info: + + # Duplicate entry to handle renaming of gccinstall.info +-doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES) +- if [ x$(BUILD_INFO) = xinfo ]; then \ +- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \ +- -I $(gcc_docdir)/include -o $@ $<; \ +- fi ++doc/gccinstall.info: + + doc/cpp.dvi: $(TEXI_CPP_FILES) + doc/gcc.dvi: $(TEXI_GCC_FILES) diff --git a/devel/gcc/patches/020-no-plt-backport.patch b/devel/gcc/patches/020-no-plt-backport.patch new file mode 100644 index 0000000..b9702c9 --- /dev/null +++ b/devel/gcc/patches/020-no-plt-backport.patch @@ -0,0 +1,28 @@ +--- a/gcc/calls.c ++++ b/gcc/calls.c +@@ -225,6 +225,12 @@ prepare_call_address (tree fndecl_or_typ + && targetm.small_register_classes_for_mode_p (FUNCTION_MODE)) + ? force_not_mem (memory_address (FUNCTION_MODE, funexp)) + : memory_address (FUNCTION_MODE, funexp)); ++ else if (flag_pic && !flag_plt && fndecl_or_type ++ && TREE_CODE (fndecl_or_type) == FUNCTION_DECL ++ && !targetm.binds_local_p (fndecl_or_type)) ++ { ++ funexp = force_reg (Pmode, funexp); ++ } + else if (! sibcallp) + { + #ifndef NO_FUNCTION_CSE +--- a/gcc/common.opt ++++ b/gcc/common.opt +@@ -1779,6 +1779,10 @@ fpie + Common Report Var(flag_pie,1) Negative(fPIC) + Generate position-independent code for executables if possible (small mode) + ++fplt ++Common Report Var(flag_plt) Init(1) ++Use PLT for PIC calls (-fno-plt: load the address from GOT at call site) ++ + fplugin= + Common Joined RejectNegative Var(common_deferred_options) Defer + Specify a plugin to load diff --git a/devel/gcc/patches/040-fix-mips-ICE-PR-68400.patch b/devel/gcc/patches/040-fix-mips-ICE-PR-68400.patch new file mode 100644 index 0000000..e88af34 --- /dev/null +++ b/devel/gcc/patches/040-fix-mips-ICE-PR-68400.patch @@ -0,0 +1,23 @@ +--- a/gcc/config/mips/mips.c ++++ b/gcc/config/mips/mips.c +@@ -8001,9 +8001,17 @@ mask_low_and_shift_p (machine_mode mode, + bool + and_operands_ok (machine_mode mode, rtx op1, rtx op2) + { +- return (memory_operand (op1, mode) +- ? and_load_operand (op2, mode) +- : and_reg_operand (op2, mode)); ++ if (!memory_operand (op1, mode)) ++ return and_reg_operand (op2, mode); ++ ++ if (!and_load_operand (op2, mode)) ++ return false; ++ ++ if (!TARGET_MIPS16 || si_mask_operand(op2, mode)) ++ return true; ++ ++ op1 = XEXP (op1, 0); ++ return !(REG_P (op1) && REGNO (op1) == STACK_POINTER_REGNUM); + } + + /* The canonical form of a mask-low-and-shift-left operation is diff --git a/devel/gcc/patches/100-uclibc-conf.patch b/devel/gcc/patches/100-uclibc-conf.patch new file mode 100644 index 0000000..ff9ad94 --- /dev/null +++ b/devel/gcc/patches/100-uclibc-conf.patch @@ -0,0 +1,33 @@ +--- a/contrib/regression/objs-gcc.sh ++++ b/contrib/regression/objs-gcc.sh +@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H + then + make all-gdb all-dejagnu all-ld || exit 1 + make install-gdb install-dejagnu install-ld || exit 1 ++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ] ++ then ++ make all-gdb all-dejagnu all-ld || exit 1 ++ make install-gdb install-dejagnu install-ld || exit 1 + elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then + make bootstrap || exit 1 + make install || exit 1 +--- a/libjava/classpath/ltconfig ++++ b/libjava/classpath/ltconfig +@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)- + + # Transform linux* to *-*-linux-gnu*, to support old configure scripts. + case $host_os in +-linux-gnu*) ;; ++linux-gnu*|linux-uclibc*) ;; + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` + esac + +@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux*) + version_type=linux + need_lib_prefix=no + need_version=no diff --git a/devel/gcc/patches/200-musl_config.patch b/devel/gcc/patches/200-musl_config.patch new file mode 100644 index 0000000..b9a5b28 --- /dev/null +++ b/devel/gcc/patches/200-musl_config.patch @@ -0,0 +1,309 @@ +From: ktkachov +Date: Fri, 8 May 2015 08:25:47 +0000 (+0000) +Subject: [PATCH 2/13] musl libc config +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=a9173ceabaf29c16f8ef226fbf98af373a4b2ceb + +[PATCH 2/13] musl libc config + +2015-05-08 Gregor Richards + Szabolcs Nagy + + * config.gcc (LIBC_MUSL): New tm_defines macro. + * config/linux.h (OPTION_MUSL): Define. + (MUSL_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER32,) + (MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERX32,) + (INCLUDE_DEFAULTS_MUSL_GPP, INCLUDE_DEFAULTS_MUSL_LOCAL,) + (INCLUDE_DEFAULTS_MUSL_PREFIX, INCLUDE_DEFAULTS_MUSL_CROSS,) + (INCLUDE_DEFAULTS_MUSL_TOOL, INCLUDE_DEFAULTS_MUSL_NATIVE): Define. + * config/linux.opt (mmusl): New option. + * doc/invoke.texi (GNU/Linux Options): Document -mmusl. + * configure.ac (gcc_cv_libc_provides_ssp): Add *-*-musl*. + (gcc_cv_target_dl_iterate_phdr): Add *-linux-musl*. + * configure: Regenerate. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222904 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -575,7 +575,7 @@ case ${target} in + esac + + # Common C libraries. +-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3" ++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4" + + # 32-bit x86 processors supported by --with-arch=. Each processor + # MUST be separated by exactly one space. +@@ -720,6 +720,9 @@ case ${target} in + *-*-*uclibc*) + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC" + ;; ++ *-*-*musl*) ++ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL" ++ ;; + *) + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC" + ;; +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -32,10 +32,12 @@ see the files COPYING3 and COPYING.RUNTI + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) ++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) + #else + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) ++#define OPTION_MUSL (linux_libc == LIBC_MUSL) + #endif + + #define GNU_USER_TARGET_OS_CPP_BUILTINS() \ +@@ -50,21 +52,25 @@ see the files COPYING3 and COPYING.RUNTI + } while (0) + + /* Determine which dynamic linker to use depending on whether GLIBC or +- uClibc or Bionic is the default C library and whether +- -muclibc or -mglibc or -mbionic has been passed to change the default. */ ++ uClibc or Bionic or musl is the default C library and whether ++ -muclibc or -mglibc or -mbionic or -mmusl has been passed to change ++ the default. */ + +-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \ +- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}" ++#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \ ++ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}" + + #if DEFAULT_LIBC == LIBC_GLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ +- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B) ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M) + #elif DEFAULT_LIBC == LIBC_UCLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ +- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B) ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M) + #elif DEFAULT_LIBC == LIBC_BIONIC +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ +- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U) ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M) ++#elif DEFAULT_LIBC == LIBC_MUSL ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B) + #else + #error "Unsupported DEFAULT_LIBC" + #endif /* DEFAULT_LIBC */ +@@ -81,24 +87,100 @@ see the files COPYING3 and COPYING.RUNTI + #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker" + #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64" + #define BIONIC_DYNAMIC_LINKERX32 "/system/bin/linkerx32" ++/* Should be redefined for each target that supports musl. */ ++#define MUSL_DYNAMIC_LINKER "/dev/null" ++#define MUSL_DYNAMIC_LINKER32 "/dev/null" ++#define MUSL_DYNAMIC_LINKER64 "/dev/null" ++#define MUSL_DYNAMIC_LINKERX32 "/dev/null" + + #define GNU_USER_DYNAMIC_LINKER \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \ +- BIONIC_DYNAMIC_LINKER) ++ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER) + #define GNU_USER_DYNAMIC_LINKER32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \ +- BIONIC_DYNAMIC_LINKER32) ++ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32) + #define GNU_USER_DYNAMIC_LINKER64 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \ +- BIONIC_DYNAMIC_LINKER64) ++ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64) + #define GNU_USER_DYNAMIC_LINKERX32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \ +- BIONIC_DYNAMIC_LINKERX32) ++ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32) + + /* Whether we have Bionic libc runtime */ + #undef TARGET_HAS_BIONIC + #define TARGET_HAS_BIONIC (OPTION_BIONIC) + ++/* musl avoids problematic includes by rearranging the include directories. ++ * Unfortunately, this is mostly duplicated from cppdefault.c */ ++#if DEFAULT_LIBC == LIBC_MUSL ++#define INCLUDE_DEFAULTS_MUSL_GPP \ ++ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \ ++ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \ ++ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, ++ ++#ifdef LOCAL_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_LOCAL \ ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \ ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 }, ++#else ++#define INCLUDE_DEFAULTS_MUSL_LOCAL ++#endif ++ ++#ifdef PREFIX_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_PREFIX \ ++ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_PREFIX ++#endif ++ ++#ifdef CROSS_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_CROSS \ ++ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_CROSS ++#endif ++ ++#ifdef TOOL_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_TOOL \ ++ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_TOOL ++#endif ++ ++#ifdef NATIVE_SYSTEM_HEADER_DIR ++#define INCLUDE_DEFAULTS_MUSL_NATIVE \ ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, ++#else ++#define INCLUDE_DEFAULTS_MUSL_NATIVE ++#endif ++ ++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT) ++# undef INCLUDE_DEFAULTS_MUSL_LOCAL ++# define INCLUDE_DEFAULTS_MUSL_LOCAL ++# undef INCLUDE_DEFAULTS_MUSL_NATIVE ++# define INCLUDE_DEFAULTS_MUSL_NATIVE ++#else ++# undef INCLUDE_DEFAULTS_MUSL_CROSS ++# define INCLUDE_DEFAULTS_MUSL_CROSS ++#endif ++ ++#undef INCLUDE_DEFAULTS ++#define INCLUDE_DEFAULTS \ ++ { \ ++ INCLUDE_DEFAULTS_MUSL_GPP \ ++ INCLUDE_DEFAULTS_MUSL_PREFIX \ ++ INCLUDE_DEFAULTS_MUSL_CROSS \ ++ INCLUDE_DEFAULTS_MUSL_TOOL \ ++ INCLUDE_DEFAULTS_MUSL_NATIVE \ ++ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ ++ { 0, 0, 0, 0, 0, 0 } \ ++ } ++#endif ++ + #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */ + /* This is a *uclinux* target. We don't define below macros to normal linux + versions, because doing so would require *uclinux* targets to include +--- a/gcc/config/linux.opt ++++ b/gcc/config/linux.opt +@@ -28,5 +28,9 @@ Target Report RejectNegative Var(linux_l + Use GNU C library + + muclibc +-Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic) ++Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mmusl) + Use uClibc C library ++ ++mmusl ++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mbionic) ++Use musl C library +--- a/gcc/configure ++++ b/gcc/configure +@@ -27833,6 +27833,9 @@ if test "${gcc_cv_libc_provides_ssp+set} + else + gcc_cv_libc_provides_ssp=no + case "$target" in ++ *-*-musl*) ++ # All versions of musl provide stack protector ++ gcc_cv_libc_provides_ssp=yes;; + *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu) + # glibc 2.4 and later provides __stack_chk_fail and + # either __stack_chk_guard, or TLS access to stack guard canary. +@@ -27865,6 +27868,7 @@ fi + # ) and for now + # simply assert that glibc does provide this, which is true for all + # realistically usable GNU/Hurd configurations. ++ # All supported versions of musl provide it as well + gcc_cv_libc_provides_ssp=yes;; + *-*-darwin* | *-*-freebsd*) + ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail" +@@ -27961,6 +27965,9 @@ case "$target" in + gcc_cv_target_dl_iterate_phdr=no + fi + ;; ++ *-linux-musl*) ++ gcc_cv_target_dl_iterate_phdr=yes ++ ;; + esac + + if test x$gcc_cv_target_dl_iterate_phdr = xyes; then +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -5287,6 +5287,9 @@ AC_CACHE_CHECK(__stack_chk_fail in targe + gcc_cv_libc_provides_ssp, + [gcc_cv_libc_provides_ssp=no + case "$target" in ++ *-*-musl*) ++ # All versions of musl provide stack protector ++ gcc_cv_libc_provides_ssp=yes;; + *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu) + # glibc 2.4 and later provides __stack_chk_fail and + # either __stack_chk_guard, or TLS access to stack guard canary. +@@ -5313,6 +5316,7 @@ AC_CACHE_CHECK(__stack_chk_fail in targe + # ) and for now + # simply assert that glibc does provide this, which is true for all + # realistically usable GNU/Hurd configurations. ++ # All supported versions of musl provide it as well + gcc_cv_libc_provides_ssp=yes;; + *-*-darwin* | *-*-freebsd*) + AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes], +@@ -5386,6 +5390,9 @@ case "$target" in + gcc_cv_target_dl_iterate_phdr=no + fi + ;; ++ *-linux-musl*) ++ gcc_cv_target_dl_iterate_phdr=yes ++ ;; + esac + GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR]) + if test x$gcc_cv_target_dl_iterate_phdr = xyes; then +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -667,7 +667,7 @@ Objective-C and Objective-C++ Dialects}. + -mcpu=@var{cpu}} + + @emph{GNU/Linux Options} +-@gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol ++@gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol + -tno-android-cc -tno-android-ld} + + @emph{H8/300 Options} +@@ -15340,13 +15340,19 @@ These @samp{-m} options are defined for + @item -mglibc + @opindex mglibc + Use the GNU C library. This is the default except +-on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets. ++on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and ++@samp{*-*-linux-*android*} targets. + + @item -muclibc + @opindex muclibc + Use uClibc C library. This is the default on + @samp{*-*-linux-*uclibc*} targets. + ++@item -mmusl ++@opindex mmusl ++Use the musl C library. This is the default on ++@samp{*-*-linux-*musl*} targets. ++ + @item -mbionic + @opindex mbionic + Use Bionic C library. This is the default on diff --git a/devel/gcc/patches/201-musl_arm.patch b/devel/gcc/patches/201-musl_arm.patch new file mode 100644 index 0000000..27a26af --- /dev/null +++ b/devel/gcc/patches/201-musl_arm.patch @@ -0,0 +1,43 @@ +From: ktkachov +Date: Wed, 27 May 2015 13:17:11 +0000 (+0000) +Subject: [PATCH 4/13] arm musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=de799bd087ab9a179768fea75bd195a31d3432a4 + +[PATCH 4/13] arm musl support + +On behalf of szabolcs.nagy@arm.com + +2015-05-27 Gregor Richards + + * config/arm/linux-eabi.h (MUSL_DYNAMIC_LINKER): Define. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223749 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -77,6 +77,23 @@ + %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \ + %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}" + ++/* For ARM musl currently supports four dynamic linkers: ++ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI ++ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI ++ - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB ++ - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB ++ musl does not support the legacy OABI mode. ++ All the dynamic linkers live in /lib. ++ We default to soft-float, EL. */ ++#undef MUSL_DYNAMIC_LINKER ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}" ++#else ++#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}" ++#endif ++#define MUSL_DYNAMIC_LINKER \ ++ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1" ++ + /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to + use the GNU/Linux version, not the generic BPABI version. */ + #undef LINK_SPEC diff --git a/devel/gcc/patches/202-musl_mips.patch b/devel/gcc/patches/202-musl_mips.patch new file mode 100644 index 0000000..816dd8d --- /dev/null +++ b/devel/gcc/patches/202-musl_mips.patch @@ -0,0 +1,35 @@ +From: ktkachov +Date: Fri, 8 May 2015 15:16:50 +0000 (+0000) +Subject: [PATCH 6/13] mips musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=2550b6a866c887472b587bef87d433c51cf1ebc8 + +[PATCH 6/13] mips musl support + +2015-05-08 Gregor Richards + Szabolcs Nagy + + * config/mips/linux.h (MUSL_DYNAMIC_LINKER32): Define. + (MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERN32): Define. + (GNU_USER_DYNAMIC_LINKERN32): Update. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222915 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/gcc/config/mips/linux.h ++++ b/gcc/config/mips/linux.h +@@ -37,7 +37,13 @@ along with GCC; see the file COPYING3. + #define UCLIBC_DYNAMIC_LINKERN32 \ + "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}" + ++#undef MUSL_DYNAMIC_LINKER32 ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips%{EL:el}%{msoft-float:-sf}.so.1" ++#undef MUSL_DYNAMIC_LINKER64 ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips64%{EL:el}%{msoft-float:-sf}.so.1" ++#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mipsn32%{EL:el}%{msoft-float:-sf}.so.1" ++ + #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32" + #define GNU_USER_DYNAMIC_LINKERN32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \ +- BIONIC_DYNAMIC_LINKERN32) ++ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32) diff --git a/devel/gcc/patches/203-musl_powerpc.patch b/devel/gcc/patches/203-musl_powerpc.patch new file mode 100644 index 0000000..b4f34e8 --- /dev/null +++ b/devel/gcc/patches/203-musl_powerpc.patch @@ -0,0 +1,209 @@ + +gcc/Changelog: + +2015-04-24 Gregor Richards + Szabolcs Nagy + + * config.gcc (secure_plt): Add *-linux*-musl*. + * config/rs6000/linux64.h (MUSL_DYNAMIC_LINKER32): Define. + (MUSL_DYNAMIC_LINKER64): Define. + (GNU_USER_DYNAMIC_LINKER32): Update. + (GNU_USER_DYNAMIC_LINKER64): Update. + (CHOOSE_DYNAMIC_LINKER): Update. + + * config/rs6000/secureplt.h (LINK_SECURE_PLT_DEFAULT_SPEC): Define. + * config/rs6000/sysv4.h (GNU_USER_DYNAMIC_LINKER): Update. + (MUSL_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER_E,) + (INCLUDE_DEFAULTS_MUSL_GPP, INCLUDE_DEFAULTS_MUSL_LOCAL,) + (INCLUDE_DEFAULTS_MUSL_PREFIX, INCLUDE_DEFAULTS_MUSL_CROSS,) + (INCLUDE_DEFAULTS_MUSL_TOOL, INCLUDE_DEFAULTS_MUSL_NATIVE): Define. + (LINK_SECURE_PLT_DEFAULT_SPEC): Define. + (CHOOSE_DYNAMIC_LINKER, LINK_TARGET_SPEC, LINK_OS_LINUX_SPEC): Update. + + * config/rs6000/sysv4le.h (MUSL_DYNAMIC_LINKER_E): Define. + +--- a/gcc/config/rs6000/linux64.h ++++ b/gcc/config/rs6000/linux64.h +@@ -365,17 +365,21 @@ extern int dot_symbols; + #endif + #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" + #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E ".so.1" ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E ".so.1" + #if DEFAULT_LIBC == LIBC_UCLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}" + #elif DEFAULT_LIBC == LIBC_GLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}" ++#elif DEFAULT_LIBC == LIBC_MUSL ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}" + #else + #error "Unsupported DEFAULT_LIBC" + #endif + #define GNU_USER_DYNAMIC_LINKER32 \ +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32) ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32) + #define GNU_USER_DYNAMIC_LINKER64 \ +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64) ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64) + + #undef DEFAULT_ASM_ENDIAN + #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN) +--- a/gcc/config/rs6000/secureplt.h ++++ b/gcc/config/rs6000/secureplt.h +@@ -18,3 +18,4 @@ along with GCC; see the file COPYING3. + . */ + + #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt" ++#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt" +--- a/gcc/config/rs6000/sysv4.h ++++ b/gcc/config/rs6000/sysv4.h +@@ -537,6 +537,9 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF + #ifndef CC1_SECURE_PLT_DEFAULT_SPEC + #define CC1_SECURE_PLT_DEFAULT_SPEC "" + #endif ++#ifndef LINK_SECURE_PLT_DEFAULT_SPEC ++#define LINK_SECURE_PLT_DEFAULT_SPEC "" ++#endif + + /* Pass -G xxx to the compiler. */ + #undef CC1_SPEC +@@ -574,7 +577,8 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF + %{R*} \ + %(link_shlib) \ + %{!T*: %(link_start) } \ +-%(link_os)" ++%(link_os)" \ ++"%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}" + + /* Shared libraries are not default. */ + #define LINK_SHLIB_SPEC "\ +@@ -757,17 +761,22 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF + + #define LINK_START_LINUX_SPEC "" + ++#define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","") ++ + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" + #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E ".so.1" + #if DEFAULT_LIBC == LIBC_UCLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}" ++#elif DEFAULT_LIBC == LIBC_MUSL ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}" + #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}" + #else + #error "Unsupported DEFAULT_LIBC" + #endif + #define GNU_USER_DYNAMIC_LINKER \ +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER) ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER) + + #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \ + %{rdynamic:-export-dynamic} \ +@@ -889,6 +898,7 @@ ncrtn.o%s" + { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \ + { "link_os_default", LINK_OS_DEFAULT_SPEC }, \ + { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \ ++ { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \ + { "cpp_os_ads", CPP_OS_ADS_SPEC }, \ + { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \ + { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \ +@@ -943,3 +953,72 @@ ncrtn.o%s" + /* This target uses the sysv4.opt file. */ + #define TARGET_USES_SYSV4_OPT 1 + ++/* Include order changes for musl, same as in generic linux.h. */ ++#if DEFAULT_LIBC == LIBC_MUSL ++#define INCLUDE_DEFAULTS_MUSL_GPP \ ++ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \ ++ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \ ++ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, ++ ++#ifdef LOCAL_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_LOCAL \ ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \ ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 }, ++#else ++#define INCLUDE_DEFAULTS_MUSL_LOCAL ++#endif ++ ++#ifdef PREFIX_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_PREFIX \ ++ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_PREFIX ++#endif ++ ++#ifdef CROSS_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_CROSS \ ++ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_CROSS ++#endif ++ ++#ifdef TOOL_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_TOOL \ ++ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_TOOL ++#endif ++ ++#ifdef NATIVE_SYSTEM_HEADER_DIR ++#define INCLUDE_DEFAULTS_MUSL_NATIVE \ ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, ++#else ++#define INCLUDE_DEFAULTS_MUSL_NATIVE ++#endif ++ ++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT) ++# undef INCLUDE_DEFAULTS_MUSL_LOCAL ++# define INCLUDE_DEFAULTS_MUSL_LOCAL ++# undef INCLUDE_DEFAULTS_MUSL_NATIVE ++# define INCLUDE_DEFAULTS_MUSL_NATIVE ++#else ++# undef INCLUDE_DEFAULTS_MUSL_CROSS ++# define INCLUDE_DEFAULTS_MUSL_CROSS ++#endif ++ ++#undef INCLUDE_DEFAULTS ++#define INCLUDE_DEFAULTS \ ++ { \ ++ INCLUDE_DEFAULTS_MUSL_GPP \ ++ INCLUDE_DEFAULTS_MUSL_PREFIX \ ++ INCLUDE_DEFAULTS_MUSL_CROSS \ ++ INCLUDE_DEFAULTS_MUSL_TOOL \ ++ INCLUDE_DEFAULTS_MUSL_NATIVE \ ++ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ ++ { 0, 0, 0, 0, 0, 0 } \ ++ } ++#endif +--- a/gcc/config/rs6000/sysv4le.h ++++ b/gcc/config/rs6000/sysv4le.h +@@ -31,3 +31,5 @@ + /* Little-endian PowerPC64 Linux uses the ELF v2 ABI by default. */ + #define LINUX64_DEFAULT_ABI_ELFv2 + ++#undef MUSL_DYNAMIC_LINKER_E ++#define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","le") +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -2416,6 +2416,10 @@ powerpc*-*-linux*) + powerpc*-*-linux*paired*) + tm_file="${tm_file} rs6000/750cl.h" ;; + esac ++ case ${target} in ++ *-linux*-musl*) ++ enable_secureplt=yes ;; ++ esac + if test x${enable_secureplt} = xyes; then + tm_file="rs6000/secureplt.h ${tm_file}" + fi diff --git a/devel/gcc/patches/204-musl_sh.patch b/devel/gcc/patches/204-musl_sh.patch new file mode 100644 index 0000000..8c3753d --- /dev/null +++ b/devel/gcc/patches/204-musl_sh.patch @@ -0,0 +1,39 @@ +gcc/Changelog: + +2015-04-27 Gregor Richards + Szabolcs Nagy + + * config/sh/linux.h (MUSL_DYNAMIC_LINKER): Define. + (MUSL_DYNAMIC_LINKER_E, MUSL_DYNAMIC_LINKER_FP): Define. + +--- a/gcc/config/sh/linux.h ++++ b/gcc/config/sh/linux.h +@@ -43,6 +43,28 @@ along with GCC; see the file COPYING3. + + #define TARGET_ASM_FILE_END file_end_indicate_exec_stack + ++#if TARGET_ENDIAN_DEFAULT == MASK_LITTLE_ENDIAN ++#define MUSL_DYNAMIC_LINKER_E "%{mb:eb}" ++#else ++#define MUSL_DYNAMIC_LINKER_E "%{!ml:eb}" ++#endif ++ ++#if TARGET_CPU_DEFAULT & ( MASK_HARD_SH2A_DOUBLE | MASK_SH4 ) ++/* "-nofpu" if any nofpu option is specified */ ++#define MUSL_DYNAMIC_LINKER_FP \ ++ "%{m1|m2|m2a-nofpu|m3|m4-nofpu|m4-100-nofpu|m4-200-nofpu|m4-300-nofpu|" \ ++ "m4-340|m4-400|m4-500|m4al|m5-32media-nofpu|m5-64media-nofpu|" \ ++ "m5-compact-nofpu:-nofpu}" ++#else ++/* "-nofpu" if none of the hard fpu options are specified */ ++#define MUSL_DYNAMIC_LINKER_FP \ ++ "%{m2a|m4|m4-100|m4-200|m4-300|m4a|m5-32media|m5-64media|m5-compact:;:-nofpu}" ++#endif ++ ++#undef MUSL_DYNAMIC_LINKER ++#define MUSL_DYNAMIC_LINKER \ ++ "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP ".so.1" ++ + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + + #undef SUBTARGET_LINK_EMUL_SUFFIX diff --git a/devel/gcc/patches/205-musl_x86.patch b/devel/gcc/patches/205-musl_x86.patch new file mode 100644 index 0000000..8772328 --- /dev/null +++ b/devel/gcc/patches/205-musl_x86.patch @@ -0,0 +1,41 @@ +From: ktkachov +Date: Fri, 15 May 2015 13:20:01 +0000 (+0000) +Subject: [PATCH 9/13] x86 musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=5551c8d927c17f60837f15f8dfe46f945ba3fa9c + +[PATCH 9/13] x86 musl support + +On behalf of Szabolcs Nagy. + +2015-05-15 Gregor Richards + + * config/i386/linux.h (MUSL_DYNAMIC_LINKER): Define. + * config/i386/linux64.h (MUSL_DYNAMIC_LINKER32): Define. + (MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERX32): Define. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223218 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/gcc/config/i386/linux.h ++++ b/gcc/config/i386/linux.h +@@ -21,3 +21,6 @@ along with GCC; see the file COPYING3. + + #define GNU_USER_LINK_EMULATION "elf_i386" + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++ ++#undef MUSL_DYNAMIC_LINKER ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1" +--- a/gcc/config/i386/linux64.h ++++ b/gcc/config/i386/linux64.h +@@ -30,3 +30,10 @@ see the files COPYING3 and COPYING.RUNTI + #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2" + #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2" + #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2" ++ ++#undef MUSL_DYNAMIC_LINKER32 ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1" ++#undef MUSL_DYNAMIC_LINKER64 ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1" ++#undef MUSL_DYNAMIC_LINKERX32 ++#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1" diff --git a/devel/gcc/patches/206-musl_aarch64.patch b/devel/gcc/patches/206-musl_aarch64.patch new file mode 100644 index 0000000..6925a02 --- /dev/null +++ b/devel/gcc/patches/206-musl_aarch64.patch @@ -0,0 +1,31 @@ +From: jgreenhalgh +Date: Wed, 27 May 2015 16:46:39 +0000 (+0000) +Subject: [PATCH 3/13] aarch64 musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=b3ff21cf0531be91bc3fb8200296a7633090ec78 + +[PATCH 3/13] aarch64 musl support + +gcc/Changelog: + +2015-05-27 Gregor Richards + Szabolcs Nagy + + * config/aarch64/aarch64-linux.h (MUSL_DYNAMIC_LINKER): Define. + + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223766 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/gcc/config/aarch64/aarch64-linux.h ++++ b/gcc/config/aarch64/aarch64-linux.h +@@ -23,6 +23,9 @@ + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" + ++#undef MUSL_DYNAMIC_LINKER ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" ++ + #undef ASAN_CC1_SPEC + #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}" + diff --git a/devel/gcc/patches/207-musl_fixincludes.patch b/devel/gcc/patches/207-musl_fixincludes.patch new file mode 100644 index 0000000..0ff33d3 --- /dev/null +++ b/devel/gcc/patches/207-musl_fixincludes.patch @@ -0,0 +1,30 @@ +From: ktkachov +Date: Wed, 22 Apr 2015 14:18:16 +0000 (+0000) +Subject: fixincludes update for musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=2dc727de2e87c2756a514cbb43cea23c99deaa3d + +fixincludes update for musl support + +On behalf of Szabolcs.Nagy@arm.com + +2015-04-22 Gregor Richards + + * mkfixinc.sh: Add *-musl* with no fixes. + + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222327 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/fixincludes/mkfixinc.sh ++++ b/fixincludes/mkfixinc.sh +@@ -19,7 +19,8 @@ case $machine in + powerpc-*-eabi* | \ + powerpc-*-rtems* | \ + powerpcle-*-eabisim* | \ +- powerpcle-*-eabi* ) ++ powerpcle-*-eabi* | \ ++ *-musl* ) + # IF there is no include fixing, + # THEN create a no-op fixer and exit + (echo "#! /bin/sh" ; echo "exit 0" ) > ${target} diff --git a/devel/gcc/patches/209-musl_libstdc++.patch b/devel/gcc/patches/209-musl_libstdc++.patch new file mode 100644 index 0000000..d2414d0 --- /dev/null +++ b/devel/gcc/patches/209-musl_libstdc++.patch @@ -0,0 +1,72 @@ +From: ktkachov +Date: Wed, 22 Apr 2015 14:24:11 +0000 (+0000) +Subject: libstdc++, libgfortran gthr workaround for musl +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=1e5f711c11cb80ce609db9e9c1d8b2da0f7b5b61 + +libstdc++, libgfortran gthr workaround for musl + +On behalf of szabolcs.nagy@arm.com + +[libstdc++-v3/] +2015-04-22 Szabolcs Nagy + + * config/os/generic/os_defines.h (_GLIBCXX_GTHREAD_USE_WEAK): Define. + * configure.host (os_include_dir): Set to "os/generic" for linux-musl*. + +[libgfortran/] +2015-04-22 Szabolcs Nagy + + * acinclude.m4 (GTHREAD_USE_WEAK): Define as 0 for *-*-musl*. + * configure: Regenerate. + + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222329 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/libgfortran/acinclude.m4 ++++ b/libgfortran/acinclude.m4 +@@ -100,7 +100,7 @@ void foo (void); + [Define to 1 if the target supports #pragma weak]) + fi + case "$host" in +- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* ) ++ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* ) + AC_DEFINE(GTHREAD_USE_WEAK, 0, + [Define to 0 if the target shouldn't use #pragma weak]) + ;; +--- a/libgfortran/configure ++++ b/libgfortran/configure +@@ -26456,7 +26456,7 @@ $as_echo "#define SUPPORTS_WEAK 1" >>con + + fi + case "$host" in +- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* ) ++ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* ) + + $as_echo "#define GTHREAD_USE_WEAK 0" >>confdefs.h + +--- a/libstdc++-v3/config/os/generic/os_defines.h ++++ b/libstdc++-v3/config/os/generic/os_defines.h +@@ -33,4 +33,9 @@ + // System-specific #define, typedefs, corrections, etc, go here. This + // file will come before all others. + ++// Disable the weak reference logic in gthr.h for os/generic because it ++// is broken on every platform unless there is implementation specific ++// workaround in gthr-posix.h and at link-time for static linking. ++#define _GLIBCXX_GTHREAD_USE_WEAK 0 ++ + #endif +--- a/libstdc++-v3/configure.host ++++ b/libstdc++-v3/configure.host +@@ -273,6 +273,9 @@ case "${host_os}" in + freebsd*) + os_include_dir="os/bsd/freebsd" + ;; ++ linux-musl*) ++ os_include_dir="os/generic" ++ ;; + gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) + if [ "$uclibc" = "yes" ]; then + os_include_dir="os/uclibc" diff --git a/devel/gcc/patches/230-musl_libssp.patch b/devel/gcc/patches/230-musl_libssp.patch new file mode 100644 index 0000000..30f42e9 --- /dev/null +++ b/devel/gcc/patches/230-musl_libssp.patch @@ -0,0 +1,13 @@ +--- a/gcc/gcc.c ++++ b/gcc/gcc.c +@@ -727,7 +727,9 @@ proper position among the other output f + #endif + + #ifndef LINK_SSP_SPEC +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if DEFAULT_LIBC == LIBC_MUSL ++#define LINK_SSP_SPEC "-lssp_nonshared" ++#elif defined(TARGET_LIBC_PROVIDES_SSP) + #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ + "|fstack-protector-strong|fstack-protector-explicit:}" + #else diff --git a/devel/gcc/patches/240-musl-libitm-fixes.patch b/devel/gcc/patches/240-musl-libitm-fixes.patch new file mode 100644 index 0000000..533cb68 --- /dev/null +++ b/devel/gcc/patches/240-musl-libitm-fixes.patch @@ -0,0 +1,61 @@ +From: ktkachov +Date: Wed, 22 Apr 2015 14:11:25 +0000 (+0000) +Subject: libitm fixes for musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=e53a4d49c3d03ab8eaddb073cf972c1c46d75338 + +libitm fixes for musl support + +On behalf of Szabolcs.Nagy@arm.com + +2015-04-22 Gregor Richards + + * config/arm/hwcap.cc: Use fcntl.h instead of sys/fcntl.h. + * config/linux/x86/tls.h: Only use __GLIBC_PREREQ if defined. + + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222325 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/libitm/config/arm/hwcap.cc ++++ b/libitm/config/arm/hwcap.cc +@@ -40,7 +40,7 @@ int GTM_hwcap HIDDEN = 0 + + #ifdef __linux__ + #include +-#include ++#include + #include + + static void __attribute__((constructor)) +--- a/libitm/config/linux/x86/tls.h ++++ b/libitm/config/linux/x86/tls.h +@@ -25,16 +25,19 @@ + #ifndef LIBITM_X86_TLS_H + #define LIBITM_X86_TLS_H 1 + +-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10) ++#if defined(__GLIBC_PREREQ) ++#if __GLIBC_PREREQ(2, 10) + /* Use slots in the TCB head rather than __thread lookups. + GLIBC has reserved words 10 through 13 for TM. */ + #define HAVE_ARCH_GTM_THREAD 1 + #define HAVE_ARCH_GTM_THREAD_DISP 1 + #endif ++#endif + + #include "config/generic/tls.h" + +-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10) ++#if defined(__GLIBC_PREREQ) ++#if __GLIBC_PREREQ(2, 10) + namespace GTM HIDDEN { + + #ifdef __x86_64__ +@@ -101,5 +104,6 @@ static inline void set_abi_disp(struct a + + } // namespace GTM + #endif /* >= GLIBC 2.10 */ ++#endif + + #endif // LIBITM_X86_TLS_H diff --git a/devel/gcc/patches/250-add-musl.patch b/devel/gcc/patches/250-add-musl.patch new file mode 100644 index 0000000..8cbedde --- /dev/null +++ b/devel/gcc/patches/250-add-musl.patch @@ -0,0 +1,120 @@ +From: ktkachov +Date: Fri, 8 May 2015 08:30:40 +0000 (+0000) +Subject: [PATCH 0/13] Add musl support to GCC +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=f2d678afa5b8385d763b93772d73d6bf80a9739e + +[PATCH 0/13] Add musl support to GCC + +2015-05-08 Szabolcs Nagy + + * config/glibc-stdint.h (OPTION_MUSL): Define. + (INT_FAST16_TYPE, INT_FAST32_TYPE, UINT_FAST16_TYPE, UINT_FAST32_TYPE): + Change the definition based on OPTION_MUSL for 64 bit targets. + * config/linux.h (OPTION_MUSL): Redefine. + * config/alpha/linux.h (OPTION_MUSL): Redefine. + * config/rs6000/linux.h (OPTION_MUSL): Redefine. + * config/rs6000/linux64.h (OPTION_MUSL): Redefine. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222905 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/gcc/config/alpha/linux.h ++++ b/gcc/config/alpha/linux.h +@@ -61,10 +61,14 @@ along with GCC; see the file COPYING3. + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) + #else + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (linux_libc == LIBC_MUSL) + #endif + + /* Determine what functions are present at the runtime; +--- a/gcc/config/glibc-stdint.h ++++ b/gcc/config/glibc-stdint.h +@@ -22,6 +22,12 @@ a copy of the GCC Runtime Library Except + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + ++/* Systems using musl libc should use this header and make sure ++ OPTION_MUSL is defined correctly before using the TYPE macros. */ ++#ifndef OPTION_MUSL ++#define OPTION_MUSL 0 ++#endif ++ + #define SIG_ATOMIC_TYPE "int" + + #define INT8_TYPE "signed char" +@@ -43,12 +49,12 @@ see the files COPYING3 and COPYING.RUNTI + #define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + + #define INT_FAST8_TYPE "signed char" +-#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") +-#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") ++#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int") ++#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int") + #define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") + #define UINT_FAST8_TYPE "unsigned char" +-#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int") +-#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int") ++#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int") ++#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int") + #define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + + #define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -32,11 +32,13 @@ see the files COPYING3 and COPYING.RUNTI + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) ++#undef OPTION_MUSL + #define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) + #else + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) ++#undef OPTION_MUSL + #define OPTION_MUSL (linux_libc == LIBC_MUSL) + #endif + +--- a/gcc/config/rs6000/linux.h ++++ b/gcc/config/rs6000/linux.h +@@ -30,10 +30,14 @@ + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) + #else + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (linux_libc == LIBC_MUSL) + #endif + + /* Determine what functions are present at the runtime; +--- a/gcc/config/rs6000/linux64.h ++++ b/gcc/config/rs6000/linux64.h +@@ -299,10 +299,14 @@ extern int dot_symbols; + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) + #else + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (linux_libc == LIBC_MUSL) + #endif + + /* Determine what functions are present at the runtime; diff --git a/devel/gcc/patches/260-musl-add-unwind-fix.patch b/devel/gcc/patches/260-musl-add-unwind-fix.patch new file mode 100644 index 0000000..a3b83e2 --- /dev/null +++ b/devel/gcc/patches/260-musl-add-unwind-fix.patch @@ -0,0 +1,34 @@ +From: ktkachov +Date: Wed, 22 Apr 2015 14:20:01 +0000 (+0000) +Subject: unwind fix for musl +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=a2e31d0681d8a47389b8a3552622fbd9827bcef4 + +unwind fix for musl + +On behalf of szabolcs.nagy@arm.com + +2015-04-22 Gregor Richards + Szabolcs Nagy + + * unwind-dw2-fde-dip.c (USE_PT_GNU_EH_FRAME): Define it on + Linux if target provides dl_iterate_phdr. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222328 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/libgcc/unwind-dw2-fde-dip.c ++++ b/libgcc/unwind-dw2-fde-dip.c +@@ -59,6 +59,12 @@ + + #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ + && defined(TARGET_DL_ITERATE_PHDR) \ ++ && defined(__linux__) ++# define USE_PT_GNU_EH_FRAME ++#endif ++ ++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ ++ && defined(TARGET_DL_ITERATE_PHDR) \ + && (defined(__DragonFly__) || defined(__FreeBSD__)) + # define ElfW __ElfN + # define USE_PT_GNU_EH_FRAME diff --git a/devel/gcc/patches/270-musl-add-powerpc-softfloat-fix.patch b/devel/gcc/patches/270-musl-add-powerpc-softfloat-fix.patch new file mode 100644 index 0000000..bdebf6c --- /dev/null +++ b/devel/gcc/patches/270-musl-add-powerpc-softfloat-fix.patch @@ -0,0 +1,24 @@ +--- a/gcc/config/rs6000/linux64.h ++++ b/gcc/config/rs6000/linux64.h +@@ -369,8 +369,8 @@ extern int dot_symbols; + #endif + #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" + #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" +-#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E ".so.1" +-#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E ".so.1" ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" + #if DEFAULT_LIBC == LIBC_UCLIBC + #define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}" + #elif DEFAULT_LIBC == LIBC_GLIBC +--- a/gcc/config/rs6000/sysv4.h ++++ b/gcc/config/rs6000/sysv4.h +@@ -765,7 +765,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF + + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" + #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" +-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E ".so.1" ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" + #if DEFAULT_LIBC == LIBC_UCLIBC + #define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}" + #elif DEFAULT_LIBC == LIBC_MUSL diff --git a/devel/gcc/patches/300-mips_Os_cpu_rtx_cost_model.patch b/devel/gcc/patches/300-mips_Os_cpu_rtx_cost_model.patch new file mode 100644 index 0000000..1743658 --- /dev/null +++ b/devel/gcc/patches/300-mips_Os_cpu_rtx_cost_model.patch @@ -0,0 +1,14 @@ +Use the proper rtx cost model for the selected CPU, even when optimizing +for size. This generates better code. + +--- a/gcc/config/mips/mips.c ++++ b/gcc/config/mips/mips.c +@@ -17483,7 +17483,7 @@ mips_option_override (void) + flag_pcc_struct_return = 0; + + /* Decide which rtx_costs structure to use. */ +- if (optimize_size) ++ if (0 && optimize_size) + mips_cost = &mips_rtx_cost_optimize_size; + else + mips_cost = &mips_rtx_cost_data[mips_tune]; diff --git a/devel/gcc/patches/800-arm_v5te_no_ldrd_strd.patch b/devel/gcc/patches/800-arm_v5te_no_ldrd_strd.patch new file mode 100644 index 0000000..0edeb13 --- /dev/null +++ b/devel/gcc/patches/800-arm_v5te_no_ldrd_strd.patch @@ -0,0 +1,11 @@ +--- a/gcc/config/arm/arm.h ++++ b/gcc/config/arm/arm.h +@@ -285,7 +285,7 @@ extern void (*arm_lang_output_object_att + /* Thumb-1 only. */ + #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm) + +-#define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN \ ++#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \ + && !TARGET_THUMB1) + + #define TARGET_CRC32 (arm_arch_crc) diff --git a/devel/gcc/patches/810-arm-softfloat-libgcc.patch b/devel/gcc/patches/810-arm-softfloat-libgcc.patch new file mode 100644 index 0000000..1d06f5b --- /dev/null +++ b/devel/gcc/patches/810-arm-softfloat-libgcc.patch @@ -0,0 +1,25 @@ +--- a/libgcc/config/arm/t-linux ++++ b/libgcc/config/arm/t-linux +@@ -1,6 +1,10 @@ + LIB1ASMSRC = arm/lib1funcs.S + LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \ +- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 ++ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \ ++ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \ ++ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \ ++ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \ ++ _arm_fixsfsi _arm_fixunssfsi + + # Just for these, we omit the frame pointer since it makes such a big + # difference. +--- a/gcc/config/arm/linux-elf.h ++++ b/gcc/config/arm/linux-elf.h +@@ -60,8 +60,6 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc" +- + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + + #define LINUX_TARGET_LINK_SPEC "%{h*} \ diff --git a/devel/gcc/patches/820-libgcc_pic.patch b/devel/gcc/patches/820-libgcc_pic.patch new file mode 100644 index 0000000..42bf0c8 --- /dev/null +++ b/devel/gcc/patches/820-libgcc_pic.patch @@ -0,0 +1,36 @@ +--- a/libgcc/Makefile.in ++++ b/libgcc/Makefile.in +@@ -887,11 +887,12 @@ $(libgcov-driver-objects): %$(objext): $ + + # Static libraries. + libgcc.a: $(libgcc-objects) ++libgcc_pic.a: $(libgcc-s-objects) + libgcov.a: $(libgcov-objects) + libunwind.a: $(libunwind-objects) + libgcc_eh.a: $(libgcc-eh-objects) + +-libgcc.a libgcov.a libunwind.a libgcc_eh.a: ++libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a: + -rm -f $@ + + objects="$(objects)"; \ +@@ -913,7 +914,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E + endif + + ifeq ($(enable_shared),yes) +-all: libgcc_eh.a libgcc_s$(SHLIB_EXT) ++all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT) + ifneq ($(LIBUNWIND),) + all: libunwind$(SHLIB_EXT) + endif +@@ -1108,6 +1109,10 @@ install-shared: + chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a + $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a + ++ $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/ ++ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a ++ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a ++ + $(subst @multilib_dir@,$(MULTIDIR),$(subst \ + @shlib_base_name@,libgcc_s,$(subst \ + @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL)))) diff --git a/devel/gcc/patches/830-arm_unbreak_armv4t.patch b/devel/gcc/patches/830-arm_unbreak_armv4t.patch new file mode 100644 index 0000000..37f8f2a --- /dev/null +++ b/devel/gcc/patches/830-arm_unbreak_armv4t.patch @@ -0,0 +1,13 @@ +http://sourceware.org/ml/crossgcc/2008-05/msg00009.html + +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -45,7 +45,7 @@ + The ARM10TDMI core is the default for armv5t, so set + SUBTARGET_CPU_DEFAULT to achieve this. */ + #undef SUBTARGET_CPU_DEFAULT +-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi ++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi + + /* TARGET_BIG_ENDIAN_DEFAULT is set in + config.gcc for big endian configurations. */ diff --git a/devel/gcc/patches/840-armv4_pass_fix-v4bx_to_ld.patch b/devel/gcc/patches/840-armv4_pass_fix-v4bx_to_ld.patch new file mode 100644 index 0000000..cb1fb98 --- /dev/null +++ b/devel/gcc/patches/840-armv4_pass_fix-v4bx_to_ld.patch @@ -0,0 +1,19 @@ +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -94,10 +94,15 @@ + #define MUSL_DYNAMIC_LINKER \ + "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1" + ++/* For armv4 we pass --fix-v4bx to linker to support EABI */ ++#undef TARGET_FIX_V4BX_SPEC ++#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\ ++ "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}" ++ + /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to + use the GNU/Linux version, not the generic BPABI version. */ + #undef LINK_SPEC +-#define LINK_SPEC EABI_LINK_SPEC \ ++#define LINK_SPEC EABI_LINK_SPEC TARGET_FIX_V4BX_SPEC \ + LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \ + LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC) + diff --git a/devel/gcc/patches/850-use_shared_libgcc.patch b/devel/gcc/patches/850-use_shared_libgcc.patch new file mode 100644 index 0000000..5818cf4 --- /dev/null +++ b/devel/gcc/patches/850-use_shared_libgcc.patch @@ -0,0 +1,47 @@ +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -131,10 +131,6 @@ + #define ENDFILE_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC) + +-/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we +- do not use -lfloat. */ +-#undef LIBGCC_SPEC +- + /* Clear the instruction cache from `beg' to `end'. This is + implemented in lib1funcs.S, so ensure an error if this definition + is used. */ +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -53,6 +53,10 @@ see the files COPYING3 and COPYING.RUNTI + builtin_assert ("system=posix"); \ + } while (0) + ++#ifndef LIBGCC_SPEC ++#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}" ++#endif ++ + /* Determine which dynamic linker to use depending on whether GLIBC or + uClibc or Bionic or musl is the default C library and whether + -muclibc or -mglibc or -mbionic or -mmusl has been passed to change +--- a/libgcc/mkmap-symver.awk ++++ b/libgcc/mkmap-symver.awk +@@ -132,5 +132,5 @@ function output(lib) { + else if (inherit[lib]) + printf("} %s;\n", inherit[lib]); + else +- printf ("\n local:\n\t*;\n};\n"); ++ printf ("\n\t*;\n};\n"); + } +--- a/gcc/config/rs6000/linux.h ++++ b/gcc/config/rs6000/linux.h +@@ -60,6 +60,9 @@ + #undef CPP_OS_DEFAULT_SPEC + #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)" + ++#undef LIBGCC_SPEC ++#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc" ++ + #undef LINK_SHLIB_SPEC + #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}" + diff --git a/devel/gcc/patches/851-libgcc_no_compat.patch b/devel/gcc/patches/851-libgcc_no_compat.patch new file mode 100644 index 0000000..80c3476 --- /dev/null +++ b/devel/gcc/patches/851-libgcc_no_compat.patch @@ -0,0 +1,12 @@ +--- a/libgcc/config/t-libunwind ++++ b/libgcc/config/t-libunwind +@@ -2,8 +2,7 @@ + + HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER + +-LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \ +- $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c ++LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c + LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c + + # Override the default value from t-slibgcc-elf-ver and mention -lunwind diff --git a/devel/gcc/patches/870-ppc_no_crtsavres.patch b/devel/gcc/patches/870-ppc_no_crtsavres.patch new file mode 100644 index 0000000..0e64a41 --- /dev/null +++ b/devel/gcc/patches/870-ppc_no_crtsavres.patch @@ -0,0 +1,11 @@ +--- a/gcc/config/rs6000/rs6000.c ++++ b/gcc/config/rs6000/rs6000.c +@@ -21500,7 +21500,7 @@ rs6000_savres_strategy (rs6000_stack_t * + /* Define cutoff for using out-of-line functions to save registers. */ + if (DEFAULT_ABI == ABI_V4 || TARGET_ELF) + { +- if (!optimize_size) ++ if (1) + { + strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS; + strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS; diff --git a/devel/gcc/patches/880-no_java_section.patch b/devel/gcc/patches/880-no_java_section.patch new file mode 100644 index 0000000..def6c9f --- /dev/null +++ b/devel/gcc/patches/880-no_java_section.patch @@ -0,0 +1,11 @@ +--- a/gcc/defaults.h ++++ b/gcc/defaults.h +@@ -380,7 +380,7 @@ see the files COPYING3 and COPYING.RUNTI + /* If we have named section and we support weak symbols, then use the + .jcr section for recording java classes which need to be registered + at program start-up time. */ +-#if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK ++#if 0 && defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK + #ifndef JCR_SECTION_NAME + #define JCR_SECTION_NAME ".jcr" + #endif diff --git a/devel/gcc/patches/900-bad-mips16-crt.patch b/devel/gcc/patches/900-bad-mips16-crt.patch new file mode 100644 index 0000000..dd6e9dc --- /dev/null +++ b/devel/gcc/patches/900-bad-mips16-crt.patch @@ -0,0 +1,9 @@ +--- a/libgcc/config/mips/t-mips16 ++++ b/libgcc/config/mips/t-mips16 +@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16 + + # Version these symbols if building libgcc.so. + SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver ++ ++CRTSTUFF_T_CFLAGS += -mno-mips16 ++CRTSTUFF_T_CFLAGS_S += -mno-mips16 diff --git a/devel/gcc/patches/910-mbsd_multi.patch b/devel/gcc/patches/910-mbsd_multi.patch new file mode 100644 index 0000000..32fc9da --- /dev/null +++ b/devel/gcc/patches/910-mbsd_multi.patch @@ -0,0 +1,222 @@ + + This patch brings over a few features from MirBSD: + * -fhonour-copts + If this option is not given, it's warned (depending + on environment variables). This is to catch errors + of misbuilt packages which override CFLAGS themselves. + * -Werror-maybe-reset + Has the effect of -Wno-error if GCC_NO_WERROR is + set and not '0', a no-operation otherwise. This is + to be able to use -Werror in "make" but prevent + GNU autoconf generated configure scripts from + freaking out. + + This patch was authored by Thorsten Glaser + with copyright assignment to the FSF in effect. + +--- a/gcc/c-family/c-opts.c ++++ b/gcc/c-family/c-opts.c +@@ -122,6 +122,9 @@ static int class_dump_flags; + /* Whether any standard preincluded header has been preincluded. */ + static bool done_preinclude; + ++/* Check if a port honours COPTS. */ ++static int honour_copts = 0; ++ + static void handle_OPT_d (const char *); + static void set_std_cxx98 (int); + static void set_std_cxx11 (int); +@@ -449,6 +452,12 @@ c_common_handle_option (size_t scode, co + flag_no_builtin = !value; + break; + ++ case OPT_fhonour_copts: ++ if (c_language == clk_c) { ++ honour_copts++; ++ } ++ break; ++ + case OPT_fconstant_string_class_: + constant_string_class_name = arg; + break; +@@ -1034,6 +1043,47 @@ c_common_init (void) + return false; + } + ++ if (c_language == clk_c) { ++ char *ev = getenv ("GCC_HONOUR_COPTS"); ++ int evv; ++ if (ev == NULL) ++ evv = -1; ++ else if ((*ev == '0') || (*ev == '\0')) ++ evv = 0; ++ else if (*ev == '1') ++ evv = 1; ++ else if (*ev == '2') ++ evv = 2; ++ else if (*ev == 's') ++ evv = -1; ++ else { ++ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1"); ++ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */ ++ } ++ if (evv == 1) { ++ if (honour_copts == 0) { ++ error ("someone does not honour COPTS at all in lenient mode"); ++ return false; ++ } else if (honour_copts != 1) { ++ warning (0, "someone does not honour COPTS correctly, passed %d times", ++ honour_copts); ++ } ++ } else if (evv == 2) { ++ if (honour_copts == 0) { ++ error ("someone does not honour COPTS at all in strict mode"); ++ return false; ++ } else if (honour_copts != 1) { ++ error ("someone does not honour COPTS correctly, passed %d times", ++ honour_copts); ++ return false; ++ } ++ } else if (evv == 0) { ++ if (honour_copts != 1) ++ inform (0, "someone does not honour COPTS correctly, passed %d times", ++ honour_copts); ++ } ++ } ++ + return true; + } + +--- a/gcc/c-family/c.opt ++++ b/gcc/c-family/c.opt +@@ -431,6 +431,10 @@ Wfloat-conversion + C ObjC C++ ObjC++ Var(warn_float_conversion) LangEnabledBy(C ObjC C++ ObjC++,Wconversion) + Warn for implicit type conversions that cause loss of floating point precision + ++Werror-maybe-reset ++C ObjC C++ ObjC++ ++; Documented in common.opt ++ + Wfloat-equal + C ObjC C++ ObjC++ Var(warn_float_equal) Warning + Warn if testing floating point numbers for equality +@@ -1161,6 +1165,9 @@ C++ ObjC++ Optimization Alias(fexception + fhonor-std + C++ ObjC++ Ignore Warn(switch %qs is no longer supported) + ++fhonour-copts ++C ObjC C++ ObjC++ RejectNegative ++ + fhosted + C ObjC + Assume normal C execution environment +--- a/gcc/common.opt ++++ b/gcc/common.opt +@@ -561,6 +561,10 @@ Werror= + Common Joined + Treat specified warning as error + ++Werror-maybe-reset ++Common ++If environment variable GCC_NO_WERROR is set, act as -Wno-error ++ + Wextra + Common Var(extra_warnings) Warning + Print extra (possibly unwanted) warnings +@@ -1360,6 +1364,9 @@ fguess-branch-probability + Common Report Var(flag_guess_branch_prob) Optimization + Enable guessing of branch probabilities + ++fhonour-copts ++Common RejectNegative ++ + ; Nonzero means ignore `#ident' directives. 0 means handle them. + ; Generate position-independent code for executables if possible + ; On SVR4 targets, it also controls whether or not to emit a +--- a/gcc/opts.c ++++ b/gcc/opts.c +@@ -1699,6 +1699,17 @@ common_handle_option (struct gcc_options + opts, opts_set, loc, dc); + break; + ++ case OPT_Werror_maybe_reset: ++ { ++ char *ev = getenv ("GCC_NO_WERROR"); ++ if ((ev != NULL) && (*ev != '0')) ++ warnings_are_errors = 0; ++ } ++ break; ++ ++ case OPT_fhonour_copts: ++ break; ++ + case OPT_Wlarger_than_: + opts->x_larger_than_size = value; + opts->x_warn_larger_than = value != -1; +--- a/gcc/doc/cppopts.texi ++++ b/gcc/doc/cppopts.texi +@@ -163,6 +163,11 @@ in older programs. This warning is on b + Make all warnings into hard errors. Source code which triggers warnings + will be rejected. + ++ at item -Werror-maybe-reset ++ at opindex Werror-maybe-reset ++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment ++variable is set to anything other than 0 or empty. ++ + @item -Wsystem-headers + @opindex Wsystem-headers + Issue warnings for code in system headers. These are normally unhelpful +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -251,7 +251,7 @@ Objective-C and Objective-C++ Dialects}. + -Wdisabled-optimization @gol + -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol + -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol +--Wno-endif-labels -Werror -Werror=* @gol ++-Wno-endif-labels -Werror -Werror=* -Werror-maybe-reset @gol + -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol + -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol + -Wformat-security -Wformat-signedness -Wformat-y2k @gol +@@ -5382,6 +5382,22 @@ This option is only supported for C and + @option{-Wall} and by @option{-Wpedantic}, which can be disabled with + @option{-Wno-pointer-sign}. + ++ at item -Werror-maybe-reset ++ at opindex Werror-maybe-reset ++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment ++variable is set to anything other than 0 or empty. ++ ++ at item -fhonour-copts ++ at opindex fhonour-copts ++If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not ++given at least once, and warn if it is given more than once. ++If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not ++given exactly once. ++If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option ++is not given exactly once. ++The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}. ++This flag and environment variable only affect the C language. ++ + @item -Wstack-protector + @opindex Wstack-protector + @opindex Wno-stack-protector +@@ -7860,7 +7876,7 @@ so, the first branch is redirected to ei + second branch or a point immediately following it, depending on whether + the condition is known to be true or false. + +-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. ++Enabled at levels @option{-O3}. + + @item -fsplit-wide-types + @opindex fsplit-wide-types +--- a/gcc/java/jvspec.c ++++ b/gcc/java/jvspec.c +@@ -629,6 +629,7 @@ lang_specific_pre_link (void) + class name. Append dummy `.c' that can be stripped by set_input so %b + is correct. */ + set_input (concat (main_class_name, "main.c", NULL)); ++ putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */ + err = do_spec (jvgenmain_spec); + if (err == 0) + { diff --git a/devel/gcc/patches/920-specs_nonfatal_getenv.patch b/devel/gcc/patches/920-specs_nonfatal_getenv.patch new file mode 100644 index 0000000..3d708f2 --- /dev/null +++ b/devel/gcc/patches/920-specs_nonfatal_getenv.patch @@ -0,0 +1,15 @@ +--- a/gcc/gcc.c ++++ b/gcc/gcc.c +@@ -8807,8 +8807,10 @@ getenv_spec_function (int argc, const ch + + value = getenv (argv[0]); + if (!value) +- fatal_error (input_location, +- "environment variable %qs not defined", argv[0]); ++ { ++ warning (input_location, "environment variable %qs not defined", argv[0]); ++ value = ""; ++ } + + /* We have to escape every character of the environment variable so + they are not interpreted as active spec characters. A diff --git a/devel/gcc/patches/930-fix-mips-noexecstack.patch b/devel/gcc/patches/930-fix-mips-noexecstack.patch new file mode 100644 index 0000000..c05844d --- /dev/null +++ b/devel/gcc/patches/930-fix-mips-noexecstack.patch @@ -0,0 +1,111 @@ +From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001 +From: Andrew McDonnell +Date: Fri, 3 Oct 2014 19:09:00 +0930 +Subject: Add .note.GNU-stack section + +See http://lists.busybox.net/pipermail/uclibc/2014-October/048671.html +Below copied from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html + +Re: [Patch, MIPS] Add .note.GNU-stack section + + From: Steve Ellcey + +On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote: +> +> +> On Wed, Sep 10, 2014 at 9:27 AM, wrote: + +> This works except you did not update the assembly files in +> libgcc or glibc. We (Cavium) have the same patch in our tree +> for a few released versions. + +> Mind just checking yours in then Andrew? + +> Thanks! +> -eric + +I talked to Andrew about what files he changed in GCC and created and +tested this new patch. Andrew also mentioned changing some assembly +files in glibc but I don't see any use of '.section .note.GNU-stack' in +any assembly files in glibc (for any platform) so I wasn't planning on +creating a glibc to add them to mips glibc assembly language files. + +OK to check in this patch? + +Steve Ellcey +sellcey@mips.com + + + +2014-09-26 Steve Ellcey +--- + gcc/config/mips/mips.c | 3 +++ + libgcc/config/mips/crti.S | 4 ++++ + libgcc/config/mips/crtn.S | 3 +++ + libgcc/config/mips/mips16.S | 4 ++++ + libgcc/config/mips/vr4120-div.S | 4 ++++ + 5 files changed, 18 insertions(+) + +--- a/gcc/config/mips/mips.c ++++ b/gcc/config/mips/mips.c +@@ -19629,6 +19629,9 @@ mips_lra_p (void) + #undef TARGET_LRA_P + #define TARGET_LRA_P mips_lra_p + ++#undef TARGET_ASM_FILE_END ++#define TARGET_ASM_FILE_END file_end_indicate_exec_stack ++ + struct gcc_target targetm = TARGET_INITIALIZER; + + #include "gt-mips.h" +--- a/libgcc/config/mips/crti.S ++++ b/libgcc/config/mips/crti.S +@@ -21,6 +21,10 @@ a copy of the GCC Runtime Library Except + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + ++ ++/* An executable stack is *not* required for these functions. */ ++ .section .note.GNU-stack,"",%progbits ++ + /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack. + Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */ + +--- a/libgcc/config/mips/crtn.S ++++ b/libgcc/config/mips/crtn.S +@@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Except + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + ++/* An executable stack is *not* required for these functions. */ ++ .section .note.GNU-stack,"",%progbits ++ + /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack. + Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */ + +--- a/libgcc/config/mips/mips16.S ++++ b/libgcc/config/mips/mips16.S +@@ -48,6 +48,10 @@ see the files COPYING3 and COPYING.RUNTI + values using the soft-float calling convention, but do the actual + operation using the hard floating point instructions. */ + ++/* An executable stack is *not* required for these functions. */ ++ .section .note.GNU-stack,"",%progbits ++ .previous ++ + #if defined _MIPS_SIM && (_MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIO64) + + /* This file contains 32-bit assembly code. */ +--- a/libgcc/config/mips/vr4120-div.S ++++ b/libgcc/config/mips/vr4120-div.S +@@ -26,6 +26,10 @@ see the files COPYING3 and COPYING.RUNTI + -mfix-vr4120. div and ddiv do not give the correct result when one + of the operands is negative. */ + ++/* An executable stack is *not* required for these functions. */ ++ .section .note.GNU-stack,"",%progbits ++ .previous ++ + .set nomips16 + + #define DIV \ diff --git a/devel/gcc/patches/930-osdefines.patch b/devel/gcc/patches/930-osdefines.patch new file mode 100644 index 0000000..a1b6120 --- /dev/null +++ b/devel/gcc/patches/930-osdefines.patch @@ -0,0 +1,13 @@ +--- a/libstdc++-v3/config/os/gnu-linux/os_defines.h 2015-01-05 06:33:28.000000000 -0600 ++++ b/libstdc++-v3/config/os/gnu-linux/os_defines.h 2016-04-15 12:32:49.374356001 -0500 +@@ -41,8 +41,8 @@ + // Provide a declaration for the possibly deprecated gets function, as + // glibc 2.15 and later does not declare gets for ISO C11 when + // __GNU_SOURCE is defined. +-#if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE) ++//#if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE) + # undef _GLIBCXX_HAVE_GETS +-#endif ++//#endif + + #endif diff --git a/devel/gcc/patches/940-no-clobber-stamp-bits.patch b/devel/gcc/patches/940-no-clobber-stamp-bits.patch new file mode 100644 index 0000000..0b21ffa --- /dev/null +++ b/devel/gcc/patches/940-no-clobber-stamp-bits.patch @@ -0,0 +1,11 @@ +--- a/libstdc++-v3/include/Makefile.in ++++ b/libstdc++-v3/include/Makefile.in +@@ -1421,7 +1421,7 @@ stamp-bits: ${bits_headers} + @$(STAMP) stamp-bits + + stamp-bits-sup: stamp-bits ${bits_sup_headers} +- @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null ++ @-cd ${bits_builddir} && $(LN_S) $(filter-out stamp-bits,$?) . 2>/dev/null + @$(STAMP) stamp-bits-sup + + stamp-c_base: ${c_base_headers} diff --git a/devel/gcc/patches/950-cpp_file_path_translation.patch b/devel/gcc/patches/950-cpp_file_path_translation.patch new file mode 100644 index 0000000..dc0938a --- /dev/null +++ b/devel/gcc/patches/950-cpp_file_path_translation.patch @@ -0,0 +1,182 @@ +Forward ported from attachment to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47047 + +--- a/gcc/c-family/c-opts.c ++++ b/gcc/c-family/c-opts.c +@@ -581,6 +581,10 @@ c_common_handle_option (size_t scode, co + add_path (xstrdup (arg), SYSTEM, 0, true); + break; + ++ case OPT_iremap: ++ add_cpp_remap_path (arg); ++ break; ++ + case OPT_iwithprefix: + add_prefixed_path (arg, SYSTEM); + break; +--- a/gcc/c-family/c.opt ++++ b/gcc/c-family/c.opt +@@ -1528,6 +1528,10 @@ iquote + C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path after %qs) + -iquote Add to the end of the quote include path + ++iremap ++C ObjC C++ ObjC++ Joined Separate ++-iremap Convert to if it occurs as prefix in __FILE__. ++ + iwithprefix + C ObjC C++ ObjC++ Joined Separate + -iwithprefix Add to the end of the system include path +--- a/gcc/doc/cpp.texi ++++ b/gcc/doc/cpp.texi +@@ -4441,6 +4441,7 @@ without notice. + @c man begin SYNOPSIS + cpp [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}] + [@option{-I}@var{dir}@dots{}] [@option{-iquote}@var{dir}@dots{}] ++ [@option{-iremap}@var{src}:@var{dst}] + [@option{-W}@var{warn}@dots{}] + [@option{-M}|@option{-MM}] [@option{-MG}] [@option{-MF} @var{filename}] + [@option{-MP}] [@option{-MQ} @var{target}@dots{}] +--- a/gcc/doc/cppopts.texi ++++ b/gcc/doc/cppopts.texi +@@ -532,6 +532,12 @@ Search @var{dir} only for header files r + If @var{dir} begins with @code{=}, then the @code{=} will be replaced + by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}. + ++@item -iremap @var{src}:@var{dst} ++@opindex iremap ++Replace the prefix @var{src} in __FILE__ with @var{dst} at expansion time. ++This option can be specified more than once. Processing stops at the first ++match. ++ + @item -fdirectives-only + @opindex fdirectives-only + When preprocessing, handle directives, but do not expand macros. +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -494,8 +494,8 @@ Objective-C and Objective-C++ Dialects}. + @item Directory Options + @xref{Directory Options,,Options for Directory Search}. + @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol +--iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol +---sysroot=@var{dir} --no-sysroot-suffix} ++-iquote@var{dir} -iremap@var{src}:@var{dst} -L@var{dir} -specs=@var{file} @gol ++-I- --sysroot=@var{dir} --no-sysroot-suffix} + + @item Machine Dependent Options + @xref{Submodel Options,,Hardware Models and Configurations}. +@@ -11479,6 +11479,12 @@ be searched for header files only for th + "@var{file}"}; they are not searched for @code{#include <@var{file}>}, + otherwise just like @option{-I}. + ++@item -iremap @var{src}:@var{dst} ++@opindex iremap ++Replace the prefix @var{src} in __FILE__ with @var{dst} at expansion time. ++This option can be specified more than once. Processing stops at the first ++match. ++ + @item -L@var{dir} + @opindex L + Add directory @var{dir} to the list of directories to be searched +--- a/libcpp/include/cpplib.h ++++ b/libcpp/include/cpplib.h +@@ -751,6 +751,9 @@ extern void cpp_set_lang (cpp_reader *, + /* Set the include paths. */ + extern void cpp_set_include_chains (cpp_reader *, cpp_dir *, cpp_dir *, int); + ++/* Provide src:dst pair for __FILE__ remapping. */ ++extern void add_cpp_remap_path (const char *); ++ + /* Call these to get pointers to the options, callback, and deps + structures for a given reader. These pointers are good until you + call cpp_finish on that reader. You can either edit the callbacks +--- a/libcpp/macro.c ++++ b/libcpp/macro.c +@@ -224,6 +224,64 @@ static const char * const monthnames[] = + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" + }; + ++static size_t remap_pairs; ++static char **remap_src; ++static char **remap_dst; ++ ++void ++add_cpp_remap_path (const char *arg) ++{ ++ const char *arg_dst; ++ size_t len; ++ ++ arg_dst = strchr(arg, ':'); ++ if (arg_dst == NULL) ++ { ++ fprintf(stderr, "Invalid argument for -iremap\n"); ++ exit(1); ++ } ++ ++ len = arg_dst - arg; ++ ++arg_dst; ++ ++ remap_src = (char **) xrealloc(remap_src, sizeof(char *) * (remap_pairs + 1)); ++ remap_dst = (char **) xrealloc(remap_dst, sizeof(char *) * (remap_pairs + 1)); ++ ++ remap_src[remap_pairs] = (char *) xmalloc(len + 1); ++ memcpy(remap_src[remap_pairs], arg, len); ++ remap_src[remap_pairs][len] = '\0'; ++ remap_dst[remap_pairs] = xstrdup(arg_dst); ++ ++remap_pairs; ++} ++ ++static const char * ++cpp_remap_file (const char *arg, char **tmp_name) ++{ ++ char *result; ++ size_t i, len; ++ ++ for (i = 0; i < remap_pairs; ++i) ++ { ++ len = strlen (remap_src[i]); ++ if (strncmp (remap_src[i], arg, len)) ++ continue; ++ if (arg[len] == '\0') ++ return xstrdup (remap_dst[i]); ++ if (arg[len] != '/') ++ continue; ++ arg += len; ++ len = strlen (remap_dst[i]); ++ result = (char *) xmalloc (len + strlen (arg) + 1); ++ memcpy(result, remap_dst[i], len); ++ strcpy(result + len, arg); ++ *tmp_name = result; ++ ++ return result; ++ } ++ ++ return arg; ++} ++ + /* Helper function for builtin_macro. Returns the text generated by + a builtin macro. */ + const uchar * +@@ -286,6 +344,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi + { + unsigned int len; + const char *name; ++ char *tmp_name = NULL; + uchar *buf; + + if (node->value.builtin == BT_FILE) +@@ -297,6 +356,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi + if (!name) + abort (); + } ++ name = cpp_remap_file (name, &tmp_name); + len = strlen (name); + buf = _cpp_unaligned_alloc (pfile, len * 2 + 3); + result = buf; +@@ -304,6 +364,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi + buf = cpp_quote_string (buf + 1, (const unsigned char *) name, len); + *buf++ = '"'; + *buf = '\0'; ++ free (tmp_name); + } + break; + diff --git a/devel/gcc/patches/960-go_libm.patch b/devel/gcc/patches/960-go_libm.patch new file mode 100644 index 0000000..d16b020 --- /dev/null +++ b/devel/gcc/patches/960-go_libm.patch @@ -0,0 +1,11 @@ +--- a/gcc/go/Make-lang.in ++++ b/gcc/go/Make-lang.in +@@ -74,7 +74,7 @@ go_OBJS = $(GO_OBJS) go/gospec.o + + go1$(exeext): $(GO_OBJS) attribs.o $(BACKEND) $(LIBDEPS) + +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ +- $(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS) ++ $(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS) -lm + + # Documentation. + diff --git a/devel/gcc/patches/970-warn_bug.patch b/devel/gcc/patches/970-warn_bug.patch new file mode 100644 index 0000000..2c5cf9b --- /dev/null +++ b/devel/gcc/patches/970-warn_bug.patch @@ -0,0 +1,11 @@ +--- a/libgo/runtime/mprof.goc ++++ b/libgo/runtime/mprof.goc +@@ -403,7 +403,7 @@ func ThreadCreateProfile(p Slice) (n int + + func Stack(b Slice, all bool) (n int) { + byte *pc, *sp; +- bool enablegc; ++ bool enablegc = false; /* workaround GCC bug #36550 */ + + sp = runtime_getcallersp(&b); + pc = (byte*)(uintptr)runtime_getcallerpc(&b); diff --git a/devel/libtool-bin/Makefile b/devel/libtool-bin/Makefile new file mode 100644 index 0000000..a10303e --- /dev/null +++ b/devel/libtool-bin/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2016 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:=libtool +PKG_VERSION:=2.4.6 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@GNU/libtool +PKG_MD5SUM:=1bfb9b923f2c1339b4d2ce1807064aa5 +PKG_MAINTAINER:=Heinrich Schuchardt +PKG_LICENSE:=GPL-2.0+ +PKG_BUILD_DIR = $(BUILD_DIR)/libtool-bin/$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +CONFIGURE_VARS += GREP=grep SED=sed + +define Package/libtool-bin + SECTION:=devel + CATEGORY:=Development + TITLE:=GNU Libtool - libtoolize + URL:=https://www.gnu.org/software/libtool/ +endef + +define Package/libtool-bin/description + GNU libtool is a generic library support script. + Libtool hides the complexity of using shared libraries behind a consistent, + portable interface. + This package contains the libtoolize executable. +endef + +define Package/libtool-bin/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/libtoolize $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/share/aclocal/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/aclocal/*.m4 \ + $(1)/usr/share/aclocal/ + $(INSTALL_DIR) $(1)/usr/share/libtool/build-aux/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/libtool/build-aux/* \ + $(1)/usr/share/libtool/build-aux/ +endef + +$(eval $(call BuildPackage,libtool-bin)) diff --git a/devel/lpc21isp/Makefile b/devel/lpc21isp/Makefile new file mode 100644 index 0000000..292b7a4 --- /dev/null +++ b/devel/lpc21isp/Makefile @@ -0,0 +1,42 @@ +# +# Copyright (C) 2016 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:=lpc21isp +PKG_VERSION:=197 +PKG_RELEASE:=1 +PKG_LICENSE:=LGPL-3.0+ +PKG_LICENSE_FILES:=README gpl.txt lgpl-3.0.txt + +PKG_BUILD_DIR:=$(BUILD_DIR)/lpc21isp_$(PKG_VERSION) +PKG_SOURCE:=lpc21isp_$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/lpc21isp +PKG_MD5SUM:=0b286859a05a725647ecb1b3fe9ba606 +PKG_CAT:=zcat + +include $(INCLUDE_DIR)/package.mk + +define Package/lpc21isp + SECTION:=base + CATEGORY:=Development + TITLE:=Command line ISP for NXP LPC family and ADUC70xx + URL:=http://lpc21isp.sourceforge.net/ + MAINTAINER:=Emil 'Skeen' Madsen +endef + +define Package/lpc21isp/description + Portable command line ISP (In-circuit Programmer) for NXP LPC family + and Analog Devices ADUC70xx. +endef + +define Package/lpc21isp/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lpc21isp $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,lpc21isp)) diff --git a/devel/lttng-modules/Makefile b/devel/lttng-modules/Makefile new file mode 100644 index 0000000..99510a0 --- /dev/null +++ b/devel/lttng-modules/Makefile @@ -0,0 +1,45 @@ +# +# Copyright (C) 2013-2015 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:=lttng-modules +PKG_VERSION:=2.6.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=https://lttng.org/files/$(PKG_NAME)/ +PKG_MD5SUM:=ccfb50ad922cdaf54a809e2d9de23da4 + +PKG_LICENSE:=LGPL-2.1 GPL-2.0 MIT +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Nicolas Thill + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/lttng + SUBMENU:=Other modules + TITLE:=Linux Trace Toolkit: next generation (kernel modules) + URL:=https://lttng.org/ + DEPENDS:= @!TARGET_uml @KERNEL_FTRACE_SYSCALLS + FILES:= \ + $(PKG_BUILD_DIR)/lttng-*.$(LINUX_KMOD_SUFFIX) \ + $(PKG_BUILD_DIR)/lib/lttng-*.$(LINUX_KMOD_SUFFIX) \ + $(PKG_BUILD_DIR)/probes/lttng-*.$(LINUX_KMOD_SUFFIX) +endef + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + SUBDIRS="$(PKG_BUILD_DIR)" \ + V="$(V)" \ + modules +endef + +$(eval $(call KernelPackage,lttng)) diff --git a/devel/lttng-modules/patches/001-mm_page_alloc_extfrag.patch b/devel/lttng-modules/patches/001-mm_page_alloc_extfrag.patch new file mode 100644 index 0000000..d8a0c62 --- /dev/null +++ b/devel/lttng-modules/patches/001-mm_page_alloc_extfrag.patch @@ -0,0 +1,10 @@ +--- a/instrumentation/events/lttng-module/kmem.h ++++ b/instrumentation/events/lttng-module/kmem.h +@@ -287,6 +287,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT(mm + ) + + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \ ++ || LTTNG_KERNEL_RANGE(3,18,10, 3,19,0) \ + || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0) \ + || LTTNG_DEBIAN_KERNEL_RANGE(3,16,7,9,0,0, 3,17,0,0,0,0)) + diff --git a/devel/lttng-tools/Makefile b/devel/lttng-tools/Makefile new file mode 100644 index 0000000..e52c529 --- /dev/null +++ b/devel/lttng-tools/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2013-2015 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:=lttng-tools +PKG_VERSION:=2.6.0 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=https://lttng.org/files/$(PKG_NAME)/ +PKG_MD5SUM:=0478f60395f9564b4a19f45ce7b7f3df + +PKG_LICENSE:=LGPL-2.1 GPL-2.0 +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Nicolas Thill + +PKG_FIXUP:=autoreconf +PKG_USE_MIPS16:=0 +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lttng-tools + SECTION:=devel + CATEGORY:=Development + TITLE:=Linux Trace Toolkit: next generation (tools) + URL:=https://lttng.org/ + DEPENDS:= +lttng-ust +libpopt +libxml2 +endef + +CONFIGURE_ARGS += --disable-kmod + +TARGET_LDFLAGS += -lurcu-bp + +MAKE_FLAGS += V="$(V)" + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/lttng $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblttng-ctl*.{a,so*} $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lttng-ctl.pc $(1)/usr/lib/pkgconfig/ +endef + +define Package/lttng-tools/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblttng-ctl*.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lttng $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lttng* $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,lttng-tools)) diff --git a/devel/lttng-tools/patches/100-musl-compat.patch b/devel/lttng-tools/patches/100-musl-compat.patch new file mode 100644 index 0000000..8813f83 --- /dev/null +++ b/devel/lttng-tools/patches/100-musl-compat.patch @@ -0,0 +1,23 @@ +--- a/src/common/compat/poll.h ++++ b/src/common/compat/poll.h +@@ -55,6 +55,10 @@ static inline void __lttng_poll_free(voi + #include + #include + ++#ifndef __GLIBC_PREREQ ++#define __GLIBC_PREREQ(maj, min) (0) ++#endif ++ + /* See man epoll(7) for this define path */ + #define COMPAT_EPOLL_PROC_PATH "/proc/sys/fs/epoll/max_user_watches" + +--- a/src/common/runas.h ++++ b/src/common/runas.h +@@ -21,6 +21,7 @@ + + #include + #include ++#include + + int run_as_mkdir_recursive(const char *path, mode_t mode, uid_t uid, gid_t gid); + int run_as_mkdir(const char *path, mode_t mode, uid_t uid, gid_t gid); diff --git a/devel/lttng-tools/patches/200-use-extern.patch b/devel/lttng-tools/patches/200-use-extern.patch new file mode 100644 index 0000000..180c061 --- /dev/null +++ b/devel/lttng-tools/patches/200-use-extern.patch @@ -0,0 +1,423 @@ +--- a/src/common/mi-lttng.h ++++ b/src/common/mi-lttng.h +@@ -49,133 +49,133 @@ struct mi_lttng_version { + }; + + /* Strings related to command */ +-const char * const mi_lttng_element_command; +-const char * const mi_lttng_element_command_action; +-const char * const mi_lttng_element_command_add_context; +-const char * const mi_lttng_element_command_calibrate; +-const char * const mi_lttng_element_command_create; +-const char * const mi_lttng_element_command_destroy; +-const char * const mi_lttng_element_command_disable_channel; +-const char * const mi_lttng_element_command_disable_event; +-const char * const mi_lttng_element_command_enable_channels; +-const char * const mi_lttng_element_command_enable_event; +-const char * const mi_lttng_element_command_list; +-const char * const mi_lttng_element_command_load; +-const char * const mi_lttng_element_command_name; +-const char * const mi_lttng_element_command_output; +-const char * const mi_lttng_element_command_save; +-const char * const mi_lttng_element_command_set_session; +-const char * const mi_lttng_element_command_snapshot; +-const char * const mi_lttng_element_command_snapshot_add; +-const char * const mi_lttng_element_command_snapshot_del; +-const char * const mi_lttng_element_command_snapshot_list; +-const char * const mi_lttng_element_command_snapshot_record; +-const char * const mi_lttng_element_command_start; +-const char * const mi_lttng_element_command_stop; +-const char * const mi_lttng_element_command_success; +-const char * const mi_lttng_element_command_version; ++extern const char * const mi_lttng_element_command; ++extern const char * const mi_lttng_element_command_action; ++extern const char * const mi_lttng_element_command_add_context; ++extern const char * const mi_lttng_element_command_calibrate; ++extern const char * const mi_lttng_element_command_create; ++extern const char * const mi_lttng_element_command_destroy; ++extern const char * const mi_lttng_element_command_disable_channel; ++extern const char * const mi_lttng_element_command_disable_event; ++extern const char * const mi_lttng_element_command_enable_channels; ++extern const char * const mi_lttng_element_command_enable_event; ++extern const char * const mi_lttng_element_command_list; ++extern const char * const mi_lttng_element_command_load; ++extern const char * const mi_lttng_element_command_name; ++extern const char * const mi_lttng_element_command_output; ++extern const char * const mi_lttng_element_command_save; ++extern const char * const mi_lttng_element_command_set_session; ++extern const char * const mi_lttng_element_command_snapshot; ++extern const char * const mi_lttng_element_command_snapshot_add; ++extern const char * const mi_lttng_element_command_snapshot_del; ++extern const char * const mi_lttng_element_command_snapshot_list; ++extern const char * const mi_lttng_element_command_snapshot_record; ++extern const char * const mi_lttng_element_command_start; ++extern const char * const mi_lttng_element_command_stop; ++extern const char * const mi_lttng_element_command_success; ++extern const char * const mi_lttng_element_command_version; + + /* Strings related to version command */ +-const char * const mi_lttng_element_version; +-const char * const mi_lttng_element_version_commit; +-const char * const mi_lttng_element_version_description; +-const char * const mi_lttng_element_version_license; +-const char * const mi_lttng_element_version_major; +-const char * const mi_lttng_element_version_minor; +-const char * const mi_lttng_element_version_patch_level; +-const char * const mi_lttng_element_version_str; +-const char * const mi_lttng_element_version_web; ++extern const char * const mi_lttng_element_version; ++extern const char * const mi_lttng_element_version_commit; ++extern const char * const mi_lttng_element_version_description; ++extern const char * const mi_lttng_element_version_license; ++extern const char * const mi_lttng_element_version_major; ++extern const char * const mi_lttng_element_version_minor; ++extern const char * const mi_lttng_element_version_patch_level; ++extern const char * const mi_lttng_element_version_str; ++extern const char * const mi_lttng_element_version_web; + + /* String related to a lttng_event_field */ +-const char * const mi_lttng_element_event_field; +-const char * const mi_lttng_element_event_fields; ++extern const char * const mi_lttng_element_event_field; ++extern const char * const mi_lttng_element_event_fields; + + /* String related to lttng_event_context */ +-const char * const mi_lttng_context_type_perf_counter; +-const char * const mi_lttng_context_type_perf_cpu_counter; +-const char * const mi_lttng_context_type_perf_thread_counter; ++extern const char * const mi_lttng_context_type_perf_counter; ++extern const char * const mi_lttng_context_type_perf_cpu_counter; ++extern const char * const mi_lttng_context_type_perf_thread_counter; + + /* String related to lttng_event_perf_counter_ctx */ +-const char * const mi_lttng_element_perf_counter_context; ++extern const char * const mi_lttng_element_perf_counter_context; + + /* Strings related to pid */ +-const char * const mi_lttng_element_pids; +-const char * const mi_lttng_element_pid; +-const char * const mi_lttng_element_pid_id; ++extern const char * const mi_lttng_element_pids; ++extern const char * const mi_lttng_element_pid; ++extern const char * const mi_lttng_element_pid_id; + + /* Strings related to save command */ +-const char * const mi_lttng_element_save; ++extern const char * const mi_lttng_element_save; + + /* Strings related to load command */ +-const char * const mi_lttng_element_load; ++extern const char * const mi_lttng_element_load; + + /* General element of mi_lttng */ +-const char * const mi_lttng_element_empty; +-const char * const mi_lttng_element_id; +-const char * const mi_lttng_element_nowrite; +-const char * const mi_lttng_element_success; +-const char * const mi_lttng_element_type_enum; +-const char * const mi_lttng_element_type_float; +-const char * const mi_lttng_element_type_integer; +-const char * const mi_lttng_element_type_other; +-const char * const mi_lttng_element_type_string; ++extern const char * const mi_lttng_element_empty; ++extern const char * const mi_lttng_element_id; ++extern const char * const mi_lttng_element_nowrite; ++extern const char * const mi_lttng_element_success; ++extern const char * const mi_lttng_element_type_enum; ++extern const char * const mi_lttng_element_type_float; ++extern const char * const mi_lttng_element_type_integer; ++extern const char * const mi_lttng_element_type_other; ++extern const char * const mi_lttng_element_type_string; + + /* String related to loglevel */ +-const char * const mi_lttng_loglevel_str_alert; +-const char * const mi_lttng_loglevel_str_crit; +-const char * const mi_lttng_loglevel_str_debug; +-const char * const mi_lttng_loglevel_str_debug_function; +-const char * const mi_lttng_loglevel_str_debug_line; +-const char * const mi_lttng_loglevel_str_debug_module; +-const char * const mi_lttng_loglevel_str_debug_process; +-const char * const mi_lttng_loglevel_str_debug_program; +-const char * const mi_lttng_loglevel_str_debug_system; +-const char * const mi_lttng_loglevel_str_debug_unit; +-const char * const mi_lttng_loglevel_str_emerg; +-const char * const mi_lttng_loglevel_str_err; +-const char * const mi_lttng_loglevel_str_info; +-const char * const mi_lttng_loglevel_str_notice; +-const char * const mi_lttng_loglevel_str_unknown; +-const char * const mi_lttng_loglevel_str_warning; ++extern const char * const mi_lttng_loglevel_str_alert; ++extern const char * const mi_lttng_loglevel_str_crit; ++extern const char * const mi_lttng_loglevel_str_debug; ++extern const char * const mi_lttng_loglevel_str_debug_function; ++extern const char * const mi_lttng_loglevel_str_debug_line; ++extern const char * const mi_lttng_loglevel_str_debug_module; ++extern const char * const mi_lttng_loglevel_str_debug_process; ++extern const char * const mi_lttng_loglevel_str_debug_program; ++extern const char * const mi_lttng_loglevel_str_debug_system; ++extern const char * const mi_lttng_loglevel_str_debug_unit; ++extern const char * const mi_lttng_loglevel_str_emerg; ++extern const char * const mi_lttng_loglevel_str_err; ++extern const char * const mi_lttng_loglevel_str_info; ++extern const char * const mi_lttng_loglevel_str_notice; ++extern const char * const mi_lttng_loglevel_str_unknown; ++extern const char * const mi_lttng_loglevel_str_warning; + + /* String related to loglevel JUL */ +-const char * const mi_lttng_loglevel_str_jul_all; +-const char * const mi_lttng_loglevel_str_jul_config; +-const char * const mi_lttng_loglevel_str_jul_fine; +-const char * const mi_lttng_loglevel_str_jul_finer; +-const char * const mi_lttng_loglevel_str_jul_finest; +-const char * const mi_lttng_loglevel_str_jul_info; +-const char * const mi_lttng_loglevel_str_jul_off; +-const char * const mi_lttng_loglevel_str_jul_severe; +-const char * const mi_lttng_loglevel_str_jul_warning; ++extern const char * const mi_lttng_loglevel_str_jul_all; ++extern const char * const mi_lttng_loglevel_str_jul_config; ++extern const char * const mi_lttng_loglevel_str_jul_fine; ++extern const char * const mi_lttng_loglevel_str_jul_finer; ++extern const char * const mi_lttng_loglevel_str_jul_finest; ++extern const char * const mi_lttng_loglevel_str_jul_info; ++extern const char * const mi_lttng_loglevel_str_jul_off; ++extern const char * const mi_lttng_loglevel_str_jul_severe; ++extern const char * const mi_lttng_loglevel_str_jul_warning; + + /* String related to loglevel Log4j */ +-const char * const mi_lttng_loglevel_str_log4j_off; +-const char * const mi_lttng_loglevel_str_log4j_fatal; +-const char * const mi_lttng_loglevel_str_log4j_error; +-const char * const mi_lttng_loglevel_str_log4j_warn; +-const char * const mi_lttng_loglevel_str_log4j_info; +-const char * const mi_lttng_loglevel_str_log4j_debug; +-const char * const mi_lttng_loglevel_str_log4j_trace; +-const char * const mi_lttng_loglevel_str_log4j_all; ++extern const char * const mi_lttng_loglevel_str_log4j_off; ++extern const char * const mi_lttng_loglevel_str_log4j_fatal; ++extern const char * const mi_lttng_loglevel_str_log4j_error; ++extern const char * const mi_lttng_loglevel_str_log4j_warn; ++extern const char * const mi_lttng_loglevel_str_log4j_info; ++extern const char * const mi_lttng_loglevel_str_log4j_debug; ++extern const char * const mi_lttng_loglevel_str_log4j_trace; ++extern const char * const mi_lttng_loglevel_str_log4j_all; + + /* String related to loglevel type */ +-const char * const mi_lttng_loglevel_type_all; +-const char * const mi_lttng_loglevel_type_range; +-const char * const mi_lttng_loglevel_type_single; +-const char * const mi_lttng_loglevel_type_unknown; ++extern const char * const mi_lttng_loglevel_type_all; ++extern const char * const mi_lttng_loglevel_type_range; ++extern const char * const mi_lttng_loglevel_type_single; ++extern const char * const mi_lttng_loglevel_type_unknown; + + /* Sting related to lttng_calibrate */ +-const char * const mi_lttng_element_calibrate; +-const char * const mi_lttng_element_calibrate_function; ++extern const char * const mi_lttng_element_calibrate; ++extern const char * const mi_lttng_element_calibrate_function; + + /* String related to a lttng_snapshot */ +-const char * const mi_lttng_element_snapshot_ctrl_url; +-const char * const mi_lttng_element_snapshot_data_url; +-const char * const mi_lttng_element_snapshot_max_size; +-const char * const mi_lttng_element_snapshot_n_ptr; +-const char * const mi_lttng_element_snapshot_session_name; +-const char * const mi_lttng_element_snapshots; ++extern const char * const mi_lttng_element_snapshot_ctrl_url; ++extern const char * const mi_lttng_element_snapshot_data_url; ++extern const char * const mi_lttng_element_snapshot_max_size; ++extern const char * const mi_lttng_element_snapshot_n_ptr; ++extern const char * const mi_lttng_element_snapshot_session_name; ++extern const char * const mi_lttng_element_snapshots; + + /* Utility string function */ + const char *mi_lttng_loglevel_string(int value, enum lttng_domain_type domain); +--- a/src/common/config/config-session-abi.h ++++ b/src/common/config/config-session-abi.h +@@ -18,95 +18,95 @@ + #ifndef CONFIG_SESSION_INTERNAL_H + #define CONFIG_SESSION_INTERNAL_H + +-const char * const config_element_channel; +-const char * const config_element_channels; +-const char * const config_element_domain; +-const char * const config_element_domains; +-const char * const config_element_event; +-const char * const config_element_events; +-const char * const config_element_context; +-const char * const config_element_contexts; +-const char * const config_element_attributes; +-const char * const config_element_exclusion; +-const char * const config_element_exclusions; +-const char * const config_element_function_attributes; +-const char * const config_element_probe_attributes; +-const char * const config_element_symbol_name; +-const char * const config_element_address; +-const char * const config_element_offset; +-const char * const config_element_name; +-const char * const config_element_enabled; +-const char * const config_element_overwrite_mode; +-const char * const config_element_subbuf_size; +-const char * const config_element_num_subbuf; +-const char * const config_element_switch_timer_interval; +-const char * const config_element_read_timer_interval; +-const char * const config_element_output; +-const char * const config_element_output_type; +-const char * const config_element_tracefile_size; +-const char * const config_element_tracefile_count; +-const char * const config_element_live_timer_interval; +-const char * const config_element_type; +-const char * const config_element_buffer_type; +-const char * const config_element_session; +-const char * const config_element_sessions; +-const char * const config_element_perf; +-const char * const config_element_config; +-const char * const config_element_started; +-const char * const config_element_snapshot_mode; +-const char * const config_element_loglevel; +-const char * const config_element_loglevel_type; +-const char * const config_element_filter; +-const char * const config_element_snapshot_outputs; +-const char * const config_element_consumer_output; +-const char * const config_element_destination; +-const char * const config_element_path; +-const char * const config_element_net_output; +-const char * const config_element_control_uri; +-const char * const config_element_data_uri; +-const char * const config_element_max_size; +- +-const char * const config_domain_type_kernel; +-const char * const config_domain_type_ust; +-const char * const config_domain_type_jul; +-const char * const config_domain_type_log4j; +- +-const char * const config_buffer_type_per_pid; +-const char * const config_buffer_type_per_uid; +-const char * const config_buffer_type_global; +- +-const char * const config_overwrite_mode_discard; +-const char * const config_overwrite_mode_overwrite; +- +-const char * const config_output_type_splice; +-const char * const config_output_type_mmap; +- +-const char * const config_loglevel_type_all; +-const char * const config_loglevel_type_range; +-const char * const config_loglevel_type_single; +- +-const char * const config_event_type_all; +-const char * const config_event_type_tracepoint; +-const char * const config_event_type_probe; +-const char * const config_event_type_function; +-const char * const config_event_type_function_entry; +-const char * const config_event_type_noop; +-const char * const config_event_type_syscall; +-const char * const config_event_type_kprobe; +-const char * const config_event_type_kretprobe; +- +-const char * const config_event_context_pid; +-const char * const config_event_context_procname; +-const char * const config_event_context_prio; +-const char * const config_event_context_nice; +-const char * const config_event_context_vpid; +-const char * const config_event_context_tid; +-const char * const config_event_context_vtid; +-const char * const config_event_context_ppid; +-const char * const config_event_context_vppid; +-const char * const config_event_context_pthread_id; +-const char * const config_event_context_hostname; +-const char * const config_event_context_ip; +-const char * const config_event_context_perf_thread_counter; ++extern const char * const config_element_channel; ++extern const char * const config_element_channels; ++extern const char * const config_element_domain; ++extern const char * const config_element_domains; ++extern const char * const config_element_event; ++extern const char * const config_element_events; ++extern const char * const config_element_context; ++extern const char * const config_element_contexts; ++extern const char * const config_element_attributes; ++extern const char * const config_element_exclusion; ++extern const char * const config_element_exclusions; ++extern const char * const config_element_function_attributes; ++extern const char * const config_element_probe_attributes; ++extern const char * const config_element_symbol_name; ++extern const char * const config_element_address; ++extern const char * const config_element_offset; ++extern const char * const config_element_name; ++extern const char * const config_element_enabled; ++extern const char * const config_element_overwrite_mode; ++extern const char * const config_element_subbuf_size; ++extern const char * const config_element_num_subbuf; ++extern const char * const config_element_switch_timer_interval; ++extern const char * const config_element_read_timer_interval; ++extern const char * const config_element_output; ++extern const char * const config_element_output_type; ++extern const char * const config_element_tracefile_size; ++extern const char * const config_element_tracefile_count; ++extern const char * const config_element_live_timer_interval; ++extern const char * const config_element_type; ++extern const char * const config_element_buffer_type; ++extern const char * const config_element_session; ++extern const char * const config_element_sessions; ++extern const char * const config_element_perf; ++extern const char * const config_element_config; ++extern const char * const config_element_started; ++extern const char * const config_element_snapshot_mode; ++extern const char * const config_element_loglevel; ++extern const char * const config_element_loglevel_type; ++extern const char * const config_element_filter; ++extern const char * const config_element_snapshot_outputs; ++extern const char * const config_element_consumer_output; ++extern const char * const config_element_destination; ++extern const char * const config_element_path; ++extern const char * const config_element_net_output; ++extern const char * const config_element_control_uri; ++extern const char * const config_element_data_uri; ++extern const char * const config_element_max_size; ++ ++extern const char * const config_domain_type_kernel; ++extern const char * const config_domain_type_ust; ++extern const char * const config_domain_type_jul; ++extern const char * const config_domain_type_log4j; ++ ++extern const char * const config_buffer_type_per_pid; ++extern const char * const config_buffer_type_per_uid; ++extern const char * const config_buffer_type_global; ++ ++extern const char * const config_overwrite_mode_discard; ++extern const char * const config_overwrite_mode_overwrite; ++ ++extern const char * const config_output_type_splice; ++extern const char * const config_output_type_mmap; ++ ++extern const char * const config_loglevel_type_all; ++extern const char * const config_loglevel_type_range; ++extern const char * const config_loglevel_type_single; ++ ++extern const char * const config_event_type_all; ++extern const char * const config_event_type_tracepoint; ++extern const char * const config_event_type_probe; ++extern const char * const config_event_type_function; ++extern const char * const config_event_type_function_entry; ++extern const char * const config_event_type_noop; ++extern const char * const config_event_type_syscall; ++extern const char * const config_event_type_kprobe; ++extern const char * const config_event_type_kretprobe; ++ ++extern const char * const config_event_context_pid; ++extern const char * const config_event_context_procname; ++extern const char * const config_event_context_prio; ++extern const char * const config_event_context_nice; ++extern const char * const config_event_context_vpid; ++extern const char * const config_event_context_tid; ++extern const char * const config_event_context_vtid; ++extern const char * const config_event_context_ppid; ++extern const char * const config_event_context_vppid; ++extern const char * const config_event_context_pthread_id; ++extern const char * const config_event_context_hostname; ++extern const char * const config_event_context_ip; ++extern const char * const config_event_context_perf_thread_counter; + + #endif /* CONFIG_SESSION_INTERNAL_H */ diff --git a/devel/m4/Makefile b/devel/m4/Makefile new file mode 100644 index 0000000..19c8c17 --- /dev/null +++ b/devel/m4/Makefile @@ -0,0 +1,41 @@ +# +# Copyright (C) 2015 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:=m4 +PKG_VERSION:=1.4.17 +PKG_RELEASE:=2 + +PKG_SOURCE_URL:=@GNU/m4 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_MD5SUM:=12a3c829301a4fd6586a57d3fcf196dc +PKG_MAINTAINER:=Heinrich Schuchardt +PKG_LICENSE:=GPL-3.0+ + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/m4 + SECTION:=devel + CATEGORY:=Development + TITLE:=m4 + URL:=https://www.gnu.org/software/m4/ +endef + +define Package/m4/description + GNU M4 is an implementation of the traditional Unix macro processor. + It is used by GNU Autoconf and Automake. +endef + +define Package/m4/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/m4 $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,m4)) diff --git a/devel/make/Makefile b/devel/make/Makefile new file mode 100644 index 0000000..2a1ba49 --- /dev/null +++ b/devel/make/Makefile @@ -0,0 +1,46 @@ +# +# Copyright (C) 2015 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:=make +PKG_VERSION:=4.2.1 +PKG_RELEASE:=2 + +PKG_SOURCE_URL:=@GNU/make +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_MD5SUM:=15b012617e7c44c0ed482721629577ac +PKG_MAINTAINER:=Heinrich Schuchardt +PKG_LICENSE:=GPL-3.0+ + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/make + SECTION:=devel + CATEGORY:=Development + TITLE:=make + URL:=https://www.gnu.org/software/make/ +endef + +define Package/make/description + The Make package contains a tool to create executables from source files. +endef + +define Package/make/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/make $(1)/usr/bin/ +endef + +# provide gnumake.h at build time for other packages +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/gnumake.h $(1)/usr/include/ +endef + +$(eval $(call BuildPackage,make)) diff --git a/devel/patch/Makefile b/devel/patch/Makefile new file mode 100644 index 0000000..d705a30 --- /dev/null +++ b/devel/patch/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2008-2015 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:=patch +PKG_VERSION:=2.7.5 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@GNU/patch +PKG_MD5SUM:=e3da7940431633fb65a01b91d3b7a27a +PKG_LICENSE:=GPL-3.0+ +PKG_LICENSE_FILES:=COPYING + +include $(INCLUDE_DIR)/package.mk + +define Package/patch + SECTION:=devel + CATEGORY:=Development + TITLE:=patch + URL:=http://www.gnu.org/ + MAINTAINER:=Russell Senior +endef + +define Package/patch/description + The Patch package contains a program for modifying or creating files + by applying a "patch" file typically created by the diff program. +endef + +CONFIGURE_ARGS+= --disable-xattr + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install +endef + +define Package/patch/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/patch $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,patch)) diff --git a/devel/pkg-config/Makefile b/devel/pkg-config/Makefile new file mode 100644 index 0000000..7fa0076 --- /dev/null +++ b/devel/pkg-config/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2015-2016 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:=pkg-config +PKG_VERSION:=0.29.1 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://pkgconfig.freedesktop.org/releases/ +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=f739a28cae4e0ca291f82d1d41ef107d +PKG_MAINTAINER:=Heinrich Schuchardt +PKG_LICENSE:=GPL-2+ + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/pkg-config + SECTION:=devel + CATEGORY:=Development + TITLE:=pkg-config + URL:=http://www.freedesktop.org/wiki/Software/pkg-config/ + DEPENDS:=+glib2 $(INTL_DEPENDS) +endef + +define Package/pkg-config/description + pkg-config is a helper tool used when compiling applications and libraries. + It helps you insert the correct compiler options on the command line so an + application can use gcc -o test test.cpkg-config --libs --cflags glib-2.0 + for instance, rather than hard-coding values on where to find glib (or + other libraries). +endef + +define Package/pkg-config/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pkg-config $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/share/aclocal/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/aclocal/pkg.m4 \ + $(1)/usr/share/aclocal/ +endef + +$(eval $(call BuildPackage,pkg-config)) diff --git a/ipv6/aiccu/Makefile b/ipv6/aiccu/Makefile new file mode 100644 index 0000000..4b81e10 --- /dev/null +++ b/ipv6/aiccu/Makefile @@ -0,0 +1,70 @@ +# +# Copyright (C) 2006-2015 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:=aiccu +PKG_VERSION:=20070115 +PKG_RELEASE:=16 + +PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.sixxs.net/archive/sixxs/aiccu/unix +PKG_MD5SUM:=c9bcc83644ed788e22a7c3f3d4021350 +PKG_LICENSE:=BSD-3-Clause +PKG_LICENSE_FILES:=doc/LICENSE + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/aiccu/Default + TITLE:=SixXS IPv6 Connectivity Client ($(1)) + SECTION:=net + CATEGORY:=Network + VARIANT:=$(2) + DEPENDS:=+libpthread +ip +kmod-sit +kmod-tun $(3) + URL:=http://www.sixxs.net/tools/aiccu/ + MAINTAINER:=Ondrej Caletka +endef + +Package/aiccu=$(call Package/aiccu/Default,without GNUTLS support,default) +Package/aiccu-gnutls=$(call Package/aiccu/Default,with GNUTLS support,gnutls,+libgnutls) + +define Build/Configure + $(SED) "s,strip,/bin/true," $(PKG_BUILD_DIR)/unix-console/Makefile +endef + +ifeq ($(BUILD_VARIANT),gnutls) +CONFIG_AICCU_GNUTLS:=y +endif + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + CC="$(TARGET_CC)" OS_NAME="Linux" OS_VERSION="$(LINUX_VERSION)" \ + EXTRA_CFLAGS="$(TARGET_CFLAGS)" \ + EXTRA_LDFLAGS="$(TARGET_LDFLAGS) -pthread" \ + $(if $(CONFIG_AICCU_GNUTLS),HAVE_GNUTLS=1) \ + DEBUG=0 +endef + +define Package/aiccu/conffiles +/etc/config/aiccu +endef + +Package/aiccu-gnutls/conffiles=$(call Package/aiccu/conffiles) + +define Package/aiccu/install + $(INSTALL_DIR) $(1)/usr/sbin $(1)/lib/netifd/proto $(1)/etc/hotplug.d/ntp + $(INSTALL_BIN) $(PKG_BUILD_DIR)/unix-console/$(PKG_NAME) $(1)/usr/sbin/ + $(INSTALL_BIN) ./files/aiccu.sh $(1)/lib/netifd/proto/aiccu.sh + $(INSTALL_DATA) ./files/aiccu.hotplug $(1)/etc/hotplug.d/ntp/10-aiccu +endef + +Package/aiccu-gnutls/install=$(call Package/aiccu/install,$(1)) + +$(eval $(call BuildPackage,aiccu)) +$(eval $(call BuildPackage,aiccu-gnutls)) diff --git a/ipv6/aiccu/files/aiccu.hotplug b/ipv6/aiccu/files/aiccu.hotplug new file mode 100644 index 0000000..b521371 --- /dev/null +++ b/ipv6/aiccu/files/aiccu.hotplug @@ -0,0 +1,3 @@ +#!/bin/sh +NTPSTRATUMFILE="/var/run/aiccu_ntp_stratum" +echo $stratum > "$NTPSTRATUMFILE" diff --git a/ipv6/aiccu/files/aiccu.sh b/ipv6/aiccu/files/aiccu.sh new file mode 100755 index 0000000..584574b --- /dev/null +++ b/ipv6/aiccu/files/aiccu.sh @@ -0,0 +1,121 @@ +#!/bin/sh +# aiccu.sh - AICCU proto +# Copyright (c) 2014 OpenWrt.org + +[ -n "$INCLUDE_ONLY" ] || { + . /lib/functions.sh + . /lib/functions/network.sh + . ../netifd-proto.sh + init_proto "$@" +} + +proto_aiccu_setup() { + local cfg="$1" + local iface="$2" + local link="aiccu-$cfg" + + local username password protocol server ip6prefix tunnelid requiretls defaultroute nat heartbeat verbose sourcerouting ip6addr ntpsynctimeout + json_get_vars username password protocol server ip6prefix tunnelid requiretls defaultroute nat heartbeat verbose sourcerouting ip6addr ntpsynctimeout + + [ -z "$username" -o -z "$password" ] && { + proto_notify_error "$cfg" "MISSING_USERNAME_OR_PASSWORD" + proto_block_restart "$cfg" + return + } + + ( proto_add_host_dependency "$cfg" 0.0.0.0 ) + + CFGFILE="/var/etc/${link}.conf" + PIDFILE="/var/run/${link}.pid" + NTPSTRATUMFILE="/var/run/aiccu_ntp_stratum" + mkdir -p /var/run /var/etc + + echo "username $username" > "$CFGFILE" + echo "password $password" >> "$CFGFILE" + echo "ipv6_interface $link" >> "$CFGFILE" + [ -n "$server" ] && echo "server $server" >> "$CFGFILE" + [ -n "$protocol" ] && echo "protocol $protocol" >> "$CFGFILE" + [ -n "$tunnelid" ] && echo "tunnel_id $tunnelid" >> "$CFGFILE" + [ "$requiretls" == 1 ] && echo "requiretls true" >> "$CFGFILE" + [ "$nat" == 1 ] && echo "behindnat true" >> "$CFGFILE" + [ "$heartbeat" == 1 ] && echo "makebeats true" >> "$CFGFILE" + [ "$verbose" == 1 ] && echo "verbose true" >> "$CFGFILE" + echo "defaultroute false" >> "$CFGFILE" + echo "daemonize true" >> "$CFGFILE" + echo "pidfile $PIDFILE" >> "$CFGFILE" + + # By default, wait at most 90 seconds for NTP sync + [ -z "$ntpsynctimeout" ] && ntpsynctimeout=90 + for i in $(seq 1 $ntpsynctimeout); do + [ -f "$NTPSTRATUMFILE" ] && \ + [ "$(cat $NTPSTRATUMFILE)" -lt 16 ] && \ + echo "NTP synced, stratum $(cat $NTPSTRATUMFILE)" && break + [ "$(( $i % 10 ))" -eq 0 ] && echo "Waiting ${i} secs for NTP sync..." + sleep 1 + done + + aiccu start "$CFGFILE" + + [ "$?" -ne 0 ] && { + proto_notify_error "$cfg" "AICCU_FAILED_SEE_LOG" + proto_block_restart "$cfg" + return + } + + proto_init_update "$link" 1 + + local source="" + [ "$sourcerouting" != "0" ] && source="::/128" + [ "$defaultroute" != "0" ] && proto_add_ipv6_route "::" 0 "" "" "" "$source" + + [ -n "$ip6addr" ] && { + local local6="${ip6addr%%/*}" + local mask6="${ip6addr##*/}" + [[ "$local6" = "$mask6" ]] && mask6= + proto_add_ipv6_address "$local6" "$mask6" + [ "$defaultroute" != "0" -a "$sourcerouting" != "0" ] && proto_add_ipv6_route "::" 0 "" "" "" "$local6/$mask6" + } + + [ -n "$ip6prefix" ] && { + proto_add_ipv6_prefix "$ip6prefix" + [ "$defaultroute" != "0" -a "$sourcerouting" != "0" ] && proto_add_ipv6_route "::" 0 "" "" "" "$ip6prefix" + } + + proto_send_update "$cfg" + +} + +proto_aiccu_teardown() { + local cfg="$1" + local link="aiccu-$cfg" + CFGFILE="/var/etc/${link}.conf" + PIDFILE="/var/run/${link}.pid" + [ -f "$CFGFILE" -a -f "$PIDFILE" ] && { + local pid="$(cat "$PIDFILE")" + [ -d /proc/$pid -a $(cat /proc/$pid/comm) = "aiccu" ] && \ + aiccu stop "$CFGFILE" + } +} + +proto_aiccu_init_config() { + no_device=1 + available=1 + proto_config_add_string "username" + proto_config_add_string "password" + proto_config_add_string "protocol" + proto_config_add_string "server" + proto_config_add_string "ip6addr:ip6addr" + proto_config_add_string "ip6prefix:ip6addr" + proto_config_add_string "tunnelid" + proto_config_add_boolean "requiretls" + proto_config_add_boolean "defaultroute" + proto_config_add_boolean "sourcerouting" + proto_config_add_boolean "nat" + proto_config_add_boolean "heartbeat" + proto_config_add_boolean "verbose" + proto_config_add_int "ntpsynctimeout" +} + +[ -n "$INCLUDE_ONLY" ] || { + add_protocol aiccu +} diff --git a/ipv6/aiccu/patches/100-cross_compile.patch b/ipv6/aiccu/patches/100-cross_compile.patch new file mode 100644 index 0000000..6ef8ad5 --- /dev/null +++ b/ipv6/aiccu/patches/100-cross_compile.patch @@ -0,0 +1,101 @@ +--- a/unix-console/Makefile ++++ b/unix-console/Makefile +@@ -25,7 +25,8 @@ CWARNS += -W -Wall -Wshadow -Wpointer-ar + # CWARNS += -Wpacked + + #CFLAGS += $(CWARNS) -D_GNU_SOURCE -D_DEBUG -g3 -O0 +-CFLAGS += $(CWARNS) -D_GNU_SOURCE ++CFLAGS += $(CWARNS) $(EXTRA_CFLAGS) -D_GNU_SOURCE ++LDFLAGS += $(EXTRA_LDFLAGS) + CC = @gcc + RM = rm + +@@ -40,25 +41,25 @@ CFLAGS += -D AICCU_CONSOLE + # GnuTLS Support ? + # Used by TIC to secure that communication + # Currently defaultly builds only on Linux, but other platforms might easily also support it +-ifeq ($(shell uname | grep -c "Linux"),1) ++ifneq ($(HAVE_GNUTLS),) + CFLAGS += -D AICCU_GNUTLS + LDFLAGS += -lgnutls + endif + + # Linux +-ifeq ($(shell uname | grep -c "Linux"),1) ++ifeq ($(OS_NAME),Linux) + CFLAGS += -D_LINUX -D HAS_IFHEAD -D AICCU_TYPE="\"linux\"" + SRCS += ../common/aiccu_linux.c + OBJS += ../common/aiccu_linux.o +-LDFLAGS += -lpthread -lresolv ++LDFLAGS += -pthread -lresolv + endif + + # FreeBSD +-ifeq ($(shell uname | grep -c "FreeBSD"),1) ++ifeq ($(OS_NAME),FreeBSD) + CFLAGS += -D_FREEBSD + + # FreeBSD 4.x +-ifeq ($(shell uname -r | cut -c 1),4) ++ifeq ($(shell echo $(OS_VERSION) | cut -c 1),4) + CFLAGS += -D AICCU_TYPE="\"freebsd4\"" + SRCS += ../common/aiccu_freebsd4.c + OBJS += ../common/aiccu_freebsd4.o +@@ -71,7 +72,7 @@ endif + endif + + # DragonFlyBSD +-ifeq ($(shell uname | grep -c "DragonFly"),1) ++ifeq ($(OS_NAME),DragonFly) + CFLAGS += -D_DFBSD -D NEED_IFHEAD -D AICCU_TYPE="\"dragonfly\"" + SRCS += ../common/aiccu_freebsd4.c + OBJS += ../common/aiccu_freebsd4.o +@@ -79,7 +80,7 @@ CFLAGS += -pthread + endif + + # NetBSD +-ifeq ($(shell uname | grep -c "NetBSD"),1) ++ifeq ($(OS_NAME),NetBSD) + CFLAGS += -D_NETBSD -D AICCU_TYPE="\"kame\"" + + # Check if net/if_tun.h has TUNSIFHEAD and enable support for it +@@ -97,10 +98,10 @@ CFLAGS += -pthread -D_NETBSD_SOURCE + endif + + # OpenBSD +-ifeq ($(shell uname | grep -c "OpenBSD"),1) ++ifeq ($(OS_NAME),OpenBSD) + CFLAGS += -D_OPENBSD -D HAS_IFHEAD + # 2.7-2.9 +-ifeq ($(shell uname -r | cut -c 1),2) ++ifeq ($(shell echo $(OS_VERSION) | cut -c 1),2) + CFLAGS += -D AICCU_TYPE="\"openbsd2\"" + SRCS += ../common/aiccu_openbsd2.c + OBJS += ../common/aiccu_openbsd2.o +@@ -114,7 +115,7 @@ CFLAGS += -pthread + endif + + # Darwin +-ifeq ($(shell uname | grep -c "Darwin"),1) ++ifeq ($(OS_NAME),Darwin) + CFLAGS += -D_DARWIN -D NEED_IFHEAD -D AICCU_TYPE="\"darwin\"" + SRCS += ../common/aiccu_darwin.c + OBJS += ../common/aiccu_darwin.o +@@ -122,7 +123,7 @@ LDFLAGS += -lresolv + endif + + # SunOS / Solaris +-ifeq ($(shell uname | grep -c "SunOS"),1) ++ifeq ($(OS_NAME),SunOS) + CFLAGS += -D_SUNOS -D AICCU_TYPE="\"sunos\"" + SRCS += ../common/aiccu_sunos.c + OBJS += ../common/aiccu_sunos.o +@@ -130,7 +131,7 @@ LDFLAGS += -lsocket -lnsl -lresolv + endif + + # AIX +-ifeq ($(shell uname | grep -c "AIX"),1) ++ifeq ($(OS_NAME),AIX) + CC = @/usr/vac/bin/xlc_r + CFLAGS = -qthreaded -q64 -qlanglvl=stdc99 -bmaxdata:0xD0000000 -D_64BIT -g -qdbxextra -qfullpath -qheapdebug -qformat=all -qcheck=all + CFLAGS += -D AICCU_CONSOLE diff --git a/ipv6/aiccu/patches/200-add_dn_skipname.patch b/ipv6/aiccu/patches/200-add_dn_skipname.patch new file mode 100644 index 0000000..3ce1e92 --- /dev/null +++ b/ipv6/aiccu/patches/200-add_dn_skipname.patch @@ -0,0 +1,68 @@ +--- /dev/null ++++ b/common/dn_skipname.c +@@ -0,0 +1,51 @@ ++#include ++#include ++ ++/* Ripped from glibc 2.4 sources. */ ++ ++/* ++ * ns_name_skip(ptrptr, eom) ++ * Advance *ptrptr to skip over the compressed name it points at. ++ * return: ++ * 0 on success, -1 (with errno set) on failure. ++ */ ++int ns_name_skip(const u_char **ptrptr, const u_char *eom) ++{ ++ const u_char *cp; ++ u_int n; ++ ++ cp = *ptrptr; ++ while (cp < eom && (n = *cp++) != 0) ++ { ++ /* Check for indirection. */ ++ switch (n & NS_CMPRSFLGS) { ++ case 0: /* normal case, n == len */ ++ cp += n; ++ continue; ++ case NS_CMPRSFLGS: /* indirection */ ++ cp++; ++ break; ++ default: /* illegal type */ ++ errno = EMSGSIZE; ++ return (-1); ++ } ++ break; ++ } ++ if (cp > eom) ++ { ++ errno = EMSGSIZE; ++ return (-1); ++ } ++ *ptrptr = cp; ++ return (0); ++} ++ ++int dn_skipname(const u_char *ptr, const u_char *eom) ++{ ++ const u_char *saveptr = ptr; ++ ++ if(ns_name_skip(&ptr, eom) == -1) ++ return (-1); ++ return (ptr - saveptr); ++} ++ +--- a/unix-console/Makefile ++++ b/unix-console/Makefile +@@ -10,9 +10,9 @@ + # $Date: 2007-01-15 11:04:27 $ + # **********************************************************/ + +-SRCS = main.c ../common/tun.c ../common/aiccu.c ../common/hash_md5.c ../common/hash_sha1.c ../common/common.c ../common/heartbeat.c ../common/tic.c ../common/ayiya.c ../common/aiccu_test.c ../common/resolver.c ++SRCS = main.c ../common/tun.c ../common/aiccu.c ../common/hash_md5.c ../common/hash_sha1.c ../common/common.c ../common/heartbeat.c ../common/tic.c ../common/ayiya.c ../common/aiccu_test.c ../common/resolver.c ../common/dn_skipname.c + INCS = ../common/tun.h ../common/aiccu.h ../common/hash_md5.h ../common/hash_sha1.h ../common/common.h ../common/heartbeat.h ../common/tic.h ../common/ayiya.h ../common/resolver.h +-OBJS = main.o ../common/tun.o ../common/aiccu.o ../common/hash_md5.o ../common/hash_sha1.o ../common/common.o ../common/heartbeat.o ../common/tic.o ../common/ayiya.o ../common/aiccu_test.o ../common/resolver.o ++OBJS = main.o ../common/tun.o ../common/aiccu.o ../common/hash_md5.o ../common/hash_sha1.o ../common/common.o ../common/heartbeat.o ../common/tic.o ../common/ayiya.o ../common/aiccu_test.o ../common/resolver.o ../common/dn_skipname.o + + # New features not fully implemented and thus disabled for now + #CFLAGS += -D NEWSTUFF_TSP -D NEWSTUFF_TEEPEE diff --git a/ipv6/aiccu/patches/300-resolver-uclibc.patch b/ipv6/aiccu/patches/300-resolver-uclibc.patch new file mode 100644 index 0000000..b88ef5c --- /dev/null +++ b/ipv6/aiccu/patches/300-resolver-uclibc.patch @@ -0,0 +1,29 @@ +--- a/common/resolver.c ++++ b/common/resolver.c +@@ -26,7 +26,7 @@ + + int getrrs(const char *label, int rrtype, void gotrec(unsigned int num, int type, const char *record)) + { +-#ifdef _LINUX ++#if defined(_LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__) + struct __res_state res; + #endif + unsigned char answer[8192]; +@@ -38,7 +38,7 @@ int getrrs(const char *label, int rrtype + uint16_t type = 0, class = 0; + uint32_t ttl = 0; + +-#ifdef _LINUX ++#if defined(_LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__) + memset(&res, 0, sizeof(res)); + res.options = RES_DEBUG; + res_ninit(&res); +@@ -47,7 +47,7 @@ int getrrs(const char *label, int rrtype + #endif + + memset(answer, 0, sizeof(answer)); +-#ifdef _LINUX ++#if defined(_LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__) + ret = res_nquery(&res, label, C_IN, rrtype, answer, sizeof(answer)); + #else + ret = res_query(label, C_IN, rrtype, answer, sizeof(answer)); diff --git a/ipv6/aiccu/patches/400-musl-compat.patch b/ipv6/aiccu/patches/400-musl-compat.patch new file mode 100644 index 0000000..b6e0c32 --- /dev/null +++ b/ipv6/aiccu/patches/400-musl-compat.patch @@ -0,0 +1,31 @@ +--- a/common/common.h ++++ b/common/common.h +@@ -50,6 +50,7 @@ + #include + #include + #include ++#include + #include + + #if defined(_SUNOS) || defined(_AIX) || defined(_DARWIN) +@@ -91,7 +92,9 @@ + #include + + #include ++#if defined(__GLIBC__) || defined(__UCLIBC__) + #include ++#endif + #ifdef linux + #include + #include +--- a/common/dn_skipname.c ++++ b/common/dn_skipname.c +@@ -1,6 +1,8 @@ + #include + #include + ++#include ++ + /* Ripped from glibc 2.4 sources. */ + + /* diff --git a/ipv6/aiccu/patches/500-gnutls_3.4.patch b/ipv6/aiccu/patches/500-gnutls_3.4.patch new file mode 100644 index 0000000..a314784 --- /dev/null +++ b/ipv6/aiccu/patches/500-gnutls_3.4.patch @@ -0,0 +1,22 @@ +--- aiccu/common/common.c ++++ aiccu/common/common.c +@@ -271,8 +271,6 @@ + TLSSOCKET sock_alloc(void) + { + #ifdef AICCU_GNUTLS +- /* Allow connections to servers that have OpenPGP keys as well */ +- const int cert_type_priority[3] = { GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0 }; + int ret; + #endif /* AICCU_GNUTLS*/ + +@@ -300,7 +298,8 @@ + gnutls_set_default_priority(sock->session); + /* XXX: Return value is not documented in GNUTLS documentation! */ + +- gnutls_certificate_type_set_priority(sock->session, cert_type_priority); ++ /* Allow connections to servers that have OpenPGP keys as well */ ++ gnutls_priority_set_direct(sock->session, "NORMAL:+CTYPE-OPENPGP", NULL); + /* XXX: Return value is not documented in GNUTLS documentation! */ + + /* Configure the x509 credentials for the current session */ + diff --git a/ipv6/tayga/Makefile b/ipv6/tayga/Makefile new file mode 100644 index 0000000..d68a271 --- /dev/null +++ b/ipv6/tayga/Makefile @@ -0,0 +1,49 @@ +# $Id: Makefile 5624 2006-11-23 00:29:07Z nbd $ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=tayga +PKG_VERSION:=0.9.2 +PKG_RELEASE:=2 + +PKG_SOURCE:=tayga-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://www.litech.org/tayga/ +PKG_MD5SUM:=7a7b24165ce008df772f398d86fa280e +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/tayga + SECTION:=net + CATEGORY:=Network + DEPENDS:=+ip @IPV6 +kmod-tun + TITLE:=Out-of-kernel stateless NAT64 implementation for Linux + URL:=http://www.litech.org/tayga/ + MAINTAINER:=Ondrej Caletka +endef + +define Package/tayga/description + TAYGA is an out-of-kernel stateless NAT64 implementation for + Linux. It uses the TUN driver to exchange packets with the + kernel, which is the same driver used by OpenVPN and QEMU/KVM. +endef + +ifdef CONFIG_PACKAGE_netifd + define Package/tayga/install + $(INSTALL_DIR) $(1)/usr/sbin $(1)/lib/netifd/proto + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tayga $(1)/usr/sbin/ + $(INSTALL_BIN) ./files/tayga-proto.sh $(1)/lib/netifd/proto/tayga.sh + endef +else + define Package/tayga/install + $(INSTALL_DIR) $(1)/usr/sbin $(1)/lib/network $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tayga $(1)/usr/sbin/ + $(INSTALL_DATA) ./files/tayga.sh $(1)/lib/network/tayga.sh + $(INSTALL_DATA) ./files/tayga.hotplug $(1)/etc/hotplug.d/iface/95-tayga + endef +endif + +$(eval $(call BuildPackage,tayga)) diff --git a/ipv6/tayga/files/tayga-proto.sh b/ipv6/tayga/files/tayga-proto.sh new file mode 100755 index 0000000..b92c2a6 --- /dev/null +++ b/ipv6/tayga/files/tayga-proto.sh @@ -0,0 +1,96 @@ +#!/bin/sh +# tayga.sh - TAYGA proto +# Copyright (c) 2014 OpenWrt.org + +[ -n "$INCLUDE_ONLY" ] || { + . /lib/functions.sh + . /lib/functions/network.sh + . ../netifd-proto.sh + init_proto "$@" +} + +proto_tayga_setup() { + local cfg="$1" + local iface="$2" + local link="tayga-$cfg" + + local ipv4_addr ipv6_addr prefix dynamic_pool ipaddr ip6addr noroutes + json_get_vars ipv4_addr ipv6_addr prefix dynamic_pool ipaddr ip6addr noroutes + [ -z "$ipv4_addr" -o -z "$prefix" ] && { + proto_notify_error "$cfg" "REQUIRED_PARAMETERS_MISSING" + proto_block_restart "$cfg" + return + } + + local tmpconf="/var/etc/tayga-$cfg.conf" + mkdir -p /var/etc + mkdir -p /var/run/tayga/$cfg + + echo "tun-device $link" >$tmpconf + echo "ipv4-addr $ipv4_addr" >>$tmpconf + [ -n "$ipv6_addr" ] && + echo "ipv6-addr $ipv6_addr" >>$tmpconf + [ -n "$prefix" ] && + echo "prefix $prefix" >>$tmpconf + [ -n "$dynamic_pool" ] && + echo "dynamic-pool $dynamic_pool" >>$tmpconf + echo "data-dir /var/run/tayga/$cfg" >>$tmpconf + #TODO: Support static mapping of IPv4 <-> IPv6 + + # here we create TUN device and check configuration + tayga -c $tmpconf --mktun + [ "$?" -ne 0 ] && { + proto_notify_error "$cfg" "TAYGA_FAILED" + proto_block_restart "$cfg" + return + } + + proto_init_update "$link" 1 + + [ -n "$ipaddr" ] && proto_add_ipv4_address "$ipaddr" "255.255.255.255" + [ -n "$ip6addr" ] && proto_add_ipv6_address "$ip6addr" "128" + + [ "$noroutes" != 1 ] && { + [ -n "$ipv6_addr" ] && proto_add_ipv6_route "$ipv6_addr" "128" + [ -n "$dynamic_pool" ] && { + local pool="${dynamic_pool%%/*}" + local mask="${dynamic_pool##*/}" + proto_add_ipv4_route "$pool" "$mask" + } + [ -n "$prefix" ] && { + local prefix6="${prefix%%/*}" + local mask6="${prefix##*/}" + proto_add_ipv6_route "$prefix6" "$mask6" + } + } + + proto_send_update "$cfg" + + proto_run_command "$cfg" tayga -n -c $tmpconf \ + -p /var/run/$link.pid + +} + +proto_tayga_teardown() { + local cfg="$1" + local tmpconf="/var/etc/tayga-$cfg.conf" + proto_kill_command "$cfg" + sleep 1 + tayga -c $tmpconf --rmtun +} + +proto_tayga_init_config() { + no_device=1 + available=1 + proto_config_add_string "ipv4_addr" + proto_config_add_string "ipv6_addr" + proto_config_add_string "prefix" + proto_config_add_string "dynamic_pool" + proto_config_add_string "ipaddr" + proto_config_add_string "ip6addr:ip6addr" + proto_config_add_boolean "noroutes" +} + +[ -n "$INCLUDE_ONLY" ] || { + add_protocol tayga +} diff --git a/ipv6/tayga/files/tayga.hotplug b/ipv6/tayga/files/tayga.hotplug new file mode 100644 index 0000000..fb989bd --- /dev/null +++ b/ipv6/tayga/files/tayga.hotplug @@ -0,0 +1,37 @@ +#!/bin/sh + +if [ "$ACTION" = ifup ]; then + . /lib/functions.sh + + include /lib/network + scan_interfaces + + update_tunnel() { + local cfg="$1" + + local proto + config_get proto "$cfg" proto + [ "$proto" = tayga ] || return 0 + + local wandev4 + config_get wandev4 "$cfg" wan4_device "$(find_tayga_wanif4)" + + local wandev6 + config_get wandev6 "$cfg" wan6_device "$(find_tayga_wanif6)" + + [ "$wandev4" = "$DEVICE" ] || [ "$wandev6" = "$DEVICE" ] || return 0 + + local wanip4=$(find_tayga_wanip4 "$wandev4") + local wanip6=$(find_tayga_wanip6 "$wandev6") + + [ -n "$wanip4" ] && [ -n "$wanip6" ] && { + uci_set_state network "$cfg" ipv4addr "$wanip4" + uci_set_state network "$cfg" ipv6addr "$wanip6" + + logger -t tayga-update "Re-establishing tayga NAT64 due to change on $INTERFACE ($DEVICE)" + ifup "$cfg" & + } + } + + config_foreach update_tunnel interface +fi diff --git a/ipv6/tayga/files/tayga.sh b/ipv6/tayga/files/tayga.sh new file mode 100644 index 0000000..a9edb6d --- /dev/null +++ b/ipv6/tayga/files/tayga.sh @@ -0,0 +1,152 @@ +# tayga.sh - NAT64 backend + +find_tayga_wanif4() { + local if=$(ip -4 r l e 0.0.0.0/0); if="${if#default* dev }"; if="${if%% *}" + [ -n "$if" ] && grep -qs "^ *$if:" /proc/net/dev && echo "$if" +} + +find_tayga_wanip4() { + local ip=$(ip -4 a s dev "$1"); ip="${ip#*inet }" + echo "${ip%%[^0-9.]*}" +} + +find_tayga_wanif6() { + local if=$(ip -6 r l e ::/0); if="${if#default* dev }"; if="${if%% *}" + [ -n "$if" ] && grep -qs "^ *$if:" /proc/net/dev && echo "$if" +} + +find_tayga_wanip6() { + local ip=$(ip -6 a s dev "$1"); ip="${ip#*inet6 }" + echo "${ip%%[^0-9A-Fa-f:]*}" +} + +# Hook into scan_interfaces() to synthesize a .device option +# This is needed for /sbin/ifup to properly dispatch control +# to setup_interface_tayga() even if no .ifname is set in +# the configuration. +scan_tayga() { + config_set "$1" device "tayga-$1" +} + +coldplug_interface_tayga() { + setup_interface_tayga "tayga-$1" "$1" +} + +tayga_add_static_mappings() { + local tmpconf="$1" + + ( + . /lib/functions.sh + config_load firewall + + tayga_map_rule_add() { + local cfg="$1" + local tmpconf="$2" + local ipv4_addr ipv6_addr + config_get ipv4_addr "$cfg" ipv4_addr "" + config_get ipv6_addr "$cfg" ipv6_addr "" + [ -n "$ipv4_addr" ] && [ -n "$ipv6_addr" ] && + echo "map $ipv4_addr $ipv6_addr" >>$tmpconf + } + + config_foreach tayga_map_rule_add nat64 "$tmpconf" + ) +} + +setup_interface_tayga() { + local iface="$1" + local cfg="$2" + local link="tayga-$cfg" + + local ipv4_addr ipv6_addr prefix dynamic_pool + + config_get ipv4_addr "$cfg" ipv4_addr + config_get ipv6_addr "$cfg" ipv6_addr + config_get prefix "$cfg" prefix + config_get dynamic_pool "$cfg" dynamic_pool + + local args + + include /lib/network + scan_interfaces + + local wanip4=$(uci_get network "$cfg" ipv4addr) + local wanip6=$(uci_get network "$cfg" ipv6addr) + + local wanif4=$(find_tayga_wanif4) + local wanif6=$(find_tayga_wanif6) + + [ -z "$wanip4" ] && { + [ -n "$wanif4" ] && { + wanip4=$(find_tayga_wanip4 "$wanif4") + uci_set_state network "$cfg" wan4_device "$wanif4" + } + } + + [ -z "$wanip6" ] && { + [ -n "$wanif6" ] && { + wanip6=$(find_tayga_wanip6 "$wanif6") + uci_set_state network "$cfg" wan6_device "$wanif6" + } + } + + [ -n "$wanip4" ] && [ -n "$wanip6" ] || { + echo "Cannot determine local IPv4 and IPv6 addressed for tayga NAT64 $cfg - skipping" + return 1 + } + + local tmpconf="/var/etc/tayga-$cfg.conf" + args="-c $tmpconf" + mkdir -p /var/etc + mkdir -p /var/run/tayga/$cfg + + echo "tun-device $link" >$tmpconf + echo "ipv4-addr $ipv4_addr" >>$tmpconf + [ -n "$ipv6_addr" ] && + echo "ipv6-addr $ipv6_addr" >>$tmpconf + [ -n "$prefix" ] && + echo "prefix $prefix" >>$tmpconf + + tayga_add_static_mappings "$tmpconf" + + [ -n "$dynamic_pool" ] && + echo "dynamic-pool $dynamic_pool" >>$tmpconf + echo "data-dir /var/run/tayga/$cfg" >>$tmpconf + + # creating the tunnel below will trigger a net subsystem event + # prevent it from touching or iface by disabling .auto here + uci_set_state network "$cfg" ifname $link + uci_set_state network "$cfg" auto 0 + + # here we create TUN device and check configuration + tayga $args --mktun || return 1 + + ip link set "$link" up + + ip addr add "$wanip4" dev "$link" + ip addr add "$wanip6" dev "$link" + + [ -n "$dynamic_pool" ] && + ip -4 route add "$dynamic_pool" dev "$link" + [ -n "$prefix" ] && + ip -6 route add "$prefix" dev "$link" + + start-stop-daemon -S -x tayga -- $args -p /var/run/$link.pid + + env -i ACTION="ifup" DEVICE="$link" INTERFACE="$cfg" PROTO="tayga" \ + /sbin/hotplug-call iface +} + +stop_interface_tayga() { + local cfg="$1" + local link="tayga-$cfg" + + env -i ACTION="ifdown" DEVICE="$link" INTERFACE="$cfg" PROTO="tayga" \ + /sbin/hotplug-call iface + + service_kill tayga "/var/run/$link.pid" + + ip link set "$link" down + ip addr flush dev "$link" + ip route flush dev "$link" +} diff --git a/ipv6/tayga/patches/001-configure_unset_CFLAGS.patch b/ipv6/tayga/patches/001-configure_unset_CFLAGS.patch new file mode 100644 index 0000000..c56b5f2 --- /dev/null +++ b/ipv6/tayga/patches/001-configure_unset_CFLAGS.patch @@ -0,0 +1,11 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -5,8 +5,6 @@ AC_CONFIG_HEADERS(config.h) + + AC_PROG_CC + +-CFLAGS='-g -Wall' +- + tayga_conf_path=${sysconfdir}/tayga.conf + + AC_SUBST(tayga_conf_path) diff --git a/ipv6/tayga/patches/002-bigendian_wrong_checksum.patch b/ipv6/tayga/patches/002-bigendian_wrong_checksum.patch new file mode 100644 index 0000000..d8deac3 --- /dev/null +++ b/ipv6/tayga/patches/002-bigendian_wrong_checksum.patch @@ -0,0 +1,53 @@ +--- a/nat64.c ++++ b/nat64.c +@@ -19,6 +19,11 @@ + + extern struct config *gcfg; + ++static uint16_t checksum_extend_byte(uint8_t b) ++{ ++ return htons(b << 8); ++} ++ + static uint16_t ip_checksum(void *d, int c) + { + uint32_t sum = 0xffff; +@@ -30,7 +35,7 @@ static uint16_t ip_checksum(void *d, int + } + + if (c) +- sum += htons(*((uint8_t *)p) << 8); ++ sum += checksum_extend_byte(*((uint8_t *)p)); + + while (sum > 0xffff) + sum = (sum & 0xffff) + (sum >> 16); +@@ -180,10 +185,12 @@ static int xlate_payload_4to6(struct pkt + cksum = ones_add(p->icmp->cksum, cksum); + if (p->icmp->type == 8) { + p->icmp->type = 128; +- p->icmp->cksum = ones_add(cksum, ~(128 - 8)); ++ p->icmp->cksum = ones_add(cksum, ++ ~checksum_extend_byte(128 - 8)); + } else { + p->icmp->type = 129; +- p->icmp->cksum = ones_add(cksum, ~(129 - 0)); ++ p->icmp->cksum = ones_add(cksum, ++ ~checksum_extend_byte(129 - 0)); + } + return 0; + case 17: +@@ -668,10 +675,12 @@ static int xlate_payload_6to4(struct pkt + cksum = ones_add(p->icmp->cksum, cksum); + if (p->icmp->type == 128) { + p->icmp->type = 8; +- p->icmp->cksum = ones_add(cksum, 128 - 8); ++ p->icmp->cksum = ones_add(cksum, ++ checksum_extend_byte(128 - 8)); + } else { + p->icmp->type = 0; +- p->icmp->cksum = ones_add(cksum, 129 - 0); ++ p->icmp->cksum = ones_add(cksum, ++ checksum_extend_byte(129 - 0)); + } + return 0; + case 17: diff --git a/kernel/exfat-nofuse/Makefile b/kernel/exfat-nofuse/Makefile new file mode 100644 index 0000000..694ad1e --- /dev/null +++ b/kernel/exfat-nofuse/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2014 Bruno Randolf +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=exfat-nofuse +PKG_VERSION=2016-09-26-$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 + +PKG_SOURCE=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/dorimanx/exfat-nofuse.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=051167ceccbe75d9d77fc4f5356f5a39a01779e8 + +PKG_MAINTAINER:=Bruno Randolf +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/fs-exfat + SUBMENU:=Filesystems + TITLE:=ExFAT Kernel driver + FILES:=$(PKG_BUILD_DIR)/exfat.ko + AUTOLOAD:=$(call AutoLoad,30,exfat,1) + DEPENDS:=+kmod-nls-base @BUILD_PATENTED +endef + +define KernelPackage/fs-exfat/description + Kernel module for ExFAT Filesytems +endef + +MAKE_OPTS:= \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + M="$(PKG_BUILD_DIR)" + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" \ + $(MAKE_OPTS) \ + CONFIG_EXFAT_FS=m \ + modules +endef + +$(eval $(call KernelPackage,fs-exfat)) diff --git a/kernel/mtd-rw/Makefile b/kernel/mtd-rw/Makefile new file mode 100644 index 0000000..7385df9 --- /dev/null +++ b/kernel/mtd-rw/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2016 Joseph C. Lehner +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=mtd-rw +PKG_VERSION:=git-20160214 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/jclehner/mtd-rw.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=7e8562067d6a366c8cbaa8084396c33b7e12986b + +PKG_MAINTAINER=Joseph C. Lehner +PKG_LICENSE=GPL-2.0 +PKG_LICENSE_FILES=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/mtd-rw + SUBMENU:=Other modules + TITLE:=Write-enabler for MTD partitions + FILES:=$(PKG_BUILD_DIR)/mtd-rw.ko +endef + +define KernelPackage/mtd-rw/description + A kernel module that temporarily makes all MTD partitions writeable. +endef + +MAKE_OPTS:= \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + M="$(PKG_BUILD_DIR)" + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" \ + $(MAKE_OPTS) \ + CONFIG_MTD_RW=m \ + modules +endef + +$(eval $(call KernelPackage,mtd-rw)) diff --git a/lang/chardet/Makefile b/lang/chardet/Makefile new file mode 100644 index 0000000..6343b4e --- /dev/null +++ b/lang/chardet/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2007-2016 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:=chardet +PKG_VERSION:=2.3.0 +PKG_RELEASE:=1 +PKG_LICENSE:=LGPL-2.1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://pypi.python.org/packages/source/c/chardet/ +PKG_MD5SUM:=25274d664ccb5130adae08047416e1a8 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/chardet + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=Universal encoding detector for Python 2 and 3 + URL:=https://github.com/chardet/chardet + DEPENDS:=+python +endef + +define Package/chardet/description + Universal encoding detector for Python 2 and 3 +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/chardet/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(INSTALL_DIR) $(1)/usr/bin + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/chardetect \ + $(1)/usr/bin + # fix python exec path in scripts + sed -i 's/#!.*/#!\/usr\/bin\/python/g' $(1)/usr/bin/chardetect +endef + +$(eval $(call BuildPackage,chardet)) diff --git a/lang/django-appconf/Makefile b/lang/django-appconf/Makefile new file mode 100644 index 0000000..c06fa6a --- /dev/null +++ b/lang/django-appconf/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 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:=django-appconf +PKG_VERSION:=1.0.2 +PKG_RELEASE:=1 +PKG_LICENSE:=BSD-3-Clause + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://pypi.python.org/packages/34/b9/d07195652ab494b026f7cb0341dd6e5f2e6e39be177abe05e2cec8bd46e4/ +PKG_MD5SUM:=cc11511a47088bc56531df67cd5d6261 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django-appconf + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=A helper class for handling configuration defaults of packaged apps gracefully. + URL:=http://django-appconf.readthedocs.org/ + DEPENDS:=+python +django +endef + +define Package/django-appconf/description + A helper class for handling configuration defaults of packaged apps gracefully. +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/django-appconf/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,django-appconf)) diff --git a/lang/django-compressor/Makefile b/lang/django-compressor/Makefile new file mode 100644 index 0000000..414e342 --- /dev/null +++ b/lang/django-compressor/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2007-2016 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:=django-compressor +PKG_VERSION:=2.1 +PKG_RELEASE:=1 +PKG_LICENSE:=MIT + +PKG_SOURCE:=django_compressor-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://pypi.python.org/packages/23/46/2c7d582255969ad5259937f5f9e14aec1f3349d0fc0651129330918d1c6d/ +PKG_BUILD_DIR:=$(BUILD_DIR)/django_compressor-$(PKG_VERSION)/ +PKG_MD5SUM:=21ecfe4e8615eae64f7068a5599df9af +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django-compressor + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=Compresses linked and inline JavaScript or CSS into single cached files. + URL:=http://django-compressor.readthedocs.org/ + DEPENDS:=+python +django +endef + +define Package/django-compressor/description + Compresses linked and inline JavaScript or CSS into single cached files. +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/django-compressor/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,django-compressor)) diff --git a/lang/django-constance/Makefile b/lang/django-constance/Makefile new file mode 100644 index 0000000..11dd2e2 --- /dev/null +++ b/lang/django-constance/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 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:=django-constance +PKG_VERSION:=1.2 +PKG_RELEASE:=1 +PKG_LICENSE:=BSD-3-Clause + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://pypi.python.org/packages/0a/ff/1c1caae2b7be9c26f2aee0703236998e22cf5557fa56726347b5afa149d1/ +PKG_MD5SUM:=f9f8e527df50b0a1533149d9be0b814b +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django-constance + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=Django live settings with pluggable backends, including Redis. + URL:=https://github.com/jazzband/django-constance + DEPENDS:=+python +django +endef + +define Package/django-constance/description + Django live settings with pluggable backends, including Redis. +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/django-constance/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,django-constance)) diff --git a/lang/django-jsonfield/Makefile b/lang/django-jsonfield/Makefile new file mode 100644 index 0000000..40a9ff7 --- /dev/null +++ b/lang/django-jsonfield/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 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:=django-jsonfield +PKG_VERSION:=1.0.1 +PKG_RELEASE:=1 +PKG_LICENSE:=BSD-3-Clause + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://pypi.python.org/packages/e4/b2/a079f0a2218e0eb7892edbf404e0bbfbb281a6bbf06966b775f5142ed159/ +PKG_MD5SUM:=2e5e737a3f93f3b5d7ae6026b1340167 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django-jsonfield + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=JSONField for django models + URL:=https://github.com/bradjasper/django-jsonfield + DEPENDS:=+python +django +endef + +define Package/django-jsonfield/description + JSONField for django models +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/django-jsonfield/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,django-jsonfield)) diff --git a/lang/django-picklefield/Makefile b/lang/django-picklefield/Makefile new file mode 100644 index 0000000..0747796 --- /dev/null +++ b/lang/django-picklefield/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 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:=django-picklefield +PKG_VERSION:=0.3.2 +PKG_RELEASE:=1 +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://pypi.python.org/packages/source/d/django-picklefield/ +PKG_MD5SUM:=b2c17ca9e03704ce33890e6aefc7b2e5 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django-picklefield + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=Pickled object field for Django + URL:=http://github.com/gintas/django-picklefield/ + DEPENDS:=+python +django +endef + +define Package/django-picklefield/description + Pickled object field for Django +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/django-picklefield/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,django-picklefield)) diff --git a/lang/django-postoffice/Makefile b/lang/django-postoffice/Makefile new file mode 100644 index 0000000..18dce36 --- /dev/null +++ b/lang/django-postoffice/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2007-2016 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:=django-postoffice +PKG_VERSION:=2.0.8 +PKG_RELEASE:=1 +PKG_LICENSE:=MIT + +PKG_SOURCE:=django-post_office-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://pypi.python.org/packages/52/25/cc0cfe923f183d7c19b162cac3bf8430ddaed7bad28202b8f93a97d248a4/ +PKG_BUILD_DIR:=$(BUILD_DIR)/django-post_office-$(PKG_VERSION)/ +PKG_MD5SUM:=437bf62cef06381d346ae2bc087c0e3c +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django-postoffice + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=A Django app to monitor and send mail asynchronously, complete with template support. + URL:=https://github.com/ui/django-postoffice + DEPENDS:=+python +django +django-jsonfield +endef + +define Package/django-postoffice/description + A Django app to monitor and send mail asynchronously, complete with template support. +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/django-postoffice/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,django-postoffice)) diff --git a/lang/django-restframework/Makefile b/lang/django-restframework/Makefile new file mode 100644 index 0000000..5ae6956 --- /dev/null +++ b/lang/django-restframework/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2007-2016 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:=django-restframework +PKG_VERSION:=3.3.3 +PKG_RELEASE:=1 +PKG_LICENSE:=BSD-3-Clause + +PKG_SOURCE:=djangorestframework-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://pypi.python.org/packages/source/d/djangorestframework/ +PKG_BUILD_DIR:=$(BUILD_DIR)/djangorestframework-$(PKG_VERSION) +PKG_MD5SUM:=6f5ee9646e7fa87dad4385d3c7e7678d +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django-restframework + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=Web APIs for Django, made easy. + URL:=http://www.django-rest-framework.org/ + DEPENDS:=+python +django +endef + +define Package/django-restframework/description + Web APIs for Django, made easy. +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/django-restframework/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,django-restframework)) diff --git a/lang/django-statici18n/Makefile b/lang/django-statici18n/Makefile new file mode 100644 index 0000000..5d94774 --- /dev/null +++ b/lang/django-statici18n/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 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:=django-statici18n +PKG_VERSION:=1.2.1 +PKG_RELEASE:=1 +PKG_LICENSE:=BSD-3-Clause + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://pypi.python.org/packages/72/76/6ee13019e1691bff6b759136068ee77fcc2982b700135caa134030937b28/ +PKG_MD5SUM:=67cac19909dd3272ae1fc73ad8d1dca3 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django-statici18n + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=A Django app that provides helper for generating JavaScript catalog to static files. + URL:=http://django-statici18n.readthedocs.org/ + DEPENDS:=+python +django +endef + +define Package/django-statici18n/description + A Django app that provides helper for generating JavaScript catalog to static files. +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/django-statici18n/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,django-statici18n)) diff --git a/lang/django/Makefile b/lang/django/Makefile new file mode 100644 index 0000000..c932cc1 --- /dev/null +++ b/lang/django/Makefile @@ -0,0 +1,65 @@ +# +# Copyright (C) 2007-2016 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:=django +PKG_VERSION:=1.8.12 +PKG_RELEASE=1 +PKG_LICENSE:=BSD-3-Clause + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/django/django.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=c168aeba175dbb92c615460a360cb1ea978de5d3 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + TITLE:=The web framework for perfectionists with deadlines. + MAINTAINER:=Gergely Kiss + URL:=https://www.djangoproject.com/ + DEPENDS:=+python +endef + +define Package/django/description + The web framework for perfectionists with deadlines. +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(INSTALL_DIR) $(1)/usr/bin + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/django-admin.py \ + $(1)/usr/bin +endef + +define Package/django/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(INSTALL_DIR) $(1)/usr/bin + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/django-admin.py \ + $(1)/usr/bin + # fix python exec path + sed -i 's/#!.*/#!\/usr\/bin\/python/g' $(1)/usr/bin/django-admin.py +endef + +$(eval $(call BuildPackage,django)) diff --git a/lang/dkjson/Makefile b/lang/dkjson/Makefile new file mode 100644 index 0000000..efb0012 --- /dev/null +++ b/lang/dkjson/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 20013-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:=dkjson +PKG_VERSION:=2.5 +PKG_RELEASE:=3 + +PKG_SOURCE_URL:=https://github.com/LuaDist/dkjson.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=e72ba0c9f5d8b8746fc306f6189a819dbb5cd0be +PKG_LICENSE:=MIT +PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.bz2 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/dkjson + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=DKJSON + URL:=http://dkolf.de/src/dkjson-lua.fsl/home + MAINTAINER:=Lars Gierth + DEPENDS:=+lua +endef + +define Package/dkjson/description + Lua JSON parser/serializer with UTF-8 support +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/dkjson/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/dkjson.lua $(1)/usr/lib/lua/ +endef + +$(eval $(call BuildPackage,dkjson)) diff --git a/lang/erlang/Makefile b/lang/erlang/Makefile new file mode 100644 index 0000000..3a86aa5 --- /dev/null +++ b/lang/erlang/Makefile @@ -0,0 +1,339 @@ +# +# Copyright (C) 2009-2015 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:=erlang +PKG_VERSION:=17.5 +PKG_RELEASE:=3 + +PKG_SOURCE:=otp_src_$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:= http://www.erlang.org/download/ \ + http://erlang.mirror.su.se/ +PKG_MD5SUM:=346dd0136bf1cc28cebc140e505206bb + +PKG_LICENSE:=ErlPL-1.1 +PKG_LICENSE_FILES:=EPLICENCE +PKG_MAINTAINER:=Nicolas Thill + +PKG_BUILD_DEPENDS:=erlang/host openssl +PKG_USE_MIPS16:=0 + +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/otp_src_$(PKG_VERSION) +PKG_BUILD_DIR:=$(BUILD_DIR)/otp_src_$(PKG_VERSION) + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/package.mk + +define Package/erlang/Default + SUBMENU:=Erlang + SECTION:=lang + CATEGORY:=Languages + TITLE:=Erlang/OTP programming language + URL:=http://www.erlang.org/ +endef + +define Package/erlang/Default/description + Erlang/OTP is a general-purpose programming language and runtime + environment. Erlang has built-in support for concurrency, distribution + and fault tolerance. +endef + +define Package/erlang +$(call Package/erlang/Default) + DEPENDS+= +libncurses +librt +zlib + PROVIDES:= erlang-erts=6.4 erlang-kernel=3.2 erlang-sasl=2.4.1 erlang-stdlib=2.4 +endef + +define Package/erlang/description +$(call Package/erlang/Default/description) + . + This package contains the runtime implementation and a minimal set of + modules (erts, kernel, sasl & stdlib). +endef + + +define Package/erlang-asn1 +$(call Package/erlang/Default) + TITLE:=Abstract Syntax Notation One (ASN.1) support + VERSION:=3.0.4 + DEPENDS+= +erlang +erlang-syntax-tools +endef + +define Package/erlang-asn1/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides Abstract Syntax Notation One (ASN.1) + support. +endef + + +define Package/erlang-compiler +$(call Package/erlang/Default) + TITLE:=Byte code compiler + VERSION:=5.0.4 + DEPENDS+= +erlang +erlang-hipe +endef + +define Package/erlang-compiler/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides a byte code compiler for Erlang which + produces highly compact code. +endef + + +define Package/erlang-crypto +$(call Package/erlang/Default) + TITLE:=Cryptography support + VERSION:=3.5 + DEPENDS+= +erlang +libopenssl +endef + +define Package/erlang-crypto/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides functions for computation of message + digests, and encryption and decryption functions. +endef + + +define Package/erlang-hipe +$(call Package/erlang/Default) + TITLE:=High Performance Erlang + VERSION:=3.11.3 + DEPENDS+= +erlang +endef + +define Package/erlang-hipe/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides HiPE (High Performance Erlang) + support. +endef + + +define Package/erlang-inets +$(call Package/erlang/Default) + TITLE:=Internet clients and servers + VERSION:=5.10.6 + DEPENDS+= +erlang +endef + +define Package/erlang-inets/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides a container for Internet clients and + servers. Currently a FTP client, a HTTP client and server, and a tftp + client and server have been incorporated in Inets. +endef + + +define Package/erlang-mnesia +$(call Package/erlang/Default) + TITLE:=Distributed database + VERSION:=4.12.5 + DEPENDS+= +erlang +endef + +define Package/erlang-mnesia/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides a distributed DataBase Management + System (DBMS), appropriate for telecommunications applications and + other Erlang applications which require continuous operation and + exhibit soft real-time properties. +endef + + +define Package/erlang-runtime-tools +$(call Package/erlang/Default) + TITLE:=Low-profile debugging/tracing tools + VERSION:=1.8.16 + DEPENDS+= +erlang +endef + +define Package/erlang-runtime-tools/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides low footprint tracing/debugging tools + suitable for inclusion in a production system. +endef + + +define Package/erlang-snmp +$(call Package/erlang/Default) + TITLE:=Simple Network Management Protocol (SNMP) support + VERSION:=5.1.1 + DEPENDS+= +erlang +erlang-asn1 +endef + +define Package/erlang-snmp/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides Simple Network Management Protocol + (SNMP) support including a MIB compiler and tools for creating SNMP + agents. +endef + + +define Package/erlang-ssh +$(call Package/erlang/Default) + TITLE:=Secure Shell (SSH) support + VERSION:=3.2 + DEPENDS+= +erlang +erlang-crypto +endef + +define Package/erlang-ssh/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides an implementation of the Secure Shell + protocol, with SSH & SFTP support. +endef + + +define Package/erlang-ssl +$(call Package/erlang/Default) + TITLE:=Secure Sockets Layer (SSL) support + VERSION:=6.0 + DEPENDS+= +erlang +erlang-crypto +endef + +define Package/erlang-ssl/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides support for secure communication over + sockets. +endef + + +define Package/erlang-syntax-tools +$(call Package/erlang/Default) + TITLE:=Abstract Erlang syntax trees handling support + VERSION:=1.6.18 + DEPENDS+= +erlang +endef + +define Package/erlang-syntax-tools/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides support for handling abstract Erlang + syntax trees. +endef + + +# Host + +HOST_CONFIGURE_ARGS += \ + --disable-hipe \ + --disable-smp-support \ + --without-javac + +HOST_CFLAGS += -D_GNU_SOURCE + +define Host/Compile + $(MAKE) -C $(HOST_BUILD_DIR) all +endef + +define Host/Install + $(MAKE) -C $(HOST_BUILD_DIR) install +endef + + +# Target + +CONFIGURE_ARGS += \ + --disable-hipe \ + --disable-smp-support \ + --without-javac \ + --enable-dynamic-ssl-lib + +CONFIGURE_VARS += \ + SHLIB_LD="$(TARGET_CC)" \ + TARGET_ARCH="$(TARGET_ARCH)" \ + ac_cv_func_mmap_fixed_mapped=yes \ + ac_cv_path_WX_CONFIG_PATH=no \ + erl_xcomp_getaddrinfo=no \ + erl_xcomp_sysroot="$(STAGING_DIR)" + +EXTRA_CFLAGS+=-D_GNU_SOURCE +EXTRA_LDFLAGS+=-lz + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + noboot + $(MAKE) -C $(PKG_BUILD_DIR) \ + INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \ + install +endef + +define Package/erlang/install + $(INSTALL_DIR) $(1)/usr/bin + for f in epmd erl erlc escript run_erl; do \ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/$$$$f $(1)/usr/bin/ ; \ + done + $(INSTALL_DIR) $(1)/usr/lib/erlang/bin + for f in erl erlc escript run_erl start start.boot start.script start_clean.boot start_erl start_sasl.boot to_erl; do \ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/erlang/bin/$$$$f $(1)/usr/lib/erlang/bin/ ; \ + done + $(INSTALL_DIR) $(1)/usr/lib/erlang/lib + for m in erts kernel sasl stdlib; do \ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/erlang/lib/$$$$m-* $(1)/usr/lib/erlang/lib/ ; \ + rm -rf $(1)/usr/lib/erlang/lib/$$$$m-*/examples ; \ + rm -rf $(1)/usr/lib/erlang/lib/$$$$m-*/src ; \ + done + $(INSTALL_DIR) $(1)/usr/lib/erlang + $(CP) $(PKG_INSTALL_DIR)/usr/lib/erlang/erts-* $(1)/usr/lib/erlang/ + rm -rf $(1)/usr/lib/erlang/erts-*/{doc,include,lib,man,src} + rm -rf $(1)/usr/lib/erlang/erts-*/bin/*.src + $(INSTALL_DIR) $(1)/usr/lib/erlang/releases + $(CP) $(PKG_INSTALL_DIR)/usr/lib/erlang/releases/* $(1)/usr/lib/erlang/releases/ + $(SED) 's,%ERL_ROOT%,/usr/lib/erlang,g' \ + $(1)/usr/lib/erlang/releases/RELEASES.src + mv -f $(1)/usr/lib/erlang/releases/RELEASES.src \ + $(1)/usr/lib/erlang/releases/RELEASES + for f in bin/erl bin/start erts-*/bin/erl erts-*/bin/start; do \ + $(SED) 's,^\(ROOTDIR\)=.*,\1=/usr/lib/erlang,g' \ + $(1)/usr/lib/erlang/$$$$f ; \ + done +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/lib/erl_interface/obj/*/*.a $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/lib/erl_interface/include/*.h $(1)/usr/include/ +endef + +define BuildModule + + define Package/erlang-$(1)/install + $(INSTALL_DIR) $$(1)/usr/lib/erlang/lib + for m in $(2); do \ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/erlang/lib/$$$$$$$$m-* $$(1)/usr/lib/erlang/lib/ ; \ + rm -rf $$(1)/usr/lib/erlang/lib/$$$$$$$$m-*/{examples,priv/obj,src} ; \ + done + endef + + $$(eval $$(call BuildPackage,erlang-$(1))) + +endef + + +$(eval $(call HostBuild)) +$(eval $(call BuildPackage,erlang)) +$(eval $(call BuildModule,asn1,asn1)) +$(eval $(call BuildModule,compiler,compiler)) +$(eval $(call BuildModule,crypto,crypto)) +$(eval $(call BuildModule,hipe,hipe)) +$(eval $(call BuildModule,inets,inets)) +$(eval $(call BuildModule,mnesia,mnesia)) +$(eval $(call BuildModule,runtime-tools,runtime_tools)) +$(eval $(call BuildModule,snmp,snmp)) +$(eval $(call BuildModule,ssh,ssh)) +$(eval $(call BuildModule,ssl,ssl)) +$(eval $(call BuildModule,syntax-tools,syntax_tools)) diff --git a/lang/erlang/patches/101-emulator_includes.patch b/lang/erlang/patches/101-emulator_includes.patch new file mode 100644 index 0000000..5a413af --- /dev/null +++ b/lang/erlang/patches/101-emulator_includes.patch @@ -0,0 +1,11 @@ +--- a/erts/emulator/Makefile.in ++++ b/erts/emulator/Makefile.in +@@ -682,7 +682,7 @@ $(OBJDIR)/beam_emu.o: beam/beam_emu.c + endif + + $(OBJDIR)/%.o: beam/%.c +- $(V_CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) $(INCLUDES) -c $< -o $@ ++ $(V_CC) $(INCLUDES) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) -c $< -o $@ + + $(OBJDIR)/%.o: $(TARGET)/%.c + $(V_CC) $(CFLAGS) $(INCLUDES) -Idrivers/common -c $< -o $@ diff --git a/lang/erlang/patches/102-musl_compat.patch b/lang/erlang/patches/102-musl_compat.patch new file mode 100644 index 0000000..d23900e --- /dev/null +++ b/lang/erlang/patches/102-musl_compat.patch @@ -0,0 +1,11 @@ +--- a/lib/erl_interface/src/connect/ei_resolve.c ++++ b/lib/erl_interface/src/connect/ei_resolve.c +@@ -642,7 +642,7 @@ struct hostent *ei_gethostbyname_r(const + #ifndef HAVE_GETHOSTBYNAME_R + return my_gethostbyname_r(name,hostp,buffer,buflen,h_errnop); + #else +-#if (defined(__GLIBC__) || (__FreeBSD_version >= 602000) || defined(__DragonFly__) || defined(__ANDROID__)) ++#if (defined(_GNU_SOURCE) || (__FreeBSD_version >= 602000) || defined(__DragonFly__) || defined(__ANDROID__)) + struct hostent *result; + + gethostbyname_r(name, hostp, buffer, buflen, &result, h_errnop); diff --git a/lang/erlang/patches/103-disable_emacs.patch b/lang/erlang/patches/103-disable_emacs.patch new file mode 100644 index 0000000..9412195 --- /dev/null +++ b/lang/erlang/patches/103-disable_emacs.patch @@ -0,0 +1,11 @@ +--- a/lib/tools/Makefile ++++ b/lib/tools/Makefile +@@ -23,7 +23,7 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk + # Macros + # ---------------------------------------------------- + +-SUB_DIRECTORIES = c_src src doc/src examples priv emacs ++SUB_DIRECTORIES = c_src src doc/src examples priv + + include vsn.mk + VSN = $(TOOLS_VSN) diff --git a/lang/et_xmlfile/Makefile b/lang/et_xmlfile/Makefile new file mode 100644 index 0000000..f0c0139 --- /dev/null +++ b/lang/et_xmlfile/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 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:=et_xmlfile +PKG_VERSION:=1.0.1 +PKG_RELEASE:=1 +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://pypi.python.org/packages/source/e/et_xmlfile/ +PKG_MD5SUM:=f47940fd9d556375420b2e276476cfaf +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/et_xmlfile + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=An implementation of lxml.xmlfile for the standard library + URL:=https://bitbucket.org/openpyxl/et_xmlfile + DEPENDS:=+python +endef + +define Package/et_xmlfile/description + An implementation of lxml.xmlfile for the standard library +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/et_xmlfile/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,et_xmlfile)) diff --git a/lang/flup/Makefile b/lang/flup/Makefile new file mode 100644 index 0000000..b0514f4 --- /dev/null +++ b/lang/flup/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 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:=flup +PKG_VERSION:=1.0.2 +PKG_RELEASE:=1 +PKG_LICENSE:=BSD-3-Clause + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://pypi.python.org/packages/source/f/flup/ +PKG_MD5SUM:=24dad7edc5ada31dddd49456ee8d5254 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/flup + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=Random assortment of WSGI servers + URL:=http://www.saddi.com/software/flup/ + DEPENDS:=+python +endef + +define Package/flup/description + Random assortment of WSGI servers +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/flup/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,flup)) diff --git a/lang/gunicorn/Makefile b/lang/gunicorn/Makefile new file mode 100644 index 0000000..efdf9f4 --- /dev/null +++ b/lang/gunicorn/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2007-2016 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:=gunicorn +PKG_VERSION:=19.6.0 +PKG_RELEASE=1 +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://pypi.python.org/packages/84/ce/7ea5396efad1cef682bbc4068e72a0276341d9d9d0f501da609fab9fcb80/ +PKG_MD5SUM:=338e5e8a83ea0f0625f768dba4597530 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/gunicorn + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + TITLE:=WSGI HTTP Server for UNIX + MAINTAINER:=Gergely Kiss + URL:=http://gunicorn.org/ + DEPENDS:=+python +python-setuptools +endef + +define Package/gunicorn/description + WSGI HTTP Server for UNIX +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/gunicorn/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(INSTALL_DIR) $(1)/usr/bin + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gunicorn* \ + $(1)/usr/bin + # fix python exec path in scripts + $(SED) 's/#!.*/#!\/usr\/bin\/python/g' $(1)/usr/bin/gunicorn* +endef + +$(eval $(call BuildPackage,gunicorn)) diff --git a/lang/jamvm/Makefile b/lang/jamvm/Makefile new file mode 100644 index 0000000..996dfa0 --- /dev/null +++ b/lang/jamvm/Makefile @@ -0,0 +1,67 @@ +# +# Copyright (C) 2006-2015 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:=jamvm +PKG_VERSION:=2.0.0 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-2.0+ +PKG_MAINTAINER:=Dana H. Myers + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/$(PKG_NAME) +PKG_MD5SUM:=a6e3321ef4b3cfb4afc20bd75452e11e + +PKG_USE_MIPS16:=0 + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/jamvm + SUBMENU:=Java + SECTION:=lang + CATEGORY:=Languages + TITLE:=A compact Java Virtual Machine + URL:=http://sourceforge.net/projects/jamvm + DEPENDS:=+zlib +libpthread +librt +classpath @!avr32 +endef + +define Package/jamvm/description + JamVM is a new Java Virtual Machine which conforms to the JVM + specification version (blue book). In comparison to most other VM's (free + and commercial) it is extremely small.However, unlike other small VMs + (e.g. KVM) it is designed to support the full specification, and includes + support for object finalisation, Soft/Weak/Phantom References, the Java + Native Interface (JNI) and the Reflection API. +endef + +CONFIGURE_ARGS += \ + --with-java-runtime-library=gnuclasspath \ + --with-classpath-install-dir=/usr \ + --disable-int-inlining \ + --disable-shared \ + --without-pic + +MAKE_FLAGS += \ + GLIBJ_ZIP=$(STAGING_DIR)/usr/share/classpath/glibj.zip + +define Package/jamvm/install + $(INSTALL_DIR) $(1)/usr + $(CP) \ + $(PKG_INSTALL_DIR)/usr/bin \ + $(PKG_INSTALL_DIR)/usr/share \ + $(1)/usr/ +endef + +define Build/InstallDev + $(CP) $(PKG_INSTALL_DIR)/* $(1)/ +endef + +$(eval $(call BuildPackage,jamvm)) diff --git a/lang/jdcal/Makefile b/lang/jdcal/Makefile new file mode 100644 index 0000000..34d3970 --- /dev/null +++ b/lang/jdcal/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 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:=jdcal +PKG_VERSION:=1.2 +PKG_RELEASE:=1 +PKG_LICENSE:=BSD-3-Clause + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://pypi.python.org/packages/source/j/jdcal/ +PKG_MD5SUM:=ab8d5ba300fd1eb01514f363d19b1eb9 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/jdcal + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=Julian dates from proleptic Gregorian and Julian calendars. + URL:=http://github.com/phn/jdcal + DEPENDS:=+python +endef + +define Package/jdcal/description + Julian dates from proleptic Gregorian and Julian calendars. +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/jdcal/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,jdcal)) diff --git a/lang/json4lua/Makefile b/lang/json4lua/Makefile new file mode 100644 index 0000000..0e0c9c5 --- /dev/null +++ b/lang/json4lua/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2006-2015 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:=json4lua +PKG_VERSION:=0.9.53 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=https://github.com/amrhassan/json4lua.git +PKG_SOURCE_VERSION:=$(PKG_VERSION) + +PKG_MAINTAINER:=Amr Hassan +PKG_LICENSE=MIT + +LUA_MODULE_PATH:=/usr/lib/lua + +include $(INCLUDE_DIR)/package.mk + +define Package/json4lua + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=json4lua + URL:=https://github.com/amrhassan/json4lua + DEPENDS:=+lua +luasocket +endef + +define Package/json4lua/description + JSON and JSONRPC for Lua +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/json4lua/install + $(INSTALL_DIR) $(1)/$(LUA_MODULE_PATH)/json + $(INSTALL_DATA) $(PKG_BUILD_DIR)/json/json.lua $(1)/$(LUA_MODULE_PATH)/json.lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/json/rpc.lua $(1)/$(LUA_MODULE_PATH)/json/rpc.lua +endef + +$(eval $(call BuildPackage,json4lua)) diff --git a/lang/lpeg/Makefile b/lang/lpeg/Makefile new file mode 100644 index 0000000..ee8a4ef --- /dev/null +++ b/lang/lpeg/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=lpeg +PKG_VERSION:=0.12.2 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.inf.puc-rio.br/~roberto/lpeg/ +PKG_MD5SUM:=fabb614eb46e370d4f6b8fd82d17ca7e + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/lpeg + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=LPeg + URL:=http://www.inf.puc-rio.br/~roberto/lpeg/ + DEPENDS:=+lua +endef + +define Package/lpeg/description + LPeg is a new pattern-matching library for Lua, based on Parsing Expression Grammars (PEGs) +endef + +define Build/Configure +endef + +# add make variable overrides here +MAKE_FLAGS += + +define Package/lpeg/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lpeg.so $(1)/usr/lib/lua +endef + +$(eval $(call BuildPackage,lpeg)) diff --git a/lang/lua-bencode/Makefile b/lang/lua-bencode/Makefile new file mode 100644 index 0000000..0b32056 --- /dev/null +++ b/lang/lua-bencode/Makefile @@ -0,0 +1,50 @@ +# +# Copyright (C) 20013-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:=lua-bencode +PKG_VERSION:=2.1.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=https://bitbucket.org/wilhelmy/lua-bencode +PKG_SOURCE_PROTO:=hg +PKG_SOURCE_VERSION:=500243383cb6acbddd3cf12aee6e4667aab53324 +PKG_LICENSE:=MIT + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-bencode + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=lua-bencode + URL:=https://bitbucket.org/wilhelmy/lua-bencode + MAINTAINER:=Lars Gierth + DEPENDS:=+lua +endef + +define Package/lua-bencode/description + This is a module for the lua programming language for decoding and encoding + bencoded data which can be used to read and write torrent files for bittorrent. +endef + +define Build/Configure +endef + +define Build/Compile +endef + + +define Package/lua-bencode/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/bencode.lua $(1)/usr/lib/lua +endef + +$(eval $(call BuildPackage,lua-bencode)) diff --git a/lang/lua-cjson/Makefile b/lang/lua-cjson/Makefile new file mode 100644 index 0000000..7cdb350 --- /dev/null +++ b/lang/lua-cjson/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2015 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:=lua-cjson +PKG_VERSION:=2.1.0 +PKG_RELEASE:=2 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.kyne.com.au/~mark/software/download/ +PKG_MD5SUM:=24f270663e9f6ca8ba2a02cef19f7963 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +HOST_BUILD_DEPENDS:=lua/host + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/lua-cjson + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua CJSON parser + URL:=https://github.com/mpx/lua-cjson + DEPENDS:= +lua +endef + +define Package/lua-cjson/description + Lua CJSON is a fast JSON encoding/parsing module for Lua. +endef + +CMAKE_OPTIONS += \ + -DUSE_LUA=ON + +CMAKE_HOST_OPTIONS += \ + -DLUA_MATH_LIBRARY=m + +define Package/lua-cjson/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/cjson.so $(1)/usr/lib/lua/ + + $(INSTALL_DIR) $(1)/usr/lib/lua/cjson + $(INSTALL_DATA) $(PKG_BUILD_DIR)/lua/cjson/util.lua $(1)/usr/lib/lua/cjson +endef + +$(eval $(call HostBuild)) +$(eval $(call BuildPackage,lua-cjson)) diff --git a/lang/lua-copas/Makefile b/lang/lua-copas/Makefile new file mode 100644 index 0000000..4f073e2 --- /dev/null +++ b/lang/lua-copas/Makefile @@ -0,0 +1,62 @@ +# +# 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:=lua-copas +PKG_VERSION:=2.0.0 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/keplerproject/copas.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=f39a80add9f7c010ac979297652bbaaea0360a27 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-copas + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua-Copas + URL:=https://github.com/keplerproject/copas + DEPENDS:=+lua +endef + +define Package/lua-copas/description + Copas is a dispatcher based on coroutines that can be used by TCP/IP servers. +endef + +define Build/Configure +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + T="$(BUILD_VARIANT)" \ + PREFIX="$(PKG_INSTALL_DIR)/usr" \ + install +endef + +# add make variable overrides here +MAKE_FLAGS += + +define Package/lua-copas/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DIR) $(1)/usr/lib/lua/copas + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/copas.lua $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/copas/ftp.lua $(1)/usr/lib/lua/copas + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/copas/smtp.lua $(1)/usr/lib/lua/copas + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/copas/http.lua $(1)/usr/lib/lua/copas + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/copas/limit.lua $(1)/usr/lib/lua/copas +endef + +$(eval $(call BuildPackage,lua-copas)) diff --git a/lang/lua-copas/patches/makefile.patch b/lang/lua-copas/patches/makefile.patch new file mode 100644 index 0000000..10e4734 --- /dev/null +++ b/lang/lua-copas/patches/makefile.patch @@ -0,0 +1,15 @@ +--- lua-copas-1.2.1_org/Makefile 2014-06-04 16:39:17.451563827 +0800 ++++ lua-copas-1.2.1/Makefile 2014-06-04 16:39:41.115563309 +0800 +@@ -1,10 +1,10 @@ + # $Id: Makefile,v 1.3 2007/10/29 22:50:16 carregal Exp $ + + # Default prefix +-PREFIX = /usr/local ++PREFIX ?= $(DESTDIR)/usr + + # System's lua directory (where Lua libraries are installed) +-LUA_DIR= $(PREFIX)/share/lua/5.1 ++LUA_DIR= $(PREFIX)/lib/lua + + install: + mkdir -p $(LUA_DIR)/copas diff --git a/lang/lua-coxpcall/Makefile b/lang/lua-coxpcall/Makefile new file mode 100644 index 0000000..6ca3ff8 --- /dev/null +++ b/lang/lua-coxpcall/Makefile @@ -0,0 +1,59 @@ +# +# 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:=lua-coxpcall +PKG_VERSION:=1.15.0 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/keplerproject/coxpcall.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=979257892884816c97391dfd7b0a7b30dcc8f479 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-coxpcall + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua-Coxpcall + URL:=https://github.com/keplerproject/coxpcall + DEPENDS:=+lua +endef + +define Package/lua-coxpcall/description + Coxpcall encapsulates the protected calls with a coroutine based loop, + so errors can be dealed without the usual pcall/xpcall issues with coroutines. +endef + +TARGET_CFLAGS += $(FPIC) +# add make variable overrides here +MAKE_FLAGS += + +define Build/Configure +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + T="$(BUILD_VARIANT)" \ + LUA_DIR="$(PKG_INSTALL_DIR)/usr/lib/lua" \ + install +endef + +define Package/lua-coxpcall/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/coxpcall.lua $(1)/usr/lib/lua +endef + +$(eval $(call BuildPackage,lua-coxpcall)) diff --git a/lang/lua-coxpcall/patches/config.patch b/lang/lua-coxpcall/patches/config.patch new file mode 100644 index 0000000..2a1dbfd --- /dev/null +++ b/lang/lua-coxpcall/patches/config.patch @@ -0,0 +1,4 @@ +--- lua-coxpcall-1.15.0_org/config 1970-01-01 08:00:00.000000000 +0800 ++++ lua-coxpcall-1.15.0/config 2014-06-04 16:51:55.487547258 +0800 +@@ -0,0 +1 @@ ++LUA_DIR ?=$(DESTDIR)/usr/lib/lua diff --git a/lang/lua-lsqlite3/Makefile b/lang/lua-lsqlite3/Makefile new file mode 100644 index 0000000..473e215 --- /dev/null +++ b/lang/lua-lsqlite3/Makefile @@ -0,0 +1,58 @@ +# +# Copyright (C) 2006-2016 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:=lsqlite3 +PKG_VERSION:=0.9.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=http://lua.sqlite.org/index.cgi/zip/lsqlite3_fsl09w.zip +PKG_MD5SUM:=8e16ef4fda82eb73295bf2f1050d14f1 + +PKG_LICENSE:=MIT +PKG_MAINTAINER:=Oskari Rauta + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)_fsl09w.zip + +include $(INCLUDE_DIR)/package.mk + +define Package/lsqlite3 + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua wrapper for the SQLite3 library + URL:=http://lua.sqlite.org + DEPENDS:= +lua +libsqlite3 +endef + +define Package/lsqlite3/description + LuaSQLite3 is a thin wrapper around the public domain SQLite3 database engine. +endef + +TARGET_CFLAGS += $(FPIC) -std=gnu99 +TARGET_CPPFLAGS += -DLUA_USE_LINUX +TARGET_LDFLAGS += -llua -lsqlite3 -lpthread + +define Build/Compile + $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) \ + -c $(PKG_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/lsqlite3.c \ + -o $(PKG_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/lsqlite3.o \ + -DSQLITE_VERSION="$(PKG_VERSION)" + $(TARGET_CC) $(TARGET_LDFLAGS) -shared \ + $(PKG_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/lsqlite3.o \ + -o $(PKG_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/lsqlite3.so +endef + +define Package/lsqlite3/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(CP) $(PKG_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/*.so $(1)/usr/lib/lua/ +endef + +$(eval $(call BuildPackage,lsqlite3)) diff --git a/lang/lua-lzlib/Makefile b/lang/lua-lzlib/Makefile new file mode 100644 index 0000000..e4094f5 --- /dev/null +++ b/lang/lua-lzlib/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=lua-lzlib +PKG_VERSION:=0.4.3 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/LuaDist/lzlib.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=79329a07d8f79c19eadd7ea2752b4c4e1574b015 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-lzlib + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua zlib binding + URL:=http://github.com/LuaDist/lzlib + DEPENDS:= +lua +zlib +endef + +define Package/lua-lzlib/description + A library to access zlib library functions and also to read/write gzip files using an interface similar to the base io package. +endef + +MAKE_FLAGS += \ + LUA="$(STAGING_DIR)/usr" \ + OFLAGS="$(TARGET_CFLAGS)" \ + +define Package/lua-lzlib/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/zlib.so $(1)/usr/lib/lua/ + + $(INSTALL_DATA) $(PKG_BUILD_DIR)/gzip.lua $(1)/usr/lib/lua/ +endef + +$(eval $(call BuildPackage,lua-lzlib)) diff --git a/lang/lua-lzlib/patches/001-allow_optim_flags.patch b/lang/lua-lzlib/patches/001-allow_optim_flags.patch new file mode 100644 index 0000000..78f981d --- /dev/null +++ b/lang/lua-lzlib/patches/001-allow_optim_flags.patch @@ -0,0 +1,12 @@ +--- a/Makefile ++++ b/Makefile +@@ -14,7 +14,8 @@ LUABIN= $(LUA)/bin + ZLIB=../zlib-1.2.3 + + # no need to change anything below here +-CFLAGS= $(INCS) $(DEFS) $(WARN) -O0 -fPIC ++CFLAGS= $(INCS) $(DEFS) $(WARN) $(OFLAGS) -fPIC ++OFLAGS= -O0 + WARN= -g -Werror -Wall -pedantic #-ansi + INCS= -I$(LUAINC) -I$(ZLIB) + LIBS= -L$(ZLIB) -lz -L$(LUALIB) -L$(LUABIN) #-llua51 diff --git a/lang/lua-md5/Makefile b/lang/lua-md5/Makefile new file mode 100644 index 0000000..36e0d9d --- /dev/null +++ b/lang/lua-md5/Makefile @@ -0,0 +1,75 @@ +# +# Copyright (C) 2015 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:=lua-md5 +PKG_VERSION:=1.2 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/keplerproject/md5.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=024b65738b4434860777fc43d7cacaefea29ec60 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-md5 + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua-MD5 + URL:=https://github.com/keplerproject/md5 + DEPENDS:=+lua +endef + +define Package/lua-md5/description + MD5 offers basic cryptographic facilities for Lua +endef + +TARGET_CFLAGS += $(FPIC) + +# add make variable overrides here +MAKE_FLAGS += + +define Build/Configure +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + PREFIX="$(STAGING_DIR)/usr" \ + LUA_LIBDIR="$(STAGING_DIR)/usr/lib/lua" \ + clean + $(MAKE) -C $(PKG_BUILD_DIR) \ + PREFIX="$(STAGING_DIR)/usr" \ + LUA_LIBDIR="$(STAGING_DIR)/usr/lib/lua" \ + LIB_OPTION="-shared" \ + CC="$(TARGET_CROSS)gcc" \ + CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ + all +endef + +define Build/Install + $(MAKE) -C $(PKG_BUILD_DIR) \ + LUA_LIBDIR="$(PKG_INSTALL_DIR)/usr/lib/lua" \ + LUA_DIR="$(PKG_INSTALL_DIR)/usr/lib/lua" \ + install +endef + +define Package/lua-md5/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/md5.lua $(1)/usr/lib/lua + $(INSTALL_DIR) $(1)/usr/lib/lua/md5 + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/core.so $(1)/usr/lib/lua/md5/core.so +endef + +$(eval $(call BuildPackage,lua-md5)) diff --git a/lang/lua-md5/patches/config.patch b/lang/lua-md5/patches/config.patch new file mode 100644 index 0000000..abea3a8 --- /dev/null +++ b/lang/lua-md5/patches/config.patch @@ -0,0 +1,19 @@ +--- lua-md5-1.2/config 2014-06-04 16:55:50.000000000 +0800 ++++ lua-md5-1.2_new/config 2014-06-04 16:57:54.223539416 +0800 +@@ -1,13 +1,13 @@ + # Installation directories + + # Default prefix +-PREFIX = /usr/local ++PREFIX = /usr + + # System's libraries directory (where binary libraries are installed) +-LUA_LIBDIR= $(PREFIX)/lib/lua/5.1 ++LUA_LIBDIR= $(PREFIX)/lib/lua + + # System's lua directory (where Lua libraries are installed) +-LUA_DIR= $(PREFIX)/share/lua/5.1 ++LUA_DIR= $(PREFIX)/lib/lua + + # Lua includes directory + LUA_INC= $(PREFIX)/include diff --git a/lang/lua-md5/patches/makefile.patch b/lang/lua-md5/patches/makefile.patch new file mode 100644 index 0000000..89a2e33 --- /dev/null +++ b/lang/lua-md5/patches/makefile.patch @@ -0,0 +1,10 @@ +--- a/Makefile.orig 2014-06-04 17:16:40.083514808 +0800 ++++ b/Makefile 2014-06-04 17:17:27.111513780 +0800 +@@ -1,6 +1,6 @@ + # $Id: Makefile,v 1.7 2007/10/11 00:02:56 carregal Exp $ + +-CONFIG= ./config ++CFLAGS+= -fPIC + + include $(CONFIG) + diff --git a/lang/lua-mobdebug/Makefile b/lang/lua-mobdebug/Makefile new file mode 100644 index 0000000..3d11539 --- /dev/null +++ b/lang/lua-mobdebug/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2015 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:=lua-mobdebug +PKG_VERSION:=0.61 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/pkulchenko/MobDebug.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=9a03aa59696647ba3b7f9ae2f29a9f28532a4feb +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-mobdebug + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua-MobDebug + URL:=https://github.com/pkulchenko/MobDebug + DEPENDS:=+lua +endef + +define Package/lua-mobdebug/description + MobDebug is a remote debugger for Lua (including Lua 5.1, Lua 5.2, Lua 5.3, and LuaJIT 2.x). +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Build/Install +endef + +# add make variable overrides here +MAKE_FLAGS += + +define Package/lua-mobdebug/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/mobdebug.lua $(1)/usr/lib/lua +endef + +$(eval $(call BuildPackage,lua-mobdebug)) diff --git a/lang/lua-openssl/Makefile b/lang/lua-openssl/Makefile new file mode 100644 index 0000000..6f46e7a --- /dev/null +++ b/lang/lua-openssl/Makefile @@ -0,0 +1,42 @@ +# +# Copyright (C) 2016 Amnon Paz +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lua-openssl +PKG_VERSION:=0.6.0 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Amnon Paz +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=https://github.com/zhaozg/lua-openssl.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=1b950e6ff8617205cda1a1b612637ef21b9daf96 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua openSSL binding + URL:=http://github.com/zhaozg/lua-openssl + DEPENDS:=+lua +libopenssl +librt +endef + +define Package/lua-openssl/description + A free, MIT-licensed OpenSSL binding for Lua. +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/openssl.so $(1)/usr/lib/lua/ +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/lang/lua-openssl/patches/0001-Revise-Makefile.patch b/lang/lua-openssl/patches/0001-Revise-Makefile.patch new file mode 100644 index 0000000..e084c0b --- /dev/null +++ b/lang/lua-openssl/patches/0001-Revise-Makefile.patch @@ -0,0 +1,135 @@ +diff --git a/Makefile b/Makefile +index 6cb1176..6605879 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,85 +1,45 @@ +-T=openssl +- +-PREFIX ?=/usr/local +-LIB_OPTION ?= -shared +- +-#Lua auto detect +-LUA_VERSION ?= $(shell pkg-config luajit --print-provides) +-ifeq ($(LUA_VERSION),) ############ Not use luajit +-LUAV ?= $(shell lua -e "_,_,v=string.find(_VERSION,'Lua (.+)');print(v)") +-LUA_CFLAGS ?= -I$(PREFIX)/include/lua$(LUAV) +-LUA_LIBS ?= -L$(PREFIX)/lib +-LUA_LIBDIR ?= $(PREFIX)/lib/lua/$(LUAV) +-else +-LUAV ?= $(shell lua -e "_,_,v=string.find(_VERSION,'Lua (.+)');print(v)") +-LUA_CFLAGS ?= $(shell pkg-config luajit --cflags) +-LUA_LIBS ?= $(shell pkg-config luajit --libs) +-LUA_LIBDIR ?= $(PREFIX)/lib/lua/$(LUAV) +-endif +- +-#OS auto detect +-SYS := $(shell gcc -dumpmachine) +- +-ifneq (, $(findstring linux, $(SYS))) +-# Do linux things +-LDFLAGS = -fPIC -lrt -ldl +-OPENSSL_LIBS ?= $(shell pkg-config openssl --libs) +-OPENSSL_CFLAGS ?= $(shell pkg-config openssl --cflags) +-CFLAGS = -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS) +-endif +-ifneq (, $(findstring apple, $(SYS))) +-# Do darwin things +-LDFLAGS = -fPIC -lrt -ldl +-OPENSSL_LIBS ?= $(shell pkg-config openssl --libs) +-OPENSSL_CFLAGS ?= $(shell pkg-config openssl --cflags) +-CFLAGS = -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS) +-endif +-ifneq (, $(findstring mingw, $(SYS))) +-# Do mingw things +-V = $(shell lua -e "v=string.gsub('$(LUAV)','%.','');print(v)") +-LDFLAGS = -mwindows -lcrypt32 -lssl -lcrypto -lws2_32 $(PREFIX)/bin/lua$(V).dll +-LUA_CFLAGS = -DLUA_LIB -DLUA_BUILD_AS_DLL -I$(PREFIX)/include/ +-CFLAGS = $(OPENSSL_CFLAGS) $(LUA_CFLAGS) +-endif +-ifneq (, $(findstring cygwin, $(SYS))) +-# Do cygwin things +-OPENSSL_LIBS ?= $(shell pkg-config openssl --libs) +-OPENSSL_CFLAGS ?= $(shell pkg-config openssl --cflags) +-CFLAGS = -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS) +-endif +-#custome config +-ifeq (.config, $(wildcard .config)) +-include .config +-endif +- +-LIBNAME= $T.so.$V +- +-#LIB_OPTION= -bundle -undefined dynamic_lookup #for MacOS X +- +-# Compilation directives +-WARN_MOST = -Wall -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -pedantic +-WARN = -Wall -Wno-unused-value +-WARN_MIN = +-CFLAGS += $(WARN_MIN) -DPTHREADS +-CC= gcc -g $(CFLAGS) -Ideps +- +- +-OBJS=src/asn1.o src/auxiliar.o src/bio.o src/cipher.o src/cms.o src/compat.o src/crl.o src/csr.o src/dh.o src/digest.o src/dsa.o \ +-src/ec.o src/engine.o src/hmac.o src/lbn.o src/lhash.o src/misc.o src/ocsp.o src/openssl.o src/ots.o src/pkcs12.o src/pkcs7.o \ +-src/pkey.o src/rsa.o src/ssl.o src/th-lock.o src/util.o src/x509.o src/xattrs.o src/xexts.o src/xname.o src/xstore.o src/xalgor.o src/callback.o +- +-.c.o: +- $(CC) -c -o $@ $? +- +-all: $T.so +- echo $(SYS) +- +-$T.so: $(OBJS) +- MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET; $(CC) $(CFLAGS) $(LIB_OPTION) -o $T.so $(OBJS) $(OPENSSL_LIBS) $(LUA_LIBS) $(LDFLAGS) +- +-install: all +- mkdir -p $(LUA_LIBDIR) +- cp $T.so $(LUA_LIBDIR) +- +-clean: +- rm -f $T.so $(OBJS) ++.PHONY: install clean ++ ++PKGC ?= pkg-config ++ ++LIBNAME = openssl.so ++LIB_OPTION = -shared ++ ++# lua's package config can be under various names ++LUAPKGC := $(shell for pc in lua lua5.1 lua5.2 lua5.3; do \ ++ $(PKGC) --exists $$pc && echo $$pc && break; \ ++ done) ++ ++BUILD_DIR = $(shell pwd) ++ ++# LUA include/libraries build flags ++LUA_LIBDIR := $(shell $(PKGC) --variable=libdir $(LUAPKGC)) ++LUA_CFLAGS := $(shell $(PKGC) --cflags $(LUAPKGC)) ++LUA_LIBS := $(shell $(PKGC) --libs-only-L $(LUAPKGC)) ++ ++# openssl include/libraries build flags ++OPENSSL_LIBS = $(shell $(PKGC) openssl --libs) ++OPENSSL_CFLAGS = $(shell $(PKGC) openssl --cflags) ++ ++# openssl include/libraries build flags ++LOCAL_INCLUDE = -I$(BUILD_DIR)/deps ++ ++CFLAGS += -fPIC -DPTHREADS -g $(LOCAL_INCLUDE) $(OPENSSL_CFLAGS) $(LUA_CFLAGS) ++LDFLAGS += -lrt -ldl $(OPENSSL_LIBS) $(LUA_LIBS) ++ ++OBJS = src/asn1.o src/auxiliar.o src/bio.o src/cipher.o src/cms.o src/compat.o src/crl.o src/csr.o src/dh.o src/digest.o src/dsa.o src/ec.o src/engine.o src/hmac.o src/lbn.o src/lhash.o src/misc.o src/ocsp.o src/openssl.o src/ots.o src/pkcs12.o src/pkcs7.o src/pkey.o src/rsa.o src/ssl.o src/th-lock.o src/util.o src/x509.o src/xattrs.o src/xexts.o src/xname.o src/xstore.o src/xalgor.o src/callback.o ++ ++all: clean $(LIBNAME) ++ ++$(LIBNAME): $(OBJS) ++ $(CC) $(LDFLAGS) $(LIB_OPTION) $(OBJS) -o $@ ++ ++%.o: %.c ++ $(CC) $(CFLAGS) -c $< -o $@ ++ ++install: all ++ mkdir -p $(LUA_LIBDIR) ++ cp $(LIBNAME) $(LUA_LIBDIR) ++ ++clean: ++ rm -f $(LIBNAME) $(OBJS) diff --git a/lang/lua-openssl/patches/0010-Fix-Linkage.patch b/lang/lua-openssl/patches/0010-Fix-Linkage.patch new file mode 100644 index 0000000..52bcf1a --- /dev/null +++ b/lang/lua-openssl/patches/0010-Fix-Linkage.patch @@ -0,0 +1,36 @@ +diff --git a/deps/lua-compat/c-api/compat-5.3.c b/deps/lua-compat/c-api/compat-5.3.c +index 4395bbc..4a8877c 100644 +--- a/deps/lua-compat/c-api/compat-5.3.c ++++ b/deps/lua-compat/c-api/compat-5.3.c +@@ -491,17 +491,6 @@ COMPAT53_API int lua_geti (lua_State *L, int index, lua_Integer i) { + } + + +-COMPAT53_API int lua_isinteger (lua_State *L, int index) { +- if (lua_type(L, index) == LUA_TNUMBER) { +- lua_Number n = lua_tonumber(L, index); +- lua_Integer i = lua_tointeger(L, index); +- if (i == n) +- return 1; +- } +- return 0; +-} +- +- + static void compat53_reverse (lua_State *L, int a, int b) { + for (; a < b; ++a, --b) { + lua_pushvalue(L, a); +diff --git a/deps/lua-compat/c-api/compat-5.3.h b/deps/lua-compat/c-api/compat-5.3.h +index 2309294..8e67bae 100644 +--- a/deps/lua-compat/c-api/compat-5.3.h ++++ b/deps/lua-compat/c-api/compat-5.3.h +@@ -244,9 +244,6 @@ typedef int (*lua_KFunction)(lua_State *L, int status, lua_KContext ctx); + #define lua_geti COMPAT53_CONCAT(COMPAT53_PREFIX, _geti) + COMPAT53_API int lua_geti (lua_State *L, int index, lua_Integer i); + +-#define lua_isinteger COMPAT53_CONCAT(COMPAT53_PREFIX, _isinteger) +-COMPAT53_API int lua_isinteger (lua_State *L, int index); +- + #define lua_numbertointeger(n, p) \ + ((*(p) = (lua_Integer)(n)), 1) + diff --git a/lang/lua-openssl/patches/0020-support-OPENSSL_NO_SSL3_METHOD.patch b/lang/lua-openssl/patches/0020-support-OPENSSL_NO_SSL3_METHOD.patch new file mode 100644 index 0000000..2f29680 --- /dev/null +++ b/lang/lua-openssl/patches/0020-support-OPENSSL_NO_SSL3_METHOD.patch @@ -0,0 +1,41 @@ +--- lua-openssl-0.6.0.old/src/ssl.c 2016-09-19 08:30:43.735075695 +0200 ++++ lua-openssl-0.6.0/src/ssl.c 2016-09-19 09:02:45.733813437 +0200 +@@ -24,12 +24,17 @@ + SSL_METHOD* method = NULL; + const char* ciphers; + SSL_CTX* ctx; +- if (strcmp(meth, "SSLv3") == 0) ++ if (0); ++ ++#ifndef OPENSSL_NO_SSL3 ++ else if (strcmp(meth, "SSLv3") == 0) + method = SSLv3_method(); /* SSLv3 */ + else if (strcmp(meth, "SSLv3_server") == 0) + method = SSLv3_server_method(); /* SSLv3 */ + else if (strcmp(meth, "SSLv3_client") == 0) + method = SSLv3_client_method(); /* SSLv3 */ ++#endif ++ + else if (strcmp(meth, "SSLv23") == 0) + method = SSLv23_method(); /* SSLv3 but can rollback to v2 */ + else if (strcmp(meth, "SSLv23_server") == 0) +@@ -79,15 +84,15 @@ + #endif + else + luaL_error(L, "#1:%s not supported\n" +- "Maybe SSLv3 SSLv23 TLSv1 TLSv1_1 TLSv1_2 DTLSv1 [SSLv2], option followed by _client or _server\n", +- "default is SSLv3", ++ "Maybe [SSLv3] SSLv23 TLSv1 TLSv1_1 TLSv1_2 DTLSv1 [SSLv2], option followed by _client or _server\n", ++ "default is TLSv1", + meth); + ciphers = luaL_optstring(L, 2, SSL_DEFAULT_CIPHER_LIST); + ctx = SSL_CTX_new(method); + if (!ctx) + luaL_error(L, "#1:%s not supported\n" +- "Maybe SSLv3 SSLv23 TLSv1 TLSv1_1 TLSv1_2 DTLSv1 [SSLv2], option followed by _client or _server\n", +- "default is SSLv3", ++ "Maybe [SSLv3] SSLv23 TLSv1 TLSv1_1 TLSv1_2 DTLSv1 [SSLv2], option followed by _client or _server\n", ++ "default is TLSv1", + meth); + openssl_newvalue(L, ctx); + SSL_CTX_set_cipher_list(ctx, ciphers); diff --git a/lang/lua-openssl/patches/0030-support-OPENSSL_NO_COMP.patch b/lang/lua-openssl/patches/0030-support-OPENSSL_NO_COMP.patch new file mode 100644 index 0000000..44e5330 --- /dev/null +++ b/lang/lua-openssl/patches/0030-support-OPENSSL_NO_COMP.patch @@ -0,0 +1,20 @@ +--- lua-openssl-0.6.0.old/src/ssl.c 2016-09-19 08:30:43.735075695 +0200 ++++ lua-openssl-0.6.0/src/ssl.c 2016-09-19 08:48:37.393737125 +0200 +@@ -1245,7 +1250,7 @@ + lua_pushinteger(L, st); + return 2; + } +-#ifndef LIBRESSL_VERSION_NUMBER ++#if !defined(OPENSSL_NO_COMP) && !defined(LIBRESSL_VERSION_NUMBER) + static int openssl_ssl_current_compression(lua_State *L) + { + SSL* s = CHECK_OBJECT(1, SSL, "openssl.ssl"); +@@ -1803,7 +1808,7 @@ + {"getfd", openssl_ssl_getfd}, + + {"current_cipher", openssl_ssl_current_cipher}, +-#ifndef LIBRESSL_VERSION_NUMBER ++#if !defined(OPENSSL_NO_COMP) && !defined(LIBRESSL_VERSION_NUMBER) + {"current_compression", openssl_ssl_current_compression}, + #endif + {"getpeerverification", openssl_ssl_getpeerverification}, diff --git a/lang/lua-penlight/Makefile b/lang/lua-penlight/Makefile new file mode 100644 index 0000000..5c1b72a --- /dev/null +++ b/lang/lua-penlight/Makefile @@ -0,0 +1,46 @@ +# +# 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:=lua-penlight +PKG_VERSION:=1.3.2 +PKG_RELEASE:=2 +PKG_BUILD_DIR:=$(BUILD_DIR)/Penlight-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/stevedonovan/Penlight/archive/ +PKG_MD5SUM:=0315a39834bb6fab07741ec04ede1bf4 +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE.md + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Penlight + URL:=http://stevedonovan.github.io/Penlight/api/manual/01-introduction.md.html + DEPENDS:=+luafilesystem + MAINTAINER:= Karl Palsson +endef + +define Package/$(PKG_NAME)/description + It is often said of Lua that it does not include batteries. + Penlight is the batteries. +endef + +define Build/Compile + echo "Nothing to compile, pure lua package" +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(CP) $(PKG_BUILD_DIR)/lua/pl $(1)/usr/lib/lua +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/lang/lua-rings/Makefile b/lang/lua-rings/Makefile new file mode 100644 index 0000000..7b2e270 --- /dev/null +++ b/lang/lua-rings/Makefile @@ -0,0 +1,54 @@ +# +# Copyright (C) 2015 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:=lua-rings +PKG_VERSION:=1.3.0 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/keplerproject/rings.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=2b8a900f8b9dbde304859a3ac9d437795c3fdde3 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_FIXUP:=autoreconf + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-rings + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua-Rings + URL:=http://keplerproject.github.io/rings/ + DEPENDS:=+lua +endef + +define Package/lua-rings/description + Rings is a library which provides a way to create new Lua states from within Lua. +endef + +TARGET_CFLAGS += $(FPIC) +# add make variable overrides here +MAKE_FLAGS += + +define Build/Configure +endef + +define Package/lua-rings/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/rings.so $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/stable.lua $(1)/usr/lib/lua +endef + +$(eval $(call BuildPackage,lua-rings)) diff --git a/lang/lua-rings/patches/config.patch b/lang/lua-rings/patches/config.patch new file mode 100644 index 0000000..5740fae --- /dev/null +++ b/lang/lua-rings/patches/config.patch @@ -0,0 +1,28 @@ +--- lua-rings-1.3.0_org/config 2014-06-04 15:24:24.223662038 +0800 ++++ lua-rings-1.3.0/config 2014-06-04 16:16:15.183594040 +0800 +@@ -1,15 +1,15 @@ + # Installation directories + + # Default prefix +-PREFIX ?= /usr/local ++PREFIX ?= /usr + + DESTDIR ?= / + + # System's libraries directory (where binary libraries are installed) +-LUA_LIBDIR ?= $(PREFIX)/lib/lua/5.1 ++LUA_LIBDIR ?= $(PREFIX)/lib/lua + + # System's lua directory (where Lua libraries are installed) +-LUA_DIR ?= $(PREFIX)/share/lua/5.1 ++LUA_DIR ?= $(PREFIX)/lib/lua + + # Lua includes directory + LUA_INC ?= $(PREFIX)/include +@@ -24,6 +24,5 @@ + WARN ?= -O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -Wpointer-arith -pedantic + INCS ?= -I$(LUA_INC) + CFLAGS ?= $(WARN) $(INCS) +-CC ?= gcc + + # $Id: config,v 1.7 2007/10/29 22:51:39 carregal Exp $ diff --git a/lang/lua-rings/patches/makefile.patch b/lang/lua-rings/patches/makefile.patch new file mode 100644 index 0000000..8bb0551 --- /dev/null +++ b/lang/lua-rings/patches/makefile.patch @@ -0,0 +1,11 @@ +--- lua-rings-1.3.0_org/Makefile 2014-06-04 15:24:37.583661746 +0800 ++++ lua-rings-1.3.0/Makefile 2014-06-04 15:23:41.611662970 +0800 +@@ -3,6 +3,8 @@ + T= rings + CONFIG= ./config + ++CFLAGS+= -fPIC ++ + include $(CONFIG) + + SRCS= src/rings.c diff --git a/lang/lua-rs232/Makefile b/lang/lua-rs232/Makefile new file mode 100644 index 0000000..7ef5ac7 --- /dev/null +++ b/lang/lua-rs232/Makefile @@ -0,0 +1,62 @@ +# +# Copyright (C) 2015 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:=lua-rs232 +PKG_VERSION:=1.0.3 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/srdgame/librs232.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=a9d463181e7f7034fe6a55bc38e845fb04fa93ba +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-rs232 + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua Serial Library + URL:=https://github.com/srdgame/librs232 + DEPENDS:= +lua +endef + +define Package/lua-rs232/description + multiplatform library for serial communications over RS-232 +endef + +CONFIGURE_ARGS += \ + --with-lua-inc=$(STAGING_DIR)/usr/include \ + --with-lua-lib=$(STAGING_DIR)/usr/lib + +#define Build/Configure +# ( cd "$(PKG_BUILD_DIR)"; ./autogen.sh ) +# $(call Build/Configure/Default) +#endef +define Build/Configure +endef + +define Build/Compile + (cd "$(PKG_BUILD_DIR)"; $(TARGET_CC) src/rs232.c src/rs232_posix.c bindings/lua/luars232.c -DLUAROCKS_HACK -std=gnu99 -I./include -I$(STAGING_DIR)/usr/include -L$(STAGING_DIR)/usr/lib -fPIC -shared -o luars232.so) +endef + +define Build/Install +endef + +define Package/lua-rs232/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/luars232.so $(1)/usr/lib/lua/ +endef + +$(eval $(call BuildPackage,lua-rs232)) diff --git a/lang/lua-sha2/Makefile b/lang/lua-sha2/Makefile new file mode 100644 index 0000000..321d6de --- /dev/null +++ b/lang/lua-sha2/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 20013-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:=lua-sha2 +PKG_VERSION:=0.2.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=https://github.com/lgierth/lua-sha2.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=02bd4bfdc8062c7e1ae51c5a72906efc0a6375ee +PKG_LICENSE:=MIT + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-sha2 + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua binding for Aaron Gifford's SHA-2 implementation + URL:=https://code.google.com/p/sha2/ + MAINTAINER:=Lars Gierth + DEPENDS:=+lua +endef + +define Package/lua-sha2/description + Lua Binding for the SHA-2 (SHA-256/384/512) BSD-licensed C implementation by Aaron Gifford. + Also contains a HMAC implementation in Lua. +endef + +TARGET_CFLAGS += -fPIC -DSHA2_USE_INTTYPES_H -DBYTE_ORDER -DLITTLE_ENDIAN +TARGET_LDFLAGS += -fPIC -DSHA2_USE_INTTYPES_H -DBYTE_ORDER -DLITTLE_ENDIAN + +define Build/Configure +endef + +define Package/lua-sha2/install + $(INSTALL_DIR) $(1)/usr/lib/lua/hmac + $(INSTALL_DATA) $(PKG_BUILD_DIR)/sha2.so $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/hmac.lua $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/hmac/sha2.lua $(1)/usr/lib/lua/hmac + $(INSTALL_DATA) $(PKG_BUILD_DIR)/hmac/md5.lua $(1)/usr/lib/lua/hmac +endef + +$(eval $(call BuildPackage,lua-sha2)) diff --git a/lang/lua-sha2/patches/001-makefile.patch b/lang/lua-sha2/patches/001-makefile.patch new file mode 100644 index 0000000..e395044 --- /dev/null +++ b/lang/lua-sha2/patches/001-makefile.patch @@ -0,0 +1,14 @@ +From: Lars Gierth +Date: Tue, 2 Sep 2014 00:05:39 +0200 + + Add rump Makefile + +new file mode 100644 +index 0000000..f081d38 +--- /dev/null ++++ b/Makefile +@@ -0,0 +1,4 @@ ++all: sha2.o sha2lib.o ++ $(CC) -shared -o sha2.so sha2.o sha2lib.o ++ ++.PHONY: all diff --git a/lang/lua-wsapi/Makefile b/lang/lua-wsapi/Makefile new file mode 100644 index 0000000..5117596 --- /dev/null +++ b/lang/lua-wsapi/Makefile @@ -0,0 +1,95 @@ +# +# Copyright (C) 2015 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:=lua-wsapi +PKG_VERSION:=1.6.1 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/keplerproject/wsapi.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=eed8338401196cc155e59280adbe58d78933ead0 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-wsapi/Default + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua WSAPI + URL:=https://keplerproject.github.io/wsapi/ + DEPENDS:= +lua +endef + +define Package/lua-wsapi/Default/description + WSAPI is an API that abstracts the web server from Lua web applications +endef + + +define Package/lua-wsapi-base +$(call Package/lua-wsapi/Default) + TITLE+= base + DEPENDS+= +luafilesystem + VARIANT:=base +endef + +define Package/lua-wsapi-base/description +$(call Package/lua-wsapi/Default/description) + . + This package contains the basic stuff. +endef + +define Package/lua-wsapi-xavante +$(call Package/lua-wsapi/Default) + TITLE+= xavante + DEPENDS+= +lua-wsapi-base +lua-xavante + VARIANT:=xavante +endef + +define Package/lua-wsapi-xavante/description +$(call Package/lua-wsapi/Default/description) + . + This package contains the Xavante stuff. +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Build/Install +endef + +define Package/lua-wsapi-base/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/wsapi.lua $(1)/usr/lib/lua + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/launcher/wsapi.cgi $(1)/usr/bin + + $(INSTALL_DIR) $(1)/usr/lib/lua/wsapi + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/wsapi/{common,request,response,util,cgi,sapi,ringer,mock}.lua $(1)/usr/lib/lua/wsapi +endef + +define Package/lua-wsapi-xavante/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/launcher/wsapi $(1)/usr/bin + + $(INSTALL_DIR) $(1)/usr/lib/lua/wsapi + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/wsapi/xavante.lua $(1)/usr/lib/lua/wsapi +endef + + +$(eval $(call BuildPackage,lua-wsapi-base)) +$(eval $(call BuildPackage,lua-wsapi-xavante)) diff --git a/lang/lua-xavante/Makefile b/lang/lua-xavante/Makefile new file mode 100644 index 0000000..71ed8bd --- /dev/null +++ b/lang/lua-xavante/Makefile @@ -0,0 +1,58 @@ +# +# Copyright (C) 2015 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:=lua-xavante +PKG_VERSION:=2.3.0 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/keplerproject/xavante.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=9825b905133e14d37a4c179f2d02367ab93f1ef6 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-xavante + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Xavante Web Server + URL:=http://keplerproject.github.io/xavante/ + DEPENDS:= +lua +endef + +define Package/lua-xavante/description + Xavante is a Lua HTTP 1.1 Web server that uses a modular architecture based on URI mapped handlers. +endef + + +define Build/Configure +endef + +define Build/Compile +endef + +define Build/Install +endef + +define Package/lua-xavante/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/sajax/sajax.lua $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/xavante/xavante.lua $(1)/usr/lib/lua + + $(INSTALL_DIR) $(1)/usr/lib/lua/xavante + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/xavante/{cgiluahandler,encoding,filehandler,httpd,mime,patternhandler,redirecthandler,vhostshandler,indexhandler,urlhandler,ruleshandler}.lua $(1)/usr/lib/lua/xavante +endef + +$(eval $(call BuildPackage,lua-xavante)) diff --git a/lang/luabitop/Makefile b/lang/luabitop/Makefile new file mode 100644 index 0000000..6153c8d --- /dev/null +++ b/lang/luabitop/Makefile @@ -0,0 +1,53 @@ +# +# 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:=luabitop +PKG_VERSION:=1.0.2 +PKG_RELEASE:=1 + +_BASENAME:=LuaBitOp + +PKG_MAINTAINER:=Maxim Storchak +PKG_SOURCE:=$(_BASENAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://bitop.luajit.org/download/ +PKG_MD5SUM:=d0c1080fe0c844e8477279668e2d0d06 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(_BASENAME)-$(PKG_VERSION) +PKG_LICENSE:=MIT + +include $(INCLUDE_DIR)/package.mk + +define Package/luabitop + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=luabitop + URL:=http://bitop.luajit.org/ + DEPENDS:=+liblua +endef + +define Package/luabitop/description +Lua BitOp is a C extension module for Lua 5.1/5.2 which adds bitwise operations on numbers. +endef + +define Build/Configure +endef + + +TARGET_CFLAGS += $(FPIC) -DLUA_USE_LINUX -DLUA_NUMBER_DOUBLE + +define Build/Compile + $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CPPFLAGS) -std=gnu99 $(FPIC) -DLUA_USE_LINUX -shared -o $(PKG_BUILD_DIR)/bit.so $(PKG_BUILD_DIR)/bit.c +endef + +define Package/luabitop/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/bit.so $(1)/usr/lib/lua +endef + +$(eval $(call BuildPackage,luabitop)) diff --git a/lang/luaexpat/Makefile b/lang/luaexpat/Makefile new file mode 100644 index 0000000..eae164f --- /dev/null +++ b/lang/luaexpat/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2009 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:=luaexpat +PKG_VERSION:=1.3.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://matthewwild.co.uk/projects/luaexpat +PKG_MD5SUM:=3c20b5795e7107f847f8da844fbfe2da + +include $(INCLUDE_DIR)/package.mk + +define Package/luaexpat + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=LuaExpat + URL:=http://matthewwild.co.uk/projects/luaexpat/ + MAINTAINER:=W. Michael Petullo + DEPENDS:=+lua +libexpat +endef + +define Package/luaexpat/description + LuaExpat is a SAX XML parser based on the Expat library. +endef + +define Build/Configure +endef + +define Build/Compile + $(CP) files/compat-5.1r5 $(PKG_BUILD_DIR)/compat-5.1r5 + $(MAKE) -C $(PKG_BUILD_DIR) \ + EXPAT_INC="-I$(STAGING_DIR)/usr/include/" \ + LUA_INC="-I$(STAGING_DIR)/usr/include/" \ + LUA_LIBDIR="$(STAGING_DIR)/usr/lib/" \ + COMPAT_DIR="$(PKG_BUILD_DIR)/compat-5.1r5" \ + LDFLAGS="-shared $(TARGET_LDFLAGS)" \ + CC="$(TARGET_CC) $(TARGET_CFLAGS) $(FPIC) -std=c99" \ + LD="$(TARGET_CROSS)ld -shared" +endef + +define Package/luaexpat/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/lxp.so $(1)/usr/lib/lua/lxp.so + $(INSTALL_DIR) $(1)/usr/lib/lua/lxp + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/lxp/lom.lua $(1)/usr/lib/lua/lxp +endef + +$(eval $(call BuildPackage,luaexpat)) diff --git a/lang/luaexpat/files/compat-5.1r5/compat-5.1.c b/lang/luaexpat/files/compat-5.1r5/compat-5.1.c new file mode 100644 index 0000000..6fdb8b7 --- /dev/null +++ b/lang/luaexpat/files/compat-5.1r5/compat-5.1.c @@ -0,0 +1,97 @@ +/* +** Compat-5.1 +** Copyright Kepler Project 2004-2006 (http://www.keplerproject.org/compat) +** $Id: compat-5.1.c,v 1.13 2006/02/20 21:12:47 carregal Exp $ +*/ + +#include +#include +#include "lua.h" +#include "lauxlib.h" +#include "compat-5.1.h" + +static void getfield(lua_State *L, int idx, const char *name) { + const char *end = strchr(name, '.'); + lua_pushvalue(L, idx); + while (end) { + lua_pushlstring(L, name, end - name); + lua_gettable(L, -2); + lua_remove(L, -2); + if (lua_isnil(L, -1)) return; + name = end+1; + end = strchr(name, '.'); + } + lua_pushstring(L, name); + lua_gettable(L, -2); + lua_remove(L, -2); +} + +static void setfield(lua_State *L, int idx, const char *name) { + const char *end = strchr(name, '.'); + lua_pushvalue(L, idx); + while (end) { + lua_pushlstring(L, name, end - name); + lua_gettable(L, -2); + /* create table if not found */ + if (lua_isnil(L, -1)) { + lua_pop(L, 1); + lua_newtable(L); + lua_pushlstring(L, name, end - name); + lua_pushvalue(L, -2); + lua_settable(L, -4); + } + lua_remove(L, -2); + name = end+1; + end = strchr(name, '.'); + } + lua_pushstring(L, name); + lua_pushvalue(L, -3); + lua_settable(L, -3); + lua_pop(L, 2); +} + +LUALIB_API void luaL_module(lua_State *L, const char *libname, + const luaL_reg *l, int nup) { + if (libname) { + getfield(L, LUA_GLOBALSINDEX, libname); /* check whether lib already exists */ + if (lua_isnil(L, -1)) { + int env, ns; + lua_pop(L, 1); /* get rid of nil */ + lua_pushliteral(L, "require"); + lua_gettable(L, LUA_GLOBALSINDEX); /* look for require */ + lua_getfenv(L, -1); /* getfenv(require) */ + lua_remove(L, -2); /* remove function require */ + env = lua_gettop(L); + + lua_newtable(L); /* create namespace for lib */ + ns = lua_gettop(L); + getfield(L, env, "package.loaded"); /* get package.loaded table */ + if (lua_isnil(L, -1)) { /* create package.loaded table */ + lua_pop(L, 1); /* remove previous result */ + lua_newtable(L); + lua_pushvalue(L, -1); + setfield(L, env, "package.loaded"); + } + else if (!lua_istable(L, -1)) + luaL_error(L, "name conflict for library `%s'", libname); + lua_pushstring(L, libname); + lua_pushvalue(L, ns); + lua_settable(L, -3); /* package.loaded[libname] = ns */ + lua_pop(L, 1); /* get rid of package.loaded table */ + lua_pushvalue(L, ns); /* copy namespace */ + setfield(L, LUA_GLOBALSINDEX, libname); + lua_remove (L, env); /* remove env */ + } + lua_insert(L, -(nup+1)); /* move library table to below upvalues */ + } + for (; l->name; l++) { + int i; + lua_pushstring(L, l->name); + for (i=0; ifunc, nup); + lua_settable(L, -(nup+3)); + } + lua_pop(L, nup); /* remove upvalues */ +} + diff --git a/lang/luaexpat/files/compat-5.1r5/compat-5.1.h b/lang/luaexpat/files/compat-5.1r5/compat-5.1.h new file mode 100644 index 0000000..97570d9 --- /dev/null +++ b/lang/luaexpat/files/compat-5.1r5/compat-5.1.h @@ -0,0 +1,13 @@ +/* +** Compat-5.1 +** Copyright Kepler Project 2004-2006 (http://www.keplerproject.org/compat/) +** $Id: compat-5.1.h,v 1.8 2006/02/20 21:12:47 carregal Exp $ +*/ + +#ifndef COMPAT_H + +LUALIB_API void luaL_module(lua_State *L, const char *libname, + const luaL_reg *l, int nup); +#define luaL_openlib luaL_module + +#endif diff --git a/lang/luaexpat/files/compat-5.1r5/compat-5.1.lua b/lang/luaexpat/files/compat-5.1r5/compat-5.1.lua new file mode 100644 index 0000000..0938d56 --- /dev/null +++ b/lang/luaexpat/files/compat-5.1r5/compat-5.1.lua @@ -0,0 +1,267 @@ +-- +-- Compat-5.1 +-- Copyright Kepler Project 2004-2006 (http://www.keplerproject.org/compat) +-- According to Lua 5.1 +-- $Id: compat-5.1.lua,v 1.22 2006/02/20 21:12:47 carregal Exp $ +-- + +_COMPAT51 = "Compat-5.1 R5" + +local LUA_DIRSEP = '/' +local LUA_OFSEP = '_' +local OLD_LUA_OFSEP = '' +local POF = 'luaopen_' +local LUA_PATH_MARK = '?' +local LUA_IGMARK = ':' + +local assert, error, getfenv, ipairs, loadfile, loadlib, pairs, setfenv, setmetatable, type = assert, error, getfenv, ipairs, loadfile, loadlib, pairs, setfenv, setmetatable, type +local find, format, gfind, gsub, sub = string.find, string.format, string.gfind, string.gsub, string.sub + +-- +-- avoid overwriting the package table if it's already there +-- +package = package or {} +local _PACKAGE = package + +package.path = LUA_PATH or os.getenv("LUA_PATH") or + ("./?.lua;" .. + "/usr/local/share/lua/5.0/?.lua;" .. + "/usr/local/share/lua/5.0/?/?.lua;" .. + "/usr/local/share/lua/5.0/?/init.lua" ) + +package.cpath = LUA_CPATH or os.getenv("LUA_CPATH") or + "./?.so;" .. + "./l?.so;" .. + "/usr/local/lib/lua/5.0/?.so;" .. + "/usr/local/lib/lua/5.0/l?.so" + +-- +-- make sure require works with standard libraries +-- +package.loaded = package.loaded or {} +package.loaded.debug = debug +package.loaded.string = string +package.loaded.math = math +package.loaded.io = io +package.loaded.os = os +package.loaded.table = table +package.loaded.base = _G +package.loaded.coroutine = coroutine +local _LOADED = package.loaded + +-- +-- avoid overwriting the package.preload table if it's already there +-- +package.preload = package.preload or {} +local _PRELOAD = package.preload + + +-- +-- looks for a file `name' in given path +-- +local function findfile (name, pname) + name = gsub (name, "%.", LUA_DIRSEP) + local path = _PACKAGE[pname] + assert (type(path) == "string", format ("package.%s must be a string", pname)) + for c in gfind (path, "[^;]+") do + c = gsub (c, "%"..LUA_PATH_MARK, name) + local f = io.open (c) + if f then + f:close () + return c + end + end + return nil -- not found +end + + +-- +-- check whether library is already loaded +-- +local function loader_preload (name) + assert (type(name) == "string", format ( + "bad argument #1 to `require' (string expected, got %s)", type(name))) + assert (type(_PRELOAD) == "table", "`package.preload' must be a table") + return _PRELOAD[name] +end + + +-- +-- Lua library loader +-- +local function loader_Lua (name) + assert (type(name) == "string", format ( + "bad argument #1 to `require' (string expected, got %s)", type(name))) + local filename = findfile (name, "path") + if not filename then + return false + end + local f, err = loadfile (filename) + if not f then + error (format ("error loading module `%s' (%s)", name, err)) + end + return f +end + + +local function mkfuncname (name) + name = gsub (name, "^.*%"..LUA_IGMARK, "") + name = gsub (name, "%.", LUA_OFSEP) + return POF..name +end + +local function old_mkfuncname (name) + --name = gsub (name, "^.*%"..LUA_IGMARK, "") + name = gsub (name, "%.", OLD_LUA_OFSEP) + return POF..name +end + +-- +-- C library loader +-- +local function loader_C (name) + assert (type(name) == "string", format ( + "bad argument #1 to `require' (string expected, got %s)", type(name))) + local filename = findfile (name, "cpath") + if not filename then + return false + end + local funcname = mkfuncname (name) + local f, err = loadlib (filename, funcname) + if not f then + funcname = old_mkfuncname (name) + f, err = loadlib (filename, funcname) + if not f then + error (format ("error loading module `%s' (%s)", name, err)) + end + end + return f +end + + +local function loader_Croot (name) + local p = gsub (name, "^([^.]*).-$", "%1") + if p == "" then + return + end + local filename = findfile (p, "cpath") + if not filename then + return + end + local funcname = mkfuncname (name) + local f, err, where = loadlib (filename, funcname) + if f then + return f + elseif where ~= "init" then + error (format ("error loading module `%s' (%s)", name, err)) + end +end + +-- create `loaders' table +package.loaders = package.loaders or { loader_preload, loader_Lua, loader_C, loader_Croot, } +local _LOADERS = package.loaders + + +-- +-- iterate over available loaders +-- +local function load (name, loaders) + -- iterate over available loaders + assert (type (loaders) == "table", "`package.loaders' must be a table") + for i, loader in ipairs (loaders) do + local f = loader (name) + if f then + return f + end + end + error (format ("module `%s' not found", name)) +end + +-- sentinel +local sentinel = function () end + +-- +-- new require +-- +function _G.require (modname) + assert (type(modname) == "string", format ( + "bad argument #1 to `require' (string expected, got %s)", type(name))) + local p = _LOADED[modname] + if p then -- is it there? + if p == sentinel then + error (format ("loop or previous error loading module '%s'", modname)) + end + return p -- package is already loaded + end + local init = load (modname, _LOADERS) + _LOADED[modname] = sentinel + local actual_arg = _G.arg + _G.arg = { modname } + local res = init (modname) + if res then + _LOADED[modname] = res + end + _G.arg = actual_arg + if _LOADED[modname] == sentinel then + _LOADED[modname] = true + end + return _LOADED[modname] +end + + +-- findtable +local function findtable (t, f) + assert (type(f)=="string", "not a valid field name ("..tostring(f)..")") + local ff = f.."." + local ok, e, w = find (ff, '(.-)%.', 1) + while ok do + local nt = rawget (t, w) + if not nt then + nt = {} + t[w] = nt + elseif type(t) ~= "table" then + return sub (f, e+1) + end + t = nt + ok, e, w = find (ff, '(.-)%.', e+1) + end + return t +end + +-- +-- new package.seeall function +-- +function _PACKAGE.seeall (module) + local t = type(module) + assert (t == "table", "bad argument #1 to package.seeall (table expected, got "..t..")") + local meta = getmetatable (module) + if not meta then + meta = {} + setmetatable (module, meta) + end + meta.__index = _G +end + + +-- +-- new module function +-- +function _G.module (modname, ...) + local ns = _LOADED[modname] + if type(ns) ~= "table" then + ns = findtable (_G, modname) + if not ns then + error (string.format ("name conflict for module '%s'", modname)) + end + _LOADED[modname] = ns + end + if not ns._NAME then + ns._NAME = modname + ns._M = ns + ns._PACKAGE = gsub (modname, "[^.]*$", "") + end + setfenv (2, ns) + for i, f in ipairs (arg) do + f (ns) + end +end diff --git a/lang/luafilesystem/Makefile b/lang/luafilesystem/Makefile new file mode 100644 index 0000000..13abef6 --- /dev/null +++ b/lang/luafilesystem/Makefile @@ -0,0 +1,66 @@ +# +# Copyright (C) 2008-2010 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:=luafilesystem +PKG_VERSION:=1.6.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/keplerproject/luafilesystem.git +PKG_SOURCE_VERSION:=2fd989cd6c777583be1c93616018c55b2cbb1bcf +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/luafilesystem + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=LuaFileSystem + URL:=http://keplerproject.github.com/luafilesystem/ + MAINTAINER:=W. Michael Petullo + DEPENDS:=+liblua +endef + +define Package/luafilesystem/description + This package contains the LuaFileSystem library, a set of portable + functions for directory creation, listing and deletion and for file + locking. +endef + +define Build/Configure +endef + +TARGET_CFLAGS += $(FPIC) $(TARGET_CPPFLAGS) + +TARGET_LDFLAGS += -llua + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS) -std=gnu99" \ + LDFLAGS="$(TARGET_LDFLAGS)" + $(TARGET_CROSS)ar r $(PKG_BUILD_DIR)/src/luafilesystem.a $(PKG_BUILD_DIR)/src/lfs.o +endef + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR)/usr/include + $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/lfs.h $(STAGING_DIR)/usr/include + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/lfs.so $(STAGING_DIR)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/luafilesystem.a $(STAGING_DIR)/usr/lib/lua +endef + +define Package/luafilesystem/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/lfs.so $(1)/usr/lib/lua/lfs.so +endef + +$(eval $(call BuildPackage,luafilesystem)) diff --git a/lang/luai2c/Makefile b/lang/luai2c/Makefile new file mode 100755 index 0000000..5022b49 --- /dev/null +++ b/lang/luai2c/Makefile @@ -0,0 +1,45 @@ +# +# Copyright (C) 2016 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:=luai2c +PKG_VERSION:=1.0.0 +PKG_RELEASE:=3 +PKG_MAINTAINER:=Frank Edelhaeuser +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/mrpace2/i2c-lua.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/luai2c + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua I2C binding + URL:=https://github.com/mrpace2/i2c-lua/ + DEPENDS:=+liblua +kmod-i2c-core + MAINTAINER:=Frank Edelhaeuser +endef + +define Package/luai2c/description + This is the Lua binding for I2C. It provides access to I2C slaves supported by the kernel. +endef + +define Package/luai2c/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/i2c.so $(1)/usr/lib/lua + $(INSTALL_DIR) $(1)/usr/lib/lua/i2c + $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/* $(1)/usr/lib/lua/i2c +endef + +$(eval $(call BuildPackage,luai2c)) diff --git a/lang/lualanes/Makefile b/lang/lualanes/Makefile new file mode 100644 index 0000000..6161290 --- /dev/null +++ b/lang/lualanes/Makefile @@ -0,0 +1,57 @@ +# +# Copyright (C) 2007-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:=lualanes +PKG_REV:=aa9bfcf2dd49f55f11b27e7c21d5b75d81ccfc7e +PKG_VERSION:=3.9.4 +PKG_RELEASE=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_REV).tar.gz +PKG_SOURCE_URL:=https://github.com/LuaLanes/lanes.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=$(PKG_REV) +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +PKG_BUILD_DEPENDS:=lua/host luac/host + +include $(INCLUDE_DIR)/package.mk + +define Package/lualanes + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=LuaLanes + URL:=http://luaforge.net/projects/lanes/ + DEPENDS:=+lua +luac +liblua +libpthread + MAINTAINER:=Vladimir Malyutin +endef + +define Package/lualanes/description + Lanes is a lightweight, native, lazy evaluating multithreading library for Lua 5.1 and 5.2. +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) all \ + CC="$(TARGET_CC)" \ + LUA="$(STAGING_DIR)/host/bin/lua" \ + LUAC="$(STAGING_DIR)/host/bin/luac" \ + OPT_FLAGS="$(TARGET_CFLAGS) --std=c99 -Dpthread_yield=sched_yield" +endef + +define Package/lualanes/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/lanes.lua $(1)/usr/lib/lua/ + $(INSTALL_DIR) $(1)/usr/lib/lua/lanes + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/lanes/core.so $(1)/usr/lib/lua/lanes/core.so +endef + +$(eval $(call BuildPackage,lualanes)) diff --git a/lang/lualanes/patches/100-musl-compat.patch b/lang/lualanes/patches/100-musl-compat.patch new file mode 100644 index 0000000..ba3f49f --- /dev/null +++ b/lang/lualanes/patches/100-musl-compat.patch @@ -0,0 +1,13 @@ +diff --git a/src/threading.h b/src/threading.h +index bfa9ab8..7b3d6a1 100644 +--- a/src/threading.h ++++ b/src/threading.h +@@ -128,7 +128,7 @@ enum e_status { PENDING, RUNNING, WAITING, DONE, ERROR_ST, CANCELLED }; + #endif // PLATFORM_WIN32 + #include + +- #ifdef PLATFORM_LINUX ++ #if defined(PLATFORM_LINUX) && defined(__UCLIBC__) + # define _MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP + #else + /* OS X, ... */ diff --git a/lang/luaposix/Makefile b/lang/luaposix/Makefile new file mode 100644 index 0000000..9bf3628 --- /dev/null +++ b/lang/luaposix/Makefile @@ -0,0 +1,61 @@ +# +# Copyright (C) 2011 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:=luaposix +PKG_VERSION:=v33.2.1 +PKG_RELEASE:=5 + +PKG_SOURCE:=release-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/luaposix/luaposix/archive/ +PKG_MD5SUM:=aa68b5c07ab1ecea81bb466c81e88056 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-release-$(PKG_VERSION) +PKG_REMOVE_FILES:=aclocal.m4 +PKG_FIXUP:=autoreconf +PKG_MAINTAINER:=Maxim Storchak +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=COPYING + +include $(INCLUDE_DIR)/package.mk + +define Package/luaposix + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=luaposix + URL:=http://luaforge.net/projects/luaposix/ + DEPENDS:=+lua +librt + PKG_BUILD_DEPENDS:=+lua/host +endef + +define Package/luaposix/description + luaposix is a general POSIX library for Lua providing access + to various low level libc functions. +endef + +CONFIGURE_VARS += ac_cv_path_LDOC="true" + +TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC) -std=gnu99 +ifeq ($(CONFIG_USE_MUSL),y) + TARGET_CFLAGS += -D_POSIX_PRIORITY_SCHEDULING +endif + +ifneq ($(CONFIG_USE_GLIBC),) + ifeq ($(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),) + TARGET_CFLAGS += -DNO_GETLOGIN + endif +endif + + +define Package/luaposix/install + $(INSTALL_DIR) $(1)/usr/lib/lua/posix + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ext/posix/.libs/posix.so $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/posix.lua $(1)/usr/lib/lua +endef + +$(eval $(call BuildPackage,luaposix)) diff --git a/lang/luaposix/patches/100-eglibc-compat.patch b/lang/luaposix/patches/100-eglibc-compat.patch new file mode 100644 index 0000000..e4df63b --- /dev/null +++ b/lang/luaposix/patches/100-eglibc-compat.patch @@ -0,0 +1,30 @@ +diff --git a/ext/posix/unistd.c b/ext/posix/unistd.c +index 9276640..69c8cef 100644 +--- a/ext/posix/unistd.c ++++ b/ext/posix/unistd.c +@@ -525,6 +525,7 @@ Pgetgroups(lua_State *L) + #endif + + ++#ifndef NO_GETLOGIN + /*** + Current logged-in user. + @treturn[1] string username, if successful +@@ -537,6 +538,7 @@ Pgetlogin(lua_State *L) + checknargs(L, 0); + return pushstringresult(getlogin()); + } ++#endif + + + /*** +@@ -1044,7 +1046,9 @@ static const luaL_Reg posix_unistd_fns[] = + LPOSIX_FUNC( Pgetegid ), + LPOSIX_FUNC( Pgeteuid ), + LPOSIX_FUNC( Pgetgid ), ++#ifndef NO_GETLOGIN + LPOSIX_FUNC( Pgetlogin ), ++#endif + LPOSIX_FUNC( Pgetpgrp ), + LPOSIX_FUNC( Pgetpid ), + LPOSIX_FUNC( Pgetppid ), diff --git a/lang/luaposix/patches/101-disable-curses.patch b/lang/luaposix/patches/101-disable-curses.patch new file mode 100644 index 0000000..6412799 --- /dev/null +++ b/lang/luaposix/patches/101-disable-curses.patch @@ -0,0 +1,32 @@ +diff --git a/configure.ac b/configure.ac +index dfd4199..19924d0 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -153,15 +153,6 @@ AC_CHECK_LIB([rt], [clock_gettime]) + AC_SUBST([LIBRT], [$LIBS]) + LIBS=$save_LIBS + +-## Curses +-AX_WITH_CURSES +-AC_ARG_VAR(CURSES_LIB, [linker flags for curses library]) +- +-save_LIBS=$LIBS +-LIBS="$CURSES_LIB $LIBS" +-AC_CHECK_FUNCS([resizeterm]) +-LIBS=$save_LIBS +- + ## Use system implementation, or bundled replacement? + AC_CHECK_FUNCS([strlcpy]) + +diff --git a/ext/posix/posix.c b/ext/posix/posix.c +index 6019df0..2d75487 100644 +--- a/ext/posix/posix.c ++++ b/ext/posix/posix.c +@@ -12,7 +12,6 @@ + + #include "bit32.c" + #include "ctype.c" +-#include "curses.c" + #include "dirent.c" + #include "errno.c" + #include "fcntl.c" diff --git a/lang/luaposix/patches/102-disable-compat-deprecated.diff b/lang/luaposix/patches/102-disable-compat-deprecated.diff new file mode 100644 index 0000000..7c58be4 --- /dev/null +++ b/lang/luaposix/patches/102-disable-compat-deprecated.diff @@ -0,0 +1,20 @@ +diff --git a/lib/posix.lua.in b/lib/posix.lua.in +index 17ef39a..a248d9b 100644 +--- a/lib/posix.lua.in ++++ b/lib/posix.lua.in +@@ -35,15 +35,6 @@ for _, sub in ipairs { + end + end + +- +--- Inject deprecated APIs (overwriting submodules) for backwards compatibility. +-for k, v in pairs (require "posix.deprecated") do +- M[k] = v +-end +-for k, v in pairs (require "posix.compat") do +- M[k] = v +-end +- + M.version = "posix for " .. _VERSION .. " / @PACKAGE_STRING@" + + diff --git a/lang/luarocks/Makefile b/lang/luarocks/Makefile new file mode 100644 index 0000000..7519f8f --- /dev/null +++ b/lang/luarocks/Makefile @@ -0,0 +1,58 @@ +# +# Copyright (C) 2006-2015 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:=luarocks +PKG_VERSION:=2.2.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=https://github.com/keplerproject/luarocks.git +PKG_SOURCE_VERSION:=v$(PKG_VERSION) + +PKG_MAINTAINER:=Amr Hassan +PKG_INSTALL=1 +PKG_BUILD_DEPENDS:=lua/host luac/host +PKG_LICENSE=GPL + +include $(INCLUDE_DIR)/package.mk + +define Package/luarocks + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=luarocks + URL:=https://github.com/keplerproject/luarocks + DEPENDS:=+lua +luac +liblua +luasocket +unzip +curl +luasec +endef + +define Package/luarocks/description + LuaRocks is a deployment and management system for Lua modules. +endef + +# My custom args, copied and modified from SDK_ROOT/include/package-defaults.mk +CONFIGURE_ARGS = \ + --prefix=$(CONFIGURE_PREFIX) \ + --sysconfdir=/etc \ + --with-lua=$(STAGING_DIR)/host + +define Build/Compile + $(call Build/Compile/Default,build) +endef + +define Package/luarocks/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luarocks-5.1 $(1)/usr/bin/luarocks + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luarocks-admin-5.1 $(1)/usr/bin/luarocks-admin + $(CP) $(PKG_INSTALL_DIR)/usr/share $(1)/usr/share + $(CP) $(PKG_INSTALL_DIR)/etc $(1)/etc +endef + +$(eval $(call BuildPackage,luarocks)) diff --git a/lang/luarocks/patches/01_dont_modify_bin_shebang.diff b/lang/luarocks/patches/01_dont_modify_bin_shebang.diff new file mode 100644 index 0000000..a1bad21 --- /dev/null +++ b/lang/luarocks/patches/01_dont_modify_bin_shebang.diff @@ -0,0 +1,13 @@ +diff -rupN luarocks/Makefile luarocks.new/Makefile +--- luarocks/Makefile 2015-02-19 13:24:07.027310956 +0200 ++++ luarocks.new/Makefile 2015-02-22 13:28:24.497353543 +0200 +@@ -104,7 +104,7 @@ build_bins: cleanup_bins + for f in $(BIN_FILES) ;\ + do \ + sed "1d" src/bin/$$f > src/bin/$$f.bak ;\ +- echo "#!$(LUA_BINDIR)/lua$(LUA_SUFFIX)" > src/bin/$$f ;\ ++ echo "#!/usr/bin/env lua" > src/bin/$$f ;\ + echo "package.path = [[$(LUADIR)/?.lua;]]..package.path" | sed "s,//,/,g" >> src/bin/$$f ;\ + cat src/bin/$$f.bak >> src/bin/$$f ;\ + chmod +x src/bin/$$f ;\ +Binary files luarocks/src/bin/.luarocks.swp and luarocks.new/src/bin/.luarocks.swp differ diff --git a/lang/luasec/Makefile b/lang/luasec/Makefile new file mode 100644 index 0000000..b2bde57 --- /dev/null +++ b/lang/luasec/Makefile @@ -0,0 +1,61 @@ +# +# 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:=luasec +PKG_VERSION:=0.6 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/brunoos/luasec/archive/ +PKG_MD5SUM:=14e1aef6d2aae96bbf98afc6b6634af2 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_NAME)-$(PKG_VERSION) + +MAINTAINER:=W. Michael Petullo +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/luasec + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=LuaSec + URL:=https://github.com/brunoos/luasec + DEPENDS:=+lua +libopenssl +luasocket +endef + +define Package/luasec/description + LuaSec is a binding for OpenSSL library to provide TLS/SSL communication. +endef + +define Build/Configure +endef + +MAKE_FLAGS += \ + INCDIR="$(TARGET_CPPFLAGS) -I." \ + LIBDIR="$(TARGET_LDFLAGS) -L./luasocket" \ + LUACPATH="$(PKG_INSTALL_DIR)/usr/lib/lua" \ + LUAPATH="$(PKG_INSTALL_DIR)/usr/lib/lua" + +define Build/Compile +$(call Build/Compile/Default,linux) +endef + +define Package/luasec/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/ssl.so $(1)/usr/lib/lua/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/ssl.lua $(1)/usr/lib/lua/ + $(INSTALL_DIR) $(1)/usr/lib/lua/ssl + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/ssl/https.lua $(1)/usr/lib/lua/ssl/ +endef + +$(eval $(call BuildPackage,luasec)) diff --git a/lang/luasoap/Makefile b/lang/luasoap/Makefile new file mode 100644 index 0000000..6ebf03b --- /dev/null +++ b/lang/luasoap/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2011 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:=luasoap +PKG_VERSION:=2014-08-21 +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/tomasguisasola/luasoap.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=af1e100281cee4b972df10121e37e51d53367a98 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz +PKG_MIRROR_MD5SUM:= + +PKG_MAINTAINER:=Liu Peng +PKG_LICENSE:=MIT + +include $(INCLUDE_DIR)/package.mk + +define Package/luasoap + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=LuaSOAP + URL:=https://github.com/tomasguisasola/luasoap + DEPENDS:=+lua +luaexpat +luasec +luasocket +endef + +define Package/luasoap/description + LuaSOAP is a library of functions to deal with SOAP. +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/luasoap/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/soap.lua $(1)/usr/lib/lua/ + $(INSTALL_DIR) $(1)/usr/lib/lua/soap + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/{client,server}.lua $(1)/usr/lib/lua/soap/ + $(INSTALL_DIR) $(1)/usr/lib/lua/soap/client + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/client/https.lua $(1)/usr/lib/lua/soap/client/ + $(INSTALL_DIR) $(1)/usr/lib/lua/soap/tests + $(INSTALL_DATA) $(PKG_BUILD_DIR)/tests/test{,-http,-server}.lua $(1)/usr/lib/lua/soap/tests/ +endef + +$(eval $(call BuildPackage,luasoap)) diff --git a/lang/luasocket/Makefile b/lang/luasocket/Makefile new file mode 100644 index 0000000..5e7c983 --- /dev/null +++ b/lang/luasocket/Makefile @@ -0,0 +1,63 @@ +# +# 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:=luasocket +PKG_SOURCE_VERSION:=6d5e40c324c84d9c1453ae88e0ad5bdd0a631448 +PKG_VERSION:=3.0-rc1-20130909 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=https://github.com/diegonehab/luasocket.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/luasocket + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=LuaSocket + URL:=http://luasocket.luaforge.net/ + MAINTAINER:=W. Michael Petullo + DEPENDS:=+lua +endef + +define Package/luasocket/description + LuaSocket is the most comprehensive networking support + library for the Lua language. It provides easy access to + TCP, UDP, DNS, SMTP, FTP, HTTP, MIME and much more. +endef + +define Build/Configure +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR)/ \ + LIBDIR="$(TARGET_LDFLAGS)" \ + CC="$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -std=gnu99" \ + LD="$(TARGET_CROSS)ld -shared" \ + all +endef + + +define Package/luasocket/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/{ltn12,mime,socket}.lua $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mime.so.1.0.3 $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/socket.so.3.0-rc1 $(1)/usr/lib/lua + $(INSTALL_DIR) $(1)/usr/lib/lua/mime + ln -sf ../mime.so.1.0.3 $(1)/usr/lib/lua/mime/core.so + $(INSTALL_DIR) $(1)/usr/lib/lua/socket + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/{ftp,http,smtp,tp,url,headers}.lua $(1)/usr/lib/lua/socket + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/unix.so $(1)/usr/lib/lua/socket + ln -sf ../socket.so.3.0-rc1 $(1)/usr/lib/lua/socket/core.so +endef + +$(eval $(call BuildPackage,luasocket)) diff --git a/lang/luasocket/patches/0001-Add-interface-support.patch b/lang/luasocket/patches/0001-Add-interface-support.patch new file mode 100644 index 0000000..3be42ed --- /dev/null +++ b/lang/luasocket/patches/0001-Add-interface-support.patch @@ -0,0 +1,237 @@ +From 96fdf07acf78ecfc9be76a8b0591f38fe6f1a875 Mon Sep 17 00:00:00 2001 +From: Steven Barth +Date: Sat, 9 Nov 2013 12:01:42 +0100 +Subject: [PATCH] Add interface resolving + +--- + src/if.c | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + src/if.h | 27 ++++++++++++++ + src/luasocket.c | 2 + + src/makefile | 2 + + src/options.c | 9 +++++ + 5 files changed, 153 insertions(+) + create mode 100644 src/if.c + create mode 100644 src/if.h + +diff --git a/src/if.c b/src/if.c +new file mode 100644 +index 0000000..db231aa +--- /dev/null ++++ b/src/if.c +@@ -0,0 +1,113 @@ ++/* ++ * $Id: if.c $ ++ * ++ * Author: Markus Stenberg ++ * ++ * Copyright (c) 2012 cisco Systems, Inc. ++ * ++ * Created: Tue Dec 4 14:50:34 2012 mstenber ++ * Last modified: Wed Dec 5 18:51:08 2012 mstenber ++ * Edit time: 24 min ++ * ++ */ ++ ++#include ++#include ++#include ++ ++#include "if.h" ++ ++#include "lauxlib.h" ++ ++static int if_global_indextoname(lua_State *L); ++static int if_global_nametoindex(lua_State *L); ++static int if_global_nameindex(lua_State *L); ++ ++static luaL_Reg func[] = { ++ { "indextoname", if_global_indextoname}, ++ { "nametoindex", if_global_nametoindex}, ++ { "nameindex", if_global_nameindex}, ++ { NULL, NULL} ++}; ++ ++int if_open(lua_State *L) ++{ ++ lua_pushstring(L, "iface"); ++ lua_newtable(L); ++ luaL_openlib(L, NULL, func, 0); ++ lua_settable(L, -3); ++ return 0; ++} ++ ++int if_global_indextoname(lua_State *L) ++{ ++ unsigned int ifnumber; ++ const char *name; ++ char buf[IF_NAMESIZE+1]; ++ ++ if (!lua_isnumber(L, 1)) ++ { ++ lua_pushnil(L); ++ lua_pushstring(L, "indextoname expects only number argument"); ++ return 2; ++ } ++ ifnumber = lua_tonumber(L, 1); ++ if (!(name = if_indextoname(ifnumber, buf))) ++ { ++ lua_pushnil(L); ++ lua_pushstring(L, "nonexistent interface"); ++ return 2; ++ } ++ lua_pushstring(L, name); ++ return 1; ++} ++ ++int if_global_nametoindex(lua_State *L) ++{ ++ unsigned int ifnumber; ++ if (!lua_isstring(L, 1)) ++ { ++ lua_pushnil(L); ++ lua_pushstring(L, "nametoindex expects only string argument"); ++ return 2; ++ } ++ if (!(ifnumber = if_nametoindex(lua_tostring(L, 1)))) ++ { ++ lua_pushnil(L); ++ lua_pushstring(L, "nonexistent interface"); ++ return 2; ++ } ++ lua_pushnumber(L, ifnumber); ++ return 1; ++} ++ ++int if_global_nameindex(lua_State *L) ++{ ++ struct if_nameindex *ni, *oni; ++ int i = 1; ++ oni = ni = if_nameindex(); ++ lua_newtable(L); ++ while (ni && ni->if_index && *(ni->if_name)) ++ { ++ /* at result[i], we store.. */ ++ lua_pushnumber(L, i); ++ ++ /* new table with two items - index, name*/ ++ lua_newtable(L); ++ lua_pushstring(L, "index"); ++ lua_pushnumber(L, ni->if_index); ++ lua_settable(L, -3); ++ ++ lua_pushstring(L, "name"); ++ lua_pushstring(L, ni->if_name); ++ lua_settable(L, -3); ++ ++ /* Then, actually store it */ ++ lua_settable(L, -3); ++ ++ i++; ++ ni++; ++ } ++ if_freenameindex(oni); ++ return 1; ++} +diff --git a/src/if.h b/src/if.h +new file mode 100644 +index 0000000..dc7faf8 +--- /dev/null ++++ b/src/if.h +@@ -0,0 +1,27 @@ ++/* ++ * $Id: if.h $ ++ * ++ * Author: Markus Stenberg ++ * ++ * Copyright (c) 2012 cisco Systems, Inc. ++ * ++ * Created: Tue Dec 4 14:37:24 2012 mstenber ++ * Last modified: Tue Dec 4 14:51:43 2012 mstenber ++ * Edit time: 7 min ++ * ++ */ ++ ++/* This module provides Lua wrapping for the advanced socket API ++ * defined in RFC3542, or mainly, the access to the system's interface ++ * list. It is necessary for use of recvmsg/sendmsg. ++ * ++ * TODO - Do something clever with Windows? ++ */ ++#ifndef IF_H ++#define IF_H ++ ++#include "lua.h" ++ ++int if_open(lua_State *L); ++ ++#endif /* IF_H */ +diff --git a/src/luasocket.c b/src/luasocket.c +index e6ee747..85d41a6 100644 +--- a/src/luasocket.c ++++ b/src/luasocket.c +@@ -31,6 +31,7 @@ + #include "tcp.h" + #include "udp.h" + #include "select.h" ++#include "if.h" + + /*-------------------------------------------------------------------------*\ + * Internal function prototypes +@@ -51,6 +52,7 @@ static const luaL_Reg mod[] = { + {"tcp", tcp_open}, + {"udp", udp_open}, + {"select", select_open}, ++ {"iface", if_open}, + {NULL, NULL} + }; + +diff --git a/src/makefile b/src/makefile +index 8d3521e..09d4882 100644 +--- a/src/makefile ++++ b/src/makefile +@@ -262,6 +262,7 @@ SOCKET_OBJS= \ + auxiliar.$(O) \ + options.$(O) \ + inet.$(O) \ ++ if.$(O) \ + $(SOCKET) \ + except.$(O) \ + select.$(O) \ +@@ -387,6 +388,7 @@ auxiliar.$(O): auxiliar.c auxiliar.h + buffer.$(O): buffer.c buffer.h io.h timeout.h + except.$(O): except.c except.h + inet.$(O): inet.c inet.h socket.h io.h timeout.h usocket.h ++if.$(O): if.c if.h + io.$(O): io.c io.h timeout.h + luasocket.$(O): luasocket.c luasocket.h auxiliar.h except.h \ + timeout.h buffer.h io.h inet.h socket.h usocket.h tcp.h \ +diff --git a/src/options.c b/src/options.c +index 8ac2a14..1c73e6f 100644 +--- a/src/options.c ++++ b/src/options.c +@@ -3,6 +3,9 @@ + * LuaSocket toolkit + \*=========================================================================*/ + #include ++#include ++#include ++#include + + #include "lauxlib.h" + +@@ -285,6 +288,12 @@ static int opt_ip6_setmembership(lua_State *L, p_socket ps, int level, int name) + if (!lua_isnil(L, -1)) { + if (lua_isnumber(L, -1)) { + val.ipv6mr_interface = (unsigned int) lua_tonumber(L, -1); ++ } else if (lua_isstring(L, -1)) { ++ if (!(val.ipv6mr_interface = if_nametoindex(lua_tostring(L, -1)))) { ++ lua_pushnil(L); ++ lua_pushstring(L, "nonexistent interface"); ++ return 2; ++ } + } else + luaL_argerror(L, -1, "number 'interface' field expected"); + } +-- +1.8.4.rc3 + diff --git a/lang/luasql/Makefile b/lang/luasql/Makefile new file mode 100644 index 0000000..135ebff --- /dev/null +++ b/lang/luasql/Makefile @@ -0,0 +1,118 @@ +# +# Copyright (C) 2010-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:=luasql +PKG_VERSION:=2.3.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=https://github.com/keplerproject/luasql.git +PKG_SOURCE_VERSION:=v$(PKG_VERSION) + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=docs/us/license.html +PKG_MAINTAINER:=Nicolas Thill + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/luasql/Default + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua SQL binding + URL:=http://keplerproject.github.io/luasql/ + DEPENDS:= +lua +endef + +define Package/luasql/Default/description + LuaSQL is a simple interface from Lua to a DBMS. +endef + + +define Package/luasql-mysql +$(call Package/luasql/Default) + TITLE+= for MySQL + DEPENDS+= +libmysqlclient + VARIANT:=mysql +endef + +define Package/luasql-mysql/description +$(call Package/luasql/Default/description) + . + This package contains the MySQL binding. +endef + + +define Package/luasql-pgsql +$(call Package/luasql/Default) + TITLE+= for PostgreSQL + DEPENDS+= +libpq + VARIANT:=postgres +endef + +define Package/luasql-pgsql/description +$(call Package/luasql/Default/description) + . + This package contains the PostgreSQL binding. +endef + + +define Package/luasql-sqlite3 +$(call Package/luasql/Default) + TITLE+= for SQLite 3 + DEPENDS+= +libsqlite3 + VARIANT:=sqlite3 +endef + +define Package/luasql-sqlite3/description +$(call Package/luasql/Default/description) + . + This package contains the SQLite 3 binding. +endef + + +TARGET_CFLAGS += $(FPIC) -std=gnu99 +TARGET_CPPFLAGS += -DLUA_USE_LINUX + +ifeq ($(BUILD_VARIANT),mysql) + TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/mysql + TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz +endif + +ifeq ($(BUILD_VARIANT),postgres) + TARGET_LDFLAGS += -lpq +endif + +ifeq ($(BUILD_VARIANT),sqlite3) + TARGET_LDFLAGS += -lsqlite3 -lpthread +endif + +MAKE_FLAGS += \ + T="$(BUILD_VARIANT)" \ + DRIVER_INCS="$(TARGET_CPPFLAGS)" \ + DRIVER_LIBS="$(TARGET_LDFLAGS)" \ + CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ + lib + +define Package/Install/Default + $(INSTALL_DIR) $(1)/usr/lib/lua/luasql + $(CP) $(PKG_BUILD_DIR)/src/*.so $(1)/usr/lib/lua/luasql/ +endef + +Package/luasql-mysql/install = $(Package/Install/Default) +Package/luasql-pgsql/install = $(Package/Install/Default) +Package/luasql-sqlite3/install = $(Package/Install/Default) + +$(eval $(call BuildPackage,luasql-mysql)) +$(eval $(call BuildPackage,luasql-pgsql)) +$(eval $(call BuildPackage,luasql-sqlite3)) diff --git a/lang/lzmq/Makefile b/lang/lzmq/Makefile new file mode 100644 index 0000000..b17b945 --- /dev/null +++ b/lang/lzmq/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=lzmq +PKG_VERSION:=0.4.3 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/zeromq/lzmq/tar.gz/v$(PKG_VERSION)? +PKG_MD5SUM:=c4e51a60a5a26987bdce59e45d674a9e + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/lzmq + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua ZeroMQ binding + URL:=https://github.com/moteus/lzmq/ + DEPENDS:= +lua +libzmq +endef + +define Package/lzmq/description + LZMQ is a Lua binding to ZeroMQ. +endef + +CMAKE_OPTIONS += \ + -DUSE_LUA=ON + +define Package/lzmq/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lzmq.so $(1)/usr/lib/lua/ + + $(INSTALL_DIR) $(1)/usr/lib/lua/lzmq + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lzmq/timer.so $(1)/usr/lib/lua/lzmq + $(CP) -R $(PKG_BUILD_DIR)/src/lua/lzmq/* $(1)/usr/lib/lua/lzmq +endef + +$(eval $(call BuildPackage,lzmq)) diff --git a/lang/micropython-lib/Makefile b/lang/micropython-lib/Makefile new file mode 100644 index 0000000..2f3fc61 --- /dev/null +++ b/lang/micropython-lib/Makefile @@ -0,0 +1,55 @@ +# +# Copyright (C) 2008-2015 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:=micropython-lib +PKG_VERSION=1.8.6-$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 + +PKG_MAINTAINER:=Roger D +PKG_LICENSE:=MIT, PSFL +PKG_LICENSE_FILES:=LICENSE + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/micropython/micropython-lib.git +PKG_SOURCE_VERSION:=f81e979c56dddb771ad36ec381b7f2c6cd12111f + +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION) +PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/micropython-lib + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + TITLE:=micropython-lib + URL:=https://github.com/micropython/micropython-lib + DEPENDS:=+micropython +endef + +define Package/micropython-lib/description + This package contains micropython-lib, a project to develop a non-monolothic + standard library for Micro Python. Note that this is a work in progress and + several libraries may be missing, incomplete or buggy. +endef + +MAKE_FLAGS:=\ + -C $(PKG_BUILD_DIR) \ + PREFIX=$(PKG_BUILD_DIR)/_install_tmp \ + install + +define Package/micropython-lib/install + $(INSTALL_DIR) $(1)/usr/lib/micropython + $(CP) $(PKG_BUILD_DIR)/_install_tmp/* $(1)/usr/lib/micropython +endef + +$(eval $(call BuildPackage,micropython-lib)) + diff --git a/lang/micropython/Makefile b/lang/micropython/Makefile new file mode 100644 index 0000000..7ee5882 --- /dev/null +++ b/lang/micropython/Makefile @@ -0,0 +1,57 @@ +# +# Copyright (C) 2008-2015 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:=micropython +PKG_VERSION=1.8.6-$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 + +PKG_MAINTAINER:=Roger D +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/micropython/micropython.git +PKG_SOURCE_VERSION:=5a1d63fc14dae788f705403a43c2d8639b7dd9cd + +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/micropython + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + TITLE:=Micro Python + URL:=http://micropython.org + DEPENDS:=+libffi +endef + +define Package/micropython/description + This package contains Micro Python, a lean and fast implementation of the Python 3.4 programming language + that is optimised to run on a microcontroller (and low power computers). +endef + + +MAKE_FLAGS += -C $(PKG_BUILD_DIR)/unix + +define Build/Compile + $(call Build/Compile/Default,axtls) + $(call Build/Compile/Default) + +endef + +define Package/micropython/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/unix/micropython $(1)/usr/bin/micropython +endef + +$(eval $(call BuildPackage,micropython)) diff --git a/lang/micropython/patches/000-Makefile-no-errors b/lang/micropython/patches/000-Makefile-no-errors new file mode 100644 index 0000000..765f3e7 --- /dev/null +++ b/lang/micropython/patches/000-Makefile-no-errors @@ -0,0 +1,13 @@ +Index: micropython-1.5-20161117-e81a5353cb794b8d6c57317488e5db6a1c524755/unix/Makefile +=================================================================== +--- micropython-1.5-20161117-e81a5353cb794b8d6c57317488e5db6a1c524755.orig/unix/Makefile 2016-11-17 02:43:13.000000000 +0100 ++++ micropython-1.5-20161117-e81a5353cb794b8d6c57317488e5db6a1c524755/unix/Makefile 2016-11-17 16:49:02.937809018 +0100 +@@ -21,7 +21,7 @@ + INC += -I$(BUILD) + + # compiler settings +-CWARN = -Wall -Werror ++CWARN = -Wall + CWARN += -Wpointer-arith -Wuninitialized + CFLAGS = $(INC) $(CWARN) -ansi -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA) + diff --git a/lang/node-arduino-firmata/Makefile b/lang/node-arduino-firmata/Makefile new file mode 100644 index 0000000..f4de0c0 --- /dev/null +++ b/lang/node-arduino-firmata/Makefile @@ -0,0 +1,68 @@ +# +# Copyright (C) 2014 Arduino LLC +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NPM_NAME:=arduino-firmata +PKG_NAME:=node-$(PKG_NPM_NAME) +PKG_VERSION:=0.3.3 +PKG_RELEASE:=5 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/shokai/node-arduino-firmata.git +PKG_SOURCE_VERSION:=16e76007edf218d72df590adbd711ac6b7432845 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_BUILD_DEPENDS:=node/host +PKG_NODE_VERSION:=4.4.5 + +PKG_MAINTAINER:=John Crispin +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE.txt + +include $(INCLUDE_DIR)/package.mk + +define Package/node-arduino-firmata + DEPENDS:=+node + SUBMENU:=Node.js + SECTION:=lang + CATEGORY:=Languages + DEPENDS:=+node +node-serialport + TITLE:=Node.js package to access serial ports for reading and writing + URL:=https://www.npmjs.org/package/serialport +endef + +define Package/node-arduino-firmata/description + Node.js package to access serial ports for reading and writing OR Welcome your robotic JavaScript overlords. Better yet, program them! +endef + +define Build/Prepare + /bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1 + $(Build/Patch) +endef + +EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \ + +define Build/Compile + $(MAKE_FLAGS) \ + npm_config_arch=$(CONFIG_ARCH) \ + npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ + npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \ + PREFIX="$(PKG_INSTALL_DIR)/usr/" \ + npm install -g $(PKG_BUILD_DIR) +endef + +define Package/node-arduino-firmata/install + mkdir -p $(1)/usr/lib/node + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node + rm -rf $(1)/usr/lib/node/arduino-firmata/node_modules/serialport/ + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,node-arduino-firmata)) + diff --git a/lang/node-arduino-firmata/files/usr/lib/node/arduino-firmata/lib/arduino-firmata.js b/lang/node-arduino-firmata/files/usr/lib/node/arduino-firmata/lib/arduino-firmata.js new file mode 100644 index 0000000..578bd40 --- /dev/null +++ b/lang/node-arduino-firmata/files/usr/lib/node/arduino-firmata/lib/arduino-firmata.js @@ -0,0 +1,306 @@ +(function() { + 'use strict'; + var ArduinoFirmata, SerialPort, debug, events, exports, serialport, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + + events = require('eventemitter2'); + + SerialPort = (serialport = require('serialport')).SerialPort; + + debug = require('debug')('arduino-firmata'); + + exports = module.exports = ArduinoFirmata = (function(superClass) { + extend(ArduinoFirmata, superClass); + + ArduinoFirmata.Status = { + CLOSE: 0, + OPEN: 1 + }; + + ArduinoFirmata.INPUT = 0; + + ArduinoFirmata.OUTPUT = 1; + + ArduinoFirmata.ANALOG = 2; + + ArduinoFirmata.PWM = 3; + + ArduinoFirmata.SERVO = 4; + + ArduinoFirmata.SHIFT = 5; + + ArduinoFirmata.I2C = 6; + + ArduinoFirmata.LOW = 0; + + ArduinoFirmata.HIGH = 1; + + ArduinoFirmata.MAX_DATA_BYTES = 32; + + ArduinoFirmata.DIGITAL_MESSAGE = 0x90; + + ArduinoFirmata.ANALOG_MESSAGE = 0xE0; + + ArduinoFirmata.REPORT_ANALOG = 0xC0; + + ArduinoFirmata.REPORT_DIGITAL = 0xD0; + + ArduinoFirmata.SET_PIN_MODE = 0xF4; + + ArduinoFirmata.REPORT_VERSION = 0xF9; + + ArduinoFirmata.SYSTEM_RESET = 0xFF; + + ArduinoFirmata.START_SYSEX = 0xF0; + + ArduinoFirmata.END_SYSEX = 0xF7; + + ArduinoFirmata.list = function(callback) { + return serialport.list(function(err, ports) { + var devices, j, len, port; + if (err) { + return callback(err); + } + devices = []; + for (j = 0, len = ports.length; j < len; j++) { + port = ports[j]; + if (/usb|acm|com\d+/i.test(port.comName)) { + devices.push(port.comName); + } + } + return callback(null, devices); + }); + }; + + function ArduinoFirmata() { + this.status = ArduinoFirmata.Status.CLOSE; + this.wait_for_data = 0; + this.execute_multi_byte_command = 0; + this.multi_byte_channel = 0; + this.stored_input_data = []; + this.parsing_sysex = false; + this.sysex_bytes_read = 0; + this.digital_output_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + this.digital_input_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + this.analog_input_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + this.boardVersion = null; + } + + ArduinoFirmata.prototype.isOldArduinoDevice = function() { + return /usbserial|USB/.test(this.serialport_name); + }; + + ArduinoFirmata.prototype.connect = function(serialport_name, opts) { + this.serialport_name = serialport_name; + if (opts == null) { + opts = { + baudrate: 57600 + }; + } + opts.parser = serialport.parsers.raw; + if (!this.serialport_name) { + ArduinoFirmata.list((function(_this) { + return function(err, devices) { + return _this.connect(devices[0], opts); + }; + })(this)); + return this; + } + this.once('boardReady', function() { + var io_init_wait; + debug('boardReady'); + io_init_wait = this.isOldArduinoDevice() ? (debug("old arduino device found " + this.serialport_name), 3000) : (debug("new arduino device found " + this.serialport_name), 100); + debug("wait " + io_init_wait + "(msec)"); + return setTimeout((function(_this) { + return function() { + var i, j, k; + for (i = j = 0; j < 6; i = ++j) { + _this.write([ArduinoFirmata.REPORT_ANALOG | i, 1]); + } + for (i = k = 0; k < 2; i = ++k) { + _this.write([ArduinoFirmata.REPORT_DIGITAL | i, 1]); + } + debug('init IO ports'); + return _this.emit('connect'); + }; + })(this), io_init_wait); + }); + this.serialport = new SerialPort(this.serialport_name, opts); + this.serialport.once('open', (function(_this) { + return function() { + var cid; + cid = setInterval(function() { + debug('request REPORT_VERSION'); + return _this.write([ArduinoFirmata.REPORT_VERSION]); + }, 500); + _this.once('boardVersion', function(version) { + clearInterval(cid); + _this.status = ArduinoFirmata.Status.OPEN; + return _this.emit('boardReady'); + }); + return _this.serialport.on('data', function(data) { + var byte, j, len, results; + results = []; + for (j = 0, len = data.length; j < len; j++) { + byte = data[j]; + results.push(_this.process_input(byte)); + } + return results; + }); + }; + })(this)); + return this; + }; + + ArduinoFirmata.prototype.isOpen = function() { + return this.status === ArduinoFirmata.Status.OPEN; + }; + + ArduinoFirmata.prototype.close = function(callback) { + this.status = ArduinoFirmata.Status.CLOSE; + return this.serialport.close(callback); + }; + + ArduinoFirmata.prototype.reset = function(callback) { + return this.write([ArduinoFirmata.SYSTEM_RESET], callback); + }; + + ArduinoFirmata.prototype.write = function(bytes, callback) { + return this.serialport.write(bytes, callback); + }; + + ArduinoFirmata.prototype.sysex = function(command, data, callback) { + var write_data; + if (data == null) { + data = []; + } + data = data.map(function(i) { + return i & 0x7f; + }); + write_data = [ArduinoFirmata.START_SYSEX, command].concat(data, [ArduinoFirmata.END_SYSEX]); + return this.write(write_data, callback); + }; + + ArduinoFirmata.prototype.pinMode = function(pin, mode, callback) { + switch (mode) { + case true: + mode = ArduinoFirmata.OUTPUT; + break; + case false: + mode = ArduinoFirmata.INPUT; + } + return this.write([ArduinoFirmata.SET_PIN_MODE, pin, mode], callback); + }; + + ArduinoFirmata.prototype.digitalWrite = function(pin, value, callback) { + var port_num; + this.pinMode(pin, ArduinoFirmata.OUTPUT); + port_num = (pin >>> 3) & 0x0F; + if (value === 0 || value === false) { + this.digital_output_data[port_num] &= ~(1 << (pin & 0x07)); + } else { + this.digital_output_data[port_num] |= 1 << (pin & 0x07); + } + return this.write([ArduinoFirmata.DIGITAL_MESSAGE | port_num, this.digital_output_data[port_num] & 0x7F, this.digital_output_data[port_num] >>> 7], callback); + }; + + ArduinoFirmata.prototype.analogWrite = function(pin, value, callback) { + value = Math.floor(value); + this.pinMode(pin, ArduinoFirmata.PWM); + return this.write([ArduinoFirmata.ANALOG_MESSAGE | (pin & 0x0F), value & 0x7F, value >>> 7], callback); + }; + + ArduinoFirmata.prototype.servoWrite = function(pin, angle, callback) { + this.pinMode(pin, ArduinoFirmata.SERVO); + return this.write([ArduinoFirmata.ANALOG_MESSAGE | (pin & 0x0F), angle & 0x7F, angle >>> 7], callback); + }; + + ArduinoFirmata.prototype.digitalRead = function(pin) { + return ((this.digital_input_data[pin >>> 3] >>> (pin & 0x07)) & 0x01) > 0; + }; + + ArduinoFirmata.prototype.analogRead = function(pin) { + return this.analog_input_data[pin]; + }; + + ArduinoFirmata.prototype.process_input = function(input_data) { + var analog_value, command, diff, i, j, old_analog_value, results, stat, sysex_command, sysex_data; + if (this.parsing_sysex) { + if (input_data === ArduinoFirmata.END_SYSEX) { + this.parsing_sysex = false; + sysex_command = this.stored_input_data[0]; + sysex_data = this.stored_input_data.slice(1, this.sysex_bytes_read); + return this.emit('sysex', { + command: sysex_command, + data: sysex_data + }); + } else { + this.stored_input_data[this.sysex_bytes_read] = input_data; + return this.sysex_bytes_read += 1; + } + } else if (this.wait_for_data > 0 && input_data < 128) { + this.wait_for_data -= 1; + this.stored_input_data[this.wait_for_data] = input_data; + if (this.execute_multi_byte_command !== 0 && this.wait_for_data === 0) { + switch (this.execute_multi_byte_command) { + case ArduinoFirmata.DIGITAL_MESSAGE: + input_data = (this.stored_input_data[0] << 7) + this.stored_input_data[1]; + diff = this.digital_input_data[this.multi_byte_channel] ^ input_data; + this.digital_input_data[this.multi_byte_channel] = input_data; + if (this.listeners('digitalChange').length > 0) { + results = []; + for (i = j = 0; j <= 13; i = ++j) { + if (((0x01 << i) & diff) > 0) { + stat = (input_data & diff) > 0; + results.push(this.emit('digitalChange', { + pin: i + this.multi_byte_channel * 8, + value: stat, + old_value: !stat + })); + } else { + results.push(void 0); + } + } + return results; + } + break; + case ArduinoFirmata.ANALOG_MESSAGE: + analog_value = (this.stored_input_data[0] << 7) + this.stored_input_data[1]; + old_analog_value = this.analogRead(this.multi_byte_channel); + this.analog_input_data[this.multi_byte_channel] = analog_value; + if (old_analog_value !== analog_value) { + return this.emit('analogChange', { + pin: this.multi_byte_channel, + value: analog_value, + old_value: old_analog_value + }); + } + break; + case ArduinoFirmata.REPORT_VERSION: + this.boardVersion = this.stored_input_data[1] + "." + this.stored_input_data[0]; + return this.emit('boardVersion', this.boardVersion); + } + } + } else { + if (input_data < 0xF0) { + command = input_data & 0xF0; + this.multi_byte_channel = input_data & 0x0F; + } else { + command = input_data; + } + if (command === ArduinoFirmata.START_SYSEX) { + this.parsing_sysex = true; + return this.sysex_bytes_read = 0; + } else if (command === ArduinoFirmata.DIGITAL_MESSAGE || command === ArduinoFirmata.ANALOG_MESSAGE || command === ArduinoFirmata.REPORT_VERSION) { + this.wait_for_data = 2; + return this.execute_multi_byte_command = command; + } + } + }; + + return ArduinoFirmata; + + })(events.EventEmitter2); + +}).call(this); diff --git a/lang/node-arduino-firmata/patches/000-new-serialport.patch b/lang/node-arduino-firmata/patches/000-new-serialport.patch new file mode 100644 index 0000000..10eab64 --- /dev/null +++ b/lang/node-arduino-firmata/patches/000-new-serialport.patch @@ -0,0 +1,10 @@ +--- a/package.json ++++ b/package.json +@@ -30,7 +30,6 @@ + "author": "Sho Hashimoto ", + "license": "MIT", + "dependencies": { +- "serialport": "*", + "eventemitter2": "*", + "debug": "*" + }, diff --git a/lang/node-cylon/Makefile b/lang/node-cylon/Makefile new file mode 100644 index 0000000..13833a3 --- /dev/null +++ b/lang/node-cylon/Makefile @@ -0,0 +1,99 @@ +# +# Copyright (C) 2014 Arduino LLC +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NPM_NAME:=cylon +PKG_NAME:=node-$(PKG_NPM_NAME) +PKG_VERSION:=0.22.0 +PKG_RELEASE:=5 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/hybridgroup/cylon-firmata.git +PKG_SOURCE_VERSION:=0c37da77e48b3e2cc3a8d566822a17689de91b40 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_BUILD_DEPENDS:=node/host +PKG_NODE_VERSION:=4.4.5 + +PKG_MAINTAINER:=John Crispin +PKG_LICENSE:=Apache-2.0 +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define Package/node-cylon/default + DEPENDS:=+node $(2) + SUBMENU:=Node.js + SECTION:=lang + CATEGORY:=Languages + TITLE:=CylonJS - $(1) + URL:=https://www.npmjs.org/package/cylon +endef + +define Package/node-cylon + $(call Package/node-cylon/default,Core) +endef + +define Package/node-cylon-i2c + $(call Package/node-cylon/default,I2C,+node-cylon) +endef + +define Package/node-cylon-gpio + $(call Package/node-cylon/default,GPIO,+node-cylon) +endef + +define Package/node-cylon-firmata + $(call Package/node-cylon/default,Firmata,+node-cylon-gpio +node-cylon-i2c +node-arduino-firmata) +endef + +define Package/node-cylon/description + JavaScript Robotics, By Your Command Next generation robotics framework with support for 36 different platforms Get Started +endef + +define Build/Prepare + /bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1 + $(Build/Patch) +endef + +EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \ + +define Build/Compile + $(MAKE_FLAGS) \ + npm_config_arch=$(CONFIG_ARCH) \ + npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ + npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \ + PREFIX="$(PKG_INSTALL_DIR)/usr/" \ + npm install -g $(PKG_BUILD_DIR) +endef + +define Package/node-cylon/install + mkdir -p $(1)/usr/lib/node/cylon + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon/* $(1)/usr/lib/node/cylon/ +endef + +define Package/node-cylon-i2c/install + mkdir -p $(1)/usr/lib/node/cylon-i2c + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-i2c/* $(1)/usr/lib/node/cylon-i2c/ +endef + +define Package/node-cylon-gpio/install + mkdir -p $(1)/usr/lib/node/cylon-gpio + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-gpio/* $(1)/usr/lib/node/cylon-gpio/ +endef + +define Package/node-cylon-firmata/install + mkdir -p $(1)/usr/lib/node/cylon-firmata + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/{index.js,lib,LICENSE,package.json,README.md,RELEASES.md,spec} $(1)/usr/lib/node/cylon-firmata/ +endef + +$(eval $(call BuildPackage,node-cylon)) +$(eval $(call BuildPackage,node-cylon-i2c)) +$(eval $(call BuildPackage,node-cylon-gpio)) +$(eval $(call BuildPackage,node-cylon-firmata)) + diff --git a/lang/node-cylon/patches/0001-serialport.patch b/lang/node-cylon/patches/0001-serialport.patch new file mode 100644 index 0000000..08d579c --- /dev/null +++ b/lang/node-cylon/patches/0001-serialport.patch @@ -0,0 +1,12 @@ +Index: node-cylon-0.22.0/package.json +=================================================================== +--- node-cylon-0.22.0.orig/package.json 2015-10-20 20:32:48.000000000 +0200 ++++ node-cylon-0.22.0/package.json 2015-10-21 10:42:20.616109122 +0200 +@@ -38,7 +38,6 @@ + }, + + "dependencies": { +- "firmata": ">= 0.3.2", + "cylon": "1.1.0", + "cylon-gpio": "0.26.0", + "cylon-i2c": "0.22.0" diff --git a/lang/node-hid/Makefile b/lang/node-hid/Makefile new file mode 100644 index 0000000..b8a5b7a --- /dev/null +++ b/lang/node-hid/Makefile @@ -0,0 +1,65 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NPM_NAME:=hid +PKG_NAME:=node-$(PKG_NPM_NAME) +PKG_VERSION:=0.5.1 +PKG_RELEASE:=5 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/node-hid/node-hid.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=35d830b7810c87d32484d0a346621568c4849441 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_BUILD_DEPENDS:=node/host +PKG_NODE_VERSION:=4.4.5 + +PKG_MAINTAINER:=John Crispin +PKG_LICENSE:=Custom +PKG_LICENSE_FILES:= + +include $(INCLUDE_DIR)/package.mk + +define Package/node-hid + DEPENDS:=+node + SUBMENU:=Node.js + SECTION:=lang + CATEGORY:=Languages + DEPENDS:=+libusb-1.0 +hidapi +libstdcpp + TITLE:=Node.js package to access HID devices + URL:=https://github.com/node-hid/node-hid +endef + +define Package/node-hid/description + Node.js package to access HID devices +endef + +CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))) + +EXTRA_CFLAGS+=-I$(STAGING_DIR)/usr/include/libusb-1.0 + +define Build/Compile + git init $(PKG_BUILD_DIR) + $(MAKE_VARS) \ + $(MAKE_FLAGS) \ + npm_config_arch=$(CONFIG_ARCH) \ + npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ + npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \ + PREFIX="$(PKG_INSTALL_DIR)/usr/" \ + npm install --build-from-source --target_arch=$(CPU) -g $(PKG_BUILD_DIR) +endef + +define Package/node-hid/install + mkdir -p $(1)/usr/lib/node/node-hid/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/ +endef + +$(eval $(call BuildPackage,node-hid)) + diff --git a/lang/node-serialport/Makefile b/lang/node-serialport/Makefile new file mode 100644 index 0000000..3109404 --- /dev/null +++ b/lang/node-serialport/Makefile @@ -0,0 +1,65 @@ +# +# Copyright (C) 2014 Arduino LLC +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NPM_NAME:=serialport +PKG_NAME:=node-$(PKG_NPM_NAME) +PKG_VERSION:=3.0.0 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://registry.npmjs.org/$(PKG_NPM_NAME)/-/ +PKG_MD5SUM:=ea20a17746dd64e72d5f6f2019d9e28d + +PKG_BUILD_DEPENDS:=node/host +PKG_NODE_VERSION:=4.4.5 + +PKG_MAINTAINER:=John Crispin +PKG_LICENSE:=Custom +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define Package/node-serialport + DEPENDS:=+node + SUBMENU:=Node.js + SECTION:=lang + CATEGORY:=Languages + TITLE:=Node.js package to access serial ports for reading and writing + URL:=https://www.npmjs.org/package/serialport +endef + +define Package/node-serialport/description + Node.js package to access serial ports for reading and writing OR Welcome your robotic JavaScript overlords. Better yet, program them! +endef + +define Build/Prepare + /bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1 + $(Build/Patch) +endef + +CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))) + +EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \ + +define Build/Compile + $(MAKE_FLAGS) \ + npm_config_arch=$(CONFIG_ARCH) \ + npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ + npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \ + PREFIX="$(PKG_INSTALL_DIR)/usr/" \ + npm install --build-from-source --target_arch=$(CPU) -g $(PKG_BUILD_DIR) +endef + +define Package/node-serialport/install + mkdir -p $(1)/usr/lib/node/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/ +endef + +$(eval $(call BuildPackage,node-serialport)) + diff --git a/lang/node/Makefile b/lang/node/Makefile new file mode 100644 index 0000000..6cb1e20 --- /dev/null +++ b/lang/node/Makefile @@ -0,0 +1,94 @@ +# +# Copyright (C) 2006-2016 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:=node +PKG_VERSION:=v4.4.5 +PKG_RELEASE:=1 + +PKG_SOURCE:=node-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION} +PKG_MD5SUM:=376140907bbe362f36065a30af04f020 + +HOST_BUILD_DEPENDS:=python/host +PKG_BUILD_DEPENDS:=python/host +PKG_INSTALL:=1 +PKG_USE_MIPS16:=0 + +HOST_BUILD_PARALLEL:=1 +PKG_BUILD_PARALLEL:=1 + +PKG_MAINTAINER:=John Crispin +PKG_LICENSE:= + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/package.mk + +define Package/node + SECTION:=lang + CATEGORY:=Languages + SUBMENU:=Node.js + TITLE:=Node.js is a platform built on Chrome's JavaScript runtime + URL:=http://nodejs.org/ + DEPENDS:=+libpthread +librt +libstdcpp +libopenssl +zlib +endef + +define Package/node/description + Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses + an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' + package ecosystem, npm, is the largest ecosystem of open source libraries in the world. +endef + +CPU:=$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))) + +MAKE_VARS += \ + DESTCPU=$(CPU) + +CONFIGURE_ARGS= \ + --dest-cpu=$(CPU) \ + --dest-os=linux \ + --without-snapshot \ + --shared-zlib \ + --shared-openssl \ + --prefix=/usr + +ifneq ($(findstring arm,$(ARCH)),) +CONFIGURE_ARGS+= \ + $(if $(CONFIG_SOFT_FLOAT),--with-arm-float-abi=soft,--with-arm-float-abi=hard) +endif + +ifneq ($(findstring mips,$(ARCH)),) +CONFIGURE_ARGS+= \ + $(if $(CONFIG_SOFT_FLOAT),--with-mips-float-abi=soft,--with-mips-float-abi=hard) +endif + +HOST_CONFIGURE_VARS:= + +HOST_CONFIGURE_ARGS:= \ + --dest-os=linux \ + --without-snapshot \ + --prefix=$(HOST_BUILD_PREFIX) + +HOST_CONFIGURE_CMD:=python ./configure + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ +endef + +define Package/node/install + mkdir -p $(1)/usr/bin $(1)/usr/lib/node_modules/npm/{bin,lib,node_modules} + $(CP) $(PKG_INSTALL_DIR)/usr/bin/{node,npm} $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/{package.json,LICENSE,cli.js} $(1)/usr/lib/node_modules/npm + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npm-cli.js $(1)/usr/lib/node_modules/npm/bin + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/lib/* $(1)/usr/lib/node_modules/npm/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/node_modules/* $(1)/usr/lib/node_modules/npm/node_modules/ +endef + +$(eval $(call HostBuild)) +$(eval $(call BuildPackage,node)) diff --git a/lang/node/patches/001-hardfloat.patch b/lang/node/patches/001-hardfloat.patch new file mode 100644 index 0000000..1bb2493 --- /dev/null +++ b/lang/node/patches/001-hardfloat.patch @@ -0,0 +1,12 @@ +diff --git a/deps/v8/src/base/cpu.cc b/deps/v8/src/base/cpu.cc +index 4f58720..1f3071e 100644 +--- a/deps/v8/src/base/cpu.cc ++++ b/deps/v8/src/base/cpu.cc +@@ -143,6 +143,7 @@ int __detect_fp64_mode(void) { + ".set push\n\t" + ".set noreorder\n\t" + ".set oddspreg\n\t" ++ ".set hardfloat\n\t" + "lui $t0, 0x3FF0\n\t" + "ldc1 $f0, %0\n\t" + "mtc1 $t0, $f1\n\t" diff --git a/lang/node/patches/002-addr_info.patch b/lang/node/patches/002-addr_info.patch new file mode 100644 index 0000000..0aa02da --- /dev/null +++ b/lang/node/patches/002-addr_info.patch @@ -0,0 +1,10 @@ +--- a/deps/uv/src/unix/getaddrinfo.c ++++ b/deps/uv/src/unix/getaddrinfo.c +@@ -99,6 +99,7 @@ static void uv__getaddrinfo_work(struct + int err; + + req = container_of(w, uv_getaddrinfo_t, work_req); ++ req->hints->ai_flags &= ~AI_V4MAPPED; + err = getaddrinfo(req->hostname, req->service, req->hints, &req->addrinfo); + req->retcode = uv__getaddrinfo_translate_error(err); + } diff --git a/lang/node/patches/003-path.patch b/lang/node/patches/003-path.patch new file mode 100644 index 0000000..01a71c6 --- /dev/null +++ b/lang/node/patches/003-path.patch @@ -0,0 +1,12 @@ +--- a/lib/module.js ++++ b/lib/module.js +@@ -453,7 +453,8 @@ Module._initPaths = function() { + homeDir = process.env.HOME; + } + +- var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node')]; ++ var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node'), ++ path.resolve(process.execPath, '..', '..', 'lib', 'node_modules')]; + + if (homeDir) { + paths.unshift(path.resolve(homeDir, '.node_libraries')); diff --git a/lang/openpyxl/Makefile b/lang/openpyxl/Makefile new file mode 100644 index 0000000..6656d56 --- /dev/null +++ b/lang/openpyxl/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 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:=openpyxl +PKG_VERSION:=2.4.0 +PKG_RELEASE:=1 +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://pypi.python.org/packages/7e/75/9bb309f80e4f75d139ecc55e9edf65c5844336b5a84966a609267255f961/ +PKG_MD5SUM:=e3376d1fce0681fd0b4047ab89218af4 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/openpyxl + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=A Python library to read/write Excel 2010 xlsx/xlsm files + URL:=https://openpyxl.readthedocs.org/ + DEPENDS:=+python +django +endef + +define Package/openpyxl/description + A Python library to read/write Excel 2010 xlsx/xlsm files +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/openpyxl/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,openpyxl)) diff --git a/lang/perl-cgi/Makefile b/lang/perl-cgi/Makefile new file mode 100644 index 0000000..afecaa0 --- /dev/null +++ b/lang/perl-cgi/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2016 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:=perl-cgi +PKG_VERSION:=4.28 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/L/LE/LEEJO +PKG_SOURCE:=CGI-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=28efb391377f6e98c19c23292d5fcc8c + +PKG_LICENSE:=GPL Artistic-2.0 +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/CGI-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-cgi + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Handle Common Gateway Interface requests and responses + URL:=http://search.cpan.org/dist/CGI/ + DEPENDS:=perl +perl-html-parser +perlbase-base +perlbase-config +perlbase-encode +perlbase-essential +perlbase-file +perlbase-if +perlbase-utf8 +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-cgi/install + $(call perlmod/Install,$(1),CGI CGI.pm auto/CGI) +endef + + +$(eval $(call BuildPackage,perl-cgi)) diff --git a/lang/perl-compress-bzip2/Makefile b/lang/perl-compress-bzip2/Makefile new file mode 100644 index 0000000..2876646 --- /dev/null +++ b/lang/perl-compress-bzip2/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2014, 2015 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:=perl-compress-bzip2 +PKG_VERSION:=2.24 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/R/RU/RURBAN/ +PKG_SOURCE:=Compress-Bzip2-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=d5ef04d1e51fe45743b3044abad967d2 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Compress-Bzip2-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-compress-bzip2 + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Perl interface to bzip2 compression library + URL:=http://search.cpan.org/dist/Compress-Bzip2/ + DEPENDS:=perl +libbz2 +perlbase-autoloader +perlbase-config +perlbase-essential +perlbase-fcntl +perlbase-file +perlbase-getopt +perlbase-test +perlbase-xsloader +endef + +define Build/Configure + $(call perlmod/Configure,,BUILD_BZLIB=0) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-compress-bzip2/install + $(call perlmod/Install,$(1),Compress auto/Compress) +endef + + +$(eval $(call BuildPackage,perl-compress-bzip2)) diff --git a/lang/perl-dbi/Makefile b/lang/perl-dbi/Makefile new file mode 100644 index 0000000..3c594d1 --- /dev/null +++ b/lang/perl-dbi/Makefile @@ -0,0 +1,65 @@ +# +# Copyright (C) 2014, 2015 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:=perl-dbi +PKG_VERSION:=1.634 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/T/TI/TIMB/ +PKG_SOURCE:=DBI-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=4ad15a9c2cc9b68e3fe1f5cadf9cdb30 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/DBI-$(PKG_VERSION) +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/perl/DBI-$(PKG_VERSION) + +HOST_BUILD_DEPENDS:=perl/host + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk +include ../perl/perlmod.mk + +define Package/perl-dbi + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Database independent interface for Perl + URL:=http://search.cpan.org/dist/DBI/ + DEPENDS:=perl +perlbase-base +perlbase-config +perlbase-cwd +perlbase-data +perlbase-dynaloader +perlbase-errno +perlbase-essential +perlbase-fcntl +perlbase-file +perlbase-io +perlbase-ipc +perlbase-scalar +perlbase-storable +perlbase-symbol +perlbase-tie +perlbase-universal +perlbase-utf8 +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Host/Configure + $(call perlmod/host/Configure,,) +endef + +define Host/Compile + $(call perlmod/host/Compile,,) +endef + +define Host/Install + $(call perlmod/host/Install,$(1),) +endef + +define Package/perl-dbi/install + $(call perlmod/Install,$(1),DB* auto/DBI,DBI/W32ODBC.pm auto/DBI/*.h) +endef + + +$(eval $(call BuildPackage,perl-dbi)) +$(eval $(call HostBuild)) diff --git a/lang/perl-device-serialport/Makefile b/lang/perl-device-serialport/Makefile new file mode 100644 index 0000000..2069bed --- /dev/null +++ b/lang/perl-device-serialport/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2014, 2015 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:=perl-device-serialport +PKG_VERSION:=1.04 +PKG_RELEASE:=3 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/C/CO/COOK/ +PKG_SOURCE:=Device-SerialPort-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=82c698151f934eb28c65d1838cee7d9e + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Paul Oranje + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Device-SerialPort-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-device-serialport + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=A POSIX-based version of the Win32::SerialPort module + URL:=http://search.cpan.org/dist/Device-SerialPort/ + DEPENDS:=perl +perlbase-essential +perlbase-io +perlbase-posix +perlbase-test +perlbase-xsloader +endef + +define Package/perl-device-serialport/description + A POSIX-based version of the Win32::SerialPort module + that provides modem support to Perl applications +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-device-serialport/install + $(call perlmod/Install,$(1),Device auto/Device) +endef + + +$(eval $(call BuildPackage,perl-device-serialport)) diff --git a/lang/perl-device-usb/Makefile b/lang/perl-device-usb/Makefile new file mode 100644 index 0000000..0a2c737 --- /dev/null +++ b/lang/perl-device-usb/Makefile @@ -0,0 +1,73 @@ +# +# Copyright (C) 2015 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:=perl-device-usb +PKG_VERSION:=0.36 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GW/GWADEJ/ +PKG_SOURCE:=Device-USB-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=aa91bee777f7ed7a18225a84f8795344 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Device-USB-$(PKG_VERSION) +PKG_BUILD_DEPENDS:=perl-inline-c/host + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-device-usb + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=libusb library wrapper + URL:=http://search.cpan.org/dist/Device-USB/ + DEPENDS:=perl +libusb-compat +perl-inline +perl-inline-c +perlbase-essential +perlbase-test +endef + +# Device::USB will generate a second Makefile.PL to build it's native code +# using Inline::C under _Inline/. The goal here is to prevent Inline::C from +# running that one automatically, as we need to supply a bunch of overrides via +# perlmod/Configure. +# _INLINE_C_NO_COMPILE_ is an OpenWRT-specific environment variable to Inline::C +# that does just that. +define Build/Configure + $(call perlmod/Configure,,) + + # Prepare a library directory where we can link againt lusb-0.1(as + # opposed to -lusb) to avoid confusion at runtime + mkdir $(PKG_BUILD_DIR)/syslib + $(LN) $(STAGING_DIR)/usr/lib/libusb.so $(PKG_BUILD_DIR)/syslib/libusb-0.1.so + + # Generate _Inline + $(call perlmod/Compile,config,LIBUSB_LIBDIR=$(PKG_BUILD_DIR)/syslib \ + _INLINE_C_NO_COMPILE_=1 \ + _INLINE_C_SYSTEM_TYPEMAP_=$(STAGING_DIR)/usr/lib/perl5/$(PERL_VERSION)/ExtUtils/typemap) + $(call perlmod/Compile,dynamic,_INLINE_C_NO_COMPILE_=1) + + # Configure _Inline + $(call perlmod/Configure,,,$(PKG_BUILD_DIR)/_Inline/build/Device/USB) + + # Prevent re-configuring Inline code + sed 's/^dynamic :: D.*$$$$//' -i $(PKG_BUILD_DIR)/Makefile +endef + +define Build/Compile + $(call perlmod/Compile,,,$(PKG_BUILD_DIR)/_Inline/build/Device/USB) + $(call perlmod/Compile,,) +endef + +define Package/perl-device-usb/install + $(call perlmod/Install,$(1),Device auto/Device) +endef + + +$(eval $(call BuildPackage,perl-device-usb)) diff --git a/lang/perl-device-usb/README.patches b/lang/perl-device-usb/README.patches new file mode 100644 index 0000000..66ece00 --- /dev/null +++ b/lang/perl-device-usb/README.patches @@ -0,0 +1,8 @@ +This package contains some patches taken directly from Debian Jessie(stable at +the time of writing). +Namely, these are: +- 100-fix_buildsystem.patch +- 110-just_assume_libusb_is_there.diff + +The other patches are specific to OpenWRT, fixing bugs and resolving conflicts +where necessary. \ No newline at end of file diff --git a/lang/perl-device-usb/patches/100-fix_buildsystem.patch b/lang/perl-device-usb/patches/100-fix_buildsystem.patch new file mode 100644 index 0000000..5201894 --- /dev/null +++ b/lang/perl-device-usb/patches/100-fix_buildsystem.patch @@ -0,0 +1,20 @@ +Description: Ignore files we do not want installed. +Forwarded: not-needed +Author: Tim Retout +Reviewed-by: gregor herrmann +Last-Update: 2013-10-28 + +--- a/Makefile.PL ++++ b/Makefile.PL +@@ -2,6 +2,11 @@ + use warnings; + use Inline::MakeMaker; + ++sub MY::libscan { ++ return if ($_[1] eq 'USB.pm' or $_[1] eq 'dump_usb.pl'); ++ return $_[1]; ++} ++ + if($^O eq 'MSWin32') + { + if(!$ENV{LIBUSB_LIBDIR} or !$ENV{LIBUSB_INCDIR}) diff --git a/lang/perl-device-usb/patches/110-just_assume_libusb_is_there.diff b/lang/perl-device-usb/patches/110-just_assume_libusb_is_there.diff new file mode 100644 index 0000000..9365eb4 --- /dev/null +++ b/lang/perl-device-usb/patches/110-just_assume_libusb_is_there.diff @@ -0,0 +1,30 @@ +Subject: Just assume libusb is out there + Makefile.PL should not try to check for libusb in a given list of directories + as the compiler might look in other places as well. +Origin: vendor +Bug-Debian: http://bugs.debian.org/639677 +Forwarded: not-needed +From: Ansgar Burchardt +Reviewed-by: gregor herrmann +Last-Update: 2013-10-28 + +--- libdevice-usb-perl.orig/Makefile.PL ++++ libdevice-usb-perl/Makefile.PL +@@ -21,7 +21,7 @@ + } + } + +-unless(header_found()) ++unless(1 || header_found()) + { + die <<"END"; + ERROR: Can't find usb.h header. +@@ -36,7 +36,7 @@ + END + } + +-unless(lib_found()) ++unless(1 || lib_found()) + { + die <<"END"; + ERROR: Can't find libusb library. diff --git a/lang/perl-device-usb/patches/120-use_libusb_0_1.patch b/lang/perl-device-usb/patches/120-use_libusb_0_1.patch new file mode 100644 index 0000000..7d43e73 --- /dev/null +++ b/lang/perl-device-usb/patches/120-use_libusb_0_1.patch @@ -0,0 +1,13 @@ +--- a/lib/Device/USB.pm ++++ b/lib/Device/USB.pm +@@ -9,8 +9,8 @@ use Inline ( + C => "DATA", + ($ENV{LIBUSB_LIBDIR} + ? ( LIBS => "-L\"$ENV{LIBUSB_LIBDIR}\" " . +- ($^O eq 'MSWin32' ? ' -llibusb -L\"$ENV{WINDDK}\\lib\\crt\\i386\" -lmsvcrt ' : '-lusb') ) +- : ( LIBS => '-lusb', ) ++ ($^O eq 'MSWin32' ? ' -llibusb -L\"$ENV{WINDDK}\\lib\\crt\\i386\" -lmsvcrt ' : '-lusb-0.1') ) ++ : ( LIBS => '-lusb-0.1', ) + ), + ($ENV{LIBUSB_INCDIR} ? ( INC => "-I\"$ENV{LIBUSB_INCDIR}\"" ) : () ), + NAME => 'Device::USB', diff --git a/lang/perl-device-usb/patches/130-provide-proper-library-paths.patch b/lang/perl-device-usb/patches/130-provide-proper-library-paths.patch new file mode 100644 index 0000000..3fce75a --- /dev/null +++ b/lang/perl-device-usb/patches/130-provide-proper-library-paths.patch @@ -0,0 +1,13 @@ +--- a/lib/Device/USB.pm ++++ b/lib/Device/USB.pm +@@ -8,8 +8,8 @@ use Carp; + use Inline ( + C => "DATA", + ($ENV{LIBUSB_LIBDIR} +- ? ( LIBS => "-L\"$ENV{LIBUSB_LIBDIR}\" " . +- ($^O eq 'MSWin32' ? ' -llibusb -L\"$ENV{WINDDK}\\lib\\crt\\i386\" -lmsvcrt ' : '-lusb-0.1') ) ++ ? ( LIBS => "-L$ENV{LIBUSB_LIBDIR} " . ++ ($^O eq 'MSWin32' ? ' -llibusb -L$ENV{WINDDK}\\lib\\crt\\i386 -lmsvcrt ' : '-lusb-0.1') ) + : ( LIBS => '-lusb-0.1', ) + ), + ($ENV{LIBUSB_INCDIR} ? ( INC => "-I\"$ENV{LIBUSB_INCDIR}\"" ) : () ), diff --git a/lang/perl-device-usb/patches/140-avoid-libusb-name-conflicts.patch b/lang/perl-device-usb/patches/140-avoid-libusb-name-conflicts.patch new file mode 100644 index 0000000..55e5cc3 --- /dev/null +++ b/lang/perl-device-usb/patches/140-avoid-libusb-name-conflicts.patch @@ -0,0 +1,219 @@ +--- a/lib/Device/USB.pm ++++ b/lib/Device/USB.pm +@@ -15,6 +15,7 @@ use Inline ( + ($ENV{LIBUSB_INCDIR} ? ( INC => "-I\"$ENV{LIBUSB_INCDIR}\"" ) : () ), + NAME => 'Device::USB', + VERSION => '0.36', ++ PREFIX => 'deviceusb_', + ); + + Inline->init(); +@@ -540,74 +541,74 @@ unsigned DeviceUSBDebugLevel() + return debugLevel; + } + +-void libusb_init() ++void deviceusb_libusb_init() + { + usb_init(); + } + +-int libusb_find_busses() ++int deviceusb_libusb_find_busses() + { + return usb_find_busses(); + } + +-int libusb_find_devices() ++int deviceusb_libusb_find_devices() + { + return usb_find_devices(); + } + +-void *libusb_get_busses() ++void *deviceusb_libusb_get_busses() + { + return usb_get_busses(); + } + +-void *libusb_open(void *dev) ++void *deviceusb_libusb_open(void *dev) + { + return usb_open( (struct usb_device*)dev ); + } + +-int libusb_close(void *dev) ++int deviceusb_libusb_close(void *dev) + { + return usb_close((usb_dev_handle *)dev); + } + +-int libusb_set_configuration(void *dev, int configuration) ++int deviceusb_libusb_set_configuration(void *dev, int configuration) + { + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_set_configuration( %d )\n", configuration ); ++ printf( "deviceusb_libusb_set_configuration( %d )\n", configuration ); + } + return usb_set_configuration((usb_dev_handle *)dev, configuration); + } + +-int libusb_set_altinterface(void *dev, int alternate) ++int deviceusb_libusb_set_altinterface(void *dev, int alternate) + { + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_set_altinterface( %d )\n", alternate ); ++ printf( "deviceusb_libusb_set_altinterface( %d )\n", alternate ); + } + return usb_set_altinterface((usb_dev_handle *)dev, alternate); + } + +-int libusb_clear_halt(void *dev, unsigned int ep) ++int deviceusb_libusb_clear_halt(void *dev, unsigned int ep) + { + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_clear_halt( %d )\n", ep ); ++ printf( "deviceusb_libusb_clear_halt( %d )\n", ep ); + } + return usb_clear_halt((usb_dev_handle *)dev, ep); + } + +-int libusb_reset(void *dev) ++int deviceusb_libusb_reset(void *dev) + { + return usb_reset((usb_dev_handle *)dev); + } + +-int libusb_get_driver_np(void *dev, int interface, char *name, unsigned int namelen) ++int deviceusb_libusb_get_driver_np(void *dev, int interface, char *name, unsigned int namelen) + { + int ret = 0; + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_get_driver_np( %d )\n", interface ); ++ printf( "deviceusb_libusb_get_driver_np( %d )\n", interface ); + } + #if LIBUSB_HAS_GET_DRIVER_NP + ret = usb_get_driver_np((usb_dev_handle *)dev, interface, name, namelen); +@@ -618,11 +619,11 @@ int libusb_get_driver_np(void *dev, int + #endif + } + +-int libusb_detach_kernel_driver_np(void *dev, int interface) ++int deviceusb_libusb_detach_kernel_driver_np(void *dev, int interface) + { + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_detach_kernel_driver_np( %d )\n", interface ); ++ printf( "deviceusb_libusb_detach_kernel_driver_np( %d )\n", interface ); + } + #if LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP + return usb_detach_kernel_driver_np((usb_dev_handle *)dev, interface); +@@ -631,25 +632,25 @@ int libusb_detach_kernel_driver_np(void + #endif + } + +-int libusb_claim_interface(void *dev, int interface) ++int deviceusb_libusb_claim_interface(void *dev, int interface) + { + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_claim_interface( %d )\n", interface ); ++ printf( "deviceusb_libusb_claim_interface( %d )\n", interface ); + } + return usb_claim_interface((usb_dev_handle *)dev, interface); + } + +-int libusb_release_interface(void *dev, int interface) ++int deviceusb_libusb_release_interface(void *dev, int interface) + { + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_release_interface( %d )\n", interface ); ++ printf( "deviceusb_libusb_release_interface( %d )\n", interface ); + } + return usb_release_interface((usb_dev_handle *)dev, interface); + } + +-void libusb_control_msg(void *dev, int requesttype, int request, int value, int index, char *bytes, int size, int timeout) ++void deviceusb_libusb_control_msg(void *dev, int requesttype, int request, int value, int index, char *bytes, int size, int timeout) + { + int i = 0; + int retval = 0; +@@ -658,7 +659,7 @@ void libusb_control_msg(void *dev, int r + + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_control_msg( %#04x, %#04x, %#04x, %#04x, %p, %d, %d )\n", ++ printf( "deviceusb_libusb_control_msg( %#04x, %#04x, %#04x, %#04x, %p, %d, %d )\n", + requesttype, request, value, index, bytes, size, timeout + ); + /* maybe need to add support for printing the bytes string. */ +@@ -691,54 +692,54 @@ void libusb_control_msg(void *dev, int r + Inline_Stack_Done; + } + +-int libusb_get_string(void *dev, int index, int langid, char *buf, size_t buflen) ++int deviceusb_libusb_get_string(void *dev, int index, int langid, char *buf, size_t buflen) + { + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_get_string( %d, %d, %p, %lu )\n", ++ printf( "deviceusb_libusb_get_string( %d, %d, %p, %lu )\n", + index, langid, buf, (unsigned long)buflen + ); + } + return usb_get_string((usb_dev_handle *)dev, index, langid, buf, buflen); + } + +-int libusb_get_string_simple(void *dev, int index, char *buf, size_t buflen) ++int deviceusb_libusb_get_string_simple(void *dev, int index, char *buf, size_t buflen) + { + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_get_string_simple( %d, %p, %lu )\n", ++ printf( "deviceusb_libusb_get_string_simple( %d, %p, %lu )\n", + index, buf, (unsigned long)buflen + ); + } + return usb_get_string_simple((usb_dev_handle *)dev, index, buf, buflen); + } + +-int libusb_get_descriptor(void *dev, unsigned char type, unsigned char index, char *buf, int size) ++int deviceusb_libusb_get_descriptor(void *dev, unsigned char type, unsigned char index, char *buf, int size) + { + return usb_get_descriptor((usb_dev_handle *)dev, type, index, buf, size); + } + +-int libusb_get_descriptor_by_endpoint(void *dev, int ep, unsigned char type, unsigned char index, char *buf, int size) ++int deviceusb_libusb_get_descriptor_by_endpoint(void *dev, int ep, unsigned char type, unsigned char index, char *buf, int size) + { + return usb_get_descriptor_by_endpoint((usb_dev_handle *)dev, ep, type, index, buf, size); + } + +-int libusb_bulk_write(void *dev, int ep, char *bytes, int size, int timeout) ++int deviceusb_libusb_bulk_write(void *dev, int ep, char *bytes, int size, int timeout) + { + return usb_bulk_write((usb_dev_handle *)dev, ep, bytes, size, timeout); + } + +-int libusb_bulk_read(void *dev, int ep, char *bytes, int size, int timeout) ++int deviceusb_libusb_bulk_read(void *dev, int ep, char *bytes, int size, int timeout) + { + return usb_bulk_read((usb_dev_handle *)dev, ep, bytes, size, timeout); + } + +-int libusb_interrupt_write(void *dev, int ep, char *bytes, int size, int timeout) ++int deviceusb_libusb_interrupt_write(void *dev, int ep, char *bytes, int size, int timeout) + { + return usb_interrupt_write((usb_dev_handle *)dev, ep, bytes, size, timeout); + } + +-int libusb_interrupt_read(void *dev, int ep, char *bytes, int size, int timeout) ++int deviceusb_libusb_interrupt_read(void *dev, int ep, char *bytes, int size, int timeout) + { + return usb_interrupt_read((usb_dev_handle *)dev, ep, bytes, size, timeout); + } diff --git a/lang/perl-encode-locale/Makefile b/lang/perl-encode-locale/Makefile new file mode 100644 index 0000000..54071dc --- /dev/null +++ b/lang/perl-encode-locale/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=perl-encode-locale +PKG_VERSION:=1.05 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=Encode-Locale-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=fcfdb8e4ee34bcf62aed429b4a23db27 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Encode-Locale-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-encode-locale + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Determine the locale encoding + URL:=http://search.cpan.org/dist/Encode-Locale/ + DEPENDS:=perl +perlbase-base +perlbase-encode +perlbase-essential +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-encode-locale/install + $(call perlmod/Install,$(1),Encode auto/Encode) +endef + + +$(eval $(call BuildPackage,perl-encode-locale)) diff --git a/lang/perl-file-listing/Makefile b/lang/perl-file-listing/Makefile new file mode 100644 index 0000000..19a6938 --- /dev/null +++ b/lang/perl-file-listing/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=perl-file-listing +PKG_VERSION:=6.04 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=File-Listing-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=83f636b477741f3a014585bb9cc079a6 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/File-Listing-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-file-listing + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Parse directory listing + URL:=http://search.cpan.org/dist/File-Listing/ + DEPENDS:=perl +perl-http-date +perlbase-essential +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-file-listing/install + $(call perlmod/Install,$(1),File auto/File) +endef + + +$(eval $(call BuildPackage,perl-file-listing)) diff --git a/lang/perl-file-sharedir-install/Makefile b/lang/perl-file-sharedir-install/Makefile new file mode 100644 index 0000000..d107d70 --- /dev/null +++ b/lang/perl-file-sharedir-install/Makefile @@ -0,0 +1,64 @@ +# +# Copyright (C) 2015 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:=perl-file-sharedir-install +PKG_VERSION:=0.10 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GW/GWYN +PKG_SOURCE:=File-ShareDir-Install-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=37fb7fa72ce7184516dd022aba62f524 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/perl/File-ShareDir-Install-$(PKG_VERSION) +HOST_BUILD_DEPENDS:=perl/host +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/File-ShareDir-Install-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk +include ../perl/perlmod.mk + +define Package/perl-file-sharedir-install + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Install read-only data files + URL:=http://search.cpan.org/dist/File-ShareDir-Install/ + DEPENDS:=perl +perlbase-essential +perlbase-extutils +perlbase-file +perlbase-io +endef + +define Host/Configure + $(call perlmod/host/Configure,,,) +endef + +define Host/Compile + $(call perlmod/host/Compile,,) +endef + +define Host/Install + $(call perlmod/host/Install,$(1),) +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-file-sharedir-install/install + $(call perlmod/Install,$(1),File auto/File) +endef + + +$(eval $(call BuildPackage,perl-file-sharedir-install)) +$(eval $(call HostBuild)) diff --git a/lang/perl-html-form/Makefile b/lang/perl-html-form/Makefile new file mode 100644 index 0000000..d412a1f --- /dev/null +++ b/lang/perl-html-form/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=perl-html-form +PKG_VERSION:=6.03 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=HTML-Form-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=fa6c2680207ed4fef5ea2ef09c210614 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTML-Form-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-html-form + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Class that represents an HTML form element + URL:=http://search.cpan.org/dist/HTML-Form/ + DEPENDS:=perl +perl-html-parser +perl-http-message +perl-uri +perlbase-encode +perlbase-essential +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-html-form/install + $(call perlmod/Install,$(1),HTML auto/HTML) +endef + + +$(eval $(call BuildPackage,perl-html-form)) diff --git a/lang/perl-html-parser/Makefile b/lang/perl-html-parser/Makefile new file mode 100644 index 0000000..e977217 --- /dev/null +++ b/lang/perl-html-parser/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2014 - 2016 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:=perl-html-parser +PKG_VERSION:=3.72 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS/ +PKG_SOURCE:=HTML-Parser-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=eb7505e5f626913350df9dd4a03d54a8 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTML-Parser-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-html-parser + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=A collection of modules that parse HTML text documents + URL:=http://search.cpan.org/dist/HTML-Parser/ + DEPENDS:=perl +perl-html-tagset +perlbase-essential +perlbase-xsloader +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-html-parser/install + $(call perlmod/Install,$(1),HTML auto/HTML) +endef + + +$(eval $(call BuildPackage,perl-html-parser)) diff --git a/lang/perl-html-tagset/Makefile b/lang/perl-html-tagset/Makefile new file mode 100644 index 0000000..4bcd10c --- /dev/null +++ b/lang/perl-html-tagset/Makefile @@ -0,0 +1,48 @@ +# +# 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:=perl-html-tagset +PKG_VERSION:=3.20 +PKG_RELEASE:=3 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/P/PE/PETDANCE/ +PKG_SOURCE:=HTML-Tagset-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=d2bfa18fe1904df7f683e96611e87437 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTML-Tagset-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-html-tagset + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Data tables pertaining to HTML + URL:=http://search.cpan.org/dist/HTML-Tagset/ + DEPENDS:=perl +perlbase-essential +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-html-tagset/install + $(call perlmod/Install,$(1),HTML) +endef + + +$(eval $(call BuildPackage,perl-html-tagset)) diff --git a/lang/perl-html-tree/Makefile b/lang/perl-html-tree/Makefile new file mode 100644 index 0000000..d1b4ac9 --- /dev/null +++ b/lang/perl-html-tree/Makefile @@ -0,0 +1,49 @@ +# +# 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:=perl-html-tree +PKG_VERSION:=3.23 +PKG_RELEASE:=4 +PKG_MD5SUM:=6352f50be402301f79b580dd235d7762 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/P/PE/PETEK/ +PKG_SOURCE:=HTML-Tree-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=6352f50be402301f79b580dd235d7762 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTML-Tree-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-html-tree + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Represent and create HTML syntax trees + URL:=http://search.cpan.org/dist/HTML-Tree/ + DEPENDS:=perl +perl-html-parser +perl-html-tagset +perlbase-essential +perlbase-integer +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-html-tree/install + $(call perlmod/Install,$(1),HTML) +endef + + +$(eval $(call BuildPackage,perl-html-tree)) diff --git a/lang/perl-http-cookies/Makefile b/lang/perl-http-cookies/Makefile new file mode 100644 index 0000000..329767a --- /dev/null +++ b/lang/perl-http-cookies/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=perl-http-cookies +PKG_VERSION:=6.01 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=HTTP-Cookies-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=ecfd0eeb88512033352c2f13c9580f03 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Cookies-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-http-cookies + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=HTTP cookie jars + URL:=http://search.cpan.org/dist/HTTP-Cookies/ + DEPENDS:=perl +perl-http-date +perl-http-message +perlbase-essential +perlbase-time +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-http-cookies/install + $(call perlmod/Install,$(1),HTTP auto/HTTP) +endef + + +$(eval $(call BuildPackage,perl-http-cookies)) diff --git a/lang/perl-http-daemon/Makefile b/lang/perl-http-daemon/Makefile new file mode 100644 index 0000000..178573d --- /dev/null +++ b/lang/perl-http-daemon/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=perl-http-daemon +PKG_VERSION:=6.01 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=HTTP-Daemon-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=ed0ae02d25d7f1e89456d4d69732adc2 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Daemon-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-http-daemon + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=A simple http server class + URL:=http://search.cpan.org/dist/HTTP-Daemon/ + DEPENDS:=perl +perl-http-date +perl-http-message +perl-lwp-mediatypes +perlbase-essential +perlbase-io +perlbase-sys +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-http-daemon/install + $(call perlmod/Install,$(1),HTTP auto/HTTP) +endef + + +$(eval $(call BuildPackage,perl-http-daemon)) diff --git a/lang/perl-http-date/Makefile b/lang/perl-http-date/Makefile new file mode 100644 index 0000000..bf0bd40 --- /dev/null +++ b/lang/perl-http-date/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=perl-http-date +PKG_VERSION:=6.02 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=HTTP-Date-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=52b7a0d5982d61be1edb217751d7daba + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Date-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-http-date + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Date conversion routines + URL:=http://search.cpan.org/dist/HTTP-Date/ + DEPENDS:=perl +perlbase-essential +perlbase-time +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-http-date/install + $(call perlmod/Install,$(1),HTTP auto/HTTP) +endef + + +$(eval $(call BuildPackage,perl-http-date)) diff --git a/lang/perl-http-message/Makefile b/lang/perl-http-message/Makefile new file mode 100644 index 0000000..2b90e2a --- /dev/null +++ b/lang/perl-http-message/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=perl-http-message +PKG_VERSION:=6.11 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/E/ET/ETHER +PKG_SOURCE:=HTTP-Message-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=4ed7add10daea3ab30abfeab6d03872f + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Message-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-http-message + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=HTTP style messages + URL:=http://search.cpan.org/dist/HTTP-Message/ + DEPENDS:=perl +perl-encode-locale +perl-http-date +perl-io-html +perl-lwp-mediatypes +perl-uri +perlbase-base +perlbase-compress +perlbase-encode +perlbase-essential +perlbase-io +perlbase-mime +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-http-message/install + $(call perlmod/Install,$(1),HTTP auto/HTTP) +endef + + +$(eval $(call BuildPackage,perl-http-message)) diff --git a/lang/perl-http-negotiate/Makefile b/lang/perl-http-negotiate/Makefile new file mode 100644 index 0000000..a72893a --- /dev/null +++ b/lang/perl-http-negotiate/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=perl-http-negotiate +PKG_VERSION:=6.01 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=HTTP-Negotiate-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=1236195250e264d7436e7bb02031671b + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Negotiate-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-http-negotiate + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Choose a variant to serve + URL:=http://search.cpan.org/dist/HTTP-Negotiate/ + DEPENDS:=perl +perl-http-message +perlbase-essential +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-http-negotiate/install + $(call perlmod/Install,$(1),HTTP auto/HTTP) +endef + + +$(eval $(call BuildPackage,perl-http-negotiate)) diff --git a/lang/perl-http-server-simple/Makefile b/lang/perl-http-server-simple/Makefile new file mode 100644 index 0000000..9a41da6 --- /dev/null +++ b/lang/perl-http-server-simple/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=perl-http-server-simple +PKG_VERSION:=0.51 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/B/BP/BPS +PKG_SOURCE:=HTTP-Server-Simple-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=ef736daddc7a32a29207fa4ed5f5d62e + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Server-Simple-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-http-server-simple + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lightweight HTTP server + URL:=http://search.cpan.org/dist/HTTP-Server-Simple/ + DEPENDS:=perl +perl-cgi +perlbase-base +perlbase-essential +perlbase-filehandle +perlbase-socket +perlbase-test +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-http-server-simple/install + $(call perlmod/Install,$(1),HTTP auto/HTTP) +endef + + +$(eval $(call BuildPackage,perl-http-server-simple)) diff --git a/lang/perl-inline-c/Makefile b/lang/perl-inline-c/Makefile new file mode 100644 index 0000000..52826d2 --- /dev/null +++ b/lang/perl-inline-c/Makefile @@ -0,0 +1,65 @@ +# +# Copyright (C) 2015 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:=perl-inline-c +PKG_VERSION:=0.76 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/I/IN/INGY +PKG_SOURCE:=Inline-C-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=c0fbfdd058075c9271a1384c822c9a87 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/perl/Inline-C-$(PKG_VERSION) +HOST_BUILD_DEPENDS:=perl/host perl-inline/host perl-parse-recdescent/host perl-file-sharedir-install/host +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Inline-C-$(PKG_VERSION) +PKG_BUILD_DEPENDS:=perl-inline/host perl-parse-recdescent/host perl-file-sharedir-install/host + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk +include ../perl/perlmod.mk + +define Package/perl-inline-c + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=C Language Support for Inline + URL:=http://search.cpan.org/dist/Inline-C/ + DEPENDS:=perl +perl-inline +perl-parse-recdescent +perlbase-config +perlbase-cwd +perlbase-data +perlbase-essential +perlbase-extutils +perlbase-file +perlbase-if +endef + +define Host/Configure + $(call perlmod/host/Configure,,,) +endef + +define Host/Compile + $(call perlmod/host/Compile,,) +endef + +define Host/Install + $(call perlmod/host/Install,$(1),) +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-inline-c/install + $(call perlmod/Install,$(1),Inline auto/Inline) +endef + + +$(eval $(call BuildPackage,perl-inline-c)) +$(eval $(call HostBuild)) diff --git a/lang/perl-inline-c/patches/100-inline_c-no_compile_hack.patch b/lang/perl-inline-c/patches/100-inline_c-no_compile_hack.patch new file mode 100644 index 0000000..dcfe2bb --- /dev/null +++ b/lang/perl-inline-c/patches/100-inline_c-no_compile_hack.patch @@ -0,0 +1,11 @@ +--- a/lib/Inline/C.pm ++++ b/lib/Inline/C.pm +@@ -361,7 +361,7 @@ sub build { + $o->call('write_XS', 'Build Glue 1'); + $o->call('write_Inline_headers', 'Build Glue 2'); + $o->call('write_Makefile_PL', 'Build Glue 3'); +- $o->call('compile', 'Build Compile'); ++ $o->call('compile', 'Build Compile') unless $ENV{'_INLINE_C_NO_COMPILE_'}; + if (IS_WIN32) { + $lockfh->release or die "releasemutex $file: $^E"; + } diff --git a/lang/perl-inline-c/patches/110-inline_c-make_system_typemap_overridable.patch b/lang/perl-inline-c/patches/110-inline_c-make_system_typemap_overridable.patch new file mode 100644 index 0000000..b2ae09e --- /dev/null +++ b/lang/perl-inline-c/patches/110-inline_c-make_system_typemap_overridable.patch @@ -0,0 +1,46 @@ +--- a/lib/Inline/C.pm ++++ b/lib/Inline/C.pm +@@ -438,22 +438,28 @@ sub get_maps { + print STDERR "get_maps Stage\n" if $o->{CONFIG}{BUILD_NOISY}; + my $typemap = ''; + my $file; +- $file = File::Spec->catfile( +- $Config::Config{installprivlib}, +- "ExtUtils", +- "typemap", +- ); +- $typemap = $file if -f $file; +- $file = File::Spec->catfile( +- $Config::Config{privlibexp} +- ,"ExtUtils","typemap" +- ); +- $typemap = $file +- if (not $typemap and -f $file); +- warn "Can't find the default system typemap file" +- if (not $typemap and $^W); ++ ++ unless ($ENV{'_INLINE_C_SYSTEM_TYPEMAP_'}) { ++ $file = File::Spec->catfile( ++ $Config::Config{installprivlib}, ++ "ExtUtils", ++ "typemap", ++ ); ++ $typemap = $file if -f $file; ++ $file = File::Spec->catfile( ++ $Config::Config{privlibexp} ++ ,"ExtUtils","typemap" ++ ); ++ $typemap = $file ++ if (not $typemap and -f $file); ++ warn "Can't find the default system typemap file" ++ if (not $typemap and $^W); + +- unshift(@{$o->{ILSM}{MAKEFILE}{TYPEMAPS}}, $typemap) if $typemap; ++ unshift(@{$o->{ILSM}{MAKEFILE}{TYPEMAPS}}, $typemap) if $typemap; ++ } ++ else { ++ unshift(@{$o->{ILSM}{MAKEFILE}{TYPEMAPS}}, $ENV{'_INLINE_C_SYSTEM_TYPEMAP_'}); ++ } + + if (not $o->UNTAINT) { + require FindBin; diff --git a/lang/perl-inline/Makefile b/lang/perl-inline/Makefile new file mode 100644 index 0000000..a120705 --- /dev/null +++ b/lang/perl-inline/Makefile @@ -0,0 +1,65 @@ +# +# Copyright (C) 2015 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:=perl-inline +PKG_VERSION:=0.80 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/I/IN/INGY +PKG_SOURCE:=Inline-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=510bbac46e727bcaf240b7feac2646c9 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Inline-$(PKG_VERSION) +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/perl/Inline-$(PKG_VERSION) + +HOST_BUILD_DEPENDS:=perl/host + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk +include ../perl/perlmod.mk + +define Package/perl-inline + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Write subroutines in other languages + URL:=http://search.cpan.org/dist/Inline/ + DEPENDS:=perl +perlbase-base +perlbase-config +perlbase-cwd +perlbase-digest +perlbase-essential +perlbase-fcntl +perlbase-file +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-inline/install + $(call perlmod/Install,$(1),Inline.pm Inline auto/Inline) +endef + +define Host/Configure + $(call perlmod/host/Configure,,,) +endef + +define Host/Compile + $(call perlmod/host/Compile,,) +endef + +define Host/Install + $(call perlmod/host/Install,$(1),) +endef + + +$(eval $(call BuildPackage,perl-inline)) +$(eval $(call HostBuild)) diff --git a/lang/perl-io-html/Makefile b/lang/perl-io-html/Makefile new file mode 100644 index 0000000..9390c36 --- /dev/null +++ b/lang/perl-io-html/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=perl-io-html +PKG_VERSION:=1.001 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/C/CJ/CJM +PKG_SOURCE:=IO-HTML-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=3f8958718844dc96b9f6946f21d70d22 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/IO-HTML-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-io-html + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Open an HTML file with automatic charset detection + URL:=http://search.cpan.org/dist/IO-HTML/ + DEPENDS:=perl +perlbase-encode +perlbase-essential +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-io-html/install + $(call perlmod/Install,$(1),IO auto/IO) +endef + + +$(eval $(call BuildPackage,perl-io-html)) diff --git a/lang/perl-lockfile-simple/Makefile b/lang/perl-lockfile-simple/Makefile new file mode 100644 index 0000000..b81e678 --- /dev/null +++ b/lang/perl-lockfile-simple/Makefile @@ -0,0 +1,48 @@ +# +# 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:=perl-lockfile-simple +PKG_VERSION:=0.208 +PKG_RELEASE:=3 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/S/SC/SCHWIGON/lockfile-simple/ +PKG_SOURCE:=LockFile-Simple-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=4421283b4f32549e5299963734170044 + +PKG_LICENSE:=GPL-2.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/LockFile-Simple-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-lockfile-simple + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Simple advisory file locking + URL:=http://search.cpan.org/dist/LockFile-Simple/ + DEPENDS:=perl +perlbase-essential +perlbase-sys +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-lockfile-simple/install + $(call perlmod/Install,$(1),LockFile auto/LockFile) +endef + + +$(eval $(call BuildPackage,perl-lockfile-simple)) diff --git a/lang/perl-lwp-mediatypes/Makefile b/lang/perl-lwp-mediatypes/Makefile new file mode 100644 index 0000000..6985431 --- /dev/null +++ b/lang/perl-lwp-mediatypes/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=perl-lwp-mediatypes +PKG_VERSION:=6.02 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=LWP-MediaTypes-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=8c5f25fb64b974d22aff424476ba13c9 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/LWP-MediaTypes-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-lwp-mediatypes + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Guess media type for a file or a URL + URL:=http://search.cpan.org/dist/LWP-MediaTypes/ + DEPENDS:=perl +perlbase-essential +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-lwp-mediatypes/install + $(call perlmod/Install,$(1),LWP auto/LWP) +endef + + +$(eval $(call BuildPackage,perl-lwp-mediatypes)) diff --git a/lang/perl-net-http/Makefile b/lang/perl-net-http/Makefile new file mode 100644 index 0000000..058ac16 --- /dev/null +++ b/lang/perl-net-http/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=perl-net-http +PKG_VERSION:=6.09 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/E/ET/ETHER +PKG_SOURCE:=Net-HTTP-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=3d84d17f64c7316d69e7eb7b4e292b9a + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Net-HTTP-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-net-http + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Low-level HTTP connection (client) + URL:=http://search.cpan.org/dist/Net-HTTP/ + DEPENDS:=perl +perl-uri +perlbase-compress +perlbase-essential +perlbase-io +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-net-http/install + $(call perlmod/Install,$(1),Net auto/Net) +endef + + +$(eval $(call BuildPackage,perl-net-http)) diff --git a/lang/perl-net-telnet/Makefile b/lang/perl-net-telnet/Makefile new file mode 100644 index 0000000..c915064 --- /dev/null +++ b/lang/perl-net-telnet/Makefile @@ -0,0 +1,48 @@ +# +# 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:=perl-net-telnet +PKG_VERSION:=3.04 +PKG_RELEASE:=3 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/J/JR/JROGERS/ +PKG_SOURCE:=Net-Telnet-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=d2514080116c1b0fa5f96295c84538e3 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Net-Telnet-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-net-telnet + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Telnet client + URL:=http://search.cpan.org/dist/Net-Telnet/ + DEPENDS:=perl +perlbase-essential +perlbase-socket +perlbase-symbol +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-net-telnet/install + $(call perlmod/Install,$(1),Net auto/Net) +endef + + +$(eval $(call BuildPackage,perl-net-telnet)) diff --git a/lang/perl-parse-recdescent/Makefile b/lang/perl-parse-recdescent/Makefile new file mode 100644 index 0000000..bbeff7b --- /dev/null +++ b/lang/perl-parse-recdescent/Makefile @@ -0,0 +1,64 @@ +# +# Copyright (C) 2015 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:=perl-parse-recdescent +PKG_VERSION:=1.967013 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/J/JT/JTBRAUN +PKG_SOURCE:=Parse-RecDescent-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=98f582240556a4a92e5d57e480f9d39d + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/perl/Parse-RecDescent-$(PKG_VERSION) +HOST_BUILD_DEPENDS:=perl/host +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Parse-RecDescent-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk +include ../perl/perlmod.mk + +define Package/perl-parse-recdescent + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Generate Recursive-Descent Parsers + URL:=http://search.cpan.org/dist/Parse-RecDescent/ + DEPENDS:=perl +perlbase-essential +perlbase-test +perlbase-text +endef + +define Host/Configure + $(call perlmod/host/Configure,,,) +endef + +define Host/Compile + $(call perlmod/host/Compile,,) +endef + +define Host/Install + $(call perlmod/host/Install,$(1),) +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-parse-recdescent/install + $(call perlmod/Install,$(1),Parse auto/Parse) +endef + + +$(eval $(call BuildPackage,perl-parse-recdescent)) +$(eval $(call HostBuild)) diff --git a/lang/perl-sub-uplevel/Makefile b/lang/perl-sub-uplevel/Makefile new file mode 100644 index 0000000..266bce4 --- /dev/null +++ b/lang/perl-sub-uplevel/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=perl-sub-uplevel +PKG_VERSION:=0.25 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/D/DA/DAGOLDEN +PKG_SOURCE:=Sub-Uplevel-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=5d0752dbfa94d0c91b25a264f47f5675 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Sub-Uplevel-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-sub-uplevel + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Apparently run a function in a higher stack frame + URL:=http://search.cpan.org/dist/Sub-Uplevel/ + DEPENDS:=perl +perlbase-essential +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-sub-uplevel/install + $(call perlmod/Install,$(1),Sub auto/Sub) +endef + + +$(eval $(call BuildPackage,perl-sub-uplevel)) diff --git a/lang/perl-test-harness/Makefile b/lang/perl-test-harness/Makefile new file mode 100644 index 0000000..0c14e85 --- /dev/null +++ b/lang/perl-test-harness/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2014 - 2016 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:=perl-test-harness +PKG_VERSION:=3.36 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/L/LE/LEONT/ +PKG_SOURCE:=Test-Harness-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=4c8d9c77e8e06ca96c7383c05c8f3616 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Test-Harness-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-test-harness + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Perl Test Harness + URL:=http://search.cpan.org/dist/Test-Harness/ + DEPENDS:=perl +perlbase-base +perlbase-benchmark +perlbase-config +perlbase-essential +perlbase-file +perlbase-getopt +perlbase-io +perlbase-posix +perlbase-text +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-test-harness/install + $(call perlmod/Install,$(1),App auto/Test TAP Test) +endef + + +$(eval $(call BuildPackage,perl-test-harness)) diff --git a/lang/perl-test-warn/Makefile b/lang/perl-test-warn/Makefile new file mode 100644 index 0000000..995e1ba --- /dev/null +++ b/lang/perl-test-warn/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=perl-test-warn +PKG_VERSION:=0.30 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/C/CH/CHORNY +PKG_SOURCE:=Test-Warn-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=8306b998a96d2cc69266b5248d550472 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Test-Warn-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-test-warn + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Perl extension to test methods for warnings + URL:=http://search.cpan.org/dist/Test-Warn/ + DEPENDS:=perl +perl-sub-uplevel +perlbase-essential +perlbase-test +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-test-warn/install + $(call perlmod/Install,$(1),Test auto/Test) +endef + + +$(eval $(call BuildPackage,perl-test-warn)) diff --git a/lang/perl-uri/Makefile b/lang/perl-uri/Makefile new file mode 100644 index 0000000..18667fc --- /dev/null +++ b/lang/perl-uri/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 - 2016 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:=perl-uri +PKG_VERSION:=1.71 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/E/ET/ETHER/ +PKG_SOURCE:=URI-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=247c3da29a794f72730e01aa5a715daf + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/URI-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-uri + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Manipulates and accesses URI strings + URL:=http://search.cpan.org/dist/URI/ + DEPENDS:=perl +perlbase-essential +perlbase-integer +perlbase-mime +perlbase-scalar +perlbase-utf8 +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-uri/install + $(call perlmod/Install,$(1),URI URI.pm) +endef + + +$(eval $(call BuildPackage,perl-uri)) diff --git a/lang/perl-www-mechanize/Makefile b/lang/perl-www-mechanize/Makefile new file mode 100644 index 0000000..93d6be2 --- /dev/null +++ b/lang/perl-www-mechanize/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2010-2015 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:=perl-www-mechanize +PKG_VERSION:=1.75 +PKG_RELEASE:=1 + +PKG_SOURCE:=WWW-Mechanize-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/E/ET/ETHER/ +PKG_MD5SUM:=9a4b9c8827f519908ef0a0d2b8ae96fa + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/WWW-Mechanize-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-www-mechanize + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Perl WWW Mechanize + URL:=http://search.cpan.org/dist/WWW-Mechanize/ + DEPENDS:=perl +perl-cgi +perl-html-form +perl-html-parser +perl-html-tree +perl-http-daemon +perl-http-message +perl-http-server-simple +perl-test-warn +perl-uri +perl-www +perlbase-base +perlbase-essential +perlbase-file +perlbase-findbin +perlbase-getopt +perlbase-pod +perlbase-test +endef + +define Build/Configure + $(call perlmod/Configure,$(STAGING_DIR)/usr/include,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-www-mechanize/install + $(call perlmod/Install,$(1),WWW/Mechanize WWW/Mechanize.pm) +endef + + +$(eval $(call BuildPackage,perl-www-mechanize)) diff --git a/lang/perl-www-robotrules/Makefile b/lang/perl-www-robotrules/Makefile new file mode 100644 index 0000000..c28b8c2 --- /dev/null +++ b/lang/perl-www-robotrules/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=perl-www-robotrules +PKG_VERSION:=6.02 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=WWW-RobotRules-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=b7186e8b8b3701e70c22abf430742403 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/WWW-RobotRules-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-www-robotrules + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=database of robots.txt-derived permissions + URL:=http://search.cpan.org/dist/WWW-RobotRules/ + DEPENDS:=perl +perl-uri +perlbase-anydbm-file +perlbase-essential +perlbase-fcntl +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-www-robotrules/install + $(call perlmod/Install,$(1),WWW auto/WWW) +endef + + +$(eval $(call BuildPackage,perl-www-robotrules)) diff --git a/lang/perl-www/Makefile b/lang/perl-www/Makefile new file mode 100644 index 0000000..86bf15b --- /dev/null +++ b/lang/perl-www/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2013-2015 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:=perl-www +PKG_VERSION:=6.15 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/E/ET/ETHER/ +PKG_SOURCE:=libwww-perl-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=6888c9d8728cd6f3ea3c9754461c9f94 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/libwww-perl-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-www + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=WWW client/server library for Perl (aka LWP) + URL:=http://search.cpan.org/dist/libwww-perl/ + DEPENDS:=perl +perl-encode-locale +perl-file-listing +perl-html-parser +perl-http-cookies +perl-http-daemon +perl-http-date +perl-http-message +perl-http-negotiate +perl-lwp-mediatypes +perl-net-http +perl-uri +perl-www-robotrules +perlbase-base +perlbase-digest +perlbase-encode +perlbase-essential +perlbase-io +perlbase-mime +perlbase-net +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-www/install + $(call perlmod/Install,$(1),LWP.pm auto/LWP LWP) +endef + + +$(eval $(call BuildPackage,perl-www)) diff --git a/lang/perl-xml-parser/Makefile b/lang/perl-xml-parser/Makefile new file mode 100644 index 0000000..e5d3b2c --- /dev/null +++ b/lang/perl-xml-parser/Makefile @@ -0,0 +1,86 @@ +# +# Copyright (C) 2015 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:=perl-xml-parser +PKG_VERSION:=2.44 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/T/TO/TODDR/ +PKG_SOURCE:=XML-Parser-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=af4813fe3952362451201ced6fbce379 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/XML-Parser-$(PKG_VERSION) +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/perl/XML-Parser-$(PKG_VERSION) + +HOST_BUILD_DEPENDS:=perl/host expat/host + +EXPAT_LIBPATH:=$(STAGING_DIR)/usr/lib +EXPAT_INCPATH=$(STAGING_DIR)/usr/include +HOST_EXPAT_LIBPATH:=$(STAGING_DIR)/host/lib +HOST_EXPAT_INCPATH=$(STAGING_DIR)/host/include + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk +include ../perl/perlmod.mk + +define Package/perl-xml-parser + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Perl XML Parser + URL:=http://search.cpan.org/dist/XML-Parser/ + DEPENDS:=perl +libexpat +perlbase-dynaloader +perlbase-essential +endef + +define FixupExpat + # Manually reconfigure XML::Parser::Expat, as some overrides we provide will not have any effect otherwise + # Force usage of OpenWRT's expat + sed \ + -e 's!%%EXPAT_LIBPATH%%!$(2)!g' \ + -e 's!%%EXPAT_INCPATH%%!$(3)!g' \ + -i $(1)/Expat/Makefile.PL +endef + +define Build/Configure + $(call perlmod/Configure,EXPATLIBPATH=$(EXPAT_LIBPATH) EXPATINCPATH=$(EXPAT_INCPATH),,) + + $(call FixupExpat,$(PKG_BUILD_DIR),$(EXPAT_LIBPATH),$(EXPAT_INCPATH)) + $(call perlmod/Configure,,,$(PKG_BUILD_DIR)/Expat) +endef + +define Build/Compile + $(call perlmod/Compile,,) + $(call perlmod/Compile,,,$(PKG_BUILD_DIR)/Expat) +endef + +define Host/Configure + $(call perlmod/host/Configure,EXPATLIBPATH=$(HOST_EXPAT_LIBPATH) EXPATINCPATH=$(HOST_EXPAT_INCPATH),,) + $(call FixupExpat,$(HOST_BUILD_DIR),$(HOST_EXPAT_LIBPATH),$(HOST_EXPAT_INCPATH)) + $(call perlmod/host/Configure,,,$(HOST_BUILD_DIR)/Expat) +endef + +define Host/Compile + $(call perlmod/host/Compile,,) + $(call perlmod/host/Compile,,,$(HOST_BUILD_DIR)/Expat) +endef + +define Host/Install + $(call perlmod/host/Install,$(1),) +endef + +define Package/perl-xml-parser/install + $(call perlmod/Install,$(1),auto/XML XML) +endef + + +$(eval $(call BuildPackage,perl-xml-parser)) +$(eval $(call HostBuild)) diff --git a/lang/perl-xml-parser/patches/010-xml-parser-expat-use-ppport.h b/lang/perl-xml-parser/patches/010-xml-parser-expat-use-ppport.h new file mode 100644 index 0000000..e2aad83 --- /dev/null +++ b/lang/perl-xml-parser/patches/010-xml-parser-expat-use-ppport.h @@ -0,0 +1,7476 @@ +--- a/Expat/Expat.xs ++++ b/Expat/Expat.xs +@@ -20,17 +20,7 @@ + #include "patchlevel.h" + #include "encoding.h" + +- +-/* Version 5.005_5x (Development version for 5.006) doesn't like sv_... +- anymore, but 5.004 doesn't know about PL_sv.. +- Don't want to push up required version just for this. */ +- +-#if PATCHLEVEL < 5 +-#define PL_sv_undef sv_undef +-#define PL_sv_no sv_no +-#define PL_sv_yes sv_yes +-#define PL_na na +-#endif ++#include "ppport.h" + + #define BUFSIZE 32768 + +--- /dev/null ++++ b/Expat/ppport.h +@@ -0,0 +1,7452 @@ ++#if 0 ++<<'SKIP'; ++#endif ++/* ++---------------------------------------------------------------------- ++ ++ ppport.h -- Perl/Pollution/Portability Version 3.21 ++ ++ Automatically created by Devel::PPPort running under perl 5.020002. ++ ++ Do NOT edit this file directly! -- Edit PPPort_pm.PL and the ++ includes in parts/inc/ instead. ++ ++ Use 'perldoc ppport.h' to view the documentation below. ++ ++---------------------------------------------------------------------- ++ ++SKIP ++ ++=pod ++ ++=head1 NAME ++ ++ppport.h - Perl/Pollution/Portability version 3.21 ++ ++=head1 SYNOPSIS ++ ++ perl ppport.h [options] [source files] ++ ++ Searches current directory for files if no [source files] are given ++ ++ --help show short help ++ ++ --version show version ++ ++ --patch=file write one patch file with changes ++ --copy=suffix write changed copies with suffix ++ --diff=program use diff program and options ++ ++ --compat-version=version provide compatibility with Perl version ++ --cplusplus accept C++ comments ++ ++ --quiet don't output anything except fatal errors ++ --nodiag don't show diagnostics ++ --nohints don't show hints ++ --nochanges don't suggest changes ++ --nofilter don't filter input files ++ ++ --strip strip all script and doc functionality from ++ ppport.h ++ ++ --list-provided list provided API ++ --list-unsupported list unsupported API ++ --api-info=name show Perl API portability information ++ ++=head1 COMPATIBILITY ++ ++This version of F is designed to support operation with Perl ++installations back to 5.003, and has been tested up to 5.11.5. ++ ++=head1 OPTIONS ++ ++=head2 --help ++ ++Display a brief usage summary. ++ ++=head2 --version ++ ++Display the version of F. ++ ++=head2 --patch=I ++ ++If this option is given, a single patch file will be created if ++any changes are suggested. This requires a working diff program ++to be installed on your system. ++ ++=head2 --copy=I ++ ++If this option is given, a copy of each file will be saved with ++the given suffix that contains the suggested changes. This does ++not require any external programs. Note that this does not ++automagially add a dot between the original filename and the ++suffix. If you want the dot, you have to include it in the option ++argument. ++ ++If neither C<--patch> or C<--copy> are given, the default is to ++simply print the diffs for each file. This requires either ++C or a C program to be installed. ++ ++=head2 --diff=I ++ ++Manually set the diff program and options to use. The default ++is to use C, when installed, and output unified ++context diffs. ++ ++=head2 --compat-version=I ++ ++Tell F to check for compatibility with the given ++Perl version. The default is to check for compatibility with Perl ++version 5.003. You can use this option to reduce the output ++of F if you intend to be backward compatible only ++down to a certain Perl version. ++ ++=head2 --cplusplus ++ ++Usually, F will detect C++ style comments and ++replace them with C style comments for portability reasons. ++Using this option instructs F to leave C++ ++comments untouched. ++ ++=head2 --quiet ++ ++Be quiet. Don't print anything except fatal errors. ++ ++=head2 --nodiag ++ ++Don't output any diagnostic messages. Only portability ++alerts will be printed. ++ ++=head2 --nohints ++ ++Don't output any hints. Hints often contain useful portability ++notes. Warnings will still be displayed. ++ ++=head2 --nochanges ++ ++Don't suggest any changes. Only give diagnostic output and hints ++unless these are also deactivated. ++ ++=head2 --nofilter ++ ++Don't filter the list of input files. By default, files not looking ++like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped. ++ ++=head2 --strip ++ ++Strip all script and documentation functionality from F. ++This reduces the size of F dramatically and may be useful ++if you want to include F in smaller modules without ++increasing their distribution size too much. ++ ++The stripped F will have a C<--unstrip> option that allows ++you to undo the stripping, but only if an appropriate C ++module is installed. ++ ++=head2 --list-provided ++ ++Lists the API elements for which compatibility is provided by ++F. Also lists if it must be explicitly requested, ++if it has dependencies, and if there are hints or warnings for it. ++ ++=head2 --list-unsupported ++ ++Lists the API elements that are known not to be supported by ++F and below which version of Perl they probably ++won't be available or work. ++ ++=head2 --api-info=I ++ ++Show portability information for API elements matching I. ++If I is surrounded by slashes, it is interpreted as a regular ++expression. ++ ++=head1 DESCRIPTION ++ ++In order for a Perl extension (XS) module to be as portable as possible ++across differing versions of Perl itself, certain steps need to be taken. ++ ++=over 4 ++ ++=item * ++ ++Including this header is the first major one. This alone will give you ++access to a large part of the Perl API that hasn't been available in ++earlier Perl releases. Use ++ ++ perl ppport.h --list-provided ++ ++to see which API elements are provided by ppport.h. ++ ++=item * ++ ++You should avoid using deprecated parts of the API. For example, using ++global Perl variables without the C prefix is deprecated. Also, ++some API functions used to have a C prefix. Using this form is ++also deprecated. You can safely use the supported API, as F ++will provide wrappers for older Perl versions. ++ ++=item * ++ ++If you use one of a few functions or variables that were not present in ++earlier versions of Perl, and that can't be provided using a macro, you ++have to explicitly request support for these functions by adding one or ++more C<#define>s in your source code before the inclusion of F. ++ ++These functions or variables will be marked C in the list shown ++by C<--list-provided>. ++ ++Depending on whether you module has a single or multiple files that ++use such functions or variables, you want either C or global ++variants. ++ ++For a C function or variable (used only in a single source ++file), use: ++ ++ #define NEED_function ++ #define NEED_variable ++ ++For a global function or variable (used in multiple source files), ++use: ++ ++ #define NEED_function_GLOBAL ++ #define NEED_variable_GLOBAL ++ ++Note that you mustn't have more than one global request for the ++same function or variable in your project. ++ ++ Function / Variable Static Request Global Request ++ ----------------------------------------------------------------------------------------- ++ PL_parser NEED_PL_parser NEED_PL_parser_GLOBAL ++ PL_signals NEED_PL_signals NEED_PL_signals_GLOBAL ++ eval_pv() NEED_eval_pv NEED_eval_pv_GLOBAL ++ grok_bin() NEED_grok_bin NEED_grok_bin_GLOBAL ++ grok_hex() NEED_grok_hex NEED_grok_hex_GLOBAL ++ grok_number() NEED_grok_number NEED_grok_number_GLOBAL ++ grok_numeric_radix() NEED_grok_numeric_radix NEED_grok_numeric_radix_GLOBAL ++ grok_oct() NEED_grok_oct NEED_grok_oct_GLOBAL ++ load_module() NEED_load_module NEED_load_module_GLOBAL ++ my_snprintf() NEED_my_snprintf NEED_my_snprintf_GLOBAL ++ my_sprintf() NEED_my_sprintf NEED_my_sprintf_GLOBAL ++ my_strlcat() NEED_my_strlcat NEED_my_strlcat_GLOBAL ++ my_strlcpy() NEED_my_strlcpy NEED_my_strlcpy_GLOBAL ++ newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL ++ newRV_noinc() NEED_newRV_noinc NEED_newRV_noinc_GLOBAL ++ newSV_type() NEED_newSV_type NEED_newSV_type_GLOBAL ++ newSVpvn_flags() NEED_newSVpvn_flags NEED_newSVpvn_flags_GLOBAL ++ newSVpvn_share() NEED_newSVpvn_share NEED_newSVpvn_share_GLOBAL ++ pv_display() NEED_pv_display NEED_pv_display_GLOBAL ++ pv_escape() NEED_pv_escape NEED_pv_escape_GLOBAL ++ pv_pretty() NEED_pv_pretty NEED_pv_pretty_GLOBAL ++ sv_2pv_flags() NEED_sv_2pv_flags NEED_sv_2pv_flags_GLOBAL ++ sv_2pvbyte() NEED_sv_2pvbyte NEED_sv_2pvbyte_GLOBAL ++ sv_catpvf_mg() NEED_sv_catpvf_mg NEED_sv_catpvf_mg_GLOBAL ++ sv_catpvf_mg_nocontext() NEED_sv_catpvf_mg_nocontext NEED_sv_catpvf_mg_nocontext_GLOBAL ++ sv_pvn_force_flags() NEED_sv_pvn_force_flags NEED_sv_pvn_force_flags_GLOBAL ++ sv_setpvf_mg() NEED_sv_setpvf_mg NEED_sv_setpvf_mg_GLOBAL ++ sv_setpvf_mg_nocontext() NEED_sv_setpvf_mg_nocontext NEED_sv_setpvf_mg_nocontext_GLOBAL ++ vload_module() NEED_vload_module NEED_vload_module_GLOBAL ++ vnewSVpvf() NEED_vnewSVpvf NEED_vnewSVpvf_GLOBAL ++ warner() NEED_warner NEED_warner_GLOBAL ++ ++To avoid namespace conflicts, you can change the namespace of the ++explicitly exported functions / variables using the C ++macro. Just C<#define> the macro before including C: ++ ++ #define DPPP_NAMESPACE MyOwnNamespace_ ++ #include "ppport.h" ++ ++The default namespace is C. ++ ++=back ++ ++The good thing is that most of the above can be checked by running ++F on your source code. See the next section for ++details. ++ ++=head1 EXAMPLES ++ ++To verify whether F is needed for your module, whether you ++should make any changes to your code, and whether any special defines ++should be used, F can be run as a Perl script to check your ++source code. Simply say: ++ ++ perl ppport.h ++ ++The result will usually be a list of patches suggesting changes ++that should at least be acceptable, if not necessarily the most ++efficient solution, or a fix for all possible problems. ++ ++If you know that your XS module uses features only available in ++newer Perl releases, if you're aware that it uses C++ comments, ++and if you want all suggestions as a single patch file, you could ++use something like this: ++ ++ perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff ++ ++If you only want your code to be scanned without any suggestions ++for changes, use: ++ ++ perl ppport.h --nochanges ++ ++You can specify a different C program or options, using ++the C<--diff> option: ++ ++ perl ppport.h --diff='diff -C 10' ++ ++This would output context diffs with 10 lines of context. ++ ++If you want to create patched copies of your files instead, use: ++ ++ perl ppport.h --copy=.new ++ ++To display portability information for the C function, ++use: ++ ++ perl ppport.h --api-info=newSVpvn ++ ++Since the argument to C<--api-info> can be a regular expression, ++you can use ++ ++ perl ppport.h --api-info=/_nomg$/ ++ ++to display portability information for all C<_nomg> functions or ++ ++ perl ppport.h --api-info=/./ ++ ++to display information for all known API elements. ++ ++=head1 BUGS ++ ++If this version of F is causing failure during ++the compilation of this module, please check if newer versions ++of either this module or C are available on CPAN ++before sending a bug report. ++ ++If F was generated using the latest version of ++C and is causing failure of this module, please ++file a bug report using the CPAN Request Tracker at L. ++ ++Please include the following information: ++ ++=over 4 ++ ++=item 1. ++ ++The complete output from running "perl -V" ++ ++=item 2. ++ ++This file. ++ ++=item 3. ++ ++The name and version of the module you were trying to build. ++ ++=item 4. ++ ++A full log of the build that failed. ++ ++=item 5. ++ ++Any other information that you think could be relevant. ++ ++=back ++ ++For the latest version of this code, please get the C ++module from CPAN. ++ ++=head1 COPYRIGHT ++ ++Version 3.x, Copyright (c) 2004-2013, Marcus Holland-Moritz. ++ ++Version 2.x, Copyright (C) 2001, Paul Marquess. ++ ++Version 1.x, Copyright (C) 1999, Kenneth Albanowski. ++ ++This program is free software; you can redistribute it and/or ++modify it under the same terms as Perl itself. ++ ++=head1 SEE ALSO ++ ++See L. ++ ++=cut ++ ++use strict; ++ ++# Disable broken TRIE-optimization ++BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if $] >= 5.009004 && $] <= 5.009005 } ++ ++my $VERSION = 3.21; ++ ++my %opt = ( ++ quiet => 0, ++ diag => 1, ++ hints => 1, ++ changes => 1, ++ cplusplus => 0, ++ filter => 1, ++ strip => 0, ++ version => 0, ++); ++ ++my($ppport) = $0 =~ /([\w.]+)$/; ++my $LF = '(?:\r\n|[\r\n])'; # line feed ++my $HS = "[ \t]"; # horizontal whitespace ++ ++# Never use C comments in this file! ++my $ccs = '/'.'*'; ++my $cce = '*'.'/'; ++my $rccs = quotemeta $ccs; ++my $rcce = quotemeta $cce; ++ ++eval { ++ require Getopt::Long; ++ Getopt::Long::GetOptions(\%opt, qw( ++ help quiet diag! filter! hints! changes! cplusplus strip version ++ patch=s copy=s diff=s compat-version=s ++ list-provided list-unsupported api-info=s ++ )) or usage(); ++}; ++ ++if ($@ and grep /^-/, @ARGV) { ++ usage() if "@ARGV" =~ /^--?h(?:elp)?$/; ++ die "Getopt::Long not found. Please don't use any options.\n"; ++} ++ ++if ($opt{version}) { ++ print "This is $0 $VERSION.\n"; ++ exit 0; ++} ++ ++usage() if $opt{help}; ++strip() if $opt{strip}; ++ ++if (exists $opt{'compat-version'}) { ++ my($r,$v,$s) = eval { parse_version($opt{'compat-version'}) }; ++ if ($@) { ++ die "Invalid version number format: '$opt{'compat-version'}'\n"; ++ } ++ die "Only Perl 5 is supported\n" if $r != 5; ++ die "Invalid version number: $opt{'compat-version'}\n" if $v >= 1000 || $s >= 1000; ++ $opt{'compat-version'} = sprintf "%d.%03d%03d", $r, $v, $s; ++} ++else { ++ $opt{'compat-version'} = 5; ++} ++ ++my %API = map { /^(\w+)\|([^|]*)\|([^|]*)\|(\w*)$/ ++ ? ( $1 => { ++ ($2 ? ( base => $2 ) : ()), ++ ($3 ? ( todo => $3 ) : ()), ++ (index($4, 'v') >= 0 ? ( varargs => 1 ) : ()), ++ (index($4, 'p') >= 0 ? ( provided => 1 ) : ()), ++ (index($4, 'n') >= 0 ? ( nothxarg => 1 ) : ()), ++ } ) ++ : die "invalid spec: $_" } qw( ++AvFILLp|5.004050||p ++AvFILL||| ++BhkDISABLE||5.019003| ++BhkENABLE||5.019003| ++BhkENTRY_set||5.019003| ++BhkENTRY||| ++BhkFLAGS||| ++CALL_BLOCK_HOOKS||| ++CLASS|||n ++CPERLscope|5.005000||p ++CX_CURPAD_SAVE||| ++CX_CURPAD_SV||| ++CopFILEAV|5.006000||p ++CopFILEGV_set|5.006000||p ++CopFILEGV|5.006000||p ++CopFILESV|5.006000||p ++CopFILE_set|5.006000||p ++CopFILE|5.006000||p ++CopSTASHPV_set|5.006000||p ++CopSTASHPV|5.006000||p ++CopSTASH_eq|5.006000||p ++CopSTASH_set|5.006000||p ++CopSTASH|5.006000||p ++CopyD|5.009002|5.004050|p ++Copy||5.004050| ++CvPADLIST||5.008001| ++CvSTASH||| ++CvWEAKOUTSIDE||| ++DEFSV_set|5.010001||p ++DEFSV|5.004050||p ++END_EXTERN_C|5.005000||p ++ENTER||| ++ERRSV|5.004050||p ++EXTEND||| ++EXTERN_C|5.005000||p ++F0convert|||n ++FREETMPS||| ++GIMME_V||5.004000|n ++GIMME|||n ++GROK_NUMERIC_RADIX|5.007002||p ++G_ARRAY||| ++G_DISCARD||| ++G_EVAL||| ++G_METHOD|5.006001||p ++G_NOARGS||| ++G_SCALAR||| ++G_VOID||5.004000| ++GetVars||| ++GvAV||| ++GvCV||| ++GvHV||| ++GvSVn|5.009003||p ++GvSV||| ++Gv_AMupdate||5.011000| ++HEf_SVKEY||5.004000| ++HeHASH||5.004000| ++HeKEY||5.004000| ++HeKLEN||5.004000| ++HePV||5.004000| ++HeSVKEY_force||5.004000| ++HeSVKEY_set||5.004000| ++HeSVKEY||5.004000| ++HeUTF8||5.010001| ++HeVAL||5.004000| ++HvENAMELEN||5.015004| ++HvENAMEUTF8||5.015004| ++HvENAME||5.013007| ++HvNAMELEN_get|5.009003||p ++HvNAMELEN||5.015004| ++HvNAMEUTF8||5.015004| ++HvNAME_get|5.009003||p ++HvNAME||| ++INT2PTR|5.006000||p ++IN_LOCALE_COMPILETIME|5.007002||p ++IN_LOCALE_RUNTIME|5.007002||p ++IN_LOCALE|5.007002||p ++IN_PERL_COMPILETIME|5.008001||p ++IS_NUMBER_GREATER_THAN_UV_MAX|5.007002||p ++IS_NUMBER_INFINITY|5.007002||p ++IS_NUMBER_IN_UV|5.007002||p ++IS_NUMBER_NAN|5.007003||p ++IS_NUMBER_NEG|5.007002||p ++IS_NUMBER_NOT_INT|5.007002||p ++IVSIZE|5.006000||p ++IVTYPE|5.006000||p ++IVdf|5.006000||p ++LEAVE||| ++LINKLIST||5.013006| ++LVRET||| ++MARK||| ++MULTICALL||5.019003| ++MY_CXT_CLONE|5.009002||p ++MY_CXT_INIT|5.007003||p ++MY_CXT|5.007003||p ++MoveD|5.009002|5.004050|p ++Move||5.004050| ++NOOP|5.005000||p ++NUM2PTR|5.006000||p ++NVTYPE|5.006000||p ++NVef|5.006001||p ++NVff|5.006001||p ++NVgf|5.006001||p ++Newxc|5.009003||p ++Newxz|5.009003||p ++Newx|5.009003||p ++Nullav||| ++Nullch||| ++Nullcv||| ++Nullhv||| ++Nullsv||| ++OP_CLASS||5.013007| ++OP_DESC||5.007003| ++OP_NAME||5.007003| ++ORIGMARK||| ++PAD_BASE_SV||| ++PAD_CLONE_VARS||| ++PAD_COMPNAME_FLAGS||| ++PAD_COMPNAME_GEN_set||| ++PAD_COMPNAME_GEN||| ++PAD_COMPNAME_OURSTASH||| ++PAD_COMPNAME_PV||| ++PAD_COMPNAME_TYPE||| ++PAD_RESTORE_LOCAL||| ++PAD_SAVE_LOCAL||| ++PAD_SAVE_SETNULLPAD||| ++PAD_SETSV||| ++PAD_SET_CUR_NOSAVE||| ++PAD_SET_CUR||| ++PAD_SVl||| ++PAD_SV||| ++PERLIO_FUNCS_CAST|5.009003||p ++PERLIO_FUNCS_DECL|5.009003||p ++PERL_ABS|5.008001||p ++PERL_BCDVERSION|5.019002||p ++PERL_GCC_BRACE_GROUPS_FORBIDDEN|5.008001||p ++PERL_HASH|5.004000||p ++PERL_INT_MAX|5.004000||p ++PERL_INT_MIN|5.004000||p ++PERL_LONG_MAX|5.004000||p ++PERL_LONG_MIN|5.004000||p ++PERL_MAGIC_arylen|5.007002||p ++PERL_MAGIC_backref|5.007002||p ++PERL_MAGIC_bm|5.007002||p ++PERL_MAGIC_collxfrm|5.007002||p ++PERL_MAGIC_dbfile|5.007002||p ++PERL_MAGIC_dbline|5.007002||p ++PERL_MAGIC_defelem|5.007002||p ++PERL_MAGIC_envelem|5.007002||p ++PERL_MAGIC_env|5.007002||p ++PERL_MAGIC_ext|5.007002||p ++PERL_MAGIC_fm|5.007002||p ++PERL_MAGIC_glob|5.019002||p ++PERL_MAGIC_isaelem|5.007002||p ++PERL_MAGIC_isa|5.007002||p ++PERL_MAGIC_mutex|5.019002||p ++PERL_MAGIC_nkeys|5.007002||p ++PERL_MAGIC_overload_elem|5.019002||p ++PERL_MAGIC_overload_table|5.007002||p ++PERL_MAGIC_overload|5.019002||p ++PERL_MAGIC_pos|5.007002||p ++PERL_MAGIC_qr|5.007002||p ++PERL_MAGIC_regdata|5.007002||p ++PERL_MAGIC_regdatum|5.007002||p ++PERL_MAGIC_regex_global|5.007002||p ++PERL_MAGIC_shared_scalar|5.007003||p ++PERL_MAGIC_shared|5.007003||p ++PERL_MAGIC_sigelem|5.007002||p ++PERL_MAGIC_sig|5.007002||p ++PERL_MAGIC_substr|5.007002||p ++PERL_MAGIC_sv|5.007002||p ++PERL_MAGIC_taint|5.007002||p ++PERL_MAGIC_tiedelem|5.007002||p ++PERL_MAGIC_tiedscalar|5.007002||p ++PERL_MAGIC_tied|5.007002||p ++PERL_MAGIC_utf8|5.008001||p ++PERL_MAGIC_uvar_elem|5.007003||p ++PERL_MAGIC_uvar|5.007002||p ++PERL_MAGIC_vec|5.007002||p ++PERL_MAGIC_vstring|5.008001||p ++PERL_PV_ESCAPE_ALL|5.009004||p ++PERL_PV_ESCAPE_FIRSTCHAR|5.009004||p ++PERL_PV_ESCAPE_NOBACKSLASH|5.009004||p ++PERL_PV_ESCAPE_NOCLEAR|5.009004||p ++PERL_PV_ESCAPE_QUOTE|5.009004||p ++PERL_PV_ESCAPE_RE|5.009005||p ++PERL_PV_ESCAPE_UNI_DETECT|5.009004||p ++PERL_PV_ESCAPE_UNI|5.009004||p ++PERL_PV_PRETTY_DUMP|5.009004||p ++PERL_PV_PRETTY_ELLIPSES|5.010000||p ++PERL_PV_PRETTY_LTGT|5.009004||p ++PERL_PV_PRETTY_NOCLEAR|5.010000||p ++PERL_PV_PRETTY_QUOTE|5.009004||p ++PERL_PV_PRETTY_REGPROP|5.009004||p ++PERL_QUAD_MAX|5.004000||p ++PERL_QUAD_MIN|5.004000||p ++PERL_REVISION|5.006000||p ++PERL_SCAN_ALLOW_UNDERSCORES|5.007003||p ++PERL_SCAN_DISALLOW_PREFIX|5.007003||p ++PERL_SCAN_GREATER_THAN_UV_MAX|5.007003||p ++PERL_SCAN_SILENT_ILLDIGIT|5.008001||p ++PERL_SHORT_MAX|5.004000||p ++PERL_SHORT_MIN|5.004000||p ++PERL_SIGNALS_UNSAFE_FLAG|5.008001||p ++PERL_SUBVERSION|5.006000||p ++PERL_SYS_INIT3||5.010000| ++PERL_SYS_INIT||5.010000| ++PERL_SYS_TERM||5.019003| ++PERL_UCHAR_MAX|5.004000||p ++PERL_UCHAR_MIN|5.004000||p ++PERL_UINT_MAX|5.004000||p ++PERL_UINT_MIN|5.004000||p ++PERL_ULONG_MAX|5.004000||p ++PERL_ULONG_MIN|5.004000||p ++PERL_UNUSED_ARG|5.009003||p ++PERL_UNUSED_CONTEXT|5.009004||p ++PERL_UNUSED_DECL|5.007002||p ++PERL_UNUSED_VAR|5.007002||p ++PERL_UQUAD_MAX|5.004000||p ++PERL_UQUAD_MIN|5.004000||p ++PERL_USE_GCC_BRACE_GROUPS|5.009004||p ++PERL_USHORT_MAX|5.004000||p ++PERL_USHORT_MIN|5.004000||p ++PERL_VERSION|5.006000||p ++PL_DBsignal|5.005000||p ++PL_DBsingle|||pn ++PL_DBsub|||pn ++PL_DBtrace|||pn ++PL_Sv|5.005000||p ++PL_bufend|5.019002||p ++PL_bufptr|5.019002||p ++PL_check||5.006000| ++PL_compiling|5.004050||p ++PL_comppad_name||5.017004| ++PL_comppad||5.008001| ++PL_copline|5.019002||p ++PL_curcop|5.004050||p ++PL_curpad||5.005000| ++PL_curstash|5.004050||p ++PL_debstash|5.004050||p ++PL_defgv|5.004050||p ++PL_diehook|5.004050||p ++PL_dirty|5.004050||p ++PL_dowarn|||pn ++PL_errgv|5.004050||p ++PL_error_count|5.019002||p ++PL_expect|5.019002||p ++PL_hexdigit|5.005000||p ++PL_hints|5.005000||p ++PL_in_my_stash|5.019002||p ++PL_in_my|5.019002||p ++PL_keyword_plugin||5.011002| ++PL_last_in_gv|||n ++PL_laststatval|5.005000||p ++PL_lex_state|5.019002||p ++PL_lex_stuff|5.019002||p ++PL_linestr|5.019002||p ++PL_modglobal||5.005000|n ++PL_na|5.004050||pn ++PL_no_modify|5.006000||p ++PL_ofsgv|||n ++PL_opfreehook||5.011000|n ++PL_parser|5.009005|5.009005|p ++PL_peepp||5.007003|n ++PL_perl_destruct_level|5.004050||p ++PL_perldb|5.004050||p ++PL_ppaddr|5.006000||p ++PL_rpeepp||5.013005|n ++PL_rsfp_filters|5.019002||p ++PL_rsfp|5.019002||p ++PL_rs|||n ++PL_signals|5.008001||p ++PL_stack_base|5.004050||p ++PL_stack_sp|5.004050||p ++PL_statcache|5.005000||p ++PL_stdingv|5.004050||p ++PL_sv_arenaroot|5.004050||p ++PL_sv_no|5.004050||pn ++PL_sv_undef|5.004050||pn ++PL_sv_yes|5.004050||pn ++PL_tainted|5.004050||p ++PL_tainting|5.004050||p ++PL_tokenbuf|5.019002||p ++POP_MULTICALL||5.019003| ++POPi|||n ++POPl|||n ++POPn|||n ++POPpbytex||5.007001|n ++POPpx||5.005030|n ++POPp|||n ++POPs|||n ++PTR2IV|5.006000||p ++PTR2NV|5.006000||p ++PTR2UV|5.006000||p ++PTR2nat|5.009003||p ++PTR2ul|5.007001||p ++PTRV|5.006000||p ++PUSHMARK||| ++PUSH_MULTICALL||5.019003| ++PUSHi||| ++PUSHmortal|5.009002||p ++PUSHn||| ++PUSHp||| ++PUSHs||| ++PUSHu|5.004000||p ++PUTBACK||| ++PadARRAY||5.019003| ++PadMAX||5.019003| ++PadlistARRAY||5.019003| ++PadlistMAX||5.019003| ++PadlistNAMESARRAY||5.019003| ++PadlistNAMESMAX||5.019003| ++PadlistNAMES||5.019003| ++PadlistREFCNT||5.017004| ++PadnameIsOUR||| ++PadnameIsSTATE||| ++PadnameLEN||5.019003| ++PadnameOURSTASH||| ++PadnameOUTER||| ++PadnamePV||5.019003| ++PadnameSV||5.019003| ++PadnameTYPE||| ++PadnameUTF8||5.019003| ++PadnamelistARRAY||5.019003| ++PadnamelistMAX||5.019003| ++PerlIO_clearerr||5.007003| ++PerlIO_close||5.007003| ++PerlIO_context_layers||5.009004| ++PerlIO_eof||5.007003| ++PerlIO_error||5.007003| ++PerlIO_fileno||5.007003| ++PerlIO_fill||5.007003| ++PerlIO_flush||5.007003| ++PerlIO_get_base||5.007003| ++PerlIO_get_bufsiz||5.007003| ++PerlIO_get_cnt||5.007003| ++PerlIO_get_ptr||5.007003| ++PerlIO_read||5.007003| ++PerlIO_seek||5.007003| ++PerlIO_set_cnt||5.007003| ++PerlIO_set_ptrcnt||5.007003| ++PerlIO_setlinebuf||5.007003| ++PerlIO_stderr||5.007003| ++PerlIO_stdin||5.007003| ++PerlIO_stdout||5.007003| ++PerlIO_tell||5.007003| ++PerlIO_unread||5.007003| ++PerlIO_write||5.007003| ++Perl_signbit||5.009005|n ++PoisonFree|5.009004||p ++PoisonNew|5.009004||p ++PoisonWith|5.009004||p ++Poison|5.008000||p ++READ_XDIGIT||5.017006| ++RETVAL|||n ++Renewc||| ++Renew||| ++SAVECLEARSV||| ++SAVECOMPPAD||| ++SAVEPADSV||| ++SAVETMPS||| ++SAVE_DEFSV|5.004050||p ++SPAGAIN||| ++SP||| ++START_EXTERN_C|5.005000||p ++START_MY_CXT|5.007003||p ++STMT_END|||p ++STMT_START|||p ++STR_WITH_LEN|5.009003||p ++ST||| ++SV_CONST_RETURN|5.009003||p ++SV_COW_DROP_PV|5.008001||p ++SV_COW_SHARED_HASH_KEYS|5.009005||p ++SV_GMAGIC|5.007002||p ++SV_HAS_TRAILING_NUL|5.009004||p ++SV_IMMEDIATE_UNREF|5.007001||p ++SV_MUTABLE_RETURN|5.009003||p ++SV_NOSTEAL|5.009002||p ++SV_SMAGIC|5.009003||p ++SV_UTF8_NO_ENCODING|5.008001||p ++SVfARG|5.009005||p ++SVf_UTF8|5.006000||p ++SVf|5.006000||p ++SVt_INVLIST||5.019002| ++SVt_IV||| ++SVt_NULL||| ++SVt_NV||| ++SVt_PVAV||| ++SVt_PVCV||| ++SVt_PVFM||| ++SVt_PVGV||| ++SVt_PVHV||| ++SVt_PVIO||| ++SVt_PVIV||| ++SVt_PVLV||| ++SVt_PVMG||| ++SVt_PVNV||| ++SVt_PV||| ++SVt_REGEXP||5.011000| ++Safefree||| ++Slab_Alloc||| ++Slab_Free||| ++Slab_to_ro||| ++Slab_to_rw||| ++StructCopy||| ++SvCUR_set||| ++SvCUR||| ++SvEND||| ++SvGAMAGIC||5.006001| ++SvGETMAGIC|5.004050||p ++SvGROW||| ++SvIOK_UV||5.006000| ++SvIOK_notUV||5.006000| ++SvIOK_off||| ++SvIOK_only_UV||5.006000| ++SvIOK_only||| ++SvIOK_on||| ++SvIOKp||| ++SvIOK||| ++SvIVX||| ++SvIV_nomg|5.009001||p ++SvIV_set||| ++SvIVx||| ++SvIV||| ++SvIsCOW_shared_hash||5.008003| ++SvIsCOW||5.008003| ++SvLEN_set||| ++SvLEN||| ++SvLOCK||5.007003| ++SvMAGIC_set|5.009003||p ++SvNIOK_off||| ++SvNIOKp||| ++SvNIOK||| ++SvNOK_off||| ++SvNOK_only||| ++SvNOK_on||| ++SvNOKp||| ++SvNOK||| ++SvNVX||| ++SvNV_nomg||5.013002| ++SvNV_set||| ++SvNVx||| ++SvNV||| ++SvOK||| ++SvOOK_offset||5.011000| ++SvOOK||| ++SvPOK_off||| ++SvPOK_only_UTF8||5.006000| ++SvPOK_only||| ++SvPOK_on||| ++SvPOKp||| ++SvPOK||| ++SvPVX_const|5.009003||p ++SvPVX_mutable|5.009003||p ++SvPVX||| ++SvPV_const|5.009003||p ++SvPV_flags_const_nolen|5.009003||p ++SvPV_flags_const|5.009003||p ++SvPV_flags_mutable|5.009003||p ++SvPV_flags|5.007002||p ++SvPV_force_flags_mutable|5.009003||p ++SvPV_force_flags_nolen|5.009003||p ++SvPV_force_flags|5.007002||p ++SvPV_force_mutable|5.009003||p ++SvPV_force_nolen|5.009003||p ++SvPV_force_nomg_nolen|5.009003||p ++SvPV_force_nomg|5.007002||p ++SvPV_force|||p ++SvPV_mutable|5.009003||p ++SvPV_nolen_const|5.009003||p ++SvPV_nolen|5.006000||p ++SvPV_nomg_const_nolen|5.009003||p ++SvPV_nomg_const|5.009003||p ++SvPV_nomg_nolen|5.013007||p ++SvPV_nomg|5.007002||p ++SvPV_renew|5.009003||p ++SvPV_set||| ++SvPVbyte_force||5.009002| ++SvPVbyte_nolen||5.006000| ++SvPVbytex_force||5.006000| ++SvPVbytex||5.006000| ++SvPVbyte|5.006000||p ++SvPVutf8_force||5.006000| ++SvPVutf8_nolen||5.006000| ++SvPVutf8x_force||5.006000| ++SvPVutf8x||5.006000| ++SvPVutf8||5.006000| ++SvPVx||| ++SvPV||| ++SvREFCNT_dec_NN||5.017007| ++SvREFCNT_dec||| ++SvREFCNT_inc_NN|5.009004||p ++SvREFCNT_inc_simple_NN|5.009004||p ++SvREFCNT_inc_simple_void_NN|5.009004||p ++SvREFCNT_inc_simple_void|5.009004||p ++SvREFCNT_inc_simple|5.009004||p ++SvREFCNT_inc_void_NN|5.009004||p ++SvREFCNT_inc_void|5.009004||p ++SvREFCNT_inc|||p ++SvREFCNT||| ++SvROK_off||| ++SvROK_on||| ++SvROK||| ++SvRV_set|5.009003||p ++SvRV||| ++SvRXOK||5.009005| ++SvRX||5.009005| ++SvSETMAGIC||| ++SvSHARED_HASH|5.009003||p ++SvSHARE||5.007003| ++SvSTASH_set|5.009003||p ++SvSTASH||| ++SvSetMagicSV_nosteal||5.004000| ++SvSetMagicSV||5.004000| ++SvSetSV_nosteal||5.004000| ++SvSetSV||| ++SvTAINTED_off||5.004000| ++SvTAINTED_on||5.004000| ++SvTAINTED||5.004000| ++SvTAINT||| ++SvTHINKFIRST||| ++SvTRUE_nomg||5.013006| ++SvTRUE||| ++SvTYPE||| ++SvUNLOCK||5.007003| ++SvUOK|5.007001|5.006000|p ++SvUPGRADE||| ++SvUTF8_off||5.006000| ++SvUTF8_on||5.006000| ++SvUTF8||5.006000| ++SvUVXx|5.004000||p ++SvUVX|5.004000||p ++SvUV_nomg|5.009001||p ++SvUV_set|5.009003||p ++SvUVx|5.004000||p ++SvUV|5.004000||p ++SvVOK||5.008001| ++SvVSTRING_mg|5.009004||p ++THIS|||n ++UNDERBAR|5.009002||p ++UTF8_MAXBYTES|5.009002||p ++UVSIZE|5.006000||p ++UVTYPE|5.006000||p ++UVXf|5.007001||p ++UVof|5.006000||p ++UVuf|5.006000||p ++UVxf|5.006000||p ++WARN_ALL|5.006000||p ++WARN_AMBIGUOUS|5.006000||p ++WARN_ASSERTIONS|5.019002||p ++WARN_BAREWORD|5.006000||p ++WARN_CLOSED|5.006000||p ++WARN_CLOSURE|5.006000||p ++WARN_DEBUGGING|5.006000||p ++WARN_DEPRECATED|5.006000||p ++WARN_DIGIT|5.006000||p ++WARN_EXEC|5.006000||p ++WARN_EXITING|5.006000||p ++WARN_GLOB|5.006000||p ++WARN_INPLACE|5.006000||p ++WARN_INTERNAL|5.006000||p ++WARN_IO|5.006000||p ++WARN_LAYER|5.008000||p ++WARN_MALLOC|5.006000||p ++WARN_MISC|5.006000||p ++WARN_NEWLINE|5.006000||p ++WARN_NUMERIC|5.006000||p ++WARN_ONCE|5.006000||p ++WARN_OVERFLOW|5.006000||p ++WARN_PACK|5.006000||p ++WARN_PARENTHESIS|5.006000||p ++WARN_PIPE|5.006000||p ++WARN_PORTABLE|5.006000||p ++WARN_PRECEDENCE|5.006000||p ++WARN_PRINTF|5.006000||p ++WARN_PROTOTYPE|5.006000||p ++WARN_QW|5.006000||p ++WARN_RECURSION|5.006000||p ++WARN_REDEFINE|5.006000||p ++WARN_REGEXP|5.006000||p ++WARN_RESERVED|5.006000||p ++WARN_SEMICOLON|5.006000||p ++WARN_SEVERE|5.006000||p ++WARN_SIGNAL|5.006000||p ++WARN_SUBSTR|5.006000||p ++WARN_SYNTAX|5.006000||p ++WARN_TAINT|5.006000||p ++WARN_THREADS|5.008000||p ++WARN_UNINITIALIZED|5.006000||p ++WARN_UNOPENED|5.006000||p ++WARN_UNPACK|5.006000||p ++WARN_UNTIE|5.006000||p ++WARN_UTF8|5.006000||p ++WARN_VOID|5.006000||p ++WIDEST_UTYPE|5.015004||p ++XCPT_CATCH|5.009002||p ++XCPT_RETHROW|5.009002|5.007001|p ++XCPT_TRY_END|5.009002|5.004000|p ++XCPT_TRY_START|5.009002|5.004000|p ++XPUSHi||| ++XPUSHmortal|5.009002||p ++XPUSHn||| ++XPUSHp||| ++XPUSHs||| ++XPUSHu|5.004000||p ++XSPROTO|5.010000||p ++XSRETURN_EMPTY||| ++XSRETURN_IV||| ++XSRETURN_NO||| ++XSRETURN_NV||| ++XSRETURN_PV||| ++XSRETURN_UNDEF||| ++XSRETURN_UV|5.008001||p ++XSRETURN_YES||| ++XSRETURN|||p ++XST_mIV||| ++XST_mNO||| ++XST_mNV||| ++XST_mPV||| ++XST_mUNDEF||| ++XST_mUV|5.008001||p ++XST_mYES||| ++XS_APIVERSION_BOOTCHECK||5.013004| ++XS_EXTERNAL||5.019003| ++XS_INTERNAL||5.019003| ++XS_VERSION_BOOTCHECK||| ++XS_VERSION||| ++XSprePUSH|5.006000||p ++XS||| ++XopDISABLE||5.019003| ++XopENABLE||5.019003| ++XopENTRY_set||5.019003| ++XopENTRY||5.019003| ++XopFLAGS||5.013007| ++ZeroD|5.009002||p ++Zero||| ++_aMY_CXT|5.007003||p ++_add_range_to_invlist||| ++_append_range_to_invlist||| ++_core_swash_init||| ++_get_swash_invlist||| ++_invlist_array_init||| ++_invlist_contains_cp||| ++_invlist_contents||| ++_invlist_dump||| ++_invlist_intersection_maybe_complement_2nd||| ++_invlist_intersection||| ++_invlist_invert_prop||| ++_invlist_invert||| ++_invlist_len||| ++_invlist_populate_swatch||| ++_invlist_search||| ++_invlist_subtract||| ++_invlist_union_maybe_complement_2nd||| ++_invlist_union||| ++_is_uni_FOO||5.017008| ++_is_uni_perl_idcont||5.017008| ++_is_uni_perl_idstart||5.017007| ++_is_utf8_FOO||5.017008| ++_is_utf8_mark||5.017008| ++_is_utf8_perl_idcont||5.017008| ++_is_utf8_perl_idstart||5.017007| ++_new_invlist_C_array||| ++_new_invlist||| ++_pMY_CXT|5.007003||p ++_swash_inversion_hash||| ++_swash_to_invlist||| ++_to_fold_latin1||| ++_to_uni_fold_flags||5.013011| ++_to_upper_title_latin1||| ++_to_utf8_fold_flags||5.015006| ++_to_utf8_lower_flags||5.015006| ++_to_utf8_title_flags||5.015006| ++_to_utf8_upper_flags||5.015006| ++aMY_CXT_|5.007003||p ++aMY_CXT|5.007003||p ++aTHXR_|5.019002||p ++aTHXR|5.019002||p ++aTHX_|5.006000||p ++aTHX|5.006000||p ++aassign_common_vars||| ++add_cp_to_invlist||| ++add_data|||n ++add_utf16_textfilter||| ++addmad||| ++adjust_size_and_find_bucket|||n ++adjust_stack_on_leave||| ++alloc_maybe_populate_EXACT||| ++alloccopstash||| ++allocmy||| ++amagic_call||| ++amagic_cmp_locale||| ++amagic_cmp||| ++amagic_deref_call||5.013007| ++amagic_i_ncmp||| ++amagic_is_enabled||| ++amagic_ncmp||| ++anonymise_cv_maybe||| ++any_dup||| ++ao||| ++append_madprops||| ++apply_attrs_my||| ++apply_attrs_string||5.006001| ++apply_attrs||| ++apply||| ++assert_uft8_cache_coherent||| ++atfork_lock||5.007003|n ++atfork_unlock||5.007003|n ++av_arylen_p||5.009003| ++av_clear||| ++av_create_and_push||5.009005| ++av_create_and_unshift_one||5.009005| ++av_delete||5.006000| ++av_exists||5.006000| ++av_extend_guts||| ++av_extend||| ++av_fetch||| ++av_fill||| ++av_iter_p||5.011000| ++av_len||| ++av_make||| ++av_pop||| ++av_push||| ++av_reify||| ++av_shift||| ++av_store||| ++av_tindex||5.017009| ++av_top_index||5.017009| ++av_undef||| ++av_unshift||| ++ax|||n ++bad_type_gv||| ++bad_type_pv||| ++bind_match||| ++block_end||| ++block_gimme||5.004000| ++block_start||| ++blockhook_register||5.013003| ++boolSV|5.004000||p ++boot_core_PerlIO||| ++boot_core_UNIVERSAL||| ++boot_core_mro||| ++bytes_cmp_utf8||5.013007| ++bytes_from_utf8||5.007001| ++bytes_to_uni|||n ++bytes_to_utf8||5.006001| ++call_argv|5.006000||p ++call_atexit||5.006000| ++call_list||5.004000| ++call_method|5.006000||p ++call_pv|5.006000||p ++call_sv|5.006000||p ++caller_cx||5.013005| ++calloc||5.007002|n ++cando||| ++cast_i32||5.006000| ++cast_iv||5.006000| ++cast_ulong||5.006000| ++cast_uv||5.006000| ++check_locale_boundary_crossing||| ++check_type_and_open||| ++check_uni||| ++check_utf8_print||| ++checkcomma||| ++ckWARN|5.006000||p ++ck_entersub_args_core||| ++ck_entersub_args_list||5.013006| ++ck_entersub_args_proto_or_list||5.013006| ++ck_entersub_args_proto||5.013006| ++ck_warner_d||5.011001|v ++ck_warner||5.011001|v ++ckwarn_common||| ++ckwarn_d||5.009003| ++ckwarn||5.009003| ++cl_and|||n ++cl_anything|||n ++cl_init|||n ++cl_is_anything|||n ++cl_or|||n ++clear_placeholders||| ++clone_params_del|||n ++clone_params_new|||n ++closest_cop||| ++compute_EXACTish||| ++convert||| ++cop_fetch_label||5.015001| ++cop_free||| ++cop_hints_2hv||5.013007| ++cop_hints_fetch_pvn||5.013007| ++cop_hints_fetch_pvs||5.013007| ++cop_hints_fetch_pv||5.013007| ++cop_hints_fetch_sv||5.013007| ++cop_store_label||5.015001| ++cophh_2hv||5.013007| ++cophh_copy||5.013007| ++cophh_delete_pvn||5.013007| ++cophh_delete_pvs||5.013007| ++cophh_delete_pv||5.013007| ++cophh_delete_sv||5.013007| ++cophh_fetch_pvn||5.013007| ++cophh_fetch_pvs||5.013007| ++cophh_fetch_pv||5.013007| ++cophh_fetch_sv||5.013007| ++cophh_free||5.013007| ++cophh_new_empty||5.019003| ++cophh_store_pvn||5.013007| ++cophh_store_pvs||5.013007| ++cophh_store_pv||5.013007| ++cophh_store_sv||5.013007| ++core_prototype||| ++core_regclass_swash||| ++coresub_op||| ++could_it_be_a_POSIX_class||| ++cr_textfilter||| ++create_eval_scope||| ++croak_memory_wrap||5.019003|n ++croak_no_mem|||n ++croak_no_modify||5.013003|n ++croak_nocontext|||vn ++croak_popstack|||n ++croak_sv||5.013001| ++croak_xs_usage||5.010001|n ++croak|||v ++csighandler||5.009003|n ++curmad||| ++current_re_engine||| ++curse||| ++custom_op_desc||5.007003| ++custom_op_name||5.007003| ++custom_op_register||5.013007| ++custom_op_xop||5.013007| ++cv_ckproto_len_flags||| ++cv_clone_into||| ++cv_clone||| ++cv_const_sv_or_av||| ++cv_const_sv||5.004000| ++cv_dump||| ++cv_forget_slab||| ++cv_get_call_checker||5.013006| ++cv_set_call_checker||5.013006| ++cv_undef||| ++cvgv_set||| ++cvstash_set||| ++cx_dump||5.005000| ++cx_dup||| ++cxinc||| ++dAXMARK|5.009003||p ++dAX|5.007002||p ++dITEMS|5.007002||p ++dMARK||| ++dMULTICALL||5.009003| ++dMY_CXT_SV|5.007003||p ++dMY_CXT|5.007003||p ++dNOOP|5.006000||p ++dORIGMARK||| ++dSP||| ++dTHR|5.004050||p ++dTHXR|5.019002||p ++dTHXa|5.006000||p ++dTHXoa|5.006000||p ++dTHX|5.006000||p ++dUNDERBAR|5.009002||p ++dVAR|5.009003||p ++dXCPT|5.009002||p ++dXSARGS||| ++dXSI32||| ++dXSTARG|5.006000||p ++deb_curcv||| ++deb_nocontext|||vn ++deb_stack_all||| ++deb_stack_n||| ++debop||5.005000| ++debprofdump||5.005000| ++debprof||| ++debstackptrs||5.007003| ++debstack||5.007003| ++debug_start_match||| ++deb||5.007003|v ++defelem_target||| ++del_sv||| ++delete_eval_scope||| ++delimcpy||5.004000|n ++deprecate_commaless_var_list||| ++despatch_signals||5.007001| ++destroy_matcher||| ++die_nocontext|||vn ++die_sv||5.013001| ++die_unwind||| ++die|||v ++dirp_dup||| ++div128||| ++djSP||| ++do_aexec5||| ++do_aexec||| ++do_aspawn||| ++do_binmode||5.004050| ++do_chomp||| ++do_close||| ++do_delete_local||| ++do_dump_pad||| ++do_eof||| ++do_exec3||| ++do_execfree||| ++do_exec||| ++do_gv_dump||5.006000| ++do_gvgv_dump||5.006000| ++do_hv_dump||5.006000| ++do_ipcctl||| ++do_ipcget||| ++do_join||| ++do_magic_dump||5.006000| ++do_msgrcv||| ++do_msgsnd||| ++do_ncmp||| ++do_oddball||| ++do_op_dump||5.006000| ++do_op_xmldump||| ++do_open9||5.006000| ++do_openn||5.007001| ++do_open||5.004000| ++do_pmop_dump||5.006000| ++do_pmop_xmldump||| ++do_print||| ++do_readline||| ++do_seek||| ++do_semop||| ++do_shmio||| ++do_smartmatch||| ++do_spawn_nowait||| ++do_spawn||| ++do_sprintf||| ++do_sv_dump||5.006000| ++do_sysseek||| ++do_tell||| ++do_trans_complex_utf8||| ++do_trans_complex||| ++do_trans_count_utf8||| ++do_trans_count||| ++do_trans_simple_utf8||| ++do_trans_simple||| ++do_trans||| ++do_vecget||| ++do_vecset||| ++do_vop||| ++docatch||| ++doeval||| ++dofile||| ++dofindlabel||| ++doform||| ++doing_taint||5.008001|n ++dooneliner||| ++doopen_pm||| ++doparseform||| ++dopoptoeval||| ++dopoptogiven||| ++dopoptolabel||| ++dopoptoloop||| ++dopoptosub_at||| ++dopoptowhen||| ++doref||5.009003| ++dounwind||| ++dowantarray||| ++dump_all_perl||| ++dump_all||5.006000| ++dump_eval||5.006000| ++dump_exec_pos||| ++dump_fds||| ++dump_form||5.006000| ++dump_indent||5.006000|v ++dump_mstats||| ++dump_packsubs_perl||| ++dump_packsubs||5.006000| ++dump_sub_perl||| ++dump_sub||5.006000| ++dump_sv_child||| ++dump_trie_interim_list||| ++dump_trie_interim_table||| ++dump_trie||| ++dump_vindent||5.006000| ++dumpuntil||| ++dup_attrlist||| ++emulate_cop_io||| ++eval_pv|5.006000||p ++eval_sv|5.006000||p ++exec_failed||| ++expect_number||| ++fbm_compile||5.005000| ++fbm_instr||5.005000| ++feature_is_enabled||| ++filter_add||| ++filter_del||| ++filter_gets||| ++filter_read||| ++finalize_optree||| ++finalize_op||| ++find_and_forget_pmops||| ++find_array_subscript||| ++find_beginning||| ++find_byclass||| ++find_hash_subscript||| ++find_in_my_stash||| ++find_lexical_cv||| ++find_runcv_where||| ++find_runcv||5.008001| ++find_rundefsv2||| ++find_rundefsvoffset||5.009002| ++find_rundefsv||5.013002| ++find_script||| ++find_uninit_var||| ++first_symbol|||n ++foldEQ_latin1||5.013008|n ++foldEQ_locale||5.013002|n ++foldEQ_utf8_flags||5.013010| ++foldEQ_utf8||5.013002| ++foldEQ||5.013002|n ++fold_constants||| ++forbid_setid||| ++force_ident_maybe_lex||| ++force_ident||| ++force_list||| ++force_next||| ++force_strict_version||| ++force_version||| ++force_word||| ++forget_pmop||| ++form_nocontext|||vn ++form_short_octal_warning||| ++form||5.004000|v ++fp_dup||| ++fprintf_nocontext|||vn ++free_global_struct||| ++free_tied_hv_pool||| ++free_tmps||| ++gen_constant_list||| ++get_and_check_backslash_N_name||| ++get_aux_mg||| ++get_av|5.006000||p ++get_context||5.006000|n ++get_cvn_flags|5.009005||p ++get_cvs|5.011000||p ++get_cv|5.006000||p ++get_db_sub||| ++get_debug_opts||| ++get_hash_seed||| ++get_hv|5.006000||p ++get_invlist_iter_addr||| ++get_invlist_offset_addr||| ++get_invlist_previous_index_addr||| ++get_mstats||| ++get_no_modify||| ++get_num||| ++get_op_descs||5.005000| ++get_op_names||5.005000| ++get_opargs||| ++get_ppaddr||5.006000| ++get_re_arg||| ++get_sv|5.006000||p ++get_vtbl||5.005030| ++getcwd_sv||5.007002| ++getenv_len||| ++glob_2number||| ++glob_assign_glob||| ++glob_assign_ref||| ++gp_dup||| ++gp_free||| ++gp_ref||| ++grok_bin|5.007003||p ++grok_bslash_N||| ++grok_bslash_c||| ++grok_bslash_o||| ++grok_bslash_x||| ++grok_hex|5.007003||p ++grok_number|5.007002||p ++grok_numeric_radix|5.007002||p ++grok_oct|5.007003||p ++group_end||| ++gv_AVadd||| ++gv_HVadd||| ++gv_IOadd||| ++gv_SVadd||| ++gv_add_by_type||5.011000| ++gv_autoload4||5.004000| ++gv_autoload_pvn||5.015004| ++gv_autoload_pv||5.015004| ++gv_autoload_sv||5.015004| ++gv_check||| ++gv_const_sv||5.009003| ++gv_dump||5.006000| ++gv_efullname3||5.004000| ++gv_efullname4||5.006001| ++gv_efullname||| ++gv_ename||| ++gv_fetchfile_flags||5.009005| ++gv_fetchfile||| ++gv_fetchmeth_autoload||5.007003| ++gv_fetchmeth_pv_autoload||5.015004| ++gv_fetchmeth_pvn_autoload||5.015004| ++gv_fetchmeth_pvn||5.015004| ++gv_fetchmeth_pv||5.015004| ++gv_fetchmeth_sv_autoload||5.015004| ++gv_fetchmeth_sv||5.015004| ++gv_fetchmethod_autoload||5.004000| ++gv_fetchmethod_pv_flags||5.015004| ++gv_fetchmethod_pvn_flags||5.015004| ++gv_fetchmethod_sv_flags||5.015004| ++gv_fetchmethod||| ++gv_fetchmeth||| ++gv_fetchpvn_flags|5.009002||p ++gv_fetchpvs|5.009004||p ++gv_fetchpv||| ++gv_fetchsv|5.009002||p ++gv_fullname3||5.004000| ++gv_fullname4||5.006001| ++gv_fullname||| ++gv_handler||5.007001| ++gv_init_pvn||5.015004| ++gv_init_pv||5.015004| ++gv_init_svtype||| ++gv_init_sv||5.015004| ++gv_init||| ++gv_magicalize_isa||| ++gv_name_set||5.009004| ++gv_stashpvn|5.004000||p ++gv_stashpvs|5.009003||p ++gv_stashpv||| ++gv_stashsv||| ++gv_try_downgrade||| ++handle_regex_sets||| ++he_dup||| ++hek_dup||| ++hfree_next_entry||| ++hfreeentries||| ++hsplit||| ++hv_assert||| ++hv_auxinit||| ++hv_backreferences_p||| ++hv_clear_placeholders||5.009001| ++hv_clear||| ++hv_common_key_len||5.010000| ++hv_common||5.010000| ++hv_copy_hints_hv||5.009004| ++hv_delayfree_ent||5.004000| ++hv_delete_common||| ++hv_delete_ent||5.004000| ++hv_delete||| ++hv_eiter_p||5.009003| ++hv_eiter_set||5.009003| ++hv_ename_add||| ++hv_ename_delete||| ++hv_exists_ent||5.004000| ++hv_exists||| ++hv_fetch_ent||5.004000| ++hv_fetchs|5.009003||p ++hv_fetch||| ++hv_fill||5.013002| ++hv_free_ent_ret||| ++hv_free_ent||5.004000| ++hv_iterinit||| ++hv_iterkeysv||5.004000| ++hv_iterkey||| ++hv_iternext_flags||5.008000| ++hv_iternextsv||| ++hv_iternext||| ++hv_iterval||| ++hv_kill_backrefs||| ++hv_ksplit||5.004000| ++hv_magic_check|||n ++hv_magic||| ++hv_name_set||5.009003| ++hv_notallowed||| ++hv_placeholders_get||5.009003| ++hv_placeholders_p||| ++hv_placeholders_set||5.009003| ++hv_rand_set||5.017011| ++hv_riter_p||5.009003| ++hv_riter_set||5.009003| ++hv_scalar||5.009001| ++hv_store_ent||5.004000| ++hv_store_flags||5.008000| ++hv_stores|5.009004||p ++hv_store||| ++hv_undef_flags||| ++hv_undef||| ++ibcmp_locale||5.004000| ++ibcmp_utf8||5.007003| ++ibcmp||| ++incline||| ++incpush_if_exists||| ++incpush_use_sep||| ++incpush||| ++ingroup||| ++init_argv_symbols||| ++init_constants||| ++init_dbargs||| ++init_debugger||| ++init_global_struct||| ++init_i18nl10n||5.006000| ++init_i18nl14n||5.006000| ++init_ids||| ++init_interp||| ++init_main_stash||| ++init_perllib||| ++init_postdump_symbols||| ++init_predump_symbols||| ++init_stacks||5.005000| ++init_tm||5.007002| ++inplace_aassign||| ++instr|||n ++intro_my||| ++intuit_method||| ++intuit_more||| ++invert||| ++invlist_array||| ++invlist_clone||| ++invlist_extend||| ++invlist_highest||| ++invlist_is_iterating||| ++invlist_iterfinish||| ++invlist_iterinit||| ++invlist_iternext||| ++invlist_max||| ++invlist_previous_index||| ++invlist_set_len||| ++invlist_set_previous_index||| ++invlist_trim||| ++invoke_exception_hook||| ++io_close||| ++isALNUMC|5.006000||p ++isALNUM_lazy||| ++isALPHANUMERIC||5.017008| ++isALPHA||| ++isASCII|5.006000|5.006000|p ++isBLANK|5.006001||p ++isCNTRL|5.006000|5.006000|p ++isDIGIT||| ++isFOO_lc||| ++isFOO_utf8_lc||| ++isGRAPH|5.006000||p ++isGV_with_GP|5.009004||p ++isIDCONT||5.017008| ++isIDFIRST_lazy||| ++isIDFIRST||| ++isLOWER||| ++isOCTAL||5.013005| ++isPRINT|5.004000||p ++isPSXSPC|5.006001||p ++isPUNCT|5.006000||p ++isSPACE||| ++isUPPER||| ++isWORDCHAR||5.013006| ++isXDIGIT|5.006000||p ++is_an_int||| ++is_ascii_string||5.011000|n ++is_cur_LC_category_utf8||| ++is_handle_constructor|||n ++is_list_assignment||| ++is_lvalue_sub||5.007001| ++is_uni_alnum_lc||5.006000| ++is_uni_alnumc_lc||5.017007| ++is_uni_alnumc||5.017007| ++is_uni_alnum||5.006000| ++is_uni_alpha_lc||5.006000| ++is_uni_alpha||5.006000| ++is_uni_ascii_lc||5.006000| ++is_uni_ascii||5.006000| ++is_uni_blank_lc||5.017002| ++is_uni_blank||5.017002| ++is_uni_cntrl_lc||5.006000| ++is_uni_cntrl||5.006000| ++is_uni_digit_lc||5.006000| ++is_uni_digit||5.006000| ++is_uni_graph_lc||5.006000| ++is_uni_graph||5.006000| ++is_uni_idfirst_lc||5.006000| ++is_uni_idfirst||5.006000| ++is_uni_lower_lc||5.006000| ++is_uni_lower||5.006000| ++is_uni_print_lc||5.006000| ++is_uni_print||5.006000| ++is_uni_punct_lc||5.006000| ++is_uni_punct||5.006000| ++is_uni_space_lc||5.006000| ++is_uni_space||5.006000| ++is_uni_upper_lc||5.006000| ++is_uni_upper||5.006000| ++is_uni_xdigit_lc||5.006000| ++is_uni_xdigit||5.006000| ++is_utf8_alnumc||5.017007| ++is_utf8_alnum||5.006000| ++is_utf8_alpha||5.006000| ++is_utf8_ascii||5.006000| ++is_utf8_blank||5.017002| ++is_utf8_char_buf||5.015008|n ++is_utf8_char_slow|||n ++is_utf8_char||5.006000|n ++is_utf8_cntrl||5.006000| ++is_utf8_common||| ++is_utf8_digit||5.006000| ++is_utf8_graph||5.006000| ++is_utf8_idcont||5.008000| ++is_utf8_idfirst||5.006000| ++is_utf8_lower||5.006000| ++is_utf8_mark||5.006000| ++is_utf8_perl_space||5.011001| ++is_utf8_perl_word||5.011001| ++is_utf8_posix_digit||5.011001| ++is_utf8_print||5.006000| ++is_utf8_punct||5.006000| ++is_utf8_space||5.006000| ++is_utf8_string_loclen||5.009003|n ++is_utf8_string_loc||5.008001|n ++is_utf8_string||5.006001|n ++is_utf8_upper||5.006000| ++is_utf8_xdigit||5.006000| ++is_utf8_xidcont||5.013010| ++is_utf8_xidfirst||5.013010| ++isa_lookup||| ++items|||n ++ix|||n ++jmaybe||| ++join_exact||| ++keyword_plugin_standard||| ++keyword||| ++leave_scope||| ++lex_bufutf8||5.011002| ++lex_discard_to||5.011002| ++lex_grow_linestr||5.011002| ++lex_next_chunk||5.011002| ++lex_peek_unichar||5.011002| ++lex_read_space||5.011002| ++lex_read_to||5.011002| ++lex_read_unichar||5.011002| ++lex_start||5.009005| ++lex_stuff_pvn||5.011002| ++lex_stuff_pvs||5.013005| ++lex_stuff_pv||5.013006| ++lex_stuff_sv||5.011002| ++lex_unstuff||5.011002| ++listkids||| ++list||| ++load_module_nocontext|||vn ++load_module|5.006000||pv ++localize||| ++looks_like_bool||| ++looks_like_number||| ++lop||| ++mPUSHi|5.009002||p ++mPUSHn|5.009002||p ++mPUSHp|5.009002||p ++mPUSHs|5.010001||p ++mPUSHu|5.009002||p ++mXPUSHi|5.009002||p ++mXPUSHn|5.009002||p ++mXPUSHp|5.009002||p ++mXPUSHs|5.010001||p ++mXPUSHu|5.009002||p ++mad_free||| ++madlex||| ++madparse||| ++magic_clear_all_env||| ++magic_cleararylen_p||| ++magic_clearenv||| ++magic_clearhints||| ++magic_clearhint||| ++magic_clearisa||| ++magic_clearpack||| ++magic_clearsig||| ++magic_copycallchecker||| ++magic_dump||5.006000| ++magic_existspack||| ++magic_freearylen_p||| ++magic_freeovrld||| ++magic_getarylen||| ++magic_getdefelem||| ++magic_getnkeys||| ++magic_getpack||| ++magic_getpos||| ++magic_getsig||| ++magic_getsubstr||| ++magic_gettaint||| ++magic_getuvar||| ++magic_getvec||| ++magic_get||| ++magic_killbackrefs||| ++magic_methcall1||| ++magic_methcall|||v ++magic_methpack||| ++magic_nextpack||| ++magic_regdata_cnt||| ++magic_regdatum_get||| ++magic_regdatum_set||| ++magic_scalarpack||| ++magic_set_all_env||| ++magic_setarylen||| ++magic_setcollxfrm||| ++magic_setdbline||| ++magic_setdefelem||| ++magic_setenv||| ++magic_sethint||| ++magic_setisa||| ++magic_setmglob||| ++magic_setnkeys||| ++magic_setpack||| ++magic_setpos||| ++magic_setregexp||| ++magic_setsig||| ++magic_setsubstr||| ++magic_settaint||| ++magic_setutf8||| ++magic_setuvar||| ++magic_setvec||| ++magic_set||| ++magic_sizepack||| ++magic_wipepack||| ++make_matcher||| ++make_trie_failtable||| ++make_trie||| ++malloc_good_size|||n ++malloced_size|||n ++malloc||5.007002|n ++markstack_grow||| ++matcher_matches_sv||| ++mayberelocate||| ++measure_struct||| ++memEQs|5.009005||p ++memEQ|5.004000||p ++memNEs|5.009005||p ++memNE|5.004000||p ++mem_collxfrm||| ++mem_log_common|||n ++mess_alloc||| ++mess_nocontext|||vn ++mess_sv||5.013001| ++mess||5.006000|v ++method_common||| ++mfree||5.007002|n ++mg_clear||| ++mg_copy||| ++mg_dup||| ++mg_find_mglob||| ++mg_findext||5.013008| ++mg_find||| ++mg_free_type||5.013006| ++mg_free||| ++mg_get||| ++mg_length||5.005000| ++mg_localize||| ++mg_magical||| ++mg_set||| ++mg_size||5.005000| ++mini_mktime||5.007002| ++minus_v||| ++missingterm||| ++mode_from_discipline||| ++modkids||| ++more_bodies||| ++more_sv||| ++moreswitches||| ++mro_clean_isarev||| ++mro_gather_and_rename||| ++mro_get_from_name||5.010001| ++mro_get_linear_isa_dfs||| ++mro_get_linear_isa||5.009005| ++mro_get_private_data||5.010001| ++mro_isa_changed_in||| ++mro_meta_dup||| ++mro_meta_init||| ++mro_method_changed_in||5.009005| ++mro_package_moved||| ++mro_register||5.010001| ++mro_set_mro||5.010001| ++mro_set_private_data||5.010001| ++mul128||| ++mulexp10|||n ++my_atof2||5.007002| ++my_atof||5.006000| ++my_attrs||| ++my_bcopy|||n ++my_bzero|||n ++my_chsize||| ++my_clearenv||| ++my_cxt_index||| ++my_cxt_init||| ++my_dirfd||5.009005| ++my_exit_jump||| ++my_exit||| ++my_failure_exit||5.004000| ++my_fflush_all||5.006000| ++my_fork||5.007003|n ++my_kid||| ++my_lstat_flags||| ++my_lstat||5.019003| ++my_memcmp|||n ++my_memset||5.004000|n ++my_pclose||5.004000| ++my_popen_list||5.007001| ++my_popen||5.004000| ++my_setenv||| ++my_snprintf|5.009004||pvn ++my_socketpair||5.007003|n ++my_sprintf|5.009003||pvn ++my_stat_flags||| ++my_stat||5.019003| ++my_strftime||5.007002| ++my_strlcat|5.009004||pn ++my_strlcpy|5.009004||pn ++my_unexec||| ++my_vsnprintf||5.009004|n ++need_utf8|||n ++newANONATTRSUB||5.006000| ++newANONHASH||| ++newANONLIST||| ++newANONSUB||| ++newASSIGNOP||| ++newATTRSUB_flags||| ++newATTRSUB||5.006000| ++newAVREF||| ++newAV||| ++newBINOP||| ++newCONDOP||| ++newCONSTSUB_flags||5.015006| ++newCONSTSUB|5.004050||p ++newCVREF||| ++newDEFSVOP||| ++newFORM||| ++newFOROP||5.013007| ++newGIVENOP||5.009003| ++newGIVWHENOP||| ++newGP||| ++newGVOP||| ++newGVREF||| ++newGVgen_flags||5.015004| ++newGVgen||| ++newHVREF||| ++newHVhv||5.005000| ++newHV||| ++newIO||| ++newLISTOP||| ++newLOGOP||| ++newLOOPEX||| ++newLOOPOP||| ++newMADPROP||| ++newMADsv||| ++newMYSUB||5.017004| ++newNULLLIST||| ++newOP||| ++newPADOP||| ++newPMOP||| ++newPROG||| ++newPVOP||| ++newRANGE||| ++newRV_inc|5.004000||p ++newRV_noinc|5.004000||p ++newRV||| ++newSLICEOP||| ++newSTATEOP||| ++newSTUB||| ++newSUB||| ++newSVOP||| ++newSVREF||| ++newSV_type|5.009005||p ++newSVhek||5.009003| ++newSViv||| ++newSVnv||| ++newSVpadname||5.017004| ++newSVpv_share||5.013006| ++newSVpvf_nocontext|||vn ++newSVpvf||5.004000|v ++newSVpvn_flags|5.010001||p ++newSVpvn_share|5.007001||p ++newSVpvn_utf8|5.010001||p ++newSVpvn|5.004050||p ++newSVpvs_flags|5.010001||p ++newSVpvs_share|5.009003||p ++newSVpvs|5.009003||p ++newSVpv||| ++newSVrv||| ++newSVsv||| ++newSVuv|5.006000||p ++newSV||| ++newTOKEN||| ++newUNOP||| ++newWHENOP||5.009003| ++newWHILEOP||5.013007| ++newXS_flags||5.009004| ++newXS_len_flags||| ++newXSproto||5.006000| ++newXS||5.006000| ++new_collate||5.006000| ++new_constant||| ++new_ctype||5.006000| ++new_he||| ++new_logop||| ++new_numeric||5.006000| ++new_stackinfo||5.005000| ++new_version||5.009000| ++new_warnings_bitfield||| ++next_symbol||| ++nextargv||| ++nextchar||| ++ninstr|||n ++no_bareword_allowed||| ++no_fh_allowed||| ++no_op||| ++not_a_number||| ++not_incrementable||| ++nothreadhook||5.008000| ++nuke_stacks||| ++num_overflow|||n ++oopsAV||| ++oopsHV||| ++op_append_elem||5.013006| ++op_append_list||5.013006| ++op_clear||| ++op_const_sv||| ++op_contextualize||5.013006| ++op_dump||5.006000| ++op_free||| ++op_getmad_weak||| ++op_getmad||| ++op_integerize||| ++op_linklist||5.013006| ++op_lvalue_flags||| ++op_lvalue||5.013007| ++op_null||5.007002| ++op_prepend_elem||5.013006| ++op_refcnt_dec||| ++op_refcnt_inc||| ++op_refcnt_lock||5.009002| ++op_refcnt_unlock||5.009002| ++op_scope||5.013007| ++op_std_init||| ++op_unscope||| ++op_xmldump||| ++open_script||| ++opslab_force_free||| ++opslab_free_nopad||| ++opslab_free||| ++pMY_CXT_|5.007003||p ++pMY_CXT|5.007003||p ++pTHX_|5.006000||p ++pTHX|5.006000||p ++packWARN|5.007003||p ++pack_cat||5.007003| ++pack_rec||| ++package_version||| ++package||| ++packlist||5.008001| ++pad_add_anon||5.008001| ++pad_add_name_pvn||5.015001| ++pad_add_name_pvs||5.015001| ++pad_add_name_pv||5.015001| ++pad_add_name_sv||5.015001| ++pad_alloc_name||| ++pad_alloc||| ++pad_block_start||| ++pad_check_dup||| ++pad_compname_type||5.009003| ++pad_findlex||| ++pad_findmy_pvn||5.015001| ++pad_findmy_pvs||5.015001| ++pad_findmy_pv||5.015001| ++pad_findmy_sv||5.015001| ++pad_fixup_inner_anons||| ++pad_free||| ++pad_leavemy||| ++pad_new||5.008001| ++pad_peg|||n ++pad_push||| ++pad_reset||| ++pad_setsv||| ++pad_sv||| ++pad_swipe||| ++pad_tidy||5.008001| ++padlist_dup||| ++padlist_store||| ++parse_arithexpr||5.013008| ++parse_barestmt||5.013007| ++parse_block||5.013007| ++parse_body||| ++parse_fullexpr||5.013008| ++parse_fullstmt||5.013005| ++parse_ident||| ++parse_label||5.013007| ++parse_listexpr||5.013008| ++parse_lparen_question_flags||| ++parse_stmtseq||5.013006| ++parse_termexpr||5.013008| ++parse_unicode_opts||| ++parser_dup||| ++parser_free_nexttoke_ops||| ++parser_free||| ++path_is_searchable|||n ++peep||| ++pending_ident||| ++perl_alloc_using|||n ++perl_alloc|||n ++perl_clone_using|||n ++perl_clone|||n ++perl_construct|||n ++perl_destruct||5.007003|n ++perl_free|||n ++perl_parse||5.006000|n ++perl_run|||n ++pidgone||| ++pm_description||| ++pmop_dump||5.006000| ++pmop_xmldump||| ++pmruntime||| ++pmtrans||| ++pop_scope||| ++populate_isa|||v ++pregcomp||5.009005| ++pregexec||| ++pregfree2||5.011000| ++pregfree||| ++prepend_madprops||| ++prescan_version||5.011004| ++printbuf||| ++printf_nocontext|||vn ++process_special_blocks||| ++ptr_hash|||n ++ptr_table_clear||5.009005| ++ptr_table_fetch||5.009005| ++ptr_table_find|||n ++ptr_table_free||5.009005| ++ptr_table_new||5.009005| ++ptr_table_split||5.009005| ++ptr_table_store||5.009005| ++push_scope||| ++put_byte||| ++put_latin1_charclass_innards||| ++pv_display|5.006000||p ++pv_escape|5.009004||p ++pv_pretty|5.009004||p ++pv_uni_display||5.007003| ++qerror||| ++qsortsvu||| ++re_compile||5.009005| ++re_croak2||| ++re_dup_guts||| ++re_intuit_start||5.019001| ++re_intuit_string||5.006000| ++re_op_compile||| ++readpipe_override||| ++realloc||5.007002|n ++reentrant_free||5.019003| ++reentrant_init||5.019003| ++reentrant_retry||5.019003|vn ++reentrant_size||5.019003| ++ref_array_or_hash||| ++refcounted_he_chain_2hv||| ++refcounted_he_fetch_pvn||| ++refcounted_he_fetch_pvs||| ++refcounted_he_fetch_pv||| ++refcounted_he_fetch_sv||| ++refcounted_he_free||| ++refcounted_he_inc||| ++refcounted_he_new_pvn||| ++refcounted_he_new_pvs||| ++refcounted_he_new_pv||| ++refcounted_he_new_sv||| ++refcounted_he_value||| ++refkids||| ++refto||| ++ref||5.019003| ++reg_check_named_buff_matched||| ++reg_named_buff_all||5.009005| ++reg_named_buff_exists||5.009005| ++reg_named_buff_fetch||5.009005| ++reg_named_buff_firstkey||5.009005| ++reg_named_buff_iter||| ++reg_named_buff_nextkey||5.009005| ++reg_named_buff_scalar||5.009005| ++reg_named_buff||| ++reg_node||| ++reg_numbered_buff_fetch||| ++reg_numbered_buff_length||| ++reg_numbered_buff_store||| ++reg_qr_package||| ++reg_recode||| ++reg_scan_name||| ++reg_skipcomment||| ++reg_temp_copy||| ++reganode||| ++regatom||| ++regbranch||| ++regclass_swash||5.009004| ++regclass||| ++regcppop||| ++regcppush||| ++regcurly||| ++regdump_extflags||| ++regdump_intflags||| ++regdump||5.005000| ++regdupe_internal||| ++regexec_flags||5.005000| ++regfree_internal||5.009005| ++reghop3|||n ++reghop4|||n ++reghopmaybe3|||n ++reginclass||| ++reginitcolors||5.006000| ++reginsert||| ++regmatch||| ++regnext||5.005000| ++regpatws|||n ++regpiece||| ++regpposixcc||| ++regprop||| ++regrepeat||| ++regtail_study||| ++regtail||| ++regtry||| ++reguni||| ++regwhite|||n ++reg||| ++repeatcpy|||n ++report_evil_fh||| ++report_redefined_cv||| ++report_uninit||| ++report_wrongway_fh||| ++require_pv||5.006000| ++require_tie_mod||| ++restore_magic||| ++rninstr|||n ++rpeep||| ++rsignal_restore||| ++rsignal_save||| ++rsignal_state||5.004000| ++rsignal||5.004000| ++run_body||| ++run_user_filter||| ++runops_debug||5.005000| ++runops_standard||5.005000| ++rv2cv_op_cv||5.013006| ++rvpv_dup||| ++rxres_free||| ++rxres_restore||| ++rxres_save||| ++safesyscalloc||5.006000|n ++safesysfree||5.006000|n ++safesysmalloc||5.006000|n ++safesysrealloc||5.006000|n ++same_dirent||| ++save_I16||5.004000| ++save_I32||| ++save_I8||5.006000| ++save_adelete||5.011000| ++save_aelem_flags||5.011000| ++save_aelem||5.004050| ++save_alloc||5.006000| ++save_aptr||| ++save_ary||| ++save_bool||5.008001| ++save_clearsv||| ++save_delete||| ++save_destructor_x||5.006000| ++save_destructor||5.006000| ++save_freeop||| ++save_freepv||| ++save_freesv||| ++save_generic_pvref||5.006001| ++save_generic_svref||5.005030| ++save_gp||5.004000| ++save_hash||| ++save_hdelete||5.011000| ++save_hek_flags|||n ++save_helem_flags||5.011000| ++save_helem||5.004050| ++save_hints||5.010001| ++save_hptr||| ++save_int||| ++save_item||| ++save_iv||5.005000| ++save_lines||| ++save_list||| ++save_long||| ++save_magic_flags||| ++save_mortalizesv||5.007001| ++save_nogv||| ++save_op||5.005000| ++save_padsv_and_mortalize||5.010001| ++save_pptr||| ++save_pushi32ptr||5.010001| ++save_pushptri32ptr||| ++save_pushptrptr||5.010001| ++save_pushptr||5.010001| ++save_re_context||5.006000| ++save_scalar_at||| ++save_scalar||| ++save_set_svflags||5.009000| ++save_shared_pvref||5.007003| ++save_sptr||| ++save_svref||| ++save_vptr||5.006000| ++savepvn||| ++savepvs||5.009003| ++savepv||| ++savesharedpvn||5.009005| ++savesharedpvs||5.013006| ++savesharedpv||5.007003| ++savesharedsvpv||5.013006| ++savestack_grow_cnt||5.008001| ++savestack_grow||| ++savesvpv||5.009002| ++sawparens||| ++scalar_mod_type|||n ++scalarboolean||| ++scalarkids||| ++scalarseq||| ++scalarvoid||| ++scalar||| ++scan_bin||5.006000| ++scan_commit||| ++scan_const||| ++scan_formline||| ++scan_heredoc||| ++scan_hex||| ++scan_ident||| ++scan_inputsymbol||| ++scan_num||5.007001| ++scan_oct||| ++scan_pat||| ++scan_str||| ++scan_subst||| ++scan_trans||| ++scan_version||5.009001| ++scan_vstring||5.009005| ++scan_word||| ++screaminstr||5.005000| ++search_const||| ++seed||5.008001| ++sequence_num||| ++set_context||5.006000|n ++set_numeric_local||5.006000| ++set_numeric_radix||5.006000| ++set_numeric_standard||5.006000| ++setdefout||| ++share_hek_flags||| ++share_hek||5.004000| ++si_dup||| ++sighandler|||n ++simplify_sort||| ++skipspace0||| ++skipspace1||| ++skipspace2||| ++skipspace_flags||| ++softref2xv||| ++sortcv_stacked||| ++sortcv_xsub||| ++sortcv||| ++sortsv_flags||5.009003| ++sortsv||5.007003| ++space_join_names_mortal||| ++ss_dup||| ++stack_grow||| ++start_force||| ++start_glob||| ++start_subparse||5.004000| ++stdize_locale||| ++strEQ||| ++strGE||| ++strGT||| ++strLE||| ++strLT||| ++strNE||| ++str_to_version||5.006000| ++strip_return||| ++strnEQ||| ++strnNE||| ++study_chunk||| ++sub_crush_depth||| ++sublex_done||| ++sublex_push||| ++sublex_start||| ++sv_2bool_flags||5.013006| ++sv_2bool||| ++sv_2cv||| ++sv_2io||| ++sv_2iuv_common||| ++sv_2iuv_non_preserve||| ++sv_2iv_flags||5.009001| ++sv_2iv||| ++sv_2mortal||| ++sv_2num||| ++sv_2nv_flags||5.013001| ++sv_2pv_flags|5.007002||p ++sv_2pv_nolen|5.006000||p ++sv_2pvbyte_nolen|5.006000||p ++sv_2pvbyte|5.006000||p ++sv_2pvutf8_nolen||5.006000| ++sv_2pvutf8||5.006000| ++sv_2pv||| ++sv_2uv_flags||5.009001| ++sv_2uv|5.004000||p ++sv_add_arena||| ++sv_add_backref||| ++sv_backoff||| ++sv_bless||| ++sv_cat_decode||5.008001| ++sv_catpv_flags||5.013006| ++sv_catpv_mg|5.004050||p ++sv_catpv_nomg||5.013006| ++sv_catpvf_mg_nocontext|||pvn ++sv_catpvf_mg|5.006000|5.004000|pv ++sv_catpvf_nocontext|||vn ++sv_catpvf||5.004000|v ++sv_catpvn_flags||5.007002| ++sv_catpvn_mg|5.004050||p ++sv_catpvn_nomg|5.007002||p ++sv_catpvn||| ++sv_catpvs_flags||5.013006| ++sv_catpvs_mg||5.013006| ++sv_catpvs_nomg||5.013006| ++sv_catpvs|5.009003||p ++sv_catpv||| ++sv_catsv_flags||5.007002| ++sv_catsv_mg|5.004050||p ++sv_catsv_nomg|5.007002||p ++sv_catsv||| ++sv_catxmlpvn||| ++sv_catxmlpv||| ++sv_catxmlsv||| ++sv_chop||| ++sv_clean_all||| ++sv_clean_objs||| ++sv_clear||| ++sv_cmp_flags||5.013006| ++sv_cmp_locale_flags||5.013006| ++sv_cmp_locale||5.004000| ++sv_cmp||| ++sv_collxfrm_flags||5.013006| ++sv_collxfrm||| ++sv_copypv_flags||5.017002| ++sv_copypv_nomg||5.017002| ++sv_copypv||| ++sv_dec_nomg||5.013002| ++sv_dec||| ++sv_del_backref||| ++sv_derived_from_pvn||5.015004| ++sv_derived_from_pv||5.015004| ++sv_derived_from_sv||5.015004| ++sv_derived_from||5.004000| ++sv_destroyable||5.010000| ++sv_display||| ++sv_does_pvn||5.015004| ++sv_does_pv||5.015004| ++sv_does_sv||5.015004| ++sv_does||5.009004| ++sv_dump||| ++sv_dup_common||| ++sv_dup_inc_multiple||| ++sv_dup_inc||| ++sv_dup||| ++sv_eq_flags||5.013006| ++sv_eq||| ++sv_exp_grow||| ++sv_force_normal_flags||5.007001| ++sv_force_normal||5.006000| ++sv_free2||| ++sv_free_arenas||| ++sv_free||| ++sv_gets||5.004000| ++sv_grow||| ++sv_i_ncmp||| ++sv_inc_nomg||5.013002| ++sv_inc||| ++sv_insert_flags||5.010001| ++sv_insert||| ++sv_isa||| ++sv_isobject||| ++sv_iv||5.005000| ++sv_kill_backrefs||| ++sv_len_utf8_nomg||| ++sv_len_utf8||5.006000| ++sv_len||| ++sv_magic_portable|5.019003|5.004000|p ++sv_magicext_mglob||| ++sv_magicext||5.007003| ++sv_magic||| ++sv_mortalcopy_flags||| ++sv_mortalcopy||| ++sv_ncmp||| ++sv_newmortal||| ++sv_newref||| ++sv_nolocking||5.007003| ++sv_nosharing||5.007003| ++sv_nounlocking||| ++sv_nv||5.005000| ++sv_peek||5.005000| ++sv_pos_b2u_flags||5.019003| ++sv_pos_b2u_midway||| ++sv_pos_b2u||5.006000| ++sv_pos_u2b_cached||| ++sv_pos_u2b_flags||5.011005| ++sv_pos_u2b_forwards|||n ++sv_pos_u2b_midway|||n ++sv_pos_u2b||5.006000| ++sv_pvbyten_force||5.006000| ++sv_pvbyten||5.006000| ++sv_pvbyte||5.006000| ++sv_pvn_force_flags|5.007002||p ++sv_pvn_force||| ++sv_pvn_nomg|5.007003|5.005000|p ++sv_pvn||5.005000| ++sv_pvutf8n_force||5.006000| ++sv_pvutf8n||5.006000| ++sv_pvutf8||5.006000| ++sv_pv||5.006000| ++sv_recode_to_utf8||5.007003| ++sv_reftype||| ++sv_ref||| ++sv_release_COW||| ++sv_replace||| ++sv_report_used||| ++sv_resetpvn||| ++sv_reset||| ++sv_rvweaken||5.006000| ++sv_sethek||| ++sv_setiv_mg|5.004050||p ++sv_setiv||| ++sv_setnv_mg|5.006000||p ++sv_setnv||| ++sv_setpv_mg|5.004050||p ++sv_setpvf_mg_nocontext|||pvn ++sv_setpvf_mg|5.006000|5.004000|pv ++sv_setpvf_nocontext|||vn ++sv_setpvf||5.004000|v ++sv_setpviv_mg||5.008001| ++sv_setpviv||5.008001| ++sv_setpvn_mg|5.004050||p ++sv_setpvn||| ++sv_setpvs_mg||5.013006| ++sv_setpvs|5.009004||p ++sv_setpv||| ++sv_setref_iv||| ++sv_setref_nv||| ++sv_setref_pvn||| ++sv_setref_pvs||5.019003| ++sv_setref_pv||| ++sv_setref_uv||5.007001| ++sv_setsv_cow||| ++sv_setsv_flags||5.007002| ++sv_setsv_mg|5.004050||p ++sv_setsv_nomg|5.007002||p ++sv_setsv||| ++sv_setuv_mg|5.004050||p ++sv_setuv|5.004000||p ++sv_tainted||5.004000| ++sv_taint||5.004000| ++sv_true||5.005000| ++sv_unglob||| ++sv_uni_display||5.007003| ++sv_unmagicext||5.013008| ++sv_unmagic||| ++sv_unref_flags||5.007001| ++sv_unref||| ++sv_untaint||5.004000| ++sv_upgrade||| ++sv_usepvn_flags||5.009004| ++sv_usepvn_mg|5.004050||p ++sv_usepvn||| ++sv_utf8_decode||5.006000| ++sv_utf8_downgrade||5.006000| ++sv_utf8_encode||5.006000| ++sv_utf8_upgrade_flags_grow||5.011000| ++sv_utf8_upgrade_flags||5.007002| ++sv_utf8_upgrade_nomg||5.007002| ++sv_utf8_upgrade||5.007001| ++sv_uv|5.005000||p ++sv_vcatpvf_mg|5.006000|5.004000|p ++sv_vcatpvfn_flags||5.017002| ++sv_vcatpvfn||5.004000| ++sv_vcatpvf|5.006000|5.004000|p ++sv_vsetpvf_mg|5.006000|5.004000|p ++sv_vsetpvfn||5.004000| ++sv_vsetpvf|5.006000|5.004000|p ++sv_xmlpeek||| ++svtype||| ++swallow_bom||| ++swash_fetch||5.007002| ++swash_init||5.006000| ++swatch_get||| ++sys_init3||5.010000|n ++sys_init||5.010000|n ++sys_intern_clear||| ++sys_intern_dup||| ++sys_intern_init||| ++sys_term||5.010000|n ++taint_env||| ++taint_proper||| ++tied_method|||v ++tmps_grow||5.006000| ++toFOLD_uni||5.007003| ++toFOLD_utf8||5.019001| ++toFOLD||5.019001| ++toLOWER_L1||5.019001| ++toLOWER_LC||5.004000| ++toLOWER_uni||5.007003| ++toLOWER_utf8||5.015007| ++toLOWER||| ++toTITLE_uni||5.007003| ++toTITLE_utf8||5.015007| ++toTITLE||5.019001| ++toUPPER_uni||5.007003| ++toUPPER_utf8||5.015007| ++toUPPER||5.004000| ++to_byte_substr||| ++to_lower_latin1||| ++to_uni_fold||5.007003| ++to_uni_lower_lc||5.006000| ++to_uni_lower||5.007003| ++to_uni_title_lc||5.006000| ++to_uni_title||5.007003| ++to_uni_upper_lc||5.006000| ++to_uni_upper||5.007003| ++to_utf8_case||5.007003| ++to_utf8_fold||5.015007| ++to_utf8_lower||5.015007| ++to_utf8_substr||| ++to_utf8_title||5.015007| ++to_utf8_upper||5.015007| ++token_free||| ++token_getmad||| ++tokenize_use||| ++tokeq||| ++tokereport||| ++too_few_arguments_pv||| ++too_few_arguments_sv||| ++too_many_arguments_pv||| ++too_many_arguments_sv||| ++translate_substr_offsets||| ++try_amagic_bin||| ++try_amagic_un||| ++uiv_2buf|||n ++unlnk||| ++unpack_rec||| ++unpack_str||5.007003| ++unpackstring||5.008001| ++unreferenced_to_tmp_stack||| ++unshare_hek_or_pvn||| ++unshare_hek||| ++unsharepvn||5.004000| ++unwind_handler_stack||| ++update_debugger_info||| ++upg_version||5.009005| ++usage||| ++utf16_textfilter||| ++utf16_to_utf8_reversed||5.006001| ++utf16_to_utf8||5.006001| ++utf8_distance||5.006000| ++utf8_hop||5.006000| ++utf8_length||5.007001| ++utf8_mg_len_cache_update||| ++utf8_mg_pos_cache_update||| ++utf8_to_bytes||5.006001| ++utf8_to_uvchr_buf||5.015009| ++utf8_to_uvchr||5.007001| ++utf8_to_uvuni_buf||5.015009| ++utf8_to_uvuni||5.007001| ++utf8n_to_uvchr||| ++utf8n_to_uvuni||5.007001| ++utilize||| ++uvchr_to_utf8_flags||5.007003| ++uvchr_to_utf8||| ++uvuni_to_utf8_flags||5.007003| ++uvuni_to_utf8||5.007001| ++valid_utf8_to_uvchr||| ++valid_utf8_to_uvuni||5.015009| ++validate_proto||| ++validate_suid||| ++varname||| ++vcmp||5.009000| ++vcroak||5.006000| ++vdeb||5.007003| ++vform||5.006000| ++visit||| ++vivify_defelem||| ++vivify_ref||| ++vload_module|5.006000||p ++vmess||5.006000| ++vnewSVpvf|5.006000|5.004000|p ++vnormal||5.009002| ++vnumify||5.009000| ++vstringify||5.009000| ++vverify||5.009003| ++vwarner||5.006000| ++vwarn||5.006000| ++wait4pid||| ++warn_nocontext|||vn ++warn_sv||5.013001| ++warner_nocontext|||vn ++warner|5.006000|5.004000|pv ++warn|||v ++was_lvalue_sub||| ++watch||| ++whichsig_pvn||5.015004| ++whichsig_pv||5.015004| ++whichsig_sv||5.015004| ++whichsig||| ++win32_croak_not_implemented|||n ++with_queued_errors||| ++wrap_op_checker||5.015008| ++write_to_stderr||| ++xmldump_all_perl||| ++xmldump_all||| ++xmldump_attr||| ++xmldump_eval||| ++xmldump_form||| ++xmldump_indent|||v ++xmldump_packsubs_perl||| ++xmldump_packsubs||| ++xmldump_sub_perl||| ++xmldump_sub||| ++xmldump_vindent||| ++xs_apiversion_bootcheck||| ++xs_version_bootcheck||| ++yyerror_pvn||| ++yyerror_pv||| ++yyerror||| ++yylex||| ++yyparse||| ++yyunlex||| ++yywarn||| ++); ++ ++if (exists $opt{'list-unsupported'}) { ++ my $f; ++ for $f (sort { lc $a cmp lc $b } keys %API) { ++ next unless $API{$f}{todo}; ++ print "$f ", '.'x(40-length($f)), " ", format_version($API{$f}{todo}), "\n"; ++ } ++ exit 0; ++} ++ ++# Scan for possible replacement candidates ++ ++my(%replace, %need, %hints, %warnings, %depends); ++my $replace = 0; ++my($hint, $define, $function); ++ ++sub find_api ++{ ++ my $code = shift; ++ $code =~ s{ ++ / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]*) ++ | "[^"\\]*(?:\\.[^"\\]*)*" ++ | '[^'\\]*(?:\\.[^'\\]*)*' }{}egsx; ++ grep { exists $API{$_} } $code =~ /(\w+)/mg; ++} ++ ++while () { ++ if ($hint) { ++ my $h = $hint->[0] eq 'Hint' ? \%hints : \%warnings; ++ if (m{^\s*\*\s(.*?)\s*$}) { ++ for (@{$hint->[1]}) { ++ $h->{$_} ||= ''; # suppress warning with older perls ++ $h->{$_} .= "$1\n"; ++ } ++ } ++ else { undef $hint } ++ } ++ ++ $hint = [$1, [split /,?\s+/, $2]] ++ if m{^\s*$rccs\s+(Hint|Warning):\s+(\w+(?:,?\s+\w+)*)\s*$}; ++ ++ if ($define) { ++ if ($define->[1] =~ /\\$/) { ++ $define->[1] .= $_; ++ } ++ else { ++ if (exists $API{$define->[0]} && $define->[1] !~ /^DPPP_\(/) { ++ my @n = find_api($define->[1]); ++ push @{$depends{$define->[0]}}, @n if @n ++ } ++ undef $define; ++ } ++ } ++ ++ $define = [$1, $2] if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(.*)}; ++ ++ if ($function) { ++ if (/^}/) { ++ if (exists $API{$function->[0]}) { ++ my @n = find_api($function->[1]); ++ push @{$depends{$function->[0]}}, @n if @n ++ } ++ undef $function; ++ } ++ else { ++ $function->[1] .= $_; ++ } ++ } ++ ++ $function = [$1, ''] if m{^DPPP_\(my_(\w+)\)}; ++ ++ $replace = $1 if m{^\s*$rccs\s+Replace:\s+(\d+)\s+$rcce\s*$}; ++ $replace{$2} = $1 if $replace and m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+)}; ++ $replace{$2} = $1 if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+).*$rccs\s+Replace\s+$rcce}; ++ $replace{$1} = $2 if m{^\s*$rccs\s+Replace (\w+) with (\w+)\s+$rcce\s*$}; ++ ++ if (m{^\s*$rccs\s+(\w+(\s*,\s*\w+)*)\s+depends\s+on\s+(\w+(\s*,\s*\w+)*)\s+$rcce\s*$}) { ++ my @deps = map { s/\s+//g; $_ } split /,/, $3; ++ my $d; ++ for $d (map { s/\s+//g; $_ } split /,/, $1) { ++ push @{$depends{$d}}, @deps; ++ } ++ } ++ ++ $need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)}; ++} ++ ++for (values %depends) { ++ my %s; ++ $_ = [sort grep !$s{$_}++, @$_]; ++} ++ ++if (exists $opt{'api-info'}) { ++ my $f; ++ my $count = 0; ++ my $match = $opt{'api-info'} =~ m!^/(.*)/$! ? $1 : "^\Q$opt{'api-info'}\E\$"; ++ for $f (sort { lc $a cmp lc $b } keys %API) { ++ next unless $f =~ /$match/; ++ print "\n=== $f ===\n\n"; ++ my $info = 0; ++ if ($API{$f}{base} || $API{$f}{todo}) { ++ my $base = format_version($API{$f}{base} || $API{$f}{todo}); ++ print "Supported at least starting from perl-$base.\n"; ++ $info++; ++ } ++ if ($API{$f}{provided}) { ++ my $todo = $API{$f}{todo} ? format_version($API{$f}{todo}) : "5.003"; ++ print "Support by $ppport provided back to perl-$todo.\n"; ++ print "Support needs to be explicitly requested by NEED_$f.\n" if exists $need{$f}; ++ print "Depends on: ", join(', ', @{$depends{$f}}), ".\n" if exists $depends{$f}; ++ print "\n$hints{$f}" if exists $hints{$f}; ++ print "\nWARNING:\n$warnings{$f}" if exists $warnings{$f}; ++ $info++; ++ } ++ print "No portability information available.\n" unless $info; ++ $count++; ++ } ++ $count or print "Found no API matching '$opt{'api-info'}'."; ++ print "\n"; ++ exit 0; ++} ++ ++if (exists $opt{'list-provided'}) { ++ my $f; ++ for $f (sort { lc $a cmp lc $b } keys %API) { ++ next unless $API{$f}{provided}; ++ my @flags; ++ push @flags, 'explicit' if exists $need{$f}; ++ push @flags, 'depend' if exists $depends{$f}; ++ push @flags, 'hint' if exists $hints{$f}; ++ push @flags, 'warning' if exists $warnings{$f}; ++ my $flags = @flags ? ' ['.join(', ', @flags).']' : ''; ++ print "$f$flags\n"; ++ } ++ exit 0; ++} ++ ++my @files; ++my @srcext = qw( .xs .c .h .cc .cpp -c.inc -xs.inc ); ++my $srcext = join '|', map { quotemeta $_ } @srcext; ++ ++if (@ARGV) { ++ my %seen; ++ for (@ARGV) { ++ if (-e) { ++ if (-f) { ++ push @files, $_ unless $seen{$_}++; ++ } ++ else { warn "'$_' is not a file.\n" } ++ } ++ else { ++ my @new = grep { -f } glob $_ ++ or warn "'$_' does not exist.\n"; ++ push @files, grep { !$seen{$_}++ } @new; ++ } ++ } ++} ++else { ++ eval { ++ require File::Find; ++ File::Find::find(sub { ++ $File::Find::name =~ /($srcext)$/i ++ and push @files, $File::Find::name; ++ }, '.'); ++ }; ++ if ($@) { ++ @files = map { glob "*$_" } @srcext; ++ } ++} ++ ++if (!@ARGV || $opt{filter}) { ++ my(@in, @out); ++ my %xsc = map { /(.*)\.xs$/ ? ("$1.c" => 1, "$1.cc" => 1) : () } @files; ++ for (@files) { ++ my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/($srcext)$/i; ++ push @{ $out ? \@out : \@in }, $_; ++ } ++ if (@ARGV && @out) { ++ warning("Skipping the following files (use --nofilter to avoid this):\n| ", join "\n| ", @out); ++ } ++ @files = @in; ++} ++ ++die "No input files given!\n" unless @files; ++ ++my(%files, %global, %revreplace); ++%revreplace = reverse %replace; ++my $filename; ++my $patch_opened = 0; ++ ++for $filename (@files) { ++ unless (open IN, "<$filename") { ++ warn "Unable to read from $filename: $!\n"; ++ next; ++ } ++ ++ info("Scanning $filename ..."); ++ ++ my $c = do { local $/; }; ++ close IN; ++ ++ my %file = (orig => $c, changes => 0); ++ ++ # Temporarily remove C/XS comments and strings from the code ++ my @ccom; ++ ++ $c =~ s{ ++ ( ^$HS*\#$HS*include\b[^\r\n]+\b(?:\Q$ppport\E|XSUB\.h)\b[^\r\n]* ++ | ^$HS*\#$HS*(?:define|elif|if(?:def)?)\b[^\r\n]* ) ++ | ( ^$HS*\#[^\r\n]* ++ | "[^"\\]*(?:\\.[^"\\]*)*" ++ | '[^'\\]*(?:\\.[^'\\]*)*' ++ | / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]* ) ) ++ }{ defined $2 and push @ccom, $2; ++ defined $1 ? $1 : "$ccs$#ccom$cce" }mgsex; ++ ++ $file{ccom} = \@ccom; ++ $file{code} = $c; ++ $file{has_inc_ppport} = $c =~ /^$HS*#$HS*include[^\r\n]+\b\Q$ppport\E\b/m; ++ ++ my $func; ++ ++ for $func (keys %API) { ++ my $match = $func; ++ $match .= "|$revreplace{$func}" if exists $revreplace{$func}; ++ if ($c =~ /\b(?:Perl_)?($match)\b/) { ++ $file{uses_replace}{$1}++ if exists $revreplace{$func} && $1 eq $revreplace{$func}; ++ $file{uses_Perl}{$func}++ if $c =~ /\bPerl_$func\b/; ++ if (exists $API{$func}{provided}) { ++ $file{uses_provided}{$func}++; ++ if (!exists $API{$func}{base} || $API{$func}{base} > $opt{'compat-version'}) { ++ $file{uses}{$func}++; ++ my @deps = rec_depend($func); ++ if (@deps) { ++ $file{uses_deps}{$func} = \@deps; ++ for (@deps) { ++ $file{uses}{$_} = 0 unless exists $file{uses}{$_}; ++ } ++ } ++ for ($func, @deps) { ++ $file{needs}{$_} = 'static' if exists $need{$_}; ++ } ++ } ++ } ++ if (exists $API{$func}{todo} && $API{$func}{todo} > $opt{'compat-version'}) { ++ if ($c =~ /\b$func\b/) { ++ $file{uses_todo}{$func}++; ++ } ++ } ++ } ++ } ++ ++ while ($c =~ /^$HS*#$HS*define$HS+(NEED_(\w+?)(_GLOBAL)?)\b/mg) { ++ if (exists $need{$2}) { ++ $file{defined $3 ? 'needed_global' : 'needed_static'}{$2}++; ++ } ++ else { warning("Possibly wrong #define $1 in $filename") } ++ } ++ ++ for (qw(uses needs uses_todo needed_global needed_static)) { ++ for $func (keys %{$file{$_}}) { ++ push @{$global{$_}{$func}}, $filename; ++ } ++ } ++ ++ $files{$filename} = \%file; ++} ++ ++# Globally resolve NEED_'s ++my $need; ++for $need (keys %{$global{needs}}) { ++ if (@{$global{needs}{$need}} > 1) { ++ my @targets = @{$global{needs}{$need}}; ++ my @t = grep $files{$_}{needed_global}{$need}, @targets; ++ @targets = @t if @t; ++ @t = grep /\.xs$/i, @targets; ++ @targets = @t if @t; ++ my $target = shift @targets; ++ $files{$target}{needs}{$need} = 'global'; ++ for (@{$global{needs}{$need}}) { ++ $files{$_}{needs}{$need} = 'extern' if $_ ne $target; ++ } ++ } ++} ++ ++for $filename (@files) { ++ exists $files{$filename} or next; ++ ++ info("=== Analyzing $filename ==="); ++ ++ my %file = %{$files{$filename}}; ++ my $func; ++ my $c = $file{code}; ++ my $warnings = 0; ++ ++ for $func (sort keys %{$file{uses_Perl}}) { ++ if ($API{$func}{varargs}) { ++ unless ($API{$func}{nothxarg}) { ++ my $changes = ($c =~ s{\b(Perl_$func\s*\(\s*)(?!aTHX_?)(\)|[^\s)]*\))} ++ { $1 . ($2 eq ')' ? 'aTHX' : 'aTHX_ ') . $2 }ge); ++ if ($changes) { ++ warning("Doesn't pass interpreter argument aTHX to Perl_$func"); ++ $file{changes} += $changes; ++ } ++ } ++ } ++ else { ++ warning("Uses Perl_$func instead of $func"); ++ $file{changes} += ($c =~ s{\bPerl_$func(\s*)\((\s*aTHX_?)?\s*} ++ {$func$1(}g); ++ } ++ } ++ ++ for $func (sort keys %{$file{uses_replace}}) { ++ warning("Uses $func instead of $replace{$func}"); ++ $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g); ++ } ++ ++ for $func (sort keys %{$file{uses_provided}}) { ++ if ($file{uses}{$func}) { ++ if (exists $file{uses_deps}{$func}) { ++ diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}})); ++ } ++ else { ++ diag("Uses $func"); ++ } ++ } ++ $warnings += hint($func); ++ } ++ ++ unless ($opt{quiet}) { ++ for $func (sort keys %{$file{uses_todo}}) { ++ print "*** WARNING: Uses $func, which may not be portable below perl ", ++ format_version($API{$func}{todo}), ", even with '$ppport'\n"; ++ $warnings++; ++ } ++ } ++ ++ for $func (sort keys %{$file{needed_static}}) { ++ my $message = ''; ++ if (not exists $file{uses}{$func}) { ++ $message = "No need to define NEED_$func if $func is never used"; ++ } ++ elsif (exists $file{needs}{$func} && $file{needs}{$func} ne 'static') { ++ $message = "No need to define NEED_$func when already needed globally"; ++ } ++ if ($message) { ++ diag($message); ++ $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_$func\b.*$LF//mg); ++ } ++ } ++ ++ for $func (sort keys %{$file{needed_global}}) { ++ my $message = ''; ++ if (not exists $global{uses}{$func}) { ++ $message = "No need to define NEED_${func}_GLOBAL if $func is never used"; ++ } ++ elsif (exists $file{needs}{$func}) { ++ if ($file{needs}{$func} eq 'extern') { ++ $message = "No need to define NEED_${func}_GLOBAL when already needed globally"; ++ } ++ elsif ($file{needs}{$func} eq 'static') { ++ $message = "No need to define NEED_${func}_GLOBAL when only used in this file"; ++ } ++ } ++ if ($message) { ++ diag($message); ++ $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_${func}_GLOBAL\b.*$LF//mg); ++ } ++ } ++ ++ $file{needs_inc_ppport} = keys %{$file{uses}}; ++ ++ if ($file{needs_inc_ppport}) { ++ my $pp = ''; ++ ++ for $func (sort keys %{$file{needs}}) { ++ my $type = $file{needs}{$func}; ++ next if $type eq 'extern'; ++ my $suffix = $type eq 'global' ? '_GLOBAL' : ''; ++ unless (exists $file{"needed_$type"}{$func}) { ++ if ($type eq 'global') { ++ diag("Files [@{$global{needs}{$func}}] need $func, adding global request"); ++ } ++ else { ++ diag("File needs $func, adding static request"); ++ } ++ $pp .= "#define NEED_$func$suffix\n"; ++ } ++ } ++ ++ if ($pp && ($c =~ s/^(?=$HS*#$HS*define$HS+NEED_\w+)/$pp/m)) { ++ $pp = ''; ++ $file{changes}++; ++ } ++ ++ unless ($file{has_inc_ppport}) { ++ diag("Needs to include '$ppport'"); ++ $pp .= qq(#include "$ppport"\n) ++ } ++ ++ if ($pp) { ++ $file{changes} += ($c =~ s/^($HS*#$HS*define$HS+NEED_\w+.*?)^/$1$pp/ms) ++ || ($c =~ s/^(?=$HS*#$HS*include.*\Q$ppport\E)/$pp/m) ++ || ($c =~ s/^($HS*#$HS*include.*XSUB.*\s*?)^/$1$pp/m) ++ || ($c =~ s/^/$pp/); ++ } ++ } ++ else { ++ if ($file{has_inc_ppport}) { ++ diag("No need to include '$ppport'"); ++ $file{changes} += ($c =~ s/^$HS*?#$HS*include.*\Q$ppport\E.*?$LF//m); ++ } ++ } ++ ++ # put back in our C comments ++ my $ix; ++ my $cppc = 0; ++ my @ccom = @{$file{ccom}}; ++ for $ix (0 .. $#ccom) { ++ if (!$opt{cplusplus} && $ccom[$ix] =~ s!^//!!) { ++ $cppc++; ++ $file{changes} += $c =~ s/$rccs$ix$rcce/$ccs$ccom[$ix] $cce/; ++ } ++ else { ++ $c =~ s/$rccs$ix$rcce/$ccom[$ix]/; ++ } ++ } ++ ++ if ($cppc) { ++ my $s = $cppc != 1 ? 's' : ''; ++ warning("Uses $cppc C++ style comment$s, which is not portable"); ++ } ++ ++ my $s = $warnings != 1 ? 's' : ''; ++ my $warn = $warnings ? " ($warnings warning$s)" : ''; ++ info("Analysis completed$warn"); ++ ++ if ($file{changes}) { ++ if (exists $opt{copy}) { ++ my $newfile = "$filename$opt{copy}"; ++ if (-e $newfile) { ++ error("'$newfile' already exists, refusing to write copy of '$filename'"); ++ } ++ else { ++ local *F; ++ if (open F, ">$newfile") { ++ info("Writing copy of '$filename' with changes to '$newfile'"); ++ print F $c; ++ close F; ++ } ++ else { ++ error("Cannot open '$newfile' for writing: $!"); ++ } ++ } ++ } ++ elsif (exists $opt{patch} || $opt{changes}) { ++ if (exists $opt{patch}) { ++ unless ($patch_opened) { ++ if (open PATCH, ">$opt{patch}") { ++ $patch_opened = 1; ++ } ++ else { ++ error("Cannot open '$opt{patch}' for writing: $!"); ++ delete $opt{patch}; ++ $opt{changes} = 1; ++ goto fallback; ++ } ++ } ++ mydiff(\*PATCH, $filename, $c); ++ } ++ else { ++fallback: ++ info("Suggested changes:"); ++ mydiff(\*STDOUT, $filename, $c); ++ } ++ } ++ else { ++ my $s = $file{changes} == 1 ? '' : 's'; ++ info("$file{changes} potentially required change$s detected"); ++ } ++ } ++ else { ++ info("Looks good"); ++ } ++} ++ ++close PATCH if $patch_opened; ++ ++exit 0; ++ ++ ++sub try_use { eval "use @_;"; return $@ eq '' } ++ ++sub mydiff ++{ ++ local *F = shift; ++ my($file, $str) = @_; ++ my $diff; ++ ++ if (exists $opt{diff}) { ++ $diff = run_diff($opt{diff}, $file, $str); ++ } ++ ++ if (!defined $diff and try_use('Text::Diff')) { ++ $diff = Text::Diff::diff($file, \$str, { STYLE => 'Unified' }); ++ $diff = <
$tmp") { ++ print F $str; ++ close F; ++ ++ if (open F, "$prog $file $tmp |") { ++ while () { ++ s/\Q$tmp\E/$file.patched/; ++ $diff .= $_; ++ } ++ close F; ++ unlink $tmp; ++ return $diff; ++ } ++ ++ unlink $tmp; ++ } ++ else { ++ error("Cannot open '$tmp' for writing: $!"); ++ } ++ ++ return undef; ++} ++ ++sub rec_depend ++{ ++ my($func, $seen) = @_; ++ return () unless exists $depends{$func}; ++ $seen = {%{$seen||{}}}; ++ return () if $seen->{$func}++; ++ my %s; ++ grep !$s{$_}++, map { ($_, rec_depend($_, $seen)) } @{$depends{$func}}; ++} ++ ++sub parse_version ++{ ++ my $ver = shift; ++ ++ if ($ver =~ /^(\d+)\.(\d+)\.(\d+)$/) { ++ return ($1, $2, $3); ++ } ++ elsif ($ver !~ /^\d+\.[\d_]+$/) { ++ die "cannot parse version '$ver'\n"; ++ } ++ ++ $ver =~ s/_//g; ++ $ver =~ s/$/000000/; ++ ++ my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/; ++ ++ $v = int $v; ++ $s = int $s; ++ ++ if ($r < 5 || ($r == 5 && $v < 6)) { ++ if ($s % 10) { ++ die "cannot parse version '$ver'\n"; ++ } ++ } ++ ++ return ($r, $v, $s); ++} ++ ++sub format_version ++{ ++ my $ver = shift; ++ ++ $ver =~ s/$/000000/; ++ my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/; ++ ++ $v = int $v; ++ $s = int $s; ++ ++ if ($r < 5 || ($r == 5 && $v < 6)) { ++ if ($s % 10) { ++ die "invalid version '$ver'\n"; ++ } ++ $s /= 10; ++ ++ $ver = sprintf "%d.%03d", $r, $v; ++ $s > 0 and $ver .= sprintf "_%02d", $s; ++ ++ return $ver; ++ } ++ ++ return sprintf "%d.%d.%d", $r, $v, $s; ++} ++ ++sub info ++{ ++ $opt{quiet} and return; ++ print @_, "\n"; ++} ++ ++sub diag ++{ ++ $opt{quiet} and return; ++ $opt{diag} and print @_, "\n"; ++} ++ ++sub warning ++{ ++ $opt{quiet} and return; ++ print "*** ", @_, "\n"; ++} ++ ++sub error ++{ ++ print "*** ERROR: ", @_, "\n"; ++} ++ ++my %given_hints; ++my %given_warnings; ++sub hint ++{ ++ $opt{quiet} and return; ++ my $func = shift; ++ my $rv = 0; ++ if (exists $warnings{$func} && !$given_warnings{$func}++) { ++ my $warn = $warnings{$func}; ++ $warn =~ s!^!*** !mg; ++ print "*** WARNING: $func\n", $warn; ++ $rv++; ++ } ++ if ($opt{hints} && exists $hints{$func} && !$given_hints{$func}++) { ++ my $hint = $hints{$func}; ++ $hint =~ s/^/ /mg; ++ print " --- hint for $func ---\n", $hint; ++ } ++ $rv; ++} ++ ++sub usage ++{ ++ my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms; ++ my %M = ( 'I' => '*' ); ++ $usage =~ s/^\s*perl\s+\S+/$^X $0/; ++ $usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g; ++ ++ print < }; ++ my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms; ++ $copy =~ s/^(?=\S+)/ /gms; ++ $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms; ++ $self =~ s/^SKIP.*(?=^__DATA__)/SKIP ++if (\@ARGV && \$ARGV[0] eq '--unstrip') { ++ eval { require Devel::PPPort }; ++ \$@ and die "Cannot require Devel::PPPort, please install.\\n"; ++ if (eval \$Devel::PPPort::VERSION < $VERSION) { ++ die "$0 was originally generated with Devel::PPPort $VERSION.\\n" ++ . "Your Devel::PPPort is only version \$Devel::PPPort::VERSION.\\n" ++ . "Please install a newer version, or --unstrip will not work.\\n"; ++ } ++ Devel::PPPort::WriteFile(\$0); ++ exit 0; ++} ++print <$0" or die "cannot strip $0: $!\n"; ++ print OUT "$pl$c\n"; ++ ++ exit 0; ++} ++ ++__DATA__ ++*/ ++ ++#ifndef _P_P_PORTABILITY_H_ ++#define _P_P_PORTABILITY_H_ ++ ++#ifndef DPPP_NAMESPACE ++# define DPPP_NAMESPACE DPPP_ ++#endif ++ ++#define DPPP_CAT2(x,y) CAT2(x,y) ++#define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name) ++ ++#ifndef PERL_REVISION ++# if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION)) ++# define PERL_PATCHLEVEL_H_IMPLICIT ++# include ++# endif ++# if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL))) ++# include ++# endif ++# ifndef PERL_REVISION ++# define PERL_REVISION (5) ++ /* Replace: 1 */ ++# define PERL_VERSION PATCHLEVEL ++# define PERL_SUBVERSION SUBVERSION ++ /* Replace PERL_PATCHLEVEL with PERL_VERSION */ ++ /* Replace: 0 */ ++# endif ++#endif ++ ++#define _dpppDEC2BCD(dec) ((((dec)/100)<<8)|((((dec)%100)/10)<<4)|((dec)%10)) ++#define PERL_BCDVERSION ((_dpppDEC2BCD(PERL_REVISION)<<24)|(_dpppDEC2BCD(PERL_VERSION)<<12)|_dpppDEC2BCD(PERL_SUBVERSION)) ++ ++/* It is very unlikely that anyone will try to use this with Perl 6 ++ (or greater), but who knows. ++ */ ++#if PERL_REVISION != 5 ++# error ppport.h only works with Perl version 5 ++#endif /* PERL_REVISION != 5 */ ++#ifndef dTHR ++# define dTHR dNOOP ++#endif ++#ifndef dTHX ++# define dTHX dNOOP ++#endif ++ ++#ifndef dTHXa ++# define dTHXa(x) dNOOP ++#endif ++#ifndef pTHX ++# define pTHX void ++#endif ++ ++#ifndef pTHX_ ++# define pTHX_ ++#endif ++ ++#ifndef aTHX ++# define aTHX ++#endif ++ ++#ifndef aTHX_ ++# define aTHX_ ++#endif ++ ++#if (PERL_BCDVERSION < 0x5006000) ++# ifdef USE_THREADS ++# define aTHXR thr ++# define aTHXR_ thr, ++# else ++# define aTHXR ++# define aTHXR_ ++# endif ++# define dTHXR dTHR ++#else ++# define aTHXR aTHX ++# define aTHXR_ aTHX_ ++# define dTHXR dTHX ++#endif ++#ifndef dTHXoa ++# define dTHXoa(x) dTHXa(x) ++#endif ++ ++#ifdef I_LIMITS ++# include ++#endif ++ ++#ifndef PERL_UCHAR_MIN ++# define PERL_UCHAR_MIN ((unsigned char)0) ++#endif ++ ++#ifndef PERL_UCHAR_MAX ++# ifdef UCHAR_MAX ++# define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX) ++# else ++# ifdef MAXUCHAR ++# define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR) ++# else ++# define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0) ++# endif ++# endif ++#endif ++ ++#ifndef PERL_USHORT_MIN ++# define PERL_USHORT_MIN ((unsigned short)0) ++#endif ++ ++#ifndef PERL_USHORT_MAX ++# ifdef USHORT_MAX ++# define PERL_USHORT_MAX ((unsigned short)USHORT_MAX) ++# else ++# ifdef MAXUSHORT ++# define PERL_USHORT_MAX ((unsigned short)MAXUSHORT) ++# else ++# ifdef USHRT_MAX ++# define PERL_USHORT_MAX ((unsigned short)USHRT_MAX) ++# else ++# define PERL_USHORT_MAX ((unsigned short)~(unsigned)0) ++# endif ++# endif ++# endif ++#endif ++ ++#ifndef PERL_SHORT_MAX ++# ifdef SHORT_MAX ++# define PERL_SHORT_MAX ((short)SHORT_MAX) ++# else ++# ifdef MAXSHORT /* Often used in */ ++# define PERL_SHORT_MAX ((short)MAXSHORT) ++# else ++# ifdef SHRT_MAX ++# define PERL_SHORT_MAX ((short)SHRT_MAX) ++# else ++# define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1)) ++# endif ++# endif ++# endif ++#endif ++ ++#ifndef PERL_SHORT_MIN ++# ifdef SHORT_MIN ++# define PERL_SHORT_MIN ((short)SHORT_MIN) ++# else ++# ifdef MINSHORT ++# define PERL_SHORT_MIN ((short)MINSHORT) ++# else ++# ifdef SHRT_MIN ++# define PERL_SHORT_MIN ((short)SHRT_MIN) ++# else ++# define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3)) ++# endif ++# endif ++# endif ++#endif ++ ++#ifndef PERL_UINT_MAX ++# ifdef UINT_MAX ++# define PERL_UINT_MAX ((unsigned int)UINT_MAX) ++# else ++# ifdef MAXUINT ++# define PERL_UINT_MAX ((unsigned int)MAXUINT) ++# else ++# define PERL_UINT_MAX (~(unsigned int)0) ++# endif ++# endif ++#endif ++ ++#ifndef PERL_UINT_MIN ++# define PERL_UINT_MIN ((unsigned int)0) ++#endif ++ ++#ifndef PERL_INT_MAX ++# ifdef INT_MAX ++# define PERL_INT_MAX ((int)INT_MAX) ++# else ++# ifdef MAXINT /* Often used in */ ++# define PERL_INT_MAX ((int)MAXINT) ++# else ++# define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1)) ++# endif ++# endif ++#endif ++ ++#ifndef PERL_INT_MIN ++# ifdef INT_MIN ++# define PERL_INT_MIN ((int)INT_MIN) ++# else ++# ifdef MININT ++# define PERL_INT_MIN ((int)MININT) ++# else ++# define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3)) ++# endif ++# endif ++#endif ++ ++#ifndef PERL_ULONG_MAX ++# ifdef ULONG_MAX ++# define PERL_ULONG_MAX ((unsigned long)ULONG_MAX) ++# else ++# ifdef MAXULONG ++# define PERL_ULONG_MAX ((unsigned long)MAXULONG) ++# else ++# define PERL_ULONG_MAX (~(unsigned long)0) ++# endif ++# endif ++#endif ++ ++#ifndef PERL_ULONG_MIN ++# define PERL_ULONG_MIN ((unsigned long)0L) ++#endif ++ ++#ifndef PERL_LONG_MAX ++# ifdef LONG_MAX ++# define PERL_LONG_MAX ((long)LONG_MAX) ++# else ++# ifdef MAXLONG ++# define PERL_LONG_MAX ((long)MAXLONG) ++# else ++# define PERL_LONG_MAX ((long) (PERL_ULONG_MAX >> 1)) ++# endif ++# endif ++#endif ++ ++#ifndef PERL_LONG_MIN ++# ifdef LONG_MIN ++# define PERL_LONG_MIN ((long)LONG_MIN) ++# else ++# ifdef MINLONG ++# define PERL_LONG_MIN ((long)MINLONG) ++# else ++# define PERL_LONG_MIN (-PERL_LONG_MAX - ((3 & -1) == 3)) ++# endif ++# endif ++#endif ++ ++#if defined(HAS_QUAD) && (defined(convex) || defined(uts)) ++# ifndef PERL_UQUAD_MAX ++# ifdef ULONGLONG_MAX ++# define PERL_UQUAD_MAX ((unsigned long long)ULONGLONG_MAX) ++# else ++# ifdef MAXULONGLONG ++# define PERL_UQUAD_MAX ((unsigned long long)MAXULONGLONG) ++# else ++# define PERL_UQUAD_MAX (~(unsigned long long)0) ++# endif ++# endif ++# endif ++ ++# ifndef PERL_UQUAD_MIN ++# define PERL_UQUAD_MIN ((unsigned long long)0L) ++# endif ++ ++# ifndef PERL_QUAD_MAX ++# ifdef LONGLONG_MAX ++# define PERL_QUAD_MAX ((long long)LONGLONG_MAX) ++# else ++# ifdef MAXLONGLONG ++# define PERL_QUAD_MAX ((long long)MAXLONGLONG) ++# else ++# define PERL_QUAD_MAX ((long long) (PERL_UQUAD_MAX >> 1)) ++# endif ++# endif ++# endif ++ ++# ifndef PERL_QUAD_MIN ++# ifdef LONGLONG_MIN ++# define PERL_QUAD_MIN ((long long)LONGLONG_MIN) ++# else ++# ifdef MINLONGLONG ++# define PERL_QUAD_MIN ((long long)MINLONGLONG) ++# else ++# define PERL_QUAD_MIN (-PERL_QUAD_MAX - ((3 & -1) == 3)) ++# endif ++# endif ++# endif ++#endif ++ ++/* This is based on code from 5.003 perl.h */ ++#ifdef HAS_QUAD ++# ifdef cray ++#ifndef IVTYPE ++# define IVTYPE int ++#endif ++ ++#ifndef IV_MIN ++# define IV_MIN PERL_INT_MIN ++#endif ++ ++#ifndef IV_MAX ++# define IV_MAX PERL_INT_MAX ++#endif ++ ++#ifndef UV_MIN ++# define UV_MIN PERL_UINT_MIN ++#endif ++ ++#ifndef UV_MAX ++# define UV_MAX PERL_UINT_MAX ++#endif ++ ++# ifdef INTSIZE ++#ifndef IVSIZE ++# define IVSIZE INTSIZE ++#endif ++ ++# endif ++# else ++# if defined(convex) || defined(uts) ++#ifndef IVTYPE ++# define IVTYPE long long ++#endif ++ ++#ifndef IV_MIN ++# define IV_MIN PERL_QUAD_MIN ++#endif ++ ++#ifndef IV_MAX ++# define IV_MAX PERL_QUAD_MAX ++#endif ++ ++#ifndef UV_MIN ++# define UV_MIN PERL_UQUAD_MIN ++#endif ++ ++#ifndef UV_MAX ++# define UV_MAX PERL_UQUAD_MAX ++#endif ++ ++# ifdef LONGLONGSIZE ++#ifndef IVSIZE ++# define IVSIZE LONGLONGSIZE ++#endif ++ ++# endif ++# else ++#ifndef IVTYPE ++# define IVTYPE long ++#endif ++ ++#ifndef IV_MIN ++# define IV_MIN PERL_LONG_MIN ++#endif ++ ++#ifndef IV_MAX ++# define IV_MAX PERL_LONG_MAX ++#endif ++ ++#ifndef UV_MIN ++# define UV_MIN PERL_ULONG_MIN ++#endif ++ ++#ifndef UV_MAX ++# define UV_MAX PERL_ULONG_MAX ++#endif ++ ++# ifdef LONGSIZE ++#ifndef IVSIZE ++# define IVSIZE LONGSIZE ++#endif ++ ++# endif ++# endif ++# endif ++#ifndef IVSIZE ++# define IVSIZE 8 ++#endif ++ ++#ifndef LONGSIZE ++# define LONGSIZE 8 ++#endif ++ ++#ifndef PERL_QUAD_MIN ++# define PERL_QUAD_MIN IV_MIN ++#endif ++ ++#ifndef PERL_QUAD_MAX ++# define PERL_QUAD_MAX IV_MAX ++#endif ++ ++#ifndef PERL_UQUAD_MIN ++# define PERL_UQUAD_MIN UV_MIN ++#endif ++ ++#ifndef PERL_UQUAD_MAX ++# define PERL_UQUAD_MAX UV_MAX ++#endif ++ ++#else ++#ifndef IVTYPE ++# define IVTYPE long ++#endif ++ ++#ifndef LONGSIZE ++# define LONGSIZE 4 ++#endif ++ ++#ifndef IV_MIN ++# define IV_MIN PERL_LONG_MIN ++#endif ++ ++#ifndef IV_MAX ++# define IV_MAX PERL_LONG_MAX ++#endif ++ ++#ifndef UV_MIN ++# define UV_MIN PERL_ULONG_MIN ++#endif ++ ++#ifndef UV_MAX ++# define UV_MAX PERL_ULONG_MAX ++#endif ++ ++#endif ++ ++#ifndef IVSIZE ++# ifdef LONGSIZE ++# define IVSIZE LONGSIZE ++# else ++# define IVSIZE 4 /* A bold guess, but the best we can make. */ ++# endif ++#endif ++#ifndef UVTYPE ++# define UVTYPE unsigned IVTYPE ++#endif ++ ++#ifndef UVSIZE ++# define UVSIZE IVSIZE ++#endif ++#ifndef sv_setuv ++# define sv_setuv(sv, uv) \ ++ STMT_START { \ ++ UV TeMpUv = uv; \ ++ if (TeMpUv <= IV_MAX) \ ++ sv_setiv(sv, TeMpUv); \ ++ else \ ++ sv_setnv(sv, (double)TeMpUv); \ ++ } STMT_END ++#endif ++#ifndef newSVuv ++# define newSVuv(uv) ((uv) <= IV_MAX ? newSViv((IV)uv) : newSVnv((NV)uv)) ++#endif ++#ifndef sv_2uv ++# define sv_2uv(sv) ((PL_Sv = (sv)), (UV) (SvNOK(PL_Sv) ? SvNV(PL_Sv) : sv_2nv(PL_Sv))) ++#endif ++ ++#ifndef SvUVX ++# define SvUVX(sv) ((UV)SvIVX(sv)) ++#endif ++ ++#ifndef SvUVXx ++# define SvUVXx(sv) SvUVX(sv) ++#endif ++ ++#ifndef SvUV ++# define SvUV(sv) (SvIOK(sv) ? SvUVX(sv) : sv_2uv(sv)) ++#endif ++ ++#ifndef SvUVx ++# define SvUVx(sv) ((PL_Sv = (sv)), SvUV(PL_Sv)) ++#endif ++ ++/* Hint: sv_uv ++ * Always use the SvUVx() macro instead of sv_uv(). ++ */ ++#ifndef sv_uv ++# define sv_uv(sv) SvUVx(sv) ++#endif ++ ++#if !defined(SvUOK) && defined(SvIOK_UV) ++# define SvUOK(sv) SvIOK_UV(sv) ++#endif ++#ifndef XST_mUV ++# define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) ) ++#endif ++ ++#ifndef XSRETURN_UV ++# define XSRETURN_UV(v) STMT_START { XST_mUV(0,v); XSRETURN(1); } STMT_END ++#endif ++#ifndef PUSHu ++# define PUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG; } STMT_END ++#endif ++ ++#ifndef XPUSHu ++# define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END ++#endif ++ ++#ifdef HAS_MEMCMP ++#ifndef memNE ++# define memNE(s1,s2,l) (memcmp(s1,s2,l)) ++#endif ++ ++#ifndef memEQ ++# define memEQ(s1,s2,l) (!memcmp(s1,s2,l)) ++#endif ++ ++#else ++#ifndef memNE ++# define memNE(s1,s2,l) (bcmp(s1,s2,l)) ++#endif ++ ++#ifndef memEQ ++# define memEQ(s1,s2,l) (!bcmp(s1,s2,l)) ++#endif ++ ++#endif ++#ifndef memEQs ++# define memEQs(s1, l, s2) \ ++ (sizeof(s2)-1 == l && memEQ(s1, (s2 ""), (sizeof(s2)-1))) ++#endif ++ ++#ifndef memNEs ++# define memNEs(s1, l, s2) !memEQs(s1, l, s2) ++#endif ++#ifndef MoveD ++# define MoveD(s,d,n,t) memmove((char*)(d),(char*)(s), (n) * sizeof(t)) ++#endif ++ ++#ifndef CopyD ++# define CopyD(s,d,n,t) memcpy((char*)(d),(char*)(s), (n) * sizeof(t)) ++#endif ++ ++#ifdef HAS_MEMSET ++#ifndef ZeroD ++# define ZeroD(d,n,t) memzero((char*)(d), (n) * sizeof(t)) ++#endif ++ ++#else ++#ifndef ZeroD ++# define ZeroD(d,n,t) ((void)memzero((char*)(d), (n) * sizeof(t)), d) ++#endif ++ ++#endif ++#ifndef PoisonWith ++# define PoisonWith(d,n,t,b) (void)memset((char*)(d), (U8)(b), (n) * sizeof(t)) ++#endif ++ ++#ifndef PoisonNew ++# define PoisonNew(d,n,t) PoisonWith(d,n,t,0xAB) ++#endif ++ ++#ifndef PoisonFree ++# define PoisonFree(d,n,t) PoisonWith(d,n,t,0xEF) ++#endif ++ ++#ifndef Poison ++# define Poison(d,n,t) PoisonFree(d,n,t) ++#endif ++#ifndef Newx ++# define Newx(v,n,t) New(0,v,n,t) ++#endif ++ ++#ifndef Newxc ++# define Newxc(v,n,t,c) Newc(0,v,n,t,c) ++#endif ++ ++#ifndef Newxz ++# define Newxz(v,n,t) Newz(0,v,n,t) ++#endif ++ ++#ifndef PERL_UNUSED_DECL ++# ifdef HASATTRIBUTE ++# if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER) ++# define PERL_UNUSED_DECL ++# else ++# define PERL_UNUSED_DECL __attribute__((unused)) ++# endif ++# else ++# define PERL_UNUSED_DECL ++# endif ++#endif ++ ++#ifndef PERL_UNUSED_ARG ++# if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */ ++# include ++# define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x)) ++# else ++# define PERL_UNUSED_ARG(x) ((void)x) ++# endif ++#endif ++ ++#ifndef PERL_UNUSED_VAR ++# define PERL_UNUSED_VAR(x) ((void)x) ++#endif ++ ++#ifndef PERL_UNUSED_CONTEXT ++# ifdef USE_ITHREADS ++# define PERL_UNUSED_CONTEXT PERL_UNUSED_ARG(my_perl) ++# else ++# define PERL_UNUSED_CONTEXT ++# endif ++#endif ++#ifndef NOOP ++# define NOOP /*EMPTY*/(void)0 ++#endif ++ ++#ifndef dNOOP ++# define dNOOP extern int /*@unused@*/ Perl___notused PERL_UNUSED_DECL ++#endif ++ ++#ifndef NVTYPE ++# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) ++# define NVTYPE long double ++# else ++# define NVTYPE double ++# endif ++typedef NVTYPE NV; ++#endif ++ ++#ifndef INT2PTR ++# if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE) ++# define PTRV UV ++# define INT2PTR(any,d) (any)(d) ++# else ++# if PTRSIZE == LONGSIZE ++# define PTRV unsigned long ++# else ++# define PTRV unsigned ++# endif ++# define INT2PTR(any,d) (any)(PTRV)(d) ++# endif ++#endif ++ ++#ifndef PTR2ul ++# if PTRSIZE == LONGSIZE ++# define PTR2ul(p) (unsigned long)(p) ++# else ++# define PTR2ul(p) INT2PTR(unsigned long,p) ++# endif ++#endif ++#ifndef PTR2nat ++# define PTR2nat(p) (PTRV)(p) ++#endif ++ ++#ifndef NUM2PTR ++# define NUM2PTR(any,d) (any)PTR2nat(d) ++#endif ++ ++#ifndef PTR2IV ++# define PTR2IV(p) INT2PTR(IV,p) ++#endif ++ ++#ifndef PTR2UV ++# define PTR2UV(p) INT2PTR(UV,p) ++#endif ++ ++#ifndef PTR2NV ++# define PTR2NV(p) NUM2PTR(NV,p) ++#endif ++ ++#undef START_EXTERN_C ++#undef END_EXTERN_C ++#undef EXTERN_C ++#ifdef __cplusplus ++# define START_EXTERN_C extern "C" { ++# define END_EXTERN_C } ++# define EXTERN_C extern "C" ++#else ++# define START_EXTERN_C ++# define END_EXTERN_C ++# define EXTERN_C extern ++#endif ++ ++#if defined(PERL_GCC_PEDANTIC) ++# ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN ++# define PERL_GCC_BRACE_GROUPS_FORBIDDEN ++# endif ++#endif ++ ++#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus) ++# ifndef PERL_USE_GCC_BRACE_GROUPS ++# define PERL_USE_GCC_BRACE_GROUPS ++# endif ++#endif ++ ++#undef STMT_START ++#undef STMT_END ++#ifdef PERL_USE_GCC_BRACE_GROUPS ++# define STMT_START (void)( /* gcc supports ``({ STATEMENTS; })'' */ ++# define STMT_END ) ++#else ++# if defined(VOIDFLAGS) && (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__) ++# define STMT_START if (1) ++# define STMT_END else (void)0 ++# else ++# define STMT_START do ++# define STMT_END while (0) ++# endif ++#endif ++#ifndef boolSV ++# define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no) ++#endif ++ ++/* DEFSV appears first in 5.004_56 */ ++#ifndef DEFSV ++# define DEFSV GvSV(PL_defgv) ++#endif ++ ++#ifndef SAVE_DEFSV ++# define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv)) ++#endif ++ ++#ifndef DEFSV_set ++# define DEFSV_set(sv) (DEFSV = (sv)) ++#endif ++ ++/* Older perls (<=5.003) lack AvFILLp */ ++#ifndef AvFILLp ++# define AvFILLp AvFILL ++#endif ++#ifndef ERRSV ++# define ERRSV get_sv("@",FALSE) ++#endif ++ ++/* Hint: gv_stashpvn ++ * This function's backport doesn't support the length parameter, but ++ * rather ignores it. Portability can only be ensured if the length ++ * parameter is used for speed reasons, but the length can always be ++ * correctly computed from the string argument. ++ */ ++#ifndef gv_stashpvn ++# define gv_stashpvn(str,len,create) gv_stashpv(str,create) ++#endif ++ ++/* Replace: 1 */ ++#ifndef get_cv ++# define get_cv perl_get_cv ++#endif ++ ++#ifndef get_sv ++# define get_sv perl_get_sv ++#endif ++ ++#ifndef get_av ++# define get_av perl_get_av ++#endif ++ ++#ifndef get_hv ++# define get_hv perl_get_hv ++#endif ++ ++/* Replace: 0 */ ++#ifndef dUNDERBAR ++# define dUNDERBAR dNOOP ++#endif ++ ++#ifndef UNDERBAR ++# define UNDERBAR DEFSV ++#endif ++#ifndef dAX ++# define dAX I32 ax = MARK - PL_stack_base + 1 ++#endif ++ ++#ifndef dITEMS ++# define dITEMS I32 items = SP - MARK ++#endif ++#ifndef dXSTARG ++# define dXSTARG SV * targ = sv_newmortal() ++#endif ++#ifndef dAXMARK ++# define dAXMARK I32 ax = POPMARK; \ ++ register SV ** const mark = PL_stack_base + ax++ ++#endif ++#ifndef XSprePUSH ++# define XSprePUSH (sp = PL_stack_base + ax - 1) ++#endif ++ ++#if (PERL_BCDVERSION < 0x5005000) ++# undef XSRETURN ++# define XSRETURN(off) \ ++ STMT_START { \ ++ PL_stack_sp = PL_stack_base + ax + ((off) - 1); \ ++ return; \ ++ } STMT_END ++#endif ++#ifndef XSPROTO ++# define XSPROTO(name) void name(pTHX_ CV* cv) ++#endif ++ ++#ifndef SVfARG ++# define SVfARG(p) ((void*)(p)) ++#endif ++#ifndef PERL_ABS ++# define PERL_ABS(x) ((x) < 0 ? -(x) : (x)) ++#endif ++#ifndef dVAR ++# define dVAR dNOOP ++#endif ++#ifndef SVf ++# define SVf "_" ++#endif ++#ifndef UTF8_MAXBYTES ++# define UTF8_MAXBYTES UTF8_MAXLEN ++#endif ++#ifndef CPERLscope ++# define CPERLscope(x) x ++#endif ++#ifndef PERL_HASH ++# define PERL_HASH(hash,str,len) \ ++ STMT_START { \ ++ const char *s_PeRlHaSh = str; \ ++ I32 i_PeRlHaSh = len; \ ++ U32 hash_PeRlHaSh = 0; \ ++ while (i_PeRlHaSh--) \ ++ hash_PeRlHaSh = hash_PeRlHaSh * 33 + *s_PeRlHaSh++; \ ++ (hash) = hash_PeRlHaSh; \ ++ } STMT_END ++#endif ++ ++#ifndef PERLIO_FUNCS_DECL ++# ifdef PERLIO_FUNCS_CONST ++# define PERLIO_FUNCS_DECL(funcs) const PerlIO_funcs funcs ++# define PERLIO_FUNCS_CAST(funcs) (PerlIO_funcs*)(funcs) ++# else ++# define PERLIO_FUNCS_DECL(funcs) PerlIO_funcs funcs ++# define PERLIO_FUNCS_CAST(funcs) (funcs) ++# endif ++#endif ++ ++/* provide these typedefs for older perls */ ++#if (PERL_BCDVERSION < 0x5009003) ++ ++# ifdef ARGSproto ++typedef OP* (CPERLscope(*Perl_ppaddr_t))(ARGSproto); ++# else ++typedef OP* (CPERLscope(*Perl_ppaddr_t))(pTHX); ++# endif ++ ++typedef OP* (CPERLscope(*Perl_check_t)) (pTHX_ OP*); ++ ++#endif ++#ifndef isPSXSPC ++# define isPSXSPC(c) (isSPACE(c) || (c) == '\v') ++#endif ++ ++#ifndef isBLANK ++# define isBLANK(c) ((c) == ' ' || (c) == '\t') ++#endif ++ ++#ifdef EBCDIC ++#ifndef isALNUMC ++# define isALNUMC(c) isalnum(c) ++#endif ++ ++#ifndef isASCII ++# define isASCII(c) isascii(c) ++#endif ++ ++#ifndef isCNTRL ++# define isCNTRL(c) iscntrl(c) ++#endif ++ ++#ifndef isGRAPH ++# define isGRAPH(c) isgraph(c) ++#endif ++ ++#ifndef isPRINT ++# define isPRINT(c) isprint(c) ++#endif ++ ++#ifndef isPUNCT ++# define isPUNCT(c) ispunct(c) ++#endif ++ ++#ifndef isXDIGIT ++# define isXDIGIT(c) isxdigit(c) ++#endif ++ ++#else ++# if (PERL_BCDVERSION < 0x5010000) ++/* Hint: isPRINT ++ * The implementation in older perl versions includes all of the ++ * isSPACE() characters, which is wrong. The version provided by ++ * Devel::PPPort always overrides a present buggy version. ++ */ ++# undef isPRINT ++# endif ++ ++#ifdef HAS_QUAD ++# define WIDEST_UTYPE U64TYPE ++#else ++# define WIDEST_UTYPE U32 ++#endif ++#ifndef isALNUMC ++# define isALNUMC(c) (isALPHA(c) || isDIGIT(c)) ++#endif ++ ++#ifndef isASCII ++# define isASCII(c) ((WIDEST_UTYPE) (c) <= 127) ++#endif ++ ++#ifndef isCNTRL ++# define isCNTRL(c) ((WIDEST_UTYPE) (c) < ' ' || (c) == 127) ++#endif ++ ++#ifndef isGRAPH ++# define isGRAPH(c) (isALNUM(c) || isPUNCT(c)) ++#endif ++ ++#ifndef isPRINT ++# define isPRINT(c) (((c) >= 32 && (c) < 127)) ++#endif ++ ++#ifndef isPUNCT ++# define isPUNCT(c) (((c) >= 33 && (c) <= 47) || ((c) >= 58 && (c) <= 64) || ((c) >= 91 && (c) <= 96) || ((c) >= 123 && (c) <= 126)) ++#endif ++ ++#ifndef isXDIGIT ++# define isXDIGIT(c) (isDIGIT(c) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) ++#endif ++ ++#endif ++ ++#ifndef PERL_SIGNALS_UNSAFE_FLAG ++ ++#define PERL_SIGNALS_UNSAFE_FLAG 0x0001 ++ ++#if (PERL_BCDVERSION < 0x5008000) ++# define D_PPP_PERL_SIGNALS_INIT PERL_SIGNALS_UNSAFE_FLAG ++#else ++# define D_PPP_PERL_SIGNALS_INIT 0 ++#endif ++ ++#if defined(NEED_PL_signals) ++static U32 DPPP_(my_PL_signals) = D_PPP_PERL_SIGNALS_INIT; ++#elif defined(NEED_PL_signals_GLOBAL) ++U32 DPPP_(my_PL_signals) = D_PPP_PERL_SIGNALS_INIT; ++#else ++extern U32 DPPP_(my_PL_signals); ++#endif ++#define PL_signals DPPP_(my_PL_signals) ++ ++#endif ++ ++/* Hint: PL_ppaddr ++ * Calling an op via PL_ppaddr requires passing a context argument ++ * for threaded builds. Since the context argument is different for ++ * 5.005 perls, you can use aTHXR (supplied by ppport.h), which will ++ * automatically be defined as the correct argument. ++ */ ++ ++#if (PERL_BCDVERSION <= 0x5005005) ++/* Replace: 1 */ ++# define PL_ppaddr ppaddr ++# define PL_no_modify no_modify ++/* Replace: 0 */ ++#endif ++ ++#if (PERL_BCDVERSION <= 0x5004005) ++/* Replace: 1 */ ++# define PL_DBsignal DBsignal ++# define PL_DBsingle DBsingle ++# define PL_DBsub DBsub ++# define PL_DBtrace DBtrace ++# define PL_Sv Sv ++# define PL_bufend bufend ++# define PL_bufptr bufptr ++# define PL_compiling compiling ++# define PL_copline copline ++# define PL_curcop curcop ++# define PL_curstash curstash ++# define PL_debstash debstash ++# define PL_defgv defgv ++# define PL_diehook diehook ++# define PL_dirty dirty ++# define PL_dowarn dowarn ++# define PL_errgv errgv ++# define PL_error_count error_count ++# define PL_expect expect ++# define PL_hexdigit hexdigit ++# define PL_hints hints ++# define PL_in_my in_my ++# define PL_laststatval laststatval ++# define PL_lex_state lex_state ++# define PL_lex_stuff lex_stuff ++# define PL_linestr linestr ++# define PL_na na ++# define PL_perl_destruct_level perl_destruct_level ++# define PL_perldb perldb ++# define PL_rsfp_filters rsfp_filters ++# define PL_rsfp rsfp ++# define PL_stack_base stack_base ++# define PL_stack_sp stack_sp ++# define PL_statcache statcache ++# define PL_stdingv stdingv ++# define PL_sv_arenaroot sv_arenaroot ++# define PL_sv_no sv_no ++# define PL_sv_undef sv_undef ++# define PL_sv_yes sv_yes ++# define PL_tainted tainted ++# define PL_tainting tainting ++# define PL_tokenbuf tokenbuf ++/* Replace: 0 */ ++#endif ++ ++/* Warning: PL_parser ++ * For perl versions earlier than 5.9.5, this is an always ++ * non-NULL dummy. Also, it cannot be dereferenced. Don't ++ * use it if you can avoid is and unless you absolutely know ++ * what you're doing. ++ * If you always check that PL_parser is non-NULL, you can ++ * define DPPP_PL_parser_NO_DUMMY to avoid the creation of ++ * a dummy parser structure. ++ */ ++ ++#if (PERL_BCDVERSION >= 0x5009005) ++# ifdef DPPP_PL_parser_NO_DUMMY ++# define D_PPP_my_PL_parser_var(var) ((PL_parser ? PL_parser : \ ++ (croak("panic: PL_parser == NULL in %s:%d", \ ++ __FILE__, __LINE__), (yy_parser *) NULL))->var) ++# else ++# ifdef DPPP_PL_parser_NO_DUMMY_WARNING ++# define D_PPP_parser_dummy_warning(var) ++# else ++# define D_PPP_parser_dummy_warning(var) \ ++ warn("warning: dummy PL_" #var " used in %s:%d", __FILE__, __LINE__), ++# endif ++# define D_PPP_my_PL_parser_var(var) ((PL_parser ? PL_parser : \ ++ (D_PPP_parser_dummy_warning(var) &DPPP_(dummy_PL_parser)))->var) ++#if defined(NEED_PL_parser) ++static yy_parser DPPP_(dummy_PL_parser); ++#elif defined(NEED_PL_parser_GLOBAL) ++yy_parser DPPP_(dummy_PL_parser); ++#else ++extern yy_parser DPPP_(dummy_PL_parser); ++#endif ++ ++# endif ++ ++/* PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf depends on PL_parser */ ++/* Warning: PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf ++ * Do not use this variable unless you know exactly what you're ++ * doint. It is internal to the perl parser and may change or even ++ * be removed in the future. As of perl 5.9.5, you have to check ++ * for (PL_parser != NULL) for this variable to have any effect. ++ * An always non-NULL PL_parser dummy is provided for earlier ++ * perl versions. ++ * If PL_parser is NULL when you try to access this variable, a ++ * dummy is being accessed instead and a warning is issued unless ++ * you define DPPP_PL_parser_NO_DUMMY_WARNING. ++ * If DPPP_PL_parser_NO_DUMMY is defined, the code trying to access ++ * this variable will croak with a panic message. ++ */ ++ ++# define PL_expect D_PPP_my_PL_parser_var(expect) ++# define PL_copline D_PPP_my_PL_parser_var(copline) ++# define PL_rsfp D_PPP_my_PL_parser_var(rsfp) ++# define PL_rsfp_filters D_PPP_my_PL_parser_var(rsfp_filters) ++# define PL_linestr D_PPP_my_PL_parser_var(linestr) ++# define PL_bufptr D_PPP_my_PL_parser_var(bufptr) ++# define PL_bufend D_PPP_my_PL_parser_var(bufend) ++# define PL_lex_state D_PPP_my_PL_parser_var(lex_state) ++# define PL_lex_stuff D_PPP_my_PL_parser_var(lex_stuff) ++# define PL_tokenbuf D_PPP_my_PL_parser_var(tokenbuf) ++# define PL_in_my D_PPP_my_PL_parser_var(in_my) ++# define PL_in_my_stash D_PPP_my_PL_parser_var(in_my_stash) ++# define PL_error_count D_PPP_my_PL_parser_var(error_count) ++ ++ ++#else ++ ++/* ensure that PL_parser != NULL and cannot be dereferenced */ ++# define PL_parser ((void *) 1) ++ ++#endif ++#ifndef mPUSHs ++# define mPUSHs(s) PUSHs(sv_2mortal(s)) ++#endif ++ ++#ifndef PUSHmortal ++# define PUSHmortal PUSHs(sv_newmortal()) ++#endif ++ ++#ifndef mPUSHp ++# define mPUSHp(p,l) sv_setpvn(PUSHmortal, (p), (l)) ++#endif ++ ++#ifndef mPUSHn ++# define mPUSHn(n) sv_setnv(PUSHmortal, (NV)(n)) ++#endif ++ ++#ifndef mPUSHi ++# define mPUSHi(i) sv_setiv(PUSHmortal, (IV)(i)) ++#endif ++ ++#ifndef mPUSHu ++# define mPUSHu(u) sv_setuv(PUSHmortal, (UV)(u)) ++#endif ++#ifndef mXPUSHs ++# define mXPUSHs(s) XPUSHs(sv_2mortal(s)) ++#endif ++ ++#ifndef XPUSHmortal ++# define XPUSHmortal XPUSHs(sv_newmortal()) ++#endif ++ ++#ifndef mXPUSHp ++# define mXPUSHp(p,l) STMT_START { EXTEND(sp,1); sv_setpvn(PUSHmortal, (p), (l)); } STMT_END ++#endif ++ ++#ifndef mXPUSHn ++# define mXPUSHn(n) STMT_START { EXTEND(sp,1); sv_setnv(PUSHmortal, (NV)(n)); } STMT_END ++#endif ++ ++#ifndef mXPUSHi ++# define mXPUSHi(i) STMT_START { EXTEND(sp,1); sv_setiv(PUSHmortal, (IV)(i)); } STMT_END ++#endif ++ ++#ifndef mXPUSHu ++# define mXPUSHu(u) STMT_START { EXTEND(sp,1); sv_setuv(PUSHmortal, (UV)(u)); } STMT_END ++#endif ++ ++/* Replace: 1 */ ++#ifndef call_sv ++# define call_sv perl_call_sv ++#endif ++ ++#ifndef call_pv ++# define call_pv perl_call_pv ++#endif ++ ++#ifndef call_argv ++# define call_argv perl_call_argv ++#endif ++ ++#ifndef call_method ++# define call_method perl_call_method ++#endif ++#ifndef eval_sv ++# define eval_sv perl_eval_sv ++#endif ++ ++/* Replace: 0 */ ++#ifndef PERL_LOADMOD_DENY ++# define PERL_LOADMOD_DENY 0x1 ++#endif ++ ++#ifndef PERL_LOADMOD_NOIMPORT ++# define PERL_LOADMOD_NOIMPORT 0x2 ++#endif ++ ++#ifndef PERL_LOADMOD_IMPORT_OPS ++# define PERL_LOADMOD_IMPORT_OPS 0x4 ++#endif ++ ++#ifndef G_METHOD ++# define G_METHOD 64 ++# ifdef call_sv ++# undef call_sv ++# endif ++# if (PERL_BCDVERSION < 0x5006000) ++# define call_sv(sv, flags) ((flags) & G_METHOD ? perl_call_method((char *) SvPV_nolen_const(sv), \ ++ (flags) & ~G_METHOD) : perl_call_sv(sv, flags)) ++# else ++# define call_sv(sv, flags) ((flags) & G_METHOD ? Perl_call_method(aTHX_ (char *) SvPV_nolen_const(sv), \ ++ (flags) & ~G_METHOD) : Perl_call_sv(aTHX_ sv, flags)) ++# endif ++#endif ++ ++/* Replace perl_eval_pv with eval_pv */ ++ ++#ifndef eval_pv ++#if defined(NEED_eval_pv) ++static SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error); ++static ++#else ++extern SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error); ++#endif ++ ++#ifdef eval_pv ++# undef eval_pv ++#endif ++#define eval_pv(a,b) DPPP_(my_eval_pv)(aTHX_ a,b) ++#define Perl_eval_pv DPPP_(my_eval_pv) ++ ++#if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL) ++ ++SV* ++DPPP_(my_eval_pv)(char *p, I32 croak_on_error) ++{ ++ dSP; ++ SV* sv = newSVpv(p, 0); ++ ++ PUSHMARK(sp); ++ eval_sv(sv, G_SCALAR); ++ SvREFCNT_dec(sv); ++ ++ SPAGAIN; ++ sv = POPs; ++ PUTBACK; ++ ++ if (croak_on_error && SvTRUE(GvSV(errgv))) ++ croak(SvPVx(GvSV(errgv), na)); ++ ++ return sv; ++} ++ ++#endif ++#endif ++ ++#ifndef vload_module ++#if defined(NEED_vload_module) ++static void DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args); ++static ++#else ++extern void DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args); ++#endif ++ ++#ifdef vload_module ++# undef vload_module ++#endif ++#define vload_module(a,b,c,d) DPPP_(my_vload_module)(aTHX_ a,b,c,d) ++#define Perl_vload_module DPPP_(my_vload_module) ++ ++#if defined(NEED_vload_module) || defined(NEED_vload_module_GLOBAL) ++ ++void ++DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args) ++{ ++ dTHR; ++ dVAR; ++ OP *veop, *imop; ++ ++ OP * const modname = newSVOP(OP_CONST, 0, name); ++ /* 5.005 has a somewhat hacky force_normal that doesn't croak on ++ SvREADONLY() if PL_compling is true. Current perls take care in ++ ck_require() to correctly turn off SvREADONLY before calling ++ force_normal_flags(). This seems a better fix than fudging PL_compling ++ */ ++ SvREADONLY_off(((SVOP*)modname)->op_sv); ++ modname->op_private |= OPpCONST_BARE; ++ if (ver) { ++ veop = newSVOP(OP_CONST, 0, ver); ++ } ++ else ++ veop = NULL; ++ if (flags & PERL_LOADMOD_NOIMPORT) { ++ imop = sawparens(newNULLLIST()); ++ } ++ else if (flags & PERL_LOADMOD_IMPORT_OPS) { ++ imop = va_arg(*args, OP*); ++ } ++ else { ++ SV *sv; ++ imop = NULL; ++ sv = va_arg(*args, SV*); ++ while (sv) { ++ imop = append_elem(OP_LIST, imop, newSVOP(OP_CONST, 0, sv)); ++ sv = va_arg(*args, SV*); ++ } ++ } ++ { ++ const line_t ocopline = PL_copline; ++ COP * const ocurcop = PL_curcop; ++ const int oexpect = PL_expect; ++ ++#if (PERL_BCDVERSION >= 0x5004000) ++ utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(FALSE, 0), ++ veop, modname, imop); ++#else ++ utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(), ++ modname, imop); ++#endif ++ PL_expect = oexpect; ++ PL_copline = ocopline; ++ PL_curcop = ocurcop; ++ } ++} ++ ++#endif ++#endif ++ ++#ifndef load_module ++#if defined(NEED_load_module) ++static void DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...); ++static ++#else ++extern void DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...); ++#endif ++ ++#ifdef load_module ++# undef load_module ++#endif ++#define load_module DPPP_(my_load_module) ++#define Perl_load_module DPPP_(my_load_module) ++ ++#if defined(NEED_load_module) || defined(NEED_load_module_GLOBAL) ++ ++void ++DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...) ++{ ++ va_list args; ++ va_start(args, ver); ++ vload_module(flags, name, ver, &args); ++ va_end(args); ++} ++ ++#endif ++#endif ++#ifndef newRV_inc ++# define newRV_inc(sv) newRV(sv) /* Replace */ ++#endif ++ ++#ifndef newRV_noinc ++#if defined(NEED_newRV_noinc) ++static SV * DPPP_(my_newRV_noinc)(SV *sv); ++static ++#else ++extern SV * DPPP_(my_newRV_noinc)(SV *sv); ++#endif ++ ++#ifdef newRV_noinc ++# undef newRV_noinc ++#endif ++#define newRV_noinc(a) DPPP_(my_newRV_noinc)(aTHX_ a) ++#define Perl_newRV_noinc DPPP_(my_newRV_noinc) ++ ++#if defined(NEED_newRV_noinc) || defined(NEED_newRV_noinc_GLOBAL) ++SV * ++DPPP_(my_newRV_noinc)(SV *sv) ++{ ++ SV *rv = (SV *)newRV(sv); ++ SvREFCNT_dec(sv); ++ return rv; ++} ++#endif ++#endif ++ ++/* Hint: newCONSTSUB ++ * Returns a CV* as of perl-5.7.1. This return value is not supported ++ * by Devel::PPPort. ++ */ ++ ++/* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */ ++#if (PERL_BCDVERSION < 0x5004063) && (PERL_BCDVERSION != 0x5004005) ++#if defined(NEED_newCONSTSUB) ++static void DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv); ++static ++#else ++extern void DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv); ++#endif ++ ++#ifdef newCONSTSUB ++# undef newCONSTSUB ++#endif ++#define newCONSTSUB(a,b,c) DPPP_(my_newCONSTSUB)(aTHX_ a,b,c) ++#define Perl_newCONSTSUB DPPP_(my_newCONSTSUB) ++ ++#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL) ++ ++/* This is just a trick to avoid a dependency of newCONSTSUB on PL_parser */ ++/* (There's no PL_parser in perl < 5.005, so this is completely safe) */ ++#define D_PPP_PL_copline PL_copline ++ ++void ++DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv) ++{ ++ U32 oldhints = PL_hints; ++ HV *old_cop_stash = PL_curcop->cop_stash; ++ HV *old_curstash = PL_curstash; ++ line_t oldline = PL_curcop->cop_line; ++ PL_curcop->cop_line = D_PPP_PL_copline; ++ ++ PL_hints &= ~HINT_BLOCK_SCOPE; ++ if (stash) ++ PL_curstash = PL_curcop->cop_stash = stash; ++ ++ newSUB( ++ ++#if (PERL_BCDVERSION < 0x5003022) ++ start_subparse(), ++#elif (PERL_BCDVERSION == 0x5003022) ++ start_subparse(0), ++#else /* 5.003_23 onwards */ ++ start_subparse(FALSE, 0), ++#endif ++ ++ newSVOP(OP_CONST, 0, newSVpv((char *) name, 0)), ++ newSVOP(OP_CONST, 0, &PL_sv_no), /* SvPV(&PL_sv_no) == "" -- GMB */ ++ newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv)) ++ ); ++ ++ PL_hints = oldhints; ++ PL_curcop->cop_stash = old_cop_stash; ++ PL_curstash = old_curstash; ++ PL_curcop->cop_line = oldline; ++} ++#endif ++#endif ++ ++/* ++ * Boilerplate macros for initializing and accessing interpreter-local ++ * data from C. All statics in extensions should be reworked to use ++ * this, if you want to make the extension thread-safe. See ext/re/re.xs ++ * for an example of the use of these macros. ++ * ++ * Code that uses these macros is responsible for the following: ++ * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts" ++ * 2. Declare a typedef named my_cxt_t that is a structure that contains ++ * all the data that needs to be interpreter-local. ++ * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t. ++ * 4. Use the MY_CXT_INIT macro such that it is called exactly once ++ * (typically put in the BOOT: section). ++ * 5. Use the members of the my_cxt_t structure everywhere as ++ * MY_CXT.member. ++ * 6. Use the dMY_CXT macro (a declaration) in all the functions that ++ * access MY_CXT. ++ */ ++ ++#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \ ++ defined(PERL_CAPI) || defined(PERL_IMPLICIT_CONTEXT) ++ ++#ifndef START_MY_CXT ++ ++/* This must appear in all extensions that define a my_cxt_t structure, ++ * right after the definition (i.e. at file scope). The non-threads ++ * case below uses it to declare the data as static. */ ++#define START_MY_CXT ++ ++#if (PERL_BCDVERSION < 0x5004068) ++/* Fetches the SV that keeps the per-interpreter data. */ ++#define dMY_CXT_SV \ ++ SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE) ++#else /* >= perl5.004_68 */ ++#define dMY_CXT_SV \ ++ SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY, \ ++ sizeof(MY_CXT_KEY)-1, TRUE) ++#endif /* < perl5.004_68 */ ++ ++/* This declaration should be used within all functions that use the ++ * interpreter-local data. */ ++#define dMY_CXT \ ++ dMY_CXT_SV; \ ++ my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv)) ++ ++/* Creates and zeroes the per-interpreter data. ++ * (We allocate my_cxtp in a Perl SV so that it will be released when ++ * the interpreter goes away.) */ ++#define MY_CXT_INIT \ ++ dMY_CXT_SV; \ ++ /* newSV() allocates one more than needed */ \ ++ my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ ++ Zero(my_cxtp, 1, my_cxt_t); \ ++ sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) ++ ++/* This macro must be used to access members of the my_cxt_t structure. ++ * e.g. MYCXT.some_data */ ++#define MY_CXT (*my_cxtp) ++ ++/* Judicious use of these macros can reduce the number of times dMY_CXT ++ * is used. Use is similar to pTHX, aTHX etc. */ ++#define pMY_CXT my_cxt_t *my_cxtp ++#define pMY_CXT_ pMY_CXT, ++#define _pMY_CXT ,pMY_CXT ++#define aMY_CXT my_cxtp ++#define aMY_CXT_ aMY_CXT, ++#define _aMY_CXT ,aMY_CXT ++ ++#endif /* START_MY_CXT */ ++ ++#ifndef MY_CXT_CLONE ++/* Clones the per-interpreter data. */ ++#define MY_CXT_CLONE \ ++ dMY_CXT_SV; \ ++ my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ ++ Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t);\ ++ sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) ++#endif ++ ++#else /* single interpreter */ ++ ++#ifndef START_MY_CXT ++ ++#define START_MY_CXT static my_cxt_t my_cxt; ++#define dMY_CXT_SV dNOOP ++#define dMY_CXT dNOOP ++#define MY_CXT_INIT NOOP ++#define MY_CXT my_cxt ++ ++#define pMY_CXT void ++#define pMY_CXT_ ++#define _pMY_CXT ++#define aMY_CXT ++#define aMY_CXT_ ++#define _aMY_CXT ++ ++#endif /* START_MY_CXT */ ++ ++#ifndef MY_CXT_CLONE ++#define MY_CXT_CLONE NOOP ++#endif ++ ++#endif ++ ++#ifndef IVdf ++# if IVSIZE == LONGSIZE ++# define IVdf "ld" ++# define UVuf "lu" ++# define UVof "lo" ++# define UVxf "lx" ++# define UVXf "lX" ++# elif IVSIZE == INTSIZE ++# define IVdf "d" ++# define UVuf "u" ++# define UVof "o" ++# define UVxf "x" ++# define UVXf "X" ++# else ++# error "cannot define IV/UV formats" ++# endif ++#endif ++ ++#ifndef NVef ++# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \ ++ defined(PERL_PRIfldbl) && (PERL_BCDVERSION != 0x5006000) ++ /* Not very likely, but let's try anyway. */ ++# define NVef PERL_PRIeldbl ++# define NVff PERL_PRIfldbl ++# define NVgf PERL_PRIgldbl ++# else ++# define NVef "e" ++# define NVff "f" ++# define NVgf "g" ++# endif ++#endif ++ ++#ifndef SvREFCNT_inc ++# ifdef PERL_USE_GCC_BRACE_GROUPS ++# define SvREFCNT_inc(sv) \ ++ ({ \ ++ SV * const _sv = (SV*)(sv); \ ++ if (_sv) \ ++ (SvREFCNT(_sv))++; \ ++ _sv; \ ++ }) ++# else ++# define SvREFCNT_inc(sv) \ ++ ((PL_Sv=(SV*)(sv)) ? (++(SvREFCNT(PL_Sv)),PL_Sv) : NULL) ++# endif ++#endif ++ ++#ifndef SvREFCNT_inc_simple ++# ifdef PERL_USE_GCC_BRACE_GROUPS ++# define SvREFCNT_inc_simple(sv) \ ++ ({ \ ++ if (sv) \ ++ (SvREFCNT(sv))++; \ ++ (SV *)(sv); \ ++ }) ++# else ++# define SvREFCNT_inc_simple(sv) \ ++ ((sv) ? (SvREFCNT(sv)++,(SV*)(sv)) : NULL) ++# endif ++#endif ++ ++#ifndef SvREFCNT_inc_NN ++# ifdef PERL_USE_GCC_BRACE_GROUPS ++# define SvREFCNT_inc_NN(sv) \ ++ ({ \ ++ SV * const _sv = (SV*)(sv); \ ++ SvREFCNT(_sv)++; \ ++ _sv; \ ++ }) ++# else ++# define SvREFCNT_inc_NN(sv) \ ++ (PL_Sv=(SV*)(sv),++(SvREFCNT(PL_Sv)),PL_Sv) ++# endif ++#endif ++ ++#ifndef SvREFCNT_inc_void ++# ifdef PERL_USE_GCC_BRACE_GROUPS ++# define SvREFCNT_inc_void(sv) \ ++ ({ \ ++ SV * const _sv = (SV*)(sv); \ ++ if (_sv) \ ++ (void)(SvREFCNT(_sv)++); \ ++ }) ++# else ++# define SvREFCNT_inc_void(sv) \ ++ (void)((PL_Sv=(SV*)(sv)) ? ++(SvREFCNT(PL_Sv)) : 0) ++# endif ++#endif ++#ifndef SvREFCNT_inc_simple_void ++# define SvREFCNT_inc_simple_void(sv) STMT_START { if (sv) SvREFCNT(sv)++; } STMT_END ++#endif ++ ++#ifndef SvREFCNT_inc_simple_NN ++# define SvREFCNT_inc_simple_NN(sv) (++SvREFCNT(sv), (SV*)(sv)) ++#endif ++ ++#ifndef SvREFCNT_inc_void_NN ++# define SvREFCNT_inc_void_NN(sv) (void)(++SvREFCNT((SV*)(sv))) ++#endif ++ ++#ifndef SvREFCNT_inc_simple_void_NN ++# define SvREFCNT_inc_simple_void_NN(sv) (void)(++SvREFCNT((SV*)(sv))) ++#endif ++ ++#ifndef newSV_type ++ ++#if defined(NEED_newSV_type) ++static SV* DPPP_(my_newSV_type)(pTHX_ svtype const t); ++static ++#else ++extern SV* DPPP_(my_newSV_type)(pTHX_ svtype const t); ++#endif ++ ++#ifdef newSV_type ++# undef newSV_type ++#endif ++#define newSV_type(a) DPPP_(my_newSV_type)(aTHX_ a) ++#define Perl_newSV_type DPPP_(my_newSV_type) ++ ++#if defined(NEED_newSV_type) || defined(NEED_newSV_type_GLOBAL) ++ ++SV* ++DPPP_(my_newSV_type)(pTHX_ svtype const t) ++{ ++ SV* const sv = newSV(0); ++ sv_upgrade(sv, t); ++ return sv; ++} ++ ++#endif ++ ++#endif ++ ++#if (PERL_BCDVERSION < 0x5006000) ++# define D_PPP_CONSTPV_ARG(x) ((char *) (x)) ++#else ++# define D_PPP_CONSTPV_ARG(x) (x) ++#endif ++#ifndef newSVpvn ++# define newSVpvn(data,len) ((data) \ ++ ? ((len) ? newSVpv((data), (len)) : newSVpv("", 0)) \ ++ : newSV(0)) ++#endif ++#ifndef newSVpvn_utf8 ++# define newSVpvn_utf8(s, len, u) newSVpvn_flags((s), (len), (u) ? SVf_UTF8 : 0) ++#endif ++#ifndef SVf_UTF8 ++# define SVf_UTF8 0 ++#endif ++ ++#ifndef newSVpvn_flags ++ ++#if defined(NEED_newSVpvn_flags) ++static SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags); ++static ++#else ++extern SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags); ++#endif ++ ++#ifdef newSVpvn_flags ++# undef newSVpvn_flags ++#endif ++#define newSVpvn_flags(a,b,c) DPPP_(my_newSVpvn_flags)(aTHX_ a,b,c) ++#define Perl_newSVpvn_flags DPPP_(my_newSVpvn_flags) ++ ++#if defined(NEED_newSVpvn_flags) || defined(NEED_newSVpvn_flags_GLOBAL) ++ ++SV * ++DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags) ++{ ++ SV *sv = newSVpvn(D_PPP_CONSTPV_ARG(s), len); ++ SvFLAGS(sv) |= (flags & SVf_UTF8); ++ return (flags & SVs_TEMP) ? sv_2mortal(sv) : sv; ++} ++ ++#endif ++ ++#endif ++ ++/* Backwards compatibility stuff... :-( */ ++#if !defined(NEED_sv_2pv_flags) && defined(NEED_sv_2pv_nolen) ++# define NEED_sv_2pv_flags ++#endif ++#if !defined(NEED_sv_2pv_flags_GLOBAL) && defined(NEED_sv_2pv_nolen_GLOBAL) ++# define NEED_sv_2pv_flags_GLOBAL ++#endif ++ ++/* Hint: sv_2pv_nolen ++ * Use the SvPV_nolen() or SvPV_nolen_const() macros instead of sv_2pv_nolen(). ++ */ ++#ifndef sv_2pv_nolen ++# define sv_2pv_nolen(sv) SvPV_nolen(sv) ++#endif ++ ++#ifdef SvPVbyte ++ ++/* Hint: SvPVbyte ++ * Does not work in perl-5.6.1, ppport.h implements a version ++ * borrowed from perl-5.7.3. ++ */ ++ ++#if (PERL_BCDVERSION < 0x5007000) ++ ++#if defined(NEED_sv_2pvbyte) ++static char * DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp); ++static ++#else ++extern char * DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp); ++#endif ++ ++#ifdef sv_2pvbyte ++# undef sv_2pvbyte ++#endif ++#define sv_2pvbyte(a,b) DPPP_(my_sv_2pvbyte)(aTHX_ a,b) ++#define Perl_sv_2pvbyte DPPP_(my_sv_2pvbyte) ++ ++#if defined(NEED_sv_2pvbyte) || defined(NEED_sv_2pvbyte_GLOBAL) ++ ++char * ++DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp) ++{ ++ sv_utf8_downgrade(sv,0); ++ return SvPV(sv,*lp); ++} ++ ++#endif ++ ++/* Hint: sv_2pvbyte ++ * Use the SvPVbyte() macro instead of sv_2pvbyte(). ++ */ ++ ++#undef SvPVbyte ++ ++#define SvPVbyte(sv, lp) \ ++ ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \ ++ ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pvbyte(sv, &lp)) ++ ++#endif ++ ++#else ++ ++# define SvPVbyte SvPV ++# define sv_2pvbyte sv_2pv ++ ++#endif ++#ifndef sv_2pvbyte_nolen ++# define sv_2pvbyte_nolen(sv) sv_2pv_nolen(sv) ++#endif ++ ++/* Hint: sv_pvn ++ * Always use the SvPV() macro instead of sv_pvn(). ++ */ ++ ++/* Hint: sv_pvn_force ++ * Always use the SvPV_force() macro instead of sv_pvn_force(). ++ */ ++ ++/* If these are undefined, they're not handled by the core anyway */ ++#ifndef SV_IMMEDIATE_UNREF ++# define SV_IMMEDIATE_UNREF 0 ++#endif ++ ++#ifndef SV_GMAGIC ++# define SV_GMAGIC 0 ++#endif ++ ++#ifndef SV_COW_DROP_PV ++# define SV_COW_DROP_PV 0 ++#endif ++ ++#ifndef SV_UTF8_NO_ENCODING ++# define SV_UTF8_NO_ENCODING 0 ++#endif ++ ++#ifndef SV_NOSTEAL ++# define SV_NOSTEAL 0 ++#endif ++ ++#ifndef SV_CONST_RETURN ++# define SV_CONST_RETURN 0 ++#endif ++ ++#ifndef SV_MUTABLE_RETURN ++# define SV_MUTABLE_RETURN 0 ++#endif ++ ++#ifndef SV_SMAGIC ++# define SV_SMAGIC 0 ++#endif ++ ++#ifndef SV_HAS_TRAILING_NUL ++# define SV_HAS_TRAILING_NUL 0 ++#endif ++ ++#ifndef SV_COW_SHARED_HASH_KEYS ++# define SV_COW_SHARED_HASH_KEYS 0 ++#endif ++ ++#if (PERL_BCDVERSION < 0x5007002) ++ ++#if defined(NEED_sv_2pv_flags) ++static char * DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); ++static ++#else ++extern char * DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); ++#endif ++ ++#ifdef sv_2pv_flags ++# undef sv_2pv_flags ++#endif ++#define sv_2pv_flags(a,b,c) DPPP_(my_sv_2pv_flags)(aTHX_ a,b,c) ++#define Perl_sv_2pv_flags DPPP_(my_sv_2pv_flags) ++ ++#if defined(NEED_sv_2pv_flags) || defined(NEED_sv_2pv_flags_GLOBAL) ++ ++char * ++DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags) ++{ ++ STRLEN n_a = (STRLEN) flags; ++ return sv_2pv(sv, lp ? lp : &n_a); ++} ++ ++#endif ++ ++#if defined(NEED_sv_pvn_force_flags) ++static char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); ++static ++#else ++extern char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); ++#endif ++ ++#ifdef sv_pvn_force_flags ++# undef sv_pvn_force_flags ++#endif ++#define sv_pvn_force_flags(a,b,c) DPPP_(my_sv_pvn_force_flags)(aTHX_ a,b,c) ++#define Perl_sv_pvn_force_flags DPPP_(my_sv_pvn_force_flags) ++ ++#if defined(NEED_sv_pvn_force_flags) || defined(NEED_sv_pvn_force_flags_GLOBAL) ++ ++char * ++DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags) ++{ ++ STRLEN n_a = (STRLEN) flags; ++ return sv_pvn_force(sv, lp ? lp : &n_a); ++} ++ ++#endif ++ ++#endif ++ ++#if (PERL_BCDVERSION < 0x5008008) || ( (PERL_BCDVERSION >= 0x5009000) && (PERL_BCDVERSION < 0x5009003) ) ++# define DPPP_SVPV_NOLEN_LP_ARG &PL_na ++#else ++# define DPPP_SVPV_NOLEN_LP_ARG 0 ++#endif ++#ifndef SvPV_const ++# define SvPV_const(sv, lp) SvPV_flags_const(sv, lp, SV_GMAGIC) ++#endif ++ ++#ifndef SvPV_mutable ++# define SvPV_mutable(sv, lp) SvPV_flags_mutable(sv, lp, SV_GMAGIC) ++#endif ++#ifndef SvPV_flags ++# define SvPV_flags(sv, lp, flags) \ ++ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ++ ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pv_flags(sv, &lp, flags)) ++#endif ++#ifndef SvPV_flags_const ++# define SvPV_flags_const(sv, lp, flags) \ ++ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ++ ? ((lp = SvCUR(sv)), SvPVX_const(sv)) : \ ++ (const char*) sv_2pv_flags(sv, &lp, flags|SV_CONST_RETURN)) ++#endif ++#ifndef SvPV_flags_const_nolen ++# define SvPV_flags_const_nolen(sv, flags) \ ++ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ++ ? SvPVX_const(sv) : \ ++ (const char*) sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags|SV_CONST_RETURN)) ++#endif ++#ifndef SvPV_flags_mutable ++# define SvPV_flags_mutable(sv, lp, flags) \ ++ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ++ ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) : \ ++ sv_2pv_flags(sv, &lp, flags|SV_MUTABLE_RETURN)) ++#endif ++#ifndef SvPV_force ++# define SvPV_force(sv, lp) SvPV_force_flags(sv, lp, SV_GMAGIC) ++#endif ++ ++#ifndef SvPV_force_nolen ++# define SvPV_force_nolen(sv) SvPV_force_flags_nolen(sv, SV_GMAGIC) ++#endif ++ ++#ifndef SvPV_force_mutable ++# define SvPV_force_mutable(sv, lp) SvPV_force_flags_mutable(sv, lp, SV_GMAGIC) ++#endif ++ ++#ifndef SvPV_force_nomg ++# define SvPV_force_nomg(sv, lp) SvPV_force_flags(sv, lp, 0) ++#endif ++ ++#ifndef SvPV_force_nomg_nolen ++# define SvPV_force_nomg_nolen(sv) SvPV_force_flags_nolen(sv, 0) ++#endif ++#ifndef SvPV_force_flags ++# define SvPV_force_flags(sv, lp, flags) \ ++ ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ ++ ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_pvn_force_flags(sv, &lp, flags)) ++#endif ++#ifndef SvPV_force_flags_nolen ++# define SvPV_force_flags_nolen(sv, flags) \ ++ ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ ++ ? SvPVX(sv) : sv_pvn_force_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags)) ++#endif ++#ifndef SvPV_force_flags_mutable ++# define SvPV_force_flags_mutable(sv, lp, flags) \ ++ ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ ++ ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) \ ++ : sv_pvn_force_flags(sv, &lp, flags|SV_MUTABLE_RETURN)) ++#endif ++#ifndef SvPV_nolen ++# define SvPV_nolen(sv) \ ++ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ++ ? SvPVX(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC)) ++#endif ++#ifndef SvPV_nolen_const ++# define SvPV_nolen_const(sv) \ ++ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ++ ? SvPVX_const(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC|SV_CONST_RETURN)) ++#endif ++#ifndef SvPV_nomg ++# define SvPV_nomg(sv, lp) SvPV_flags(sv, lp, 0) ++#endif ++ ++#ifndef SvPV_nomg_const ++# define SvPV_nomg_const(sv, lp) SvPV_flags_const(sv, lp, 0) ++#endif ++ ++#ifndef SvPV_nomg_const_nolen ++# define SvPV_nomg_const_nolen(sv) SvPV_flags_const_nolen(sv, 0) ++#endif ++ ++#ifndef SvPV_nomg_nolen ++# define SvPV_nomg_nolen(sv) ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ++ ? SvPVX(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, 0)) ++#endif ++#ifndef SvPV_renew ++# define SvPV_renew(sv,n) STMT_START { SvLEN_set(sv, n); \ ++ SvPV_set((sv), (char *) saferealloc( \ ++ (Malloc_t)SvPVX(sv), (MEM_SIZE)((n)))); \ ++ } STMT_END ++#endif ++#ifndef SvMAGIC_set ++# define SvMAGIC_set(sv, val) \ ++ STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ ++ (((XPVMG*) SvANY(sv))->xmg_magic = (val)); } STMT_END ++#endif ++ ++#if (PERL_BCDVERSION < 0x5009003) ++#ifndef SvPVX_const ++# define SvPVX_const(sv) ((const char*) (0 + SvPVX(sv))) ++#endif ++ ++#ifndef SvPVX_mutable ++# define SvPVX_mutable(sv) (0 + SvPVX(sv)) ++#endif ++#ifndef SvRV_set ++# define SvRV_set(sv, val) \ ++ STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ ++ (((XRV*) SvANY(sv))->xrv_rv = (val)); } STMT_END ++#endif ++ ++#else ++#ifndef SvPVX_const ++# define SvPVX_const(sv) ((const char*)((sv)->sv_u.svu_pv)) ++#endif ++ ++#ifndef SvPVX_mutable ++# define SvPVX_mutable(sv) ((sv)->sv_u.svu_pv) ++#endif ++#ifndef SvRV_set ++# define SvRV_set(sv, val) \ ++ STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ ++ ((sv)->sv_u.svu_rv = (val)); } STMT_END ++#endif ++ ++#endif ++#ifndef SvSTASH_set ++# define SvSTASH_set(sv, val) \ ++ STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ ++ (((XPVMG*) SvANY(sv))->xmg_stash = (val)); } STMT_END ++#endif ++ ++#if (PERL_BCDVERSION < 0x5004000) ++#ifndef SvUV_set ++# define SvUV_set(sv, val) \ ++ STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ ++ (((XPVIV*) SvANY(sv))->xiv_iv = (IV) (val)); } STMT_END ++#endif ++ ++#else ++#ifndef SvUV_set ++# define SvUV_set(sv, val) \ ++ STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ ++ (((XPVUV*) SvANY(sv))->xuv_uv = (val)); } STMT_END ++#endif ++ ++#endif ++ ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(vnewSVpvf) ++#if defined(NEED_vnewSVpvf) ++static SV * DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args); ++static ++#else ++extern SV * DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args); ++#endif ++ ++#ifdef vnewSVpvf ++# undef vnewSVpvf ++#endif ++#define vnewSVpvf(a,b) DPPP_(my_vnewSVpvf)(aTHX_ a,b) ++#define Perl_vnewSVpvf DPPP_(my_vnewSVpvf) ++ ++#if defined(NEED_vnewSVpvf) || defined(NEED_vnewSVpvf_GLOBAL) ++ ++SV * ++DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args) ++{ ++ register SV *sv = newSV(0); ++ sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); ++ return sv; ++} ++ ++#endif ++#endif ++ ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf) ++# define sv_vcatpvf(sv, pat, args) sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) ++#endif ++ ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf) ++# define sv_vsetpvf(sv, pat, args) sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) ++#endif ++ ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg) ++#if defined(NEED_sv_catpvf_mg) ++static void DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...); ++static ++#else ++extern void DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...); ++#endif ++ ++#define Perl_sv_catpvf_mg DPPP_(my_sv_catpvf_mg) ++ ++#if defined(NEED_sv_catpvf_mg) || defined(NEED_sv_catpvf_mg_GLOBAL) ++ ++void ++DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...) ++{ ++ va_list args; ++ va_start(args, pat); ++ sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); ++ SvSETMAGIC(sv); ++ va_end(args); ++} ++ ++#endif ++#endif ++ ++#ifdef PERL_IMPLICIT_CONTEXT ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg_nocontext) ++#if defined(NEED_sv_catpvf_mg_nocontext) ++static void DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...); ++static ++#else ++extern void DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...); ++#endif ++ ++#define sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) ++#define Perl_sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) ++ ++#if defined(NEED_sv_catpvf_mg_nocontext) || defined(NEED_sv_catpvf_mg_nocontext_GLOBAL) ++ ++void ++DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...) ++{ ++ dTHX; ++ va_list args; ++ va_start(args, pat); ++ sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); ++ SvSETMAGIC(sv); ++ va_end(args); ++} ++ ++#endif ++#endif ++#endif ++ ++/* sv_catpvf_mg depends on sv_catpvf_mg_nocontext */ ++#ifndef sv_catpvf_mg ++# ifdef PERL_IMPLICIT_CONTEXT ++# define sv_catpvf_mg Perl_sv_catpvf_mg_nocontext ++# else ++# define sv_catpvf_mg Perl_sv_catpvf_mg ++# endif ++#endif ++ ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf_mg) ++# define sv_vcatpvf_mg(sv, pat, args) \ ++ STMT_START { \ ++ sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ ++ SvSETMAGIC(sv); \ ++ } STMT_END ++#endif ++ ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg) ++#if defined(NEED_sv_setpvf_mg) ++static void DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...); ++static ++#else ++extern void DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...); ++#endif ++ ++#define Perl_sv_setpvf_mg DPPP_(my_sv_setpvf_mg) ++ ++#if defined(NEED_sv_setpvf_mg) || defined(NEED_sv_setpvf_mg_GLOBAL) ++ ++void ++DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...) ++{ ++ va_list args; ++ va_start(args, pat); ++ sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); ++ SvSETMAGIC(sv); ++ va_end(args); ++} ++ ++#endif ++#endif ++ ++#ifdef PERL_IMPLICIT_CONTEXT ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg_nocontext) ++#if defined(NEED_sv_setpvf_mg_nocontext) ++static void DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...); ++static ++#else ++extern void DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...); ++#endif ++ ++#define sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) ++#define Perl_sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) ++ ++#if defined(NEED_sv_setpvf_mg_nocontext) || defined(NEED_sv_setpvf_mg_nocontext_GLOBAL) ++ ++void ++DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...) ++{ ++ dTHX; ++ va_list args; ++ va_start(args, pat); ++ sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); ++ SvSETMAGIC(sv); ++ va_end(args); ++} ++ ++#endif ++#endif ++#endif ++ ++/* sv_setpvf_mg depends on sv_setpvf_mg_nocontext */ ++#ifndef sv_setpvf_mg ++# ifdef PERL_IMPLICIT_CONTEXT ++# define sv_setpvf_mg Perl_sv_setpvf_mg_nocontext ++# else ++# define sv_setpvf_mg Perl_sv_setpvf_mg ++# endif ++#endif ++ ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf_mg) ++# define sv_vsetpvf_mg(sv, pat, args) \ ++ STMT_START { \ ++ sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ ++ SvSETMAGIC(sv); \ ++ } STMT_END ++#endif ++ ++/* Hint: newSVpvn_share ++ * The SVs created by this function only mimic the behaviour of ++ * shared PVs without really being shared. Only use if you know ++ * what you're doing. ++ */ ++ ++#ifndef newSVpvn_share ++ ++#if defined(NEED_newSVpvn_share) ++static SV * DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash); ++static ++#else ++extern SV * DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash); ++#endif ++ ++#ifdef newSVpvn_share ++# undef newSVpvn_share ++#endif ++#define newSVpvn_share(a,b,c) DPPP_(my_newSVpvn_share)(aTHX_ a,b,c) ++#define Perl_newSVpvn_share DPPP_(my_newSVpvn_share) ++ ++#if defined(NEED_newSVpvn_share) || defined(NEED_newSVpvn_share_GLOBAL) ++ ++SV * ++DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash) ++{ ++ SV *sv; ++ if (len < 0) ++ len = -len; ++ if (!hash) ++ PERL_HASH(hash, (char*) src, len); ++ sv = newSVpvn((char *) src, len); ++ sv_upgrade(sv, SVt_PVIV); ++ SvIVX(sv) = hash; ++ SvREADONLY_on(sv); ++ SvPOK_on(sv); ++ return sv; ++} ++ ++#endif ++ ++#endif ++#ifndef SvSHARED_HASH ++# define SvSHARED_HASH(sv) (0 + SvUVX(sv)) ++#endif ++#ifndef HvNAME_get ++# define HvNAME_get(hv) HvNAME(hv) ++#endif ++#ifndef HvNAMELEN_get ++# define HvNAMELEN_get(hv) (HvNAME_get(hv) ? (I32)strlen(HvNAME_get(hv)) : 0) ++#endif ++#ifndef GvSVn ++# define GvSVn(gv) GvSV(gv) ++#endif ++ ++#ifndef isGV_with_GP ++# define isGV_with_GP(gv) isGV(gv) ++#endif ++ ++#ifndef gv_fetchpvn_flags ++# define gv_fetchpvn_flags(name, len, flags, svt) gv_fetchpv(name, flags, svt) ++#endif ++ ++#ifndef gv_fetchsv ++# define gv_fetchsv(name, flags, svt) gv_fetchpv(SvPV_nolen_const(name), flags, svt) ++#endif ++#ifndef get_cvn_flags ++# define get_cvn_flags(name, namelen, flags) get_cv(name, flags) ++#endif ++#ifndef WARN_ALL ++# define WARN_ALL 0 ++#endif ++ ++#ifndef WARN_CLOSURE ++# define WARN_CLOSURE 1 ++#endif ++ ++#ifndef WARN_DEPRECATED ++# define WARN_DEPRECATED 2 ++#endif ++ ++#ifndef WARN_EXITING ++# define WARN_EXITING 3 ++#endif ++ ++#ifndef WARN_GLOB ++# define WARN_GLOB 4 ++#endif ++ ++#ifndef WARN_IO ++# define WARN_IO 5 ++#endif ++ ++#ifndef WARN_CLOSED ++# define WARN_CLOSED 6 ++#endif ++ ++#ifndef WARN_EXEC ++# define WARN_EXEC 7 ++#endif ++ ++#ifndef WARN_LAYER ++# define WARN_LAYER 8 ++#endif ++ ++#ifndef WARN_NEWLINE ++# define WARN_NEWLINE 9 ++#endif ++ ++#ifndef WARN_PIPE ++# define WARN_PIPE 10 ++#endif ++ ++#ifndef WARN_UNOPENED ++# define WARN_UNOPENED 11 ++#endif ++ ++#ifndef WARN_MISC ++# define WARN_MISC 12 ++#endif ++ ++#ifndef WARN_NUMERIC ++# define WARN_NUMERIC 13 ++#endif ++ ++#ifndef WARN_ONCE ++# define WARN_ONCE 14 ++#endif ++ ++#ifndef WARN_OVERFLOW ++# define WARN_OVERFLOW 15 ++#endif ++ ++#ifndef WARN_PACK ++# define WARN_PACK 16 ++#endif ++ ++#ifndef WARN_PORTABLE ++# define WARN_PORTABLE 17 ++#endif ++ ++#ifndef WARN_RECURSION ++# define WARN_RECURSION 18 ++#endif ++ ++#ifndef WARN_REDEFINE ++# define WARN_REDEFINE 19 ++#endif ++ ++#ifndef WARN_REGEXP ++# define WARN_REGEXP 20 ++#endif ++ ++#ifndef WARN_SEVERE ++# define WARN_SEVERE 21 ++#endif ++ ++#ifndef WARN_DEBUGGING ++# define WARN_DEBUGGING 22 ++#endif ++ ++#ifndef WARN_INPLACE ++# define WARN_INPLACE 23 ++#endif ++ ++#ifndef WARN_INTERNAL ++# define WARN_INTERNAL 24 ++#endif ++ ++#ifndef WARN_MALLOC ++# define WARN_MALLOC 25 ++#endif ++ ++#ifndef WARN_SIGNAL ++# define WARN_SIGNAL 26 ++#endif ++ ++#ifndef WARN_SUBSTR ++# define WARN_SUBSTR 27 ++#endif ++ ++#ifndef WARN_SYNTAX ++# define WARN_SYNTAX 28 ++#endif ++ ++#ifndef WARN_AMBIGUOUS ++# define WARN_AMBIGUOUS 29 ++#endif ++ ++#ifndef WARN_BAREWORD ++# define WARN_BAREWORD 30 ++#endif ++ ++#ifndef WARN_DIGIT ++# define WARN_DIGIT 31 ++#endif ++ ++#ifndef WARN_PARENTHESIS ++# define WARN_PARENTHESIS 32 ++#endif ++ ++#ifndef WARN_PRECEDENCE ++# define WARN_PRECEDENCE 33 ++#endif ++ ++#ifndef WARN_PRINTF ++# define WARN_PRINTF 34 ++#endif ++ ++#ifndef WARN_PROTOTYPE ++# define WARN_PROTOTYPE 35 ++#endif ++ ++#ifndef WARN_QW ++# define WARN_QW 36 ++#endif ++ ++#ifndef WARN_RESERVED ++# define WARN_RESERVED 37 ++#endif ++ ++#ifndef WARN_SEMICOLON ++# define WARN_SEMICOLON 38 ++#endif ++ ++#ifndef WARN_TAINT ++# define WARN_TAINT 39 ++#endif ++ ++#ifndef WARN_THREADS ++# define WARN_THREADS 40 ++#endif ++ ++#ifndef WARN_UNINITIALIZED ++# define WARN_UNINITIALIZED 41 ++#endif ++ ++#ifndef WARN_UNPACK ++# define WARN_UNPACK 42 ++#endif ++ ++#ifndef WARN_UNTIE ++# define WARN_UNTIE 43 ++#endif ++ ++#ifndef WARN_UTF8 ++# define WARN_UTF8 44 ++#endif ++ ++#ifndef WARN_VOID ++# define WARN_VOID 45 ++#endif ++ ++#ifndef WARN_ASSERTIONS ++# define WARN_ASSERTIONS 46 ++#endif ++#ifndef packWARN ++# define packWARN(a) (a) ++#endif ++ ++#ifndef ckWARN ++# ifdef G_WARN_ON ++# define ckWARN(a) (PL_dowarn & G_WARN_ON) ++# else ++# define ckWARN(a) PL_dowarn ++# endif ++#endif ++ ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(warner) ++#if defined(NEED_warner) ++static void DPPP_(my_warner)(U32 err, const char *pat, ...); ++static ++#else ++extern void DPPP_(my_warner)(U32 err, const char *pat, ...); ++#endif ++ ++#define Perl_warner DPPP_(my_warner) ++ ++#if defined(NEED_warner) || defined(NEED_warner_GLOBAL) ++ ++void ++DPPP_(my_warner)(U32 err, const char *pat, ...) ++{ ++ SV *sv; ++ va_list args; ++ ++ PERL_UNUSED_ARG(err); ++ ++ va_start(args, pat); ++ sv = vnewSVpvf(pat, &args); ++ va_end(args); ++ sv_2mortal(sv); ++ warn("%s", SvPV_nolen(sv)); ++} ++ ++#define warner Perl_warner ++ ++#define Perl_warner_nocontext Perl_warner ++ ++#endif ++#endif ++ ++/* concatenating with "" ensures that only literal strings are accepted as argument ++ * note that STR_WITH_LEN() can't be used as argument to macros or functions that ++ * under some configurations might be macros ++ */ ++#ifndef STR_WITH_LEN ++# define STR_WITH_LEN(s) (s ""), (sizeof(s)-1) ++#endif ++#ifndef newSVpvs ++# define newSVpvs(str) newSVpvn(str "", sizeof(str) - 1) ++#endif ++ ++#ifndef newSVpvs_flags ++# define newSVpvs_flags(str, flags) newSVpvn_flags(str "", sizeof(str) - 1, flags) ++#endif ++ ++#ifndef newSVpvs_share ++# define newSVpvs_share(str) newSVpvn_share(str "", sizeof(str) - 1, 0) ++#endif ++ ++#ifndef sv_catpvs ++# define sv_catpvs(sv, str) sv_catpvn(sv, str "", sizeof(str) - 1) ++#endif ++ ++#ifndef sv_setpvs ++# define sv_setpvs(sv, str) sv_setpvn(sv, str "", sizeof(str) - 1) ++#endif ++ ++#ifndef hv_fetchs ++# define hv_fetchs(hv, key, lval) hv_fetch(hv, key "", sizeof(key) - 1, lval) ++#endif ++ ++#ifndef hv_stores ++# define hv_stores(hv, key, val) hv_store(hv, key "", sizeof(key) - 1, val, 0) ++#endif ++#ifndef gv_fetchpvs ++# define gv_fetchpvs(name, flags, svt) gv_fetchpvn_flags(name "", sizeof(name) - 1, flags, svt) ++#endif ++ ++#ifndef gv_stashpvs ++# define gv_stashpvs(name, flags) gv_stashpvn(name "", sizeof(name) - 1, flags) ++#endif ++#ifndef get_cvs ++# define get_cvs(name, flags) get_cvn_flags(name "", sizeof(name)-1, flags) ++#endif ++#ifndef SvGETMAGIC ++# define SvGETMAGIC(x) STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END ++#endif ++#ifndef PERL_MAGIC_sv ++# define PERL_MAGIC_sv '\0' ++#endif ++ ++#ifndef PERL_MAGIC_overload ++# define PERL_MAGIC_overload 'A' ++#endif ++ ++#ifndef PERL_MAGIC_overload_elem ++# define PERL_MAGIC_overload_elem 'a' ++#endif ++ ++#ifndef PERL_MAGIC_overload_table ++# define PERL_MAGIC_overload_table 'c' ++#endif ++ ++#ifndef PERL_MAGIC_bm ++# define PERL_MAGIC_bm 'B' ++#endif ++ ++#ifndef PERL_MAGIC_regdata ++# define PERL_MAGIC_regdata 'D' ++#endif ++ ++#ifndef PERL_MAGIC_regdatum ++# define PERL_MAGIC_regdatum 'd' ++#endif ++ ++#ifndef PERL_MAGIC_env ++# define PERL_MAGIC_env 'E' ++#endif ++ ++#ifndef PERL_MAGIC_envelem ++# define PERL_MAGIC_envelem 'e' ++#endif ++ ++#ifndef PERL_MAGIC_fm ++# define PERL_MAGIC_fm 'f' ++#endif ++ ++#ifndef PERL_MAGIC_regex_global ++# define PERL_MAGIC_regex_global 'g' ++#endif ++ ++#ifndef PERL_MAGIC_isa ++# define PERL_MAGIC_isa 'I' ++#endif ++ ++#ifndef PERL_MAGIC_isaelem ++# define PERL_MAGIC_isaelem 'i' ++#endif ++ ++#ifndef PERL_MAGIC_nkeys ++# define PERL_MAGIC_nkeys 'k' ++#endif ++ ++#ifndef PERL_MAGIC_dbfile ++# define PERL_MAGIC_dbfile 'L' ++#endif ++ ++#ifndef PERL_MAGIC_dbline ++# define PERL_MAGIC_dbline 'l' ++#endif ++ ++#ifndef PERL_MAGIC_mutex ++# define PERL_MAGIC_mutex 'm' ++#endif ++ ++#ifndef PERL_MAGIC_shared ++# define PERL_MAGIC_shared 'N' ++#endif ++ ++#ifndef PERL_MAGIC_shared_scalar ++# define PERL_MAGIC_shared_scalar 'n' ++#endif ++ ++#ifndef PERL_MAGIC_collxfrm ++# define PERL_MAGIC_collxfrm 'o' ++#endif ++ ++#ifndef PERL_MAGIC_tied ++# define PERL_MAGIC_tied 'P' ++#endif ++ ++#ifndef PERL_MAGIC_tiedelem ++# define PERL_MAGIC_tiedelem 'p' ++#endif ++ ++#ifndef PERL_MAGIC_tiedscalar ++# define PERL_MAGIC_tiedscalar 'q' ++#endif ++ ++#ifndef PERL_MAGIC_qr ++# define PERL_MAGIC_qr 'r' ++#endif ++ ++#ifndef PERL_MAGIC_sig ++# define PERL_MAGIC_sig 'S' ++#endif ++ ++#ifndef PERL_MAGIC_sigelem ++# define PERL_MAGIC_sigelem 's' ++#endif ++ ++#ifndef PERL_MAGIC_taint ++# define PERL_MAGIC_taint 't' ++#endif ++ ++#ifndef PERL_MAGIC_uvar ++# define PERL_MAGIC_uvar 'U' ++#endif ++ ++#ifndef PERL_MAGIC_uvar_elem ++# define PERL_MAGIC_uvar_elem 'u' ++#endif ++ ++#ifndef PERL_MAGIC_vstring ++# define PERL_MAGIC_vstring 'V' ++#endif ++ ++#ifndef PERL_MAGIC_vec ++# define PERL_MAGIC_vec 'v' ++#endif ++ ++#ifndef PERL_MAGIC_utf8 ++# define PERL_MAGIC_utf8 'w' ++#endif ++ ++#ifndef PERL_MAGIC_substr ++# define PERL_MAGIC_substr 'x' ++#endif ++ ++#ifndef PERL_MAGIC_defelem ++# define PERL_MAGIC_defelem 'y' ++#endif ++ ++#ifndef PERL_MAGIC_glob ++# define PERL_MAGIC_glob '*' ++#endif ++ ++#ifndef PERL_MAGIC_arylen ++# define PERL_MAGIC_arylen '#' ++#endif ++ ++#ifndef PERL_MAGIC_pos ++# define PERL_MAGIC_pos '.' ++#endif ++ ++#ifndef PERL_MAGIC_backref ++# define PERL_MAGIC_backref '<' ++#endif ++ ++#ifndef PERL_MAGIC_ext ++# define PERL_MAGIC_ext '~' ++#endif ++ ++/* That's the best we can do... */ ++#ifndef sv_catpvn_nomg ++# define sv_catpvn_nomg sv_catpvn ++#endif ++ ++#ifndef sv_catsv_nomg ++# define sv_catsv_nomg sv_catsv ++#endif ++ ++#ifndef sv_setsv_nomg ++# define sv_setsv_nomg sv_setsv ++#endif ++ ++#ifndef sv_pvn_nomg ++# define sv_pvn_nomg sv_pvn ++#endif ++ ++#ifndef SvIV_nomg ++# define SvIV_nomg SvIV ++#endif ++ ++#ifndef SvUV_nomg ++# define SvUV_nomg SvUV ++#endif ++ ++#ifndef sv_catpv_mg ++# define sv_catpv_mg(sv, ptr) \ ++ STMT_START { \ ++ SV *TeMpSv = sv; \ ++ sv_catpv(TeMpSv,ptr); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_catpvn_mg ++# define sv_catpvn_mg(sv, ptr, len) \ ++ STMT_START { \ ++ SV *TeMpSv = sv; \ ++ sv_catpvn(TeMpSv,ptr,len); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_catsv_mg ++# define sv_catsv_mg(dsv, ssv) \ ++ STMT_START { \ ++ SV *TeMpSv = dsv; \ ++ sv_catsv(TeMpSv,ssv); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_setiv_mg ++# define sv_setiv_mg(sv, i) \ ++ STMT_START { \ ++ SV *TeMpSv = sv; \ ++ sv_setiv(TeMpSv,i); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_setnv_mg ++# define sv_setnv_mg(sv, num) \ ++ STMT_START { \ ++ SV *TeMpSv = sv; \ ++ sv_setnv(TeMpSv,num); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_setpv_mg ++# define sv_setpv_mg(sv, ptr) \ ++ STMT_START { \ ++ SV *TeMpSv = sv; \ ++ sv_setpv(TeMpSv,ptr); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_setpvn_mg ++# define sv_setpvn_mg(sv, ptr, len) \ ++ STMT_START { \ ++ SV *TeMpSv = sv; \ ++ sv_setpvn(TeMpSv,ptr,len); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_setsv_mg ++# define sv_setsv_mg(dsv, ssv) \ ++ STMT_START { \ ++ SV *TeMpSv = dsv; \ ++ sv_setsv(TeMpSv,ssv); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_setuv_mg ++# define sv_setuv_mg(sv, i) \ ++ STMT_START { \ ++ SV *TeMpSv = sv; \ ++ sv_setuv(TeMpSv,i); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_usepvn_mg ++# define sv_usepvn_mg(sv, ptr, len) \ ++ STMT_START { \ ++ SV *TeMpSv = sv; \ ++ sv_usepvn(TeMpSv,ptr,len); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++#ifndef SvVSTRING_mg ++# define SvVSTRING_mg(sv) (SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_vstring) : NULL) ++#endif ++ ++/* Hint: sv_magic_portable ++ * This is a compatibility function that is only available with ++ * Devel::PPPort. It is NOT in the perl core. ++ * Its purpose is to mimic the 5.8.0 behaviour of sv_magic() when ++ * it is being passed a name pointer with namlen == 0. In that ++ * case, perl 5.8.0 and later store the pointer, not a copy of it. ++ * The compatibility can be provided back to perl 5.004. With ++ * earlier versions, the code will not compile. ++ */ ++ ++#if (PERL_BCDVERSION < 0x5004000) ++ ++ /* code that uses sv_magic_portable will not compile */ ++ ++#elif (PERL_BCDVERSION < 0x5008000) ++ ++# define sv_magic_portable(sv, obj, how, name, namlen) \ ++ STMT_START { \ ++ SV *SvMp_sv = (sv); \ ++ char *SvMp_name = (char *) (name); \ ++ I32 SvMp_namlen = (namlen); \ ++ if (SvMp_name && SvMp_namlen == 0) \ ++ { \ ++ MAGIC *mg; \ ++ sv_magic(SvMp_sv, obj, how, 0, 0); \ ++ mg = SvMAGIC(SvMp_sv); \ ++ mg->mg_len = -42; /* XXX: this is the tricky part */ \ ++ mg->mg_ptr = SvMp_name; \ ++ } \ ++ else \ ++ { \ ++ sv_magic(SvMp_sv, obj, how, SvMp_name, SvMp_namlen); \ ++ } \ ++ } STMT_END ++ ++#else ++ ++# define sv_magic_portable(a, b, c, d, e) sv_magic(a, b, c, d, e) ++ ++#endif ++ ++#ifdef USE_ITHREADS ++#ifndef CopFILE ++# define CopFILE(c) ((c)->cop_file) ++#endif ++ ++#ifndef CopFILEGV ++# define CopFILEGV(c) (CopFILE(c) ? gv_fetchfile(CopFILE(c)) : Nullgv) ++#endif ++ ++#ifndef CopFILE_set ++# define CopFILE_set(c,pv) ((c)->cop_file = savepv(pv)) ++#endif ++ ++#ifndef CopFILESV ++# define CopFILESV(c) (CopFILE(c) ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv) ++#endif ++ ++#ifndef CopFILEAV ++# define CopFILEAV(c) (CopFILE(c) ? GvAV(gv_fetchfile(CopFILE(c))) : Nullav) ++#endif ++ ++#ifndef CopSTASHPV ++# define CopSTASHPV(c) ((c)->cop_stashpv) ++#endif ++ ++#ifndef CopSTASHPV_set ++# define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = ((pv) ? savepv(pv) : Nullch)) ++#endif ++ ++#ifndef CopSTASH ++# define CopSTASH(c) (CopSTASHPV(c) ? gv_stashpv(CopSTASHPV(c),GV_ADD) : Nullhv) ++#endif ++ ++#ifndef CopSTASH_set ++# define CopSTASH_set(c,hv) CopSTASHPV_set(c, (hv) ? HvNAME(hv) : Nullch) ++#endif ++ ++#ifndef CopSTASH_eq ++# define CopSTASH_eq(c,hv) ((hv) && (CopSTASHPV(c) == HvNAME(hv) \ ++ || (CopSTASHPV(c) && HvNAME(hv) \ ++ && strEQ(CopSTASHPV(c), HvNAME(hv))))) ++#endif ++ ++#else ++#ifndef CopFILEGV ++# define CopFILEGV(c) ((c)->cop_filegv) ++#endif ++ ++#ifndef CopFILEGV_set ++# define CopFILEGV_set(c,gv) ((c)->cop_filegv = (GV*)SvREFCNT_inc(gv)) ++#endif ++ ++#ifndef CopFILE_set ++# define CopFILE_set(c,pv) CopFILEGV_set((c), gv_fetchfile(pv)) ++#endif ++ ++#ifndef CopFILESV ++# define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv) ++#endif ++ ++#ifndef CopFILEAV ++# define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : Nullav) ++#endif ++ ++#ifndef CopFILE ++# define CopFILE(c) (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch) ++#endif ++ ++#ifndef CopSTASH ++# define CopSTASH(c) ((c)->cop_stash) ++#endif ++ ++#ifndef CopSTASH_set ++# define CopSTASH_set(c,hv) ((c)->cop_stash = (hv)) ++#endif ++ ++#ifndef CopSTASHPV ++# define CopSTASHPV(c) (CopSTASH(c) ? HvNAME(CopSTASH(c)) : Nullch) ++#endif ++ ++#ifndef CopSTASHPV_set ++# define CopSTASHPV_set(c,pv) CopSTASH_set((c), gv_stashpv(pv,GV_ADD)) ++#endif ++ ++#ifndef CopSTASH_eq ++# define CopSTASH_eq(c,hv) (CopSTASH(c) == (hv)) ++#endif ++ ++#endif /* USE_ITHREADS */ ++#ifndef IN_PERL_COMPILETIME ++# define IN_PERL_COMPILETIME (PL_curcop == &PL_compiling) ++#endif ++ ++#ifndef IN_LOCALE_RUNTIME ++# define IN_LOCALE_RUNTIME (PL_curcop->op_private & HINT_LOCALE) ++#endif ++ ++#ifndef IN_LOCALE_COMPILETIME ++# define IN_LOCALE_COMPILETIME (PL_hints & HINT_LOCALE) ++#endif ++ ++#ifndef IN_LOCALE ++# define IN_LOCALE (IN_PERL_COMPILETIME ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME) ++#endif ++#ifndef IS_NUMBER_IN_UV ++# define IS_NUMBER_IN_UV 0x01 ++#endif ++ ++#ifndef IS_NUMBER_GREATER_THAN_UV_MAX ++# define IS_NUMBER_GREATER_THAN_UV_MAX 0x02 ++#endif ++ ++#ifndef IS_NUMBER_NOT_INT ++# define IS_NUMBER_NOT_INT 0x04 ++#endif ++ ++#ifndef IS_NUMBER_NEG ++# define IS_NUMBER_NEG 0x08 ++#endif ++ ++#ifndef IS_NUMBER_INFINITY ++# define IS_NUMBER_INFINITY 0x10 ++#endif ++ ++#ifndef IS_NUMBER_NAN ++# define IS_NUMBER_NAN 0x20 ++#endif ++#ifndef GROK_NUMERIC_RADIX ++# define GROK_NUMERIC_RADIX(sp, send) grok_numeric_radix(sp, send) ++#endif ++#ifndef PERL_SCAN_GREATER_THAN_UV_MAX ++# define PERL_SCAN_GREATER_THAN_UV_MAX 0x02 ++#endif ++ ++#ifndef PERL_SCAN_SILENT_ILLDIGIT ++# define PERL_SCAN_SILENT_ILLDIGIT 0x04 ++#endif ++ ++#ifndef PERL_SCAN_ALLOW_UNDERSCORES ++# define PERL_SCAN_ALLOW_UNDERSCORES 0x01 ++#endif ++ ++#ifndef PERL_SCAN_DISALLOW_PREFIX ++# define PERL_SCAN_DISALLOW_PREFIX 0x02 ++#endif ++ ++#ifndef grok_numeric_radix ++#if defined(NEED_grok_numeric_radix) ++static bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send); ++static ++#else ++extern bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send); ++#endif ++ ++#ifdef grok_numeric_radix ++# undef grok_numeric_radix ++#endif ++#define grok_numeric_radix(a,b) DPPP_(my_grok_numeric_radix)(aTHX_ a,b) ++#define Perl_grok_numeric_radix DPPP_(my_grok_numeric_radix) ++ ++#if defined(NEED_grok_numeric_radix) || defined(NEED_grok_numeric_radix_GLOBAL) ++bool ++DPPP_(my_grok_numeric_radix)(pTHX_ const char **sp, const char *send) ++{ ++#ifdef USE_LOCALE_NUMERIC ++#ifdef PL_numeric_radix_sv ++ if (PL_numeric_radix_sv && IN_LOCALE) { ++ STRLEN len; ++ char* radix = SvPV(PL_numeric_radix_sv, len); ++ if (*sp + len <= send && memEQ(*sp, radix, len)) { ++ *sp += len; ++ return TRUE; ++ } ++ } ++#else ++ /* older perls don't have PL_numeric_radix_sv so the radix ++ * must manually be requested from locale.h ++ */ ++#include ++ dTHR; /* needed for older threaded perls */ ++ struct lconv *lc = localeconv(); ++ char *radix = lc->decimal_point; ++ if (radix && IN_LOCALE) { ++ STRLEN len = strlen(radix); ++ if (*sp + len <= send && memEQ(*sp, radix, len)) { ++ *sp += len; ++ return TRUE; ++ } ++ } ++#endif ++#endif /* USE_LOCALE_NUMERIC */ ++ /* always try "." if numeric radix didn't match because ++ * we may have data from different locales mixed */ ++ if (*sp < send && **sp == '.') { ++ ++*sp; ++ return TRUE; ++ } ++ return FALSE; ++} ++#endif ++#endif ++ ++#ifndef grok_number ++#if defined(NEED_grok_number) ++static int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep); ++static ++#else ++extern int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep); ++#endif ++ ++#ifdef grok_number ++# undef grok_number ++#endif ++#define grok_number(a,b,c) DPPP_(my_grok_number)(aTHX_ a,b,c) ++#define Perl_grok_number DPPP_(my_grok_number) ++ ++#if defined(NEED_grok_number) || defined(NEED_grok_number_GLOBAL) ++int ++DPPP_(my_grok_number)(pTHX_ const char *pv, STRLEN len, UV *valuep) ++{ ++ const char *s = pv; ++ const char *send = pv + len; ++ const UV max_div_10 = UV_MAX / 10; ++ const char max_mod_10 = UV_MAX % 10; ++ int numtype = 0; ++ int sawinf = 0; ++ int sawnan = 0; ++ ++ while (s < send && isSPACE(*s)) ++ s++; ++ if (s == send) { ++ return 0; ++ } else if (*s == '-') { ++ s++; ++ numtype = IS_NUMBER_NEG; ++ } ++ else if (*s == '+') ++ s++; ++ ++ if (s == send) ++ return 0; ++ ++ /* next must be digit or the radix separator or beginning of infinity */ ++ if (isDIGIT(*s)) { ++ /* UVs are at least 32 bits, so the first 9 decimal digits cannot ++ overflow. */ ++ UV value = *s - '0'; ++ /* This construction seems to be more optimiser friendly. ++ (without it gcc does the isDIGIT test and the *s - '0' separately) ++ With it gcc on arm is managing 6 instructions (6 cycles) per digit. ++ In theory the optimiser could deduce how far to unroll the loop ++ before checking for overflow. */ ++ if (++s < send) { ++ int digit = *s - '0'; ++ if (digit >= 0 && digit <= 9) { ++ value = value * 10 + digit; ++ if (++s < send) { ++ digit = *s - '0'; ++ if (digit >= 0 && digit <= 9) { ++ value = value * 10 + digit; ++ if (++s < send) { ++ digit = *s - '0'; ++ if (digit >= 0 && digit <= 9) { ++ value = value * 10 + digit; ++ if (++s < send) { ++ digit = *s - '0'; ++ if (digit >= 0 && digit <= 9) { ++ value = value * 10 + digit; ++ if (++s < send) { ++ digit = *s - '0'; ++ if (digit >= 0 && digit <= 9) { ++ value = value * 10 + digit; ++ if (++s < send) { ++ digit = *s - '0'; ++ if (digit >= 0 && digit <= 9) { ++ value = value * 10 + digit; ++ if (++s < send) { ++ digit = *s - '0'; ++ if (digit >= 0 && digit <= 9) { ++ value = value * 10 + digit; ++ if (++s < send) { ++ digit = *s - '0'; ++ if (digit >= 0 && digit <= 9) { ++ value = value * 10 + digit; ++ if (++s < send) { ++ /* Now got 9 digits, so need to check ++ each time for overflow. */ ++ digit = *s - '0'; ++ while (digit >= 0 && digit <= 9 ++ && (value < max_div_10 ++ || (value == max_div_10 ++ && digit <= max_mod_10))) { ++ value = value * 10 + digit; ++ if (++s < send) ++ digit = *s - '0'; ++ else ++ break; ++ } ++ if (digit >= 0 && digit <= 9 ++ && (s < send)) { ++ /* value overflowed. ++ skip the remaining digits, don't ++ worry about setting *valuep. */ ++ do { ++ s++; ++ } while (s < send && isDIGIT(*s)); ++ numtype |= ++ IS_NUMBER_GREATER_THAN_UV_MAX; ++ goto skip_value; ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ numtype |= IS_NUMBER_IN_UV; ++ if (valuep) ++ *valuep = value; ++ ++ skip_value: ++ if (GROK_NUMERIC_RADIX(&s, send)) { ++ numtype |= IS_NUMBER_NOT_INT; ++ while (s < send && isDIGIT(*s)) /* optional digits after the radix */ ++ s++; ++ } ++ } ++ else if (GROK_NUMERIC_RADIX(&s, send)) { ++ numtype |= IS_NUMBER_NOT_INT | IS_NUMBER_IN_UV; /* valuep assigned below */ ++ /* no digits before the radix means we need digits after it */ ++ if (s < send && isDIGIT(*s)) { ++ do { ++ s++; ++ } while (s < send && isDIGIT(*s)); ++ if (valuep) { ++ /* integer approximation is valid - it's 0. */ ++ *valuep = 0; ++ } ++ } ++ else ++ return 0; ++ } else if (*s == 'I' || *s == 'i') { ++ s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; ++ s++; if (s == send || (*s != 'F' && *s != 'f')) return 0; ++ s++; if (s < send && (*s == 'I' || *s == 'i')) { ++ s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; ++ s++; if (s == send || (*s != 'I' && *s != 'i')) return 0; ++ s++; if (s == send || (*s != 'T' && *s != 't')) return 0; ++ s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0; ++ s++; ++ } ++ sawinf = 1; ++ } else if (*s == 'N' || *s == 'n') { ++ /* XXX TODO: There are signaling NaNs and quiet NaNs. */ ++ s++; if (s == send || (*s != 'A' && *s != 'a')) return 0; ++ s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; ++ s++; ++ sawnan = 1; ++ } else ++ return 0; ++ ++ if (sawinf) { ++ numtype &= IS_NUMBER_NEG; /* Keep track of sign */ ++ numtype |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT; ++ } else if (sawnan) { ++ numtype &= IS_NUMBER_NEG; /* Keep track of sign */ ++ numtype |= IS_NUMBER_NAN | IS_NUMBER_NOT_INT; ++ } else if (s < send) { ++ /* we can have an optional exponent part */ ++ if (*s == 'e' || *s == 'E') { ++ /* The only flag we keep is sign. Blow away any "it's UV" */ ++ numtype &= IS_NUMBER_NEG; ++ numtype |= IS_NUMBER_NOT_INT; ++ s++; ++ if (s < send && (*s == '-' || *s == '+')) ++ s++; ++ if (s < send && isDIGIT(*s)) { ++ do { ++ s++; ++ } while (s < send && isDIGIT(*s)); ++ } ++ else ++ return 0; ++ } ++ } ++ while (s < send && isSPACE(*s)) ++ s++; ++ if (s >= send) ++ return numtype; ++ if (len == 10 && memEQ(pv, "0 but true", 10)) { ++ if (valuep) ++ *valuep = 0; ++ return IS_NUMBER_IN_UV; ++ } ++ return 0; ++} ++#endif ++#endif ++ ++/* ++ * The grok_* routines have been modified to use warn() instead of ++ * Perl_warner(). Also, 'hexdigit' was the former name of PL_hexdigit, ++ * which is why the stack variable has been renamed to 'xdigit'. ++ */ ++ ++#ifndef grok_bin ++#if defined(NEED_grok_bin) ++static UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); ++static ++#else ++extern UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); ++#endif ++ ++#ifdef grok_bin ++# undef grok_bin ++#endif ++#define grok_bin(a,b,c,d) DPPP_(my_grok_bin)(aTHX_ a,b,c,d) ++#define Perl_grok_bin DPPP_(my_grok_bin) ++ ++#if defined(NEED_grok_bin) || defined(NEED_grok_bin_GLOBAL) ++UV ++DPPP_(my_grok_bin)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) ++{ ++ const char *s = start; ++ STRLEN len = *len_p; ++ UV value = 0; ++ NV value_nv = 0; ++ ++ const UV max_div_2 = UV_MAX / 2; ++ bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; ++ bool overflowed = FALSE; ++ ++ if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { ++ /* strip off leading b or 0b. ++ for compatibility silently suffer "b" and "0b" as valid binary ++ numbers. */ ++ if (len >= 1) { ++ if (s[0] == 'b') { ++ s++; ++ len--; ++ } ++ else if (len >= 2 && s[0] == '0' && s[1] == 'b') { ++ s+=2; ++ len-=2; ++ } ++ } ++ } ++ ++ for (; len-- && *s; s++) { ++ char bit = *s; ++ if (bit == '0' || bit == '1') { ++ /* Write it in this wonky order with a goto to attempt to get the ++ compiler to make the common case integer-only loop pretty tight. ++ With gcc seems to be much straighter code than old scan_bin. */ ++ redo: ++ if (!overflowed) { ++ if (value <= max_div_2) { ++ value = (value << 1) | (bit - '0'); ++ continue; ++ } ++ /* Bah. We're just overflowed. */ ++ warn("Integer overflow in binary number"); ++ overflowed = TRUE; ++ value_nv = (NV) value; ++ } ++ value_nv *= 2.0; ++ /* If an NV has not enough bits in its mantissa to ++ * represent a UV this summing of small low-order numbers ++ * is a waste of time (because the NV cannot preserve ++ * the low-order bits anyway): we could just remember when ++ * did we overflow and in the end just multiply value_nv by the ++ * right amount. */ ++ value_nv += (NV)(bit - '0'); ++ continue; ++ } ++ if (bit == '_' && len && allow_underscores && (bit = s[1]) ++ && (bit == '0' || bit == '1')) ++ { ++ --len; ++ ++s; ++ goto redo; ++ } ++ if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) ++ warn("Illegal binary digit '%c' ignored", *s); ++ break; ++ } ++ ++ if ( ( overflowed && value_nv > 4294967295.0) ++#if UVSIZE > 4 ++ || (!overflowed && value > 0xffffffff ) ++#endif ++ ) { ++ warn("Binary number > 0b11111111111111111111111111111111 non-portable"); ++ } ++ *len_p = s - start; ++ if (!overflowed) { ++ *flags = 0; ++ return value; ++ } ++ *flags = PERL_SCAN_GREATER_THAN_UV_MAX; ++ if (result) ++ *result = value_nv; ++ return UV_MAX; ++} ++#endif ++#endif ++ ++#ifndef grok_hex ++#if defined(NEED_grok_hex) ++static UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); ++static ++#else ++extern UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); ++#endif ++ ++#ifdef grok_hex ++# undef grok_hex ++#endif ++#define grok_hex(a,b,c,d) DPPP_(my_grok_hex)(aTHX_ a,b,c,d) ++#define Perl_grok_hex DPPP_(my_grok_hex) ++ ++#if defined(NEED_grok_hex) || defined(NEED_grok_hex_GLOBAL) ++UV ++DPPP_(my_grok_hex)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) ++{ ++ const char *s = start; ++ STRLEN len = *len_p; ++ UV value = 0; ++ NV value_nv = 0; ++ ++ const UV max_div_16 = UV_MAX / 16; ++ bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; ++ bool overflowed = FALSE; ++ const char *xdigit; ++ ++ if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { ++ /* strip off leading x or 0x. ++ for compatibility silently suffer "x" and "0x" as valid hex numbers. ++ */ ++ if (len >= 1) { ++ if (s[0] == 'x') { ++ s++; ++ len--; ++ } ++ else if (len >= 2 && s[0] == '0' && s[1] == 'x') { ++ s+=2; ++ len-=2; ++ } ++ } ++ } ++ ++ for (; len-- && *s; s++) { ++ xdigit = strchr((char *) PL_hexdigit, *s); ++ if (xdigit) { ++ /* Write it in this wonky order with a goto to attempt to get the ++ compiler to make the common case integer-only loop pretty tight. ++ With gcc seems to be much straighter code than old scan_hex. */ ++ redo: ++ if (!overflowed) { ++ if (value <= max_div_16) { ++ value = (value << 4) | ((xdigit - PL_hexdigit) & 15); ++ continue; ++ } ++ warn("Integer overflow in hexadecimal number"); ++ overflowed = TRUE; ++ value_nv = (NV) value; ++ } ++ value_nv *= 16.0; ++ /* If an NV has not enough bits in its mantissa to ++ * represent a UV this summing of small low-order numbers ++ * is a waste of time (because the NV cannot preserve ++ * the low-order bits anyway): we could just remember when ++ * did we overflow and in the end just multiply value_nv by the ++ * right amount of 16-tuples. */ ++ value_nv += (NV)((xdigit - PL_hexdigit) & 15); ++ continue; ++ } ++ if (*s == '_' && len && allow_underscores && s[1] ++ && (xdigit = strchr((char *) PL_hexdigit, s[1]))) ++ { ++ --len; ++ ++s; ++ goto redo; ++ } ++ if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) ++ warn("Illegal hexadecimal digit '%c' ignored", *s); ++ break; ++ } ++ ++ if ( ( overflowed && value_nv > 4294967295.0) ++#if UVSIZE > 4 ++ || (!overflowed && value > 0xffffffff ) ++#endif ++ ) { ++ warn("Hexadecimal number > 0xffffffff non-portable"); ++ } ++ *len_p = s - start; ++ if (!overflowed) { ++ *flags = 0; ++ return value; ++ } ++ *flags = PERL_SCAN_GREATER_THAN_UV_MAX; ++ if (result) ++ *result = value_nv; ++ return UV_MAX; ++} ++#endif ++#endif ++ ++#ifndef grok_oct ++#if defined(NEED_grok_oct) ++static UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); ++static ++#else ++extern UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); ++#endif ++ ++#ifdef grok_oct ++# undef grok_oct ++#endif ++#define grok_oct(a,b,c,d) DPPP_(my_grok_oct)(aTHX_ a,b,c,d) ++#define Perl_grok_oct DPPP_(my_grok_oct) ++ ++#if defined(NEED_grok_oct) || defined(NEED_grok_oct_GLOBAL) ++UV ++DPPP_(my_grok_oct)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) ++{ ++ const char *s = start; ++ STRLEN len = *len_p; ++ UV value = 0; ++ NV value_nv = 0; ++ ++ const UV max_div_8 = UV_MAX / 8; ++ bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; ++ bool overflowed = FALSE; ++ ++ for (; len-- && *s; s++) { ++ /* gcc 2.95 optimiser not smart enough to figure that this subtraction ++ out front allows slicker code. */ ++ int digit = *s - '0'; ++ if (digit >= 0 && digit <= 7) { ++ /* Write it in this wonky order with a goto to attempt to get the ++ compiler to make the common case integer-only loop pretty tight. ++ */ ++ redo: ++ if (!overflowed) { ++ if (value <= max_div_8) { ++ value = (value << 3) | digit; ++ continue; ++ } ++ /* Bah. We're just overflowed. */ ++ warn("Integer overflow in octal number"); ++ overflowed = TRUE; ++ value_nv = (NV) value; ++ } ++ value_nv *= 8.0; ++ /* If an NV has not enough bits in its mantissa to ++ * represent a UV this summing of small low-order numbers ++ * is a waste of time (because the NV cannot preserve ++ * the low-order bits anyway): we could just remember when ++ * did we overflow and in the end just multiply value_nv by the ++ * right amount of 8-tuples. */ ++ value_nv += (NV)digit; ++ continue; ++ } ++ if (digit == ('_' - '0') && len && allow_underscores ++ && (digit = s[1] - '0') && (digit >= 0 && digit <= 7)) ++ { ++ --len; ++ ++s; ++ goto redo; ++ } ++ /* Allow \octal to work the DWIM way (that is, stop scanning ++ * as soon as non-octal characters are seen, complain only iff ++ * someone seems to want to use the digits eight and nine). */ ++ if (digit == 8 || digit == 9) { ++ if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) ++ warn("Illegal octal digit '%c' ignored", *s); ++ } ++ break; ++ } ++ ++ if ( ( overflowed && value_nv > 4294967295.0) ++#if UVSIZE > 4 ++ || (!overflowed && value > 0xffffffff ) ++#endif ++ ) { ++ warn("Octal number > 037777777777 non-portable"); ++ } ++ *len_p = s - start; ++ if (!overflowed) { ++ *flags = 0; ++ return value; ++ } ++ *flags = PERL_SCAN_GREATER_THAN_UV_MAX; ++ if (result) ++ *result = value_nv; ++ return UV_MAX; ++} ++#endif ++#endif ++ ++#if !defined(my_snprintf) ++#if defined(NEED_my_snprintf) ++static int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...); ++static ++#else ++extern int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...); ++#endif ++ ++#define my_snprintf DPPP_(my_my_snprintf) ++#define Perl_my_snprintf DPPP_(my_my_snprintf) ++ ++#if defined(NEED_my_snprintf) || defined(NEED_my_snprintf_GLOBAL) ++ ++int ++DPPP_(my_my_snprintf)(char *buffer, const Size_t len, const char *format, ...) ++{ ++ dTHX; ++ int retval; ++ va_list ap; ++ va_start(ap, format); ++#ifdef HAS_VSNPRINTF ++ retval = vsnprintf(buffer, len, format, ap); ++#else ++ retval = vsprintf(buffer, format, ap); ++#endif ++ va_end(ap); ++ if (retval < 0 || (len > 0 && (Size_t)retval >= len)) ++ Perl_croak(aTHX_ "panic: my_snprintf buffer overflow"); ++ return retval; ++} ++ ++#endif ++#endif ++ ++#if !defined(my_sprintf) ++#if defined(NEED_my_sprintf) ++static int DPPP_(my_my_sprintf)(char * buffer, const char * pat, ...); ++static ++#else ++extern int DPPP_(my_my_sprintf)(char * buffer, const char * pat, ...); ++#endif ++ ++#define my_sprintf DPPP_(my_my_sprintf) ++#define Perl_my_sprintf DPPP_(my_my_sprintf) ++ ++#if defined(NEED_my_sprintf) || defined(NEED_my_sprintf_GLOBAL) ++ ++int ++DPPP_(my_my_sprintf)(char *buffer, const char* pat, ...) ++{ ++ va_list args; ++ va_start(args, pat); ++ vsprintf(buffer, pat, args); ++ va_end(args); ++ return strlen(buffer); ++} ++ ++#endif ++#endif ++ ++#ifdef NO_XSLOCKS ++# ifdef dJMPENV ++# define dXCPT dJMPENV; int rEtV = 0 ++# define XCPT_TRY_START JMPENV_PUSH(rEtV); if (rEtV == 0) ++# define XCPT_TRY_END JMPENV_POP; ++# define XCPT_CATCH if (rEtV != 0) ++# define XCPT_RETHROW JMPENV_JUMP(rEtV) ++# else ++# define dXCPT Sigjmp_buf oldTOP; int rEtV = 0 ++# define XCPT_TRY_START Copy(top_env, oldTOP, 1, Sigjmp_buf); rEtV = Sigsetjmp(top_env, 1); if (rEtV == 0) ++# define XCPT_TRY_END Copy(oldTOP, top_env, 1, Sigjmp_buf); ++# define XCPT_CATCH if (rEtV != 0) ++# define XCPT_RETHROW Siglongjmp(top_env, rEtV) ++# endif ++#endif ++ ++#if !defined(my_strlcat) ++#if defined(NEED_my_strlcat) ++static Size_t DPPP_(my_my_strlcat)(char * dst, const char * src, Size_t size); ++static ++#else ++extern Size_t DPPP_(my_my_strlcat)(char * dst, const char * src, Size_t size); ++#endif ++ ++#define my_strlcat DPPP_(my_my_strlcat) ++#define Perl_my_strlcat DPPP_(my_my_strlcat) ++ ++#if defined(NEED_my_strlcat) || defined(NEED_my_strlcat_GLOBAL) ++ ++Size_t ++DPPP_(my_my_strlcat)(char *dst, const char *src, Size_t size) ++{ ++ Size_t used, length, copy; ++ ++ used = strlen(dst); ++ length = strlen(src); ++ if (size > 0 && used < size - 1) { ++ copy = (length >= size - used) ? size - used - 1 : length; ++ memcpy(dst + used, src, copy); ++ dst[used + copy] = '\0'; ++ } ++ return used + length; ++} ++#endif ++#endif ++ ++#if !defined(my_strlcpy) ++#if defined(NEED_my_strlcpy) ++static Size_t DPPP_(my_my_strlcpy)(char * dst, const char * src, Size_t size); ++static ++#else ++extern Size_t DPPP_(my_my_strlcpy)(char * dst, const char * src, Size_t size); ++#endif ++ ++#define my_strlcpy DPPP_(my_my_strlcpy) ++#define Perl_my_strlcpy DPPP_(my_my_strlcpy) ++ ++#if defined(NEED_my_strlcpy) || defined(NEED_my_strlcpy_GLOBAL) ++ ++Size_t ++DPPP_(my_my_strlcpy)(char *dst, const char *src, Size_t size) ++{ ++ Size_t length, copy; ++ ++ length = strlen(src); ++ if (size > 0) { ++ copy = (length >= size) ? size - 1 : length; ++ memcpy(dst, src, copy); ++ dst[copy] = '\0'; ++ } ++ return length; ++} ++ ++#endif ++#endif ++#ifndef PERL_PV_ESCAPE_QUOTE ++# define PERL_PV_ESCAPE_QUOTE 0x0001 ++#endif ++ ++#ifndef PERL_PV_PRETTY_QUOTE ++# define PERL_PV_PRETTY_QUOTE PERL_PV_ESCAPE_QUOTE ++#endif ++ ++#ifndef PERL_PV_PRETTY_ELLIPSES ++# define PERL_PV_PRETTY_ELLIPSES 0x0002 ++#endif ++ ++#ifndef PERL_PV_PRETTY_LTGT ++# define PERL_PV_PRETTY_LTGT 0x0004 ++#endif ++ ++#ifndef PERL_PV_ESCAPE_FIRSTCHAR ++# define PERL_PV_ESCAPE_FIRSTCHAR 0x0008 ++#endif ++ ++#ifndef PERL_PV_ESCAPE_UNI ++# define PERL_PV_ESCAPE_UNI 0x0100 ++#endif ++ ++#ifndef PERL_PV_ESCAPE_UNI_DETECT ++# define PERL_PV_ESCAPE_UNI_DETECT 0x0200 ++#endif ++ ++#ifndef PERL_PV_ESCAPE_ALL ++# define PERL_PV_ESCAPE_ALL 0x1000 ++#endif ++ ++#ifndef PERL_PV_ESCAPE_NOBACKSLASH ++# define PERL_PV_ESCAPE_NOBACKSLASH 0x2000 ++#endif ++ ++#ifndef PERL_PV_ESCAPE_NOCLEAR ++# define PERL_PV_ESCAPE_NOCLEAR 0x4000 ++#endif ++ ++#ifndef PERL_PV_ESCAPE_RE ++# define PERL_PV_ESCAPE_RE 0x8000 ++#endif ++ ++#ifndef PERL_PV_PRETTY_NOCLEAR ++# define PERL_PV_PRETTY_NOCLEAR PERL_PV_ESCAPE_NOCLEAR ++#endif ++#ifndef PERL_PV_PRETTY_DUMP ++# define PERL_PV_PRETTY_DUMP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_QUOTE ++#endif ++ ++#ifndef PERL_PV_PRETTY_REGPROP ++# define PERL_PV_PRETTY_REGPROP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_LTGT|PERL_PV_ESCAPE_RE ++#endif ++ ++/* Hint: pv_escape ++ * Note that unicode functionality is only backported to ++ * those perl versions that support it. For older perl ++ * versions, the implementation will fall back to bytes. ++ */ ++ ++#ifndef pv_escape ++#if defined(NEED_pv_escape) ++static char * DPPP_(my_pv_escape)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags); ++static ++#else ++extern char * DPPP_(my_pv_escape)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags); ++#endif ++ ++#ifdef pv_escape ++# undef pv_escape ++#endif ++#define pv_escape(a,b,c,d,e,f) DPPP_(my_pv_escape)(aTHX_ a,b,c,d,e,f) ++#define Perl_pv_escape DPPP_(my_pv_escape) ++ ++#if defined(NEED_pv_escape) || defined(NEED_pv_escape_GLOBAL) ++ ++char * ++DPPP_(my_pv_escape)(pTHX_ SV *dsv, char const * const str, ++ const STRLEN count, const STRLEN max, ++ STRLEN * const escaped, const U32 flags) ++{ ++ const char esc = flags & PERL_PV_ESCAPE_RE ? '%' : '\\'; ++ const char dq = flags & PERL_PV_ESCAPE_QUOTE ? '"' : esc; ++ char octbuf[32] = "%123456789ABCDF"; ++ STRLEN wrote = 0; ++ STRLEN chsize = 0; ++ STRLEN readsize = 1; ++#if defined(is_utf8_string) && defined(utf8_to_uvchr) ++ bool isuni = flags & PERL_PV_ESCAPE_UNI ? 1 : 0; ++#endif ++ const char *pv = str; ++ const char * const end = pv + count; ++ octbuf[0] = esc; ++ ++ if (!(flags & PERL_PV_ESCAPE_NOCLEAR)) ++ sv_setpvs(dsv, ""); ++ ++#if defined(is_utf8_string) && defined(utf8_to_uvchr) ++ if ((flags & PERL_PV_ESCAPE_UNI_DETECT) && is_utf8_string((U8*)pv, count)) ++ isuni = 1; ++#endif ++ ++ for (; pv < end && (!max || wrote < max) ; pv += readsize) { ++ const UV u = ++#if defined(is_utf8_string) && defined(utf8_to_uvchr) ++ isuni ? utf8_to_uvchr((U8*)pv, &readsize) : ++#endif ++ (U8)*pv; ++ const U8 c = (U8)u & 0xFF; ++ ++ if (u > 255 || (flags & PERL_PV_ESCAPE_ALL)) { ++ if (flags & PERL_PV_ESCAPE_FIRSTCHAR) ++ chsize = my_snprintf(octbuf, sizeof octbuf, ++ "%"UVxf, u); ++ else ++ chsize = my_snprintf(octbuf, sizeof octbuf, ++ "%cx{%"UVxf"}", esc, u); ++ } else if (flags & PERL_PV_ESCAPE_NOBACKSLASH) { ++ chsize = 1; ++ } else { ++ if (c == dq || c == esc || !isPRINT(c)) { ++ chsize = 2; ++ switch (c) { ++ case '\\' : /* fallthrough */ ++ case '%' : if (c == esc) ++ octbuf[1] = esc; ++ else ++ chsize = 1; ++ break; ++ case '\v' : octbuf[1] = 'v'; break; ++ case '\t' : octbuf[1] = 't'; break; ++ case '\r' : octbuf[1] = 'r'; break; ++ case '\n' : octbuf[1] = 'n'; break; ++ case '\f' : octbuf[1] = 'f'; break; ++ case '"' : if (dq == '"') ++ octbuf[1] = '"'; ++ else ++ chsize = 1; ++ break; ++ default: chsize = my_snprintf(octbuf, sizeof octbuf, ++ pv < end && isDIGIT((U8)*(pv+readsize)) ++ ? "%c%03o" : "%c%o", esc, c); ++ } ++ } else { ++ chsize = 1; ++ } ++ } ++ if (max && wrote + chsize > max) { ++ break; ++ } else if (chsize > 1) { ++ sv_catpvn(dsv, octbuf, chsize); ++ wrote += chsize; ++ } else { ++ char tmp[2]; ++ my_snprintf(tmp, sizeof tmp, "%c", c); ++ sv_catpvn(dsv, tmp, 1); ++ wrote++; ++ } ++ if (flags & PERL_PV_ESCAPE_FIRSTCHAR) ++ break; ++ } ++ if (escaped != NULL) ++ *escaped= pv - str; ++ return SvPVX(dsv); ++} ++ ++#endif ++#endif ++ ++#ifndef pv_pretty ++#if defined(NEED_pv_pretty) ++static char * DPPP_(my_pv_pretty)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags); ++static ++#else ++extern char * DPPP_(my_pv_pretty)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags); ++#endif ++ ++#ifdef pv_pretty ++# undef pv_pretty ++#endif ++#define pv_pretty(a,b,c,d,e,f,g) DPPP_(my_pv_pretty)(aTHX_ a,b,c,d,e,f,g) ++#define Perl_pv_pretty DPPP_(my_pv_pretty) ++ ++#if defined(NEED_pv_pretty) || defined(NEED_pv_pretty_GLOBAL) ++ ++char * ++DPPP_(my_pv_pretty)(pTHX_ SV *dsv, char const * const str, const STRLEN count, ++ const STRLEN max, char const * const start_color, char const * const end_color, ++ const U32 flags) ++{ ++ const U8 dq = (flags & PERL_PV_PRETTY_QUOTE) ? '"' : '%'; ++ STRLEN escaped; ++ ++ if (!(flags & PERL_PV_PRETTY_NOCLEAR)) ++ sv_setpvs(dsv, ""); ++ ++ if (dq == '"') ++ sv_catpvs(dsv, "\""); ++ else if (flags & PERL_PV_PRETTY_LTGT) ++ sv_catpvs(dsv, "<"); ++ ++ if (start_color != NULL) ++ sv_catpv(dsv, D_PPP_CONSTPV_ARG(start_color)); ++ ++ pv_escape(dsv, str, count, max, &escaped, flags | PERL_PV_ESCAPE_NOCLEAR); ++ ++ if (end_color != NULL) ++ sv_catpv(dsv, D_PPP_CONSTPV_ARG(end_color)); ++ ++ if (dq == '"') ++ sv_catpvs(dsv, "\""); ++ else if (flags & PERL_PV_PRETTY_LTGT) ++ sv_catpvs(dsv, ">"); ++ ++ if ((flags & PERL_PV_PRETTY_ELLIPSES) && escaped < count) ++ sv_catpvs(dsv, "..."); ++ ++ return SvPVX(dsv); ++} ++ ++#endif ++#endif ++ ++#ifndef pv_display ++#if defined(NEED_pv_display) ++static char * DPPP_(my_pv_display)(pTHX_ SV * dsv, const char * pv, STRLEN cur, STRLEN len, STRLEN pvlim); ++static ++#else ++extern char * DPPP_(my_pv_display)(pTHX_ SV * dsv, const char * pv, STRLEN cur, STRLEN len, STRLEN pvlim); ++#endif ++ ++#ifdef pv_display ++# undef pv_display ++#endif ++#define pv_display(a,b,c,d,e) DPPP_(my_pv_display)(aTHX_ a,b,c,d,e) ++#define Perl_pv_display DPPP_(my_pv_display) ++ ++#if defined(NEED_pv_display) || defined(NEED_pv_display_GLOBAL) ++ ++char * ++DPPP_(my_pv_display)(pTHX_ SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pvlim) ++{ ++ pv_pretty(dsv, pv, cur, pvlim, NULL, NULL, PERL_PV_PRETTY_DUMP); ++ if (len > cur && pv[cur] == '\0') ++ sv_catpvs(dsv, "\\0"); ++ return SvPVX(dsv); ++} ++ ++#endif ++#endif ++ ++#endif /* _P_P_PORTABILITY_H_ */ ++ ++/* End of File ppport.h */ diff --git a/lang/perl-xml-parser/patches/020-xml-parser-expat-lib-inc-path-anchor.patch b/lang/perl-xml-parser/patches/020-xml-parser-expat-lib-inc-path-anchor.patch new file mode 100644 index 0000000..4e17daa --- /dev/null +++ b/lang/perl-xml-parser/patches/020-xml-parser-expat-lib-inc-path-anchor.patch @@ -0,0 +1,12 @@ +--- a/Expat/Makefile.PL ++++ b/Expat/Makefile.PL +@@ -2,6 +2,9 @@ use ExtUtils::MakeMaker; + use Config; + use English; + ++$expat_libpath = '%%EXPAT_LIBPATH%%'; ++$expat_incpath = '%%EXPAT_INCPATH%%'; ++ + my $libs = "-lexpat"; + my @extras = (); + diff --git a/lang/perl/Config.in b/lang/perl/Config.in new file mode 100644 index 0000000..14aedc2 --- /dev/null +++ b/lang/perl/Config.in @@ -0,0 +1,20 @@ +menu "Configuration" + depends on PACKAGE_perl + +config PERL_THREADS + bool "Enable threading support" + default y if (mips || mipsel || i386 || i686 || x86_64 || armeb || arm) + default n + +config PERL_TESTS + bool "Include perl tests" + default n + help + Include test suites for all perl packages. + + This will increase the size of perl and related packages + considerably. + Test support is still in development. Some tests will fail, + others are just missing completely. + +endmenu diff --git a/lang/perl/Makefile b/lang/perl/Makefile new file mode 100644 index 0000000..7c7f10d --- /dev/null +++ b/lang/perl/Makefile @@ -0,0 +1,184 @@ +# +# Copyright (C) 2006-2016 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:=perl +PKG_VERSION:=5.22.1 +PKG_RELEASE:=3 + +PKG_SOURCE_URL:=ftp://ftp.cpan.org/pub/CPAN/src/5.0 \ + http://www.cpan.org/src/5.0 \ + ftp://ftp.mpi-sb.mpg.de/pub/perl/CPAN/src/5.0 \ + http://ftp.mpi-sb.mpg.de/pub/perl/CPAN/src/5.0 \ + ftp://ftp.gmd.de/mirrors/CPAN/src/5.0 \ + http://ftp5.gwdg.de/pub/languages/perl/CPAN/src/ \ + ftp://ftp.funet.fi/pub/languages/perl/CPAN/src/5.0 \ + http://ftp.funet.fi/pub/languages/perl/CPAN/src/5.0 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=19295bbb775a3c36123161b9bf4892f1 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_LICENSE_FILES:=Copying Artistic README +PKG_MAINTAINER:=Marcel Denia + +# Build settings +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/$(PKG_NAME)-$(PKG_VERSION) +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/perl/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL:=1 +PKG_BUILD_DEPENDS:=perl/host +PKG_BUILD_PARALLEL:=1 +HOST_BUILD_PARALLEL:=1 + +# Variables used during configuration/build +HOST_PERL_PREFIX:=$(STAGING_DIR)/host/usr + +# Filter -g3, it will break Compress-Raw-Zlib +TARGET_CFLAGS_PERL:=$(patsubst -g3,-g,$(TARGET_CFLAGS)) +TARGET_CPPFLAGS_PERL:=$(patsubst -g3,-g,$(TARGET_CPPFLAGS)) + +# A list of disabled tests +# ExtUtils tests are disabled for now as we don't support building +# native extensions on the target machine at the moment +PERL_DISABLEDTESTS:=cpan/ExtUtils-Constant cpan/ExtUtils-MakeMaker +# We're on Linux, so don't even package them +PERL_DISABLEDTESTS+=cpan/Win32API-File cpan/Win32 ext/VMS-DCLsym ext/VMS-Filespec ext/VMS-Stdio ext/Win32CORE os2/ +# NDBM and ODBM not supported +PERL_DISABLEDTESTS+=ext/NDBM_File ext/ODBM_File + + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk +include perlmod.mk + +define Package/perl + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=The Perl intepreter + URL:=http://www.perl.com/ + DEPENDS:=+USE_GLIBC:libbsd +PERL_THREADS:libpthread +endef + +define Package/perl/description + Perl is a stable, cross platform programming language. + It is used for mission critical projects in the public and private sectors + and is widely used to program web applications of all needs. +endef + +define Package/perl/config + source "$(SOURCE)/Config.in" +endef + +# Static host perl +define Host/Configure + ( cd $(HOST_BUILD_DIR); ./Configure -der -Uusedl -Duserelocatableinc -Dprefix=$(HOST_PERL_PREFIX) $(if $(CONFIG_PERL_THREADS),-Dusethreads,)) +endef + +define Host/Install + ( cd $(HOST_BUILD_DIR); ./miniperl installperl ) + $(INSTALL_DIR) $(HOST_PERL_PREFIX)/bin/ + $(CP) $(HOST_BUILD_DIR)/generate_uudmap $(HOST_PERL_PREFIX)/bin/ + + # Link any possibly installed static extension in + $(MAKE) -C $(HOST_BUILD_DIR)/relink clean || true + ( cd $(HOST_BUILD_DIR)/relink && $(HOST_PERL_PREFIX)/bin/perl Makefile.PL ) + $(call perlmod/host/relink,$(HOST_BUILD_DIR)/relink) +endef + +# Target perl +define Build/Configure + $(PERL_CMD) files/perlconfig.pl -Dowrt:target_cc='$(TARGET_CC)' \ + -Dowrt:gccversion=$(CONFIG_GCC_VERSION) \ + -Dowrt:target_cross='$(TARGET_CROSS)' \ + -Dowrt:cflags='$(TARGET_CFLAGS_PERL) $(TARGET_CPPFLAGS_PERL)' \ + -Dowrt:ldflags='-rdynamic $(TARGET_LDFLAGS)' \ + -Dowrt:libc=$(subst uClibc,uclibc,$(CONFIG_LIBC)) \ + -Dowrt:ipv6=$(if $($(CONFIG_IPV6)),define,undef) \ + -Dowrt:threads=$(if $(CONFIG_PERL_THREADS),yes,no) \ + -Dowrt:staging_dir='$(STAGING_DIR)' \ + -Dowrt:host_perl_prefix='$(HOST_PERL_PREFIX)' \ + files/version.config \ + files/base.config \ + files/$(patsubst i386,i486,$(ARCH)).config \ + files/architecture.config \ + files/signal.config \ + files/threads.config \ + files/libc.config \ + files/misc.config \ + > $(PKG_BUILD_DIR)/config.sh + (cd $(PKG_BUILD_DIR) && ./Configure -S) + install -m 0644 $(PKG_BUILD_DIR)/config.h $(PKG_BUILD_DIR)/xconfig.h +endef + +define Build/Compile + +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION) + $(CP) $(PKG_INSTALL_DIR)/usr/lib/perl5/$(PERL_VERSION) $(1)/usr/lib/perl5/ +endef + +define Package/perl/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/perl$(PKG_VERSION) $(1)/usr/bin + ln -nsf perl$(PKG_VERSION) $(1)/usr/bin/perl + + $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)/CORE + $(CP) $(PKG_INSTALL_DIR)/usr/lib/perl5/$(PERL_VERSION)/CORE/libperl.so $(1)/usr/lib/perl5/$(PERL_VERSION)/CORE/ +endef + + +$(eval $(call RequireCommand,rsync, \ + $(PKG_NAME) requires rsync installed on the host-system. \ +)) + +$(eval $(call BuildPackage,perl)) +$(eval $(call HostBuild)) + +-include perlbase.mk + +# A helper package that includes all sort of supplementary files for tests +define Package/perl-tests-common +$(call Package/perlbase-template) +TITLE:=Common test support files +DEPENDS:=@PERL_TESTS +endef + +define Package/perl-tests-common/install + $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR) + $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/Porting + $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/regen + $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/lib + $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)/XS + $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)/auto/XS + $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)/unicore + + $(CP) $(PKG_BUILD_DIR)/t $(1)/$(PERL_TESTSDIR) + $(CP) $(PKG_BUILD_DIR)/Porting $(1)/$(PERL_TESTSDIR) + $(CP) $(PKG_BUILD_DIR)/regen $(1)/$(PERL_TESTSDIR) + $(CP) $(PKG_BUILD_DIR)/MANIFEST $(1)/$(PERL_TESTSDIR) + $(CP) $(PKG_BUILD_DIR)/TestInit.pm $(1)/$(PERL_TESTSDIR) + $(CP) $(PKG_BUILD_DIR)/vutil.c $(1)/$(PERL_TESTSDIR) + $(CP) $(PKG_BUILD_DIR)/vxs.inc $(1)/$(PERL_TESTSDIR) + $(CP) $(PKG_BUILD_DIR)/lib/XS $(1)/usr/lib/perl5/$(PERL_VERSION)/ + $(CP) $(PKG_BUILD_DIR)/lib/auto/XS $(1)/usr/lib/perl5/$(PERL_VERSION)/auto + $(CP) $(PKG_BUILD_DIR)/lib/vmsish.pm $(1)/usr/lib/perl5/$(PERL_VERSION)/ + $(CP) $(PKG_BUILD_DIR)/lib/vmsish.t $(1)/$(PERL_TESTSDIR)/lib + $(CP) $(PKG_BUILD_DIR)/lib/Internals.t $(1)/$(PERL_TESTSDIR)/lib + $(CP) $(PKG_BUILD_DIR)/lib/unicore/TestProp.pl $(1)/usr/lib/perl5/$(PERL_VERSION)/unicore + $(CP) files/perl-run_tests.sh $(1)/$(PERL_TESTSDIR)/run_tests.sh + sed \ + -e 's!%%PERL_DISABLEDTESTS%%!$(PERL_DISABLEDTESTS)!' \ + -e 's!%%PERL_VERSION%%!$(PERL_VERSION)!' \ + -i $(1)/$(PERL_TESTSDIR)/run_tests.sh + $(CP) $(PKG_BUILD_DIR)/config_h.SH $(1)/$(PERL_TESTSDIR) + $(CP) $(PKG_BUILD_DIR)/perl.h $(1)/$(PERL_TESTSDIR) +endef + +$(eval $(call BuildPackage,perl-tests-common)) diff --git a/lang/perl/README.patches b/lang/perl/README.patches new file mode 100644 index 0000000..5f3b595 --- /dev/null +++ b/lang/perl/README.patches @@ -0,0 +1,9 @@ +The patches in this package are loosely sorted into the following categories: + +0xx - Bugfixes +1xx - Cross-compile fixes +3xx - Workarounds +7xx - Testsuite fixes + +Feel free to add another one if your new patch doesn't seem to fit into an +existing category. \ No newline at end of file diff --git a/lang/perl/files/README.config b/lang/perl/files/README.config new file mode 100644 index 0000000..16bf058 --- /dev/null +++ b/lang/perl/files/README.config @@ -0,0 +1,59 @@ +-- Perl configuration -- + +Perl uses a huge configuration file, normally generated via the Configure script +at build-time. This fails when cross-compiling though, so we need to supply our +own. + +We're using perlconfig.pl to piece together the final configuration from a bunch +of configuration files(all ending in .config). Please refer to perlconfig.pl's +POD for information on usage and syntax. + +Throughout the files, you will see a bunch of references to private symbols with +the prefix "owrt". These are used to control output in an effort to both +simplify writing configuration files, as well as to provide switchable options +to select the feature set of the resulting perl installation. + +The following will be a summary/quick reference of all private symbols we're +currently using: + +Passed via architecture configuration file(mipsel.config, i486.config, ...) +--------------------------------------------------------------------------- +Symbol Values Description +owrt:bits 32/64 Target's native word length. +owrt:endian little/big Target's endianness. +owrt:arch mipsel, i486, ... Target's architecture name. +owrt:sig_count 64/128 Number of signals the target + provides(NSIG - 1). +owrt:sigs * Symbolic names of the first 32 signals + this architecture provides, in numeric + order. Separated by whitespaces. +owrt:sig_name_extra * Symbolic names of any additional signals + this architecture provides after + owrt:sig_count. Separated by + whitespaces. +owrt:sig_num_extra * Numeric values associated with the + signal names provided in + owrt:sig_name_extra. Separated by + whitespaces. + +Passed via command line +----------------------- +Symbol Values Description +owrt:libc glibc/uclibc/musl Which C library implementation is in + use. +owrt:threads yes/no Whether to enable threading support. +owrt:ipv6 define/undef Whether to enable IPv6 support. +owrt:target_cross * Target architecture's host triplet. +owrt:target_cc * C compiler to use. +owrt:gccversion * target_cc's version number. +owrt:cflags * Additional C compiler flags. +owrt:ldflags * Additional linker flags. +owrt:staging_dir * Same as OpenWRT buildroot's + $(STAGING_DIR). +owrt:host_perl_prefix * host-perl installation prefix. + +Passed via version.config +------------------------- +Symbol Values Description +owrt:perllibpath * Path to perl library files, from the + target's point of view. diff --git a/lang/perl/files/architecture.config b/lang/perl/files/architecture.config new file mode 100644 index 0000000..cc97281 --- /dev/null +++ b/lang/perl/files/architecture.config @@ -0,0 +1,121 @@ +alignbytes='8' + +($owrt:bits eq '32') { + ($owrt:endian eq 'little') { + byteorder='1234' + } + ($owrt:endian eq 'big') { + byteorder='4321' + } + + # Types + ivsize='4' + uvsize='4' + longsize='4' + longdblsize='8' + ptrsize='4' + + #quadkind='3' + #doublekind='3' + #longdblkind='0' + + i8type='signed char' + i16type='signed short' + i32type='signed long' + i64type='signed long long' + u32type='unsigned long' + u64type='unsigned long long' + quadtype='long long' + uquadtype='unsigned long long' + + sizesize='4' + + use64bitall='undef' + use64bitint='undef' + + uidformat='"lu"' + gidformat='"lu"' + + selectminbits='32' + + sGMTIME_max='2147483647' + sGMTIME_min='-2147483648' + sLOCALTIME_max='2147483647' + sLOCALTIME_min='-2147483648' + + sPRIi64='"Li"' + sPRIo64='"Lo"' + sPRIu64='"Lu"' + sPRIx64='"Lx"' + sPRId64='"Ld"' + + netdb_host_type='const void *' + nv_preserves_uv_bits='32' + d_nv_preserves_uv='define' + d_printf_format_null='define' + d_u32align='undef' +} +($owrt:bits eq '64') { + ($owrt:endian eq 'little') { + byteorder='12345678' + } + ($owrt:endian eq 'big') { + byteorder='87654321' + } + + # Types + ivsize='8' + uvsize='8' + longsize='8' + longdblsize='16' + ptrsize='8' + + quadtype='long' + + i16type='signed short' + i32type='signed int' + i64type='signed long' + i8type='signed char' + + u32type='unsigned int' + u64type='unsigned long' + uquadtype='unsigned long' + + sizesize='8' + + uidformat='"u"' + gidformat='"u"' + + selectminbits='64' + + sGMTIME_max='67768036191676799' + sGMTIME_min='-62167219200' + sLOCALTIME_max='67768036191673199' + sLOCALTIME_min='-62167222408' + + sPRIi64='"li"' + sPRIo64='"lo"' + sPRIu64='"lu"' + sPRIx64='"lx"' + sPRId64='"ld"' + + netdb_host_type='char *' + nv_preserves_uv_bits='53' + d_nv_preserves_uv='undef' + d_printf_format_null='undef' + d_u32align='define' + use64bitall='define' + use64bitint='define' +} + +# Only defined by i486 and x86_64. Provide defaults for all others +(!defined($sPRIEUldbl)) { + sPRIEUldbl='"E"' + sPRIFUldbl='"F"' + sPRIGUldbl='"G"' + sPRIXU64='"LX"' + sPRIeldbl='"e"' + sPRIfldbl='"f"' + sPRIgldbl='"g"' + sSCNfldbl='"f"' +} diff --git a/lang/perl/files/arm.config b/lang/perl/files/arm.config new file mode 100644 index 0000000..75fe254 --- /dev/null +++ b/lang/perl/files/arm.config @@ -0,0 +1,19 @@ +owrt:arch=arm +owrt:bits=32 +owrt:endian=little + +ccsymbols='__ARM_ARCH_3__=1' +cppccsymbols='' +cppsymbols='__ELF__=1 _FILE_OFFSET_BITS=64 __GLIBC__=2 __GLIBC_MINOR__=2 __GNUC__=3 __GNUC_MINOR__=4 __GNU_LIBRARY__=6 _LARGEFILE_SOURCE=1 _POSIX_C_SOURCE=199506L _POSIX_SOURCE=1 __STDC__=1 __USE_BSD=1 __USE_FILE_OFFSET64=1 __USE_LARGEFILE=1 __USE_MISC=1 __USE_POSIX=1 __USE_POSIX199309=1 __USE_POSIX199506=1 __USE_POSIX2=1 __USE_SVID=1 linux=1 __linux=1 __linux__=1 unix=1 __unix=1 __unix__=1' +d_casti32='define' +d_modflproto='undef' +doublekind='3' +fpossize='20' +longdblkind='0' +need_va_copy='undef' +quadkind='3' + +owrt:sig_count='64' +owrt:sigs='ZERO HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS' +owrt:sig_name_extra='IOT CLD POLL UNUSED' +owrt:sig_num_extra='6 17 29 31' diff --git a/lang/perl/files/armeb.config b/lang/perl/files/armeb.config new file mode 100644 index 0000000..081300c --- /dev/null +++ b/lang/perl/files/armeb.config @@ -0,0 +1,19 @@ +owrt:arch=armeb +owrt:bits=32 +owrt:endian=big + +ccsymbols='__ARM_ARCH_3__=1' +cppccsymbols='' +cppsymbols='__ELF__=1 _FILE_OFFSET_BITS=64 __GLIBC__=2 __GLIBC_MINOR__=2 __GNUC__=3 __GNUC_MINOR__=4 __GNU_LIBRARY__=6 _LARGEFILE_SOURCE=1 _POSIX_C_SOURCE=199506L _POSIX_SOURCE=1 __STDC__=1 __USE_BSD=1 __USE_FILE_OFFSET64=1 __USE_LARGEFILE=1 __USE_MISC=1 __USE_POSIX=1 __USE_POSIX199309=1 __USE_POSIX199506=1 __USE_POSIX2=1 __USE_SVID=1 linux=1 __linux=1 __linux__=1 unix=1 __unix=1 __unix__=1' +d_casti32='define' +d_modflproto='undef' +doublekind='4' +fpossize='20' +longdblkind='0' +need_va_copy='undef' +quadkind='3' + +owrt:sig_count='64' +owrt:sigs='ZERO HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS' +owrt:sig_name_extra='IOT CLD POLL UNUSED' +owrt:sig_num_extra='6 17 29 31' diff --git a/lang/perl/files/base.config b/lang/perl/files/base.config new file mode 100644 index 0000000..edc3bd4 --- /dev/null +++ b/lang/perl/files/base.config @@ -0,0 +1,1005 @@ +Author='' +Date='' +Header='' +Id='' +Locker='' +Log='' +PERL_CONFIG_SH=true +PERL_PATCHLEVEL= +RCSfile='' +Revision='' +Source='' +State='' +_a='.a' +_exe='' +_o='.o' +afs='false' +afsroot='/afs' +ansi2knr='' +aphostname='/bin/hostname' +ar='ar' +archname64='' +archobjs='' +awk='awk' +baserev='5.0' +bash='' +bin='/usr/bin' +bin_ELF='define' +binexp='/usr/bin' +bison='bison' +byacc='byacc' +c='' +castflags='0' +cat='cat' +ccname='gcc' +ccversion='' +cf_by='root' +charbits='8' +charsize='1' +chgrp='' +chmod='chmod' +chown='' +clocktype='clock_t' +comm='comm' +compress='' +config_arg0='./Configure' +config_arg1='-der' +contains='grep' +cp='cp' +cpio='' +cpp='cpp' +cpp_stuff='42' +cpplast='-' +cppminus='-' +cryptlib='' +csh='csh' +ctermid_r_proto='0' +d_Gconvert='sprintf((b),"%.*g",(n),(x))' +d_PRIEUldbl='define' +d_PRIFUldbl='define' +d_PRIGUldbl='define' +d_PRIXU64='define' +d_PRId64='define' +d_PRIeldbl='define' +d_PRIfldbl='define' +d_PRIgldbl='define' +d_PRIi64='define' +d_PRIo64='define' +d_PRIu64='define' +d_PRIx64='define' +d_SCNfldbl='define' +d__fwalk='undef' +d_access='define' +d_accessx='undef' +d_acosh='define' +d_aintl='undef' +d_alarm='define' +d_archlib='undef' +d_asctime64='undef' +d_asinh='define' +d_atanh='define' +d_atolf='undef' +d_atoll='define' +d_attribute_deprecated='define' +d_attribute_format='define' +d_attribute_malloc='define' +d_attribute_nonnull='define' +d_attribute_noreturn='define' +d_attribute_pure='define' +d_attribute_unused='define' +d_attribute_warn_unused_result='define' +d_backtrace='define' +d_bcmp='define' +d_bcopy='define' +d_bsd='undef' +d_bsdgetpgrp='undef' +d_bsdsetpgrp='undef' +d_builtin_choose_expr='define' +d_builtin_expect='undef' +d_bzero='define' +d_c99_variadic_macros='define' +d_castneg='define' +d_cbrt='define' +d_charvspr='undef' +d_chown='define' +d_chroot='define' +d_chsize='undef' +d_class='undef' +d_clearenv='define' +d_clock='define' +d_clock_getres='define' +d_clock_gettime='define' +d_clock_nanosleep='define' +d_closedir='define' +d_cmsghdr_s='define' +d_const='define' +d_copysign='define' +d_copysignl='undef' +d_cplusplus='undef' +d_csh='undef' +d_ctermid='define' +d_ctermid_r='undef' +d_ctime64='undef' +d_cuserid='define' +d_dbl_dig='define' +d_dbminitproto='undef' +d_difftime='define' +d_difftime64='undef' +d_dir_dd_fd='undef' +d_dirfd='define' +d_dirnamlen='undef' +d_dladdr='define' +d_dlerror='define' +d_dlopen='define' +d_dlsymun='undef' +d_dosuid='undef' +d_drand48proto='define' +d_dup2='define' +d_eaccess='undef' +d_endgrent='define' +d_endgrent_r='undef' +d_endhent='define' +d_endhostent_r='undef' +d_endnent='define' +d_endnetent_r='undef' +d_endpent='define' +d_endprotoent_r='undef' +d_endpwent='define' +d_endpwent_r='undef' +d_endsent='define' +d_endservent_r='undef' +d_eofnblk='define' +d_erf='define' +d_erfc='define' +d_eunice='undef' +d_exp2='define' +d_expm1='define' +d_faststdio='undef' +d_fchdir='define' +d_fchmod='define' +d_fchown='define' +d_fcntl='define' +d_fcntl_can_lock='define' +d_fd_macros='define' +d_fd_set='define' +d_fdim='define' +d_fgetpos='define' +d_finite='define' +d_finitel='undef' +d_flexfnam='define' +d_flock='define' +d_flockproto='define' +d_fma='define' +d_fmax='define' +d_fmin='define' +d_fork='define' +d_fp_class='undef' +d_fp_classify='undef' +d_fp_classl='undef' +d_fpathconf='define' +d_fpclass='undef' +d_fpclassify='define' +d_fpclassl='undef' +d_fpgetround='undef' +d_fpos64_t='undef' +d_frexpl='undef' +d_fs_data_s='undef' +d_fseeko='define' +d_fsetpos='define' +d_fstatfs='define' +d_fstatvfs='define' +d_fsync='define' +d_ftello='define' +d_ftime='undef' +d_futimes='undef' +d_gdbm_ndbm_h_uses_prototypes='undef' +d_gdbmndbm_h_uses_prototypes='undef' +d_getaddrinfo='define' +d_getcwd='define' +d_getespwnam='undef' +d_getfsstat='undef' +d_getgrent='define' +d_getgrps='define' +d_gethbyaddr='define' +d_gethbyname='define' +d_gethent='define' +d_gethname='define' +d_gethostprotos='define' +d_getitimer='define' +d_getlogin='define' +d_getmnt='undef' +d_getmntent='define' +d_getnameinfo='define' +d_getnbyaddr='define' +d_getnbyname='define' +d_getnent='define' +d_getnetprotos='define' +d_getpagsz='define' +d_getpbyname='define' +d_getpbynumber='define' +d_getpent='define' +d_getpgid='define' +d_getpgrp='define' +d_getpgrp2='undef' +d_getppid='define' +d_getprior='define' +d_getprotoprotos='define' +d_getprpwnam='undef' +d_getpwent='define' +d_getsbyname='define' +d_getsbyport='define' +d_getsent='define' +d_getservprotos='define' +d_getspnam='define' +d_gettimeod='define' +d_gmtime64='undef' +d_gnulibc='undef' +d_grpasswd='define' +d_hasmntopt='define' +d_htonl='define' +d_hypot='define' +d_ilogb='define' +d_ilogbl='undef' +d_inc_version_list='undef' +d_index='undef' +d_inetaton='define' +d_inetntop='define' +d_inetpton='define' +d_int64_t='define' +d_ip_mreq='define' +d_ip_mreq_source='define' +d_ipv6_mreq="$owrt:ipv6" +d_ipv6_mreq_source='undef' +d_isascii='define' +d_isblank='define' +d_isfinite='define' +d_isfinitel='undef' +d_isinf='define' +d_isinfl='define' +d_isless='undef' +d_isnan='define' +d_isnanl='undef' +d_isnormal='define' +d_killpg='define' +d_lc_monetary_2008='define' +d_lchown='define' +d_ldbl_dig='define' +d_ldexpl='define' +d_lgamma='define' +d_lgamma_r='define' +d_libm_lib_version='define' +d_libname_unique='undef' +d_link='define' +d_llrint='define' +d_llrintl='define' +d_llround='define' +d_llroundl='define' +d_localtime64='undef' +d_locconv='define' +d_lockf='define' +d_log1p='define' +d_log2='define' +d_logb='define' +d_longdbl='define' +d_longlong='define' +d_lrint='define' +d_lrintl='define' +d_lround='define' +d_lroundl='define' +d_lseekproto='define' +d_lstat='define' +d_madvise='define' +d_malloc_good_size='undef' +d_malloc_size='undef' +d_mblen='define' +d_mbstowcs='define' +d_mbtowc='define' +d_memchr='define' +d_memcmp='define' +d_memcpy='define' +d_memmove='define' +d_memset='define' +d_mkdir='define' +d_mkdtemp='define' +d_mkfifo='define' +d_mkstemp='define' +d_mkstemps='undef' +d_mktime='define' +d_mktime64='undef' +d_mmap='define' +d_modfl='undef' +d_modfl_pow32_bug='undef' +d_mprotect='define' +d_msg='define' +d_msg_ctrunc='define' +d_msg_dontroute='define' +d_msg_oob='define' +d_msg_peek='define' +d_msg_proxy='define' +d_msgctl='define' +d_msgget='define' +d_msghdr_s='define' +d_msgrcv='define' +d_msgsnd='define' +d_msync='define' +d_munmap='define' +d_mymalloc='undef' +d_nan='define' +d_nanosleep='define' +d_ndbm='undef' +d_ndbm_h_uses_prototypes='undef' +d_nearbyint='define' +d_nextafter='define' +d_nice='define' +d_nl_langinfo='define' +d_nv_zero_is_allbits_zero='define' +d_old_pthread_create_joinable='undef' +d_oldpthreads='undef' +d_oldsock='undef' +d_open3='define' +d_pathconf='define' +d_pause='define' +d_perl_otherlibdirs='undef' +d_phostname='undef' +d_pipe='define' +d_poll='define' +d_portable='define' +d_prctl='define' +d_prctl_set_name='define' +d_procselfexe='define' +d_pseudofork='undef' +d_pthread_attr_setscope='define' +d_ptrdiff_t='define' +d_pwage='undef' +d_pwchange='undef' +d_pwclass='undef' +d_pwcomment='undef' +d_pwexpire='undef' +d_pwgecos='define' +d_pwpasswd='define' +d_pwquota='undef' +d_qgcvt='undef' +d_quad='define' +d_re_comp='undef' +d_readdir='define' +d_readlink='define' +d_readv='define' +d_recvmsg='define' +d_regcmp='undef' +d_regcomp='define' +d_remainder='define' +d_remquo='define' +d_rename='define' +d_rewinddir='define' +d_rint='define' +d_rmdir='define' +d_round='define' +d_safebcpy='undef' +d_safemcpy='undef' +d_sanemcmp='define' +d_sbrkproto='define' +d_scalbn='define' +d_scalbnl='undef' +d_sched_yield='define' +d_scm_rights='define' +d_seekdir='define' +d_select='define' +d_sem='define' +d_semctl='define' +d_semctl_semid_ds='define' +d_semctl_semun='define' +d_semget='define' +d_semop='define' +d_sendmsg='define' +d_setegid='define' +d_seteuid='define' +d_setgrent='define' +d_setgrent_r='undef' +d_setgrps='define' +d_sethent='define' +d_sethostent_r='undef' +d_setitimer='define' +d_setlinebuf='define' +d_setlocale='define' +d_setlocale_r='undef' +d_setnent='define' +d_setnetent_r='undef' +d_setpent='define' +d_setpgid='define' +d_setpgrp='define' +d_setpgrp2='undef' +d_setprior='define' +d_setproctitle='undef' +d_setprotoent_r='undef' +d_setpwent='define' +d_setpwent_r='undef' +d_setregid='define' +d_setresgid='define' +d_setresuid='define' +d_setreuid='define' +d_setrgid='undef' +d_setruid='undef' +d_setsent='define' +d_setservent_r='undef' +d_setsid='define' +d_setvbuf='define' +d_sfio='undef' +d_shm='define' +d_shmat='define' +d_shmatprototype='define' +d_shmctl='define' +d_shmdt='define' +d_shmget='define' +d_sigaction='define' +d_signbit='undef' +d_sigprocmask='define' +d_sigsetjmp='define' +d_sin6_scope_id="$owrt:ipv6" +d_sitearch='define' +d_snprintf='define' +d_sockaddr_in6="$owrt:ipv6" +d_sockaddr_sa_len='undef' +d_sockatmark='undef' +d_sockatmarkproto='undef' +d_socket='define' +d_socklen_t='define' +d_sockpair='define' +d_socks5_init='undef' +d_sprintf_returns_strlen='define' +d_sqrtl='undef' +d_stat='define' +d_statblks='define' +d_statfs_f_flags='undef' +d_statfs_s='define' +d_static_inline='define' +d_statvfs='define' +d_stdio_cnt_lval='undef' +d_stdio_ptr_lval='undef' +d_stdio_ptr_lval_nochange_cnt='undef' +d_stdio_ptr_lval_sets_cnt='undef' +d_stdio_stream_array='undef' +d_stdiobase='undef' +d_stdstdio='undef' +d_strchr='define' +d_strcoll='define' +d_strctcpy='define' +d_strerrm='strerror(e)' +d_strerror='define' +d_strftime='define' +d_strlcat='define' +d_strlcpy='define' +d_strtod='define' +d_strtol='define' +d_strtold='define' +d_strtoll='define' +d_strtoq='define' +d_strtoul='define' +d_strtoull='define' +d_strtouq='define' +d_strxfrm='define' +d_suidsafe='undef' +d_symlink='define' +d_syscall='define' +d_syscallproto='define' +d_sysconf='define' +d_sysernlst='' +d_syserrlst='undef' +d_system='define' +d_tcgetpgrp='define' +d_tcsetpgrp='define' +d_telldir='define' +d_telldirproto='define' +d_tgamma='define' +d_time='define' +d_timegm='define' +d_times='define' +d_tm_tm_gmtoff='define' +d_tm_tm_zone='define' +d_trunc='define' +d_truncate='define' +d_truncl='define' +d_tzname='define' +d_ualarm='define' +d_umask='define' +d_uname='define' +d_union_semun='undef' +d_unordered='undef' +d_unsetenv='define' +d_usleep='define' +d_usleepproto='define' +d_ustat='define' +d_vendorarch='undef' +d_vendorbin='undef' +d_vendorlib='undef' +d_vendorscript='undef' +d_vfork='undef' +d_void_closedir='undef' +d_voidsig='define' +d_voidtty='' +d_volatile='define' +d_vprintf='define' +d_vsnprintf='define' +d_wait4='define' +d_waitpid='define' +d_wcscmp='define' +d_wcstombs='define' +d_wcsxfrm='define' +d_wctomb='define' +d_writev='define' +d_xenix='undef' +date='date' +db_hashtype='u_int32_t' +db_prefixtype='size_t' +db_version_major='' +db_version_minor='' +db_version_patch='' +defvoidused='15' +direntrytype='struct dirent' +dlext='so' +dlsrc='dl_dlopen.xs' +doublesize='8' +drand01='drand48()' +dtrace='' +eagain='EAGAIN' +ebcdic='undef' +echo='echo' +egrep='egrep' +emacs='' +endgrent_r_proto='0' +endhostent_r_proto='0' +endnetent_r_proto='0' +endprotoent_r_proto='0' +endpwent_r_proto='0' +endservent_r_proto='0' +eunicefix=':' +exe_ext='' +expr='expr' +extern_C='extern' +extras='' +fflushNULL='define' +fflushall='undef' +find='' +firstmakefile='makefile' +flex='' +fpostype='fpos_t' +freetype='void' +from=':' +full_csh='csh' +full_sed='sed' +gccansipedantic='' +gccosandvers='' +gidsign='1' +gidsize='4' +gidtype='gid_t' +glibpth='/usr/shlib /lib /usr/lib /usr/lib/386 /lib/386 /usr/ccs/lib /usr/ucblib /usr/local/lib ' +gmake='gmake' +gnulibc_version='' +grep='grep' +groupcat='cat /etc/group' +groupstype='gid_t' +gzip='gzip' +h_fcntl='false' +h_sysfile='true' +hint='recommended' +hostcat='cat /etc/hosts' +hostgenerate="$owrt:host_perl_prefix/bin/generate_uudmap" +hostosname='' +hostperl="$owrt:host_perl_prefix/bin/perl" +html1dir=' ' +html1direxp='' +html3dir=' ' +html3direxp='' +i16size='2' +i32size='4' +i64size='8' +i8size='1' +i_arpainet='define' +i_assert='define' +i_bfd='undef' +i_bsdioctl='' +i_db='define' +i_dbm='undef' +i_dirent='define' +i_dld='undef' +i_dlfcn='define' +i_execinfo='define' +i_fcntl='undef' +i_fenv='undef' +i_float='define' +i_fp='undef' +i_fp_class='undef' +i_gdbm='define' +i_gdbm_ndbm='undef' +i_gdbmndbm='undef' +i_grp='define' +i_ieeefp='undef' +i_inttypes='define' +i_langinfo='define' +i_libutil='undef' +i_limits='define' +i_locale='define' +i_machcthr='undef' +i_malloc='define' +i_mallocmalloc='undef' +i_math='define' +i_memory='undef' +i_mntent='define' +i_ndbm='undef' +i_netdb='define' +i_neterrno='undef' +i_netinettcp='define' +i_niin='define' +i_poll='define' +i_prot='undef' +i_pthread='define' +i_pwd='define' +i_quadmath='define' +i_rpcsvcdbm='undef' +i_sfio='undef' +i_sgtty='undef' +i_shadow='define' +i_socks='undef' +i_stdarg='define' +i_stdbool='define' +i_stddef='define' +i_stdint='define' +i_stdlib='define' +i_string='define' +i_sunmath='undef' +i_sysaccess='undef' +i_sysdir='define' +i_sysfile='define' +i_sysfilio='undef' +i_sysin='undef' +i_sysioctl='define' +i_syslog='define' +i_sysmman='define' +i_sysmode='undef' +i_sysmount='define' +i_sysndir='undef' +i_sysparam='define' +i_syspoll='define' +i_sysresrc='define' +i_syssecrt='undef' +i_sysselct='define' +i_syssockio='undef' +i_sysstat='define' +i_sysstatfs='define' +i_sysstatvfs='define' +i_systime='define' +i_systimek='undef' +i_systimes='define' +i_systypes='define' +i_sysuio='define' +i_sysun='define' +i_sysutsname='define' +i_sysvfs='define' +i_syswait='define' +i_termio='undef' +i_termios='define' +i_time='define' +i_unistd='define' +i_ustat='define' +i_utime='define' +i_values='define' +i_varargs='undef' +i_varhdr='stdarg.h' +i_vfork='undef' +ignore_versioned_solibs='y' +inc_version_list=' ' +inc_version_list_init='0' +incpath='' +inews='' +initialinstalllocation='/usr/bin' +installbin='/usr/bin' +installhtml1dir='' +installhtml3dir='' +installman1dir='' +installman3dir='' +installprefix='/usr' +installprefixexp='/usr' +installscript='/usr/bin' +installsitebin='/usr/bin' +installsitehtml1dir='' +installsitehtml3dir='' +installsiteman1dir='' +installsiteman3dir='' +installsitescript='/usr/bin' +installstyle='lib/perl5' +installusrbinperl='define' +installvendorarch='' +installvendorbin='' +installvendorhtml1dir='' +installvendorhtml3dir='' +installvendorlib='' +installvendorman1dir='' +installvendorman3dir='' +installvendorscript='' +intsize='4' +issymlink='test -h' +ivdformat='"ld"' +ivtype='long' +ksh='' +ld_can_script='define' +ldlibpthname='LD_LIBRARY_PATH' +less='less' +lib_ext='.a' +libc='' +libdb_needs_pthread='N' +libperl='libperl.so' +libpth="$owrt:staging_dir/lib $owrt:staging_dir/usr/lib" +libsdirs="$owrt:staging_dir/lib $owrt:staging_dir/usr/lib" +libspath="$owrt:staging_dir/lib $owrt:staging_dir/usr/lib" +libswanted_uselargefiles='' +line='' +lint='' +lkflags='' +ln='ln' +lns='/bin/ln -s' +locincpth=' ' +loclibpth=' ' +longlongsize='8' +lp='' +lpr='' +ls='ls' +lseeksize='8' +lseektype='off_t' +mail='' +mailx='' +make='make' +make_set_make='#' +mallocobj='' +mallocsrc='' +malloctype='void *' +man1dir=' ' +man1direxp='' +man1ext='0' +man3dir=' ' +man3direxp='' +man3ext='0' +mips_type='' +mistrustnm='' +mkdir='mkdir' +mmaptype='void *' +modetype='mode_t' +more='more' +multiarch='undef' +mv='' +mydomain='.dev.null' +n='-n' +netdb_hlen_type='size_t' +netdb_name_type='const char *' +netdb_net_type='in_addr_t' +nm='nm' +nm_opt='' +nm_so_opt='--dynamic' +nroff='nroff' +nvEUformat='"E"' +nvFUformat='"F"' +nvGUformat='"G"' +nv_overflows_integers_at='256.0*256.0*256.0*256.0*256.0*256.0*2.0*2.0*2.0*2.0*2.0' +nveformat='"e"' +nvfformat='"f"' +nvgformat='"g"' +nvsize='8' +nvtype='double' +o_nonblock='O_NONBLOCK' +obj_ext='.o' +old_pthread_create_joinable='' +optimize='-O2' +orderlib='false' +osname='linux' +otherlibdirs=' ' +package='perl5' +pager='/usr/bin/less' +passcat='cat /etc/passwd' +path_sep=':' +perl='' +perl5='' +perl_patchlevel='' +perl_static_inline='static __inline__' +perlpath='/usr/bin/perl' +pg='pg' +phostname='hostname' +pidtype='pid_t' +plibpth='' +pmake='' +pr='' +prefix='/usr' +prefixexp='/usr' +procselfexe='"/proc/self/exe"' +prototype='define' +randbits='48' +randfunc='drand48' +randseedtype='long' +ranlib=':' +rd_nodata='-1' +rm='rm' +rm_try='/bin/rm -f try try a.out .out try.[cho] try..o core core.try* try.core*' +rmail='' +run='' +runnm='false' +sched_yield='sched_yield()' +scriptdir='/usr/bin' +scriptdirexp='/usr/bin' +sed='sed' +seedfunc='srand48' +selecttype='fd_set *' +sendmail='' +setgrent_r_proto='0' +sethostent_r_proto='0' +setlocale_r_proto='0' +setnetent_r_proto='0' +setprotoent_r_proto='0' +setpwent_r_proto='0' +setservent_r_proto='0' +sh='/bin/sh' +shar='' +sharpbang='#!' +shmattype='void *' +shortsize='2' +shrpenv='' +shsharp='true' +signal_t='void' +sitearch='' +sitearchexp='' +sitebin='/usr/bin' +sitebinexp='/usr/bin' +sitehtml1dir='' +sitehtml1direxp='' +sitehtml3dir='' +sitehtml3direxp='' +sitelib='' +sitelibexp='' +siteman1dir='' +siteman1direxp='' +siteman3dir='' +siteman3direxp='' +siteprefix='/usr' +siteprefixexp='/usr' +sitescript='/usr/bin' +sitescriptexp='/usr/bin' +sizetype='size_t' +sleep='' +smail='' +so='so' +sockethdr='' +socketlib='' +socksizetype='socklen_t' +sort='sort' +spackage='Perl5' +spitshell='cat' +src='.' +ssizetype='ssize_t' +st_ino_sign='1' +st_ino_size='8' +startperl='#!/usr/bin/perl' +startsh='#!/bin/sh' +static_ext=' ' +stdchar='char' +stdio_base='((fp)->_base)' +stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)' +stdio_cnt='((fp)->_cnt)' +stdio_filbuf='' +stdio_ptr='((fp)->_ptr)' +stdio_stream_array='' +submit='' +sysman='/usr/share/man/man1' +sysroot='' +tail='' +tar='' +targetdir='' +targetenv='' +targethost='' +targetmkdir='' +targetport='' +targetsh='/bin/sh' +tbl='' +tee='' +test='test' +timetype='time_t' +to=':' +touch='touch' +tr='tr' +trnl='\n' +troff='' +u16size='2' +u16type='unsigned short' +u32size='4' +u64size='8' +u8size='1' +u8type='unsigned char' +uidsign='1' +uidsize='4' +uidtype='uid_t' +uname='uname' +uniq='uniq' +use5005threads='undef' +usecbacktrace='undef' +usecrosscompile='define' +usedevel='undef' +usedl='define' +usedtrace='undef' +usefaststdio='undef' +usekernprocpathname='undef' +uselargefiles='define' +uselongdouble='undef' +usemallocwrap='define' +usemorebits='undef' +usemymalloc='n' +usenm='true' +usensgetexecutablepath='undef' +useopcode='true' +useperlio='define' +useposix='true' +usequadmath='undef' +usereentrant='undef' +userelocatableinc='undef' +usesfio='false' +useshrplib='true' +usesitecustomize='undef' +usesocks='undef' +usevendorprefix='undef' +useversionedarchname='undef' +usevfork='false' +usrinc="$owrt:staging_dir/include $owrt:staging_dir/usr/include" +uuname='' +uvXUformat='"lX"' +uvoformat='"lo"' +uvtype='unsigned long' +uvuformat='"lu"' +uvxformat='"lx"' +vaproto='define' +vendorarch='' +vendorarchexp='' +vendorbin='' +vendorbinexp='' +vendorhtml1dir=' ' +vendorhtml1direxp='' +vendorhtml3dir=' ' +vendorhtml3direxp='' +vendorlib='' +vendorlib_stem='' +vendorlibexp='' +vendorman1dir=' ' +vendorman1direxp='' +vendorman3dir=' ' +vendorman3direxp='' +vendorprefix='' +vendorprefixexp='' +vendorscript='' +vendorscriptexp='' +versiononly='undef' +vi='' +voidflags='15' +xlibpth='/usr/lib/386 /lib/386' +yacc='yacc' +yaccflags='' +zcat='' +zip='zip' + +config_argc=1 +config_args='-der' + +# Tools +cpprun="$owrt:target_cc -E" +cppstdin="$owrt:target_cc -E" +cc="$owrt:target_cc" +ld="$cc" +full_ar="${owrt:target_cross}ar" + +# Tool flags +cppflags="$owrt:cflags" +ccflags="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $owrt:cflags" +ccflags_uselargefiles='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' +ccdlflags="-fPIC -Wl,-rpath,$owrt:perllibpath/CORE" +cccdlflags='-fPIC' +ldflags='' +ldflags_uselargefiles='' +lddlflags="-shared $owrt:ldflags" + +# Libraries +perllibs='-ldl -lm -lcrypt -lutil -lc' +libs='-lgdbm -ldb -ldl -lm -lcrypt -lutil -lc' +libsfiles='libdl.so libm.so libcrypt.so libutil.so libc.so' +libswanted='sfio socket inet nm ndbm gdbm dbm db malloc dl dld ld sun m crypt sec util c cposix posix ucb BSD' diff --git a/lang/perl/files/i486.config b/lang/perl/files/i486.config new file mode 100644 index 0000000..b44c64e --- /dev/null +++ b/lang/perl/files/i486.config @@ -0,0 +1,28 @@ +owrt:arch=i486 +owrt:bits=32 +owrt:endian=little + +ccsymbols='' +cppccsymbols='' +cppsymbols='__ELF__=1 _FILE_OFFSET_BITS=64 __GLIBC__=2 __GLIBC_MINOR__=2 __GNUC__=3 __GNUC_MINOR__=4 __GNU_LIBRARY__=6 _LARGEFILE_SOURCE=1 _POSIX_C_SOURCE=199506L _POSIX_SOURCE=1 __STDC__=1 __USE_BSD=1 __USE_FILE_OFFSET64=1 __USE_LARGEFILE=1 __USE_MISC=1 __USE_POSIX=1 __USE_POSIX199309=1 __USE_POSIX199506=1 __USE_POSIX2=1 __USE_SVID=1 i386=1 __i386=1 __i386__=1 linux=1 __linux=1 __linux__=1 unix=1 __unix=1 __unix__=1' +d_casti32='undef' +d_modflproto='define' +doublekind='3' +fpossize='20' +longdblkind='3' +need_va_copy='undef' +quadkind='3' + +sPRIEUldbl='"LE"' +sPRIFUldbl='"LF"' +sPRIGUldbl='"LG"' +sPRIXU64='"LX"' +sPRIeldbl='"Le"' +sPRIfldbl='"Lf"' +sPRIgldbl='"Lg"' +sSCNfldbl='"Lf"' + +owrt:sig_count='64' +owrt:sigs='ZERO HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS' +owrt:sig_name_extra='IOT CLD POLL UNUSED' +owrt:sig_num_extra='6 17 29 31' diff --git a/lang/perl/files/libc.config b/lang/perl/files/libc.config new file mode 100644 index 0000000..93d190c --- /dev/null +++ b/lang/perl/files/libc.config @@ -0,0 +1,47 @@ +($owrt:libc eq 'glibc') { + perllibs="$perllibs -lbsd" + ldflags="$ldflags -L$owrt:staging_dir/lib" +} + +# uclibc does not provide crypt_r(). +($owrt:libc eq 'uclibc') { + crypt_r_proto='0' + d_crypt_r='undef' +} + +($owrt:libc eq 'musl') { + # musl does not provide a working setlocale(). It accepts arbitrary locales + # and makes them act as if they were C.UTF-8. + d_setlocale='undef' + + d_stdio_ptr_lval='undef' + d_stdio_ptr_lval_sets_cnt='undef' + d_stdiobase='undef' + d_stdstdio='undef' + + d_getnetbyname_r='undef' + + d_getprotobyname_r='undef' + d_getpwent_r='undef' + d_getservent_r='undef' + d_gethostent_r='undef' + d_getnetent_r='undef' + d_getnetbyaddr_r='undef' + d_getprotoent_r='undef' + d_getprotobynumber_r='undef' + d_getgrent_r='undef' + + getprotobyname_r='undef' + getpwent_r='undef' + getservent_r='undef' + gethostent_r='undef' + getnetent_r='undef' + getnetbyaddr_r='undef' + getprotoent_r='undef' + getprotobynumber_r='undef' + getgrent_r='undef' + + i_fcntl='define' + h_fcntl='true' + d_strerror_r='undef' +} diff --git a/lang/perl/files/mips.config b/lang/perl/files/mips.config new file mode 100644 index 0000000..05e807b --- /dev/null +++ b/lang/perl/files/mips.config @@ -0,0 +1,19 @@ +owrt:arch=mips +owrt:bits=32 +owrt:endian=big + +ccsymbols='' +cppccsymbols='' +cppsymbols='__ELF__=1 _FILE_OFFSET_BITS=64 __GLIBC__=2 __GLIBC_MINOR__=2 __GNUC__=3 __GNUC_MINOR__=4 __GNU_LIBRARY__=6 LANGUAGE_C=1 _LANGUAGE_C=1 __LANGUAGE_C=1 __LANGUAGE_C__=1 _LARGEFILE_SOURCE=1 MIPSEL=1 _MIPSEL=1 __MIPSEL=1 __MIPSEL__=1 _MIPS_FPSET=16 _MIPS_ISA=_MIPS_ISA_MIPS1 _MIPS_SIM=1 _MIPS_SZINT=32 _MIPS_SZLONG=32 _MIPS_SZPTR=32 __PIC__=1 _POSIX_C_SOURCE=199506L _POSIX_SOURCE=1 R3000=1 _R3000=1 __R3000=1 __R3000__=1 __STDC__=1 __USE_BSD=1 __USE_FILE_OFFSET64=1 __USE_LARGEFILE=1 __USE_MISC=1 __USE_POSIX=1 __USE_POSIX199309=1 __USE_POSIX199506=1 __USE_POSIX2=1 __USE_SVID=1 linux=1 __linux=1 __linux__=1 mips=1 _mips=1 __mips=1 __mips__=1 __pic__=1 unix=1 __unix=1 __unix__=1' +d_casti32='define' +d_modflproto='undef' +doublekind='4' +fpossize='24' +longdblkind='0' +need_va_copy='undef' +quadkind='3' + +owrt:sig_count=128 +owrt:sigs='ZERO HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM USR1 USR2 CHLD PWR WINCH URG IO STOP TSTP CONT TTIN TTOU VTALRM PROF XCPU XFSZ' +owrt:sig_name_extra='IOT CLD POLL' +owrt:sig_num_extra='6 18 22' diff --git a/lang/perl/files/mips64.config b/lang/perl/files/mips64.config new file mode 100644 index 0000000..89875f7 --- /dev/null +++ b/lang/perl/files/mips64.config @@ -0,0 +1,19 @@ +owrt:arch=mips64 +owrt:bits=64 +owrt:endian=big + +ccsymbols='' +cppccsymbols='' +cppsymbols='' +d_casti32='define' +d_modflproto='undef' +doublekind='4' +fpossize='24' +longdblkind='6' +need_va_copy='define' +quadkind='2' + +owrt:sig_count=128 +owrt:sigs='ZERO HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM USR1 USR2 CHLD PWR WINCH URG IO STOP TSTP CONT TTIN TTOU VTALRM PROF XCPU XFSZ' +owrt:sig_name_extra='IOT CLD POLL' +owrt:sig_num_extra='6 18 22' diff --git a/lang/perl/files/mipsel.config b/lang/perl/files/mipsel.config new file mode 100644 index 0000000..d209a0d --- /dev/null +++ b/lang/perl/files/mipsel.config @@ -0,0 +1,19 @@ +owrt:arch=mipsel +owrt:bits=32 +owrt:endian=little + +ccsymbols='' +cppccsymbols='' +cppsymbols='__ELF__=1 _FILE_OFFSET_BITS=64 __GLIBC__=2 __GLIBC_MINOR__=2 __GNUC__=3 __GNUC_MINOR__=4 __GNU_LIBRARY__=6 LANGUAGE_C=1 _LANGUAGE_C=1 __LANGUAGE_C=1 __LANGUAGE_C__=1 _LARGEFILE_SOURCE=1 MIPSEL=1 _MIPSEL=1 __MIPSEL=1 __MIPSEL__=1 _MIPS_FPSET=16 _MIPS_ISA=_MIPS_ISA_MIPS1 _MIPS_SIM=1 _MIPS_SZINT=32 _MIPS_SZLONG=32 _MIPS_SZPTR=32 __PIC__=1 _POSIX_C_SOURCE=199506L _POSIX_SOURCE=1 R3000=1 _R3000=1 __R3000=1 __R3000__=1 __STDC__=1 __USE_BSD=1 __USE_FILE_OFFSET64=1 __USE_LARGEFILE=1 __USE_MISC=1 __USE_POSIX=1 __USE_POSIX199309=1 __USE_POSIX199506=1 __USE_POSIX2=1 __USE_SVID=1 linux=1 __linux=1 __linux__=1 mips=1 _mips=1 __mips=1 __mips__=1 __pic__=1 unix=1 __unix=1 __unix__=1' +d_casti32='define' +d_modflproto='undef' +doublekind='3' +fpossize='24' +longdblkind='0' +need_va_copy='undef' +quadkind='3' + +owrt:sig_count=128 +owrt:sigs='ZERO HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM USR1 USR2 CHLD PWR WINCH URG IO STOP TSTP CONT TTIN TTOU VTALRM PROF XCPU XFSZ' +owrt:sig_name_extra='IOT CLD POLL' +owrt:sig_num_extra='6 18 22' diff --git a/lang/perl/files/misc.config b/lang/perl/files/misc.config new file mode 100644 index 0000000..3e8f6bd --- /dev/null +++ b/lang/perl/files/misc.config @@ -0,0 +1,11 @@ +cf_email='naoir@gmx.net' +osvers='3.18.19' +gccversion="$owrt:gccversion" +myhostname='OpenWrt' +cf_time='Thu Jan 1 12:00:00 CEST 2015' + +perladmin="$cf_email" +archname="$owrt:arch-linux-$owrt:libc" +targetarch="$archname" +myarchname="$archname" +myuname="Linux $myhostname $osvers #1 SMP $cf_time @{[$owrt:arch =~ s/(el|eb)$//r]} GNU/Linux" diff --git a/lang/perl/files/perl-run_tests.sh b/lang/perl/files/perl-run_tests.sh new file mode 100755 index 0000000..bf83c0a --- /dev/null +++ b/lang/perl/files/perl-run_tests.sh @@ -0,0 +1,81 @@ +#!/bin/sh + +PERL_TESTSDIR="/usr/share/perl/perl-tests" +PERL_LIBDIR="/usr/lib/perl5/%%PERL_VERSION%%/" +PERL_DISABLEDTESTS="%%PERL_DISABLEDTESTS%%" + +no_run="" +manual_run="" +manual_run_no_base="" + +while [ ! -z "$1" ]; do + case $1 in + -n) + no_run="yes" + ;; + -m) + manual_run="yes" + ;; + -mb) + manual_run="yes" + manual_run_no_base="yes" + ;; + --help) + echo "run_tests.sh [-n|-m|-mb|--help]" + echo "" + echo "Options:" + echo " -n Just prepare the environment. Don't actually run any tests" + echo " -m Run tests manually according to MANIFEST, instead of whatever t/TEST chooses" + echo " -mb Don't run base tests. Implies -m" + echo " --help Print this help ;)" + echo "" + exit 0 + ;; + *) + echo "Invalid argument: $1" + ;; + esac + shift +done + +if [ ! -f "$PERL_TESTSDIR/__prepared" ]; then + # Many tests insist on having PERL5LIB in $PERL_TESTSDIR/lib. However, + # that directory may also contain tests. Some of them(FindBin.t in particular) + # also demand being located in a directory ending with "lib". So we can't do symlink + # trickery here. + # Our solution is to just copy PERL5LIB over. + if [ -d "$PERL_TESTSDIR/lib" ]; then + cp -a "$PERL_LIBDIR/"* "$PERL_TESTSDIR/lib/" + else + ln -s "$PERL_LIBDIR" "$PERL_TESTSDIR/lib" + fi + + ln -s /usr/bin/perl "$PERL_TESTSDIR/perl" + ln -s /usr/bin/perl "$PERL_TESTSDIR/t/perl" + touch "$PERL_TESTSDIR/__prepared" + + for i in $PERL_DISABLEDTESTS; do + echo "Disabling $i tests" + sed 's!^'$i'.*$!!' -i $PERL_TESTSDIR/MANIFEST + done + + cat $PERL_TESTSDIR/MANIFEST | grep -v '^$' > $PERL_TESTSDIR/MANIFEST_NEW + rm $PERL_TESTSDIR/MANIFEST + mv $PERL_TESTSDIR/MANIFEST_NEW $PERL_TESTSDIR/MANIFEST +fi + +if [ -z "$no_run" ]; then + cd "$PERL_TESTSDIR/t" + if [ ! -z "$manual_run" ]; then + for i in $(cat ../MANIFEST | sed 's/\t.*$//g' | grep '\.t$'); do + if [ ! -z "$manual_run_no_base" ] && [ ! -z "$(echo $i | grep '^t/')" ]; then + continue; + fi + echo "Running $i" + ./TEST ../$i + echo "" + done + else + ./perl TEST + fi +fi diff --git a/lang/perl/files/perlconfig.pl b/lang/perl/files/perlconfig.pl new file mode 100644 index 0000000..f169980 --- /dev/null +++ b/lang/perl/files/perlconfig.pl @@ -0,0 +1,313 @@ +#!/usr/bin/perl + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright 2015 Marcel Denia + +=head1 NAME + +perlconfig.pl + +=head1 SYNOPSIS + +B [B<-Dsymbol>=I, ...] [B<-dsymbol>=I, ...] I<[files]> + +Generate a configuration file suitable for (cross-)compiling perl 5. + +=head1 OPTIONS + +=over + +=item B<-Dsymbol=value> + +The symbol identified by I will have the literal value I. +When generating the configuration file, it's value will be printed enclosed by +single quotation marks('). + +=item B<-dsymbol=value> + +The symbol identified by I will have the literal value I. + +=back + +=head1 DESCRIPTION + +B is a program to compile and generate configuration files ready +to be used as a "config.sh" file for compiling perl 5. It does so by processing +specially-made configuration files(usually called *.config), typically augmented +by command-line definitions. + +B's intent is to be used in place of perl 5's own Configure +script in situations where it can not be run, like cross-compiling. + +=head2 File syntax + +B's configuration files a consist of symbol definitions in +different variations, each one assigning a specific symbol identified by a name +some value, as well as conditional blocks in order to allow for some +flexibility. + +=head3 Symbol names + +A symbol name has to consist entirely of alphanumeric characters as well as +the underscore(_) character. In addition, symbol names may be prefixed with an +all-lowercase string, separated by a colon(:): + + my:name=value + +Having a zero-length prefix string is also valid: + + :name=value + +Symbols prefixed that way are called private symbols. They act exactly like +regular symbols, with the only difference being that they will B be written +to the final configuration file. + +=head3 Symbol definitions + +A symbol definition is in the form of a simple name/value pair, separated by +an equals sign(=): + + name=value + +I can be anything really. However, there are 3 notations, with +differences in quoting and interpolation: + +=over + +=item name=foo + +The symbol identified by I will have the literal value I. + +=item name='foo' + +The symbol identified by I will have the literal value I. +When generating the configuration file, it's value will be printed enclosed by +single quotation marks('). + +=item name="foo" + +The symbol identified by I will have the value of I +S>(as described in L). +When generating the configuration file, it's value will be printed enclosed by +single quotation marks('). + +=back + +=head3 Conditional blocks + +A conditional block is of the form + + (condition) { + ... + } + +B will execute everything enclosed in the curly braces({ and }), +or inside the BLOCK in Perl 5 terms, if I evaluates to any true +value. I will go through interpolation as described in +L. It may contain any valid Perl 5 expression. Some common +examples are: + +=over + +=item $name eq 'foo' + +Evaluates to true if configuration symbol I is literally equal to I. + +=item $name ne 'foo' + +Evaluates to true if configuration symbol I is B literally equal to +I. + +=item defined($name) + +Evaluates to true if configuration symbol I is defined(has any usable +value, see L). + +=back + +Conditional blocks may be nested inside conditional blocks. Note that the +opening curl brace({) has to be on the same line as your condition. + +=head3 Comments + +All lines starting with nothing or any number of whitespaces, followed by a +hash sign(#), are considered comments and will be completely ignored by +B. + +=head3 Interpolation + +In certain situations(see above), B will interpolate strings or +constructs in order to allow you to refer to configuration symbols or embed +code. + +Interpolated strings are subject to the following rules: + +=over + +=item You may not include any single(') or double(") quotation marks. + +You can use \qq in order to include double quotation marks(") in your string. + +=item $name and ${name} reference configuration symbols + +You can easily refer to existing configuration symbols using the commmon $name +or ${name} syntax. In case you want to refer to the perl variable named $name, +write \$name. This is useful for embedding code. + +=item Perl 5 interpolation rules apply + +Aside from the above, you may include anything that is also valid for an +interpolated(qq//) string in Perl 5. For instance, it's perfectly valid to +execute code using the @{[]} construct. + +=back + +=head1 EXAMPLES + +As a simple example, consider the following configuration file, named +"example.config": + + recommendation='The Perl you want is' + ($:maturity eq 'stable') { + recommendation="$recommendation Perl 5" + } + ($:maturity eq 'experimental') { + recommendation="$recommendation Perl 6(try Rakudo!)" + } + +Executing it using these command-lines will yield the following results: + +=over + +=item $ perlconfig.pl -D:maturity=stable example.config + + recommendation='The Perl you want is Perl 5' + +=item $ perlconfig.pl -D:maturity=experimental example.config + + recommendation='The Perl you want is Perl 6(try Rakudo!)' + +=back + +=head1 AUTHOR + +Marcel Denia + +=head1 COPYRIGHT AND LICENSE + +Copyright 2015 Marcel Denia + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +=cut + +use strict; +use warnings; +use List::Util qw/all/; +my $symbol_name_prefix_regex = '(?:[a-z]*:)'; +my $symbol_name_regex = "($symbol_name_prefix_regex?(?:[a-zA-Z0-9_]+))"; + +my %config; + +sub interpolate { + my $string = shift; + my %options = @_; + + # First, convert $foo into ${foo} + $string =~ s/(?{value} + $string =~ s/\$\{$symbol_name_regex\}/\$config{\'$1\'}->{value}/g; + + # Un-escape \$foo + $string =~ s/\\\$/\$/g; + + # Turn \qq into " + $string =~ s/\\qq/\\"/g; + + return $string; +} + +# Parse command-line symbol definitions +while ($ARGV[0]) { + if ($ARGV[0] =~ /^-([D|d])$symbol_name_regex=(.*)$/) { + $config{$2} = { value => $3, quoted => $1 eq 'D' }; + shift(@ARGV); + } + else { + last; + } +} + +# Process configuration files +my @condition_stack = ( 1 ); +for my $file (@ARGV) { + open(my $fh, '<', $file) or die "Can't open $file: $!\n"; + while (my $line = <$fh>) { + chomp($line); + + if ($line =~ /^\s*$symbol_name_regex=(.*)$/) { # A symbol definition + if (all {$_ == 1} @condition_stack) { + my $symbol = $1; + (my $quote_begin, my $value, my $quote_end) = $2 =~ /^(['|"])?([^'"]*)(['|"])?$/; + + $quote_begin = '' unless defined $quote_begin; + $quote_end = '' unless defined $quote_end; + die "$file:$.: Unmatched quotes in \"$line\"\n" unless $quote_begin eq $quote_end; + + if ($quote_begin eq '"') { + $config{$symbol} = { value => eval('"' . interpolate($2) . '"'), quoted => 1 }; + } + else { + $config{$symbol} = { value => $2, quoted => $quote_begin eq '\'' }; + } + } + } + elsif ($line =~ /^\s*\((.*)\)\s?{$/) { # A conditional block + if (eval(interpolate($1))) { + push(@condition_stack, 1); + } + else { + push(@condition_stack, 0); + } + } + elsif ($line =~ /^\s*}$/) { # Closing a conditional block + pop(@condition_stack); + die "$file:$.: Closing non-existent block\n" unless @condition_stack; + } + elsif ($line =~ (/^\s*$/) || ($line =~ /^\s*#/)) { # An empty line or comment + } + else { + die "$file:$.: Malformed line: \"$line\"\n"; + } + } +} + +# Output +for (sort(keys(%config))) { + my $quote = $config{$_}->{quoted} ? '\'' : ''; + print("$_=$quote$config{$_}->{value}$quote\n") unless $_ =~ /^$symbol_name_prefix_regex/; +} \ No newline at end of file diff --git a/lang/perl/files/powerpc.config b/lang/perl/files/powerpc.config new file mode 100644 index 0000000..33af767 --- /dev/null +++ b/lang/perl/files/powerpc.config @@ -0,0 +1,19 @@ +owrt:arch=powerpc +owrt:bits=32 +owrt:endian=big + +ccsymbols='__gnu_linux__=1 __linux=1 __linux__=1 __unix=1 __unix__=1 system=linux system=posix system=unix' +cppccsymbols='linux=1 unix=1' +cppsymbols='_BIG_ENDIAN=1 __BIG_ENDIAN__=1 __ELF__=1 _FILE_OFFSET_BITS=64 __GLIBC__=2 __GLIBC_MINOR__=2 __GNUC__=3 __GNUC_MINOR__=4 __GNU_LIBRARY__=6 _LARGEFILE_SOURCE=1 _POSIX_C_SOURCE=199506L _POSIX_SOURCE=1 __STDC__=1 __USE_BSD=1 __USE_FILE_OFFSET64=1 __USE_LARGEFILE=1 __USE_MISC=1 __USE_POSIX=1 __USE_POSIX199309=1 __USE_POSIX199506=1 __USE_POSIX2=1 __USE_SVID=1 __linux=1 __linux__=1 __unix=1 __unix__=1' +d_casti32='undef' +d_modflproto='undef' +doublekind='4' +fpossize='24' +longdblkind='0' +need_va_copy='define' +quadkind='3' + +owrt:sig_count='64' +owrt:sigs='ZERO HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS' +owrt:sig_name_extra='IOT CLD POLL UNUSED' +owrt:sig_num_extra='6 17 29 31' diff --git a/lang/perl/files/signal.config b/lang/perl/files/signal.config new file mode 100644 index 0000000..183d3b9 --- /dev/null +++ b/lang/perl/files/signal.config @@ -0,0 +1,18 @@ +# Signal table helper + +(defined($owrt:sigs)) { + sig_name="$owrt:sigs" + (($owrt:libc eq 'glibc') || ($owrt:libc eq 'uclibc')) { + sig_name="$sig_name NUM32 NUM33 RTMIN NUM35 NUM36" + } + ($owrt:libc eq 'musl') { + sig_name="$sig_name NUM32 NUM33 NUM34 RTMIN NUM36" + } + + sig_name="$sig_name @{[map({qq/NUM\$_/} 37..$owrt:sig_count - 2)]} RTMAX $owrt:sig_name_extra" + sig_num="@{[0..$owrt:sig_count - 1]} $owrt:sig_num_extra " + sig_count="$owrt:sig_count" + sig_size="@{[scalar(split(q/ /, $sig_name))]}" + sig_name_init="@{[join(q/, /, map({qq/\qq\$_\qq/} split(q/ /, $sig_name)))]}, 0" + sig_num_init="@{[join(q/, /, split(q/ /, $sig_num))]}, 0" +} diff --git a/lang/perl/files/threads.config b/lang/perl/files/threads.config new file mode 100644 index 0000000..e0a2f82 --- /dev/null +++ b/lang/perl/files/threads.config @@ -0,0 +1,197 @@ +($owrt:threads eq 'yes') { + # Configure arguments + config_args="$config_args -Dusethreads" + config_arg2='-Dusethreads' + config_argc=2 + + # Options + useithreads='define' + usemultiplicity='define' + usethreads='define' + + # Flags and related + ccflags="-D_REENTRANT -D_GNU_SOURCE $ccflags" + cppflags="-D_REENTRANT -D_GNU_SOURCE $cppflags" + perllibs="-lpthread $perllibs" + libs="-lpthread $libs" + libsfiles="libpthread.so $libsfiles" + libswanted="pthread $libswanted" + + + crypt_r_proto='REENTRANT_PROTO_B_CCS' + i_crypt='define' + d_crypt='define' + d_crypt_r='define' + + # Prototypes + asctime_r_proto='REENTRANT_PROTO_B_SB' + ctime_r_proto='REENTRANT_PROTO_B_SB' + drand48_r_proto='REENTRANT_PROTO_I_ST' + getgrent_r_proto='REENTRANT_PROTO_I_SBWR' + getgrgid_r_proto='REENTRANT_PROTO_I_TSBWR' + getgrnam_r_proto='REENTRANT_PROTO_I_CSBWR' + gethostbyaddr_r_proto='REENTRANT_PROTO_I_TsISBWRE' + gethostbyname_r_proto='REENTRANT_PROTO_I_CSBWRE' + gethostent_r_proto='REENTRANT_PROTO_I_SBWRE' + getlogin_r_proto='REENTRANT_PROTO_I_BW' + getnetbyaddr_r_proto='REENTRANT_PROTO_I_uISBWRE' + getnetbyname_r_proto='REENTRANT_PROTO_I_CSBWRE' + getnetent_r_proto='REENTRANT_PROTO_I_SBWRE' + getprotobyname_r_proto='REENTRANT_PROTO_I_CSBWR' + getprotobynumber_r_proto='REENTRANT_PROTO_I_ISBWR' + getprotoent_r_proto='REENTRANT_PROTO_I_SBWR' + getpwent_r_proto='REENTRANT_PROTO_I_SBWR' + getpwnam_r_proto='REENTRANT_PROTO_I_CSBWR' + getpwuid_r_proto='REENTRANT_PROTO_I_TSBWR' + getservbyname_r_proto='REENTRANT_PROTO_I_CCSBWR' + getservbyport_r_proto='REENTRANT_PROTO_I_ICSBWR' + getservent_r_proto='REENTRANT_PROTO_I_SBWR' + getspnam_r_proto='REENTRANT_PROTO_I_CSBWR' + gmtime_r_proto='REENTRANT_PROTO_S_TS' + localtime_r_proto='REENTRANT_PROTO_S_TS' + random_r_proto='REENTRANT_PROTO_I_St' + readdir64_r_proto='REENTRANT_PROTO_I_TSR' + readdir_r_proto='REENTRANT_PROTO_I_TSR' + srand48_r_proto='REENTRANT_PROTO_I_LS' + srandom_r_proto='REENTRANT_PROTO_I_TS' + strerror_r_proto='REENTRANT_PROTO_B_IBW' + tmpnam_r_proto='REENTRANT_PROTO_B_B' + ttyname_r_proto='REENTRANT_PROTO_I_IBW' + + # Defines + d_asctime_r='define' + d_ctime_r='define' + d_drand48_r='define' + d_fds_bits='define' + d_fegetround='undef' + d_getgrent_r='define' + d_getgrgid_r='define' + d_getgrnam_r='define' + d_gethostbyaddr_r='define' + d_gethostbyname_r='define' + d_gethostent_r='define' + d_getlogin_r='define' + d_getnetbyaddr_r='define' + d_getnetbyname_r='define' + d_getnetent_r='define' + d_getprotobyname_r='define' + d_getprotobynumber_r='define' + d_getprotoent_r='define' + d_getpwent_r='define' + d_getpwnam_r='define' + d_getpwuid_r='define' + d_getservbyname_r='define' + d_getservbyport_r='define' + d_getservent_r='define' + d_getspnam_r='define' + d_gmtime_r='define' + d_j0='undef' + d_j0l='undef' + d_localtime_r='define' + d_localtime_r_needs_tzset='define' + d_nexttoward='undef' + d_off64_t='define' + d_pthread_atfork='define' + d_pthread_yield='define' + d_random_r='define' + d_readdir64_r='define' + d_readdir_r='define' + d_srand48_r='define' + d_srandom_r='define' + d_sresgproto='define' + d_sresuproto='define' + d_strerror_r='define' + d_tmpnam_r='define' + d_ttyname_r='define' +} +($owrt:threads eq 'no') { + # Options + useithreads='undef' + usemultiplicity='undef' + usethreads='undef' + + # Prototyypes + asctime_r_proto='0' + crypt_r_proto='0' + ctime_r_proto='0' + drand48_r_proto='0' + getgrent_r_proto='0' + getgrgid_r_proto='0' + getgrnam_r_proto='0' + gethostbyaddr_r_proto='0' + gethostbyname_r_proto='0' + gethostent_r_proto='0' + getlogin_r_proto='0' + getnetbyaddr_r_proto='0' + getnetbyname_r_proto='0' + getnetent_r_proto='0' + getprotobyname_r_proto='0' + getprotobynumber_r_proto='0' + getprotoent_r_proto='0' + getpwent_r_proto='0' + getpwnam_r_proto='0' + getpwuid_r_proto='0' + getservbyname_r_proto='0' + getservbyport_r_proto='0' + getservent_r_proto='0' + getspnam_r_proto='0' + gmtime_r_proto='0' + + # Defines + d_asctime_r='undef' + d_crypt='define' + d_crypt_r='undef' + d_ctime_r='undef' + d_drand48_r='undef' + d_fds_bits='undef' + d_fegetround='define' + d_getgrent_r='undef' + d_getgrgid_r='undef' + d_getgrnam_r='undef' + d_gethostbyaddr_r='undef' + d_gethostbyname_r='undef' + d_gethostent_r='undef' + d_getlogin_r='undef' + d_getnetbyaddr_r='undef' + d_getnetbyname_r='undef' + d_getnetent_r='undef' + d_getprotobyname_r='undef' + d_getprotobynumber_r='undef' + d_getprotoent_r='undef' + d_getpwent_r='undef' + d_getpwnam_r='undef' + d_getpwuid_r='undef' + d_getservbyname_r='undef' + d_getservbyport_r='undef' + d_getservent_r='undef' + d_getspnam_r='undef' + d_gmtime_r='undef' + d_j0='define' + d_j0l='define' + d_localtime_r='undef' + d_localtime_r_needs_tzset='undef' + d_nexttoward='define' + d_off64_t='undef' + d_pthread_atfork='undef' + d_pthread_yield='undef' + d_random_r='undef' + d_readdir64_r='undef' + d_readdir_r='undef' + d_srand48_r='undef' + d_srandom_r='undef' + d_sresgproto='undef' + d_sresuproto='undef' + d_strerror_r='undef' + d_tmpnam_r='undef' + d_ttyname_r='undef' + i_crypt='define' + localtime_r_proto='0' + random_r_proto='0' + readdir64_r_proto='0' + readdir_r_proto='0' + srand48_r_proto='0' + srandom_r_proto='0' + strerror_r_proto='0' + tmpnam_r_proto='0' + ttyname_r_proto='0' +} diff --git a/lang/perl/files/version.config b/lang/perl/files/version.config new file mode 100644 index 0000000..98cd2a5 --- /dev/null +++ b/lang/perl/files/version.config @@ -0,0 +1,38 @@ +# Set the version here +PERL_REVISION=5 +PERL_VERSION=22 +PERL_SUBVERSION=1 + +# (api_revison, api_version, api_subversion) = (revision, version, 0) usually +PERL_API_REVISION=5 +PERL_API_VERSION=22 +PERL_API_SUBVERSION=0 + +known_extensions='B Compress/Raw/Zlib Cwd DB_File Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Digest/SHA Encode Fcntl File/Glob Filter/Util/Call GDBM_File Hash/Util I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Math/BigInt/FastCalc NDBM_File ODBM_File Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Text/Soundex Time/HiRes Time/Piece Unicode/Normalize Win32 Win32API/File Win32CORE XS/APItest XS/Typemap attrs re threads threads/shared Hash/Util/FieldHash' +extensions='B Compress/Raw/Bzip2 Compress/Raw/Zlib Cwd DB_File Data/Dumper Devel/PPPort Devel/Peek Digest/MD5 Digest/SHA Encode Fcntl File/DosGlob File/Glob Filter/Util/Call GDBM_File Hash/Util Hash/Util/FieldHash I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Math/BigInt/FastCalc Opcode POSIX PerlIO/encoding PerlIO/mmap PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Tie/Hash/NamedCapture Time/HiRes Time/Piece Unicode/Collate XS/APItest XS/Typemap arybase attributes mro re threads threads/shared Archive/Tar Attribute/Handlers AutoLoader B/Debug CPAN CPAN/Meta CPAN/Meta/Requirements CPAN/Meta/YAML Carp Config/Perl/V Devel/SelfStubber Digest Dumpvalue Env Errno Exporter ExtUtils/CBuilder ExtUtils/Command ExtUtils/Constant ExtUtils/Install ExtUtils/MakeMaker ExtUtils/Manifest ExtUtils/Miniperl ExtUtils/ParseXS File/Fetch File/Find File/Path File/Temp FileCache Filter/Simple Getopt/Long HTTP/Tiny I18N/Collate I18N/LangTags IO/Compress IO/Socket/IP IO/Zlib IPC/Cmd IPC/Open3 JSON/PP Locale/Codes Locale/Maketext Locale/Maketext/Simple Math/BigInt Math/BigRat Math/Complex Memoize Module/CoreList Module/Load Module/Load/Conditional Module/Loaded Module/Metadata NEXT Net/Ping Params/Check Parse/CPAN/Meta Perl/OSType PerlIO/via/QuotedPrint Pod/Checker Pod/Escapes Pod/Functions Pod/Html Pod/Parser Pod/Perldoc Pod/Simple Pod/Usage Safe Search/Dict SelfLoader Term/ANSIColor Term/Cap Term/Complete Term/ReadLine Test Test/Harness Test/Simple Text/Abbrev Text/Balanced Text/ParseWords Text/Tabs Thread/Queue Thread/Semaphore Tie/File Tie/Memoize Tie/RefHash Time/Local XSLoader autodie autouse base bignum constant encoding/warnings experimental if lib libnet parent perlfaq podlators Unicode/Normalize version' +nonxs_ext='Archive/Tar Attribute/Handlers AutoLoader B/Debug CPAN CPAN/Meta CPAN/Meta/Requirements CPAN/Meta/YAML Carp Config/Perl/V Devel/SelfStubber Digest Dumpvalue Env Errno Exporter ExtUtils/CBuilder ExtUtils/Command ExtUtils/Constant ExtUtils/Install ExtUtils/MakeMaker ExtUtils/Manifest ExtUtils/Miniperl ExtUtils/ParseXS File/Fetch File/Find File/Path File/Temp FileCache Filter/Simple Getopt/Long HTTP/Tiny I18N/Collate I18N/LangTags IO/Compress IO/Socket/IP IO/Zlib IPC/Cmd IPC/Open3 JSON/PP Locale/Codes Locale/Maketext Locale/Maketext/Simple Math/BigInt Math/BigRat Math/Complex Memoize Module/CoreList Module/Load Module/Load/Conditional Module/Loaded Module/Metadata NEXT Net/Ping Params/Check Parse/CPAN/Meta Perl/OSType PerlIO/via/QuotedPrint Pod/Checker Pod/Escapes Pod/Functions Pod/Html Pod/Parser Pod/Perldoc Pod/Simple Pod/Usage Safe Search/Dict SelfLoader Term/ANSIColor Term/Cap Term/Complete Term/ReadLine Test Test/Harness Test/Simple Text/Abbrev Text/Balanced Text/ParseWords Text/Tabs Thread/Queue Thread/Semaphore Tie/File Tie/Memoize Tie/RefHash Time/Local XSLoader autodie autouse base bignum constant encoding/warnings experimental if lib libnet parent perlfaq podlators Unicode/Normalize version' +dynamic_ext='B Compress/Raw/Bzip2 Compress/Raw/Zlib Cwd DB_File Data/Dumper Devel/PPPort Devel/Peek Digest/MD5 Digest/SHA Encode Fcntl File/DosGlob File/Glob Filter/Util/Call GDBM_File Hash/Util Hash/Util/FieldHash I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Math/BigInt/FastCalc Opcode POSIX PerlIO/encoding PerlIO/mmap PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Tie/Hash/NamedCapture Time/HiRes Time/Piece Unicode/Collate XS/APItest XS/Typemap arybase attributes mro re threads threads/shared' + +# No need to change anything from here on +owrt:perllibpath="/usr/lib/perl5/$PERL_REVISION.$PERL_VERSION" + +revision="$PERL_REVISION" +patchlevel="$PERL_VERSION" +subversion="$PERL_SUBVERSION" +version_patchlevel_string="version $PERL_VERSION subversion $PERL_SUBVERSION" +version="$PERL_REVISION.$PERL_VERSION.$PERL_SUBVERSION" + +api_revision="$PERL_API_REVISION" +api_version="$PERL_API_VERSION" +api_subversion="$PERL_API_SUBVERSION" +api_versionstring="$PERL_API_REVISION.$PERL_API_VERSION.$PERL_API_SUBVERSION" + +privlib="$owrt:perllibpath" +privlibexp="$privlib" +archlib="$owrt:perllibpath" +archlibexp="$archlib" + +installarchlib="$owrt:perllibpath" +installprivlib="$owrt:perllibpath" +installsitearch="$owrt:perllibpath" +installsitelib="$owrt:perllibpath" diff --git a/lang/perl/files/x86_64.config b/lang/perl/files/x86_64.config new file mode 100644 index 0000000..a9cb581 --- /dev/null +++ b/lang/perl/files/x86_64.config @@ -0,0 +1,28 @@ +owrt:arch=x86_64 +owrt:bits=64 +owrt:endian=little + +ccsymbols='' +cppccsymbols='' +cppsymbols='__ELF__=1 _LP64=1 __FLT_EVAL_METHOD__=0 __FXSR__=1 __GCC_ATOMIC_LLONG_LOCK_FREE=2 __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8=1 __INT64_MAX__=9223372036854775807L __INT64_TYPE__=long\ int __INTMAX_MAX__=9223372036854775807L __INTMAX_TYPE__=long\ int __INTPTR_MAX__=9223372036854775807L __INTPTR_TYPE__=long\ int __INT_FAST16_MAX__=9223372036854775807L __INT_FAST16_TYPE__=long\ int __INT_FAST32_MAX__=9223372036854775807L __INT_FAST32_TYPE__=long\ int __INT_FAST64_MAX__=9223372036854775807L __INT_FAST64_TYPE__=long\ int __INT_LEAST64_MAX__=9223372036854775807L __INT_LEAST64_TYPE__=long\ int __LONG_MAX__=9223372036854775807L __LP64__=1 __MMX__=1 __PTRDIFF_MAX__=9223372036854775807L __PTRDIFF_TYPE__=long\ int __SIZEOF_INT128__=16 __SIZEOF_LONG_DOUBLE__=16 __SIZEOF_LONG__=8 __SIZEOF_POINTER__=8 __SIZEOF_PTRDIFF_T__=8 __SIZEOF_SIZE_T__=8 __SIZE_MAX__=18446744073709551615UL __SIZE_TYPE__=long\ unsigned\ int __SSE2_MATH__=1 __SSE2__=1 __SSE_MATH__=1 __SSE__=1 __UINT64_MAX__=18446744073709551615UL __UINT64_TYPE__=long\ unsigned\ int __UINTMAX_MAX__=18446744073709551615UL __UINTMAX_TYPE__=long\ unsigned\ int __UINTPTR_MAX__=18446744073709551615UL __UINTPTR_TYPE__=long\ unsigned\ int __UINT_FAST16_MAX__=18446744073709551615UL __UINT_FAST16_TYPE__=long\ unsigned\ int __UINT_FAST32_MAX__=18446744073709551615UL __UINT_FAST32_TYPE__=long\ unsigned\ int __UINT_FAST64_MAX__=18446744073709551615UL __UINT_FAST64_TYPE__=long\ unsigned\ int __UINT_LEAST64_MAX__=18446744073709551615UL __UINT_LEAST64_TYPE__=long\ unsigned\ int __WCHAR_MAX__=2147483647 __WCHAR_MIN__=(-2147483647\ -\ 1) __WCHAR_TYPE__=int __amd64=1 __amd64__=1 __code_model_small__=1 __k8=1 __k8__=1 __x86_64=1 __x86_64__=1 _FILE_OFFSET_BITS=64 __GLIBC__=2 __GLIBC_MINOR__=2 __GNUC__=3 __GNUC_MINOR__=4 __GNU_LIBRARY__=6 _LARGEFILE_SOURCE=1 _POSIX_C_SOURCE=199506L _POSIX_SOURCE=1 __STDC__=1 __USE_BSD=1 __USE_FILE_OFFSET64=1 __USE_LARGEFILE=1 __USE_MISC=1 __USE_POSIX=1 __USE_POSIX199309=1 __USE_POSIX199506=1 __USE_POSIX2=1 __USE_SVID=1 linux=1 __linux=1 __linux__=1 unix=1 __unix=1 __unix__=1' +d_casti32='undef' +d_modflproto='define' +doublekind='3' +fpossize='16' +longdblkind='3' +need_va_copy='define' +quadkind='2' + +sPRIEUldbl='"LE"' +sPRIFUldbl='"LF"' +sPRIGUldbl='"LG"' +sPRIXU64='"lX"' +sPRIeldbl='"Le"' +sPRIfldbl='"Lf"' +sPRIgldbl='"Lg"' +sSCNfldbl='"Lf"' + +owrt:sig_count='64' +owrt:sigs='ZERO HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS' +owrt:sig_name_extra='IOT CLD POLL UNUSED' +owrt:sig_num_extra='6 17 29 31' diff --git a/lang/perl/patches/010-musl-compat.patch b/lang/perl/patches/010-musl-compat.patch new file mode 100644 index 0000000..8dbad78 --- /dev/null +++ b/lang/perl/patches/010-musl-compat.patch @@ -0,0 +1,11 @@ +--- a/pp.c ++++ b/pp.c +@@ -43,7 +43,7 @@ extern Pid_t getpid (void); + * Some BSDs and Cygwin default to POSIX math instead of IEEE. + * This switches them over to IEEE. + */ +-#if defined(LIBM_LIB_VERSION) ++#if defined(LIBM_LIB_VERSION) && (defined(__GLIBC__) || defined(__UCLIBC__)) + _LIB_VERSION_TYPE _LIB_VERSION = _IEEE_; + #endif + diff --git a/lang/perl/patches/020-host-libc-dir-moved-debian+derivatives.patch b/lang/perl/patches/020-host-libc-dir-moved-debian+derivatives.patch new file mode 100644 index 0000000..956466d --- /dev/null +++ b/lang/perl/patches/020-host-libc-dir-moved-debian+derivatives.patch @@ -0,0 +1,27 @@ +--- a/hints/linux.sh ++++ b/hints/linux.sh +@@ -221,6 +221,24 @@ case "$libc" in + ;; + esac + ++# Ubuntu 11.04 (and later, presumably) doesn't keep most libraries ++# (such as -lm) in /lib or /usr/lib. So we have to ask gcc to tell us ++# where to look. We don't want gcc's own libraries, however, so we ++# filter those out. ++# This could be conditional on Unbuntu, but other distributions may ++# follow suit, and this scheme seems to work even on rather old gcc's. ++# This unconditionally uses gcc because even if the user is using another ++# compiler, we still need to find the math library and friends, and I don't ++# know how other compilers will cope with that situation. ++# Still, as an escape hatch, allow Configure command line overrides to ++# plibpth to bypass this check. ++case "$plibpth" in ++'') plibpth=`gcc -print-search-dirs | grep libraries | ++ cut -f2- -d= | tr ':' $trnl | grep -v 'gcc'` ++ plibpth="$plibpth" # Collapse all entries on one line ++ ;; ++esac ++ + # Are we using ELF? Thanks to Kenneth Albanowski + # for this test. + cat >try.c <<'EOM' diff --git a/lang/perl/patches/100-fix-cross-compile-endianness-detection.patch b/lang/perl/patches/100-fix-cross-compile-endianness-detection.patch new file mode 100644 index 0000000..e187941 --- /dev/null +++ b/lang/perl/patches/100-fix-cross-compile-endianness-detection.patch @@ -0,0 +1,22 @@ +--- a/config_h.SH ++++ b/config_h.SH +@@ -52,6 +52,19 @@ sed <$CONFIG_H -e 's!^#und + #ifndef _config_h_ + #define _config_h_ + ++#if defined(USE_CROSS_COMPILE) && !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) ++# include ++# if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && defined(__BIG_ENDIAN) ++# if (__BYTE_ORDER == __LITTLE_ENDIAN) ++# define __LITTLE_ENDIAN__ ++# elif (__BYTE_ORDER == __BIG_ENDIAN) ++# define __BIG_ENDIAN__ ++# else ++# error Unknown endianness ++# endif ++# endif ++#endif ++ + /* LOC_SED: + * This symbol holds the complete pathname to the sed program. + */ diff --git a/lang/perl/patches/110-always_use_miniperl.patch b/lang/perl/patches/110-always_use_miniperl.patch new file mode 100644 index 0000000..9f9f812 --- /dev/null +++ b/lang/perl/patches/110-always_use_miniperl.patch @@ -0,0 +1,27 @@ +--- a/Makefile.SH ++++ b/Makefile.SH +@@ -316,22 +316,11 @@ MANIFEST_SRT = MANIFEST.srt + + !GROK!THIS! + +-case "$usecrosscompile$perl" in +-define?*) +- $spitshell >>$Makefile <>$Makefile <>$Makefile <>$Makefile < "relink"); diff --git a/lang/perl/patches/310-recompile-hack.patch b/lang/perl/patches/310-recompile-hack.patch new file mode 100644 index 0000000..05a8e9b --- /dev/null +++ b/lang/perl/patches/310-recompile-hack.patch @@ -0,0 +1,16 @@ +perl: Work around recompile failures + +Apparently, recompiling/relinking fails under some circumstances. This +patch has been reported to work around that issue. + +--- a/Makefile.SH ++++ b/Makefile.SH +@@ -818,7 +818,7 @@ $(LIBPERL): $& $(obj) $(DYNALOADER) $(LI + true) + $spitshell >>$Makefile <<'!NO!SUBS!' + rm -f $@ +- $(LD) -o $@ $(SHRPLDFLAGS) $(obj) $(DYNALOADER) $(libs) ++ $(CC) -o $@ $(SHRPLDFLAGS) $(obj) $(DYNALOADER) $(libs) + !NO!SUBS! + case "$osname" in + aix) diff --git a/lang/perl/patches/700-tie_fetch_count_t-handle_missing_crypt.patch b/lang/perl/patches/700-tie_fetch_count_t-handle_missing_crypt.patch new file mode 100644 index 0000000..f90e5d9 --- /dev/null +++ b/lang/perl/patches/700-tie_fetch_count_t-handle_missing_crypt.patch @@ -0,0 +1,26 @@ +--- a/t/op/tie_fetch_count.t ++++ b/t/op/tie_fetch_count.t +@@ -250,12 +250,17 @@ for ([chdir=>''],[chmod=>'0,'],[chown=>' + check_count "$op $args\\\$tied_glob$postargs"; + } + +-$dummy = crypt $var,0; check_count 'crypt $tied, ...'; +-$dummy = crypt 0,$var; check_count 'crypt ..., $tied'; +-$var = substr(chr 256,0,0); +-$dummy = crypt $var,0; check_count 'crypt $tied_utf8, ...'; +-$var = substr(chr 256,0,0); +-$dummy = crypt 0,$var; check_count 'crypt ..., $tied_utf8'; ++SKIP: { ++ use Config; ++ skip "crypt() is unavailable", 4, unless defined $Config{'d_crypt'}; ++ ++ $dummy = crypt $var,0; check_count 'crypt $tied, ...'; ++ $dummy = crypt 0,$var; check_count 'crypt ..., $tied'; ++ $var = substr(chr 256,0,0); ++ $dummy = crypt $var,0; check_count 'crypt $tied_utf8, ...'; ++ $var = substr(chr 256,0,0); ++ $dummy = crypt 0,$var; check_count 'crypt ..., $tied_utf8'; ++} + + SKIP: + { diff --git a/lang/perl/patches/710-threads_join-skip_ps_on_busybox.patch b/lang/perl/patches/710-threads_join-skip_ps_on_busybox.patch new file mode 100644 index 0000000..e60ee8c --- /dev/null +++ b/lang/perl/patches/710-threads_join-skip_ps_on_busybox.patch @@ -0,0 +1,81 @@ +perl: Skip $0 test on busybox + +This test requires a ps which provides the -f option, as well as suitable output. +We can't provide either with busybox. Just skip it for now. + +Signed-off-by: Marcel Denia + +--- a/dist/threads/t/join.t ++++ b/dist/threads/t/join.t +@@ -110,36 +110,41 @@ sub skip { + + # We parse ps output so this is OS-dependent. + if ($^O eq 'linux') { +- # First modify $0 in a subthread. +- #print "# mainthread: \$0 = $0\n"; +- threads->create(sub{ #print "# subthread: \$0 = $0\n"; +- $0 = "foobar"; +- #print "# subthread: \$0 = $0\n" +- })->join; +- #print "# mainthread: \$0 = $0\n"; +- #print "# pid = $$\n"; +- if (open PS, "ps -f |") { # Note: must work in (all) systems. +- my ($sawpid, $sawexe); +- while () { +- chomp; +- #print "# [$_]\n"; +- if (/^\s*\S+\s+$$\s/) { +- $sawpid++; +- if (/\sfoobar\s*$/) { # Linux 2.2 leaves extra trailing spaces. +- $sawexe++; +- } +- last; +- } +- } +- close PS or die; +- if ($sawpid) { +- ok($sawpid && $sawexe, 'altering $0 is effective'); +- } else { +- skip("\$0 check: did not see pid $$ in 'ps -f |'"); +- } +- } else { +- skip("\$0 check: opening 'ps -f |' failed: $!"); +- } ++ if (readlink('/bin/ps') ne 'busybox') { ++ # First modify $0 in a subthread. ++ #print "# mainthread: \$0 = $0\n"; ++ threads->create(sub{ #print "# subthread: \$0 = $0\n"; ++ $0 = "foobar"; ++ #print "# subthread: \$0 = $0\n" ++ })->join; ++ #print "# mainthread: \$0 = $0\n"; ++ #print "# pid = $$\n"; ++ if (open PS, "ps -f |") { # Note: must work in (all) systems. ++ my ($sawpid, $sawexe); ++ while () { ++ chomp; ++ #print "# [$_]\n"; ++ if (/^\s*\S+\s+$$\s/) { ++ $sawpid++; ++ if (/\sfoobar\s*$/) { # Linux 2.2 leaves extra trailing spaces. ++ $sawexe++; ++ } ++ last; ++ } ++ } ++ close PS or die; ++ if ($sawpid) { ++ ok($sawpid && $sawexe, 'altering $0 is effective'); ++ } else { ++ skip("\$0 check: did not see pid $$ in 'ps -f |'"); ++ } ++ } else { ++ skip("\$0 check: opening 'ps -f |' failed: $!"); ++ } ++ } ++ else { ++ skip("\$0 check: incompatible with busybox"); ++ } + } else { + skip("\$0 check: only on Linux"); + } diff --git a/lang/perl/patches/900-CVE-2015-8607.patch b/lang/perl/patches/900-CVE-2015-8607.patch new file mode 100644 index 0000000..5f1c1cb --- /dev/null +++ b/lang/perl/patches/900-CVE-2015-8607.patch @@ -0,0 +1,57 @@ +From b6307f728a4f842a54ea96959e386c7daa92ece1 Mon Sep 17 00:00:00 2001 +From: Tony Cook +Date: Tue, 15 Dec 2015 10:56:54 +1100 +Subject: [perl #126862] ensure File::Spec::canonpath() preserves taint + +Previously the unix specific XS implementation of canonpath() would +return an untainted path when supplied a tainted path. + +For the empty string case, newSVpvs() already sets taint as needed on +its result. +--- + dist/PathTools/Cwd.xs | 1 + + dist/PathTools/t/taint.t | 19 ++++++++++++++++++- + 2 files changed, 19 insertions(+), 1 deletion(-) + +--- a/dist/PathTools/Cwd.xs ++++ b/dist/PathTools/Cwd.xs +@@ -535,6 +535,7 @@ THX_unix_canonpath(pTHX_ SV *path) + *o = 0; + SvPOK_on(retval); + SvCUR_set(retval, o - SvPVX(retval)); ++ SvTAINT(retval); + return retval; + } + +--- a/dist/PathTools/t/taint.t ++++ b/dist/PathTools/t/taint.t +@@ -12,7 +12,7 @@ use Test::More; + BEGIN { + plan( + ${^TAINT} +- ? (tests => 17) ++ ? (tests => 21) + : (skip_all => "A perl without taint support") + ); + } +@@ -34,3 +34,20 @@ foreach my $func (@Functions) { + + # Previous versions of Cwd tainted $^O + is !tainted($^O), 1, "\$^O should not be tainted"; ++ ++{ ++ # [perl #126862] canonpath() loses taint ++ my $tainted = substr($ENV{PATH}, 0, 0); ++ # yes, getcwd()'s result should be tainted, and is tested above ++ # but be sure ++ ok tainted(File::Spec->canonpath($tainted . Cwd::getcwd)), ++ "canonpath() keeps taint on non-empty string"; ++ ok tainted(File::Spec->canonpath($tainted)), ++ "canonpath() keeps taint on empty string"; ++ ++ (Cwd::getcwd() =~ /^(.*)/); ++ my $untainted = $1; ++ ok !tainted($untainted), "make sure our untainted value is untainted"; ++ ok !tainted(File::Spec->canonpath($untainted)), ++ "canonpath() doesn't add taint to untainted string"; ++} diff --git a/lang/perl/patches/901-CVE-2016-2381.patch b/lang/perl/patches/901-CVE-2016-2381.patch new file mode 100644 index 0000000..ee5db6c --- /dev/null +++ b/lang/perl/patches/901-CVE-2016-2381.patch @@ -0,0 +1,102 @@ +From: Tony Cook +Date: Wed, 27 Jan 2016 00:52:15 +0000 (+1100) +Subject: remove duplicate environment variables from environ +X-Git-Url: http://perl5.git.perl.org/perl.git/commitdiff_plain/ae37b791a73a9e78dedb89fb2429d2628cf58076 + +remove duplicate environment variables from environ + +If we see duplicate environment variables while iterating over +environ[]: + +a) make sure we use the same value in %ENV that getenv() returns. + +Previously on a duplicate, %ENV would have the last entry for the name +from environ[], but a typical getenv() would return the first entry. + +Rather than assuming all getenv() implementations return the first entry +explicitly call getenv() to ensure they agree. + +b) remove duplicate entries from environ + +Previously if there was a duplicate definition for a name in environ[] +setting that name in %ENV could result in an unsafe value being passed +to a child process, so ensure environ[] has no duplicates. + +CVE-2016-2381 +--- + +--- a/perl.c ++++ b/perl.c +@@ -4298,23 +4298,70 @@ S_init_postdump_symbols(pTHX_ int argc, + } + if (env) { + char *s, *old_var; ++ STRLEN nlen; + SV *sv; ++ HV *dups = newHV(); ++ + for (; *env; env++) { + old_var = *env; + + if (!(s = strchr(old_var,'=')) || s == old_var) + continue; ++ nlen = s - old_var; + + #if defined(MSDOS) && !defined(DJGPP) + *s = '\0'; + (void)strupr(old_var); + *s = '='; + #endif +- sv = newSVpv(s+1, 0); +- (void)hv_store(hv, old_var, s - old_var, sv, 0); ++ if (hv_exists(hv, old_var, nlen)) { ++ const char *name = savepvn(old_var, nlen); ++ ++ /* make sure we use the same value as getenv(), otherwise code that ++ uses getenv() (like setlocale()) might see a different value to %ENV ++ */ ++ sv = newSVpv(PerlEnv_getenv(name), 0); ++ ++ /* keep a count of the dups of this name so we can de-dup environ later */ ++ if (hv_exists(dups, name, nlen)) ++ ++SvIVX(*hv_fetch(dups, name, nlen, 0)); ++ else ++ (void)hv_store(dups, name, nlen, newSViv(1), 0); ++ ++ Safefree(name); ++ } ++ else { ++ sv = newSVpv(s+1, 0); ++ } ++ (void)hv_store(hv, old_var, nlen, sv, 0); + if (env_is_not_environ) + mg_set(sv); + } ++ if (HvKEYS(dups)) { ++ /* environ has some duplicate definitions, remove them */ ++ HE *entry; ++ hv_iterinit(dups); ++ while ((entry = hv_iternext_flags(dups, 0))) { ++ STRLEN nlen; ++ const char *name = HePV(entry, nlen); ++ IV count = SvIV(HeVAL(entry)); ++ IV i; ++ SV **valp = hv_fetch(hv, name, nlen, 0); ++ ++ assert(valp); ++ ++ /* try to remove any duplicate names, depending on the ++ * implementation used in my_setenv() the iteration might ++ * not be necessary, but let's be safe. ++ */ ++ for (i = 0; i < count; ++i) ++ my_setenv(name, 0); ++ ++ /* and set it back to the value we set $ENV{name} to */ ++ my_setenv(name, SvPV_nolen(*valp)); ++ } ++ } ++ SvREFCNT_dec_NN(dups); + } + #endif /* USE_ENVIRON_ARRAY */ + #endif /* !PERL_MICRO */ diff --git a/lang/perl/perlbase.mk b/lang/perl/perlbase.mk new file mode 100644 index 0000000..9ad9d77 --- /dev/null +++ b/lang/perl/perlbase.mk @@ -0,0 +1,1559 @@ +define Package/perlbase-template +SUBMENU:=Perl +SECTION:=lang +CATEGORY:=Languages +URL:=http://www.cpan.org/ +DEPENDS:=perl +endef + +define Package/perlbase-anydbm-file +$(call Package/perlbase-template) +TITLE:=AnyDBM_File perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-anydbm-file/install +$(call perlmod/Install,$(1),AnyDBM_File.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/AnyDBM_File.t) +endef + +$(eval $(call BuildPackage,perlbase-anydbm-file)) + + +define Package/perlbase-app +$(call Package/perlbase-template) +TITLE:=app perl module +DEPENDS+=+perlbase-autouse +perlbase-base +perlbase-config +perlbase-cpan +perlbase-essential +perlbase-file +perlbase-getopt +perlbase-if +perlbase-tap +perlbase-text +endef + +define Package/perlbase-app/install +$(call perlmod/Install,$(1),App,) +endef + +$(eval $(call BuildPackage,perlbase-app)) + + +define Package/perlbase-archive +$(call Package/perlbase-template) +TITLE:=Archive perl module +DEPENDS+=+perlbase-cwd +perlbase-essential +perlbase-file +perlbase-io +endef + +define Package/perlbase-archive/install +$(call perlmod/Install,$(1),Archive,) +$(call perlmod/InstallBaseTests,$(1),cpan/Archive-Tar/bin cpan/Archive-Tar/t) + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/ptar $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/ptardiff $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/ptargrep $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,perlbase-archive)) + + +define Package/perlbase-arybase +$(call Package/perlbase-template) +TITLE:=arybase perl module +DEPENDS+=+perlbase-xsloader +endef + +define Package/perlbase-arybase/install +$(call perlmod/Install,$(1),arybase.pm auto/arybase,) +$(call perlmod/InstallBaseTests,$(1),ext/arybase/t) +endef + +$(eval $(call BuildPackage,perlbase-arybase)) + + +define Package/perlbase-attribute +$(call Package/perlbase-template) +TITLE:=Attribute perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-attribute/install +$(call perlmod/Install,$(1),Attribute,) +$(call perlmod/InstallBaseTests,$(1),dist/Attribute-Handlers/t) +endef + +$(eval $(call BuildPackage,perlbase-attribute)) + + +define Package/perlbase-attributes +$(call Package/perlbase-template) +TITLE:=attributes perl module +DEPENDS+=+perlbase-essential +perlbase-xsloader +endef + +define Package/perlbase-attributes/install +$(call perlmod/Install,$(1),attributes.pm auto/attributes,) +endef + +$(eval $(call BuildPackage,perlbase-attributes)) + + +define Package/perlbase-autodie +$(call Package/perlbase-template) +TITLE:=autodie perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-autodie/install +$(call perlmod/Install,$(1),autodie autodie.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/autodie/t) +endef + +$(eval $(call BuildPackage,perlbase-autodie)) + + +define Package/perlbase-autoloader +$(call Package/perlbase-template) +TITLE:=AutoLoader perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-autoloader/install +$(call perlmod/Install,$(1),AutoLoader.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/AutoLoader/t) +endef + +$(eval $(call BuildPackage,perlbase-autoloader)) + + +define Package/perlbase-autosplit +$(call Package/perlbase-template) +TITLE:=AutoSplit perl module +DEPENDS+=+perlbase-config +perlbase-essential +perlbase-file +endef + +define Package/perlbase-autosplit/install +$(call perlmod/Install/NoStrip,$(1),AutoSplit.pm,) +endef + +$(eval $(call BuildPackage,perlbase-autosplit)) + + +define Package/perlbase-autouse +$(call Package/perlbase-template) +TITLE:=autouse perl module +endef + +define Package/perlbase-autouse/install +$(call perlmod/Install,$(1),autouse.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/autouse/t) +endef + +$(eval $(call BuildPackage,perlbase-autouse)) + + +define Package/perlbase-b +$(call Package/perlbase-template) +TITLE:=B perl module +DEPENDS+=+perlbase-config +perlbase-essential +perlbase-feature +endef + +define Package/perlbase-b/install +$(call perlmod/Install,$(1),B B.pm auto/B,) +$(call perlmod/InstallBaseTests,$(1),cpan/B-Debug/t ext/B/t lib/B/Deparse-core.t lib/B/Deparse-subclass.t lib/B/Deparse.t) +endef + +$(eval $(call BuildPackage,perlbase-b)) + + +define Package/perlbase-base +$(call Package/perlbase-template) +TITLE:=base perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-base/install +$(call perlmod/Install,$(1),base.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/base/t) +endef + +$(eval $(call BuildPackage,perlbase-base)) + + +define Package/perlbase-benchmark +$(call Package/perlbase-template) +TITLE:=Benchmark perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-benchmark/install +$(call perlmod/Install,$(1),Benchmark.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/Benchmark.t) +endef + +$(eval $(call BuildPackage,perlbase-benchmark)) + + +define Package/perlbase-bigint +$(call Package/perlbase-template) +TITLE:=bigint perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-bigint/install +$(call perlmod/Install,$(1),bigint.pm,) +endef + +$(eval $(call BuildPackage,perlbase-bigint)) + + +define Package/perlbase-bignum +$(call Package/perlbase-template) +TITLE:=bignum perl module +DEPENDS+=+perlbase-bigint +perlbase-essential +endef + +define Package/perlbase-bignum/install +$(call perlmod/Install,$(1),bignum.pm bigrat.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/bignum/t) +endef + +$(eval $(call BuildPackage,perlbase-bignum)) + + +define Package/perlbase-blib +$(call Package/perlbase-template) +TITLE:=blib perl module +DEPENDS+=+perlbase-cwd +perlbase-essential +perlbase-file +endef + +define Package/perlbase-blib/install +$(call perlmod/Install,$(1),blib.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/blib.t) +endef + +$(eval $(call BuildPackage,perlbase-blib)) + + +define Package/perlbase-bytes +$(call Package/perlbase-template) +TITLE:=bytes perl module +endef + +define Package/perlbase-bytes/install +$(call perlmod/Install,$(1),bytes.pm bytes_heavy.pl,) +$(call perlmod/InstallBaseTests,$(1),lib/bytes.t) +endef + +$(eval $(call BuildPackage,perlbase-bytes)) + + +define Package/perlbase-charnames +$(call Package/perlbase-template) +TITLE:=charnames perl module +DEPENDS+=+perlbase-bytes +perlbase-essential +perlbase-re +perlbase-unicore +endef + +define Package/perlbase-charnames/install +$(call perlmod/Install,$(1),_charnames.pm charnames.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/charnames.t) +endef + +$(eval $(call BuildPackage,perlbase-charnames)) + + +define Package/perlbase-class +$(call Package/perlbase-template) +TITLE:=Class perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-class/install +$(call perlmod/Install,$(1),Class,) +$(call perlmod/InstallBaseTests,$(1),lib/Class/Struct.t) +endef + +$(eval $(call BuildPackage,perlbase-class)) + + +define Package/perlbase-compress +$(call Package/perlbase-template) +TITLE:=Compress perl module +DEPENDS+=+perlbase-bytes +perlbase-essential +perlbase-io +perlbase-scalar +endef + +define Package/perlbase-compress/install +$(call perlmod/Install,$(1),Compress auto/Compress,) +$(call perlmod/InstallBaseTests,$(1),cpan/Compress-Raw-Bzip2/t cpan/Compress-Raw-Zlib/t) +endef + +$(eval $(call BuildPackage,perlbase-compress)) + + +define Package/perlbase-config +$(call Package/perlbase-template) +TITLE:=Config perl module +endef + +define Package/perlbase-config/install +$(call perlmod/Install,$(1),Config Config.pm Config_git.pl Config_heavy.pl,) +$(call perlmod/InstallBaseTests,$(1),cpan/Config-Perl-V/t lib/Config.t lib/Config/Extensions.t) +endef + +$(eval $(call BuildPackage,perlbase-config)) + + +define Package/perlbase-cpan +$(call Package/perlbase-template) +TITLE:=CPAN perl module +DEPENDS+=+perlbase-b +perlbase-config +perlbase-cwd +perlbase-dirhandle +perlbase-essential +perlbase-extutils +perlbase-fcntl +perlbase-file +perlbase-filehandle +perlbase-http-tiny +perlbase-net +perlbase-safe +perlbase-scalar +perlbase-sys +perlbase-text +endef + +define Package/perlbase-cpan/install +$(call perlmod/Install,$(1),CPAN CPAN.pm Parse/CPAN/Meta.pm,CPAN/FirstTime.pm) +$(call perlmod/Install/NoStrip,$(1),CPAN/FirstTime.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/CPAN-Meta-Requirements/t cpan/CPAN-Meta-YAML/t cpan/CPAN-Meta/t cpan/CPAN/t cpan/Parse-CPAN-Meta/t) +endef + +$(eval $(call BuildPackage,perlbase-cpan)) + + +define Package/perlbase-cwd +$(call Package/perlbase-template) +TITLE:=Cwd perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-cwd/install +$(call perlmod/Install,$(1),Cwd.pm auto/Cwd,) +endef + +$(eval $(call BuildPackage,perlbase-cwd)) + + +define Package/perlbase-data +$(call Package/perlbase-template) +TITLE:=Data perl module +DEPENDS+=+perlbase-bytes +perlbase-essential +endef + +define Package/perlbase-data/install +$(call perlmod/Install,$(1),Data auto/Data,) +$(call perlmod/InstallBaseTests,$(1),dist/Data-Dumper/t) +endef + +$(eval $(call BuildPackage,perlbase-data)) + + +define Package/perlbase-db +$(call Package/perlbase-template) +TITLE:=DB perl module +DEPENDS+=+libdb47 +perlbase-essential +perlbase-meta-notation +endef + +define Package/perlbase-db/install +$(call perlmod/Install,$(1),DB.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/DB.t) +endef + +$(eval $(call BuildPackage,perlbase-db)) + + +define Package/perlbase-db-file +$(call Package/perlbase-template) +TITLE:=DB_File perl module +DEPENDS+=+libdb47 +perlbase-essential +perlbase-tie +endef + +define Package/perlbase-db-file/install +$(call perlmod/Install,$(1),DB_File.pm auto/DB_File,) +$(call perlmod/InstallBaseTests,$(1),cpan/DB_File/t) +endef + +$(eval $(call BuildPackage,perlbase-db-file)) + + +define Package/perlbase-dbm-filter +$(call Package/perlbase-template) +TITLE:=DBM_Filter perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-dbm-filter/install +$(call perlmod/Install,$(1),DBM_Filter DBM_Filter.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/DBM_Filter/t lib/dbm_filter_util.pl) +endef + +$(eval $(call BuildPackage,perlbase-dbm-filter)) + + +define Package/perlbase-devel +$(call Package/perlbase-template) +TITLE:=Devel perl module +DEPENDS+=+perlbase-essential +perlbase-file +perlbase-selfloader +perlbase-xsloader +endef + +define Package/perlbase-devel/install +$(call perlmod/Install,$(1),Devel auto/Devel,Devel/PPPort.pm) +$(call perlmod/Install/NoStrip,$(1),Devel/PPPort.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/Devel-PPPort/t dist/Devel-SelfStubber/t ext/Devel-Peek/t) +endef + +$(eval $(call BuildPackage,perlbase-devel)) + + +define Package/perlbase-diagnostics +$(call Package/perlbase-template) +TITLE:=diagnostics perl module +DEPENDS+=+perlbase-config +perlbase-essential +perlbase-text +endef + +define Package/perlbase-diagnostics/install +$(call perlmod/Install,$(1),diagnostics.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/diagnostics.t pod/perldiag.pod) +endef + +$(eval $(call BuildPackage,perlbase-diagnostics)) + + +define Package/perlbase-digest +$(call Package/perlbase-template) +TITLE:=Digest perl module +DEPENDS+=+perlbase-dynaloader +perlbase-essential +perlbase-fcntl +perlbase-integer +endef + +define Package/perlbase-digest/install +$(call perlmod/Install,$(1),Digest Digest.pm auto/Digest,) +$(call perlmod/InstallBaseTests,$(1),cpan/Digest-MD5/MD5.xs cpan/Digest-MD5/t cpan/Digest-SHA/t cpan/Digest/t) + $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/cpan/Digest-SHA/src +endef + +$(eval $(call BuildPackage,perlbase-digest)) + + +define Package/perlbase-dirhandle +$(call Package/perlbase-template) +TITLE:=DirHandle perl module +DEPENDS+=+perlbase-essential +perlbase-symbol +endef + +define Package/perlbase-dirhandle/install +$(call perlmod/Install,$(1),DirHandle.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/DirHandle.t) +endef + +$(eval $(call BuildPackage,perlbase-dirhandle)) + + +define Package/perlbase-dumpvalue +$(call Package/perlbase-template) +TITLE:=Dumpvalue perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-dumpvalue/install +$(call perlmod/Install,$(1),Dumpvalue.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/Dumpvalue/t) +endef + +$(eval $(call BuildPackage,perlbase-dumpvalue)) + + +define Package/perlbase-dumpvar +$(call Package/perlbase-template) +TITLE:=dumpvar perl module +endef + +define Package/perlbase-dumpvar/install +$(call perlmod/Install,$(1),dumpvar.pl,) +$(call perlmod/InstallBaseTests,$(1),lib/dumpvar.t) +endef + +$(eval $(call BuildPackage,perlbase-dumpvar)) + + +define Package/perlbase-dynaloader +$(call Package/perlbase-template) +TITLE:=DynaLoader perl module +DEPENDS+=+perlbase-config +endef + +define Package/perlbase-dynaloader/install +$(call perlmod/Install,$(1),DynaLoader.pm,) +$(call perlmod/InstallBaseTests,$(1),ext/DynaLoader/t) +endef + +$(eval $(call BuildPackage,perlbase-dynaloader)) + + +define Package/perlbase-encode +$(call Package/perlbase-template) +TITLE:=Encode perl module +DEPENDS+=+perlbase-essential +perlbase-mime +perlbase-utf8 +perlbase-xsloader +endef + +define Package/perlbase-encode/install +$(call perlmod/Install,$(1),Encode Encode.pm auto/Encode,Encode/PerlIO.pod Encode/Supported.pod) +$(call perlmod/InstallBaseTests,$(1),cpan/Encode/t) +endef + +$(eval $(call BuildPackage,perlbase-encode)) + + +define Package/perlbase-encoding +$(call Package/perlbase-template) +TITLE:=encoding perl module +DEPENDS+=+perlbase-encode +perlbase-essential +endef + +define Package/perlbase-encoding/install +$(call perlmod/Install,$(1),encoding encoding.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/encoding-warnings/t) +endef + +$(eval $(call BuildPackage,perlbase-encoding)) + + +define Package/perlbase-english +$(call Package/perlbase-template) +TITLE:=English perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-english/install +$(call perlmod/Install,$(1),English.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/English.t) +endef + +$(eval $(call BuildPackage,perlbase-english)) + + +define Package/perlbase-env +$(call Package/perlbase-template) +TITLE:=Env perl module +DEPENDS+=+perlbase-config +perlbase-tie +endef + +define Package/perlbase-env/install +$(call perlmod/Install,$(1),Env.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/Env/t) +endef + +$(eval $(call BuildPackage,perlbase-env)) + + +define Package/perlbase-errno +$(call Package/perlbase-template) +TITLE:=Errno perl module +DEPENDS+=+perlbase-config +perlbase-essential +endef + +define Package/perlbase-errno/install +$(call perlmod/Install,$(1),Errno.pm,) +$(call perlmod/InstallBaseTests,$(1),ext/Errno/t) +endef + +$(eval $(call BuildPackage,perlbase-errno)) + + +define Package/perlbase-essential +$(call Package/perlbase-template) +TITLE:=essential perl module +DEPENDS+=+perlbase-config +endef + +define Package/perlbase-essential/install +$(call perlmod/Install,$(1),Carp Carp.pm Exporter Exporter.pm constant.pm deprecate.pm lib.pm locale.pm overload.pm overloading.pm parent.pm strict.pm subs.pm vars.pm warnings warnings.pm,) +$(call perlmod/Install/NoStrip,$(1),overload/numbers.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/parent/t dist/Carp/t dist/Exporter/t dist/constant/t dist/lib/t lib/locale.t lib/overload.t lib/overload64.t lib/overloading.t lib/strict.t lib/subs.t lib/vars.t lib/vars_carp.t lib/warnings.t) +endef + +$(eval $(call BuildPackage,perlbase-essential)) + + +define Package/perlbase-experimental +$(call Package/perlbase-template) +TITLE:=experimental perl module +DEPENDS+=+perlbase-essential +perlbase-feature +perlbase-version +endef + +define Package/perlbase-experimental/install +$(call perlmod/Install,$(1),experimental.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/experimental/t) +endef + +$(eval $(call BuildPackage,perlbase-experimental)) + + +define Package/perlbase-extutils +$(call Package/perlbase-template) +TITLE:=ExtUtils perl module +DEPENDS+=+perlbase-autosplit +perlbase-base +perlbase-config +perlbase-cwd +perlbase-dirhandle +perlbase-encode +perlbase-essential +perlbase-file +perlbase-io +perlbase-ipc +perlbase-ostype +perlbase-symbol +perlbase-text +endef + +define Package/perlbase-extutils/install +$(call perlmod/Install,$(1),ExtUtils,ExtUtils/MakeMaker/FAQ.pod ExtUtils/MakeMaker/Tutorial.pod ExtUtils/ParseXS.pm ExtUtils/ParseXS/Utilities.pm) +$(call perlmod/Install/NoStrip,$(1),ExtUtils/ParseXS.pm ExtUtils/ParseXS/Utilities.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/ExtUtils-Command/t cpan/ExtUtils-Constant/t cpan/ExtUtils-Install/t cpan/ExtUtils-MakeMaker/t cpan/ExtUtils-Manifest/t dist/ExtUtils-CBuilder/t dist/ExtUtils-ParseXS/t lib/ExtUtils/t lib/h2ph.t lib/h2xs.t utils/h2ph utils/h2xs) +endef + +$(eval $(call BuildPackage,perlbase-extutils)) + + +define Package/perlbase-fatal +$(call Package/perlbase-template) +TITLE:=Fatal perl module +DEPENDS+=+perlbase-autodie +perlbase-config +perlbase-essential +perlbase-scalar +perlbase-tie +endef + +define Package/perlbase-fatal/install +$(call perlmod/Install,$(1),Fatal.pm,) +endef + +$(eval $(call BuildPackage,perlbase-fatal)) + + +define Package/perlbase-fcntl +$(call Package/perlbase-template) +TITLE:=Fcntl perl module +DEPENDS+=+perlbase-essential +perlbase-xsloader +endef + +define Package/perlbase-fcntl/install +$(call perlmod/Install,$(1),Fcntl.pm auto/Fcntl,) +$(call perlmod/InstallBaseTests,$(1),ext/Fcntl/t) +endef + +$(eval $(call BuildPackage,perlbase-fcntl)) + + +define Package/perlbase-feature +$(call Package/perlbase-template) +TITLE:=feature perl module +endef + +define Package/perlbase-feature/install +$(call perlmod/Install,$(1),feature.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/feature.t lib/feature/unicode_strings.t) +endef + +$(eval $(call BuildPackage,perlbase-feature)) + + +define Package/perlbase-fields +$(call Package/perlbase-template) +TITLE:=fields perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-fields/install +$(call perlmod/Install,$(1),fields.pm,) +endef + +$(eval $(call BuildPackage,perlbase-fields)) + + +define Package/perlbase-file +$(call Package/perlbase-template) +TITLE:=File perl module +DEPENDS+=+perlbase-class +perlbase-config +perlbase-cwd +perlbase-errno +perlbase-essential +perlbase-fcntl +perlbase-filehandle +perlbase-io +perlbase-locale +perlbase-params +perlbase-scalar +perlbase-symbol +perlbase-xsloader +endef + +define Package/perlbase-file/install +$(call perlmod/Install,$(1),File auto/File,File/Find.pm) +$(call perlmod/Install/NoStrip,$(1),File/Find.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/File-Fetch/t cpan/File-Path/t cpan/File-Temp/t dist/PathTools/t ext/File-DosGlob/t ext/File-Find/t ext/File-Glob/t lib/File/Basename.t lib/File/Compare.t lib/File/Copy.t lib/File/stat-7896.t lib/File/stat.t) +endef + +$(eval $(call BuildPackage,perlbase-file)) + + +define Package/perlbase-filecache +$(call Package/perlbase-template) +TITLE:=FileCache perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-filecache/install +$(call perlmod/Install,$(1),FileCache.pm,) +$(call perlmod/InstallBaseTests,$(1),ext/FileCache/t) +endef + +$(eval $(call BuildPackage,perlbase-filecache)) + + +define Package/perlbase-filehandle +$(call Package/perlbase-template) +TITLE:=FileHandle perl module +DEPENDS+=+perlbase-essential +perlbase-io +endef + +define Package/perlbase-filehandle/install +$(call perlmod/Install,$(1),FileHandle.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/FileHandle.t) +endef + +$(eval $(call BuildPackage,perlbase-filehandle)) + + +define Package/perlbase-filetest +$(call Package/perlbase-template) +TITLE:=filetest perl module +endef + +define Package/perlbase-filetest/install +$(call perlmod/Install,$(1),filetest.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/filetest.t) +endef + +$(eval $(call BuildPackage,perlbase-filetest)) + + +define Package/perlbase-filter +$(call Package/perlbase-template) +TITLE:=Filter perl module +DEPENDS+=+perlbase-dynaloader +perlbase-essential +perlbase-text +endef + +define Package/perlbase-filter/install +$(call perlmod/Install,$(1),Filter auto/Filter,) +$(call perlmod/InstallBaseTests,$(1),cpan/Filter-Util-Call/filter-util.pl cpan/Filter-Util-Call/t dist/Filter-Simple/t) +endef + +$(eval $(call BuildPackage,perlbase-filter)) + + +define Package/perlbase-findbin +$(call Package/perlbase-template) +TITLE:=FindBin perl module +DEPENDS+=+perlbase-cwd +perlbase-essential +perlbase-file +endef + +define Package/perlbase-findbin/install +$(call perlmod/Install,$(1),FindBin.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/FindBin.t) +endef + +$(eval $(call BuildPackage,perlbase-findbin)) + + +define Package/perlbase-gdbm-file +$(call Package/perlbase-template) +TITLE:=GDBM_File perl module +DEPENDS+=+libgdbm +perlbase-essential +perlbase-tie +perlbase-xsloader +endef + +define Package/perlbase-gdbm-file/install +$(call perlmod/Install,$(1),GDBM_File.pm auto/GDBM_File,) +$(call perlmod/InstallBaseTests,$(1),ext/GDBM_File/t) +endef + +$(eval $(call BuildPackage,perlbase-gdbm-file)) + + +define Package/perlbase-getopt +$(call Package/perlbase-template) +TITLE:=Getopt perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-getopt/install +$(call perlmod/Install,$(1),Getopt,) +$(call perlmod/InstallBaseTests,$(1),cpan/Getopt-Long/t lib/Getopt/Std.t) +endef + +$(eval $(call BuildPackage,perlbase-getopt)) + + +define Package/perlbase-hash +$(call Package/perlbase-template) +TITLE:=Hash perl module +DEPENDS+=+perlbase-essential +perlbase-scalar +perlbase-xsloader +endef + +define Package/perlbase-hash/install +$(call perlmod/Install,$(1),Hash auto/Hash,) +$(call perlmod/InstallBaseTests,$(1),ext/Hash-Util-FieldHash/t ext/Hash-Util/t) +endef + +$(eval $(call BuildPackage,perlbase-hash)) + + +define Package/perlbase-http-tiny +$(call Package/perlbase-template) +TITLE:=http-tiny perl module +DEPENDS+=+perlbase-errno +perlbase-essential +perlbase-io +endef + +define Package/perlbase-http-tiny/install +$(call perlmod/Install,$(1),HTTP/Tiny.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/HTTP-Tiny/corpus cpan/HTTP-Tiny/t) +endef + +$(eval $(call BuildPackage,perlbase-http-tiny)) + + +define Package/perlbase-i18n +$(call Package/perlbase-template) +TITLE:=I18N perl module +DEPENDS+=+perlbase-essential +perlbase-posix +perlbase-xsloader +endef + +define Package/perlbase-i18n/install +$(call perlmod/Install,$(1),I18N auto/I18N,I18N/LangTags/List.pm) +$(call perlmod/InstallBaseTests,$(1),dist/I18N-Collate/t dist/I18N-LangTags/t ext/I18N-Langinfo/t) +$(call perlmod/Install/NoStrip,$(1),I18N/LangTags/List.pm) +endef + +$(eval $(call BuildPackage,perlbase-i18n)) + + +define Package/perlbase-if +$(call Package/perlbase-template) +TITLE:=if perl module +endef + +define Package/perlbase-if/install +$(call perlmod/Install,$(1),if.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/if/t) +endef + +$(eval $(call BuildPackage,perlbase-if)) + + +define Package/perlbase-integer +$(call Package/perlbase-template) +TITLE:=integer perl module +endef + +define Package/perlbase-integer/install +$(call perlmod/Install,$(1),integer.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/integer.t) +endef + +$(eval $(call BuildPackage,perlbase-integer)) + + +define Package/perlbase-io +$(call Package/perlbase-template) +TITLE:=IO perl module +DEPENDS+=+perlbase-base +perlbase-bytes +perlbase-config +perlbase-errno +perlbase-essential +perlbase-fcntl +perlbase-list +perlbase-posix +perlbase-scalar +perlbase-selectsaver +perlbase-socket +perlbase-symbol +perlbase-tie +perlbase-xsloader +endef + +define Package/perlbase-io/install +$(call perlmod/Install,$(1),IO IO.pm auto/IO,) +$(call perlmod/InstallBaseTests,$(1),cpan/IO-Compress/t cpan/IO-Socket-IP/t cpan/IO-Zlib/t dist/IO/Makefile.PL dist/IO/t) +endef + +$(eval $(call BuildPackage,perlbase-io)) + + +define Package/perlbase-ipc +$(call Package/perlbase-template) +TITLE:=IPC perl module +DEPENDS+=+perlbase-config +perlbase-essential +perlbase-file +perlbase-locale +perlbase-params +perlbase-symbol +perlbase-text +endef + +define Package/perlbase-ipc/install +$(call perlmod/Install,$(1),IPC auto/IPC,) +$(call perlmod/InstallBaseTests,$(1),cpan/IPC-Cmd/t cpan/IPC-SysV/t ext/IPC-Open3/t) +endef + +$(eval $(call BuildPackage,perlbase-ipc)) + + +define Package/perlbase-json-pp +$(call Package/perlbase-template) +TITLE:=json-pp perl module +DEPENDS+=+perlbase-b +perlbase-base +perlbase-essential +endef + +define Package/perlbase-json-pp/install +$(call perlmod/Install,$(1),JSON/PP JSON/PP.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/JSON-PP/t) +endef + +$(eval $(call BuildPackage,perlbase-json-pp)) + + +define Package/perlbase-less +$(call Package/perlbase-template) +TITLE:=less perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-less/install +$(call perlmod/Install,$(1),less.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/less.t) +endef + +$(eval $(call BuildPackage,perlbase-less)) + + +define Package/perlbase-list +$(call Package/perlbase-template) +TITLE:=List perl module +DEPENDS+=+perlbase-essential +perlbase-xsloader +endef + +define Package/perlbase-list/install +$(call perlmod/Install,$(1),List auto/List,) +endef + +$(eval $(call BuildPackage,perlbase-list)) + + +define Package/perlbase-locale +$(call Package/perlbase-template) +TITLE:=Locale perl module +DEPENDS+=+perlbase-essential +perlbase-i18n +perlbase-integer +perlbase-utf8 +endef + +define Package/perlbase-locale/install +$(call perlmod/Install,$(1),Locale,Locale/Constants.pod Locale/Country.pod Locale/Currency.pod Locale/Language.pod Locale/Maketext.pod Locale/Maketext/TPJ13.pod Locale/Script.pod) +$(call perlmod/InstallBaseTests,$(1),cpan/Locale-Codes/t cpan/Locale-Maketext-Simple/t dist/Locale-Maketext/t) +endef + +$(eval $(call BuildPackage,perlbase-locale)) + + +define Package/perlbase-math +$(call Package/perlbase-template) +TITLE:=Math perl module +DEPENDS+=+perlbase-config +perlbase-essential +perlbase-scalar +perlbase-xsloader +endef + +define Package/perlbase-math/install +$(call perlmod/Install,$(1),Math auto/Math,) +$(call perlmod/InstallBaseTests,$(1),cpan/Math-Complex/t dist/Math-BigInt-FastCalc/t dist/Math-BigInt/t dist/Math-BigRat/t) +endef + +$(eval $(call BuildPackage,perlbase-math)) + + +define Package/perlbase-memoize +$(call Package/perlbase-template) +TITLE:=Memoize perl module +DEPENDS+=+perlbase-config +perlbase-essential +perlbase-storable +endef + +define Package/perlbase-memoize/install +$(call perlmod/Install,$(1),Memoize Memoize.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/Memoize/t) +endef + +$(eval $(call BuildPackage,perlbase-memoize)) + + +define Package/perlbase-meta-notation +$(call Package/perlbase-template) +TITLE:=meta_notation module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-meta-notation/install +$(call perlmod/Install,$(1),meta_notation.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/meta_notation.t) +endef + +$(eval $(call BuildPackage,perlbase-meta-notation)) + + +define Package/perlbase-mime +$(call Package/perlbase-template) +TITLE:=MIME perl module +DEPENDS+=+perlbase-essential +perlbase-xsloader +endef + +define Package/perlbase-mime/install +$(call perlmod/Install,$(1),MIME auto/MIME,) +$(call perlmod/InstallBaseTests,$(1),cpan/MIME-Base64/t) +endef + +$(eval $(call BuildPackage,perlbase-mime)) + + +define Package/perlbase-module +$(call Package/perlbase-template) +TITLE:=Module perl module +DEPENDS+=+perlbase-essential +perlbase-file +perlbase-filehandle +perlbase-locale +perlbase-params +perlbase-version +endef + +define Package/perlbase-module/install +$(call perlmod/Install,$(1),Module,) +$(call perlmod/InstallBaseTests,$(1),cpan/Module-Load-Conditional/t cpan/Module-Load/t cpan/Module-Loaded/t cpan/Module-Metadata/corpus cpan/Module-Metadata/lib cpan/Module-Metadata/t dist/Module-CoreList/t) +endef + +$(eval $(call BuildPackage,perlbase-module)) + + +define Package/perlbase-mro +$(call Package/perlbase-template) +TITLE:=mro perl module +DEPENDS+=+perlbase-essential +perlbase-xsloader +endef + +define Package/perlbase-mro/install +$(call perlmod/Install,$(1),auto/mro mro.pm,) +endef + +$(eval $(call BuildPackage,perlbase-mro)) + + +define Package/perlbase-net +$(call Package/perlbase-template) +TITLE:=Net perl module +DEPENDS+=+perlbase-class +perlbase-errno +perlbase-essential +perlbase-fcntl +perlbase-filehandle +perlbase-io +perlbase-posix +perlbase-socket +perlbase-symbol +perlbase-time +endef + +define Package/perlbase-net/install +$(call perlmod/Install,$(1),Net,Net/libnetFAQ.pod) +$(call perlmod/InstallBaseTests,$(1),cpan/libnet/t dist/Net-Ping/t lib/Net/hostent.t lib/Net/netent.t lib/Net/protoent.t lib/Net/servent.t) +endef + +$(eval $(call BuildPackage,perlbase-net)) + + +define Package/perlbase-next +$(call Package/perlbase-template) +TITLE:=NEXT perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-next/install +$(call perlmod/Install,$(1),NEXT.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/NEXT/t) +endef + +$(eval $(call BuildPackage,perlbase-next)) + + +define Package/perlbase-o +$(call Package/perlbase-template) +TITLE:=O perl module +DEPENDS+=+perlbase-b +perlbase-essential +endef + +define Package/perlbase-o/install +$(call perlmod/Install,$(1),O.pm,) +endef + +$(eval $(call BuildPackage,perlbase-o)) + + +define Package/perlbase-opcode +$(call Package/perlbase-template) +TITLE:=Opcode perl module +DEPENDS+=+perlbase-essential +perlbase-xsloader +endef + +define Package/perlbase-opcode/install +$(call perlmod/Install,$(1),auto/Opcode,) +$(call perlmod/Install/NoStrip,$(1),Opcode.pm,) +$(call perlmod/InstallBaseTests,$(1),ext/Opcode/t) +endef + +$(eval $(call BuildPackage,perlbase-opcode)) + + +define Package/perlbase-open +$(call Package/perlbase-template) +TITLE:=open perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-open/install +$(call perlmod/Install,$(1),open.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/open.t) +endef + +$(eval $(call BuildPackage,perlbase-open)) + + +define Package/perlbase-ops +$(call Package/perlbase-template) +TITLE:=ops perl module +DEPENDS+=+perlbase-opcode +endef + +define Package/perlbase-ops/install +$(call perlmod/Install,$(1),ops.pm,) +endef + +$(eval $(call BuildPackage,perlbase-ops)) + + +define Package/perlbase-ostype +$(call Package/perlbase-template) +TITLE:=OSType perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-ostype/install +$(call perlmod/Install,$(1),Perl/OSType.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/Perl-OSType/t) +endef + +$(eval $(call BuildPackage,perlbase-ostype)) + + +define Package/perlbase-params +$(call Package/perlbase-template) +TITLE:=Params perl module +DEPENDS+=+perlbase-essential +perlbase-locale +endef + +define Package/perlbase-params/install +$(call perlmod/Install,$(1),Params,) +$(call perlmod/InstallBaseTests,$(1),cpan/Params-Check/t) +endef + +$(eval $(call BuildPackage,perlbase-params)) + + +define Package/perlbase-perl5db +$(call Package/perlbase-template) +TITLE:=perl5db perl module +DEPENDS+=+perlbase-cwd +perlbase-essential +endef + +define Package/perlbase-perl5db/install +$(call perlmod/Install,$(1),perl5db.pl,) +$(call perlmod/InstallBaseTests,$(1),lib/perl5db.t lib/perl5db/t) +endef + +$(eval $(call BuildPackage,perlbase-perl5db)) + + +define Package/perlbase-perlio +$(call Package/perlbase-template) +TITLE:=PerlIO perl module +DEPENDS+=+perlbase-essential +perlbase-mime +perlbase-xsloader +endef + +define Package/perlbase-perlio/install +$(call perlmod/Install,$(1),PerlIO PerlIO.pm auto/PerlIO,) +$(call perlmod/InstallBaseTests,$(1),cpan/PerlIO-via-QuotedPrint/t ext/PerlIO-encoding/t ext/PerlIO-scalar/t ext/PerlIO-via/t) +endef + +$(eval $(call BuildPackage,perlbase-perlio)) + + +define Package/perlbase-pod +$(call Package/perlbase-template) +TITLE:=Pod perl module +DEPENDS+=+perlbase-config +perlbase-cwd +perlbase-encode +perlbase-essential +perlbase-fcntl +perlbase-file +perlbase-getopt +perlbase-integer +perlbase-posix +perlbase-symbol +perlbase-term +perlbase-text +endef + +define Package/perlbase-pod/install +$(call perlmod/Install,$(1),Pod,Pod/Usage.pm) +$(call perlmod/Install/NoStrip,$(1),Pod/Usage.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/Pod-Checker/t cpan/Pod-Escapes/t cpan/Pod-Parser/lib cpan/Pod-Parser/scripts cpan/Pod-Parser/t cpan/Pod-Perldoc/t cpan/Pod-Simple/t cpan/Pod-Usage/scripts cpan/Pod-Usage/t cpan/podlators/t ext/Pod-Functions/Functions.pm ext/Pod-Functions/t ext/Pod-Html/t lib/Pod/t) + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/pod2man $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/pod2text $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,perlbase-pod)) + + +define Package/perlbase-posix +$(call Package/perlbase-template) +TITLE:=POSIX perl module +DEPENDS+=+perlbase-essential +perlbase-fcntl +perlbase-tie +perlbase-xsloader +endef + +define Package/perlbase-posix/install +$(call perlmod/Install,$(1),POSIX.pm auto/POSIX,) +$(call perlmod/InstallBaseTests,$(1),ext/POSIX/Makefile.PL ext/POSIX/POSIX.xs ext/POSIX/t) +endef + +$(eval $(call BuildPackage,perlbase-posix)) + + +define Package/perlbase-re +$(call Package/perlbase-template) +TITLE:=re perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-re/install +$(call perlmod/Install,$(1),auto/re re.pm,) +$(call perlmod/InstallBaseTests,$(1),ext/re/t) +endef + +$(eval $(call BuildPackage,perlbase-re)) + + +define Package/perlbase-safe +$(call Package/perlbase-template) +TITLE:=Safe perl module +DEPENDS+=+perlbase-b +perlbase-essential +perlbase-opcode +perlbase-scalar +perlbase-utf8 +endef + +define Package/perlbase-safe/install +$(call perlmod/Install,$(1),Safe.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/Safe/t) +endef + +$(eval $(call BuildPackage,perlbase-safe)) + + +define Package/perlbase-scalar +$(call Package/perlbase-template) +TITLE:=Scalar perl module +DEPENDS+=+perlbase-essential +perlbase-list +endef + +define Package/perlbase-scalar/install +$(call perlmod/Install,$(1),Scalar Sub,) +$(call perlmod/InstallBaseTests,$(1),cpan/Scalar-List-Utils/t) + $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/cpan/Scalar-List-Utils/blib +endef + +$(eval $(call BuildPackage,perlbase-scalar)) + + +define Package/perlbase-sdbm-file +$(call Package/perlbase-template) +TITLE:=SDBM_File perl module +DEPENDS+=+perlbase-essential +perlbase-tie +perlbase-xsloader +endef + +define Package/perlbase-sdbm-file/install +$(call perlmod/Install,$(1),SDBM_File.pm auto/SDBM_File,) +$(call perlmod/InstallBaseTests,$(1),ext/SDBM_File/t) +endef + +$(eval $(call BuildPackage,perlbase-sdbm-file)) + + +define Package/perlbase-search +$(call Package/perlbase-template) +TITLE:=Search perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-search/install +$(call perlmod/Install,$(1),Search,) +$(call perlmod/InstallBaseTests,$(1),dist/Search-Dict/t) +endef + +$(eval $(call BuildPackage,perlbase-search)) + + +define Package/perlbase-selectsaver +$(call Package/perlbase-template) +TITLE:=SelectSaver perl module +DEPENDS+=+perlbase-essential +perlbase-symbol +endef + +define Package/perlbase-selectsaver/install +$(call perlmod/Install,$(1),SelectSaver.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/SelectSaver.t) +endef + +$(eval $(call BuildPackage,perlbase-selectsaver)) + + +define Package/perlbase-selfloader +$(call Package/perlbase-template) +TITLE:=SelfLoader perl module +DEPENDS+=+perlbase-essential +perlbase-io +endef + +define Package/perlbase-selfloader/install +$(call perlmod/Install,$(1),SelfLoader.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/SelfLoader/t) +endef + +$(eval $(call BuildPackage,perlbase-selfloader)) + + +define Package/perlbase-sigtrap +$(call Package/perlbase-template) +TITLE:=sigtrap perl module +DEPENDS+=+perlbase-essential +perlbase-meta-notation +endef + +define Package/perlbase-sigtrap/install +$(call perlmod/Install,$(1),sigtrap.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/sigtrap.t) +endef + +$(eval $(call BuildPackage,perlbase-sigtrap)) + + +define Package/perlbase-socket +$(call Package/perlbase-template) +TITLE:=Socket perl module +DEPENDS+=+perlbase-essential +perlbase-xsloader +endef + +define Package/perlbase-socket/install +$(call perlmod/Install,$(1),Socket.pm auto/Socket,) +$(call perlmod/InstallBaseTests,$(1),cpan/Socket/t) +endef + +$(eval $(call BuildPackage,perlbase-socket)) + + +define Package/perlbase-sort +$(call Package/perlbase-template) +TITLE:=sort perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-sort/install +$(call perlmod/Install,$(1),sort.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/sort.t) +endef + +$(eval $(call BuildPackage,perlbase-sort)) + + +define Package/perlbase-storable +$(call Package/perlbase-template) +TITLE:=Storable perl module +DEPENDS+=+perlbase-essential +perlbase-xsloader +endef + +define Package/perlbase-storable/install +$(call perlmod/Install,$(1),Storable.pm auto/Storable,) +$(call perlmod/InstallBaseTests,$(1),dist/Storable/t) +endef + +$(eval $(call BuildPackage,perlbase-storable)) + + +define Package/perlbase-symbol +$(call Package/perlbase-template) +TITLE:=Symbol perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-symbol/install +$(call perlmod/Install,$(1),Symbol.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/Symbol.t) +endef + +$(eval $(call BuildPackage,perlbase-symbol)) + + +define Package/perlbase-sys +$(call Package/perlbase-template) +TITLE:=Sys perl module +DEPENDS+=+perlbase-essential +perlbase-file +perlbase-posix +perlbase-socket +endef + +define Package/perlbase-sys/install +$(call perlmod/Install,$(1),Sys auto/Sys,) +$(call perlmod/InstallBaseTests,$(1),cpan/Sys-Syslog/t ext/Sys-Hostname/t) +endef + +$(eval $(call BuildPackage,perlbase-sys)) + + +define Package/perlbase-tap +$(call Package/perlbase-template) +TITLE:=TAP perl module +DEPENDS+=+perlbase-base +perlbase-benchmark +perlbase-config +perlbase-essential +perlbase-file +perlbase-io +perlbase-posix +perlbase-text +endef + +define Package/perlbase-tap/install +$(call perlmod/Install,$(1),TAP,) +endef + +$(eval $(call BuildPackage,perlbase-tap)) + + +define Package/perlbase-term +$(call Package/perlbase-template) +TITLE:=Term perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-term/install +$(call perlmod/Install,$(1),Term,) +$(call perlmod/InstallBaseTests,$(1),cpan/Term-ANSIColor/t cpan/Term-Cap/test.pl dist/Term-Complete/t dist/Term-ReadLine/t) +endef + +$(eval $(call BuildPackage,perlbase-term)) + + +define Package/perlbase-test +$(call Package/perlbase-template) +TITLE:=Test perl module +DEPENDS+=+perlbase-base +perlbase-config +perlbase-essential +perlbase-io +perlbase-symbol +perlbase-tap +perlbase-text +endef + +define Package/perlbase-test/install +$(call perlmod/Install,$(1),Test Test.pm ok.pm,Test/Builder.pm Test/Harness/TAP.pod Test/More.pm Test/Tutorial.pod) +$(call perlmod/Install/NoStrip,$(1),Test/Builder.pm Test/More.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/Test-Harness/t cpan/Test-Simple/t cpan/Test/t) + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/prove $(1)/usr/bin +endef + +$(eval $(call BuildPackage,perlbase-test)) + + +define Package/perlbase-text +$(call Package/perlbase-template) +TITLE:=Text perl module +DEPENDS+=+perlbase-essential +perlbase-selfloader +endef + +define Package/perlbase-text/install +$(call perlmod/Install,$(1),Text,) +$(call perlmod/InstallBaseTests,$(1),cpan/Text-Balanced/t cpan/Text-ParseWords/t cpan/Text-Tabs/t dist/Text-Abbrev/t) +endef + +$(eval $(call BuildPackage,perlbase-text)) + + +define Package/perlbase-thread +$(call Package/perlbase-template) +TITLE:=Thread perl module +DEPENDS+=+perlbase-essential +perlbase-scalar +perlbase-threads +endef + +define Package/perlbase-thread/install +$(call perlmod/Install,$(1),Thread Thread.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/Thread-Queue/t dist/Thread-Semaphore/t lib/Thread.t) +endef + +$(eval $(call BuildPackage,perlbase-thread)) + + +define Package/perlbase-threads +$(call Package/perlbase-template) +TITLE:=threads perl module +DEPENDS+=+perlbase-config +perlbase-essential +perlbase-scalar +perlbase-xsloader +endef + +define Package/perlbase-threads/install +$(call perlmod/Install,$(1),auto/threads threads threads.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/threads-shared/t dist/threads/t) +endef + +$(eval $(call BuildPackage,perlbase-threads)) + + +define Package/perlbase-tie +$(call Package/perlbase-template) +TITLE:=Tie perl module +DEPENDS+=+perlbase-essential +perlbase-fcntl +perlbase-xsloader +endef + +define Package/perlbase-tie/install +$(call perlmod/Install,$(1),Tie auto/Tie,) +$(call perlmod/InstallBaseTests,$(1),cpan/Tie-RefHash/t dist/Tie-File/t ext/Tie-Hash-NamedCapture/t ext/Tie-Memoize/lib/Tie/Memoize.pm ext/Tie-Memoize/t lib/Tie/Array/push.t lib/Tie/Array/splice.t lib/Tie/Array/std.t lib/Tie/Array/stdpush.t lib/Tie/ExtraHash.t lib/Tie/Handle/stdhandle.t lib/Tie/Handle/stdhandle_from_handle.t lib/Tie/Hash.t lib/Tie/Scalar.t lib/Tie/SubstrHash.t) +endef + +$(eval $(call BuildPackage,perlbase-tie)) + + +define Package/perlbase-time +$(call Package/perlbase-template) +TITLE:=Time perl module +DEPENDS+=+perlbase-class +perlbase-config +perlbase-dynaloader +perlbase-essential +endef + +define Package/perlbase-time/install +$(call perlmod/Install,$(1),Time auto/Time,) +$(call perlmod/InstallBaseTests,$(1),cpan/Time-HiRes/t cpan/Time-Local/t cpan/Time-Piece/t lib/Time/gmtime.t lib/Time/localtime.t) +endef + +$(eval $(call BuildPackage,perlbase-time)) + + +define Package/perlbase-unicode +$(call Package/perlbase-template) +TITLE:=Unicode perl module +DEPENDS+=+perlbase-base +perlbase-charnames +perlbase-dynaloader +perlbase-essential +perlbase-file +endef + +define Package/perlbase-unicode/install +$(call perlmod/Install,$(1),Unicode auto/Unicode,) +$(call perlmod/InstallBaseTests,$(1),cpan/Unicode-Collate/t cpan/Unicode-Normalize/t lib/Unicode/UCD.t) +endef + +$(eval $(call BuildPackage,perlbase-unicode)) + + +define Package/perlbase-unicore +$(call Package/perlbase-template) +TITLE:=unicore perl module +endef + +define Package/perlbase-unicore/install +$(call perlmod/Install,$(1),unicore,) +$(call perlmod/InstallBaseTests,$(1),lib/unicore/NameAliases.txt lib/unicore/PropValueAliases.txt lib/unicore/PropertyAliases.txt lib/unicore/UnicodeData.txt) +endef + +$(eval $(call BuildPackage,perlbase-unicore)) + + +define Package/perlbase-universal +$(call Package/perlbase-template) +TITLE:=UNIVERSAL perl module +endef + +define Package/perlbase-universal/install +$(call perlmod/Install,$(1),UNIVERSAL.pm,) +endef + +$(eval $(call BuildPackage,perlbase-universal)) + + +define Package/perlbase-user +$(call Package/perlbase-template) +TITLE:=User perl module +DEPENDS+=+perlbase-class +perlbase-config +perlbase-essential +endef + +define Package/perlbase-user/install +$(call perlmod/Install,$(1),User,) +$(call perlmod/InstallBaseTests,$(1),lib/User/grent.t lib/User/pwent.t) +endef + +$(eval $(call BuildPackage,perlbase-user)) + + +define Package/perlbase-utf8 +$(call Package/perlbase-template) +TITLE:=utf8 perl module +DEPENDS+=+perlbase-essential +perlbase-re +perlbase-unicore +endef + +define Package/perlbase-utf8/install +$(call perlmod/Install,$(1),utf8.pm utf8_heavy.pl,) +$(call perlmod/InstallBaseTests,$(1),lib/utf8.t) +endef + +$(eval $(call BuildPackage,perlbase-utf8)) + + +define Package/perlbase-version +$(call Package/perlbase-template) +TITLE:=version perl module +DEPENDS+=+perlbase-config +perlbase-essential +endef + +define Package/perlbase-version/install +$(call perlmod/Install,$(1),version version.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/version/t) +endef + +$(eval $(call BuildPackage,perlbase-version)) + + +define Package/perlbase-xsloader +$(call Package/perlbase-template) +TITLE:=XSLoader perl module +endef + +define Package/perlbase-xsloader/install +$(call perlmod/Install,$(1),XSLoader.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/XSLoader/t ext/XS-APItest/t ext/XS-Typemap/t) +endef + +$(eval $(call BuildPackage,perlbase-xsloader)) + + +# Generated Fri Sep 25 07:47:59 2015 diff --git a/lang/perl/perlmod.mk b/lang/perl/perlmod.mk new file mode 100644 index 0000000..c64942f --- /dev/null +++ b/lang/perl/perlmod.mk @@ -0,0 +1,162 @@ +# This makefile simplifies perl module builds. +# + +PERL_VERSION:=5.22 + +# Build environment +HOST_PERL_PREFIX:=$(STAGING_DIR)/host/usr +ifneq ($(CONFIG_USE_GLIBC),) + EXTRA_LIBS:=bsd + EXTRA_LIBDIRS:=$(STAGING_DIR)/lib +endif +PERL_CMD:=$(STAGING_DIR)/host/usr/bin/perl$(PERL_VERSION).0 + +MOD_CFLAGS_PERL:=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) +ifdef CONFIG_PERL_THREADS + MOD_CFLAGS_PERL+= -D_REENTRANT -D_GNU_SOURCE +endif + +# Module install prefix +PERL_SITELIB:=/usr/lib/perl5/$(PERL_VERSION) +PERL_TESTSDIR:=/usr/share/perl/perl-tests +PERLBASE_TESTSDIR:=/usr/share/perl/perlbase-tests +PERLMOD_TESTSDIR:=/usr/share/perl/perlmod-tests + +define perlmod/host/relink + rm -f $(1)/Makefile.aperl + $(MAKE) -C $(1) perl + $(CP) $(1)/perl $(PERL_CMD) + $(CP) $(1)/perl $(STAGING_DIR)/host/usr/bin/perl +endef + +define perlmod/host/Configure + (cd $(HOST_BUILD_DIR); \ + PERL_MM_USE_DEFAULT=1 \ + $(2) \ + $(PERL_CMD) Makefile.PL \ + $(1) \ + ); +endef + +define perlmod/host/Compile + $(2) \ + $(MAKE) -C $(HOST_BUILD_DIR) \ + $(1) \ + install +endef + +define perlmod/host/Install + $(2) \ + $(MAKE) -C $(HOST_BUILD_DIR) \ + $(1) \ + install + $(call perlmod/host/relink,$(HOST_BUILD_DIR)) +endef + +define perlmod/Configure + (cd $(if $(3),$(3),$(PKG_BUILD_DIR)); \ + PERL_MM_USE_DEFAULT=1 \ + $(2) \ + $(PERL_CMD) -MConfig -e '$$$${tied %Config::Config}{cpprun}="$(GNU_TARGET_NAME)-cpp -E"; do "Makefile.PL"' \ + $(1) \ + AR=ar \ + CC=$(GNU_TARGET_NAME)-gcc \ + CCFLAGS="$(MOD_CFLAGS_PERL)" \ + CCCDLFLAGS=-fPIC \ + CCDLFLAGS=-Wl,-E \ + DLEXT=so \ + DLSRC=dl_dlopen.xs \ + EXE_EXT=" " \ + FULL_AR=$(GNU_TARGET_NAME)-ar \ + LD=$(GNU_TARGET_NAME)-gcc \ + LDDLFLAGS="-shared -rdynamic $(TARGET_LDFLAGS)" \ + LDFLAGS="$(EXTRA_LIBDIRS:%=-L%) $(EXTRA_LIBS:%=-l%) " \ + LIBC=" " \ + LIB_EXT=.a \ + OBJ_EXT=.o \ + OSNAME=linux \ + OSVERS=2.4.30 \ + RANLIB=: \ + SITELIBEXP=" " \ + SITEARCHEXP=" " \ + SO=so \ + VENDORARCHEXP=" " \ + VENDORLIBEXP=" " \ + SITEPREFIX=/usr \ + INSTALLPRIVLIB=$(PERL_SITELIB) \ + INSTALLSITELIB=$(PERL_SITELIB) \ + INSTALLVENDORLIB=" " \ + INSTALLARCHLIB=$(PERL_SITELIB) \ + INSTALLSITEARCH=$(PERL_SITELIB) \ + INSTALLVENDORARCH=" " \ + INSTALLBIN=/usr/bin \ + INSTALLSITEBIN=/usr/bin \ + INSTALLVENDORBIN=" " \ + INSTALLSCRIPT=/usr/bin \ + INSTALLSITESCRIPT=/usr/bin \ + INSTALLVENDORSCRIPT=" " \ + INSTALLMAN1DIR=/usr/man/man1 \ + INSTALLSITEMAN1DIR=/usr/man/man1 \ + INSTALLVENDORMAN1DIR=" " \ + INSTALLMAN3DIR=/usr/man/man3 \ + INSTALLSITEMAN3DIR=/usr/man/man3 \ + INSTALLVENDORMAN3DIR=" " \ + LINKTYPE=dynamic \ + DESTDIR=$(PKG_INSTALL_DIR) \ + ); + sed 's!^PERL_INC = .*!PERL_INC = $(STAGING_DIR)/usr/lib/perl5/$(PERL_VERSION)/CORE/!' -i $(if $(3),$(3),$(PKG_BUILD_DIR))/Makefile +endef + +define perlmod/Compile + PERL5LIB=$(PERL_LIB) \ + $(2) \ + $(MAKE) -C $(if $(3),$(3),$(PKG_BUILD_DIR)) \ + $(1) \ + install +endef + +define perlmod/Install/NoStrip + $(INSTALL_DIR) $(strip $(1))$(PERL_SITELIB) + (cd $(PKG_INSTALL_DIR)$(PERL_SITELIB) && \ + rsync --relative -rlHp --itemize-changes \ + --exclude=\*.pod \ + --exclude=.packlist \ + $(addprefix --exclude=/,$(strip $(3))) \ + --prune-empty-dirs \ + $(strip $(2)) $(strip $(1))$(PERL_SITELIB)) + + chmod -R u+w $(strip $(1))$(PERL_SITELIB) +endef + + +define perlmod/Install + $(call perlmod/Install/NoStrip,$(1),$(2),$(3)) + + @echo "---> Stripping modules in: $(strip $(1))$(PERL_SITELIB)" + find $(strip $(1))$(PERL_SITELIB) -name \*.pm -or -name \*.pl | \ + xargs -r sed -i \ + -e '/^=\(head\|pod\|item\|over\|back\|encoding\|begin\|end\|for\)/,/^=cut/d' \ + -e '/^=\(head\|pod\|item\|over\|back\|encoding\|begin\|end\|for\)/,$$$$d' \ + -e '/^#$$$$/d' \ + -e '/^#[^!"'"'"']/d' +endef + +# You probably don't want to use this directly. Look at perlmod/InstallTests +define perlmod/_InstallTests + $(INSTALL_DIR) $(strip $(1)) + (cd $(PKG_BUILD_DIR)/$(2) && \ + rsync --relative -rlHp --itemize-changes \ + --exclude=.packlist \ + --prune-empty-dirs \ + $(strip $(3)) $(strip $(1))) + + chmod -R u+w $(strip $(1)) +endef + +define perlmod/InstallBaseTests + $(if $(CONFIG_PERL_TESTS),$(call perlmod/_InstallTests,$(1)$(PERL_TESTSDIR),,$(2))) +endef + +define perlmod/InstallTests + $(if $(CONFIG_PERL_TESTS),$(call perlmod/_InstallTests,$(1)$(PERL_TESTSDIR),$(2),$(3))) +endef diff --git a/lang/php7-pecl-dio/Makefile b/lang/php7-pecl-dio/Makefile new file mode 100644 index 0000000..bcf32a1 --- /dev/null +++ b/lang/php7-pecl-dio/Makefile @@ -0,0 +1,34 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PECL_NAME:=dio +PECL_LONGNAME:=Direct I/O functions + +PKG_VERSION:=0.0.7 +PKG_RELEASE:=2 +PKG_MD5SUM:=a1a4df428a17dbe1ab4277b492dfa052 + +PKG_NAME:=php7-pecl-$(PECL_NAME) +PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://pecl.php.net/get/ + +PKG_BUILD_DIR:=$(BUILD_DIR)/pecl-php7/$(PECL_NAME)-$(PKG_VERSION) +PKG_BUILD_PARALLEL:=1 + +PKG_MAINTAINER:=Michael Heimpold + +PKG_LICENSE:=PHPv3.01 +PKG_LICENSE_FILES:= + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk +include ../php7/pecl.mk + +$(eval $(call PECLPackage,$(PECL_NAME),$(PECL_LONGNAME))) +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/lang/php7-pecl-dio/patches/0000-unify-line-endings.patch b/lang/php7-pecl-dio/patches/0000-unify-line-endings.patch new file mode 100644 index 0000000..b6c2750 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0000-unify-line-endings.patch @@ -0,0 +1,3110 @@ +--- a/dio_posix.c ++++ b/dio_posix.c +@@ -1,659 +1,659 @@ +-/* +- +----------------------------------------------------------------------+ +- | PHP Version 5 | +- +----------------------------------------------------------------------+ +- | Copyright (c) 2009 Melanie Rhianna Lewis | +- +----------------------------------------------------------------------+ +- | This source file is subject to version 3.0 of the PHP license, | +- | that is bundled with this package in the file LICENSE, and is | +- | available through the world-wide-web at the following url: | +- | http://www.php.net/license/3_0.txt. | +- | If you did not receive a copy of the PHP license and are unable to | +- | obtain it through the world-wide-web, please send a note to | +- | license@php.net so we can mail you a copy immediately. | +- +----------------------------------------------------------------------+ +- | Author: Melanie Rhianna Lewis | +- +----------------------------------------------------------------------+ +- */ +- +-#ifdef HAVE_CONFIG_H +-#include "config.h" +-#endif +- +-#include "php.h" +- +-#include "php_dio_common.h" +- +-/* {{{ dio_stream_mode_to_flags +- * Convert an fopen() mode string to open() flags +- */ +-static int dio_stream_mode_to_flags(const char *mode) { +- int flags = 0, ch = 0, bin = 1; +- +- switch(mode[ch++]) { +- case 'r': +- flags = 0; +- break; +- case 'w': +- flags = O_TRUNC | O_CREAT; +- break; +- case 'a': +- flags = O_APPEND | O_CREAT; +- break; +- case 'x': +- flags = O_EXCL | O_CREAT; +- break; +- } +- +- if (mode[ch] != '+') { +- bin = (mode[ch++] == 'b'); +- } +- +- if (mode[ch] == '+') { +- flags |= O_RDWR; +- } else if (flags) { +- flags |= O_WRONLY; +- } else { +- flags |= O_RDONLY; +- } +- +-#if defined(_O_TEXT) && defined(O_BINARY) +- if (bin) { +- flags |= O_BINARY; +- } else { +- flags |= _O_TEXT; +- } +-#endif +- +- return flags; +-} +-/* }}} */ +- +-/* {{{ dio_data_rate_to_define +- * Converts a numeric data rate to a termios define +- */ +-static int dio_data_rate_to_define(long rate, speed_t *def) { +- speed_t val; +- +- switch (rate) { +- case 0: +- val = 0; +- break; +- case 50: +- val = B50; +- break; +- case 75: +- val = B75; +- break; +- case 110: +- val = B110; +- break; +- case 134: +- val = B134; +- break; +- case 150: +- val = B150; +- break; +- case 200: +- val = B200; +- break; +- case 300: +- val = B300; +- break; +- case 600: +- val = B600; +- break; +- case 1200: +- val = B1200; +- break; +- case 1800: +- val = B1800; +- break; +- case 2400: +- val = B2400; +- break; +- case 4800: +- val = B4800; +- break; +- case 9600: +- val = B9600; +- break; +- case 19200: +- val = B19200; +- break; +- case 38400: +- val = B38400; +- break; +-#ifdef B57600 +- case 57600: +- val = B57600; +- break; +-#endif +-#ifdef B115200 +- case 115200: +- val = B115200; +- break; +-#endif +-#ifdef B230400 +- case 230400: +- val = B230400; +- break; +-#endif +-#ifdef B460800 +- case 460800: +- val = B460800; +- break; +-#endif +- default: +- return 0; +- } +- +- *def = val; +- return 1; +-} +- +-/* {{{ dio_data_bits_to_define +- * Converts a number of data bits to a termios define +- */ +-static int dio_data_bits_to_define(int data_bits, int *def) { +- int val; +- +- switch (data_bits) { +- case 8: +- val = CS8; +- break; +- case 7: +- val = CS7; +- break; +- case 6: +- val = CS6; +- break; +- case 5: +- val = CS5; +- break; +- default: +- return 0; +- } +- +- *def = val; +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_stop_bits_to_define +- * Converts a number of stop bits to a termios define +- */ +-static int dio_stop_bits_to_define(int stop_bits, int *def) { +- int val; +- +- switch (stop_bits) { +- case 1: +- val = 0; +- break; +- case 2: +- val = CSTOPB; +- break; +- default: +- return 0; +- } +- +- *def = val; +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_parity_to_define +- * Converts a parity type to a termios define +- */ +-static int dio_parity_to_define(int parity, int *def) { +- int val; +- +- switch (parity) { +- case 0: +- val = 0; +- break; +- case 1: +- val = PARENB | PARODD; +- break; +- case 2: +- val = PARENB; +- break; +- default: +- return 0; +- } +- +- *def = val; +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_create_stream_data +- * Creates an initialised stream data structure. Free with efree(). +- */ +-php_dio_stream_data * dio_create_stream_data(void) { +- php_dio_posix_stream_data * data = emalloc(sizeof(php_dio_posix_stream_data)); +- dio_init_stream_data(&(data->common)); +- data->fd = -1; +- data->flags = 0; +- +- return (php_dio_stream_data *)data; +-} +-/* }}} */ +- +-/* {{{ dio_common_write +- * Writes count chars from the buffer to the stream described by the stream data. +- */ +-size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count) { +- size_t ret; +- +- /* Blocking writes can be interrupted by signals etc. If +- * interrupted try again. Not sure about non-blocking +- * writes but it doesn't hurt to check. */ +- do { +- ret = write(((php_dio_posix_stream_data*)data)->fd, buf, count); +- if (ret > 0) { +- return ret; +- } +- } while (errno == EINTR); +- return 0; +-} +-/* }}} */ +- +-#ifdef DIO_NONBLOCK +-/* {{{ dio_timeval_subtract +- * Calculates the difference between two timevals returning the result in the +- * structure pointed to by diffptr. Returns -1 as error if late time is +- * earlier than early time. +- */ +-static int dio_timeval_subtract(struct timeval *late, struct timeval *early, struct timeval *diff) { +- struct timeval *tmp; +- +- /* Handle negatives */ +- if (late->tv_sec < early->tv_sec) { +- return 0; +- } +- +- if ((late->tv_sec == early->tv_sec) && (late->tv_usec < early->tv_usec)) { +- return 0; +- } +- +- /* Handle any carry. If later usec is smaller than earlier usec simple +- * subtraction will result in negative value. Since usec has a maximum +- * of one second by adding another second before the subtraction the +- * result will always be positive. */ +- if (late->tv_usec < early->tv_usec) { +- late->tv_usec += 1000000; +- late->tv_sec--; +- } +- +- /* Once adjusted can just subtract values. */ +- diff->tv_sec = late->tv_sec - early->tv_sec; +- diff->tv_usec = late->tv_usec - early->tv_usec; +- +- return 1; +-} +-#endif +- +-/* {{{ dio_common_read +- * Reads count chars to the buffer to the stream described by the stream data. +- */ +-size_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count) { +- int fd = ((php_dio_posix_stream_data*)data)->fd; +- size_t ret, total = 0; +- char *ptr = (char*)buf; +- +- struct timeval timeout, timeouttmp, before, after, diff; +- fd_set rfds; +- +- if (!data->has_timeout) { +- /* Blocking reads can be interrupted by signals etc. If +- * interrupted try again. Not sure about non-blocking +- * reads but it doesn't hurt to check. */ +- do { +- ret = read(fd, (char*)ptr, count); +- if (ret > 0) { +- return ret; +- } else if (!ret) { +- data->end_of_file = 1; +- } +- } while ((errno == EINTR) && !data->end_of_file); +- return 0; +- } +-#ifdef DIO_NONBLOCK +- else { +- /* Clear timed out flag */ +- data->timed_out = 0; +- +- /* The initial timeout value */ +- timeout.tv_sec = data->timeout_sec; +- timeout.tv_usec = data->timeout_usec; +- +- do { +- /* The semantics of select() are that you cannot guarantee +- * that the timeval structure passed in has not been changed by +- * the select call. So you keep a copy. */ +- timeouttmp = timeout; +- +- /* The time before we wait for data. */ +- (void) gettimeofday(&before, NULL); +- +- /* Wait for an event on our file descriptor. */ +- FD_ZERO(&rfds); +- FD_SET(fd, &rfds); +- +- ret = select(fd + 1, &rfds, NULL, NULL, &timeouttmp); +- /* An error. */ +- if ((ret < 0) && (errno != EINTR) && (errno != EAGAIN)) { +- return 0; +- } +- +- /* We have data to read. */ +- if ((ret > 0) && FD_ISSET(fd, &rfds)) { +- ret = read(fd, ptr, count); +- /* Another error */ +- if ((ret < 0) && (errno != EINTR) && (errno != EAGAIN)) { +- return 0; +- } +- +- if (ret > 0) { +- /* Got data, add it to the buffer. */ +- ptr += ret; +- total += ret; +- count -= ret; +- } else if (!ret) { +- /* This should never happen since how can we have +- * data to read at an end of file, but still +- * just in case! */ +- data->end_of_file = 1; +- break; +- } +- } +- +- /* If not timed out and not end of file and not all data read +- * calculate how long it took us and loop if we still have time +- * out time left. */ +- if (count) { +- (void) gettimeofday(&after, NULL); +- +- /* Diff the timevals */ +- (void) dio_timeval_subtract(&after, &before, &diff); +- +- /* Now adjust the timeout. */ +- if (!dio_timeval_subtract(&timeout, &diff, &timeout)) { +- /* If it errors we've run out of time. */ +- data->timed_out = 1; +- break; +- } else if (!timeout.tv_sec && !(timeout.tv_usec / 1000)) { +- /* Check for rounding issues (millisecond accuracy) */ +- data->timed_out = 1; +- break; +- } +- } +- } while (count); /* Until time out or end of file or all data read. */ +- +- return total; +- } +-#endif +-} +-/* }}} */ +- +-/* {{{ php_dio_stream_data +- * Closes the php_stream. +- */ +-int dio_common_close(php_dio_stream_data *data) { +- if (close(((php_dio_posix_stream_data*)data)->fd) < 0) { +- return 0; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_common_set_option +- * Sets/gets stream options +- */ +-int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam) { +- int fd = ((php_dio_posix_stream_data*)data)->fd; +- int old_is_blocking; +- int flags; +- +- switch (option) { +-#ifdef DIO_NONBLOCK +- case PHP_STREAM_OPTION_READ_TIMEOUT: +- if (ptrparam) { +- struct timeval *tv = (struct timeval*)ptrparam; +- +- flags = fcntl(fd, F_GETFL, 0); +- +- /* A timeout of zero seconds and zero microseconds disables +- any existing timeout. */ +- if (tv->tv_sec || tv->tv_usec) { +- data->timeout_sec = tv->tv_sec; +- data->timeout_usec = tv->tv_usec; +- data->has_timeout = -1; +- (void) fcntl(fd, F_SETFL, flags & ~DIO_NONBLOCK); +- } else { +- data->timeout_sec = 0; +- data->timeout_usec = 0; +- data->has_timeout = 0; +- data->timed_out = 0; +- (void) fcntl(fd, F_SETFL, flags | DIO_NONBLOCK); +- } +- +- return PHP_STREAM_OPTION_RETURN_OK; +- } else { +- return PHP_STREAM_OPTION_RETURN_ERR; +- } +- +- case PHP_STREAM_OPTION_BLOCKING: +- flags = fcntl(fd, F_GETFL, 0); +- if (value) { +- flags &= ~DIO_NONBLOCK; +- } else { +- flags |= DIO_NONBLOCK; +- } +- (void) fcntl(fd, F_SETFL, flags); +- +- old_is_blocking = data->is_blocking; +- data->is_blocking = value; +- return old_is_blocking ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR; +-#endif /* O_NONBLOCK */ +- +- default: +- break; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_raw_open_stream +- * Opens the underlying stream. +- */ +-int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { +- php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; +- pdata->flags = dio_stream_mode_to_flags(mode); +- +-#ifdef DIO_NONBLOCK +- if (!data->is_blocking || data->has_timeout) { +- pdata->flags |= DIO_NONBLOCK; +- } +-#endif +- +- /* Open the file and handle any errors. */ +-#ifdef DIO_HAS_FILEPERMS +- if (data->has_perms) { +- pdata->fd = open(filename, pdata->flags, (mode_t)data->perms); +- } else { +- pdata->fd = open(filename, pdata->flags); +- } +-#else +- pdata->fd = open(filename, pdata->flags); +-#endif +- +- if (pdata->fd < 0) { +- switch (errno) { +- case EEXIST: +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!"); +- return 0; +- default: +- return 0; +- } +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_serial_init +- * Initialises the serial settings storing the original settings before hand. +- */ +-static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) { +- php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; +- int ret = 0, data_bits_def, stop_bits_def, parity_def; +- struct termios tio; +- speed_t rate_def; +- +- if (!dio_data_rate_to_define(data->data_rate, &rate_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%ld)", data->data_rate); +- return 0; +- } +- +- if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits); +- return 0; +- } +- +- if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits); +- return 0; +- } +- +- if (!dio_parity_to_define(data->parity, &parity_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity); +- return 0; +- } +- +- ret = tcgetattr(pdata->fd, &(pdata->oldtio)); +- if (ret < 0) { +- if ((errno == ENOTTY) || (errno == ENODEV)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a serial port or terminal!"); +- } +- return 0; +- } +- +- ret = tcgetattr(pdata->fd, &tio); +- if (ret < 0) { +- return 0; +- } +- +- if (data->canonical) { +- tio.c_iflag = IGNPAR | ICRNL; +- tio.c_oflag = 0; +- tio.c_lflag = ICANON; +- } else { +- cfmakeraw(&tio); +- } +- +- cfsetispeed(&tio, rate_def); +- cfsetospeed(&tio, rate_def); +- +- tio.c_cflag &= ~CSIZE; +- tio.c_cflag |= data_bits_def; +- tio.c_cflag &= ~CSTOPB; +- tio.c_cflag |= stop_bits_def; +- tio.c_cflag &= ~(PARENB|PARODD); +- tio.c_cflag |= parity_def; +- +-#ifdef CRTSCTS +- tio.c_cflag &= ~(CLOCAL | CRTSCTS); +-#else +- tio.c_cflag &= ~CLOCAL; +-#endif +- if (!data->flow_control) { +- tio.c_cflag |= CLOCAL; +-#ifdef CRTSCTS +- } else { +- tio.c_cflag |= CRTSCTS; +-#endif +- } +- +- ret = tcsetattr(pdata->fd, TCSANOW, &tio); +- if (ret < 0) { +- return 0; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_serial_uninit +- * Restores the serial settings back to their original state. +- */ +-int dio_serial_uninit(php_dio_stream_data *data) { +- php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; +- int ret; +- +- do { +- ret = tcsetattr(pdata->fd, TCSANOW, &(pdata->oldtio)); +- } while ((ret < 0) && (errno == EINTR)); +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_serial_flush +- * Purges the serial buffers of data. +- */ +-int dio_serial_purge(php_dio_stream_data *data) { +- php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; +- int ret; +- +- if ((pdata->flags & O_RDWR) == O_RDWR) { +- ret = tcflush(pdata->fd, TCIOFLUSH); +- } else if ((pdata->flags & O_WRONLY) == O_WRONLY) { +- ret = tcflush(pdata->fd, TCOFLUSH); +- } else if ((pdata->flags & O_RDONLY) == O_RDONLY) { +- ret = tcflush(pdata->fd, TCIFLUSH); +- } +- +- if (ret < 0) { +- return 0; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_serial_open_stream +- * Opens the underlying stream. +- */ +-int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { +- php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; +- +-#ifdef O_NOCTTY +- /* We don't want a controlling TTY */ +- pdata->flags |= O_NOCTTY; +-#endif +- +- if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) { +- return 0; +- } +- +- if (!dio_serial_init(data TSRMLS_CC)) { +- close(pdata->fd); +- return 0; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* +- * Local variables: +- * c-basic-offset: 4 +- * tab-width: 4 +- * End: +- * vim600: fdm=marker +- * vim: sw=4 ts=4 noet +- */ ++/* ++ +----------------------------------------------------------------------+ ++ | PHP Version 5 | ++ +----------------------------------------------------------------------+ ++ | Copyright (c) 2009 Melanie Rhianna Lewis | ++ +----------------------------------------------------------------------+ ++ | This source file is subject to version 3.0 of the PHP license, | ++ | that is bundled with this package in the file LICENSE, and is | ++ | available through the world-wide-web at the following url: | ++ | http://www.php.net/license/3_0.txt. | ++ | If you did not receive a copy of the PHP license and are unable to | ++ | obtain it through the world-wide-web, please send a note to | ++ | license@php.net so we can mail you a copy immediately. | ++ +----------------------------------------------------------------------+ ++ | Author: Melanie Rhianna Lewis | ++ +----------------------------------------------------------------------+ ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include "php.h" ++ ++#include "php_dio_common.h" ++ ++/* {{{ dio_stream_mode_to_flags ++ * Convert an fopen() mode string to open() flags ++ */ ++static int dio_stream_mode_to_flags(const char *mode) { ++ int flags = 0, ch = 0, bin = 1; ++ ++ switch(mode[ch++]) { ++ case 'r': ++ flags = 0; ++ break; ++ case 'w': ++ flags = O_TRUNC | O_CREAT; ++ break; ++ case 'a': ++ flags = O_APPEND | O_CREAT; ++ break; ++ case 'x': ++ flags = O_EXCL | O_CREAT; ++ break; ++ } ++ ++ if (mode[ch] != '+') { ++ bin = (mode[ch++] == 'b'); ++ } ++ ++ if (mode[ch] == '+') { ++ flags |= O_RDWR; ++ } else if (flags) { ++ flags |= O_WRONLY; ++ } else { ++ flags |= O_RDONLY; ++ } ++ ++#if defined(_O_TEXT) && defined(O_BINARY) ++ if (bin) { ++ flags |= O_BINARY; ++ } else { ++ flags |= _O_TEXT; ++ } ++#endif ++ ++ return flags; ++} ++/* }}} */ ++ ++/* {{{ dio_data_rate_to_define ++ * Converts a numeric data rate to a termios define ++ */ ++static int dio_data_rate_to_define(long rate, speed_t *def) { ++ speed_t val; ++ ++ switch (rate) { ++ case 0: ++ val = 0; ++ break; ++ case 50: ++ val = B50; ++ break; ++ case 75: ++ val = B75; ++ break; ++ case 110: ++ val = B110; ++ break; ++ case 134: ++ val = B134; ++ break; ++ case 150: ++ val = B150; ++ break; ++ case 200: ++ val = B200; ++ break; ++ case 300: ++ val = B300; ++ break; ++ case 600: ++ val = B600; ++ break; ++ case 1200: ++ val = B1200; ++ break; ++ case 1800: ++ val = B1800; ++ break; ++ case 2400: ++ val = B2400; ++ break; ++ case 4800: ++ val = B4800; ++ break; ++ case 9600: ++ val = B9600; ++ break; ++ case 19200: ++ val = B19200; ++ break; ++ case 38400: ++ val = B38400; ++ break; ++#ifdef B57600 ++ case 57600: ++ val = B57600; ++ break; ++#endif ++#ifdef B115200 ++ case 115200: ++ val = B115200; ++ break; ++#endif ++#ifdef B230400 ++ case 230400: ++ val = B230400; ++ break; ++#endif ++#ifdef B460800 ++ case 460800: ++ val = B460800; ++ break; ++#endif ++ default: ++ return 0; ++ } ++ ++ *def = val; ++ return 1; ++} ++ ++/* {{{ dio_data_bits_to_define ++ * Converts a number of data bits to a termios define ++ */ ++static int dio_data_bits_to_define(int data_bits, int *def) { ++ int val; ++ ++ switch (data_bits) { ++ case 8: ++ val = CS8; ++ break; ++ case 7: ++ val = CS7; ++ break; ++ case 6: ++ val = CS6; ++ break; ++ case 5: ++ val = CS5; ++ break; ++ default: ++ return 0; ++ } ++ ++ *def = val; ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_stop_bits_to_define ++ * Converts a number of stop bits to a termios define ++ */ ++static int dio_stop_bits_to_define(int stop_bits, int *def) { ++ int val; ++ ++ switch (stop_bits) { ++ case 1: ++ val = 0; ++ break; ++ case 2: ++ val = CSTOPB; ++ break; ++ default: ++ return 0; ++ } ++ ++ *def = val; ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_parity_to_define ++ * Converts a parity type to a termios define ++ */ ++static int dio_parity_to_define(int parity, int *def) { ++ int val; ++ ++ switch (parity) { ++ case 0: ++ val = 0; ++ break; ++ case 1: ++ val = PARENB | PARODD; ++ break; ++ case 2: ++ val = PARENB; ++ break; ++ default: ++ return 0; ++ } ++ ++ *def = val; ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_create_stream_data ++ * Creates an initialised stream data structure. Free with efree(). ++ */ ++php_dio_stream_data * dio_create_stream_data(void) { ++ php_dio_posix_stream_data * data = emalloc(sizeof(php_dio_posix_stream_data)); ++ dio_init_stream_data(&(data->common)); ++ data->fd = -1; ++ data->flags = 0; ++ ++ return (php_dio_stream_data *)data; ++} ++/* }}} */ ++ ++/* {{{ dio_common_write ++ * Writes count chars from the buffer to the stream described by the stream data. ++ */ ++size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count) { ++ size_t ret; ++ ++ /* Blocking writes can be interrupted by signals etc. If ++ * interrupted try again. Not sure about non-blocking ++ * writes but it doesn't hurt to check. */ ++ do { ++ ret = write(((php_dio_posix_stream_data*)data)->fd, buf, count); ++ if (ret > 0) { ++ return ret; ++ } ++ } while (errno == EINTR); ++ return 0; ++} ++/* }}} */ ++ ++#ifdef DIO_NONBLOCK ++/* {{{ dio_timeval_subtract ++ * Calculates the difference between two timevals returning the result in the ++ * structure pointed to by diffptr. Returns -1 as error if late time is ++ * earlier than early time. ++ */ ++static int dio_timeval_subtract(struct timeval *late, struct timeval *early, struct timeval *diff) { ++ struct timeval *tmp; ++ ++ /* Handle negatives */ ++ if (late->tv_sec < early->tv_sec) { ++ return 0; ++ } ++ ++ if ((late->tv_sec == early->tv_sec) && (late->tv_usec < early->tv_usec)) { ++ return 0; ++ } ++ ++ /* Handle any carry. If later usec is smaller than earlier usec simple ++ * subtraction will result in negative value. Since usec has a maximum ++ * of one second by adding another second before the subtraction the ++ * result will always be positive. */ ++ if (late->tv_usec < early->tv_usec) { ++ late->tv_usec += 1000000; ++ late->tv_sec--; ++ } ++ ++ /* Once adjusted can just subtract values. */ ++ diff->tv_sec = late->tv_sec - early->tv_sec; ++ diff->tv_usec = late->tv_usec - early->tv_usec; ++ ++ return 1; ++} ++#endif ++ ++/* {{{ dio_common_read ++ * Reads count chars to the buffer to the stream described by the stream data. ++ */ ++size_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count) { ++ int fd = ((php_dio_posix_stream_data*)data)->fd; ++ size_t ret, total = 0; ++ char *ptr = (char*)buf; ++ ++ struct timeval timeout, timeouttmp, before, after, diff; ++ fd_set rfds; ++ ++ if (!data->has_timeout) { ++ /* Blocking reads can be interrupted by signals etc. If ++ * interrupted try again. Not sure about non-blocking ++ * reads but it doesn't hurt to check. */ ++ do { ++ ret = read(fd, (char*)ptr, count); ++ if (ret > 0) { ++ return ret; ++ } else if (!ret) { ++ data->end_of_file = 1; ++ } ++ } while ((errno == EINTR) && !data->end_of_file); ++ return 0; ++ } ++#ifdef DIO_NONBLOCK ++ else { ++ /* Clear timed out flag */ ++ data->timed_out = 0; ++ ++ /* The initial timeout value */ ++ timeout.tv_sec = data->timeout_sec; ++ timeout.tv_usec = data->timeout_usec; ++ ++ do { ++ /* The semantics of select() are that you cannot guarantee ++ * that the timeval structure passed in has not been changed by ++ * the select call. So you keep a copy. */ ++ timeouttmp = timeout; ++ ++ /* The time before we wait for data. */ ++ (void) gettimeofday(&before, NULL); ++ ++ /* Wait for an event on our file descriptor. */ ++ FD_ZERO(&rfds); ++ FD_SET(fd, &rfds); ++ ++ ret = select(fd + 1, &rfds, NULL, NULL, &timeouttmp); ++ /* An error. */ ++ if ((ret < 0) && (errno != EINTR) && (errno != EAGAIN)) { ++ return 0; ++ } ++ ++ /* We have data to read. */ ++ if ((ret > 0) && FD_ISSET(fd, &rfds)) { ++ ret = read(fd, ptr, count); ++ /* Another error */ ++ if ((ret < 0) && (errno != EINTR) && (errno != EAGAIN)) { ++ return 0; ++ } ++ ++ if (ret > 0) { ++ /* Got data, add it to the buffer. */ ++ ptr += ret; ++ total += ret; ++ count -= ret; ++ } else if (!ret) { ++ /* This should never happen since how can we have ++ * data to read at an end of file, but still ++ * just in case! */ ++ data->end_of_file = 1; ++ break; ++ } ++ } ++ ++ /* If not timed out and not end of file and not all data read ++ * calculate how long it took us and loop if we still have time ++ * out time left. */ ++ if (count) { ++ (void) gettimeofday(&after, NULL); ++ ++ /* Diff the timevals */ ++ (void) dio_timeval_subtract(&after, &before, &diff); ++ ++ /* Now adjust the timeout. */ ++ if (!dio_timeval_subtract(&timeout, &diff, &timeout)) { ++ /* If it errors we've run out of time. */ ++ data->timed_out = 1; ++ break; ++ } else if (!timeout.tv_sec && !(timeout.tv_usec / 1000)) { ++ /* Check for rounding issues (millisecond accuracy) */ ++ data->timed_out = 1; ++ break; ++ } ++ } ++ } while (count); /* Until time out or end of file or all data read. */ ++ ++ return total; ++ } ++#endif ++} ++/* }}} */ ++ ++/* {{{ php_dio_stream_data ++ * Closes the php_stream. ++ */ ++int dio_common_close(php_dio_stream_data *data) { ++ if (close(((php_dio_posix_stream_data*)data)->fd) < 0) { ++ return 0; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_common_set_option ++ * Sets/gets stream options ++ */ ++int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam) { ++ int fd = ((php_dio_posix_stream_data*)data)->fd; ++ int old_is_blocking; ++ int flags; ++ ++ switch (option) { ++#ifdef DIO_NONBLOCK ++ case PHP_STREAM_OPTION_READ_TIMEOUT: ++ if (ptrparam) { ++ struct timeval *tv = (struct timeval*)ptrparam; ++ ++ flags = fcntl(fd, F_GETFL, 0); ++ ++ /* A timeout of zero seconds and zero microseconds disables ++ any existing timeout. */ ++ if (tv->tv_sec || tv->tv_usec) { ++ data->timeout_sec = tv->tv_sec; ++ data->timeout_usec = tv->tv_usec; ++ data->has_timeout = -1; ++ (void) fcntl(fd, F_SETFL, flags & ~DIO_NONBLOCK); ++ } else { ++ data->timeout_sec = 0; ++ data->timeout_usec = 0; ++ data->has_timeout = 0; ++ data->timed_out = 0; ++ (void) fcntl(fd, F_SETFL, flags | DIO_NONBLOCK); ++ } ++ ++ return PHP_STREAM_OPTION_RETURN_OK; ++ } else { ++ return PHP_STREAM_OPTION_RETURN_ERR; ++ } ++ ++ case PHP_STREAM_OPTION_BLOCKING: ++ flags = fcntl(fd, F_GETFL, 0); ++ if (value) { ++ flags &= ~DIO_NONBLOCK; ++ } else { ++ flags |= DIO_NONBLOCK; ++ } ++ (void) fcntl(fd, F_SETFL, flags); ++ ++ old_is_blocking = data->is_blocking; ++ data->is_blocking = value; ++ return old_is_blocking ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR; ++#endif /* O_NONBLOCK */ ++ ++ default: ++ break; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_raw_open_stream ++ * Opens the underlying stream. ++ */ ++int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++ php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; ++ pdata->flags = dio_stream_mode_to_flags(mode); ++ ++#ifdef DIO_NONBLOCK ++ if (!data->is_blocking || data->has_timeout) { ++ pdata->flags |= DIO_NONBLOCK; ++ } ++#endif ++ ++ /* Open the file and handle any errors. */ ++#ifdef DIO_HAS_FILEPERMS ++ if (data->has_perms) { ++ pdata->fd = open(filename, pdata->flags, (mode_t)data->perms); ++ } else { ++ pdata->fd = open(filename, pdata->flags); ++ } ++#else ++ pdata->fd = open(filename, pdata->flags); ++#endif ++ ++ if (pdata->fd < 0) { ++ switch (errno) { ++ case EEXIST: ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!"); ++ return 0; ++ default: ++ return 0; ++ } ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_serial_init ++ * Initialises the serial settings storing the original settings before hand. ++ */ ++static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) { ++ php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; ++ int ret = 0, data_bits_def, stop_bits_def, parity_def; ++ struct termios tio; ++ speed_t rate_def; ++ ++ if (!dio_data_rate_to_define(data->data_rate, &rate_def)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%ld)", data->data_rate); ++ return 0; ++ } ++ ++ if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits); ++ return 0; ++ } ++ ++ if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits); ++ return 0; ++ } ++ ++ if (!dio_parity_to_define(data->parity, &parity_def)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity); ++ return 0; ++ } ++ ++ ret = tcgetattr(pdata->fd, &(pdata->oldtio)); ++ if (ret < 0) { ++ if ((errno == ENOTTY) || (errno == ENODEV)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a serial port or terminal!"); ++ } ++ return 0; ++ } ++ ++ ret = tcgetattr(pdata->fd, &tio); ++ if (ret < 0) { ++ return 0; ++ } ++ ++ if (data->canonical) { ++ tio.c_iflag = IGNPAR | ICRNL; ++ tio.c_oflag = 0; ++ tio.c_lflag = ICANON; ++ } else { ++ cfmakeraw(&tio); ++ } ++ ++ cfsetispeed(&tio, rate_def); ++ cfsetospeed(&tio, rate_def); ++ ++ tio.c_cflag &= ~CSIZE; ++ tio.c_cflag |= data_bits_def; ++ tio.c_cflag &= ~CSTOPB; ++ tio.c_cflag |= stop_bits_def; ++ tio.c_cflag &= ~(PARENB|PARODD); ++ tio.c_cflag |= parity_def; ++ ++#ifdef CRTSCTS ++ tio.c_cflag &= ~(CLOCAL | CRTSCTS); ++#else ++ tio.c_cflag &= ~CLOCAL; ++#endif ++ if (!data->flow_control) { ++ tio.c_cflag |= CLOCAL; ++#ifdef CRTSCTS ++ } else { ++ tio.c_cflag |= CRTSCTS; ++#endif ++ } ++ ++ ret = tcsetattr(pdata->fd, TCSANOW, &tio); ++ if (ret < 0) { ++ return 0; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_serial_uninit ++ * Restores the serial settings back to their original state. ++ */ ++int dio_serial_uninit(php_dio_stream_data *data) { ++ php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; ++ int ret; ++ ++ do { ++ ret = tcsetattr(pdata->fd, TCSANOW, &(pdata->oldtio)); ++ } while ((ret < 0) && (errno == EINTR)); ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_serial_flush ++ * Purges the serial buffers of data. ++ */ ++int dio_serial_purge(php_dio_stream_data *data) { ++ php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; ++ int ret; ++ ++ if ((pdata->flags & O_RDWR) == O_RDWR) { ++ ret = tcflush(pdata->fd, TCIOFLUSH); ++ } else if ((pdata->flags & O_WRONLY) == O_WRONLY) { ++ ret = tcflush(pdata->fd, TCOFLUSH); ++ } else if ((pdata->flags & O_RDONLY) == O_RDONLY) { ++ ret = tcflush(pdata->fd, TCIFLUSH); ++ } ++ ++ if (ret < 0) { ++ return 0; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_serial_open_stream ++ * Opens the underlying stream. ++ */ ++int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++ php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; ++ ++#ifdef O_NOCTTY ++ /* We don't want a controlling TTY */ ++ pdata->flags |= O_NOCTTY; ++#endif ++ ++ if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) { ++ return 0; ++ } ++ ++ if (!dio_serial_init(data TSRMLS_CC)) { ++ close(pdata->fd); ++ return 0; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* ++ * Local variables: ++ * c-basic-offset: 4 ++ * tab-width: 4 ++ * End: ++ * vim600: fdm=marker ++ * vim: sw=4 ts=4 noet ++ */ +--- a/dio_win32.c ++++ b/dio_win32.c +@@ -1,759 +1,759 @@ +-/* +- +----------------------------------------------------------------------+ +- | PHP Version 5 | +- +----------------------------------------------------------------------+ +- | Copyright (c) 2009 Melanie Rhianna Lewis | +- +----------------------------------------------------------------------+ +- | This source file is subject to version 3.0 of the PHP license, | +- | that is bundled with this package in the file LICENSE, and is | +- | available through the world-wide-web at the following url: | +- | http://www.php.net/license/3_0.txt. | +- | If you did not receive a copy of the PHP license and are unable to | +- | obtain it through the world-wide-web, please send a note to | +- | license@php.net so we can mail you a copy immediately. | +- +----------------------------------------------------------------------+ +- | Author: Melanie Rhianna Lewis | +- +----------------------------------------------------------------------+ +- */ +- +-#ifdef HAVE_CONFIG_H +-#include "config.h" +-#endif +- +-#include "php.h" +-#include "php_dio_common.h" +- +-#ifndef ZEND_WIN32 +-#error ZEND_WIN32 not defined! +-#endif +- +-/* {{{ dio_last_error_php_error +- * Generates a PHP error message based upon the last Windows error. +- */ +-static void dio_last_error_php_error(int level, char * message TSRMLS_DC) { +- LPVOID msgbuf; +- DWORD msgbuflen; +- char * errmsg; +- DWORD err; +- +-#ifdef UNICODE +- DWORD errmsglen; +-#endif +- +- err = GetLastError(); +- msgbuflen = FormatMessage( +- FORMAT_MESSAGE_ALLOCATE_BUFFER| +- FORMAT_MESSAGE_FROM_SYSTEM| +- FORMAT_MESSAGE_IGNORE_INSERTS, +- NULL, +- err, +- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), +- (LPTSTR)&msgbuf, +- 0, +- NULL); +- +-#ifdef UNICODE +- +- /* Get the length of the converted message */ +- errmsglen = WideCharToMultibyte( +- CP_ACP, +- 0 +- (LPCWSTR)msgbuf, +- -1, +- (LPSTR)errmsg, +- 0, +- NULL, +- NULL); +- +- /* Allocate a buffer */ +- errmsg = emalloc(errmsglen); +- if (!errmsg) { +- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Out of memory in dio_last_error_php_error()!"); +- LocalFree(msgbuf); +- return; +- } +- +- /* Convert the message */ +- errmsglen = WideCharToMultibyte( +- CP_ACP, +- 0 +- (LPCWSTR)msgbuf, +- -1, +- (LPSTR)errmsg, +- errmsglen, +- NULL, +- NULL); +- +-#else +- errmsg = (char *)msgbuf; +-#endif +- +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s[ERROR %d] %s", message, err, errmsg); +- +- LocalFree(msgbuf); +-#ifdef UNICODE +- efree(errmsg); +-#endif +-} +- +-/* {{{ dio_data_rate_to_define +- * Converts a numeric data rate to a termios define +- */ +-static int dio_data_rate_to_define(long rate, DWORD *def) { +- switch (rate) { +- case 75: +- case 110: +- case 134: +- case 150: +- case 300: +- case 600: +- case 1200: +- case 1800: +- case 2400: +- case 4800: +- case 7200: +- case 9600: +- case 14400: +- case 19200: +- case 38400: +- case 57600: +- case 115200: +- case 56000: +- case 128000: +- case 256000: +- break; +- default: +- return 0; +- } +- +- *def = (DWORD)rate; +- return 1; +-} +-/* }}} */ +- +- +-/* {{{ dio_data_bits_to_define +- * Converts a number of data bits to a termios define +- */ +-static int dio_data_bits_to_define(int data_bits, DWORD *def) { +- switch (data_bits) { +- case 8: +- case 7: +- case 6: +- case 5: +- case 4: +- break; +- default: +- return 0; +- } +- +- *def = (DWORD)data_bits; +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_stop_bits_to_define +- * Converts a number of stop bits to a termios define +- */ +-static int dio_stop_bits_to_define(int stop_bits, DWORD *def) { +- DWORD val; +- +- switch (stop_bits) { +- case 1: +- val = ONESTOPBIT; +- break; +- case 2: +- val = TWOSTOPBITS; +- break; +- case 3: +- val = ONE5STOPBITS; +- break; +- default: +- return 0; +- } +- +- *def = val; +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_parity_to_define +- * Converts a parity type to a termios define +- */ +-static int dio_parity_to_define(int parity, DWORD *def) { +- DWORD val; +- +- switch (parity) { +- case 0: +- val = NOPARITY; +- break; +- case 1: +- val = ODDPARITY; +- break; +- case 2: +- val = EVENPARITY; +- break; +- default: +- return 0; +- } +- +- *def = val; +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_create_stream_data +- * Creates an initialised stream data structure. Free with efree(). +- */ +-php_dio_stream_data * dio_create_stream_data(void) { +- php_dio_win32_stream_data * data = emalloc(sizeof(php_dio_win32_stream_data)); +- memset(data, 0, sizeof(php_dio_win32_stream_data)); +- dio_init_stream_data(&(data->common)); +- data->handle = INVALID_HANDLE_VALUE; +- data->desired_access = 0; +- data->creation_disposition = 0; +- data->olddcb.DCBlength = sizeof(DCB); +- +- return (php_dio_stream_data *)data; +-} +-/* }}} */ +- +-/* {{{ dio_common_write +- * Writes count chars from the buffer to the stream described by the stream data. +- */ +-size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count) { +- php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; +- DWORD total = 0; +- +- if (WriteFile(wdata->handle, buf, (DWORD)count, &total, NULL)) { +- return (size_t)total; +- } +- +- return 0; +-} +-/* }}} */ +- +-/* {{{ dio_buffer_read +- * Reads any available chars from the canonical buffer. +- */ +-static size_t dio_buffer_read(php_dio_win32_stream_data *wdata, const char *buf, size_t count) { +- php_dio_win32_canon_data *canon_data = wdata->canon_data; +- size_t total = 0; +- +- /* Read always follows write. I.e. if read ptr > write ptr buffer has +- wrapped and so we need to copy two blocks of data. */ +- if (canon_data->read_pos > canon_data->write_pos) { +- +- /* Check we actually need to copy both blocks */ +- if ((canon_data->size - canon_data->read_pos) > count) { +- +- /* No we don't. Just copy as much as we were asked for. */ +- memcpy((char*)buf, +- &(canon_data->buf[canon_data->read_pos]), +- count); +- /* Update the read pointer. */ +- canon_data->read_pos += count; +- +- /* Return the amount read. */ +- return count; +- } else { +- +- /* We need to copy both blocks so copy data up to the end of +- the buffer. */ +- total = canon_data->size - canon_data->read_pos; +- memcpy((char*)buf, +- &(canon_data->buf[canon_data->read_pos]), +- total); +- canon_data->read_pos = 0; +- count -= total; +- +- /* Now copy the data from the start of the buffer either up +- count or the number of bytes in the buffer. */ +- +- if (canon_data->write_pos > count) { +- memcpy((char*)buf, canon_data->buf, count); +- canon_data->read_pos = count; +- total += count; +- +- return total; +- } else { +- memcpy((char*)buf, canon_data->buf, canon_data->write_pos); +- canon_data->read_pos = canon_data->write_pos; +- total += canon_data->write_pos; +- +- return total; +- } +- } +- +- /* Else if write follows read. This is a simpler case. We just copy +- either all the data buffered or count, which ever is smaller. */ +- } else if (canon_data->write_pos > canon_data->read_pos) { +- if ((canon_data->write_pos - canon_data->read_pos) > count) { +- memcpy((char*)buf, +- &(canon_data->buf[canon_data->read_pos]), +- count); +- canon_data->read_pos += count; +- +- return count; +- } else { +- total = canon_data->write_pos - canon_data->read_pos; +- memcpy((char*)buf, +- &(canon_data->buf[canon_data->read_pos]), +- total); +- canon_data->read_pos += total; +- +- return total; +- } +- } +- +- /* Else we need to read more data from the data port. */ +- return 0; +-} +- +-/* {{{ dio_com_read +- * Read chars from the data port. +- */ +-static size_t dio_com_read(php_dio_stream_data *data, const char *buf, size_t count) { +- php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; +- DWORD err, total = 0; +- +- if (ReadFile(wdata->handle, (void*)buf, (DWORD)count, &total, NULL)) { +- +- if (total) { +- return (size_t)total; +- } +- +- data->end_of_file = 1; +- } +- +- if (!data->end_of_file) { +- err = GetLastError(); +- +- if (ERROR_HANDLE_EOF == err) { +- data->end_of_file = 1; +- } +- } +- +- return 0; +-} +- +-/* {{{ dio_canonical_read +- * Reads chars from the input stream until the internal buffer is full or a new +- * line is reached. +- */ +-static size_t dio_canonical_read(php_dio_win32_stream_data *wdata, const char *buf, size_t count) { +- php_dio_win32_canon_data *canon_data = wdata->canon_data; +- size_t total = 0; +- char ch; +- +- /* See if there's any buffered data and copy it. */ +- total = dio_buffer_read(wdata, buf, count); +- if (total) { +- return total; +- } +- +- /* Need to read more data from the data port. Buffer should be empty(er) +- by now. */ +- do { +- /* Is the buffer full? */ +- if (((canon_data->write_pos + 1) % canon_data->size) == +- canon_data->read_pos) { +- break; +- } +- +- /* Read a byte from the input checking for EOF. */ +- if (!dio_com_read((php_dio_stream_data*)wdata, &ch, 1)) { +- break; +- } +- +- /* Translate CR to newlines (same as ICRNL in POSIX) */ +- ch = (ch != '\r') ? ch : '\n'; +- +- /* We read a character! So buffer it. */ +- canon_data->buf[canon_data->write_pos++] = ch; +- if (canon_data->write_pos >= canon_data->size) { +- canon_data->write_pos = 0; +- } +- +- /* End of line/input (^D)? */ +- } while ((ch != '\n') && (ch != 0x04)); +- +- return dio_buffer_read(wdata, buf, count); +-} +-/* }}} */ +- +-/* {{{ dio_common_read +- * Reads count chars to the buffer to the stream described by the stream data. +- */ +-size_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count) { +- +- /* You ask for no bytes you'll get none :-) */ +- if (!count) { +- return 0; +- } +- +- if (data->canonical) { +- return dio_canonical_read((php_dio_win32_stream_data*)data, buf, count); +- } else { +- return dio_com_read(data, buf, count); +- } +-} +-/* }}} */ +- +-/* {{{ php_dio_stream_data +- * Closes the php_stream. +- */ +-int dio_common_close(php_dio_stream_data *data) { +- php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; +- +- if (data->canonical) { +- efree(wdata->canon_data); +- } +- +- if (!CloseHandle(wdata->handle)) { +- return 0; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_common_set_option +- * Sets/gets stream options +- */ +-int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam) { +- COMMTIMEOUTS cto = { 0, 0, 0, 0, 0 }; +- int old_is_blocking = 0; +- +- /* Can't do timeouts or non blocking with raw windows streams :-( */ +- if (DIO_STREAM_TYPE_SERIAL == data->stream_type) { +- switch (option) { +- case PHP_STREAM_OPTION_BLOCKING: +- old_is_blocking = data->is_blocking; +- data->is_blocking = value ? 1 : 0; +- +- /* Only change values if we need to change them. */ +- if (data->is_blocking != old_is_blocking) { +- /* If we're not blocking but don't have a timeout +- set to return immediately */ +- if (!data->is_blocking && !data->has_timeout) { +- cto.ReadIntervalTimeout = MAXDWORD; +- } +- +- /* If we have a timeout ignore the blocking and set +- the total time in which to read the data */ +- if (data->has_timeout) { +- cto.ReadIntervalTimeout = MAXDWORD; +- cto.ReadTotalTimeoutMultiplier = MAXDWORD; +- cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) + +- (data->timeout_sec * 1000); +- } +- +- if (!SetCommTimeouts(((php_dio_win32_stream_data*)data)->handle, &cto)) { +- return PHP_STREAM_OPTION_RETURN_ERR; +- } +- } +- return old_is_blocking ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR; +- +- case PHP_STREAM_OPTION_READ_TIMEOUT: +- if (ptrparam) { +- /* struct timeval is supported with PHP_WIN32 defined. */ +- struct timeval *tv = (struct timeval*)ptrparam; +- +- /* A timeout of zero seconds and zero microseconds disables +- any existing timeout. */ +- if (tv->tv_sec || tv->tv_usec) { +- data->timeout_sec = tv->tv_sec; +- data->timeout_usec = tv->tv_usec; +- data->has_timeout = -1; +- +- cto.ReadIntervalTimeout = MAXDWORD; +- cto.ReadTotalTimeoutMultiplier = MAXDWORD; +- cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) + +- (data->timeout_sec * 1000); +- } else { +- data->timeout_sec = 0; +- data->timeout_usec = 0; +- data->has_timeout = 0; +- data->timed_out = 0; +- +- /* If we're not blocking but don't have a timeout +- set to return immediately */ +- if (!data->is_blocking) { +- cto.ReadIntervalTimeout = MAXDWORD; +- } +- } +- +- if (!SetCommTimeouts(((php_dio_win32_stream_data*)data)->handle, &cto)) { +- return PHP_STREAM_OPTION_RETURN_ERR; +- } else { +- return PHP_STREAM_OPTION_RETURN_OK; +- } +- } else { +- return PHP_STREAM_OPTION_RETURN_ERR; +- } +- +- default: +- break; +- } +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_raw_open_stream +- * Opens the underlying stream. +- */ +-int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { +- php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; +- DWORD err; +- +- switch(*mode) { +- case 'r': +- wdata->creation_disposition = OPEN_EXISTING; +- break; +- case 'w': +- wdata->creation_disposition = TRUNCATE_EXISTING; +- break; +- case 'a': +- wdata->creation_disposition = OPEN_ALWAYS; +- break; +- case 'x': +- wdata->creation_disposition = CREATE_NEW; +- break; +- } +- mode ++; +- +- if (*mode && (*mode != '+')) { +- mode++; +- } +- +- if (*mode && (*mode == '+')) { +- wdata->desired_access = GENERIC_READ | GENERIC_WRITE; +- } else if (OPEN_EXISTING == wdata->creation_disposition) { +- wdata->desired_access = GENERIC_READ; +- } else { +- wdata->desired_access = GENERIC_WRITE; +- } +- +- wdata->handle = CreateFile(filename, wdata->desired_access, 0, +- NULL, wdata->creation_disposition, FILE_ATTRIBUTE_NORMAL, NULL); +- if (INVALID_HANDLE_VALUE == wdata->handle) { +- err = GetLastError(); +- switch (err) { +- case ERROR_FILE_EXISTS: +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!"); +- return 0; +- +- case ERROR_FILE_NOT_FOUND: +- /* ERROR_FILE_NOT_FOUND with TRUNCATE_EXISTING means that +- * the file doesn't exist so now try to create it. */ +- if (TRUNCATE_EXISTING == wdata->creation_disposition) { +- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "File does not exist, creating new file!"); +- +- wdata->handle = CreateFile(filename, wdata->desired_access, 0, +- NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); +- if (INVALID_HANDLE_VALUE == wdata->handle) { +- dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC); +- return 0; +- } +- } else { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "File not found!"); +- return 0; +- } +- break; +- +- default: +- dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC); +- return 0; +- } +- } +- +- /* If canonical allocate the canonical buffer. */ +- if (data->canonical) { +- wdata->canon_data = emalloc(sizeof(php_dio_win32_canon_data)); +- memset(wdata->canon_data, 0, sizeof(php_dio_win32_canon_data)); +- wdata->canon_data->size = DIO_WIN32_CANON_BUF_SIZE; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_serial_init +- * Initialises the serial port +- */ +-static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) { +- php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; +- DWORD rate_def, data_bits_def, stop_bits_def, parity_def; +- DCB dcb; +- +- if (!dio_data_rate_to_define(data->data_rate, &rate_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%d)", data->data_rate); +- return 0; +- } +- +- if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits); +- return 0; +- } +- +- if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits); +- return 0; +- } +- +- if (!dio_parity_to_define(data->parity, &parity_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity); +- return 0; +- } +- +- if (!GetCommState(wdata->handle, &(wdata->olddcb))) { +- dio_last_error_php_error(E_WARNING, "GetCommState() failed:" TSRMLS_CC); +- return 0; +- } +- +- /* Init the DCB structure */ +- memset(&dcb, 0, sizeof(DCB)); +- dcb.DCBlength = sizeof(DCB); +- +- /* Set the communication parameters */ +- dcb.fBinary = 1; +- dcb.BaudRate = rate_def; +- dcb.ByteSize = (BYTE)data_bits_def; +- dcb.StopBits = (BYTE)stop_bits_def; +- dcb.Parity = (BYTE)parity_def; +- +- /* Set the control line parameters */ +- dcb.fDtrControl = DTR_CONTROL_DISABLE; +- dcb.fDsrSensitivity = FALSE; +- dcb.fOutxDsrFlow = FALSE; +- dcb.fTXContinueOnXoff = FALSE; +- dcb.fOutX = FALSE; +- dcb.fInX = FALSE; +- dcb.fErrorChar = FALSE; +- dcb.fNull = FALSE; +- dcb.fAbortOnError = FALSE; +- +- /* Hardware flow control */ +- if (data->flow_control) { +- dcb.fOutxCtsFlow = TRUE; +- dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; +- } else { +- dcb.fOutxCtsFlow = FALSE; +- dcb.fRtsControl = RTS_CONTROL_DISABLE; +- } +- +- if (!SetCommState(wdata->handle, &dcb)) { +- dio_last_error_php_error(E_WARNING, "SetCommState() failed:" TSRMLS_CC); +- return 0; +- } +- +- return 1; +-} +-/* }}} */ +- +- +-/* {{{ dio_serial_uninit +- * Restores the serial settings back to their original state. +- */ +-int dio_serial_uninit(php_dio_stream_data *data) { +- php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; +- +- if (!SetCommState(wdata->handle, &(wdata->olddcb))) { +- return 0; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_serial_flush +- * Purges the serial buffers of data. +- */ +-int dio_serial_purge(php_dio_stream_data *data) { +- php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; +- BOOL ret; +- +- /* Purge the canonical buffer if required */ +- if (data->canonical && ((wdata->desired_access & GENERIC_READ) == GENERIC_READ)) { +- wdata->canon_data->read_pos = 0; +- wdata->canon_data->write_pos = 0; +- } +- +- /* Purge the com port */ +- if ((wdata->desired_access & (GENERIC_READ|GENERIC_WRITE)) == (GENERIC_READ|GENERIC_WRITE)) { +- ret = PurgeComm(wdata->handle, PURGE_RXCLEAR|PURGE_TXCLEAR); +- } else if ((wdata->desired_access & GENERIC_WRITE) == GENERIC_WRITE) { +- ret = PurgeComm(wdata->handle, PURGE_TXCLEAR); +- } else if ((wdata->desired_access & GENERIC_READ) == GENERIC_READ) { +- ret = PurgeComm(wdata->handle, PURGE_RXCLEAR); +- } +- +- return ret; +-} +-/* }}} */ +- +-/* {{{ dio_serial_open_stream +- * Opens the underlying stream. +- */ +-int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { +- php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; +- COMMTIMEOUTS cto = { 0, 0, 0, 0, 0 }; +- +- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Opening \"%s\" as a serial port (mode=\"%s\").", filename, mode); +- +- if (*mode != 'r') { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must open serial ports in read or read/write mode!"); +- return 0; +- } +- +- if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) { +- return 0; +- } +- +- if (!GetCommTimeouts(wdata->handle, &(wdata->oldcto))) { +- dio_last_error_php_error(E_WARNING, "GetCommTimeouts() failed (Not a comm port?):" TSRMLS_CC); +- CloseHandle(wdata->handle); +- return 0; +- } +- +- /* If we're not blocking but don't have a timeout +- set to return immediately */ +- if (!data->is_blocking && !data->has_timeout) { +- cto.ReadIntervalTimeout = MAXDWORD; +- } +- +- /* If we have a timeout ignore the blocking and set +- the total time in which to read the data */ +- if (data->has_timeout) { +- cto.ReadIntervalTimeout = MAXDWORD; +- cto.ReadTotalTimeoutMultiplier = MAXDWORD; +- cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) + +- (data->timeout_sec * 1000); +- } +- +- if (!SetCommTimeouts(wdata->handle, &cto)) { +- dio_last_error_php_error(E_WARNING, "SetCommTimeouts() failed:" TSRMLS_CC); +- CloseHandle(wdata->handle); +- return 0; +- } +- +- if (!dio_serial_init(data TSRMLS_CC)) { +- CloseHandle(wdata->handle); +- return 0; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* +- * Local variables: +- * c-basic-offset: 4 +- * tab-width: 4 +- * End: +- * vim600: fdm=marker +- * vim: sw=4 ts=4 noet +- */ ++/* ++ +----------------------------------------------------------------------+ ++ | PHP Version 5 | ++ +----------------------------------------------------------------------+ ++ | Copyright (c) 2009 Melanie Rhianna Lewis | ++ +----------------------------------------------------------------------+ ++ | This source file is subject to version 3.0 of the PHP license, | ++ | that is bundled with this package in the file LICENSE, and is | ++ | available through the world-wide-web at the following url: | ++ | http://www.php.net/license/3_0.txt. | ++ | If you did not receive a copy of the PHP license and are unable to | ++ | obtain it through the world-wide-web, please send a note to | ++ | license@php.net so we can mail you a copy immediately. | ++ +----------------------------------------------------------------------+ ++ | Author: Melanie Rhianna Lewis | ++ +----------------------------------------------------------------------+ ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include "php.h" ++#include "php_dio_common.h" ++ ++#ifndef ZEND_WIN32 ++#error ZEND_WIN32 not defined! ++#endif ++ ++/* {{{ dio_last_error_php_error ++ * Generates a PHP error message based upon the last Windows error. ++ */ ++static void dio_last_error_php_error(int level, char * message TSRMLS_DC) { ++ LPVOID msgbuf; ++ DWORD msgbuflen; ++ char * errmsg; ++ DWORD err; ++ ++#ifdef UNICODE ++ DWORD errmsglen; ++#endif ++ ++ err = GetLastError(); ++ msgbuflen = FormatMessage( ++ FORMAT_MESSAGE_ALLOCATE_BUFFER| ++ FORMAT_MESSAGE_FROM_SYSTEM| ++ FORMAT_MESSAGE_IGNORE_INSERTS, ++ NULL, ++ err, ++ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), ++ (LPTSTR)&msgbuf, ++ 0, ++ NULL); ++ ++#ifdef UNICODE ++ ++ /* Get the length of the converted message */ ++ errmsglen = WideCharToMultibyte( ++ CP_ACP, ++ 0 ++ (LPCWSTR)msgbuf, ++ -1, ++ (LPSTR)errmsg, ++ 0, ++ NULL, ++ NULL); ++ ++ /* Allocate a buffer */ ++ errmsg = emalloc(errmsglen); ++ if (!errmsg) { ++ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Out of memory in dio_last_error_php_error()!"); ++ LocalFree(msgbuf); ++ return; ++ } ++ ++ /* Convert the message */ ++ errmsglen = WideCharToMultibyte( ++ CP_ACP, ++ 0 ++ (LPCWSTR)msgbuf, ++ -1, ++ (LPSTR)errmsg, ++ errmsglen, ++ NULL, ++ NULL); ++ ++#else ++ errmsg = (char *)msgbuf; ++#endif ++ ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s[ERROR %d] %s", message, err, errmsg); ++ ++ LocalFree(msgbuf); ++#ifdef UNICODE ++ efree(errmsg); ++#endif ++} ++ ++/* {{{ dio_data_rate_to_define ++ * Converts a numeric data rate to a termios define ++ */ ++static int dio_data_rate_to_define(long rate, DWORD *def) { ++ switch (rate) { ++ case 75: ++ case 110: ++ case 134: ++ case 150: ++ case 300: ++ case 600: ++ case 1200: ++ case 1800: ++ case 2400: ++ case 4800: ++ case 7200: ++ case 9600: ++ case 14400: ++ case 19200: ++ case 38400: ++ case 57600: ++ case 115200: ++ case 56000: ++ case 128000: ++ case 256000: ++ break; ++ default: ++ return 0; ++ } ++ ++ *def = (DWORD)rate; ++ return 1; ++} ++/* }}} */ ++ ++ ++/* {{{ dio_data_bits_to_define ++ * Converts a number of data bits to a termios define ++ */ ++static int dio_data_bits_to_define(int data_bits, DWORD *def) { ++ switch (data_bits) { ++ case 8: ++ case 7: ++ case 6: ++ case 5: ++ case 4: ++ break; ++ default: ++ return 0; ++ } ++ ++ *def = (DWORD)data_bits; ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_stop_bits_to_define ++ * Converts a number of stop bits to a termios define ++ */ ++static int dio_stop_bits_to_define(int stop_bits, DWORD *def) { ++ DWORD val; ++ ++ switch (stop_bits) { ++ case 1: ++ val = ONESTOPBIT; ++ break; ++ case 2: ++ val = TWOSTOPBITS; ++ break; ++ case 3: ++ val = ONE5STOPBITS; ++ break; ++ default: ++ return 0; ++ } ++ ++ *def = val; ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_parity_to_define ++ * Converts a parity type to a termios define ++ */ ++static int dio_parity_to_define(int parity, DWORD *def) { ++ DWORD val; ++ ++ switch (parity) { ++ case 0: ++ val = NOPARITY; ++ break; ++ case 1: ++ val = ODDPARITY; ++ break; ++ case 2: ++ val = EVENPARITY; ++ break; ++ default: ++ return 0; ++ } ++ ++ *def = val; ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_create_stream_data ++ * Creates an initialised stream data structure. Free with efree(). ++ */ ++php_dio_stream_data * dio_create_stream_data(void) { ++ php_dio_win32_stream_data * data = emalloc(sizeof(php_dio_win32_stream_data)); ++ memset(data, 0, sizeof(php_dio_win32_stream_data)); ++ dio_init_stream_data(&(data->common)); ++ data->handle = INVALID_HANDLE_VALUE; ++ data->desired_access = 0; ++ data->creation_disposition = 0; ++ data->olddcb.DCBlength = sizeof(DCB); ++ ++ return (php_dio_stream_data *)data; ++} ++/* }}} */ ++ ++/* {{{ dio_common_write ++ * Writes count chars from the buffer to the stream described by the stream data. ++ */ ++size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count) { ++ php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; ++ DWORD total = 0; ++ ++ if (WriteFile(wdata->handle, buf, (DWORD)count, &total, NULL)) { ++ return (size_t)total; ++ } ++ ++ return 0; ++} ++/* }}} */ ++ ++/* {{{ dio_buffer_read ++ * Reads any available chars from the canonical buffer. ++ */ ++static size_t dio_buffer_read(php_dio_win32_stream_data *wdata, const char *buf, size_t count) { ++ php_dio_win32_canon_data *canon_data = wdata->canon_data; ++ size_t total = 0; ++ ++ /* Read always follows write. I.e. if read ptr > write ptr buffer has ++ wrapped and so we need to copy two blocks of data. */ ++ if (canon_data->read_pos > canon_data->write_pos) { ++ ++ /* Check we actually need to copy both blocks */ ++ if ((canon_data->size - canon_data->read_pos) > count) { ++ ++ /* No we don't. Just copy as much as we were asked for. */ ++ memcpy((char*)buf, ++ &(canon_data->buf[canon_data->read_pos]), ++ count); ++ /* Update the read pointer. */ ++ canon_data->read_pos += count; ++ ++ /* Return the amount read. */ ++ return count; ++ } else { ++ ++ /* We need to copy both blocks so copy data up to the end of ++ the buffer. */ ++ total = canon_data->size - canon_data->read_pos; ++ memcpy((char*)buf, ++ &(canon_data->buf[canon_data->read_pos]), ++ total); ++ canon_data->read_pos = 0; ++ count -= total; ++ ++ /* Now copy the data from the start of the buffer either up ++ count or the number of bytes in the buffer. */ ++ ++ if (canon_data->write_pos > count) { ++ memcpy((char*)buf, canon_data->buf, count); ++ canon_data->read_pos = count; ++ total += count; ++ ++ return total; ++ } else { ++ memcpy((char*)buf, canon_data->buf, canon_data->write_pos); ++ canon_data->read_pos = canon_data->write_pos; ++ total += canon_data->write_pos; ++ ++ return total; ++ } ++ } ++ ++ /* Else if write follows read. This is a simpler case. We just copy ++ either all the data buffered or count, which ever is smaller. */ ++ } else if (canon_data->write_pos > canon_data->read_pos) { ++ if ((canon_data->write_pos - canon_data->read_pos) > count) { ++ memcpy((char*)buf, ++ &(canon_data->buf[canon_data->read_pos]), ++ count); ++ canon_data->read_pos += count; ++ ++ return count; ++ } else { ++ total = canon_data->write_pos - canon_data->read_pos; ++ memcpy((char*)buf, ++ &(canon_data->buf[canon_data->read_pos]), ++ total); ++ canon_data->read_pos += total; ++ ++ return total; ++ } ++ } ++ ++ /* Else we need to read more data from the data port. */ ++ return 0; ++} ++ ++/* {{{ dio_com_read ++ * Read chars from the data port. ++ */ ++static size_t dio_com_read(php_dio_stream_data *data, const char *buf, size_t count) { ++ php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; ++ DWORD err, total = 0; ++ ++ if (ReadFile(wdata->handle, (void*)buf, (DWORD)count, &total, NULL)) { ++ ++ if (total) { ++ return (size_t)total; ++ } ++ ++ data->end_of_file = 1; ++ } ++ ++ if (!data->end_of_file) { ++ err = GetLastError(); ++ ++ if (ERROR_HANDLE_EOF == err) { ++ data->end_of_file = 1; ++ } ++ } ++ ++ return 0; ++} ++ ++/* {{{ dio_canonical_read ++ * Reads chars from the input stream until the internal buffer is full or a new ++ * line is reached. ++ */ ++static size_t dio_canonical_read(php_dio_win32_stream_data *wdata, const char *buf, size_t count) { ++ php_dio_win32_canon_data *canon_data = wdata->canon_data; ++ size_t total = 0; ++ char ch; ++ ++ /* See if there's any buffered data and copy it. */ ++ total = dio_buffer_read(wdata, buf, count); ++ if (total) { ++ return total; ++ } ++ ++ /* Need to read more data from the data port. Buffer should be empty(er) ++ by now. */ ++ do { ++ /* Is the buffer full? */ ++ if (((canon_data->write_pos + 1) % canon_data->size) == ++ canon_data->read_pos) { ++ break; ++ } ++ ++ /* Read a byte from the input checking for EOF. */ ++ if (!dio_com_read((php_dio_stream_data*)wdata, &ch, 1)) { ++ break; ++ } ++ ++ /* Translate CR to newlines (same as ICRNL in POSIX) */ ++ ch = (ch != '\r') ? ch : '\n'; ++ ++ /* We read a character! So buffer it. */ ++ canon_data->buf[canon_data->write_pos++] = ch; ++ if (canon_data->write_pos >= canon_data->size) { ++ canon_data->write_pos = 0; ++ } ++ ++ /* End of line/input (^D)? */ ++ } while ((ch != '\n') && (ch != 0x04)); ++ ++ return dio_buffer_read(wdata, buf, count); ++} ++/* }}} */ ++ ++/* {{{ dio_common_read ++ * Reads count chars to the buffer to the stream described by the stream data. ++ */ ++size_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count) { ++ ++ /* You ask for no bytes you'll get none :-) */ ++ if (!count) { ++ return 0; ++ } ++ ++ if (data->canonical) { ++ return dio_canonical_read((php_dio_win32_stream_data*)data, buf, count); ++ } else { ++ return dio_com_read(data, buf, count); ++ } ++} ++/* }}} */ ++ ++/* {{{ php_dio_stream_data ++ * Closes the php_stream. ++ */ ++int dio_common_close(php_dio_stream_data *data) { ++ php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; ++ ++ if (data->canonical) { ++ efree(wdata->canon_data); ++ } ++ ++ if (!CloseHandle(wdata->handle)) { ++ return 0; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_common_set_option ++ * Sets/gets stream options ++ */ ++int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam) { ++ COMMTIMEOUTS cto = { 0, 0, 0, 0, 0 }; ++ int old_is_blocking = 0; ++ ++ /* Can't do timeouts or non blocking with raw windows streams :-( */ ++ if (DIO_STREAM_TYPE_SERIAL == data->stream_type) { ++ switch (option) { ++ case PHP_STREAM_OPTION_BLOCKING: ++ old_is_blocking = data->is_blocking; ++ data->is_blocking = value ? 1 : 0; ++ ++ /* Only change values if we need to change them. */ ++ if (data->is_blocking != old_is_blocking) { ++ /* If we're not blocking but don't have a timeout ++ set to return immediately */ ++ if (!data->is_blocking && !data->has_timeout) { ++ cto.ReadIntervalTimeout = MAXDWORD; ++ } ++ ++ /* If we have a timeout ignore the blocking and set ++ the total time in which to read the data */ ++ if (data->has_timeout) { ++ cto.ReadIntervalTimeout = MAXDWORD; ++ cto.ReadTotalTimeoutMultiplier = MAXDWORD; ++ cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) + ++ (data->timeout_sec * 1000); ++ } ++ ++ if (!SetCommTimeouts(((php_dio_win32_stream_data*)data)->handle, &cto)) { ++ return PHP_STREAM_OPTION_RETURN_ERR; ++ } ++ } ++ return old_is_blocking ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR; ++ ++ case PHP_STREAM_OPTION_READ_TIMEOUT: ++ if (ptrparam) { ++ /* struct timeval is supported with PHP_WIN32 defined. */ ++ struct timeval *tv = (struct timeval*)ptrparam; ++ ++ /* A timeout of zero seconds and zero microseconds disables ++ any existing timeout. */ ++ if (tv->tv_sec || tv->tv_usec) { ++ data->timeout_sec = tv->tv_sec; ++ data->timeout_usec = tv->tv_usec; ++ data->has_timeout = -1; ++ ++ cto.ReadIntervalTimeout = MAXDWORD; ++ cto.ReadTotalTimeoutMultiplier = MAXDWORD; ++ cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) + ++ (data->timeout_sec * 1000); ++ } else { ++ data->timeout_sec = 0; ++ data->timeout_usec = 0; ++ data->has_timeout = 0; ++ data->timed_out = 0; ++ ++ /* If we're not blocking but don't have a timeout ++ set to return immediately */ ++ if (!data->is_blocking) { ++ cto.ReadIntervalTimeout = MAXDWORD; ++ } ++ } ++ ++ if (!SetCommTimeouts(((php_dio_win32_stream_data*)data)->handle, &cto)) { ++ return PHP_STREAM_OPTION_RETURN_ERR; ++ } else { ++ return PHP_STREAM_OPTION_RETURN_OK; ++ } ++ } else { ++ return PHP_STREAM_OPTION_RETURN_ERR; ++ } ++ ++ default: ++ break; ++ } ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_raw_open_stream ++ * Opens the underlying stream. ++ */ ++int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++ php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; ++ DWORD err; ++ ++ switch(*mode) { ++ case 'r': ++ wdata->creation_disposition = OPEN_EXISTING; ++ break; ++ case 'w': ++ wdata->creation_disposition = TRUNCATE_EXISTING; ++ break; ++ case 'a': ++ wdata->creation_disposition = OPEN_ALWAYS; ++ break; ++ case 'x': ++ wdata->creation_disposition = CREATE_NEW; ++ break; ++ } ++ mode ++; ++ ++ if (*mode && (*mode != '+')) { ++ mode++; ++ } ++ ++ if (*mode && (*mode == '+')) { ++ wdata->desired_access = GENERIC_READ | GENERIC_WRITE; ++ } else if (OPEN_EXISTING == wdata->creation_disposition) { ++ wdata->desired_access = GENERIC_READ; ++ } else { ++ wdata->desired_access = GENERIC_WRITE; ++ } ++ ++ wdata->handle = CreateFile(filename, wdata->desired_access, 0, ++ NULL, wdata->creation_disposition, FILE_ATTRIBUTE_NORMAL, NULL); ++ if (INVALID_HANDLE_VALUE == wdata->handle) { ++ err = GetLastError(); ++ switch (err) { ++ case ERROR_FILE_EXISTS: ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!"); ++ return 0; ++ ++ case ERROR_FILE_NOT_FOUND: ++ /* ERROR_FILE_NOT_FOUND with TRUNCATE_EXISTING means that ++ * the file doesn't exist so now try to create it. */ ++ if (TRUNCATE_EXISTING == wdata->creation_disposition) { ++ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "File does not exist, creating new file!"); ++ ++ wdata->handle = CreateFile(filename, wdata->desired_access, 0, ++ NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); ++ if (INVALID_HANDLE_VALUE == wdata->handle) { ++ dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC); ++ return 0; ++ } ++ } else { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "File not found!"); ++ return 0; ++ } ++ break; ++ ++ default: ++ dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC); ++ return 0; ++ } ++ } ++ ++ /* If canonical allocate the canonical buffer. */ ++ if (data->canonical) { ++ wdata->canon_data = emalloc(sizeof(php_dio_win32_canon_data)); ++ memset(wdata->canon_data, 0, sizeof(php_dio_win32_canon_data)); ++ wdata->canon_data->size = DIO_WIN32_CANON_BUF_SIZE; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_serial_init ++ * Initialises the serial port ++ */ ++static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) { ++ php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; ++ DWORD rate_def, data_bits_def, stop_bits_def, parity_def; ++ DCB dcb; ++ ++ if (!dio_data_rate_to_define(data->data_rate, &rate_def)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%d)", data->data_rate); ++ return 0; ++ } ++ ++ if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits); ++ return 0; ++ } ++ ++ if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits); ++ return 0; ++ } ++ ++ if (!dio_parity_to_define(data->parity, &parity_def)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity); ++ return 0; ++ } ++ ++ if (!GetCommState(wdata->handle, &(wdata->olddcb))) { ++ dio_last_error_php_error(E_WARNING, "GetCommState() failed:" TSRMLS_CC); ++ return 0; ++ } ++ ++ /* Init the DCB structure */ ++ memset(&dcb, 0, sizeof(DCB)); ++ dcb.DCBlength = sizeof(DCB); ++ ++ /* Set the communication parameters */ ++ dcb.fBinary = 1; ++ dcb.BaudRate = rate_def; ++ dcb.ByteSize = (BYTE)data_bits_def; ++ dcb.StopBits = (BYTE)stop_bits_def; ++ dcb.Parity = (BYTE)parity_def; ++ ++ /* Set the control line parameters */ ++ dcb.fDtrControl = DTR_CONTROL_DISABLE; ++ dcb.fDsrSensitivity = FALSE; ++ dcb.fOutxDsrFlow = FALSE; ++ dcb.fTXContinueOnXoff = FALSE; ++ dcb.fOutX = FALSE; ++ dcb.fInX = FALSE; ++ dcb.fErrorChar = FALSE; ++ dcb.fNull = FALSE; ++ dcb.fAbortOnError = FALSE; ++ ++ /* Hardware flow control */ ++ if (data->flow_control) { ++ dcb.fOutxCtsFlow = TRUE; ++ dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; ++ } else { ++ dcb.fOutxCtsFlow = FALSE; ++ dcb.fRtsControl = RTS_CONTROL_DISABLE; ++ } ++ ++ if (!SetCommState(wdata->handle, &dcb)) { ++ dio_last_error_php_error(E_WARNING, "SetCommState() failed:" TSRMLS_CC); ++ return 0; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++ ++/* {{{ dio_serial_uninit ++ * Restores the serial settings back to their original state. ++ */ ++int dio_serial_uninit(php_dio_stream_data *data) { ++ php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; ++ ++ if (!SetCommState(wdata->handle, &(wdata->olddcb))) { ++ return 0; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_serial_flush ++ * Purges the serial buffers of data. ++ */ ++int dio_serial_purge(php_dio_stream_data *data) { ++ php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; ++ BOOL ret; ++ ++ /* Purge the canonical buffer if required */ ++ if (data->canonical && ((wdata->desired_access & GENERIC_READ) == GENERIC_READ)) { ++ wdata->canon_data->read_pos = 0; ++ wdata->canon_data->write_pos = 0; ++ } ++ ++ /* Purge the com port */ ++ if ((wdata->desired_access & (GENERIC_READ|GENERIC_WRITE)) == (GENERIC_READ|GENERIC_WRITE)) { ++ ret = PurgeComm(wdata->handle, PURGE_RXCLEAR|PURGE_TXCLEAR); ++ } else if ((wdata->desired_access & GENERIC_WRITE) == GENERIC_WRITE) { ++ ret = PurgeComm(wdata->handle, PURGE_TXCLEAR); ++ } else if ((wdata->desired_access & GENERIC_READ) == GENERIC_READ) { ++ ret = PurgeComm(wdata->handle, PURGE_RXCLEAR); ++ } ++ ++ return ret; ++} ++/* }}} */ ++ ++/* {{{ dio_serial_open_stream ++ * Opens the underlying stream. ++ */ ++int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++ php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; ++ COMMTIMEOUTS cto = { 0, 0, 0, 0, 0 }; ++ ++ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Opening \"%s\" as a serial port (mode=\"%s\").", filename, mode); ++ ++ if (*mode != 'r') { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must open serial ports in read or read/write mode!"); ++ return 0; ++ } ++ ++ if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) { ++ return 0; ++ } ++ ++ if (!GetCommTimeouts(wdata->handle, &(wdata->oldcto))) { ++ dio_last_error_php_error(E_WARNING, "GetCommTimeouts() failed (Not a comm port?):" TSRMLS_CC); ++ CloseHandle(wdata->handle); ++ return 0; ++ } ++ ++ /* If we're not blocking but don't have a timeout ++ set to return immediately */ ++ if (!data->is_blocking && !data->has_timeout) { ++ cto.ReadIntervalTimeout = MAXDWORD; ++ } ++ ++ /* If we have a timeout ignore the blocking and set ++ the total time in which to read the data */ ++ if (data->has_timeout) { ++ cto.ReadIntervalTimeout = MAXDWORD; ++ cto.ReadTotalTimeoutMultiplier = MAXDWORD; ++ cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) + ++ (data->timeout_sec * 1000); ++ } ++ ++ if (!SetCommTimeouts(wdata->handle, &cto)) { ++ dio_last_error_php_error(E_WARNING, "SetCommTimeouts() failed:" TSRMLS_CC); ++ CloseHandle(wdata->handle); ++ return 0; ++ } ++ ++ if (!dio_serial_init(data TSRMLS_CC)) { ++ CloseHandle(wdata->handle); ++ return 0; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* ++ * Local variables: ++ * c-basic-offset: 4 ++ * tab-width: 4 ++ * End: ++ * vim600: fdm=marker ++ * vim: sw=4 ts=4 noet ++ */ +--- a/php_dio_posix.h ++++ b/php_dio_posix.h +@@ -1,70 +1,70 @@ +-/* +- +----------------------------------------------------------------------+ +- | PHP Version 5 | +- +----------------------------------------------------------------------+ +- | Copyright (c) 2009 Melanie Rhianna Lewis | +- +----------------------------------------------------------------------+ +- | This source file is subject to version 3.0 of the PHP license, | +- | that is bundled with this package in the file LICENSE, and is | +- | available through the world-wide-web at the following url: | +- | http://www.php.net/license/3_0.txt. | +- | If you did not receive a copy of the PHP license and are unable to | +- | obtain it through the world-wide-web, please send a note to | +- | license@php.net so we can mail you a copy immediately. | +- +----------------------------------------------------------------------+ +- | Author: Melanie Rhianna Lewis | +- +----------------------------------------------------------------------+ +- */ +- +-#ifndef PHP_DIO_POSIX_H_ +-#define PHP_DIO_POSIX_H_ +- +-#include +-#include +-#include +-#include +- +-#ifdef HAVE_UNISTD_H +-#include +-#endif +- +-#include +-#include +- +- +-/** ++/* ++ +----------------------------------------------------------------------+ ++ | PHP Version 5 | ++ +----------------------------------------------------------------------+ ++ | Copyright (c) 2009 Melanie Rhianna Lewis | ++ +----------------------------------------------------------------------+ ++ | This source file is subject to version 3.0 of the PHP license, | ++ | that is bundled with this package in the file LICENSE, and is | ++ | available through the world-wide-web at the following url: | ++ | http://www.php.net/license/3_0.txt. | ++ | If you did not receive a copy of the PHP license and are unable to | ++ | obtain it through the world-wide-web, please send a note to | ++ | license@php.net so we can mail you a copy immediately. | ++ +----------------------------------------------------------------------+ ++ | Author: Melanie Rhianna Lewis | ++ +----------------------------------------------------------------------+ ++ */ ++ ++#ifndef PHP_DIO_POSIX_H_ ++#define PHP_DIO_POSIX_H_ ++ ++#include ++#include ++#include ++#include ++ ++#ifdef HAVE_UNISTD_H ++#include ++#endif ++ ++#include ++#include ++ ++ ++/** + * Detect if we can support non blocking IO. +- */ +-#ifdef O_NONBLOCK +-#define DIO_NONBLOCK O_NONBLOCK +-#else +-#ifdef O_NDELAY +-#define DIO_NONBLOCK O_NDELAY +-#endif +-#endif +- +-/** ++ */ ++#ifdef O_NONBLOCK ++#define DIO_NONBLOCK O_NONBLOCK ++#else ++#ifdef O_NDELAY ++#define DIO_NONBLOCK O_NDELAY ++#endif ++#endif ++ ++/** + * POSIXy platforms have file permissions +- */ +-#define DIO_HAS_FILEPERMS +- +-#include "php_dio_common_data.h" +- +-typedef struct _php_dio_posix_stream_data { +- php_dio_stream_data common; +- int fd; +- int flags; +- /* Serial options */ +- struct termios oldtio; +-} php_dio_posix_stream_data ; +- +-#endif /* PHP_DIO_POSIX_H_ */ +- +-/* +- * Local variables: +- * c-basic-offset: 4 +- * tab-width: 4 +- * End: +- * vim600: fdm=marker +- * vim: sw=4 ts=4 noet +- */ ++ */ ++#define DIO_HAS_FILEPERMS ++ ++#include "php_dio_common_data.h" ++ ++typedef struct _php_dio_posix_stream_data { ++ php_dio_stream_data common; ++ int fd; ++ int flags; ++ /* Serial options */ ++ struct termios oldtio; ++} php_dio_posix_stream_data ; ++ ++#endif /* PHP_DIO_POSIX_H_ */ ++ ++/* ++ * Local variables: ++ * c-basic-offset: 4 ++ * tab-width: 4 ++ * End: ++ * vim600: fdm=marker ++ * vim: sw=4 ts=4 noet ++ */ +--- a/php_dio_win32.h ++++ b/php_dio_win32.h +@@ -1,62 +1,62 @@ +-/* +- +----------------------------------------------------------------------+ +- | PHP Version 5 | +- +----------------------------------------------------------------------+ +- | Copyright (c) 2009 Melanie Rhianna Lewis | +- +----------------------------------------------------------------------+ +- | This source file is subject to version 3.0 of the PHP license, | +- | that is bundled with this package in the file LICENSE, and is | +- | available through the world-wide-web at the following url: | +- | http://www.php.net/license/3_0.txt. | +- | If you did not receive a copy of the PHP license and are unable to | +- | obtain it through the world-wide-web, please send a note to | +- | license@php.net so we can mail you a copy immediately. | +- +----------------------------------------------------------------------+ +- | Author: Melanie Rhianna Lewis | +- +----------------------------------------------------------------------+ +- */ +- +-#ifndef PHP_DIO_WIN32_H_ +-#define PHP_DIO_WIN32_H_ +- +-#include +- +-/* Windows platform can do non blocking. */ +-#define DIO_NONBLOCK +- +-#include "php_dio_common_data.h" +- +-#define DIO_WIN32_CANON_BUF_SIZE 8192 +- +-/* This is the buffer information when reading in canonical mode. Data is +- read right up to either buffer being full or a newline being read. Excess +- data will be retained in the buffer until the next read. */ +-typedef struct _php_dio_win32_canon_data { +- size_t size; +- size_t read_pos; +- size_t write_pos; +- char buf[DIO_WIN32_CANON_BUF_SIZE]; +- +-} php_dio_win32_canon_data; +- +-typedef struct _php_dio_win32_stream_data { +- php_dio_stream_data common; +- HANDLE handle; +- DWORD desired_access; +- DWORD creation_disposition; +- DCB olddcb; +- COMMTIMEOUTS oldcto; +- php_dio_win32_canon_data *canon_data; +- +-} php_dio_win32_stream_data ; +- +-#endif /* PHP_DIO_WIN32_H_ */ +- +-/* +- * Local variables: +- * c-basic-offset: 4 +- * tab-width: 4 +- * End: +- * vim600: fdm=marker +- * vim: sw=4 ts=4 noet +- */ ++/* ++ +----------------------------------------------------------------------+ ++ | PHP Version 5 | ++ +----------------------------------------------------------------------+ ++ | Copyright (c) 2009 Melanie Rhianna Lewis | ++ +----------------------------------------------------------------------+ ++ | This source file is subject to version 3.0 of the PHP license, | ++ | that is bundled with this package in the file LICENSE, and is | ++ | available through the world-wide-web at the following url: | ++ | http://www.php.net/license/3_0.txt. | ++ | If you did not receive a copy of the PHP license and are unable to | ++ | obtain it through the world-wide-web, please send a note to | ++ | license@php.net so we can mail you a copy immediately. | ++ +----------------------------------------------------------------------+ ++ | Author: Melanie Rhianna Lewis | ++ +----------------------------------------------------------------------+ ++ */ ++ ++#ifndef PHP_DIO_WIN32_H_ ++#define PHP_DIO_WIN32_H_ ++ ++#include ++ ++/* Windows platform can do non blocking. */ ++#define DIO_NONBLOCK ++ ++#include "php_dio_common_data.h" ++ ++#define DIO_WIN32_CANON_BUF_SIZE 8192 ++ ++/* This is the buffer information when reading in canonical mode. Data is ++ read right up to either buffer being full or a newline being read. Excess ++ data will be retained in the buffer until the next read. */ ++typedef struct _php_dio_win32_canon_data { ++ size_t size; ++ size_t read_pos; ++ size_t write_pos; ++ char buf[DIO_WIN32_CANON_BUF_SIZE]; ++ ++} php_dio_win32_canon_data; ++ ++typedef struct _php_dio_win32_stream_data { ++ php_dio_stream_data common; ++ HANDLE handle; ++ DWORD desired_access; ++ DWORD creation_disposition; ++ DCB olddcb; ++ COMMTIMEOUTS oldcto; ++ php_dio_win32_canon_data *canon_data; ++ ++} php_dio_win32_stream_data ; ++ ++#endif /* PHP_DIO_WIN32_H_ */ ++ ++/* ++ * Local variables: ++ * c-basic-offset: 4 ++ * tab-width: 4 ++ * End: ++ * vim600: fdm=marker ++ * vim: sw=4 ts=4 noet ++ */ diff --git a/lang/php7-pecl-dio/patches/0001-fix-svn-prop.patch b/lang/php7-pecl-dio/patches/0001-fix-svn-prop.patch new file mode 100644 index 0000000..e8a56fb --- /dev/null +++ b/lang/php7-pecl-dio/patches/0001-fix-svn-prop.patch @@ -0,0 +1,32 @@ +From 46d3a1ff2c6e316cf0928a9fd403cb5284bfe863 Mon Sep 17 00:00:00 2001 +From: remi +Date: Wed, 9 Oct 2013 12:04:16 +0000 +Subject: [PATCH 01/16] fix svn prop + +git-svn-id: http://svn.php.net/repository/pecl/dio/trunk@331748 c90b9560-bf6c-de11-be94-00142212c4b1 +--- + dio_posix.c | 0 + dio_win32.c | 0 + php_dio_posix.h | 0 + php_dio_win32.h | 0 + 4 files changed, 0 insertions(+), 0 deletions(-) + mode change 100755 => 100644 dio_posix.c + mode change 100755 => 100644 dio_win32.c + mode change 100755 => 100644 php_dio_posix.h + mode change 100755 => 100644 php_dio_win32.h + +diff --git a/dio_posix.c b/dio_posix.c +old mode 100755 +new mode 100644 +diff --git a/dio_win32.c b/dio_win32.c +old mode 100755 +new mode 100644 +diff --git a/php_dio_posix.h b/php_dio_posix.h +old mode 100755 +new mode 100644 +diff --git a/php_dio_win32.h b/php_dio_win32.h +old mode 100755 +new mode 100644 +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0002-fix-Wunused-variable.patch b/lang/php7-pecl-dio/patches/0002-fix-Wunused-variable.patch new file mode 100644 index 0000000..6624174 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0002-fix-Wunused-variable.patch @@ -0,0 +1,39 @@ +From e9261081d447492e7eff3a22601b1de4f1ae550f Mon Sep 17 00:00:00 2001 +From: remi +Date: Wed, 9 Oct 2013 12:15:51 +0000 +Subject: [PATCH 02/16] fix [-Wunused-variable] + +git-svn-id: http://svn.php.net/repository/pecl/dio/trunk@331749 c90b9560-bf6c-de11-be94-00142212c4b1 +--- + dio.c | 2 +- + dio_posix.c | 1 - + 2 files changed, 1 insertion(+), 2 deletions(-) + +diff --git a/dio.c b/dio.c +index e400cf0..408a171 100644 +--- a/dio.c ++++ b/dio.c +@@ -775,7 +775,7 @@ ZEND_BEGIN_ARG_INFO_EX(dio_serial_args, 0, 0, 2) + ZEND_ARG_INFO(0, options) + ZEND_END_ARG_INFO() + +-static zend_object_handlers dio_raw_object_handlers; ++// not used static zend_object_handlers dio_raw_object_handlers; + + static zend_function_entry dio_functions[] = { + /* Class functions. */ +diff --git a/dio_posix.c b/dio_posix.c +index 16fb3d6..01e1109 100644 +--- a/dio_posix.c ++++ b/dio_posix.c +@@ -266,7 +266,6 @@ size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count + * earlier than early time. + */ + static int dio_timeval_subtract(struct timeval *late, struct timeval *early, struct timeval *diff) { +- struct timeval *tmp; + + /* Handle negatives */ + if (late->tv_sec < early->tv_sec) { +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0003-Fix-Wmaybe-uninitialized.patch b/lang/php7-pecl-dio/patches/0003-Fix-Wmaybe-uninitialized.patch new file mode 100644 index 0000000..21f4cff --- /dev/null +++ b/lang/php7-pecl-dio/patches/0003-Fix-Wmaybe-uninitialized.patch @@ -0,0 +1,39 @@ +From 6cbc1651b6b6f865f9aae1e9adff73743298666f Mon Sep 17 00:00:00 2001 +From: remi +Date: Wed, 9 Oct 2013 12:18:34 +0000 +Subject: [PATCH 03/16] Fix [-Wmaybe-uninitialized] + +git-svn-id: http://svn.php.net/repository/pecl/dio/trunk@331750 c90b9560-bf6c-de11-be94-00142212c4b1 +--- + dio_stream_wrappers.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/dio_stream_wrappers.c b/dio_stream_wrappers.c +index 844b006..811bc07 100644 +--- a/dio_stream_wrappers.c ++++ b/dio_stream_wrappers.c +@@ -228,9 +228,8 @@ PHP_FUNCTION(dio_raw) { + efree(data); + RETURN_FALSE; + } ++ php_stream_to_zval(stream, return_value); + } +- +- php_stream_to_zval(stream, return_value); + } + /* }}} */ + +@@ -390,9 +389,8 @@ PHP_FUNCTION(dio_serial) { + efree(data); + RETURN_FALSE; + } ++ php_stream_to_zval(stream, return_value); + } +- +- php_stream_to_zval(stream, return_value); + } + /* }}} */ + +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0004-Fix-last-build-warning-Wunused-but-set-variable-sorr.patch b/lang/php7-pecl-dio/patches/0004-Fix-last-build-warning-Wunused-but-set-variable-sorr.patch new file mode 100644 index 0000000..ba69d22 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0004-Fix-last-build-warning-Wunused-but-set-variable-sorr.patch @@ -0,0 +1,42 @@ +From 1e6f98d9fb65b9c052e6d555eab573d7e5073dae Mon Sep 17 00:00:00 2001 +From: remi +Date: Wed, 9 Oct 2013 12:24:28 +0000 +Subject: [PATCH 04/16] Fix last build warning [-Wunused-but-set-variable] + (sorry for legibility...) + +git-svn-id: http://svn.php.net/repository/pecl/dio/trunk@331751 c90b9560-bf6c-de11-be94-00142212c4b1 +--- + dio_posix.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/dio_posix.c b/dio_posix.c +index 01e1109..6ed8630 100644 +--- a/dio_posix.c ++++ b/dio_posix.c +@@ -28,7 +28,10 @@ + * Convert an fopen() mode string to open() flags + */ + static int dio_stream_mode_to_flags(const char *mode) { +- int flags = 0, ch = 0, bin = 1; ++ int flags = 0, ch = 0; ++#if defined(_O_TEXT) && defined(O_BINARY) ++ int bin = 1; ++#endif + + switch(mode[ch++]) { + case 'r': +@@ -45,9 +48,11 @@ static int dio_stream_mode_to_flags(const char *mode) { + break; + } + ++#if defined(_O_TEXT) && defined(O_BINARY) + if (mode[ch] != '+') { + bin = (mode[ch++] == 'b'); + } ++#endif + + if (mode[ch] == '+') { + flags |= O_RDWR; +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0005-Added-LICENCE-file-as-requested-in-Request-65869.patch b/lang/php7-pecl-dio/patches/0005-Added-LICENCE-file-as-requested-in-Request-65869.patch new file mode 100644 index 0000000..fc9961a --- /dev/null +++ b/lang/php7-pecl-dio/patches/0005-Added-LICENCE-file-as-requested-in-Request-65869.patch @@ -0,0 +1,91 @@ +From 7c85a44880d9d748e7554f8fe7448505fa86aa28 Mon Sep 17 00:00:00 2001 +From: cyberspice +Date: Sat, 12 Oct 2013 22:20:19 +0000 +Subject: [PATCH 05/16] Added LICENCE file as requested in Request #65869 + +Files added: + LICENCE + +git-svn-id: http://svn.php.net/repository/pecl/dio/trunk@331788 c90b9560-bf6c-de11-be94-00142212c4b1 +--- + LICENSE | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 68 insertions(+) + create mode 100644 LICENSE + +diff --git a/LICENSE b/LICENSE +new file mode 100644 +index 0000000..d376afe +--- /dev/null ++++ b/LICENSE +@@ -0,0 +1,68 @@ ++-------------------------------------------------------------------- ++ The PHP License, version 3.01 ++Copyright (c) 2008 - 2013 The PHP Group. All rights reserved. ++-------------------------------------------------------------------- ++ ++Redistribution and use in source and binary forms, with or without ++modification, is permitted provided that the following conditions ++are met: ++ ++ 1. Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ ++ 2. Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in ++ the documentation and/or other materials provided with the ++ distribution. ++ ++ 3. The name "PHP" must not be used to endorse or promote products ++ derived from this software without prior written permission. For ++ written permission, please contact group@php.net. ++ ++ 4. Products derived from this software may not be called "PHP", nor ++ may "PHP" appear in their name, without prior written permission ++ from group@php.net. You may indicate that your software works in ++ conjunction with PHP by saying "Foo for PHP" instead of calling ++ it "PHP Foo" or "phpfoo" ++ ++ 5. The PHP Group may publish revised and/or new versions of the ++ license from time to time. Each version will be given a ++ distinguishing version number. ++ Once covered code has been published under a particular version ++ of the license, you may always continue to use it under the terms ++ of that version. You may also choose to use such covered code ++ under the terms of any subsequent version of the license ++ published by the PHP Group. No one other than the PHP Group has ++ the right to modify the terms applicable to covered code created ++ under this License. ++ ++ 6. Redistributions of any form whatsoever must retain the following ++ acknowledgment: ++ "This product includes PHP software, freely available from ++ ". ++ ++THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND ++ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ++PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP ++DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, ++INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, ++STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED ++OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++-------------------------------------------------------------------- ++ ++This software consists of voluntary contributions made by many ++individuals on behalf of the PHP Group. ++ ++The PHP Group can be contacted via Email at group@php.net. ++ ++For more information on the PHP Group and the PHP project, ++please see . ++ ++PHP includes the Zend Engine, freely available at ++. +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0006-Replace-ZEND_FETCH_RESOURCE-macro-with-zend_fetch_re.patch b/lang/php7-pecl-dio/patches/0006-Replace-ZEND_FETCH_RESOURCE-macro-with-zend_fetch_re.patch new file mode 100644 index 0000000..6d9c483 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0006-Replace-ZEND_FETCH_RESOURCE-macro-with-zend_fetch_re.patch @@ -0,0 +1,117 @@ +From b69e1067f70ef293587b72979193e68b01d90902 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Wed, 13 Jul 2016 00:23:29 +0200 +Subject: [PATCH 06/16] Replace ZEND_FETCH_RESOURCE macro with + zend_fetch_resource + +Signed-off-by: Michael Heimpold +--- + dio.c | 36 +++++++++++++++++++++++++++--------- + 1 file changed, 27 insertions(+), 9 deletions(-) + +diff --git a/dio.c b/dio.c +index 408a171..6b687ac 100644 +--- a/dio.c ++++ b/dio.c +@@ -161,7 +161,9 @@ PHP_FUNCTION(dio_dup) + return; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + dfd = dup(f->fd); + if (dfd == -1) { +@@ -192,7 +194,9 @@ PHP_FUNCTION(dio_read) + return; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + if (bytes <= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0."); +@@ -233,7 +237,9 @@ PHP_FUNCTION(dio_write) + RETURN_FALSE; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + res = write(f->fd, data, trunc_len ? trunc_len : data_len); + if (res == -1) { +@@ -258,7 +264,9 @@ PHP_FUNCTION(dio_truncate) + return; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + if (ftruncate(f->fd, offset) == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "couldn't truncate %d to %ld bytes: %s", f->fd, offset, strerror(errno)); +@@ -284,7 +292,9 @@ PHP_FUNCTION(dio_stat) + return; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + if (fstat(f->fd, &s) == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot stat %d: %s", f->fd, strerror(errno)); +@@ -323,7 +333,9 @@ PHP_FUNCTION(dio_seek) + return; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + RETURN_LONG(lseek(f->fd, offset, whence)); + } +@@ -344,7 +356,9 @@ PHP_FUNCTION(dio_fcntl) + return; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + switch (cmd) { + case F_SETLK: +@@ -454,7 +468,9 @@ PHP_FUNCTION(dio_tcsetattr) + return; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + if (Z_TYPE_P(arg) != IS_ARRAY) { + php_error_docref(NULL TSRMLS_CC, E_WARNING,"tcsetattr, third argument should be an associative array"); +@@ -639,7 +655,9 @@ PHP_FUNCTION(dio_close) + return; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + zend_list_delete(Z_LVAL_P(r_fd)); + } +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0007-Replace-ZEND_REGISTER_RESOURCE-with-zend_register_re.patch b/lang/php7-pecl-dio/patches/0007-Replace-ZEND_REGISTER_RESOURCE-with-zend_register_re.patch new file mode 100644 index 0000000..c676a25 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0007-Replace-ZEND_REGISTER_RESOURCE-with-zend_register_re.patch @@ -0,0 +1,66 @@ +From dbf03eb09bf1a41bcd140c4edba351121ac24729 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Wed, 13 Jul 2016 00:36:46 +0200 +Subject: [PATCH 07/16] Replace ZEND_REGISTER_RESOURCE with + zend_register_resource + +Signed-off-by: Michael Heimpold +--- + dio.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/dio.c b/dio.c +index 6b687ac..6f2d58c 100644 +--- a/dio.c ++++ b/dio.c +@@ -72,9 +72,9 @@ static int new_php_fd(php_fd_t **f, int fd) + return 1; + } + +-static void _dio_close_fd(zend_rsrc_list_entry *rsrc TSRMLS_DC) ++static void _dio_close_fd(zend_resource *res) + { +- php_fd_t *f = (php_fd_t *) rsrc->ptr; ++ php_fd_t *f = (php_fd_t *)zend_fetch_resource(res, NULL, le_fd); + if (f) { + close(f->fd); + free(f); +@@ -115,7 +115,7 @@ PHP_FUNCTION(dio_open) + RETURN_FALSE; + } + +- ZEND_REGISTER_RESOURCE(return_value, f, le_fd); ++ RETVAL_RES(zend_register_resource(f, le_fd)); + } + /* }}} */ + +@@ -144,7 +144,7 @@ PHP_FUNCTION(dio_fdopen) + RETURN_FALSE; + } + +- ZEND_REGISTER_RESOURCE(return_value, f, le_fd); ++ RETVAL_RES(zend_register_resource(f, le_fd)); + } + /* }}} */ + +@@ -175,7 +175,7 @@ PHP_FUNCTION(dio_dup) + RETURN_FALSE; + } + +- ZEND_REGISTER_RESOURCE(return_value, df, le_fd); ++ RETVAL_RES(zend_register_resource(f, le_fd)); + } + /* }}} */ + #endif +@@ -434,7 +434,7 @@ PHP_FUNCTION(dio_fcntl) + if (!new_php_fd(&new_f, fcntl(f->fd, cmd, Z_LVAL_P(arg)))) { + RETURN_FALSE; + } +- ZEND_REGISTER_RESOURCE(return_value, new_f, le_fd); ++ RETVAL_RES(zend_register_resource(new_f, le_fd)); + break; + } + default: +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0008-RETURN_STRINGL-takes-only-2-arguments.patch b/lang/php7-pecl-dio/patches/0008-RETURN_STRINGL-takes-only-2-arguments.patch new file mode 100644 index 0000000..2197d12 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0008-RETURN_STRINGL-takes-only-2-arguments.patch @@ -0,0 +1,34 @@ +From 47422cf01f0a352c3f5f015585a28c99dba79862 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Wed, 13 Jul 2016 00:40:08 +0200 +Subject: [PATCH 08/16] RETURN_STRINGL takes only 2 arguments + +Signed-off-by: Michael Heimpold +--- + dio.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/dio.c b/dio.c +index 6f2d58c..e8660f8 100644 +--- a/dio.c ++++ b/dio.c +@@ -24,6 +24,7 @@ + #include "php.h" + #include "php_ini.h" + #include "ext/standard/info.h" ++#include "ext/standard/php_string.h" + + #include "php_dio.h" + #include "php_dio_stream_wrappers.h" +@@ -213,7 +214,7 @@ PHP_FUNCTION(dio_read) + data = erealloc(data, res + 1); + data[res] = 0; + +- RETURN_STRINGL(data, res, 0); ++ RETURN_STRINGL(data, res); + } + /* }}} */ + +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0009-Replace-zend_hash_find-with-zend_hash_str_find.patch b/lang/php7-pecl-dio/patches/0009-Replace-zend_hash_find-with-zend_hash_str_find.patch new file mode 100644 index 0000000..85a8a07 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0009-Replace-zend_hash_find-with-zend_hash_str_find.patch @@ -0,0 +1,125 @@ +From 7533f64b19006262fae7c6a4769392c67078166b Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Wed, 13 Jul 2016 01:07:22 +0200 +Subject: [PATCH 09/16] Replace zend_hash_find with zend_hash_str_find + +Signed-off-by: Michael Heimpold +--- + dio.c | 44 ++++++++++++++++++++++---------------------- + 1 file changed, 22 insertions(+), 22 deletions(-) + +diff --git a/dio.c b/dio.c +index e8660f8..b489747 100644 +--- a/dio.c ++++ b/dio.c +@@ -364,7 +364,7 @@ PHP_FUNCTION(dio_fcntl) + switch (cmd) { + case F_SETLK: + case F_SETLKW: { +- zval **element; ++ zval *element; + struct flock lk = {0}; + HashTable *fh; + +@@ -374,28 +374,28 @@ PHP_FUNCTION(dio_fcntl) + } + if (Z_TYPE_P(arg) == IS_ARRAY) { + fh = HASH_OF(arg); +- if (zend_hash_find(fh, "start", sizeof("start"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "start", sizeof("start"))) == NULL) { + lk.l_start = 0; + } else { +- lk.l_start = Z_LVAL_PP(element); ++ lk.l_start = Z_LVAL_P(element); + } + +- if (zend_hash_find(fh, "length", sizeof("length"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "length", sizeof("length"))) == NULL) { + lk.l_len = 0; + } else { +- lk.l_len = Z_LVAL_PP(element); ++ lk.l_len = Z_LVAL_P(element); + } + +- if (zend_hash_find(fh, "whence", sizeof("whence"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "whence", sizeof("whence"))) == NULL) { + lk.l_whence = 0; + } else { +- lk.l_whence = Z_LVAL_PP(element); ++ lk.l_whence = Z_LVAL_P(element); + } + +- if (zend_hash_find(fh, "type", sizeof("type"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "type", sizeof("type"))) == NULL) { + lk.l_type = 0; + } else { +- lk.l_type = Z_LVAL_PP(element); ++ lk.l_type = Z_LVAL_P(element); + } + } else if (Z_TYPE_P(arg) == IS_LONG) { + lk.l_start = 0; +@@ -463,7 +463,7 @@ PHP_FUNCTION(dio_tcsetattr) + int Baud_Rate, Data_Bits=8, Stop_Bits=1, Parity=0, Flow_Control=1, Is_Canonical=1; + long BAUD,DATABITS,STOPBITS,PARITYON,PARITY; + HashTable *fh; +- zval **element; ++ zval *element; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz", &r_fd, &arg) == FAILURE) { + return; +@@ -480,40 +480,40 @@ PHP_FUNCTION(dio_tcsetattr) + + fh = HASH_OF(arg); + +- if (zend_hash_find(fh, "baud", sizeof("baud"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "baud", sizeof("baud"))) == NULL) { + Baud_Rate = 9600; + } else { +- Baud_Rate = Z_LVAL_PP(element); ++ Baud_Rate = Z_LVAL_P(element); + } + +- if (zend_hash_find(fh, "bits", sizeof("bits"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "bits", sizeof("bits"))) == NULL) { + Data_Bits = 8; + } else { +- Data_Bits = Z_LVAL_PP(element); ++ Data_Bits = Z_LVAL_P(element); + } + +- if (zend_hash_find(fh, "stop", sizeof("stop"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "stop", sizeof("stop"))) == NULL) { + Stop_Bits = 1; + } else { +- Stop_Bits = Z_LVAL_PP(element); ++ Stop_Bits = Z_LVAL_P(element); + } + +- if (zend_hash_find(fh, "parity", sizeof("parity"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "parity", sizeof("parity"))) == NULL) { + Parity = 0; + } else { +- Parity = Z_LVAL_PP(element); ++ Parity = Z_LVAL_P(element); + } + +- if (zend_hash_find(fh, "flow_control", sizeof("flow_control"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "flow_control", sizeof("flow_control"))) == NULL) { + Flow_Control = 1; + } else { +- Flow_Control = Z_LVAL_PP(element); ++ Flow_Control = Z_LVAL_P(element); + } + +- if (zend_hash_find(fh, "is_canonical", sizeof("is_canonical"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "is_canonical", sizeof("is_canonical"))) == NULL) { + Is_Canonical = 0; + } else { +- Is_Canonical = Z_LVAL_PP(element); ++ Is_Canonical = Z_LVAL_P(element); + } + + /* assign to correct values... */ +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0010-Replace-dio_convert_to_long.patch b/lang/php7-pecl-dio/patches/0010-Replace-dio_convert_to_long.patch new file mode 100644 index 0000000..b5d7b61 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0010-Replace-dio_convert_to_long.patch @@ -0,0 +1,240 @@ +From fb31b1cf4da2bfd0830d0a83754f5ecb125d1c4a Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Thu, 14 Jul 2016 00:38:52 +0200 +Subject: [PATCH 10/16] Replace dio_convert_to_long + +Signed-off-by: Michael Heimpold +--- + dio_common.c | 106 +++++++++++++++++++++++-------------------------------- + php_dio_common.h | 2 -- + 2 files changed, 44 insertions(+), 64 deletions(-) + +diff --git a/dio_common.c b/dio_common.c +index c50f56d..a5f4c63 100644 +--- a/dio_common.c ++++ b/dio_common.c +@@ -52,29 +52,12 @@ void dio_init_stream_data(php_dio_stream_data *data) { + } + /* }}} */ + +-/* {{{ dio_convert_to_long +- * Returns as a long, the value of the zval regardless of its type. +- */ +-long dio_convert_to_long(zval *val) { +- zval *copyval; +- long longval; +- +- ALLOC_INIT_ZVAL(copyval); +- *copyval = *val; +- convert_to_long(copyval); +- longval = Z_LVAL_P(copyval); +- zval_ptr_dtor(©val); +- +- return longval; +-} +-/* }}} */ +- + /* {{{ dio_assoc_array_get_basic_options + * Retrieves the basic open option values from an associative array + */ + void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data TSRMLS_DC) { + #if defined(DIO_HAS_FILEPERMS) || defined(DIO_NONBLOCK) +- zval **tmpzval; ++ zval *tmpzval; + HashTable *opthash; + + opthash = HASH_OF(options); +@@ -82,8 +65,8 @@ void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data + + #ifdef DIO_HAS_FILEPERMS + /* This is the file mode flags used by open(). */ +- if (zend_hash_find(opthash, "perms", sizeof("perms"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->perms = (int)dio_convert_to_long(*tmpzval); ++ if ((tmpzval = zend_hash_str_find(opthash, "perms", sizeof("perms"))) != NULL) { ++ data->perms = (int)zval_get_long(tmpzval); + data->has_perms = 1; + } + #endif +@@ -91,20 +74,20 @@ void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data + #ifdef DIO_NONBLOCK + /* This sets the underlying stream to be blocking/non + block (i.e. O_NONBLOCK) */ +- if (zend_hash_find(opthash, "is_blocking", sizeof("is_blocking"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->is_blocking = dio_convert_to_long(*tmpzval) ? 1 : 0; ++ if ((tmpzval = zend_hash_str_find(opthash, "is_blocking", sizeof("is_blocking"))) != NULL) { ++ data->is_blocking = zval_get_long(tmpzval) ? 1 : 0; + } + + /* This is the timeout value for reads in seconds. Only one of + timeout_secs or timeout_usecs need be defined to define a timeout. */ +- if (zend_hash_find(opthash, "timeout_secs", sizeof("timeout_secs"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->timeout_sec = dio_convert_to_long(*tmpzval); ++ if ((tmpzval = zend_hash_str_find(opthash, "timeout_secs", sizeof("timeout_secs"))) != NULL) { ++ data->timeout_sec = zval_get_long(tmpzval); + } + + /* This is the timeout value for reads in microseconds. Only one of + timeout_secs or timeout_usecs need be defined to define a timeout. */ +- if (zend_hash_find(opthash, "timeout_usecs", sizeof("timeout_usecs"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->timeout_usec = dio_convert_to_long(*tmpzval); ++ if ((tmpzval = zend_hash_str_find(opthash, "timeout_usecs", sizeof("timeout_usecs"))) != NULL) { ++ data->timeout_usec = zval_get_long(tmpzval); + } + + data->has_timeout = (data->timeout_sec | data->timeout_usec) ? 1 : 0; +@@ -116,33 +99,33 @@ void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data + * Retrieves the serial open option values from an associative array + */ + void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data TSRMLS_DC) { +- zval **tmpzval; ++ zval *tmpzval; + HashTable *opthash; + + opthash = HASH_OF(options); + +- if (zend_hash_find(opthash, "data_rate", sizeof("data_rate"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->data_rate = dio_convert_to_long(*tmpzval); ++ if ((tmpzval = zend_hash_str_find(opthash, "data_rate", sizeof("data_rate"))) != NULL) { ++ data->data_rate = zval_get_long(tmpzval); + } + +- if (zend_hash_find(opthash, "data_bits", sizeof("data_bits"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->data_bits = (int)dio_convert_to_long(*tmpzval); ++ if ((tmpzval = zend_hash_str_find(opthash, "data_bits", sizeof("data_bits"))) != NULL) { ++ data->data_bits = (int)zval_get_long(tmpzval); + } + +- if (zend_hash_find(opthash, "stop_bits", sizeof("stop_bits"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->stop_bits = (int)dio_convert_to_long(*tmpzval); ++ if ((tmpzval = zend_hash_str_find(opthash, "stop_bits", sizeof("stop_bits"))) != NULL) { ++ data->stop_bits = (int)zval_get_long(tmpzval); + } + +- if (zend_hash_find(opthash, "parity", sizeof("parity"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->parity = (int)dio_convert_to_long(*tmpzval); ++ if ((tmpzval = zend_hash_str_find(opthash, "parity", sizeof("parity"))) != NULL) { ++ data->parity = (int)zval_get_long(tmpzval); + } + +- if (zend_hash_find(opthash, "flow_control", sizeof("flow_control"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->flow_control = (int)(dio_convert_to_long(*tmpzval) ? 1 : 0); ++ if ((tmpzval = zend_hash_str_find(opthash, "flow_control", sizeof("flow_control"))) != NULL) { ++ data->flow_control = zval_get_long(tmpzval) ? 1 : 0; + } + +- if (zend_hash_find(opthash, "is_canonical", sizeof("is_canonical"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->canonical = (int)(dio_convert_to_long(*tmpzval) ? 1 : 0); ++ if ((tmpzval = zend_hash_str_find(opthash, "is_canonical", sizeof("is_canonical"))) != NULL) { ++ data->canonical = zval_get_long(tmpzval) ? 1 : 0; + } + } + /* }}} */ +@@ -152,13 +135,13 @@ void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data + */ + void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC) { + #if defined(DIO_HAS_FILEPERMS) || defined(DIO_NONBLOCK) +- zval **tmpzval; ++ zval *tmpzval; + #endif + + #ifdef DIO_HAS_FILEPERMS + /* This is the file mode flags used by open(). */ +- if (php_stream_context_get_option(context, "dio", "perms", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->perms = (int)dio_convert_to_long(*tmpzval); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "perms")) != NULL) { ++ data->perms = (int)zval_get_long(tmpzval); + data->has_perms = 1; + } + #endif +@@ -166,20 +149,20 @@ void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_s + #ifdef DIO_NONBLOCK + /* This sets the underlying stream to be blocking/non + block (i.e. O_NONBLOCK) */ +- if (php_stream_context_get_option(context, "dio", "is_blocking", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->is_blocking = dio_convert_to_long(*tmpzval) ? 1 : 0; ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "is_blocking")) != NULL) { ++ data->is_blocking = zval_get_long(tmpzval) ? 1 : 0; + } + + /* This is the timeout value for reads in seconds. Only one of + timeout_secs or timeout_usecs need be defined to define a timeout. */ +- if (php_stream_context_get_option(context, "dio", "timeout_secs", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->timeout_sec = dio_convert_to_long(*tmpzval); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "timeout_secs")) != NULL) { ++ data->timeout_sec = zval_get_long(tmpzval); + } + + /* This is the timeout value for reads in microseconds. Only one of + timeout_secs or timeout_usecs need be defined to define a timeout. */ +- if (php_stream_context_get_option(context, "dio", "timeout_usecs", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->timeout_usec = dio_convert_to_long(*tmpzval); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "timeout_usecs")) != NULL) { ++ data->timeout_usec = zval_get_long(tmpzval); + } + + data->has_timeout = (data->timeout_sec | data->timeout_usec) ? 1 : 0; +@@ -191,30 +174,30 @@ void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_s + * Extracts the option values for dio.serial mode from a context + */ + void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC) { +- zval **tmpzval; ++ zval *tmpzval; + +- if (php_stream_context_get_option(context, "dio", "data_rate", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->data_rate = dio_convert_to_long(*tmpzval); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "data_rate")) != NULL) { ++ data->data_rate = zval_get_long(tmpzval); + } + +- if (php_stream_context_get_option(context, "dio", "data_bits", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->data_bits = (int)dio_convert_to_long(*tmpzval); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "data_bits")) != NULL) { ++ data->data_bits = (int)zval_get_long(tmpzval); + } + +- if (php_stream_context_get_option(context, "dio", "stop_bits", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->stop_bits = (int)dio_convert_to_long(*tmpzval); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "stop_bits")) != NULL) { ++ data->stop_bits = (int)zval_get_long(tmpzval); + } + +- if (php_stream_context_get_option(context, "dio", "parity", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->parity = (int)dio_convert_to_long(*tmpzval); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "parity")) != NULL) { ++ data->parity = (int)zval_get_long(tmpzval); + } + +- if (php_stream_context_get_option(context, "dio", "flow_control", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->flow_control = (int)(dio_convert_to_long(*tmpzval) ? 1 : 0); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "flow_control")) != NULL) { ++ data->flow_control = zval_get_long(tmpzval) ? 1 : 0; + } + +- if (php_stream_context_get_option(context, "dio", "is_canonical", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->canonical = (int)(dio_convert_to_long(*tmpzval) ? 1 : 0); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "is_canonical")) != NULL) { ++ data->canonical = zval_get_long(tmpzval) ? 1 : 0; + } + } + /* }}} */ +@@ -227,4 +210,3 @@ void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_ + * vim600: fdm=marker + * vim: sw=4 ts=4 noet + */ +- +diff --git a/php_dio_common.h b/php_dio_common.h +index f6e4d98..6b14040 100644 +--- a/php_dio_common.h ++++ b/php_dio_common.h +@@ -35,8 +35,6 @@ + #define DIO_STREAM_TYPE_RAW 1 + #define DIO_STREAM_TYPE_SERIAL 2 + +-long dio_convert_to_long(zval *val); +- + php_dio_stream_data * dio_create_stream_data(void); + + void dio_init_stream_data(php_dio_stream_data *data); +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0011-Adopt-to-changed-stream-API-interface.patch b/lang/php7-pecl-dio/patches/0011-Adopt-to-changed-stream-API-interface.patch new file mode 100644 index 0000000..dde8565 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0011-Adopt-to-changed-stream-API-interface.patch @@ -0,0 +1,89 @@ +From 3d71063ada4f1a4ef90611d263aa8e1d4f275359 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Thu, 14 Jul 2016 00:50:12 +0200 +Subject: [PATCH 11/16] Adopt to changed stream API interface + +Signed-off-by: Michael Heimpold +--- + dio_posix.c | 2 +- + dio_stream_wrappers.c | 14 +++++++------- + dio_win32.c | 2 +- + php_dio_common.h | 2 +- + 4 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/dio_posix.c b/dio_posix.c +index 6ed8630..527d683 100644 +--- a/dio_posix.c ++++ b/dio_posix.c +@@ -474,7 +474,7 @@ int dio_common_set_option(php_dio_stream_data *data, int option, int value, void + /* {{{ dio_raw_open_stream + * Opens the underlying stream. + */ +-int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { + php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; + pdata->flags = dio_stream_mode_to_flags(mode); + +diff --git a/dio_stream_wrappers.c b/dio_stream_wrappers.c +index 811bc07..817b0d1 100644 +--- a/dio_stream_wrappers.c ++++ b/dio_stream_wrappers.c +@@ -126,12 +126,12 @@ php_stream_ops dio_raw_stream_ops = { + * fopen for the dio.raw stream. + */ + static php_stream *dio_raw_fopen_wrapper(php_stream_wrapper *wrapper, +- char *path, char *mode, +- int options, char **opened_path, +- php_stream_context *context STREAMS_DC TSRMLS_DC) { ++ const char *path, const char *mode, int options, ++ zend_string **opened_path, php_stream_context *context STREAMS_DC) ++{ + php_dio_stream_data *data; + php_stream *stream; +- char *filename; ++ const char *filename; + + /* Check it was actually for us (not a corrupted function pointer + somewhere!). */ +@@ -287,9 +287,9 @@ php_stream_ops dio_serial_stream_ops = { + * fopen for the dio.raw stream. + */ + static php_stream *dio_serial_fopen_wrapper(php_stream_wrapper *wrapper, +- char *path, char *mode, +- int options, char **opened_path, +- php_stream_context *context STREAMS_DC TSRMLS_DC) { ++ const char *path, const char *mode, int options, ++ zend_string **opened_path, php_stream_context *context STREAMS_DC) ++{ + php_dio_stream_data *data; + php_stream *stream; + char *filename; +diff --git a/dio_win32.c b/dio_win32.c +index e7ccedd..1023d36 100644 +--- a/dio_win32.c ++++ b/dio_win32.c +@@ -505,7 +505,7 @@ int dio_common_set_option(php_dio_stream_data *data, int option, int value, void + /* {{{ dio_raw_open_stream + * Opens the underlying stream. + */ +-int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { + php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; + DWORD err; + +diff --git a/php_dio_common.h b/php_dio_common.h +index 6b14040..7a75370 100644 +--- a/php_dio_common.h ++++ b/php_dio_common.h +@@ -55,7 +55,7 @@ int dio_common_close(php_dio_stream_data *data); + + int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam); + +-int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC); ++int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC); + + int dio_serial_uninit(php_dio_stream_data *data); + +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0012-Remove-ancient-macros-TSRMLS_CC-and-TSRMLS_DC.patch b/lang/php7-pecl-dio/patches/0012-Remove-ancient-macros-TSRMLS_CC-and-TSRMLS_DC.patch new file mode 100644 index 0000000..c15fd89 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0012-Remove-ancient-macros-TSRMLS_CC-and-TSRMLS_DC.patch @@ -0,0 +1,829 @@ +From 760ec7072cbba2cbbb6e4e17b0c54ee3c7b661a8 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Thu, 14 Jul 2016 00:59:42 +0200 +Subject: [PATCH 12/16] Remove ancient macros TSRMLS_CC and TSRMLS_DC + +Signed-off-by: Michael Heimpold +--- + dio.c | 70 +++++++++++++++++++++++++-------------------------- + dio_common.c | 8 +++--- + dio_posix.c | 22 ++++++++-------- + dio_stream_wrappers.c | 48 +++++++++++++++++------------------ + dio_win32.c | 46 ++++++++++++++++----------------- + php_dio_common.h | 12 ++++----- + 6 files changed, 103 insertions(+), 103 deletions(-) + +diff --git a/dio.c b/dio.c +index b489747..7bad575 100644 +--- a/dio.c ++++ b/dio.c +@@ -93,11 +93,11 @@ PHP_FUNCTION(dio_open) + long mode = 0; + int fd; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", &file_name, &file_name_length, &flags, &mode) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l", &file_name, &file_name_length, &flags, &mode) == FAILURE) { + return; + } + +- if (php_check_open_basedir(file_name TSRMLS_CC) || DIO_SAFE_MODE_CHECK(file_name, "wb+")) { ++ if (php_check_open_basedir(file_name) || DIO_SAFE_MODE_CHECK(file_name, "wb+")) { + RETURN_FALSE; + } + +@@ -108,7 +108,7 @@ PHP_FUNCTION(dio_open) + } + + if (fd == -1) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot open file %s with flags %ld and permissions %ld: %s", file_name, flags, mode, strerror(errno)); ++ php_error_docref(NULL, E_WARNING, "cannot open file %s with flags %ld and permissions %ld: %s", file_name, flags, mode, strerror(errno)); + RETURN_FALSE; + } + +@@ -130,14 +130,14 @@ PHP_FUNCTION(dio_fdopen) + long lfd; + int fd; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &lfd) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &lfd) == FAILURE) { + return; + } + + fd = (int)lfd; + + if ((fcntl(fd, F_GETFL, 0) == -1) && (errno == EBADF)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad file descriptor %d", fd); ++ php_error_docref(NULL, E_WARNING, "Bad file descriptor %d", fd); + RETURN_FALSE; + } + +@@ -158,7 +158,7 @@ PHP_FUNCTION(dio_dup) + php_fd_t *f, *df; + int dfd; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &r_fd) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &r_fd) == FAILURE) { + return; + } + +@@ -168,7 +168,7 @@ PHP_FUNCTION(dio_dup) + + dfd = dup(f->fd); + if (dfd == -1) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot duplication file descriptor %d: %s", f->fd, strerror(errno)); ++ php_error_docref(NULL, E_WARNING, "cannot duplication file descriptor %d: %s", f->fd, strerror(errno)); + RETURN_FALSE; + } + +@@ -191,7 +191,7 @@ PHP_FUNCTION(dio_read) + long bytes = 1024; + ssize_t res; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &r_fd, &bytes) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &r_fd, &bytes) == FAILURE) { + return; + } + +@@ -200,7 +200,7 @@ PHP_FUNCTION(dio_read) + } + + if (bytes <= 0) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0."); ++ php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0."); + RETURN_FALSE; + } + +@@ -229,12 +229,12 @@ PHP_FUNCTION(dio_write) + long trunc_len = 0; + ssize_t res; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &r_fd, &data, &data_len, &trunc_len) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|l", &r_fd, &data, &data_len, &trunc_len) == FAILURE) { + return; + } + + if (trunc_len < 0 || trunc_len > data_len) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "length must be greater or equal to zero and less then the length of the specified string."); ++ php_error_docref(NULL, E_WARNING, "length must be greater or equal to zero and less then the length of the specified string."); + RETURN_FALSE; + } + +@@ -244,7 +244,7 @@ PHP_FUNCTION(dio_write) + + res = write(f->fd, data, trunc_len ? trunc_len : data_len); + if (res == -1) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot write data to file descriptor %d: %s", f->fd, strerror(errno)); ++ php_error_docref(NULL, E_WARNING, "cannot write data to file descriptor %d: %s", f->fd, strerror(errno)); + } + + RETURN_LONG(res); +@@ -261,7 +261,7 @@ PHP_FUNCTION(dio_truncate) + php_fd_t *f; + long offset; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &r_fd, &offset) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &r_fd, &offset) == FAILURE) { + return; + } + +@@ -270,7 +270,7 @@ PHP_FUNCTION(dio_truncate) + } + + if (ftruncate(f->fd, offset) == -1) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "couldn't truncate %d to %ld bytes: %s", f->fd, offset, strerror(errno)); ++ php_error_docref(NULL, E_WARNING, "couldn't truncate %d to %ld bytes: %s", f->fd, offset, strerror(errno)); + RETURN_FALSE; + } + +@@ -289,7 +289,7 @@ PHP_FUNCTION(dio_stat) + php_fd_t *f; + struct stat s; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &r_fd) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &r_fd) == FAILURE) { + return; + } + +@@ -298,7 +298,7 @@ PHP_FUNCTION(dio_stat) + } + + if (fstat(f->fd, &s) == -1) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot stat %d: %s", f->fd, strerror(errno)); ++ php_error_docref(NULL, E_WARNING, "cannot stat %d: %s", f->fd, strerror(errno)); + RETURN_FALSE; + } + +@@ -330,7 +330,7 @@ PHP_FUNCTION(dio_seek) + long offset; + long whence = SEEK_SET; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &r_fd, &offset, &whence) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|l", &r_fd, &offset, &whence) == FAILURE) { + return; + } + +@@ -353,7 +353,7 @@ PHP_FUNCTION(dio_fcntl) + php_fd_t *f; + long cmd; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &r_fd, &cmd, &arg) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|z", &r_fd, &cmd, &arg) == FAILURE) { + return; + } + +@@ -369,7 +369,7 @@ PHP_FUNCTION(dio_fcntl) + HashTable *fh; + + if (!arg) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be array or int, none given"); ++ php_error_docref(NULL, E_WARNING, "expects argument 3 to be array or int, none given"); + RETURN_FALSE; + } + if (Z_TYPE_P(arg) == IS_ARRAY) { +@@ -403,7 +403,7 @@ PHP_FUNCTION(dio_fcntl) + lk.l_whence = SEEK_SET; + lk.l_type = Z_LVAL_P(arg); + } else { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be array or int, %s given", zend_zval_type_name(arg)); ++ php_error_docref(NULL, E_WARNING, "expects argument 3 to be array or int, %s given", zend_zval_type_name(arg)); + RETURN_FALSE; + } + +@@ -428,7 +428,7 @@ PHP_FUNCTION(dio_fcntl) + php_fd_t *new_f; + + if (!arg || Z_TYPE_P(arg) != IS_LONG) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be int"); ++ php_error_docref(NULL, E_WARNING, "expects argument 3 to be int"); + RETURN_FALSE; + } + +@@ -440,7 +440,7 @@ PHP_FUNCTION(dio_fcntl) + } + default: + if (!arg || Z_TYPE_P(arg) != IS_LONG) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be int"); ++ php_error_docref(NULL, E_WARNING, "expects argument 3 to be int"); + RETURN_FALSE; + } + +@@ -465,7 +465,7 @@ PHP_FUNCTION(dio_tcsetattr) + HashTable *fh; + zval *element; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz", &r_fd, &arg) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &r_fd, &arg) == FAILURE) { + return; + } + +@@ -474,7 +474,7 @@ PHP_FUNCTION(dio_tcsetattr) + } + + if (Z_TYPE_P(arg) != IS_ARRAY) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING,"tcsetattr, third argument should be an associative array"); ++ php_error_docref(NULL, E_WARNING,"tcsetattr, third argument should be an associative array"); + return; + } + +@@ -564,7 +564,7 @@ PHP_FUNCTION(dio_tcsetattr) + BAUD = B50; + break; + default: +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid baud rate %d", Baud_Rate); ++ php_error_docref(NULL, E_WARNING, "invalid baud rate %d", Baud_Rate); + RETURN_FALSE; + } + switch (Data_Bits) { +@@ -581,7 +581,7 @@ PHP_FUNCTION(dio_tcsetattr) + DATABITS = CS5; + break; + default: +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data bits %d", Data_Bits); ++ php_error_docref(NULL, E_WARNING, "invalid data bits %d", Data_Bits); + RETURN_FALSE; + } + switch (Stop_Bits) { +@@ -592,7 +592,7 @@ PHP_FUNCTION(dio_tcsetattr) + STOPBITS = CSTOPB; + break; + default: +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop bits %d", Stop_Bits); ++ php_error_docref(NULL, E_WARNING, "invalid stop bits %d", Stop_Bits); + RETURN_FALSE; + } + +@@ -610,7 +610,7 @@ PHP_FUNCTION(dio_tcsetattr) + PARITY = 0; + break; + default: +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity %d", Parity); ++ php_error_docref(NULL, E_WARNING, "invalid parity %d", Parity); + RETURN_FALSE; + } + +@@ -652,7 +652,7 @@ PHP_FUNCTION(dio_close) + zval *r_fd; + php_fd_t *f; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &r_fd) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &r_fd) == FAILURE) { + return; + } + +@@ -669,7 +669,7 @@ PHP_FUNCTION(dio_close) + /* {{{ dio_init_legacy_defines + * Initialises the legacy PHP defines + */ +-static void dio_init_legacy_defines(int module_number TSRMLS_DC) { ++static void dio_init_legacy_defines(int module_number) { + RDIOC(O_RDONLY); + RDIOC(O_WRONLY); + RDIOC(O_RDWR); +@@ -852,11 +852,11 @@ PHP_MINIT_FUNCTION(dio) + /* Legacy resource destructor. */ + le_fd = zend_register_list_destructors_ex(_dio_close_fd, NULL, le_fd_name, module_number); + +- dio_init_legacy_defines(module_number TSRMLS_CC); ++ dio_init_legacy_defines(module_number); + + /* Register the stream wrappers */ +- return (php_register_url_stream_wrapper(DIO_RAW_STREAM_NAME, &php_dio_raw_stream_wrapper TSRMLS_CC) == SUCCESS && +- php_register_url_stream_wrapper(DIO_SERIAL_STREAM_NAME, &php_dio_serial_stream_wrapper TSRMLS_CC) == SUCCESS) ? SUCCESS : FAILURE; ++ return (php_register_url_stream_wrapper(DIO_RAW_STREAM_NAME, &php_dio_raw_stream_wrapper) == SUCCESS && ++ php_register_url_stream_wrapper(DIO_SERIAL_STREAM_NAME, &php_dio_serial_stream_wrapper) == SUCCESS) ? SUCCESS : FAILURE; + } + /* }}} */ + +@@ -864,8 +864,8 @@ PHP_MINIT_FUNCTION(dio) + */ + PHP_MSHUTDOWN_FUNCTION(dio) + { +- return (php_unregister_url_stream_wrapper(DIO_RAW_STREAM_NAME TSRMLS_CC) == SUCCESS && +- php_unregister_url_stream_wrapper(DIO_SERIAL_STREAM_NAME TSRMLS_CC) == SUCCESS) ? SUCCESS : FAILURE; ++ return (php_unregister_url_stream_wrapper(DIO_RAW_STREAM_NAME) == SUCCESS && ++ php_unregister_url_stream_wrapper(DIO_SERIAL_STREAM_NAME) == SUCCESS) ? SUCCESS : FAILURE; + } + /* }}} */ + +diff --git a/dio_common.c b/dio_common.c +index a5f4c63..d09c0ec 100644 +--- a/dio_common.c ++++ b/dio_common.c +@@ -55,7 +55,7 @@ void dio_init_stream_data(php_dio_stream_data *data) { + /* {{{ dio_assoc_array_get_basic_options + * Retrieves the basic open option values from an associative array + */ +-void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data TSRMLS_DC) { ++void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data) { + #if defined(DIO_HAS_FILEPERMS) || defined(DIO_NONBLOCK) + zval *tmpzval; + HashTable *opthash; +@@ -98,7 +98,7 @@ void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data + /* {{{ dio_assoc_array_get_serial_options + * Retrieves the serial open option values from an associative array + */ +-void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data TSRMLS_DC) { ++void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data) { + zval *tmpzval; + HashTable *opthash; + +@@ -133,7 +133,7 @@ void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data + /* {{{ dio_stream_context_get_raw_options + * Extracts the option values for dio.raw mode from a context + */ +-void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC) { ++void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data) { + #if defined(DIO_HAS_FILEPERMS) || defined(DIO_NONBLOCK) + zval *tmpzval; + #endif +@@ -173,7 +173,7 @@ void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_s + /* {{{ dio_stream_context_get_serial_options + * Extracts the option values for dio.serial mode from a context + */ +-void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC) { ++void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data) { + zval *tmpzval; + + if ((tmpzval = php_stream_context_get_option(context, "dio", "data_rate")) != NULL) { +diff --git a/dio_posix.c b/dio_posix.c +index 527d683..843e234 100644 +--- a/dio_posix.c ++++ b/dio_posix.c +@@ -474,7 +474,7 @@ int dio_common_set_option(php_dio_stream_data *data, int option, int value, void + /* {{{ dio_raw_open_stream + * Opens the underlying stream. + */ +-int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++int dio_raw_open_stream(const char *filename, const char *mode, php_dio_stream_data *data) { + php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; + pdata->flags = dio_stream_mode_to_flags(mode); + +@@ -498,7 +498,7 @@ int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *d + if (pdata->fd < 0) { + switch (errno) { + case EEXIST: +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!"); ++ php_error_docref(NULL, E_WARNING, "File exists!"); + return 0; + default: + return 0; +@@ -512,36 +512,36 @@ int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *d + /* {{{ dio_serial_init + * Initialises the serial settings storing the original settings before hand. + */ +-static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) { ++static int dio_serial_init(php_dio_stream_data *data) { + php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; + int ret = 0, data_bits_def, stop_bits_def, parity_def; + struct termios tio; + speed_t rate_def; + + if (!dio_data_rate_to_define(data->data_rate, &rate_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%ld)", data->data_rate); ++ php_error_docref(NULL, E_WARNING, "invalid data_rate value (%ld)", data->data_rate); + return 0; + } + + if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits); ++ php_error_docref(NULL, E_WARNING, "invalid data_bits value (%d)", data->data_bits); + return 0; + } + + if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits); ++ php_error_docref(NULL, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits); + return 0; + } + + if (!dio_parity_to_define(data->parity, &parity_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity); ++ php_error_docref(NULL, E_WARNING, "invalid parity value (%d)", data->parity); + return 0; + } + + ret = tcgetattr(pdata->fd, &(pdata->oldtio)); + if (ret < 0) { + if ((errno == ENOTTY) || (errno == ENODEV)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a serial port or terminal!"); ++ php_error_docref(NULL, E_WARNING, "Not a serial port or terminal!"); + } + return 0; + } +@@ -632,7 +632,7 @@ int dio_serial_purge(php_dio_stream_data *data) { + /* {{{ dio_serial_open_stream + * Opens the underlying stream. + */ +-int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data) { + php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; + + #ifdef O_NOCTTY +@@ -640,11 +640,11 @@ int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data + pdata->flags |= O_NOCTTY; + #endif + +- if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) { ++ if (!dio_raw_open_stream(filename, mode, data)) { + return 0; + } + +- if (!dio_serial_init(data TSRMLS_CC)) { ++ if (!dio_serial_init(data)) { + close(pdata->fd); + return 0; + } +diff --git a/dio_stream_wrappers.c b/dio_stream_wrappers.c +index 817b0d1..eb23752 100644 +--- a/dio_stream_wrappers.c ++++ b/dio_stream_wrappers.c +@@ -36,7 +36,7 @@ + /* {{{ dio_stream_write + * Write to the stream + */ +-static size_t dio_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) ++static size_t dio_stream_write(php_stream *stream, const char *buf, size_t count) + { + return dio_common_write((php_dio_stream_data*)stream->abstract, buf, count); + } +@@ -45,7 +45,7 @@ static size_t dio_stream_write(php_stream *stream, const char *buf, size_t count + /* {{{ dio_stream_read + * Read from the stream + */ +-static size_t dio_stream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) ++static size_t dio_stream_read(php_stream *stream, char *buf, size_t count) + { + php_dio_stream_data* data = (php_dio_stream_data*)stream->abstract; + size_t bytes = dio_common_read(data, buf, count); +@@ -58,7 +58,7 @@ static size_t dio_stream_read(php_stream *stream, char *buf, size_t count TSRMLS + /* {{{ dio_stream_flush + * Flush the stream. For raw streams this does nothing. + */ +-static int dio_stream_flush(php_stream *stream TSRMLS_DC) ++static int dio_stream_flush(php_stream *stream) + { + return 1; + } +@@ -67,7 +67,7 @@ static int dio_stream_flush(php_stream *stream TSRMLS_DC) + /* {{{ dio_stream_close + * Close the stream + */ +-static int dio_stream_close(php_stream *stream, int close_handle TSRMLS_DC) ++static int dio_stream_close(php_stream *stream, int close_handle) + { + php_dio_stream_data *abstract = (php_dio_stream_data*)stream->abstract; + +@@ -83,7 +83,7 @@ static int dio_stream_close(php_stream *stream, int close_handle TSRMLS_DC) + /* {{{ dio_stream_set_option + * Set the stream options. + */ +-static int dio_stream_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC) ++static int dio_stream_set_option(php_stream *stream, int option, int value, void *ptrparam) + { + php_dio_stream_data *abstract = (php_dio_stream_data*)stream->abstract; + +@@ -143,7 +143,7 @@ static php_stream *dio_raw_fopen_wrapper(php_stream_wrapper *wrapper, + filename = path + sizeof(DIO_RAW_STREAM_PROTOCOL) - 1; + + /* Check we can actually access it. */ +- if (php_check_open_basedir(filename TSRMLS_CC) || DIO_SAFE_MODE_CHECK(filename, mode)) { ++ if (php_check_open_basedir(filename) || DIO_SAFE_MODE_CHECK(filename, mode)) { + return NULL; + } + +@@ -152,11 +152,11 @@ static php_stream *dio_raw_fopen_wrapper(php_stream_wrapper *wrapper, + + /* Parse the context. */ + if (context) { +- dio_stream_context_get_basic_options(context, data TSRMLS_CC); ++ dio_stream_context_get_basic_options(context, data); + } + + /* Try and open a raw stream. */ +- if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) { ++ if (!dio_raw_open_stream(filename, mode, data)) { + return NULL; + } + +@@ -199,7 +199,7 @@ PHP_FUNCTION(dio_raw) { + char *mode; + int mode_len; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|z", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|z", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) { + RETURN_FALSE; + } + +@@ -209,7 +209,7 @@ PHP_FUNCTION(dio_raw) { + } + + /* Check we can actually access the file. */ +- if (php_check_open_basedir(filename TSRMLS_CC) || DIO_SAFE_MODE_CHECK(filename, mode)) { ++ if (php_check_open_basedir(filename) || DIO_SAFE_MODE_CHECK(filename, mode)) { + RETURN_FALSE; + } + +@@ -217,11 +217,11 @@ PHP_FUNCTION(dio_raw) { + data->stream_type = DIO_STREAM_TYPE_RAW; + + if (options) { +- dio_assoc_array_get_basic_options(options, data TSRMLS_CC); ++ dio_assoc_array_get_basic_options(options, data); + } + + /* Try and open a raw stream. */ +- if (dio_raw_open_stream(filename, mode, data TSRMLS_CC)) { ++ if (dio_raw_open_stream(filename, mode, data)) { + stream = php_stream_alloc(&dio_raw_stream_ops, data, 0, mode); + if (!stream) { + (void) dio_common_close(data); +@@ -244,7 +244,7 @@ PHP_FUNCTION(dio_raw) { + * stream, if it is write only it flushes the write, otherwise it flushes + * both. + */ +-static int dio_serial_stream_flush(php_stream *stream TSRMLS_DC) ++static int dio_serial_stream_flush(php_stream *stream) + { + return dio_serial_purge((php_dio_stream_data*)stream->abstract); + } +@@ -254,7 +254,7 @@ static int dio_serial_stream_flush(php_stream *stream TSRMLS_DC) + * Close the stream. Restores the serial settings to their value before + * the stream was open. + */ +-static int dio_serial_stream_close(php_stream *stream, int close_handle TSRMLS_DC) ++static int dio_serial_stream_close(php_stream *stream, int close_handle) + { + php_dio_stream_data *abstract = (php_dio_stream_data*)stream->abstract; + +@@ -304,7 +304,7 @@ static php_stream *dio_serial_fopen_wrapper(php_stream_wrapper *wrapper, + filename = path + sizeof(DIO_SERIAL_STREAM_PROTOCOL) - 1; + + /* Check we can actually access it. */ +- if (php_check_open_basedir(filename TSRMLS_CC) || DIO_SAFE_MODE_CHECK(filename, mode)) { ++ if (php_check_open_basedir(filename) || DIO_SAFE_MODE_CHECK(filename, mode)) { + return NULL; + } + +@@ -313,12 +313,12 @@ static php_stream *dio_serial_fopen_wrapper(php_stream_wrapper *wrapper, + + /* Parse the context. */ + if (context) { +- dio_stream_context_get_basic_options(context, data TSRMLS_CC); +- dio_stream_context_get_serial_options(context, data TSRMLS_CC); ++ dio_stream_context_get_basic_options(context, data); ++ dio_stream_context_get_serial_options(context, data); + } + + /* Try and open a serial stream. */ +- if (!dio_serial_open_stream(filename, mode, data TSRMLS_CC)) { ++ if (!dio_serial_open_stream(filename, mode, data)) { + return NULL; + } + +@@ -359,18 +359,18 @@ PHP_FUNCTION(dio_serial) { + char *mode; + int mode_len; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|z", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|z", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) { + RETURN_FALSE; + } + + /* Check the third argument is an array. */ + if (options && (Z_TYPE_P(options) != IS_ARRAY)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING,"dio_serial, the third argument should be an array of options"); ++ php_error_docref(NULL, E_WARNING,"dio_serial, the third argument should be an array of options"); + RETURN_FALSE; + } + + /* Check we can actually access the file. */ +- if (php_check_open_basedir(filename TSRMLS_CC) || DIO_SAFE_MODE_CHECK(filename, mode)) { ++ if (php_check_open_basedir(filename) || DIO_SAFE_MODE_CHECK(filename, mode)) { + RETURN_FALSE; + } + +@@ -378,12 +378,12 @@ PHP_FUNCTION(dio_serial) { + data->stream_type = DIO_STREAM_TYPE_SERIAL; + + if (options) { +- dio_assoc_array_get_basic_options(options, data TSRMLS_CC); +- dio_assoc_array_get_serial_options(options, data TSRMLS_CC); ++ dio_assoc_array_get_basic_options(options, data); ++ dio_assoc_array_get_serial_options(options, data); + } + + /* Try and open a serial stream. */ +- if (dio_serial_open_stream(filename, mode, data TSRMLS_CC)) { ++ if (dio_serial_open_stream(filename, mode, data)) { + stream = php_stream_alloc(&dio_serial_stream_ops, data, 0, mode); + if (!stream) { + efree(data); +diff --git a/dio_win32.c b/dio_win32.c +index 1023d36..25c838a 100644 +--- a/dio_win32.c ++++ b/dio_win32.c +@@ -30,7 +30,7 @@ + /* {{{ dio_last_error_php_error + * Generates a PHP error message based upon the last Windows error. + */ +-static void dio_last_error_php_error(int level, char * message TSRMLS_DC) { ++static void dio_last_error_php_error(int level, char * message) { + LPVOID msgbuf; + DWORD msgbuflen; + char * errmsg; +@@ -68,7 +68,7 @@ static void dio_last_error_php_error(int level, char * message TSRMLS_DC) { + /* Allocate a buffer */ + errmsg = emalloc(errmsglen); + if (!errmsg) { +- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Out of memory in dio_last_error_php_error()!"); ++ php_error_docref(NULL, E_ERROR, "Out of memory in dio_last_error_php_error()!"); + LocalFree(msgbuf); + return; + } +@@ -88,7 +88,7 @@ static void dio_last_error_php_error(int level, char * message TSRMLS_DC) { + errmsg = (char *)msgbuf; + #endif + +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s[ERROR %d] %s", message, err, errmsg); ++ php_error_docref(NULL, E_WARNING, "%s[ERROR %d] %s", message, err, errmsg); + + LocalFree(msgbuf); + #ifdef UNICODE +@@ -505,7 +505,7 @@ int dio_common_set_option(php_dio_stream_data *data, int option, int value, void + /* {{{ dio_raw_open_stream + * Opens the underlying stream. + */ +-int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++int dio_raw_open_stream(const char *filename, const char *mode, php_dio_stream_data *data) { + php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; + DWORD err; + +@@ -543,29 +543,29 @@ int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *d + err = GetLastError(); + switch (err) { + case ERROR_FILE_EXISTS: +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!"); ++ php_error_docref(NULL, E_WARNING, "File exists!"); + return 0; + + case ERROR_FILE_NOT_FOUND: + /* ERROR_FILE_NOT_FOUND with TRUNCATE_EXISTING means that + * the file doesn't exist so now try to create it. */ + if (TRUNCATE_EXISTING == wdata->creation_disposition) { +- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "File does not exist, creating new file!"); ++ php_error_docref(NULL, E_NOTICE, "File does not exist, creating new file!"); + + wdata->handle = CreateFile(filename, wdata->desired_access, 0, + NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (INVALID_HANDLE_VALUE == wdata->handle) { +- dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC); ++ dio_last_error_php_error(E_WARNING, "CreateFile() failed:"); + return 0; + } + } else { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "File not found!"); ++ php_error_docref(NULL, E_WARNING, "File not found!"); + return 0; + } + break; + + default: +- dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC); ++ dio_last_error_php_error(E_WARNING, "CreateFile() failed:"); + return 0; + } + } +@@ -584,33 +584,33 @@ int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *d + /* {{{ dio_serial_init + * Initialises the serial port + */ +-static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) { ++static int dio_serial_init(php_dio_stream_data *data) { + php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; + DWORD rate_def, data_bits_def, stop_bits_def, parity_def; + DCB dcb; + + if (!dio_data_rate_to_define(data->data_rate, &rate_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%d)", data->data_rate); ++ php_error_docref(NULL, E_WARNING, "invalid data_rate value (%d)", data->data_rate); + return 0; + } + + if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits); ++ php_error_docref(NULL, E_WARNING, "invalid data_bits value (%d)", data->data_bits); + return 0; + } + + if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits); ++ php_error_docref(NULL, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits); + return 0; + } + + if (!dio_parity_to_define(data->parity, &parity_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity); ++ php_error_docref(NULL, E_WARNING, "invalid parity value (%d)", data->parity); + return 0; + } + + if (!GetCommState(wdata->handle, &(wdata->olddcb))) { +- dio_last_error_php_error(E_WARNING, "GetCommState() failed:" TSRMLS_CC); ++ dio_last_error_php_error(E_WARNING, "GetCommState() failed:"); + return 0; + } + +@@ -646,7 +646,7 @@ static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) { + } + + if (!SetCommState(wdata->handle, &dcb)) { +- dio_last_error_php_error(E_WARNING, "SetCommState() failed:" TSRMLS_CC); ++ dio_last_error_php_error(E_WARNING, "SetCommState() failed:"); + return 0; + } + +@@ -698,23 +698,23 @@ int dio_serial_purge(php_dio_stream_data *data) { + /* {{{ dio_serial_open_stream + * Opens the underlying stream. + */ +-int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data) { + php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; + COMMTIMEOUTS cto = { 0, 0, 0, 0, 0 }; + +- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Opening \"%s\" as a serial port (mode=\"%s\").", filename, mode); ++ php_error_docref(NULL, E_NOTICE, "Opening \"%s\" as a serial port (mode=\"%s\").", filename, mode); + + if (*mode != 'r') { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must open serial ports in read or read/write mode!"); ++ php_error_docref(NULL, E_WARNING, "You must open serial ports in read or read/write mode!"); + return 0; + } + +- if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) { ++ if (!dio_raw_open_stream(filename, mode, data)) { + return 0; + } + + if (!GetCommTimeouts(wdata->handle, &(wdata->oldcto))) { +- dio_last_error_php_error(E_WARNING, "GetCommTimeouts() failed (Not a comm port?):" TSRMLS_CC); ++ dio_last_error_php_error(E_WARNING, "GetCommTimeouts() failed (Not a comm port?):"); + CloseHandle(wdata->handle); + return 0; + } +@@ -735,12 +735,12 @@ int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data + } + + if (!SetCommTimeouts(wdata->handle, &cto)) { +- dio_last_error_php_error(E_WARNING, "SetCommTimeouts() failed:" TSRMLS_CC); ++ dio_last_error_php_error(E_WARNING, "SetCommTimeouts() failed:"); + CloseHandle(wdata->handle); + return 0; + } + +- if (!dio_serial_init(data TSRMLS_CC)) { ++ if (!dio_serial_init(data)) { + CloseHandle(wdata->handle); + return 0; + } +diff --git a/php_dio_common.h b/php_dio_common.h +index 7a75370..6af202f 100644 +--- a/php_dio_common.h ++++ b/php_dio_common.h +@@ -39,13 +39,13 @@ php_dio_stream_data * dio_create_stream_data(void); + + void dio_init_stream_data(php_dio_stream_data *data); + +-void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data TSRMLS_DC); ++void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data); + +-void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data TSRMLS_DC); ++void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data); + +-void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC); ++void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data); + +-void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC); ++void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data); + + size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count); + +@@ -55,13 +55,13 @@ int dio_common_close(php_dio_stream_data *data); + + int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam); + +-int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC); ++int dio_raw_open_stream(const char *filename, const char *mode, php_dio_stream_data *data); + + int dio_serial_uninit(php_dio_stream_data *data); + + int dio_serial_purge(php_dio_stream_data *data); + +-int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC); ++int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data); + + #endif /* PHP_DIO_COMMON_H_ */ + +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0013-Fix-tests-for-legacy-interface.patch b/lang/php7-pecl-dio/patches/0013-Fix-tests-for-legacy-interface.patch new file mode 100644 index 0000000..e632552 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0013-Fix-tests-for-legacy-interface.patch @@ -0,0 +1,69 @@ +From 942b77d84417298fb9e99c216029f22fbd1e2d98 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Thu, 14 Jul 2016 01:47:05 +0200 +Subject: [PATCH 13/16] Fix tests for legacy interface + +Signed-off-by: Michael Heimpold +--- + dio.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +diff --git a/dio.c b/dio.c +index 7bad575..1a130a2 100644 +--- a/dio.c ++++ b/dio.c +@@ -73,9 +73,9 @@ static int new_php_fd(php_fd_t **f, int fd) + return 1; + } + +-static void _dio_close_fd(zend_resource *res) ++static void _dio_close_fd(zend_resource *rsrc) + { +- php_fd_t *f = (php_fd_t *)zend_fetch_resource(res, NULL, le_fd); ++ php_fd_t *f = (php_fd_t *)rsrc->ptr; + if (f) { + close(f->fd); + free(f); +@@ -87,8 +87,8 @@ static void _dio_close_fd(zend_resource *res) + PHP_FUNCTION(dio_open) + { + php_fd_t *f; +- char *file_name; +- int file_name_length; ++ char *file_name = NULL; ++ size_t file_name_length = 0; + long flags; + long mode = 0; + int fd; +@@ -97,6 +97,10 @@ PHP_FUNCTION(dio_open) + return; + } + ++ if (!file_name || file_name[0] == '\0') { ++ RETURN_FALSE; ++ } ++ + if (php_check_open_basedir(file_name) || DIO_SAFE_MODE_CHECK(file_name, "wb+")) { + RETURN_FALSE; + } +@@ -176,7 +180,7 @@ PHP_FUNCTION(dio_dup) + RETURN_FALSE; + } + +- RETVAL_RES(zend_register_resource(f, le_fd)); ++ RETVAL_RES(zend_register_resource(df, le_fd)); + } + /* }}} */ + #endif +@@ -660,7 +664,7 @@ PHP_FUNCTION(dio_close) + RETURN_FALSE; + } + +- zend_list_delete(Z_LVAL_P(r_fd)); ++ zend_list_delete(Z_RES_P(r_fd)); + } + /* }}} */ + +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0014-Add-missing-changes-from-changed-stream-API-interfac.patch b/lang/php7-pecl-dio/patches/0014-Add-missing-changes-from-changed-stream-API-interfac.patch new file mode 100644 index 0000000..b9e2e00 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0014-Add-missing-changes-from-changed-stream-API-interfac.patch @@ -0,0 +1,54 @@ +From ff469d3a11409e9b043dc10ddfc44792c5359ff1 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Thu, 14 Jul 2016 01:47:05 +0200 +Subject: [PATCH 14/16] Add missing changes from changed stream API interface + +Signed-off-by: Michael Heimpold +--- + dio_posix.c | 2 +- + dio_stream_wrappers.c | 2 +- + php_dio_common.h | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/dio_posix.c b/dio_posix.c +index 843e234..b2aa228 100644 +--- a/dio_posix.c ++++ b/dio_posix.c +@@ -632,7 +632,7 @@ int dio_serial_purge(php_dio_stream_data *data) { + /* {{{ dio_serial_open_stream + * Opens the underlying stream. + */ +-int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data) { ++int dio_serial_open_stream(const char *filename, const char *mode, php_dio_stream_data *data) { + php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; + + #ifdef O_NOCTTY +diff --git a/dio_stream_wrappers.c b/dio_stream_wrappers.c +index eb23752..0a00daa 100644 +--- a/dio_stream_wrappers.c ++++ b/dio_stream_wrappers.c +@@ -292,7 +292,7 @@ static php_stream *dio_serial_fopen_wrapper(php_stream_wrapper *wrapper, + { + php_dio_stream_data *data; + php_stream *stream; +- char *filename; ++ const char *filename; + + /* Check it was actually for us (not a corrupted function pointer + somewhere!). */ +diff --git a/php_dio_common.h b/php_dio_common.h +index 6af202f..7068ea7 100644 +--- a/php_dio_common.h ++++ b/php_dio_common.h +@@ -61,7 +61,7 @@ int dio_serial_uninit(php_dio_stream_data *data); + + int dio_serial_purge(php_dio_stream_data *data); + +-int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data); ++int dio_serial_open_stream(const char *filename, const char *mode, php_dio_stream_data *data); + + #endif /* PHP_DIO_COMMON_H_ */ + +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0015-Add-.gitignore.patch b/lang/php7-pecl-dio/patches/0015-Add-.gitignore.patch new file mode 100644 index 0000000..ef675de --- /dev/null +++ b/lang/php7-pecl-dio/patches/0015-Add-.gitignore.patch @@ -0,0 +1,48 @@ +From def92a2db269d4ea6d2e8b7f8fe9dd473886a6b1 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Sun, 17 Jul 2016 01:08:47 +0200 +Subject: [PATCH 15/16] Add .gitignore + +Signed-off-by: Michael Heimpold +--- + .gitignore | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + create mode 100644 .gitignore + +diff --git a/.gitignore b/.gitignore +new file mode 100644 +index 0000000..dae52e8 +--- /dev/null ++++ b/.gitignore +@@ -0,0 +1,28 @@ ++.deps ++.libs ++Makefile ++Makefile.fragments ++Makefile.global ++Makefile.objects ++acinclude.m4 ++aclocal.m4 ++autom4te.cache ++build ++config.guess ++config.h ++config.h.in ++config.log ++config.nice ++config.status ++config.sub ++configure ++configure.in ++*.la ++*.lo ++install-sh ++libtool ++ltmain.sh ++missing ++mkinstalldirs ++modules ++run-tests.php +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0016-Add-additional-baudrates.patch b/lang/php7-pecl-dio/patches/0016-Add-additional-baudrates.patch new file mode 100644 index 0000000..16cceea --- /dev/null +++ b/lang/php7-pecl-dio/patches/0016-Add-additional-baudrates.patch @@ -0,0 +1,44 @@ +From 0f8df09a8008eed8a7ac0c6400bce523014ff770 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Mon, 18 Jul 2016 22:45:04 +0200 +Subject: [PATCH 16/16] Add additional baudrates + +Signed-off-by: Michael Heimpold +--- + dio.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/dio.c b/dio.c +index 1a130a2..a4e8e7d 100644 +--- a/dio.c ++++ b/dio.c +@@ -522,6 +522,26 @@ PHP_FUNCTION(dio_tcsetattr) + + /* assign to correct values... */ + switch (Baud_Rate) { ++#ifdef B460800 ++ case 460800: ++ BAUD = B460800; ++ break; ++#endif ++#ifdef B230400 ++ case 230400: ++ BAUD = B230400; ++ break; ++#endif ++#ifdef B115200 ++ case 115200: ++ BAUD = B115200; ++ break; ++#endif ++#ifdef B57600 ++ case 57600: ++ BAUD = B57600; ++ break; ++#endif + case 38400: + BAUD = B38400; + break; +-- +2.5.0 + diff --git a/lang/php7-pecl-http/Makefile b/lang/php7-pecl-http/Makefile new file mode 100644 index 0000000..4166d2c --- /dev/null +++ b/lang/php7-pecl-http/Makefile @@ -0,0 +1,46 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PECL_NAME:=pecl_http +PECL_LONGNAME:=Extended HTTP Support + +PKG_VERSION:=3.0.1 +PKG_RELEASE:=2 +PKG_MD5SUM:=042c97314c180f6473338f0c5d35fabd + +PKG_NAME:=php7-pecl-http +PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://pecl.php.net/get/ + +PKG_MAINTAINER:=Michael Heimpold + +PKG_LICENSE:=BSD-2-Clause +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_DEPENDS:=php7 php7-pecl-propro php7-pecl-raphf +PKG_BUILD_DIR:=$(BUILD_DIR)/pecl-php7/$(PECL_NAME)-$(PKG_VERSION) +PKG_BUILD_PARALLEL:=1 + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk +include ../php7/pecl.mk + +CONFIGURE_VARS+= \ + PHP_PROPRO=yes \ + PHP_RAPHF=yes \ + +CONFIGURE_ARGS+= \ + --with-http \ + --without-http-shared-deps \ + --with-http-libcurl-dir="$(STAGING_DIR)/usr" \ + --with-http-libevent-dir="$(STAGING_DIR)/usr" \ + --with-http-libidn-dir="$(STAGING_DIR)/usr" + +$(eval $(call PECLPackage,http,$(PECL_LONGNAME),+libcurl +librt +libevent2 +libidn +php7-mod-iconv +php7-mod-session +php7-pecl-raphf +php7-pecl-propro,30)) +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/lang/php7-pecl-http/patches/100_config9-m4.patch b/lang/php7-pecl-http/patches/100_config9-m4.patch new file mode 100644 index 0000000..304a1df --- /dev/null +++ b/lang/php7-pecl-http/patches/100_config9-m4.patch @@ -0,0 +1,22 @@ +--- a/config9.m4 2016-09-08 21:39:18.000000000 +0200 ++++ b/config9.m4 2016-09-08 21:42:35.066903251 +0200 +@@ -71,18 +71,7 @@ + extname=$1 + haveext=$[PHP_]translit($1,a-z_-,A-Z__) + AC_MSG_CHECKING([for ext/$extname support]) +- if test -x "$PHP_EXECUTABLE"; then +- grepext=`$PHP_EXECUTABLE -m | $EGREP ^$extname\$` +- if test "$grepext" = "$extname"; then +- [PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__)=1 +- AC_MSG_RESULT([yes]) +- $2 +- else +- [PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__)= +- AC_MSG_RESULT([no]) +- $3 +- fi +- elif test "$haveext" != "no" && test "x$haveext" != "x"; then ++ if test "$haveext" != "no" && test "x$haveext" != "x"; then + [PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__)=1 + AC_MSG_RESULT([yes]) + $2 diff --git a/lang/php7-pecl-libevent/Makefile b/lang/php7-pecl-libevent/Makefile new file mode 100644 index 0000000..272b34a --- /dev/null +++ b/lang/php7-pecl-libevent/Makefile @@ -0,0 +1,38 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PECL_NAME:=libevent +PECL_LONGNAME:=Libevent - event notification + +PKG_NAME:=php7-pecl-$(PECL_NAME) +PKG_VERSION=2016-08-30-$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/expressif/pecl-event-libevent.git +PKG_SOURCE_VERSION:=9e72744ce6224beafc7b54ce2a3a990f1c552a5a +PKG_SOURCE_SUBDIR:=$(PECL_NAME)-$(PKG_SOURCE_VERSION) +PKG_SOURCE:=$(PECL_NAME)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_MAINTAINER:=Michael Heimpold + +PKG_LICENSE:=PHPv3.01 +PKG_LICENSE_FILES:= + +PKG_BUILD_DIR:=$(BUILD_DIR)/pecl-php7/$(PECL_NAME)-$(PKG_SOURCE_VERSION) +PKG_BUILD_PARALLEL:=1 + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk +include ../php7/pecl.mk + +CONFIGURE_ARGS+= --with-libevent=shared,"$(STAGING_DIR)/usr" + +$(eval $(call PECLPackage,$(PECL_NAME),$(PECL_LONGNAME),+libevent2 +php7-mod-sockets,25)) +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/lang/php7-pecl-libevent/patches/010-libevent2.patch b/lang/php7-pecl-libevent/patches/010-libevent2.patch new file mode 100644 index 0000000..961fb36 --- /dev/null +++ b/lang/php7-pecl-libevent/patches/010-libevent2.patch @@ -0,0 +1,16 @@ +--- a/libevent.c ++++ b/libevent.c +@@ -42,10 +42,12 @@ + (rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 1, resource_type)) + #endif + +-#ifdef PHP_WIN32 ++//#ifdef PHP_WIN32 + /* XXX compiling with 2.x on Windows. Luckily the ext code works thanks to the + compat exports from the libevent. However it might need to be adapted to the + never version, so this ifdefs would go away. */ ++#if 1 ++/* force use of libevent2 on OpenWrt and by-pass compat event.h */ + # include + # include + # include diff --git a/lang/php7-pecl-propro/Makefile b/lang/php7-pecl-propro/Makefile new file mode 100644 index 0000000..3bfe535 --- /dev/null +++ b/lang/php7-pecl-propro/Makefile @@ -0,0 +1,43 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PECL_NAME:=propro +PECL_LONGNAME:=Property proxy + +PKG_VERSION:=2.0.1 +PKG_RELEASE:=2 +PKG_MD5SUM:=19f9517210a87e18cc09faed262e1522 + +PKG_NAME:=php7-pecl-propro +PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://pecl.php.net/get/ + +PKG_MAINTAINER:=Michael Heimpold + +PKG_LICENSE:=BSD-2-Clause +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_DIR:=$(BUILD_DIR)/pecl-php7/$(PECL_NAME)-$(PKG_VERSION) +PKG_BUILD_PARALLEL:=1 + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk +include ../php7/pecl.mk + +CONFIGURE_ARGS+= \ + --enable-propro + +define Build/InstallDev + mkdir -p $(STAGING_DIR)/usr/include/php7/ext/$(PECL_NAME) + $(CP) $(PKG_BUILD_DIR)/php_propro.h $(STAGING_DIR)/usr/include/php7/ext/$(PECL_NAME)/ + $(CP) $(PKG_BUILD_DIR)/php_propro_api.h $(STAGING_DIR)/usr/include/php7/ext/$(PECL_NAME)/ +endef + +$(eval $(call PECLPackage,$(PECL_NAME),$(PECL_LONGNAME))) +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/lang/php7-pecl-raphf/Makefile b/lang/php7-pecl-raphf/Makefile new file mode 100644 index 0000000..4ce09f9 --- /dev/null +++ b/lang/php7-pecl-raphf/Makefile @@ -0,0 +1,43 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PECL_NAME:=raphf +PECL_LONGNAME:=Resource and persistent handles factory + +PKG_VERSION:=2.0.0 +PKG_RELEASE:=2 +PKG_MD5SUM:=bc465eb5caa9d0f09cced121a8ac2e8e + +PKG_NAME:=php7-pecl-raphf +PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://pecl.php.net/get/ + +PKG_MAINTAINER:=Michael Heimpold + +PKG_LICENSE:=BSD-2-Clause +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_DIR:=$(BUILD_DIR)/pecl-php7/$(PECL_NAME)-$(PKG_VERSION) +PKG_BUILD_PARALLEL:=1 + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk +include ../php7/pecl.mk + +CONFIGURE_ARGS+= \ + --enable-raphf + +define Build/InstallDev + mkdir -p $(STAGING_DIR)/usr/include/php7/ext/$(PECL_NAME) + cp $(PKG_BUILD_DIR)/php_raphf.h $(STAGING_DIR)/usr/include/php7/ext/$(PECL_NAME)/ + cp $(PKG_BUILD_DIR)/php_raphf_api.h $(STAGING_DIR)/usr/include/php7/ext/$(PECL_NAME)/ +endef + +$(eval $(call PECLPackage,$(PECL_NAME),$(PECL_LONGNAME))) +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/lang/php7/Makefile b/lang/php7/Makefile new file mode 100644 index 0000000..d311a7b --- /dev/null +++ b/lang/php7/Makefile @@ -0,0 +1,593 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=php +PKG_VERSION:=7.0.13 +PKG_RELEASE:=1 + +PKG_MAINTAINER:=Michael Heimpold + +PKG_LICENSE:=PHPv3.01 +PKG_LICENSE_FILES:=LICENSE + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=http://www.php.net/distributions/ +PKG_MD5SUM:=eb117bf1d1efc99c522f132b265a3402 + +PKG_FIXUP:=libtool autoreconf +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +PHP7_MODULES = \ + calendar ctype curl \ + fileinfo \ + dom \ + exif \ + ftp \ + gettext gd gmp \ + hash \ + iconv intl \ + json \ + ldap \ + mbstring mcrypt mysqli \ + opcache openssl \ + pcntl pdo pdo-mysql pdo-pgsql pdo-sqlite pgsql phar \ + session shmop simplexml soap sockets sqlite3 sysvmsg sysvsem sysvshm \ + tokenizer \ + xml xmlreader xmlwriter zip \ + +PKG_CONFIG_DEPENDS:= \ + $(patsubst %,CONFIG_PACKAGE_php7-mod-%,$(PHP7_MODULES)) \ + CONFIG_PHP7_FILTER CONFIG_PHP7_LIBXML CONFIG_PHP7_SYSTEMTZDATA + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/php7/Default + SUBMENU:=PHP + SECTION:=lang + CATEGORY:=Languages + TITLE:=PHP7 Hypertext preprocessor + URL:=http://www.php.net/ + DEPENDS:=php7 +endef + +define Package/php7/Default/description + PHP is a widely-used general-purpose scripting language that is especially + suited for Web development and can be embedded into HTML. +endef + +define Package/php7/config + config PHP7_FILTER + bool "PHP7 Filter support" + depends on PACKAGE_php7-cli || PACKAGE_php7-cgi + + config PHP7_LIBXML + bool "PHP7 LIBXML support" + depends on PACKAGE_php7-cli || PACKAGE_php7-cgi + + config PHP7_SYSTEMTZDATA + bool "Use system timezone data instead of php's built-in database" + depends on PACKAGE_php7-cli || PACKAGE_php7-cgi + select PACKAGE_zoneinfo-core + default y + help + Enabling this feature automatically selects the zoneinfo-core package + which contains data for UTC timezone. To use other timezones you have + to install the corresponding zoneinfo-... package(s). +endef + +define Package/php7 + $(call Package/php7/Default) + + DEPENDS:=+libpcre +zlib \ + +PHP7_LIBXML:libxml2 +endef + +define Package/php7/description + $(call Package/php7/Default/description) + This package contains only the PHP config file. You must actually choose + your PHP flavour (cli, cgi or fastcgi). + + Please note, that installing php5 and php7 in parallel on the same target + is not supported in OpenWrt/LEDE. +endef + +define Package/php7-cli + $(call Package/php7/Default) + DEPENDS+= +PACKAGE_php7-mod-intl:libstdcpp + TITLE+= (CLI) +endef + +define Package/php7-cli/description + $(call Package/php7/Default/description) + This package contains the CLI version of the PHP7 interpreter. +endef + +define Package/php7-cgi + $(call Package/php7/Default) + DEPENDS+= +PACKAGE_php7-mod-intl:libstdcpp + TITLE+= (CGI & FastCGI) +endef + +define Package/php7-cgi/description + $(call Package/php7/Default/description) + This package contains the CGI version of the PHP7 interpreter. +endef + +define Package/php7-fastcgi + $(call Package/php7/Default) + DEPENDS+= +php7-cgi + TITLE:=FastCGI startup script +endef + +define Package/php7-fastcgi/description + As FastCGI support is now a core feature the php7-fastcgi package now depends + on the php7-cgi package, containing just the startup script. +endef + +define Package/php7-fpm + $(call Package/php7/Default) + DEPENDS+= +php7-cgi + TITLE+= (FPM) +endef + +define Package/php7-fpm/description + $(call Package/php7/Default/description) + This package contains the FastCGI Process Manager of the PHP7 interpreter. +endef + +CONFIGURE_ARGS+= \ + --enable-cli \ + --enable-cgi \ + --enable-fpm \ + --enable-shared \ + --disable-static \ + --disable-rpath \ + --disable-debug \ + --disable-phpdbg \ + --without-pear \ + \ + --with-config-file-path=/etc \ + --with-config-file-scan-dir=/etc/php7 \ + --disable-short-tags \ + \ + --with-zlib="$(STAGING_DIR)/usr" \ + --with-zlib-dir="$(STAGING_DIR)/usr" + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-calendar),) + CONFIGURE_ARGS+= --enable-calendar=shared +else + CONFIGURE_ARGS+= --disable-calendar +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-ctype),) + CONFIGURE_ARGS+= --enable-ctype=shared +else + CONFIGURE_ARGS+= --disable-ctype +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-curl),) + CONFIGURE_ARGS+= --with-curl=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-curl +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-fileinfo),) + CONFIGURE_ARGS+= --enable-fileinfo=shared +else + CONFIGURE_ARGS+= --disable-fileinfo +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-gettext),) + CONFIGURE_ARGS+= --with-gettext=shared,"$(STAGING_DIR)/usr/lib/libintl-full" +else + CONFIGURE_ARGS+= --without-gettext +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-dom),) + CONFIGURE_ARGS+= --enable-dom=shared +else + CONFIGURE_ARGS+= --disable-dom +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-exif),) + CONFIGURE_ARGS+= --enable-exif=shared +else + CONFIGURE_ARGS+= --disable-exif +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-ftp),) + CONFIGURE_ARGS+= --enable-ftp=shared +else + CONFIGURE_ARGS+= --disable-ftp +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-gd),) + CONFIGURE_ARGS+= \ + --with-gd=shared \ + --without-freetype-dir \ + --with-jpeg-dir="$(STAGING_DIR)/usr" \ + --with-png-dir="$(STAGING_DIR)/usr" \ + --without-xpm-dir \ + --without-t1lib \ + --enable-gd-native-ttf \ + --disable-gd-jis-conv +else + CONFIGURE_ARGS+= --without-gd +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-gmp),) + CONFIGURE_ARGS+= --with-gmp=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-gmp +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-hash),) + CONFIGURE_ARGS+= --enable-hash=shared +else + CONFIGURE_ARGS+= --disable-hash +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-iconv),) + CONFIGURE_ARGS+= --with-iconv=shared,"$(ICONV_PREFIX)" +else + CONFIGURE_ARGS+= --without-iconv +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-intl),) + CONFIGURE_ARGS+= --enable-intl=shared +else + CONFIGURE_ARGS+= --disable-intl +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-json),) + CONFIGURE_ARGS+= --enable-json=shared +else + CONFIGURE_ARGS+= --disable-json +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-ldap),) + CONFIGURE_ARGS+= \ + --with-ldap=shared,"$(STAGING_DIR)/usr" \ + --with-ldap-sasl="$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-ldap +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-mbstring),) + CONFIGURE_ARGS+= --enable-mbstring=shared --enable-mbregex +else + CONFIGURE_ARGS+= --disable-mbstring +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-mcrypt),) + CONFIGURE_ARGS+= --with-mcrypt=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-mcrypt +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-mysqli),) + CONFIGURE_ARGS+= --with-mysqli=shared,"$(STAGING_DIR)/usr/bin/mysql_config" +else + CONFIGURE_ARGS+= --without-mysqli +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-opcache),) + CONFIGURE_ARGS+= --enable-opcache=shared +else + CONFIGURE_ARGS+= --disable-opcache +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-openssl),) + CONFIGURE_ARGS+= \ + --with-openssl=shared,"$(STAGING_DIR)/usr" \ + --with-kerberos=no \ + --with-openssl-dir="$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-openssl +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pcntl),) + CONFIGURE_ARGS+= --enable-pcntl=shared +else + CONFIGURE_ARGS+= --disable-pcntl +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pdo),) + CONFIGURE_ARGS+= --enable-pdo=shared + ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pdo-mysql),) + CONFIGURE_ARGS+= --with-pdo-mysql=shared,"$(STAGING_DIR)/usr" + else + CONFIGURE_ARGS+= --without-pdo-mysql + endif + ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pdo-pgsql),) + CONFIGURE_ARGS+= --with-pdo-pgsql=shared,"$(STAGING_DIR)/usr" + else + CONFIGURE_ARGS+= --without-pdo-pgsql + endif + ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pdo-sqlite),) + CONFIGURE_ARGS+= --with-pdo-sqlite=shared,"$(STAGING_DIR)/usr" + else + CONFIGURE_ARGS+= --without-pdo-sqlite + endif +else + CONFIGURE_ARGS+= --disable-pdo +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pgsql),) + CONFIGURE_ARGS+= --with-pgsql=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-pgsql +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-phar),) + CONFIGURE_ARGS+= --enable-phar=shared +else + CONFIGURE_ARGS+= --disable-phar +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-session),) + CONFIGURE_ARGS+= --enable-session=shared +else + CONFIGURE_ARGS+= --disable-session +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-shmop),) + CONFIGURE_ARGS+= --enable-shmop=shared +else + CONFIGURE_ARGS+= --disable-shmop +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-simplexml),) + CONFIGURE_ARGS+= --enable-simplexml=shared +else + CONFIGURE_ARGS+= --disable-simplexml +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-soap),) + CONFIGURE_ARGS+= --enable-soap=shared +else + CONFIGURE_ARGS+= --disable-soap +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sockets),) + CONFIGURE_ARGS+= --enable-sockets=shared +else + CONFIGURE_ARGS+= --disable-sockets +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sqlite3),) + CONFIGURE_ARGS+= --with-sqlite3=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-sqlite3 +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sysvmsg),) + CONFIGURE_ARGS+= --enable-sysvmsg=shared +else + CONFIGURE_ARGS+= --disable-sysvmsg +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sysvsem),) + CONFIGURE_ARGS+= --enable-sysvsem=shared +else + CONFIGURE_ARGS+= --disable-sysvsem +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sysvshm),) + CONFIGURE_ARGS+= --enable-sysvshm=shared +else + CONFIGURE_ARGS+= --disable-sysvshm +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-tokenizer),) + CONFIGURE_ARGS+= --enable-tokenizer=shared +else + CONFIGURE_ARGS+= --disable-tokenizer +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-xml),) + CONFIGURE_ARGS+= --enable-xml=shared,"$(STAGING_DIR)/usr" + ifneq ($(CONFIG_PHP7_LIBXML),) + CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2" + else + CONFIGURE_ARGS+= --with-libexpat-dir="$(STAGING_DIR)/usr" + endif +else + CONFIGURE_ARGS+= --disable-xml +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-xmlreader),) + CONFIGURE_ARGS+= --enable-xmlreader=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --disable-xmlreader +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-xmlwriter),) + CONFIGURE_ARGS+= --enable-xmlwriter=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --disable-xmlwriter +endif + +ifneq ($(CONFIG_PACKAGE_php7-mod-zip),) + CONFIGURE_ARGS+= --enable-zip=shared +else + CONFIGURE_ARGS+= --disable-zip +endif + +ifneq ($(SDK)$(CONFIG_PHP7_FILTER),) + CONFIGURE_ARGS+= --enable-filter +else + CONFIGURE_ARGS+= --disable-filter +endif + +ifneq ($(SDK)$(CONFIG_PHP7_LIBXML),) + CONFIGURE_ARGS+= --enable-libxml + CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2" +else + CONFIGURE_ARGS+= --disable-libxml +endif + +#ifneq ($(CONFIG_PHP7_SYSTEMTZDATA),) +# CONFIGURE_ARGS+= --with-system-tzdata +#else +# CONFIGURE_ARGS+= --without-system-tzdata +#endif + +CONFIGURE_VARS+= \ + ac_cv_c_bigendian_php=$(if $(CONFIG_BIG_ENDIAN),yes,no) \ + php_cv_cc_rpath="no" \ + iconv_impl_name="gnu_libiconv" \ + ac_cv_php_xml2_config_path="$(STAGING_DIR)/host/bin/xml2-config" \ + +define Package/php7/conffiles +/etc/php.ini +endef + +define Package/php7/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) ./files/php.ini $(1)/etc/ +endef + +define Package/php7-cli/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_BUILD_DIR)/sapi/cli/php $(1)/usr/bin/php-cli +endef + +define Package/php7-cgi/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(1)/usr/bin/php-cgi + ln -sf php-cgi $(1)/usr/bin/php-fcgi +endef + +define Package/php7-fastcgi/install + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/php7-fastcgi.config $(1)/etc/config/php7-fastcgi + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/php7-fastcgi.init $(1)/etc/init.d/php7-fastcgi +endef + +define Package/php7-fpm/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/sapi/fpm/php-fpm $(1)/usr/bin/php-fpm + + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) ./files/php7-fpm.conf $(1)/etc/php7-fpm.conf + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/php7-fpm.config $(1)/etc/config/php7-fpm + + $(INSTALL_DIR) $(1)/etc/php7-fpm.d + $(INSTALL_DATA) ./files/php7-fpm-www.conf $(1)/etc/php7-fpm.d/www.conf + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/php7-fpm.init $(1)/etc/init.d/php7-fpm +endef + +define Build/Prepare + $(call Build/Prepare/Default) + ( cd $(PKG_BUILD_DIR); touch configure.in; ./buildconf --force ) +endef + +define Build/InstallDev + rm -rf $(PKG_BUILD_DIR)/staging + make -C $(PKG_BUILD_DIR) install INSTALL_ROOT=$(PKG_BUILD_DIR)/staging + rm -rf $(PKG_BUILD_DIR)/staging/usr/{share,man,sbin} + rm -f $(PKG_BUILD_DIR)/staging/usr/bin/{php,php-cgi,php-cli} + mv $(PKG_BUILD_DIR)/staging/usr/bin/phpize $(PKG_BUILD_DIR)/staging/usr/bin/phpize7 + mv $(PKG_BUILD_DIR)/staging/usr/bin/php-config $(PKG_BUILD_DIR)/staging/usr/bin/php7-config + mv $(PKG_BUILD_DIR)/staging/usr/include/php $(PKG_BUILD_DIR)/staging/usr/include/php7 + mv $(PKG_BUILD_DIR)/staging/usr/lib/php $(PKG_BUILD_DIR)/staging/usr/lib/php7 + + $(CP) $(PKG_BUILD_DIR)/staging/usr $(STAGING_DIR)/ + + sed -i -e "s#prefix='/usr'#prefix='$(STAGING_DIR)/usr'#" $(STAGING_DIR)/usr/bin/phpize7 + sed -i -e "s#exec_prefix=\"\`eval echo /usr\`\"#exec_prefix='$(STAGING_DIR)/usr'#" $(STAGING_DIR)/usr/bin/phpize7 + sed -i -e "s#/include\`/php\"#/include\`/php7\"#" $(STAGING_DIR)/usr/bin/phpize7 + sed -i -e "s#/lib/php\`/build\"#/lib/php7\`/build\"#" $(STAGING_DIR)/usr/bin/phpize7 + + sed -i -e "s#prefix=\"/usr\"#prefix=\"$(STAGING_DIR)/usr\"#" $(STAGING_DIR)/usr/bin/php7-config + sed -i -e "s#/include/php\"#/include/php7\"#" $(STAGING_DIR)/usr/bin/php7-config +endef + +define BuildModule + + define Package/php7-mod-$(1) + $(call Package/php7/Default) + + ifneq ($(3),) + DEPENDS+=$(3) + endif + + TITLE:=$(2) shared module + endef + + define Package/php7-mod-$(1)/install + $(INSTALL_DIR) $$(1)/usr/lib/php + $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$(subst -,_,$(1)).so $$(1)/usr/lib/php/ + $(INSTALL_DIR) $$(1)/etc/php7 + ifeq ($(5),zend) + echo "zend_extension=/usr/lib/php/$(subst -,_,$(1)).so" > $$(1)/etc/php7/$(if $(4),$(4),20)_$(subst -,_,$(1)).ini + else + echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php7/$(if $(4),$(4),20)_$(subst -,_,$(1)).ini + endif + endef + + $$(eval $$(call BuildPackage,php7-mod-$(1))) + +endef + +$(eval $(call BuildPackage,php7)) +$(eval $(call BuildPackage,php7-cgi)) +$(eval $(call BuildPackage,php7-cli)) +$(eval $(call BuildPackage,php7-fastcgi)) +$(eval $(call BuildPackage,php7-fpm)) + +#$(eval $(call BuildModule,NAME,TITLE[,PKG DEPENDS])) +$(eval $(call BuildModule,calendar,Calendar)) +$(eval $(call BuildModule,ctype,Ctype)) +$(eval $(call BuildModule,curl,cURL,+PACKAGE_php7-mod-curl:libcurl)) +$(eval $(call BuildModule,dom,DOM,+@PHP7_LIBXML +PACKAGE_php7-mod-dom:libxml2)) +$(eval $(call BuildModule,exif,EXIF)) +$(eval $(call BuildModule,fileinfo,Fileinfo)) +$(eval $(call BuildModule,ftp,FTP,+PACKAGE_php7-mod-ftp:libopenssl)) +$(eval $(call BuildModule,gd,GD graphics,+PACKAGE_php7-mod-gd:libjpeg +PACKAGE_php7-mod-gd:libpng)) +$(eval $(call BuildModule,gettext,Gettext,+PACKAGE_php7-mod-gettext:libintl-full)) +$(eval $(call BuildModule,gmp,GMP,+PACKAGE_php7-mod-gmp:libgmp)) +$(eval $(call BuildModule,hash,Hash)) +$(eval $(call BuildModule,iconv,iConv,$(ICONV_DEPENDS))) +$(eval $(call BuildModule,intl,Internationalization Functions,+PACKAGE_php7-mod-intl:icu)) +$(eval $(call BuildModule,json,JSON)) +$(eval $(call BuildModule,ldap,LDAP,+PACKAGE_php7-mod-ldap:libopenldap +PACKAGE_php7-mod-ldap:libsasl2)) +$(eval $(call BuildModule,mbstring,MBString)) +$(eval $(call BuildModule,mcrypt,Mcrypt,+PACKAGE_php7-mod-mcrypt:libmcrypt +PACKAGE_php7-mod-mcrypt:libltdl)) +$(eval $(call BuildModule,mysqli,MySQL Improved Extension,+PACKAGE_php7-mod-mysqli:libmysqlclient)) +$(eval $(call BuildModule,opcache,OPcache,,,zend)) +$(eval $(call BuildModule,openssl,OpenSSL,+PACKAGE_php7-mod-openssl:libopenssl)) +$(eval $(call BuildModule,pcntl,PCNTL)) +$(eval $(call BuildModule,pdo,PHP Data Objects)) +$(eval $(call BuildModule,pdo-mysql,PDO driver for MySQL,+php7-mod-pdo +PACKAGE_php7-mod-pdo-mysql:libmysqlclient)) +$(eval $(call BuildModule,pdo-pgsql,PDO driver for PostgreSQL,+php7-mod-pdo +PACKAGE_php7-mod-pdo-pgsql:libpq)) +$(eval $(call BuildModule,pdo-sqlite,PDO driver for SQLite 3.x,+php7-mod-pdo +PACKAGE_php7-mod-pdo-sqlite:libsqlite3 +PACKAGE_php7-mod-pdo-sqlite:librt)) +$(eval $(call BuildModule,pgsql,PostgreSQL,+PACKAGE_php7-mod-pgsql:libpq)) +$(eval $(call BuildModule,phar,Phar Archives,+php7-mod-hash)) +$(eval $(call BuildModule,session,Session)) +$(eval $(call BuildModule,shmop,Shared Memory)) +$(eval $(call BuildModule,simplexml,SimpleXML,+@PHP7_LIBXML +PACKAGE_php7-mod-simplexml:libxml2)) +$(eval $(call BuildModule,soap,SOAP,+@PHP7_LIBXML +PACKAGE_php7-mod-soap:libxml2)) +$(eval $(call BuildModule,sockets,Sockets)) +$(eval $(call BuildModule,sqlite3,SQLite3,+PACKAGE_php7-mod-sqlite3:libsqlite3)) +$(eval $(call BuildModule,sysvmsg,System V messages)) +$(eval $(call BuildModule,sysvsem,System V shared memory)) +$(eval $(call BuildModule,sysvshm,System V semaphore)) +$(eval $(call BuildModule,tokenizer,Tokenizer)) +$(eval $(call BuildModule,xml,XML,+PHP7_LIBXML:libxml2 +!PHP7_LIBXML:libexpat)) +$(eval $(call BuildModule,xmlreader,XMLReader,+@PHP7_LIBXML +PACKAGE_php7-mod-xmlreader:libxml2)) +$(eval $(call BuildModule,xmlwriter,XMLWriter,+@PHP7_LIBXML +PACKAGE_php7-mod-xmlwriter:libxml2)) +$(eval $(call BuildModule,zip,ZIP,+PACKAGE_php7-mod-zip:zlib)) diff --git a/lang/php7/files/php.ini b/lang/php7/files/php.ini new file mode 100644 index 0000000..c88ab0a --- /dev/null +++ b/lang/php7/files/php.ini @@ -0,0 +1,152 @@ +[PHP] +zend.ze1_compatibility_mode = Off + +; Language Options + +engine = On +;short_open_tag = Off +precision = 12 +y2k_compliance = On +output_buffering = Off +;output_handler = +zlib.output_compression = Off +;zlib.output_compression_level = -1 +;zlib.output_handler = +implicit_flush = Off +unserialize_callback_func = +serialize_precision = 100 + +;open_basedir = +disable_functions = +disable_classes = + +; Colors for Syntax Highlighting mode. Anything that's acceptable in +; would work. +;highlight.string = #DD0000 +;highlight.comment = #FF9900 +;highlight.keyword = #007700 +;highlight.bg = #FFFFFF +;highlight.default = #0000BB +;highlight.html = #000000 + +;ignore_user_abort = On +;realpath_cache_size = 16k +;realpath_cache_ttl = 120 + +; Miscellaneous + +expose_php = On + +; Resource Limits + +max_execution_time = 30 ; Maximum execution time of each script, in seconds. +max_input_time = 60 ; Maximum amount of time each script may spend parsing request data. +;max_input_nesting_level = 64 +memory_limit = 8M ; Maximum amount of memory a script may consume. + +; Error handling and logging + +; Error Level Constants: +; E_ALL - All errors and warnings (includes E_STRICT as of PHP 6.0.0) +; E_ERROR - fatal run-time errors +; E_RECOVERABLE_ERROR - almost fatal run-time errors +; E_WARNING - run-time warnings (non-fatal errors) +; E_PARSE - compile-time parse errors +; E_NOTICE - run-time notices (these are warnings which often result +; from a bug in your code, but it's possible that it was +; intentional (e.g., using an uninitialized variable and +; relying on the fact it's automatically initialized to an +; empty string) +; E_STRICT - run-time notices, enable to have PHP suggest changes +; to your code which will ensure the best interoperability +; and forward compatibility of your code +; E_CORE_ERROR - fatal errors that occur during PHP's initial startup +; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's +; initial startup +; E_COMPILE_ERROR - fatal compile-time errors +; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) +; E_USER_ERROR - user-generated error message +; E_USER_WARNING - user-generated warning message +; E_USER_NOTICE - user-generated notice message +; E_DEPRECATED - warn about code that will not work in future versions +; of PHP +; E_USER_DEPRECATED - user-generated deprecation warnings +; +; Common Values: +; E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.) +; E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices) +; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) +; E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.) +; Default Value: E_ALL & ~E_NOTICE +error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT + +display_errors = On +display_startup_errors = Off +log_errors = Off +log_errors_max_len = 1024 +ignore_repeated_errors = Off +ignore_repeated_source = Off +report_memleaks = On +;report_zend_debug = 0 +track_errors = Off +;html_errors = Off +;docref_root = "/phpmanual/" +;docref_ext = .html +;error_prepend_string = "" +;error_append_string = "" +; Log errors to specified file. +;error_log = /var/log/php_errors.log +; Log errors to syslog. +;error_log = syslog + +; Data Handling + +;arg_separator.output = "&" +;arg_separator.input = ";&" +variables_order = "EGPCS" +request_order = "GP" +register_globals = Off +register_long_arrays = Off +register_argc_argv = On +auto_globals_jit = On +post_max_size = 8M +;magic_quotes_gpc = Off +magic_quotes_runtime = Off +magic_quotes_sybase = Off +auto_prepend_file = +auto_append_file = +default_mimetype = "text/html" +;default_charset = "iso-8859-1" +;always_populate_raw_post_data = On + +; Paths and Directories + +; UNIX: "/path1:/path2" +;include_path = ".:/php/includes" +doc_root = "/www" +user_dir = +extension_dir = "/usr/lib/php" +enable_dl = On +;cgi.force_redirect = 1 +;cgi.nph = 1 +;cgi.redirect_status_env = ; +cgi.fix_pathinfo=1 +;fastcgi.impersonate = 1; +;fastcgi.logging = 0 +;cgi.rfc2616_headers = 0 + +; File Uploads + +file_uploads = On +upload_tmp_dir = "/tmp" +upload_max_filesize = 2M +max_file_uploads = 20 + +; Fopen wrappers + +allow_url_fopen = On +allow_url_include = Off +;from="john@doe.com" +;user_agent="PHP" +default_socket_timeout = 60 +;auto_detect_line_endings = Off diff --git a/lang/php7/files/php7-fastcgi.config b/lang/php7/files/php7-fastcgi.config new file mode 100644 index 0000000..22e9998 --- /dev/null +++ b/lang/php7/files/php7-fastcgi.config @@ -0,0 +1,3 @@ +config php7-fastcgi + option enabled 1 + option port '1026' diff --git a/lang/php7/files/php7-fastcgi.init b/lang/php7/files/php7-fastcgi.init new file mode 100644 index 0000000..21f5b09 --- /dev/null +++ b/lang/php7/files/php7-fastcgi.init @@ -0,0 +1,29 @@ +#!/bin/sh /etc/rc.common + +START=50 + +SERVICE_DAEMONIZE=1 +SERVICE_WRITE_PID=1 + +start_instance() { + local section="$1" + local enabled + local port + + config_get_bool enabled "$section" 'enabled' 0 + config_get port "$section" 'port' 1026 + + [ $enabled -gt 0 ] || return 1 + + PHP_FCGI_CHILDREN='' \ + service_start /usr/bin/php-fcgi -b $port +} + +start() { + config_load 'php7-fastcgi' + config_foreach start_instance 'php7-fastcgi' +} + +stop() { + service_stop /usr/bin/php-fcgi +} diff --git a/lang/php7/files/php7-fpm-www.conf b/lang/php7/files/php7-fpm-www.conf new file mode 100644 index 0000000..d3a3222 --- /dev/null +++ b/lang/php7/files/php7-fpm-www.conf @@ -0,0 +1,392 @@ +; Start a new pool named 'www'. +; the variable $pool can we used in any directive and will be replaced by the +; pool name ('www' here) +[www] + +; Per pool prefix +; It only applies on the following directives: +; - 'slowlog' +; - 'listen' (unixsocket) +; - 'chroot' +; - 'chdir' +; - 'php_values' +; - 'php_admin_values' +; When not set, the global prefix (or /usr) applies instead. +; Note: This directive can also be relative to the global prefix. +; Default Value: none +;prefix = /path/to/pools/$pool + +; Unix user/group of processes +; Note: The user is mandatory. If the group is not set, the default user's group +; will be used. +user = nobody +;group = + +; The address on which to accept FastCGI requests. +; Valid syntaxes are: +; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on +; a specific port; +; 'port' - to listen on a TCP socket to all addresses on a +; specific port; +; '/path/to/unix/socket' - to listen on a unix socket. +; Note: This value is mandatory. +listen = /var/run/php7-fpm.sock + +; Set listen(2) backlog. +; Default Value: 128 (-1 on FreeBSD and OpenBSD) +;listen.backlog = 128 + +; Set permissions for unix socket, if one is used. In Linux, read/write +; permissions must be set in order to allow connections from a web server. Many +; BSD-derived systems allow connections regardless of permissions. +; Default Values: user and group are set as the running user +; mode is set to 0666 +;listen.owner = www-data +;listen.group = www-data +;listen.mode = 0666 + +; List of ipv4 addresses of FastCGI clients which are allowed to connect. +; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original +; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address +; must be separated by a comma. If this value is left blank, connections will be +; accepted from any ip address. +; Default Value: any +;listen.allowed_clients = 127.0.0.1 + +; Specify the nice(2) priority to apply to the pool processes (only if set) +; The value can vary from -19 (highest priority) to 20 (lower priority) +; Note: - It will only work if the FPM master process is launched as root +; - The pool processes will inherit the master process priority +; unless it specified otherwise +; Default Value: no set +; priority = -19 + +; Choose how the process manager will control the number of child processes. +; Possible Values: +; static - a fixed number (pm.max_children) of child processes; +; dynamic - the number of child processes are set dynamically based on the +; following directives. With this process management, there will be +; always at least 1 children. +; pm.max_children - the maximum number of children that can +; be alive at the same time. +; pm.start_servers - the number of children created on startup. +; pm.min_spare_servers - the minimum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is less than this +; number then some children will be created. +; pm.max_spare_servers - the maximum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is greater than this +; number then some children will be killed. +; ondemand - no children are created at startup. Children will be forked when +; new requests will connect. The following parameter are used: +; pm.max_children - the maximum number of children that +; can be alive at the same time. +; pm.process_idle_timeout - The number of seconds after which +; an idle process will be killed. +; Note: This value is mandatory. +pm = dynamic + +; The number of child processes to be created when pm is set to 'static' and the +; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. +; This value sets the limit on the number of simultaneous requests that will be +; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. +; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP +; CGI. The below defaults are based on a server without much resources. Don't +; forget to tweak pm.* to fit your needs. +; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' +; Note: This value is mandatory. +pm.max_children = 5 + +; The number of child processes created on startup. +; Note: Used only when pm is set to 'dynamic' +; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 +pm.start_servers = 2 + +; The desired minimum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.min_spare_servers = 1 + +; The desired maximum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.max_spare_servers = 3 + +; The number of seconds after which an idle process will be killed. +; Note: Used only when pm is set to 'ondemand' +; Default Value: 10s +;pm.process_idle_timeout = 10s; + +; The number of requests each child process should execute before respawning. +; This can be useful to work around memory leaks in 3rd party libraries. For +; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. +; Default Value: 0 +;pm.max_requests = 500 + +; The URI to view the FPM status page. If this value is not set, no URI will be +; recognized as a status page. It shows the following informations: +; pool - the name of the pool; +; process manager - static, dynamic or ondemand; +; start time - the date and time FPM has started; +; start since - number of seconds since FPM has started; +; accepted conn - the number of request accepted by the pool; +; listen queue - the number of request in the queue of pending +; connections (see backlog in listen(2)); +; max listen queue - the maximum number of requests in the queue +; of pending connections since FPM has started; +; listen queue len - the size of the socket queue of pending connections; +; idle processes - the number of idle processes; +; active processes - the number of active processes; +; total processes - the number of idle + active processes; +; max active processes - the maximum number of active processes since FPM +; has started; +; max children reached - number of times, the process limit has been reached, +; when pm tries to start more children (works only for +; pm 'dynamic' and 'ondemand'); +; Value are updated in real time. +; Example output: +; pool: www +; process manager: static +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 62636 +; accepted conn: 190460 +; listen queue: 0 +; max listen queue: 1 +; listen queue len: 42 +; idle processes: 4 +; active processes: 11 +; total processes: 15 +; max active processes: 12 +; max children reached: 0 +; +; By default the status page output is formatted as text/plain. Passing either +; 'html', 'xml' or 'json' in the query string will return the corresponding +; output syntax. Example: +; http://www.foo.bar/status +; http://www.foo.bar/status?json +; http://www.foo.bar/status?html +; http://www.foo.bar/status?xml +; +; By default the status page only outputs short status. Passing 'full' in the +; query string will also return status for each pool process. +; Example: +; http://www.foo.bar/status?full +; http://www.foo.bar/status?json&full +; http://www.foo.bar/status?html&full +; http://www.foo.bar/status?xml&full +; The Full status returns for each process: +; pid - the PID of the process; +; state - the state of the process (Idle, Running, ...); +; start time - the date and time the process has started; +; start since - the number of seconds since the process has started; +; requests - the number of requests the process has served; +; request duration - the duration in µs of the requests; +; request method - the request method (GET, POST, ...); +; request URI - the request URI with the query string; +; content length - the content length of the request (only with POST); +; user - the user (PHP_AUTH_USER) (or '-' if not set); +; script - the main script called (or '-' if not set); +; last request cpu - the %cpu the last request consumed +; it's always 0 if the process is not in Idle state +; because CPU calculation is done when the request +; processing has terminated; +; last request memory - the max amount of memory the last request consumed +; it's always 0 if the process is not in Idle state +; because memory calculation is done when the request +; processing has terminated; +; If the process is in Idle state, then informations are related to the +; last request the process has served. Otherwise informations are related to +; the current request being served. +; Example output: +; ************************ +; pid: 31330 +; state: Running +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 63087 +; requests: 12808 +; request duration: 1250261 +; request method: GET +; request URI: /test_mem.php?N=10000 +; content length: 0 +; user: - +; script: /home/fat/web/docs/php/test_mem.php +; last request cpu: 0.00 +; last request memory: 0 +; +; Note: There is a real-time FPM status monitoring sample web page available +; It's available in: ${prefix}/share/fpm/status.html +; +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;pm.status_path = /status + +; The ping URI to call the monitoring page of FPM. If this value is not set, no +; URI will be recognized as a ping page. This could be used to test from outside +; that FPM is alive and responding, or to +; - create a graph of FPM availability (rrd or such); +; - remove a server from a group if it is not responding (load balancing); +; - trigger alerts for the operating team (24/7). +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;ping.path = /ping + +; This directive may be used to customize the response of a ping request. The +; response is formatted as text/plain with a 200 response code. +; Default Value: pong +;ping.response = pong + +; The access log file +; Default: not set +;access.log = log/$pool.access.log + +; The access log format. +; The following syntax is allowed +; %%: the '%' character +; %C: %CPU used by the request +; it can accept the following format: +; - %{user}C for user CPU only +; - %{system}C for system CPU only +; - %{total}C for user + system CPU (default) +; %d: time taken to serve the request +; it can accept the following format: +; - %{seconds}d (default) +; - %{miliseconds}d +; - %{mili}d +; - %{microseconds}d +; - %{micro}d +; %e: an environment variable (same as $_ENV or $_SERVER) +; it must be associated with embraces to specify the name of the env +; variable. Some exemples: +; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e +; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e +; %f: script filename +; %l: content-length of the request (for POST request only) +; %m: request method +; %M: peak of memory allocated by PHP +; it can accept the following format: +; - %{bytes}M (default) +; - %{kilobytes}M +; - %{kilo}M +; - %{megabytes}M +; - %{mega}M +; %n: pool name +; %o: ouput header +; it must be associated with embraces to specify the name of the header: +; - %{Content-Type}o +; - %{X-Powered-By}o +; - %{Transfert-Encoding}o +; - .... +; %p: PID of the child that serviced the request +; %P: PID of the parent of the child that serviced the request +; %q: the query string +; %Q: the '?' character if query string exists +; %r: the request URI (without the query string, see %q and %Q) +; %R: remote IP address +; %s: status (response code) +; %t: server time the request was received +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; %T: time the log has been written (the request has finished) +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; %u: remote user +; +; Default: "%R - %u %t \"%m %r\" %s" +;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" + +; The log file for slow requests +; Default Value: not set +; Note: slowlog is mandatory if request_slowlog_timeout is set +;slowlog = log/$pool.log.slow + +; The timeout for serving a single request after which a PHP backtrace will be +; dumped to the 'slowlog' file. A value of '0s' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +;request_slowlog_timeout = 0 + +; The timeout for serving a single request after which the worker process will +; be killed. This option should be used when the 'max_execution_time' ini option +; does not stop script execution for some reason. A value of '0' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +;request_terminate_timeout = 0 + +; Set open file descriptor rlimit. +; Default Value: system defined value +;rlimit_files = 1024 + +; Set max core size rlimit. +; Possible Values: 'unlimited' or an integer greater or equal to 0 +; Default Value: system defined value +;rlimit_core = 0 + +; Chroot to this directory at the start. This value must be defined as an +; absolute path. When this value is not set, chroot is not used. +; Note: you can prefix with '$prefix' to chroot to the pool prefix or one +; of its subdirectories. If the pool prefix is not set, the global prefix +; will be used instead. +; Note: chrooting is a great security feature and should be used whenever +; possible. However, all PHP paths will be relative to the chroot +; (error_log, sessions.save_path, ...). +; Default Value: not set +;chroot = + +; Chdir to this directory at the start. +; Note: relative path can be used. +; Default Value: current directory or / when chroot +chdir = / + +; Redirect worker stdout and stderr into main error log. If not set, stdout and +; stderr will be redirected to /dev/null according to FastCGI specs. +; Note: on highloaded environement, this can cause some delay in the page +; process time (several ms). +; Default Value: no +;catch_workers_output = yes + +; Limits the extensions of the main script FPM will allow to parse. This can +; prevent configuration mistakes on the web server side. You should only limit +; FPM to .php extensions to prevent malicious users to use other extensions to +; exectute php code. +; Note: set an empty value to allow all extensions. +; Default Value: .php +;security.limit_extensions = .php .php3 .php4 .php5 + +; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from +; the current environment. +; Default Value: clean env +;env[HOSTNAME] = $HOSTNAME +;env[PATH] = /usr/local/bin:/usr/bin:/bin +;env[TMP] = /tmp +;env[TMPDIR] = /tmp +;env[TEMP] = /tmp + +; Additional php.ini defines, specific to this pool of workers. These settings +; overwrite the values previously defined in the php.ini. The directives are the +; same as the PHP SAPI: +; php_value/php_flag - you can set classic ini defines which can +; be overwritten from PHP call 'ini_set'. +; php_admin_value/php_admin_flag - these directives won't be overwritten by +; PHP call 'ini_set' +; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. + +; Defining 'extension' will load the corresponding shared extension from +; extension_dir. Defining 'disable_functions' or 'disable_classes' will not +; overwrite previously defined php.ini values, but will append the new value +; instead. + +; Note: path INI options can be relative and will be expanded with the prefix +; (pool, global or /usr) + +; Default Value: nothing is defined by default except the values in php.ini and +; specified at startup with the -d argument +;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com +;php_flag[display_errors] = off +;php_admin_value[error_log] = /var/log/fpm-php.www.log +;php_admin_flag[log_errors] = on +;php_admin_value[memory_limit] = 32M diff --git a/lang/php7/files/php7-fpm.conf b/lang/php7/files/php7-fpm.conf new file mode 100644 index 0000000..c980b21 --- /dev/null +++ b/lang/php7/files/php7-fpm.conf @@ -0,0 +1,121 @@ +;;;;;;;;;;;;;;;;;;;;; +; FPM Configuration ; +;;;;;;;;;;;;;;;;;;;;; + +; All relative paths in this configuration file are relative to PHP's install +; prefix (/usr). This prefix can be dynamically changed by using the +; '-p' argument from the command line. + +; Include one or more files. If glob(3) exists, it is used to include a bunch of +; files from a glob(3) pattern. This directive can be used everywhere in the +; file. +; Relative path can also be used. They will be prefixed by: +; - the global prefix if it's been set (-p argument) +; - /usr otherwise +;include=/etc/php7/fpm/*.conf + +;;;;;;;;;;;;;;;;;; +; Global Options ; +;;;;;;;;;;;;;;;;;; + +[global] +; Pid file +; Note: the default prefix is /var +; Default Value: none +pid = /var/run/php7-fpm.pid + +; Error log file +; If it's set to "syslog", log is sent to syslogd instead of being written +; in a local file. +; Note: the default prefix is /var +; Default Value: log/php-fpm.log +error_log = /var/log/php7-fpm.log + +; syslog_facility is used to specify what type of program is logging the +; message. This lets syslogd specify that messages from different facilities +; will be handled differently. +; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) +; Default Value: daemon +;syslog.facility = daemon + +; syslog_ident is prepended to every message. If you have multiple FPM +; instances running on the same server, you can change the default value +; which must suit common needs. +; Default Value: php-fpm +;syslog.ident = php-fpm + +; Log level +; Possible Values: alert, error, warning, notice, debug +; Default Value: notice +;log_level = notice + +; If this number of child processes exit with SIGSEGV or SIGBUS within the time +; interval set by emergency_restart_interval then FPM will restart. A value +; of '0' means 'Off'. +; Default Value: 0 +;emergency_restart_threshold = 0 + +; Interval of time used by emergency_restart_interval to determine when +; a graceful restart will be initiated. This can be useful to work around +; accidental corruptions in an accelerator's shared memory. +; Available Units: s(econds), m(inutes), h(ours), or d(ays) +; Default Unit: seconds +; Default Value: 0 +;emergency_restart_interval = 0 + +; Time limit for child processes to wait for a reaction on signals from master. +; Available units: s(econds), m(inutes), h(ours), or d(ays) +; Default Unit: seconds +; Default Value: 0 +;process_control_timeout = 0 + +; The maximum number of processes FPM will fork. This has been design to control +; the global number of processes when using dynamic PM within a lot of pools. +; Use it with caution. +; Note: A value of 0 indicates no limit +; Default Value: 0 +; process.max = 128 + +; Specify the nice(2) priority to apply to the master process (only if set) +; The value can vary from -19 (highest priority) to 20 (lower priority) +; Note: - It will only work if the FPM master process is launched as root +; - The pool process will inherit the master process priority +; unless it specified otherwise +; Default Value: no set +; process.priority = -19 + +; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. +; Default Value: yes +;daemonize = yes + +; Set open file descriptor rlimit for the master process. +; Default Value: system defined value +;rlimit_files = 1024 + +; Set max core size rlimit for the master process. +; Possible Values: 'unlimited' or an integer greater or equal to 0 +; Default Value: system defined value +;rlimit_core = 0 + +; Specify the event mechanism FPM will use. The following is available: +; - select (any POSIX os) +; - poll (any POSIX os) +; - epoll (linux >= 2.5.44) +; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) +; - /dev/poll (Solaris >= 7) +; - port (Solaris >= 10) +; Default Value: not set (auto detection) +; events.mechanism = epoll + +;;;;;;;;;;;;;;;;;;;; +; Pool Definitions ; +;;;;;;;;;;;;;;;;;;;; + +; Multiple pools of child processes may be started with different listening +; ports and different management options. The name of the pool will be +; used in logs and stats. There is no limitation on the number of pools which +; FPM can handle. Your system will tell you anyway :) + +; To configure the pools it is recommended to have one .conf file per +; pool in the following directory: +include=/etc/php7-fpm.d/*.conf diff --git a/lang/php7/files/php7-fpm.config b/lang/php7/files/php7-fpm.config new file mode 100644 index 0000000..3a893c6 --- /dev/null +++ b/lang/php7/files/php7-fpm.config @@ -0,0 +1,2 @@ +config php7-fpm + option enabled 1 diff --git a/lang/php7/files/php7-fpm.init b/lang/php7/files/php7-fpm.init new file mode 100644 index 0000000..c913a2b --- /dev/null +++ b/lang/php7/files/php7-fpm.init @@ -0,0 +1,28 @@ +#!/bin/sh /etc/rc.common + +START=50 + +PROG=/usr/bin/php-fpm +CONFIG=/etc/php7-fpm.conf + +SERVICE_PID_FILE=/var/run/php7-fpm.pid + +start_instance() { + local section="$1" + local enabled + + config_get_bool enabled "$section" 'enabled' 0 + + [ $enabled -gt 0 ] || return 1 + + service_start $PROG -y $CONFIG -g $SERVICE_PID_FILE +} + +start() { + config_load 'php7-fpm' + config_foreach start_instance 'php7-fpm' +} + +stop() { + service_stop $PROG +} diff --git a/lang/php7/patches/0013-Add-support-for-use-of-the-system-timezone-database.patch b/lang/php7/patches/0013-Add-support-for-use-of-the-system-timezone-database.patch new file mode 100644 index 0000000..9d8f989 --- /dev/null +++ b/lang/php7/patches/0013-Add-support-for-use-of-the-system-timezone-database.patch @@ -0,0 +1,673 @@ +From: Joe Orton +Date: Sun, 18 Oct 2015 02:15:17 +0200 +Subject: Add support for use of the system timezone database + +Add support for use of the system timezone database, rather +than embedding a copy. Discussed upstream but was not desired. + +History: +r13: adapt for upstream changes to use PHP allocator +r12: adapt for upstream changes for new zic +r11: use canonical names to avoid more case sensitivity issues + round lat/long from zone.tab towards zero per builtin db +r10: make timezone case insensitive +r9: fix another compile error without --with-system-tzdata configured (Michael Heimpold) +r8: fix compile error without --with-system-tzdata configured +r7: improve check for valid timezone id to exclude directories +r6: fix fd leak in r5, fix country code/BC flag use in + timezone_identifiers_list() using system db, + fix use of PECL timezonedb to override system db, +r5: reverts addition of "System/Localtime" fake tzname. + updated for 5.3.0, parses zone.tab to pick up mapping between + timezone name, country code and long/lat coords +r4: added "System/Localtime" tzname which uses /etc/localtime +r3: fix a crash if /usr/share/zoneinfo doesn't exist (Raphael Geissert) +r2: add filesystem trawl to set up name alias index +r1: initial revision +--- + ext/date/lib/parse_tz.c | 549 +++++++++++++++++++++++++++++++++++++++++++++++- + ext/date/lib/timelib.m4 | 14 ++ + 2 files changed, 552 insertions(+), 11 deletions(-) + +diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c +index 20d7eea..6301dc5 100644 +--- a/ext/date/lib/parse_tz.c ++++ b/ext/date/lib/parse_tz.c +@@ -24,6 +24,16 @@ + + #include "timelib.h" + ++#ifdef HAVE_SYSTEM_TZDATA ++#include ++#include ++#include ++#include ++#include ++ ++#include "php_scandir.h" ++#endif ++ + #include + + #ifdef HAVE_LOCALE_H +@@ -36,8 +46,12 @@ + #include + #endif + ++#ifndef HAVE_SYSTEM_TZDATA + #define TIMELIB_SUPPORTS_V2DATA + #include "timezonedb.h" ++#endif ++ ++#include + + #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) + # if defined(__LITTLE_ENDIAN__) +@@ -59,6 +73,11 @@ static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz) + { + uint32_t version; + ++ if (memcmp(*tzf, "TZif", 4) == 0) { ++ *tzf += 20; ++ return 0; ++ } ++ + /* read ID */ + version = (*tzf)[3] - '0'; + *tzf += 4; +@@ -302,7 +321,418 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz) + } + } + +-static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) ++#ifdef HAVE_SYSTEM_TZDATA ++ ++#ifdef HAVE_SYSTEM_TZDATA_PREFIX ++#define ZONEINFO_PREFIX HAVE_SYSTEM_TZDATA_PREFIX ++#else ++#define ZONEINFO_PREFIX "/usr/share/zoneinfo" ++#endif ++ ++/* System timezone database pointer. */ ++static const timelib_tzdb *timezonedb_system; ++ ++/* Hash table entry for the cache of the zone.tab mapping table. */ ++struct location_info { ++ char code[2]; ++ double latitude, longitude; ++ char name[64]; ++ char *comment; ++ struct location_info *next; ++}; ++ ++/* Cache of zone.tab. */ ++static struct location_info **system_location_table; ++ ++/* Size of the zone.tab hash table; a random-ish prime big enough to ++ * prevent too many collisions. */ ++#define LOCINFO_HASH_SIZE (1021) ++ ++/* Compute a case insensitive hash of str */ ++static uint32_t tz_hash(const char *str) ++{ ++ const unsigned char *p = (const unsigned char *)str; ++ uint32_t hash = 5381; ++ int c; ++ ++ while ((c = tolower(*p++)) != '\0') { ++ hash = (hash << 5) ^ hash ^ c; ++ } ++ ++ return hash % LOCINFO_HASH_SIZE; ++} ++ ++/* Parse an ISO-6709 date as used in zone.tab. Returns end of the ++ * parsed string on success, or NULL on parse error. On success, ++ * writes the parsed number to *result. */ ++static char *parse_iso6709(char *p, double *result) ++{ ++ double v, sign; ++ char *pend; ++ size_t len; ++ ++ if (*p == '+') ++ sign = 1.0; ++ else if (*p == '-') ++ sign = -1.0; ++ else ++ return NULL; ++ ++ p++; ++ for (pend = p; *pend >= '0' && *pend <= '9'; pend++) ++ ;; ++ ++ /* Annoying encoding used by zone.tab has no decimal point, so use ++ * the length to determine the format: ++ * ++ * 4 = DDMM ++ * 5 = DDDMM ++ * 6 = DDMMSS ++ * 7 = DDDMMSS ++ */ ++ len = pend - p; ++ if (len < 4 || len > 7) { ++ return NULL; ++ } ++ ++ /* p => [D]DD */ ++ v = (p[0] - '0') * 10.0 + (p[1] - '0'); ++ p += 2; ++ if (len == 5 || len == 7) ++ v = v * 10.0 + (*p++ - '0'); ++ /* p => MM[SS] */ ++ v += (10.0 * (p[0] - '0') ++ + p[1] - '0') / 60.0; ++ p += 2; ++ /* p => [SS] */ ++ if (len > 5) { ++ v += (10.0 * (p[0] - '0') ++ + p[1] - '0') / 3600.0; ++ p += 2; ++ } ++ ++ /* Round to five decimal place, not because it's a good idea, ++ * but, because the builtin data uses rounded data, so, match ++ * that. */ ++ *result = trunc(v * sign * 100000.0) / 100000.0; ++ ++ return p; ++} ++ ++/* This function parses the zone.tab file to build up the mapping of ++ * timezone to country code and geographic location, and returns a ++ * hash table. The hash table is indexed by the function: ++ * ++ * tz_hash(timezone-name) ++ */ ++static struct location_info **create_location_table(void) ++{ ++ struct location_info **li, *i; ++ char zone_tab[PATH_MAX]; ++ char line[512]; ++ FILE *fp; ++ ++ strncpy(zone_tab, ZONEINFO_PREFIX "/zone.tab", sizeof zone_tab); ++ ++ fp = fopen(zone_tab, "r"); ++ if (!fp) { ++ return NULL; ++ } ++ ++ li = calloc(LOCINFO_HASH_SIZE, sizeof *li); ++ ++ while (fgets(line, sizeof line, fp)) { ++ char *p = line, *code, *name, *comment; ++ uint32_t hash; ++ double latitude, longitude; ++ ++ while (isspace(*p)) ++ p++; ++ ++ if (*p == '#' || *p == '\0' || *p == '\n') ++ continue; ++ ++ if (!isalpha(p[0]) || !isalpha(p[1]) || p[2] != '\t') ++ continue; ++ ++ /* code => AA */ ++ code = p; ++ p[2] = 0; ++ p += 3; ++ ++ /* coords => [+-][D]DDMM[SS][+-][D]DDMM[SS] */ ++ p = parse_iso6709(p, &latitude); ++ if (!p) { ++ continue; ++ } ++ p = parse_iso6709(p, &longitude); ++ if (!p) { ++ continue; ++ } ++ ++ if (!p || *p != '\t') { ++ continue; ++ } ++ ++ /* name = string */ ++ name = ++p; ++ while (*p != '\t' && *p && *p != '\n') ++ p++; ++ ++ *p++ = '\0'; ++ ++ /* comment = string */ ++ comment = p; ++ while (*p != '\t' && *p && *p != '\n') ++ p++; ++ ++ if (*p == '\n' || *p == '\t') ++ *p = '\0'; ++ ++ hash = tz_hash(name); ++ i = malloc(sizeof *i); ++ memcpy(i->code, code, 2); ++ strncpy(i->name, name, sizeof i->name); ++ i->comment = strdup(comment); ++ i->longitude = longitude; ++ i->latitude = latitude; ++ i->next = li[hash]; ++ li[hash] = i; ++ /* printf("%s [%u, %f, %f]\n", name, hash, latitude, longitude); */ ++ } ++ ++ fclose(fp); ++ ++ return li; ++} ++ ++/* Return location info from hash table, using given timezone name. ++ * Returns NULL if the name could not be found. */ ++const struct location_info *find_zone_info(struct location_info **li, ++ const char *name) ++{ ++ uint32_t hash = tz_hash(name); ++ const struct location_info *l; ++ ++ if (!li) { ++ return NULL; ++ } ++ ++ for (l = li[hash]; l; l = l->next) { ++ if (strcasecmp(l->name, name) == 0) ++ return l; ++ } ++ ++ return NULL; ++} ++ ++/* Filter out some non-tzdata files and the posix/right databases, if ++ * present. */ ++static int index_filter(const struct dirent *ent) ++{ ++ return strcmp(ent->d_name, ".") != 0 ++ && strcmp(ent->d_name, "..") != 0 ++ && strcmp(ent->d_name, "posix") != 0 ++ && strcmp(ent->d_name, "posixrules") != 0 ++ && strcmp(ent->d_name, "right") != 0 ++ && strstr(ent->d_name, ".tab") == NULL; ++} ++ ++static int sysdbcmp(const void *first, const void *second) ++{ ++ const timelib_tzdb_index_entry *alpha = first, *beta = second; ++ ++ return strcasecmp(alpha->id, beta->id); ++} ++ ++ ++/* Create the zone identifier index by trawling the filesystem. */ ++static void create_zone_index(timelib_tzdb *db) ++{ ++ size_t dirstack_size, dirstack_top; ++ size_t index_size, index_next; ++ timelib_tzdb_index_entry *db_index; ++ char **dirstack; ++ ++ /* LIFO stack to hold directory entries to scan; each slot is a ++ * directory name relative to the zoneinfo prefix. */ ++ dirstack_size = 32; ++ dirstack = malloc(dirstack_size * sizeof *dirstack); ++ dirstack_top = 1; ++ dirstack[0] = strdup(""); ++ ++ /* Index array. */ ++ index_size = 64; ++ db_index = malloc(index_size * sizeof *db_index); ++ index_next = 0; ++ ++ do { ++ struct dirent **ents; ++ char name[PATH_MAX], *top; ++ int count; ++ ++ /* Pop the top stack entry, and iterate through its contents. */ ++ top = dirstack[--dirstack_top]; ++ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s", top); ++ ++ count = php_scandir(name, &ents, index_filter, php_alphasort); ++ ++ while (count > 0) { ++ struct stat st; ++ const char *leaf = ents[count - 1]->d_name; ++ ++ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s/%s", ++ top, leaf); ++ ++ if (strlen(name) && stat(name, &st) == 0) { ++ /* Name, relative to the zoneinfo prefix. */ ++ const char *root = top; ++ ++ if (root[0] == '/') root++; ++ ++ snprintf(name, sizeof name, "%s%s%s", root, ++ *root ? "/": "", leaf); ++ ++ if (S_ISDIR(st.st_mode)) { ++ if (dirstack_top == dirstack_size) { ++ dirstack_size *= 2; ++ dirstack = realloc(dirstack, ++ dirstack_size * sizeof *dirstack); ++ } ++ dirstack[dirstack_top++] = strdup(name); ++ } ++ else { ++ if (index_next == index_size) { ++ index_size *= 2; ++ db_index = realloc(db_index, ++ index_size * sizeof *db_index); ++ } ++ ++ db_index[index_next++].id = strdup(name); ++ } ++ } ++ ++ free(ents[--count]); ++ } ++ ++ if (count != -1) free(ents); ++ free(top); ++ } while (dirstack_top); ++ ++ qsort(db_index, index_next, sizeof *db_index, sysdbcmp); ++ ++ db->index = db_index; ++ db->index_size = index_next; ++ ++ free(dirstack); ++} ++ ++#define FAKE_HEADER "1234\0??\1??" ++#define FAKE_UTC_POS (7 - 4) ++ ++/* Create a fake data segment for database 'sysdb'. */ ++static void fake_data_segment(timelib_tzdb *sysdb, ++ struct location_info **info) ++{ ++ size_t n; ++ char *data, *p; ++ ++ data = malloc(3 * sysdb->index_size + 7); ++ ++ p = mempcpy(data, FAKE_HEADER, sizeof(FAKE_HEADER) - 1); ++ ++ for (n = 0; n < sysdb->index_size; n++) { ++ const struct location_info *li; ++ timelib_tzdb_index_entry *ent; ++ ++ ent = (timelib_tzdb_index_entry *)&sysdb->index[n]; ++ ++ /* Lookup the timezone name in the hash table. */ ++ if (strcmp(ent->id, "UTC") == 0) { ++ ent->pos = FAKE_UTC_POS; ++ continue; ++ } ++ ++ li = find_zone_info(info, ent->id); ++ if (li) { ++ /* If found, append the BC byte and the ++ * country code; set the position for this ++ * section of timezone data. */ ++ ent->pos = (p - data) - 4; ++ *p++ = '\1'; ++ *p++ = li->code[0]; ++ *p++ = li->code[1]; ++ } ++ else { ++ /* If not found, the timezone data can ++ * point at the header. */ ++ ent->pos = 0; ++ } ++ } ++ ++ sysdb->data = (unsigned char *)data; ++} ++ ++/* Returns true if the passed-in stat structure describes a ++ * probably-valid timezone file. */ ++static int is_valid_tzfile(const struct stat *st) ++{ ++ return S_ISREG(st->st_mode) && st->st_size > 20; ++} ++ ++/* To allow timezone names to be used case-insensitively, find the ++ * canonical name for this timezone, if possible. */ ++static const char *canonical_tzname(const char *timezone) ++{ ++ if (timezonedb_system) { ++ timelib_tzdb_index_entry *ent, lookup; ++ ++ lookup.id = (char *)timezone; ++ ++ ent = bsearch(&lookup, timezonedb_system->index, ++ timezonedb_system->index_size, sizeof lookup, ++ sysdbcmp); ++ if (ent) { ++ return ent->id; ++ } ++ } ++ ++ return timezone; ++} ++ ++/* Return the mmap()ed tzfile if found, else NULL. On success, the ++ * length of the mapped data is placed in *length. */ ++static char *map_tzfile(const char *timezone, size_t *length) ++{ ++ char fname[PATH_MAX]; ++ struct stat st; ++ char *p; ++ int fd; ++ ++ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { ++ return NULL; ++ } ++ ++ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone)); ++ ++ fd = open(fname, O_RDONLY); ++ if (fd == -1) { ++ return NULL; ++ } else if (fstat(fd, &st) != 0 || !is_valid_tzfile(&st)) { ++ close(fd); ++ return NULL; ++ } ++ ++ *length = st.st_size; ++ p = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); ++ close(fd); ++ ++ return p != MAP_FAILED ? p : NULL; ++} ++ ++#endif ++ ++static int inmem_seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) + { + int left = 0, right = tzdb->index_size - 1; + #ifdef HAVE_SETLOCALE +@@ -341,21 +771,88 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const + return 0; + } + ++static int seek_to_tz_position(const unsigned char **tzf, char *timezone, ++ char **map, size_t *maplen, ++ const timelib_tzdb *tzdb) ++{ ++#ifdef HAVE_SYSTEM_TZDATA ++ if (tzdb == timezonedb_system) { ++ char *orig; ++ ++ orig = map_tzfile(timezone, maplen); ++ if (orig == NULL) { ++ return 0; ++ } ++ ++ (*tzf) = (unsigned char *)orig; ++ *map = orig; ++ return 1; ++ } ++ else ++#endif ++ { ++ return inmem_seek_to_tz_position(tzf, timezone, tzdb); ++ } ++} ++ + const timelib_tzdb *timelib_builtin_db(void) + { ++#ifdef HAVE_SYSTEM_TZDATA ++ if (timezonedb_system == NULL) { ++ timelib_tzdb *tmp = malloc(sizeof *tmp); ++ ++ tmp->version = "0.system"; ++ tmp->data = NULL; ++ create_zone_index(tmp); ++ system_location_table = create_location_table(); ++ fake_data_segment(tmp, system_location_table); ++ timezonedb_system = tmp; ++ } ++ ++ return timezonedb_system; ++#else + return &timezonedb_builtin; ++#endif + } + + const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count) + { ++#ifdef HAVE_SYSTEM_TZDATA ++ *count = timezonedb_system->index_size; ++ return timezonedb_system->index; ++#else + *count = sizeof(timezonedb_idx_builtin) / sizeof(*timezonedb_idx_builtin); + return timezonedb_idx_builtin; ++#endif + } + + int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb) + { + const unsigned char *tzf; +- return (seek_to_tz_position(&tzf, timezone, tzdb)); ++ ++#ifdef HAVE_SYSTEM_TZDATA ++ if (tzdb == timezonedb_system) { ++ char fname[PATH_MAX]; ++ struct stat st; ++ ++ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { ++ return 0; ++ } ++ ++ if (system_location_table) { ++ if (find_zone_info(system_location_table, timezone) != NULL) { ++ /* found in cache */ ++ return 1; ++ } ++ } ++ ++ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone)); ++ ++ return stat(fname, &st) == 0 && is_valid_tzfile(&st); ++ } ++#endif ++ ++ return (inmem_seek_to_tz_position(&tzf, timezone, tzdb)); + } + + static void skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz) +@@ -380,24 +877,54 @@ static void read_64bit_header(const unsigned char **tzf, timelib_tzinfo *tz) + timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb) + { + const unsigned char *tzf; ++ char *memmap = NULL; ++ size_t maplen; + timelib_tzinfo *tmp; + int version; + +- if (seek_to_tz_position(&tzf, timezone, tzdb)) { ++ if (seek_to_tz_position(&tzf, timezone, &memmap, &maplen, tzdb)) { + tmp = timelib_tzinfo_ctor(timezone); + + version = read_preamble(&tzf, tmp); + read_header(&tzf, tmp); + read_transistions(&tzf, tmp); + read_types(&tzf, tmp); +- if (version == 2) { +- skip_64bit_preamble(&tzf, tmp); +- read_64bit_header(&tzf, tmp); +- skip_64bit_transistions(&tzf, tmp); +- skip_64bit_types(&tzf, tmp); +- skip_posix_string(&tzf, tmp); +- } +- read_location(&tzf, tmp); ++ ++#ifdef HAVE_SYSTEM_TZDATA ++ if (memmap) { ++ const struct location_info *li; ++ ++ /* TZif-style - grok the location info from the system database, ++ * if possible. */ ++ ++ if ((li = find_zone_info(system_location_table, timezone)) != NULL) { ++ tmp->location.comments = timelib_strdup(li->comment); ++ strncpy(tmp->location.country_code, li->code, 2); ++ tmp->location.longitude = li->longitude; ++ tmp->location.latitude = li->latitude; ++ tmp->bc = 1; ++ } ++ else { ++ strcpy(tmp->location.country_code, "??"); ++ tmp->bc = 0; ++ tmp->location.comments = timelib_strdup(""); ++ } ++ ++ /* Now done with the mmap segment - discard it. */ ++ munmap(memmap, maplen); ++ } else ++#endif ++ { ++ /* PHP-style - use the embedded info. */ ++ if (version == 2) { ++ skip_64bit_preamble(&tzf, tmp); ++ read_64bit_header(&tzf, tmp); ++ skip_64bit_transistions(&tzf, tmp); ++ skip_64bit_types(&tzf, tmp); ++ skip_posix_string(&tzf, tmp); ++ } ++ read_location(&tzf, tmp); ++ } + } else { + tmp = NULL; + } +diff --git a/ext/date/lib/timelib.m4 b/ext/date/lib/timelib.m4 +index c725572..4c837c7 100644 +--- a/ext/date/lib/timelib.m4 ++++ b/ext/date/lib/timelib.m4 +@@ -78,3 +78,17 @@ stdlib.h + + dnl Check for strtoll, atoll + AC_CHECK_FUNCS(strtoll atoll strftime) ++ ++PHP_ARG_WITH(system-tzdata, for use of system timezone data, ++[ --with-system-tzdata[=DIR] to specify use of system timezone data], ++no, no) ++ ++if test "$PHP_SYSTEM_TZDATA" != "no"; then ++ AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used]) ++ ++ if test "$PHP_SYSTEM_TZDATA" != "yes"; then ++ AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA", ++ [Define for location of system timezone data]) ++ fi ++fi ++ diff --git a/lang/php7/patches/0016-dont-gitclean-in-build.patch b/lang/php7/patches/0016-dont-gitclean-in-build.patch new file mode 100644 index 0000000..32de557 --- /dev/null +++ b/lang/php7/patches/0016-dont-gitclean-in-build.patch @@ -0,0 +1,19 @@ +From: Debian PHP Maintainers +Date: Sat, 2 May 2015 10:26:53 +0200 +Subject: dont-gitclean-in-build + +--- + build/build.mk | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/build/build.mk b/build/build.mk +index 9452984..b964def 100644 +--- a/build/build.mk ++++ b/build/build.mk +@@ -63,6 +63,5 @@ gitclean-work: + @if (test ! -f '.git/info/exclude' || grep -s "git-ls-files" .git/info/exclude); then \ + (echo "Rebuild .git/info/exclude" && echo '*.o' > .git/info/exclude && git svn propget svn:ignore | grep -v config.nice >> .git/info/exclude); \ + fi; \ +- git clean -X -f -d; + + .PHONY: $(ALWAYS) snapshot diff --git a/lang/php7/patches/0032-Use-system-timezone.patch b/lang/php7/patches/0032-Use-system-timezone.patch new file mode 100644 index 0000000..11a6393 --- /dev/null +++ b/lang/php7/patches/0032-Use-system-timezone.patch @@ -0,0 +1,43 @@ +From: Debian PHP Maintainers +Date: Sat, 2 May 2015 10:26:56 +0200 +Subject: Use system timezone + +Upstream don't want this patch. See +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=730771 for a summary. + +This delta is recovered from previous versions of the system timezone patch in +Debian, and appears to have inadvertently been dropped. Author unknown. + +To be used in tandem with use_embedded_timezonedb.patch and use_embedded_timezonedb_fixes.patch. +--- + ext/date/php_date.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/ext/date/php_date.c b/ext/date/php_date.c +index e780b2e..2b5a528 100644 +--- a/ext/date/php_date.c ++++ b/ext/date/php_date.c +@@ -992,6 +992,23 @@ static char* guess_timezone(const timelib_tzdb *tzdb) + DATEG(timezone_valid) = 1; + return DATEG(default_timezone); + } ++ /* Try to guess timezone from system information */ ++ { ++ struct tm *ta, tmbuf; ++ time_t the_time; ++ char *tzid = NULL; ++ ++ the_time = time(NULL); ++ ta = php_localtime_r(&the_time, &tmbuf); ++ if (ta) { ++ tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff, ta->tm_isdst); ++ } ++ if (! tzid) { ++ tzid = "UTC"; ++ } ++ ++ return tzid; ++ } + /* Fallback to UTC */ + return "UTC"; + } diff --git a/lang/php7/patches/0041-Add-patch-to-remove-build-timestamps-from-generated-.patch b/lang/php7/patches/0041-Add-patch-to-remove-build-timestamps-from-generated-.patch new file mode 100644 index 0000000..abfd6f7 --- /dev/null +++ b/lang/php7/patches/0041-Add-patch-to-remove-build-timestamps-from-generated-.patch @@ -0,0 +1,131 @@ +From: Thijs Kinkhorst +Date: Wed, 15 Jun 2016 09:18:03 +0200 +Subject: Add patch to remove build timestamps from generated binaries. + +--- + ext/standard/info.c | 1 - + sapi/apache2handler/config.m4 | 15 +++------------ + sapi/cgi/cgi_main.c | 4 ++-- + sapi/cli/php_cli.c | 4 ++-- + sapi/fpm/fpm/fpm_main.c | 4 ++-- + sapi/litespeed/lsapi_main.c | 4 ++-- + sapi/phpdbg/phpdbg.c | 4 +--- + 7 files changed, 12 insertions(+), 24 deletions(-) + +diff --git a/ext/standard/info.c b/ext/standard/info.c +index e6eaac3..024e5c9 100644 +--- a/ext/standard/info.c ++++ b/ext/standard/info.c +@@ -863,7 +863,6 @@ PHPAPI void php_print_info(int flag) + php_info_print_box_end(); + php_info_print_table_start(); + php_info_print_table_row(2, "System", ZSTR_VAL(php_uname)); +- php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__); + #ifdef COMPILER + php_info_print_table_row(2, "Compiler", COMPILER); + #endif +diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4 +index f286b1a..fba92b8 100644 +--- a/sapi/apache2handler/config.m4 ++++ b/sapi/apache2handler/config.m4 +@@ -59,18 +59,9 @@ if test "$PHP_APXS2" != "no"; then + APACHE_CFLAGS="$APACHE_CPPFLAGS -I$APXS_INCLUDEDIR $APR_CFLAGS $APU_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1" + + APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR` +- if test -z `$APXS -q SYSCONFDIR`; then +- INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \ +- $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \ +- -i -n php7" +- else +- APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR` +- INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \ +- \$(mkinstalldirs) '$APXS_SYSCONFDIR' && \ +- $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \ +- -S SYSCONFDIR='$APXS_SYSCONFDIR' \ +- -i -a -n php7" +- fi ++ INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \ ++ $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \ ++ -i -n php7" + + case $host_alias in + *aix*) +diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c +index 8983b53..589e299 100644 +--- a/sapi/cgi/cgi_main.c ++++ b/sapi/cgi/cgi_main.c +@@ -2216,9 +2216,9 @@ consult the installation file that came with this distribution, or visit \n\ + SG(request_info).no_headers = 1; + } + #if ZEND_DEBUG +- php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); ++ php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version()); + #else +- php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); ++ php_printf("PHP %s (%s)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version()); + #endif + php_request_shutdown((void *) 0); + fcgi_shutdown(); +diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c +index 978c8b3..3ee61a4 100644 +--- a/sapi/cli/php_cli.c ++++ b/sapi/cli/php_cli.c +@@ -682,8 +682,8 @@ static int do_cli(int argc, char **argv) /* {{{ */ + goto out; + + case 'v': /* show php version & quit */ +- php_printf("PHP %s (%s) (built: %s %s) ( %s)\nCopyright (c) 1997-2016 The PHP Group\n%s", +- PHP_VERSION, cli_sapi_module.name, __DATE__, __TIME__, ++ php_printf("PHP %s (%s) ( %s)\nCopyright (c) 1997-2016 The PHP Group\n%s", ++ PHP_VERSION, cli_sapi_module.name, + #if ZTS + "ZTS " + #else +diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c +index 5adeb63..5e60255 100644 +--- a/sapi/fpm/fpm/fpm_main.c ++++ b/sapi/fpm/fpm/fpm_main.c +@@ -1757,9 +1757,9 @@ int main(int argc, char *argv[]) + SG(request_info).no_headers = 1; + + #if ZEND_DEBUG +- php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); ++ php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version()); + #else +- php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); ++ php_printf("PHP %s (%s)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version()); + #endif + php_request_shutdown((void *) 0); + fcgi_shutdown(); +diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c +index b0ea105..4feb8f3 100644 +--- a/sapi/litespeed/lsapi_main.c ++++ b/sapi/litespeed/lsapi_main.c +@@ -811,9 +811,9 @@ static int cli_main( int argc, char * argv[] ) + case 'v': + if (php_request_startup() != FAILURE) { + #if ZEND_DEBUG +- php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); ++ php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version()); + #else +- php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); ++ php_printf("PHP %s (%s)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version()); + #endif + #ifdef PHP_OUTPUT_NEWAPI + php_output_end_all(); +diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c +index 68a164c..82565d8 100644 +--- a/sapi/phpdbg/phpdbg.c ++++ b/sapi/phpdbg/phpdbg.c +@@ -1657,10 +1657,8 @@ + phpdbg_do_help(NULL); + } else if (show_version) { + phpdbg_out( +- "phpdbg %s (built: %s %s)\nPHP %s, Copyright (c) 1997-2016 The PHP Group\n%s", ++ "phpdbg %s\nPHP %s, Copyright (c) 1997-2016 The PHP Group\n%s", + PHPDBG_VERSION, +- __DATE__, +- __TIME__, + PHP_VERSION, + get_zend_version() + ); diff --git a/lang/php7/patches/0042-Remove-W3C-validation-icon-to-not-expose-the-reader-.patch b/lang/php7/patches/0042-Remove-W3C-validation-icon-to-not-expose-the-reader-.patch new file mode 100644 index 0000000..78f7dca --- /dev/null +++ b/lang/php7/patches/0042-Remove-W3C-validation-icon-to-not-expose-the-reader-.patch @@ -0,0 +1,25 @@ +From: =?utf-8?q?Ond=C5=99ej_Sur=C3=BD?= +Date: Wed, 29 Jul 2015 14:37:55 +0200 +Subject: Remove W3C validation icon to not expose the reader's IP address to + potential tracking. + +--- + sapi/fpm/status.html.in | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/sapi/fpm/status.html.in b/sapi/fpm/status.html.in +index 86492d7..31c31ff 100644 +--- a/sapi/fpm/status.html.in ++++ b/sapi/fpm/status.html.in +@@ -71,11 +71,6 @@ + PID↓Start TimeStart SinceRequests ServedRequest DurationRequest methodRequest URIContent LengthUserScriptLast Request %CPULast Request Memory + + +-

+- +- Valid XHTML 1.0 Transitional +- +-

+ + + + + + diff --git a/net/addrwatch/Makefile b/net/addrwatch/Makefile new file mode 100644 index 0000000..aadac26 --- /dev/null +++ b/net/addrwatch/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2006-2016 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:=addrwatch +PKG_VERSION:=0.8 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-master.tar.gz +PKG_SOURCE_URL:=https://github.com/fln/addrwatch/releases/download/$(PKG_VERSION)/ +PKG_MD5SUM:=8f401415be993005fa5fb58a05e14295 +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=COPYING +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-master +PKG_FIXUP:=autoreconf +PKG_BUILD_DEPENDS:=USE_UCLIBC:argp-standalone USE_MUSL:argp-standalone + +include $(INCLUDE_DIR)/package.mk + +define Package/addrwatch + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpcap +libevent2 + TITLE:=IPv4/IPv6 and ethernet address pairing tool + URL:=https://github.com/fln/addrwatch + MAINTAINER:=Ondrej Caletka +endef + +define Package/addrwatch/description + This is a tool similar to arpwatch. It main purpose is to monitor network and + log discovered ethernet/ip pairings. Addrwatch is extremely useful in networks + with IPv6 autoconfiguration (RFC4862) enabled. It allows to track IPv6 + addresses of hosts using IPv6 privacy extensions (RFC4941). +endef + +define Package/addrwatch/conffiles + /etc/config/addrwatch +endef + +define Package/addrwatch/install + $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/addrwatch $(1)/usr/sbin/ + $(INSTALL_BIN) ./files/addrwatch.init $(1)/etc/init.d/addrwatch + $(INSTALL_CONF) ./files/addrwatch.config $(1)/etc/config/addrwatch$ +endef + +$(eval $(call BuildPackage,addrwatch)) diff --git a/net/addrwatch/files/addrwatch.config b/net/addrwatch/files/addrwatch.config new file mode 100644 index 0000000..177eeef --- /dev/null +++ b/net/addrwatch/files/addrwatch.config @@ -0,0 +1,12 @@ + +config addrwatch + option disabled '0' + list interface 'lan' + #list interface 'wan' + #option syslog '1' + #option verbose '0' + #option output '/var/log/addrwatch' + #list blacklist '192.168.1.1' + #option hashsize '1' + #option ratelimit '-1' + diff --git a/net/addrwatch/files/addrwatch.init b/net/addrwatch/files/addrwatch.init new file mode 100644 index 0000000..c7cbbfe --- /dev/null +++ b/net/addrwatch/files/addrwatch.init @@ -0,0 +1,74 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2016 OpenWrt.org + +START=50 +USE_PROCD=1 + +. /lib/functions/network.sh + +validate_section_addrwatch() { + uci_validate_section addrwatch addrwatch "${1}" \ + 'disabled:bool:0' \ + 'interface:list(string):lan' \ + 'syslog:bool:1' \ + 'output:string' \ + 'quiet:bool:0' \ + 'verbose:bool:0' \ + 'ipv4only:bool:0' \ + 'ipv6only:bool:0' \ + 'blacklist:list(or(ip4addr,ip6addr))' \ + 'hashsize:range(1,65536):1024'\ + 'ratelimit:integer:3600' + return $? +} + +start_instance() { + local cfg="$1" + local disabled interface syslog output quiet verbose ipv4only ipv6only + local blacklist hashsize ratelimit + local netdevs="" + + validate_section_addrwatch "${cfg}" || { + echo "validation of config $cfg failed" + return 1 + } + [ $disabled -ne 0 ] && return 1 + + for iface in $interface; do + local netdev + network_get_physdev netdev "${iface}" + append netdevs "${netdev}" + done + + procd_open_instance + procd_set_param command /usr/sbin/addrwatch + [ "${syslog}" -eq 1 ] && procd_append_param command --syslog + [ -n "${output}" ] && procd_append_param command --output "$output" + [ "$quiet" -eq 1 ] && procd_append_param command --quiet + [ "$verbose" -eq 1 ] && procd_append_param command --verbose + [ "$ipv4only" -eq 1 ] && procd_append_param command --ipv4only + [ "$ipv6only" -eq 1 ] && procd_append_param command --ipv6only + [ -n "$hashsize" ] && procd_append_param command --hashsize "$hashsize" + [ -n "$ratelimit" ] && procd_append_param command --ratelimit "$ratelimit" + for blitem in $blacklist; do + procd_append_param command "--blacklist=${blitem}" + done + procd_append_param command $netdevs + procd_set_param netdev $netdevs + procd_set_param respawn + procd_open_trigger + for iface in $interface; do + procd_add_interface_trigger "interface.*" ${iface} /etc/init.d/addrwatch reload + done + procd_close_trigger + procd_close_instance +} + +start_service() { + config_load 'addrwatch' + config_foreach start_instance 'addrwatch' +} + +service_triggers() { + procd_add_reload_trigger 'addrwatch' +} diff --git a/net/addrwatch/patches/001-fix-sys_siglist.patch b/net/addrwatch/patches/001-fix-sys_siglist.patch new file mode 100644 index 0000000..53032b5 --- /dev/null +++ b/net/addrwatch/patches/001-fix-sys_siglist.patch @@ -0,0 +1,32 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -56,9 +56,6 @@ AC_CHECK_HEADERS([arpa/inet.h netinet/in + # Checks for typedefs, structures, and compiler characteristics. + AC_C_INLINE + AC_TYPE_PID_T +-AC_CHECK_DECLS([sys_siglist], [], [ +- AC_MSG_ERROR([Unable to find sys_siglist declaration.]) +-], [[#include ]]) + AC_TYPE_UINT32_T + AC_TYPE_UINT16_T + AC_TYPE_UINT8_T +--- a/src/addrwatch.c ++++ b/src/addrwatch.c +@@ -339,7 +339,7 @@ void reload_cb(evutil_socket_t fd, short + void reload_cb(int fd, short events, void *arg) + #endif + { +- log_msg(LOG_DEBUG, "Received signal (%d), %s", fd, sys_siglist[fd]); ++ log_msg(LOG_DEBUG, "Received signal (%d), %s", fd, strsignal(fd)); + log_msg(LOG_DEBUG, "Reopening output files"); + + output_flatfile_reload(); +@@ -353,7 +353,7 @@ void stop_cb(evutil_socket_t fd, short e + void stop_cb(int fd, short events, void *arg) + #endif + { +- log_msg(LOG_DEBUG, "Received signal (%d), %s", fd, sys_siglist[fd]); ++ log_msg(LOG_DEBUG, "Received signal (%d), %s", fd, strsignal(fd)); + #if HAVE_LIBEVENT2 + event_base_loopbreak(cfg.eb); + #else diff --git a/net/addrwatch/patches/002-fix-uclibc-sysconf.patch b/net/addrwatch/patches/002-fix-uclibc-sysconf.patch new file mode 100644 index 0000000..c3c0e2e --- /dev/null +++ b/net/addrwatch/patches/002-fix-uclibc-sysconf.patch @@ -0,0 +1,11 @@ +--- a/src/addrwatch.c ++++ b/src/addrwatch.c +@@ -492,7 +492,7 @@ int main(int argc, char *argv[]) + argp_parse(&argp, argc, argv, 0, &optind, 0); + + if (!cfg.hostname) { +- cfg.hostname_len = sysconf(_SC_HOST_NAME_MAX); ++ cfg.hostname_len = HOST_NAME_MAX; + cfg.hostname = (char *)calloc(cfg.hostname_len, sizeof(char)); + gethostname(cfg.hostname, cfg.hostname_len); + } diff --git a/net/aggregate/Makefile b/net/aggregate/Makefile new file mode 100644 index 0000000..0127285 --- /dev/null +++ b/net/aggregate/Makefile @@ -0,0 +1,47 @@ +# +# Copyright (C) 2006-2016 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:=aggregate +PKG_VERSION:=1.6 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://ftp.isc.org/isc/aggregate/ +PKG_MD5SUM:=6fcc515388bf2c5b0c8f9f733bfee7e1 + +PKG_MAINTAINER:=Nikil Mehta +PKG_LICENSE:=ISC +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define Package/aggregate + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names + TITLE:=ipv4 cidr prefix aggregator + URL:=https://ftp.isc.org/isc/aggregate/ +endef + +define Package/aggregate/description + takes a list of prefixes in conventional format on stdin, and performs two + optimisations to reduce the length of the prefix list. It removes any + supplied prefixes which are supurfluous because they are already included in + another supplied prefix (e.g., 203.97.2.0/24 would be removed if + 203.97.0.0/17 was also supplied), and identifies adjacent prefixes that can + be combined under a single, shorter-length prefix (e.g., 203.97.2.0/24 and + 203.97.3.0/24 can be combined into the single prefix 203.97.2.0/23). +endef + +define Package/aggregate/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/aggregate $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,aggregate)) diff --git a/net/aircrack-ng/Makefile b/net/aircrack-ng/Makefile new file mode 100644 index 0000000..866db9f --- /dev/null +++ b/net/aircrack-ng/Makefile @@ -0,0 +1,74 @@ +# +# Copyright (C) 2006-2015 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:=aircrack-ng +PKG_VERSION:=1.2-rc1 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=LICENSE + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://download.aircrack-ng.org/ \ + http://archive.aircrack-ng.org/aircrack-ng/$(PKG_VERSION)/ +PKG_MD5SUM:=c2f8648c92f7e46051c86c618d4fb0d5 + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +PKG_MAINTAINER:=Rick Farina + +include $(INCLUDE_DIR)/package.mk + +define Package/aircrack-ng + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpcap +libpthread +libopenssl +libnl-core +libnl-genl +zlib + TITLE:=WLAN tools (without airmon-ng) for breaking 802.11 WEP/WPA keys + URL:=http://www.aircrack-ng.org/ + SUBMENU:=wireless +endef + +define Package/aircrack-ng/description + WLAN tools for breaking 802.11 WEP/WPA keys +endef + +define Package/airmon-ng + SECTION:=net + CATEGORY:=Network + DEPENDS:=+wireless-tools +ethtool +procps-ng +CONFIG_PCI_SUPPORT:pciutils +CONFIG_USB_SUPPORT:usbutils + TITLE:=Bash script designed to turn wireless cards into monitor mode. + URL:=http://www.aircrack-ng.org/ + SUBMENU:=wireless +endef + +define Package/airmon-ng/description + Bash script designed to turn wireless cards into monitor mode. +endef + +MAKE_FLAGS += prefix=/usr \ + libnl=true \ + sqlite=false \ + unstable=false \ + OSNAME=Linux + +define Package/aircrack-ng/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/ + rm -f $(1)/usr/sbin/airmon-ng +endef + +define Package/airmon-ng/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/airmon-ng $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,aircrack-ng)) +$(eval $(call BuildPackage,airmon-ng)) diff --git a/net/announce/Makefile b/net/announce/Makefile new file mode 100644 index 0000000..60d9e63 --- /dev/null +++ b/net/announce/Makefile @@ -0,0 +1,57 @@ +# +# Copyright (C) 2015 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:=announce +PKG_VERSION:=1.0.1 +PKG_RELEASE:=1 +PKG_LICENSE:=BSD-3-Clause +PKG_LICENSE_FILES:=src/LICENSE.txt +PKG_MAINTAINER:=Simon Peter + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/probonopd/announce.git +PKG_SOURCE_VERSION:=1368525c7305ca5bb4134242f332344f5f7e94e3 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION) +PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +PKG_BUILD_DEPENDS:= +libpthread + +define Package/announce + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names + TITLE:=Announce services on the network with Zeroconf/Bonjour + URL:=https://github.com/probonopd/announce + DEPENDS:= +libpthread +endef + +define Package/announce/description + Announce services on the network with Zeroconf/Bonjour. + This announces services such as ssh, sftp, and http running on the local machine + to the network. +endef + +define Build/Prepare + $(call Build/Prepare/Default) + $(CP) $(PKG_BUILD_DIR)/src/* $(PKG_BUILD_DIR)/ +endef + +define Package/announce/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/announce $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) $(PKG_BUILD_DIR)/announce.initscript $(1)/etc/init.d/announce +endef + +$(eval $(call BuildPackage,announce)) diff --git a/net/apache/Makefile b/net/apache/Makefile new file mode 100644 index 0000000..6d24fb4 --- /dev/null +++ b/net/apache/Makefile @@ -0,0 +1,165 @@ +# +# Copyright (C) 2007-2015 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:=apache +PKG_VERSION:=2.2.31 +PKG_RELEASE:=2 +PKG_SOURCE_NAME:=httpd +PKG_MAINTAINER:=Thomas Heil +PKG_LICENSE:=Apache License + +PKG_SOURCE:=$(PKG_SOURCE_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=@APACHE/httpd/ +PKG_MD5SUM:=6c10e15835ab214464228a9beb7afba8 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/apache/Default + SECTION:=net + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + TITLE:=The Apache Web Server + URL:=http://httpd.apache.org/ +endef + +define Package/apache/Default/description + The Apache Web Server is a powerful and flexible HTTP/1.1 compliant + web server. Originally designed as a replacement for the NCSA HTTP + Server, it has grown to be the most popular web server on the Internet. +endef + +define Package/apache +$(call Package/apache/Default) + DEPENDS:=+libapr +libaprutil +libpcre +libopenssl +unixodbc +endef + +define Package/apache/description +$(call Package/apache/Default/description) + . + This package contains the Apache web server and utility programs. + . + Take care that you don't include apache at the moment into your image + please select it only as module because busybox will override + /usr/sbin/httpd. It'll be solved soon. If you need to include this + package in the image anyway, remove httpd from busybox + (Base system --> Configuration --> Networking Utilities --> httpd). + Also you should take care for the initscripts, apache's httpd isn't + compatible with the one from busybox, so if you want to use apache + for running your webif, you'll need to change the parameters in the + scripts and configure the rest in /etc/httpd.conf. +endef + +define Package/apache/conffiles +/etc/apache/httpd.conf +/etc/apache/extra/httpd-autoindex.conf +/etc/apache/extra/httpd-dav.conf +/etc/apache/extra/httpd-default.conf +/etc/apache/extra/httpd-info.conf +/etc/apache/extra/httpd-languages.conf +/etc/apache/extra/httpd-manual.conf +/etc/apache/extra/httpd-mpm.conf +/etc/apache/extra/httpd-multilang-errordoc.conf +/etc/apache/extra/httpd-ssl.conf +/etc/apache/extra/httpd-userdir.conf +/etc/apache/extra/httpd-vhosts.conf +/etc/apache/magic +/etc/apache/mime.types +endef + +define Package/apache-icons +$(call Package/apache/Default) + TITLE:=Icons from Apache + DEPENDS:=apache +endef + +define Package/apache-icons/description +$(call Package/apache/Default/description) + . + This package contains the icons from Apache. +endef + +TARGET_CFLAGS += $(FPIC) +TARGET_CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE + +define Build/Configure + $(call Build/Configure/Default, \ + --with-apr="$(STAGING_DIR)/usr/bin/apr-1-config" \ + --with-apr-util="$(STAGING_DIR)/usr/bin/apu-1-config" \ + --with-pcre="$(STAGING_DIR)/usr/bin/pcre-config" \ + --enable-http \ + --enable-ssl \ + --enable-proxy \ + --disable-disk-cache \ + --enable-maintainer-mode \ + --enable-mime-magic \ + --without-suexec-bin \ + --sysconfdir=/etc/apache \ + ap_cv_void_ptr_lt_long=no \ + logfiledir="/var/log" \ + runtimedir="/var/run" \ + ) +endef + +define Build/InstallDev + rm -rf $(PKG_INSTALL_DIR)/usr/man/ \ + $(PKG_INSTALL_DIR)/usr/share/manual/ + # if you need docs take a look into the build-dir :) + $(INSTALL_DIR) $(1)/etc + $(CP) $(PKG_INSTALL_DIR)/etc/* \ + $(1)/etc + $(INSTALL_DIR) $(1)/usr/include/apache + $(CP) $(PKG_INSTALL_DIR)/usr/include/* \ + $(1)/usr/include/apache + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/httpd.exp \ + $(1)/usr/lib + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/* \ + $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/share + $(CP) $(PKG_INSTALL_DIR)/usr/share/* \ + $(1)/usr/share +endef + +define Package/apache/preinst + rm /usr/sbin/httpd + echo -e "You should take a look in the initscripts, busybox's httpd \n\ + uses some parameters which are maybe unsupported by apache." +endef + +define Package/apache/install + $(INSTALL_DIR) $(1)/usr/sbin + # we don't need apxs on the router, it's just for building apache modules. + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{ab,apachectl,checkgid,dbmmanage,envvars,envvars-std,htcacheclean,htdbm,htdigest,htpasswd,httpd,httxt2dbm,logresolve,rotatelogs} $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/httpd.exp $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/share + $(CP) $(PKG_INSTALL_DIR)/usr/share/{error,htdocs,cgi-bin,build} $(1)/usr/share/ + $(INSTALL_DIR) $(1)/etc/apache + $(CP) $(PKG_INSTALL_DIR)/etc/apache/{httpd.conf,magic,mime.types,extra} $(1)/etc/apache/ +endef + +define Package/apache/postrm + rm -rf /usr/sbin/httpd + ln -s /bin/busybox /usr/sbin/httpd + echo -e "You may need to change your initscripts back for the use \n\ + with busybox's httpd." +endef + +define Package/apache-icons/install + $(INSTALL_DIR) $(1)/usr/share + $(CP) $(PKG_INSTALL_DIR)/usr/share/icons $(1)/usr/share/ +endef + +$(eval $(call BuildPackage,apache)) +$(eval $(call BuildPackage,apache-icons)) diff --git a/net/apache/patches/001-Makefile_in.patch b/net/apache/patches/001-Makefile_in.patch new file mode 100644 index 0000000..0bccfd3 --- /dev/null +++ b/net/apache/patches/001-Makefile_in.patch @@ -0,0 +1,14 @@ +--- a/server/Makefile.in ++++ b/server/Makefile.in +@@ -26,7 +26,10 @@ gen_test_char: $(gen_test_char_OBJECTS) + $(LINK) $(EXTRA_LDFLAGS) $(gen_test_char_OBJECTS) $(EXTRA_LIBS) + + test_char.h: gen_test_char +- ./gen_test_char > test_char.h ++ true ++# ./gen_test_char > test_char.h ++# doesn't matter if you run it on the buildhost or on an wl500gd, ++# same output on both, so i just patched in the test_char.h :). + + util.lo: test_char.h + diff --git a/net/apache/patches/002-test_char_h.patch b/net/apache/patches/002-test_char_h.patch new file mode 100644 index 0000000..e8ea3cd --- /dev/null +++ b/net/apache/patches/002-test_char_h.patch @@ -0,0 +1,26 @@ +--- /dev/null ++++ b/server/test_char.h +@@ -0,0 +1,23 @@ ++/* this file is automatically generated by gen_test_char, do not edit */ ++#define T_ESCAPE_SHELL_CMD (1) ++#define T_ESCAPE_PATH_SEGMENT (2) ++#define T_OS_ESCAPE_PATH (4) ++#define T_HTTP_TOKEN_STOP (8) ++#define T_ESCAPE_LOGITEM (16) ++#define T_ESCAPE_FORENSIC (32) ++ ++static const unsigned char test_char_table[256] = { ++ 32,62,62,62,62,62,62,62,62,62,63,62,62,62,62,62,62,62,62,62, ++ 62,62,62,62,62,62,62,62,62,62,62,62,14,0,23,6,1,38,1,1, ++ 9,9,1,0,8,0,0,10,0,0,0,0,0,0,0,0,0,0,40,15, ++ 15,8,15,15,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ++ 0,0,0,0,0,0,0,0,0,0,0,15,31,15,7,0,7,0,0,0, ++ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ++ 0,0,0,15,39,15,1,62,54,54,54,54,54,54,54,54,54,54,54,54, ++ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54, ++ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54, ++ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54, ++ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54, ++ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54, ++ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54 ++}; diff --git a/net/apache/patches/003-logdir_fix.patch b/net/apache/patches/003-logdir_fix.patch new file mode 100644 index 0000000..635c65c --- /dev/null +++ b/net/apache/patches/003-logdir_fix.patch @@ -0,0 +1,33 @@ +--- a/build/mkconfNW.awk ++++ b/build/mkconfNW.awk +@@ -24,7 +24,7 @@ BEGIN { + A["sysconfdir"] = "conf" + A["iconsdir"] = "icons" + A["manualdir"] = "manual" +- A["runtimedir"] = "logs" ++ A["runtimedir"] = "log" + A["errordir"] = "error" + A["proxycachedir"] = "proxy" + +--- a/config.layout ++++ b/config.layout +@@ -28,8 +28,8 @@ + cgidir: ${datadir}/cgi-bin + includedir: ${prefix}/include + localstatedir: ${prefix} +- runtimedir: ${localstatedir}/logs +- logfiledir: ${localstatedir}/logs ++ runtimedir: ${localstatedir}/log ++ logfiledir: ${localstatedir}/log + proxycachedir: ${localstatedir}/proxy + + +@@ -150,7 +150,7 @@ + includedir: ${prefix}/include + localstatedir: /var${prefix} + runtimedir: ${localstatedir}/run +- logfiledir: ${localstatedir}/logs ++ logfiledir: ${localstatedir}/log + proxycachedir: ${localstatedir}/proxy + + diff --git a/net/apache/patches/004-pidfile_fix.patch b/net/apache/patches/004-pidfile_fix.patch new file mode 100644 index 0000000..e9f0b6d --- /dev/null +++ b/net/apache/patches/004-pidfile_fix.patch @@ -0,0 +1,11 @@ +--- a/include/scoreboard.h ++++ b/include/scoreboard.h +@@ -42,7 +42,7 @@ extern "C" { + + /* Scoreboard file, if there is one */ + #ifndef DEFAULT_SCOREBOARD +-#define DEFAULT_SCOREBOARD "logs/apache_runtime_status" ++#define DEFAULT_SCOREBOARD "log/apache_runtime_status" + #endif + + /* Scoreboard info on a process is, for now, kept very brief --- diff --git a/net/apache/patches/005-httpd_conf.patch b/net/apache/patches/005-httpd_conf.patch new file mode 100644 index 0000000..3bcbba4 --- /dev/null +++ b/net/apache/patches/005-httpd_conf.patch @@ -0,0 +1,60 @@ +--- a/docs/conf/httpd.conf.in ++++ b/docs/conf/httpd.conf.in +@@ -52,7 +52,6 @@ Listen @@Port@@ + # Example: + # LoadModule foo_module modules/mod_foo.so + # +-@@LoadModule@@ + + + +@@ -64,8 +63,8 @@ Listen @@Port@@ + # It is usually good practice to create a dedicated user and group for + # running httpd, as with most system services. + # +-User daemon +-Group daemon ++User nobody ++Group nogroup + + + +@@ -192,7 +191,7 @@ ErrorLog "@rel_logfiledir@/error_log" + # Possible values include: debug, info, notice, warn, error, crit, + # alert, emerg. + # +-LogLevel warn ++LogLevel debug + + + # +@@ -337,7 +336,7 @@ DefaultType text/plain + # contents of the file itself to determine its type. The MIMEMagicFile + # directive tells the module where the hint definitions are located. + # +-#MIMEMagicFile @rel_sysconfdir@/magic ++MIMEMagicFile @rel_sysconfdir@/magic + + # + # Customizable error responses come in three flavors: +@@ -366,7 +365,7 @@ DefaultType text/plain + # broken on your system. + # + #EnableMMAP off +-#EnableSendfile off ++EnableSendfile off + + # Supplemental configuration + # +@@ -412,7 +411,7 @@ DefaultType text/plain + # starting without SSL on platforms with no /dev/random equivalent + # but a statically compiled-in mod_ssl. + # +- +-SSLRandomSeed startup builtin +-SSLRandomSeed connect builtin +- ++# ++#SSLRandomSeed startup builtin ++#SSLRandomSeed connect builtin ++# diff --git a/net/apache/patches/006-remove-ssl3.patch b/net/apache/patches/006-remove-ssl3.patch new file mode 100644 index 0000000..c09654c --- /dev/null +++ b/net/apache/patches/006-remove-ssl3.patch @@ -0,0 +1,13 @@ +--- a/support/ab.c ++++ b/support/ab.c +@@ -2232,8 +2232,10 @@ int main(int argc, const char * const ar + } else if (strncasecmp(optarg, "SSL2", 4) == 0) { + meth = SSLv2_client_method(); + #endif ++#ifndef OPENSSL_NO_SSL3_METHOD + } else if (strncasecmp(optarg, "SSL3", 4) == 0) { + meth = SSLv3_client_method(); ++#endif + #ifdef HAVE_TLSV1_X + } else if (strncasecmp(optarg, "TLS1.1", 6) == 0) { + meth = TLSv1_1_client_method(); diff --git a/net/apcupsd/Makefile b/net/apcupsd/Makefile new file mode 100644 index 0000000..e0b8016 --- /dev/null +++ b/net/apcupsd/Makefile @@ -0,0 +1,106 @@ +# +# Copyright (C) 2006-2015 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:=apcupsd +PKG_VERSION:=3.14.14 +PKG_RELEASE:=1 + +PKG_MAINTAINER:=Othmar Truniger +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/apcupsd +PKG_MD5SUM:=cc8f5ced77f38906a274787acb9bc980 + +PKG_BUILD_DEPENDS:=libgd + +include $(INCLUDE_DIR)/package.mk + +define Package/apcupsd + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpthread +libusb-compat + TITLE:=UPS control software + URL:=http://www.apcupsd.org/ +endef + +define Package/apcupsd-cgi + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpthread +libgd + TITLE:=UPS control software CGI module + URL:=http://www.apcupsd.org/ +endef + +define Build/Configure + $(CP) $(SCRIPT_DIR)/config.* $(PKG_BUILD_DIR)/autoconf/ + $(call Build/Configure/Default, \ + --with-distname=unknown \ + --sysconfdir=/etc/apcupsd \ + --enable-cgi \ + --enable-usb \ + --enable-modbus-usb \ + --without-x \ + ) +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + LD="$(TARGET_CC)" \ + all install +endef + +define Package/apcupsd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apcupsd $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/smtp $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apctest $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apcaccess $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/apcupsd + $(INSTALL_CONF) ./files/apcupsd.conf $(1)/etc/apcupsd/ + $(INSTALL_CONF) ./files/apcupsd_mail.conf $(1)/etc/apcupsd/ + $(INSTALL_BIN) ./files/changeme $(1)/etc/apcupsd/ + $(INSTALL_BIN) ./files/commfailure $(1)/etc/apcupsd/ + $(INSTALL_BIN) ./files/commok $(1)/etc/apcupsd/ + $(INSTALL_BIN) ./files/offbattery $(1)/etc/apcupsd/ + $(INSTALL_BIN) ./files/onbattery $(1)/etc/apcupsd/ + $(INSTALL_BIN) ./files/apccontrol $(1)/etc/apcupsd/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/apcupsd.init $(1)/etc/init.d/apcupsd +endef + +define Package/apcupsd-cgi/install + $(INSTALL_DIR) $(1)/www/cgi-bin/apcupsd + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/*.cgi $(1)/www/cgi-bin/apcupsd + $(INSTALL_DIR) $(1)/etc/apcupsd + $(INSTALL_CONF) ./files/apcupsd.css $(1)/etc/apcupsd/ + $(INSTALL_CONF) ./files/hosts.conf $(1)/etc/apcupsd/ + $(INSTALL_CONF) ./files/multimon.conf $(1)/etc/apcupsd/ +endef + +define Package/apcupsd/conffiles +/etc/apcupsd/apcupsd.conf +/etc/apcupsd/apcupsd_mail.conf +/etc/apcupsd/changeme +/etc/apcupsd/commfailure +/etc/apcupsd/commok +/etc/apcupsd/offbattery +/etc/apcupsd/onbattery +endef + +define Package/apcupsd-cgi/conffiles +/etc/apcupsd/apcupsd.css +/etc/apcupsd/hosts.conf +/etc/apcupsd/multimon.conf +endef + +$(eval $(call BuildPackage,apcupsd)) +$(eval $(call BuildPackage,apcupsd-cgi)) diff --git a/net/apcupsd/files/apccontrol b/net/apcupsd/files/apccontrol new file mode 100644 index 0000000..2549354 --- /dev/null +++ b/net/apcupsd/files/apccontrol @@ -0,0 +1,146 @@ +#!/bin/sh +# +# Copyright (C) 1999-2002 Riccardo Facchetti +# +# for apcupsd release 3.14.1 (04 May 2007) - unknown +# +# platforms/apccontrol. Generated from apccontrol.in by configure. +# +# Note, this is a generic file that can be used by most +# systems. If a particular system needs to have something +# special, start with this file, and put a copy in the +# platform subdirectory. +# + +# +# These variables are needed for set up the autoconf other variables. +# +prefix=/usr +exec_prefix=/usr + +APCPID=/var/run/apcupsd.pid +APCUPSD=/usr/sbin/apcupsd +SHUTDOWN=/sbin/shutdown +SCRIPTSHELL=/bin/sh +SCRIPTDIR=/etc/apcupsd +WALL=true + +# +# Concatenate all output from this script to the events file +# Note, the following kills the script in a power fail situation +# where the disks are mounted read-only. +# exec >>/var/log/apcupsd.events 2>&1 + +# +# This piece is to substitute the default behaviour with your own script, +# perl, or C program. +# You can customize every single command creating an executable file (may be a +# script or a compiled program) and calling it the same as the $1 parameter +# passed by apcupsd to this script. +# +# After executing your script, apccontrol continues with the default action. +# If you do not want apccontrol to continue, exit your script with exit +# code 99. E.g. "exit 99". +# +# WARNING: the apccontrol file will be overwritten every time you update your +# apcupsd, doing `make install'. Your own customized scripts will _not_ be +# overwritten. If you wish to make changes to this file (discouraged), you +# should change apccontrol.sh.in and then rerun the configure process. +# +if [ -f ${SCRIPTDIR}/${1} -a -x ${SCRIPTDIR}/${1} ] +then + ${SCRIPTDIR}/${1} ${2} ${3} ${4} + # exit code 99 means he does not want us to do default action + if [ $? = 99 ] ; then + exit 0 + fi +fi + +case "$1" in + killpower) + echo "Apccontrol doing: ${APCUPSD} --killpower on UPS ${2}" + sleep 10 + ${APCUPSD} --killpower + echo "Apccontrol has done: ${APCUPSD} --killpower on UPS ${2}" | ${WALL} + ;; + commfailure) + echo "Warning communications lost with UPS ${2}" | ${WALL} + ;; + commok) + echo "Communications restored with UPS ${2}" | ${WALL} + ;; +# +# powerout, onbattery, offbattery, mainsback events occur +# in that order. +# + powerout) + echo "Warning power loss detected on UPS ${2}" | ${WALL} + ;; + onbattery) + echo "Power failure on UPS ${2}. Running on batteries." | ${WALL} + ;; + offbattery) + ;; + mainsback) + echo "Power has returned on UPS ${2}..." | ${WALL} + if [ -f /etc/powerfail ] ; then + printf "Continuing with shutdown." | ${WALL} + fi + ;; + failing) + echo "Battery power exhaused on UPS ${2}. Doing shutdown." | ${WALL} + ;; + timeout) + echo "Battery time limit exceeded on UPS ${2}. Doing shutdown." | ${WALL} + ;; + loadlimit) + echo "Remaining battery charge below limit on UPS ${2}. Doing shutdown." | ${WALL} + ;; + runlimit) + echo "Remaining battery runtime below limit on UPS ${2}. Doing shutdown." | ${WALL} + ;; + doreboot) + echo "UPS ${2} initiating Reboot Sequence" | ${WALL} + ${SHUTDOWN} -r now "apcupsd UPS ${2} initiated reboot" + ;; + doshutdown) + echo "UPS ${2} initiated Shutdown Sequence" | ${WALL} + ${SHUTDOWN} -h now "apcupsd UPS ${2} initiated shutdown" + ;; + annoyme) + echo "Power problems with UPS ${2}. Please logoff." | ${WALL} + ;; + emergency) + echo "Emergency Shutdown. Possible battery failure on UPS ${2}." | ${WALL} + ;; + changeme) + echo "Emergency! Batteries have failed on UPS ${2}. Change them NOW" | ${WALL} + ;; + remotedown) + echo "Remote Shutdown. Beginning Shutdown Sequence." | ${WALL} + ;; + restartme) + echo -n "Restarting APCUPSD Power Management: " + THEPID=`cat ${APCPID}` + kill ${THEPID} + rm -f ${APCPID} + rm -f /etc/powerfail + rm -f /etc/nologin + sleep 5 + `${APCUPSD}` + echo "apcupsd" + ;; + startselftest) + ;; + endselftest) + ;; + battdetach) + ;; + battattach) + ;; + *) echo "Usage: ${0##*/} command" + echo " warning: this script is intended to be launched by" + echo " apcupsd and should never be launched by users." + exit 1 + ;; +esac diff --git a/net/apcupsd/files/apcupsd.conf b/net/apcupsd/files/apcupsd.conf new file mode 100644 index 0000000..5f478b9 --- /dev/null +++ b/net/apcupsd/files/apcupsd.conf @@ -0,0 +1,322 @@ +## apcupsd.conf v1.1 ## +# +# for apcupsd release 3.14.1 (04 May 2007) - unknown +# +# "apcupsd" POSIX config file + +# +# ========= General configuration parameters ============ +# + +# UPSNAME xxx +# Use this to give your UPS a name in log files and such. This +# is particularly useful if you have multiple UPSes. This does not +# set the EEPROM. It should be 8 characters or less. +UPSNAME ups1 + +# UPSCABLE +# Defines the type of cable connecting the UPS to your computer. +# +# Possible generic choices for are: +# simple, smart, ether, usb +# +# Or a specific cable model number may be used: +# 940-0119A, 940-0127A, 940-0128A, 940-0020B, +# 940-0020C, 940-0023A, 940-0024B, 940-0024C, +# 940-1524C, 940-0024G, 940-0095A, 940-0095B, +# 940-0095C, M-04-02-2000 +# +UPSCABLE smart + +# To get apcupsd to work, in addition to defining the cable +# above, you must also define a UPSTYPE, which corresponds to +# the type of UPS you have (see the Description for more details). +# You must also specify a DEVICE, sometimes referred to as a port. +# For USB UPSes, please leave the DEVICE directive blank. For +# other UPS types, you must specify an appropriate port or address. +# +# UPSTYPE DEVICE Description +# apcsmart /dev/tty** Newer serial character device, +# appropriate for SmartUPS models using +# a serial cable (not USB). +# +# usb Most new UPSes are USB. A blank DEVICE +# setting enables autodetection, which is +# the best choice for most installations. +# +# net hostname:port Network link to a master apcupsd +# through apcupsd's Network Information +# Server. This is used if you don't have +# a UPS directly connected to your computer. +# +# snmp hostname:port:vendor:community +# SNMP Network link to an SNMP-enabled +# UPS device. Vendor is the MIB used by +# the UPS device: can be "APC", "APC_NOTRAP" +# or "RFC" where APC is the powernet MIB, +# "APC_NOTRAP" is powernet with SNMP trap +# catching disabled, and RFC is the IETF's +# rfc1628 UPS-MIB. You usually want "APC". +# Port is usually 161. Community is usually +# "private". +# +# dumb /dev/tty** Old serial character device for use +# with simple-signaling UPSes. +# +# pcnet ipaddr:username:passphrase +# PowerChute Network Shutdown protocol +# which can be used as an alternative to SNMP +# with AP9617 family of smart slot cards. +# ipaddr is the IP address of the UPS mgmt +# card. username and passphrase are the +# credentials for which the card has been +# configured. +# +UPSTYPE apcsmart +DEVICE /dev/ttyS0 + + +# LOCKFILE +# Path for device lock file. Not used on Win32. +LOCKFILE /var/lock + +# SCRIPTDIR +# Directory in which apccontrol and event scripts are located. +SCRIPTDIR /etc/apcupsd + +# PWRFAILDIR +# Directory in which to write the powerfail flag file. This file +# is created when apcupsd initiates a system shutdown and is +# checked in the OS halt scripts to determine if a killpower +# (turning off UPS output power) is required. +PWRFAILDIR /etc + +# NOLOGINDIR +# Directory in which to write the nologin file. The existence +# of this flag file tells the OS to disallow new logins. +NOLOGINDIR /etc + + +# +# ======== Configuration parameters used during power failures ========== +# + +# The ONBATTERYDELAY is the time in seconds from when a power failure +# is detected until we react to it with an onbattery event. +# +# This means that, apccontrol will be called with the powerout argument +# immediately when a power failure is detected. However, the +# onbattery argument is passed to apccontrol only after the +# ONBATTERYDELAY time. If you don't want to be annoyed by short +# powerfailures, make sure that apccontrol powerout does nothing +# i.e. comment out the wall. +#ONBATTERYDELAY 6 + +# +# Note: BATTERYLEVEL, MINUTES, and TIMEOUT work in conjunction, so +# the first that occurs will cause the initiation of a shutdown. +# + +# If during a power failure, the remaining battery percentage +# (as reported by the UPS) is below or equal to BATTERYLEVEL, +# apcupsd will initiate a system shutdown. +BATTERYLEVEL 5 + +# If during a power failure, the remaining runtime in minutes +# (as calculated internally by the UPS) is below or equal to MINUTES, +# apcupsd, will initiate a system shutdown. +MINUTES 3 + +# If during a power failure, the UPS has run on batteries for TIMEOUT +# many seconds or longer, apcupsd will initiate a system shutdown. +# A value of 0 disables this timer. +# +# Note, if you have a Smart UPS, you will most likely want to disable +# this timer by setting it to zero. That way, you UPS will continue +# on batteries until either the % charge remaining drops to or below BATTERYLEVEL, +# or the remaining battery runtime drops to or below MINUTES. Of course, +# if you are testing, setting this to 60 causes a quick system shutdown +# if you pull the power plug. +# If you have an older dumb UPS, you will want to set this to less than +# the time you know you can run on batteries. +TIMEOUT 0 + +# Time in seconds between annoying users to signoff prior to +# system shutdown. 0 disables. +ANNOY 300 + +# Initial delay after power failure before warning users to get +# off the system. +ANNOYDELAY 60 + +# The condition which determines when users are prevented from +# logging in during a power failure. +# NOLOGON [ disable | timeout | percent | minutes | always ] +NOLOGON disable + +# If KILLDELAY is non-zero, apcupsd will continue running after a +# shutdown has been requested, and after the specified time in +# seconds attempt to kill the power. This is for use on systems +# where apcupsd cannot regain control after a shutdown. +# KILLDELAY 0 disables +KILLDELAY 0 + +# +# ==== Configuration statements for Network Information Server ==== +# + +# NETSERVER [ on | off ] on enables, off disables the network +# information server. If netstatus is on, a network information +# server process will be started for serving the STATUS and +# EVENT data over the network (used by CGI programs). +NETSERVER on + +# NISIP +# IP address on which NIS server will listen for incoming connections. +# This is useful if your server is multi-homed (has more than one +# network interface and IP address). Default value is 0.0.0.0 which +# means any incoming request will be serviced. Alternatively, you can +# configure this setting to any specific IP address of your server and +# NIS will listen for connections only on that interface. Use the +# loopback address (127.0.0.1) to accept connections only from the +# local machine. +NISIP 0.0.0.0 + +# NISPORT default is 3551 as registered with the IANA +# port to use for sending STATUS and EVENTS data over the network. +# It is not used unless NETSERVER is on. If you change this port, +# you will need to change the corresponding value in the cgi directory +# and rebuild the cgi programs. +NISPORT 3551 + +# If you want the last few EVENTS to be available over the network +# by the network information server, you must define an EVENTSFILE. +EVENTSFILE /var/log/apcupsd.events + +# EVENTSFILEMAX +# By default, the size of the EVENTSFILE will be not be allowed to exceed +# 10 kilobytes. When the file grows beyond this limit, older EVENTS will +# be removed from the beginning of the file (first in first out). The +# parameter EVENTSFILEMAX can be set to a different kilobyte value, or set +# to zero to allow the EVENTSFILE to grow without limit. +EVENTSFILEMAX 10 + +# +# ========== Configuration statements used if sharing ============= +# a UPS with more than one machine + +# NETTIME +# Interval (in seconds) at which the NIS client polls the server. +# Used only when this apcupsd is a network client (UPSTYPE net). +#NETTIME 60 + +# +# Remaining items are for ShareUPS (APC expansion card) ONLY +# + +# UPSCLASS [ standalone | shareslave | sharemaster ] +# Normally standalone unless you share an UPS using an APC ShareUPS +# card. +UPSCLASS standalone + +# UPSMODE [ disable | share ] +# Normally disable unless you share an UPS using an APC ShareUPS card. +UPSMODE disable + +# +# ===== Configuration statements to control apcupsd system logging ======== +# + +# Time interval in seconds between writing the STATUS file; 0 disables +STATTIME 0 + +# Location of STATUS file (written to only if STATTIME is non-zero) +STATFILE /var/log/apcupsd.status + +# LOGSTATS [ on | off ] on enables, off disables +# Note! This generates a lot of output, so if +# you turn this on, be sure that the +# file defined in syslog.conf for LOG_NOTICE is a named pipe. +# You probably do not want this on. +LOGSTATS off + +# Time interval in seconds between writing the DATA records to +# the log file. 0 disables. +DATATIME 0 + +# FACILITY defines the logging facility (class) for logging to syslog. +# If not specified, it defaults to "daemon". This is useful +# if you want to separate the data logged by apcupsd from other +# programs. +#FACILITY DAEMON + +# +# ========== Configuration statements used in updating the UPS EPROM ========= +# + +# +# These statements are used only by apctest when choosing "Set EEPROM with conf +# file values" from the EEPROM menu. THESE STATEMENTS HAVE NO EFFECT ON APCUPSD. +# + +# UPS name, max 8 characters +#UPSNAME UPS_IDEN + +# Battery date - 8 characters +#BATTDATE mm/dd/yy + +# Sensitivity to line voltage quality (H cause faster transfer to batteries) +# SENSITIVITY H M L (default = H) +#SENSITIVITY H + +# UPS delay after power return (seconds) +# WAKEUP 000 060 180 300 (default = 0) +#WAKEUP 60 + +# UPS Grace period after request to power off (seconds) +# SLEEP 020 180 300 600 (default = 20) +#SLEEP 180 + +# Low line voltage causing transfer to batteries +# The permitted values depend on your model as defined by last letter +# of FIRMWARE or APCMODEL. Some representative values are: +# D 106 103 100 097 +# M 177 172 168 182 +# A 092 090 088 086 +# I 208 204 200 196 (default = 0 => not valid) +#LOTRANSFER 208 + +# High line voltage causing transfer to batteries +# The permitted values depend on your model as defined by last letter +# of FIRMWARE or APCMODEL. Some representative values are: +# D 127 130 133 136 +# M 229 234 239 224 +# A 108 110 112 114 +# I 253 257 261 265 (default = 0 => not valid) +#HITRANSFER 253 + +# Battery charge needed to restore power +# RETURNCHARGE 00 15 50 90 (default = 15) +#RETURNCHARGE 15 + +# Alarm delay +# 0 = zero delay after pwr fail, T = power fail + 30 sec, L = low battery, N = never +# BEEPSTATE 0 T L N (default = 0) +#BEEPSTATE T + +# Low battery warning delay in minutes +# LOWBATT 02 05 07 10 (default = 02) +#LOWBATT 2 + +# UPS Output voltage when running on batteries +# The permitted values depend on your model as defined by last letter +# of FIRMWARE or APCMODEL. Some representative values are: +# D 115 +# M 208 +# A 100 +# I 230 240 220 225 (default = 0 => not valid) +#OUTPUTVOLTS 230 + +# Self test interval in hours 336=2 weeks, 168=1 week, ON=at power on +# SELFTEST 336 168 ON OFF (default = 336) +#SELFTEST 336 diff --git a/net/apcupsd/files/apcupsd.css b/net/apcupsd/files/apcupsd.css new file mode 100644 index 0000000..e98c75e --- /dev/null +++ b/net/apcupsd/files/apcupsd.css @@ -0,0 +1,64 @@ +body { + color: black; + background: white; +} + +div.Center { + text-align: center; +} + +img { + border-style: none; +} + +pre { + text-align: left; +} + +strong { + color: red; +} + +table.Outer { + color: black; + background: #60a0a0; + empty-cells: show; border: solid #60a0a0 +} + +th.Outer { + color: black; + background: #60b0b0 +} + +.Title { + font-size: 18pt; +} + +.SubTitle { + font-size: 12pt; +} + +.Empty { + color: black; + background: aqua; +} + +.Fault { + color: black; + background: red; +} + +.Label { + color: black; + background: aqua; +} + +.Normal { + color: black; + background: lime; +} + +.Warning { + color: black; + background: yellow; +} diff --git a/net/apcupsd/files/apcupsd.init b/net/apcupsd/files/apcupsd.init new file mode 100644 index 0000000..5454377 --- /dev/null +++ b/net/apcupsd/files/apcupsd.init @@ -0,0 +1,12 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org +START=50 +STOP=50 + +start() { + /usr/sbin/apcupsd -f /etc/apcupsd/apcupsd.conf +} + +stop() { + kill $(cat /var/run/apcupsd.pid) +} diff --git a/net/apcupsd/files/apcupsd_mail.conf b/net/apcupsd/files/apcupsd_mail.conf new file mode 100644 index 0000000..3ada8e5 --- /dev/null +++ b/net/apcupsd/files/apcupsd_mail.conf @@ -0,0 +1,7 @@ +#!/bin/sh + +MAILPROG="/usr/sbin/smtp" +MAILHOST="mail:25" +FROM="OpenWrt" +TO="apcups@example.com" +HOSTNAME="OpenWrt" diff --git a/net/apcupsd/files/changeme b/net/apcupsd/files/changeme new file mode 100644 index 0000000..bcf448a --- /dev/null +++ b/net/apcupsd/files/changeme @@ -0,0 +1,17 @@ +#!/bin/sh +# +# This shell script if placed in /etc/apcupsd +# will be called by /etc/apcupsd/apccontrol when apcupsd +# detects that the battery should be replaced. +# We send an email message to root to notify him. +# +. /etc/apcupsd/apcupsd_mail.conf + +MSG="$HOSTNAME UPS battery needs changing NOW." +# +( + echo "$MSG" + echo " " + /usr/sbin/apcaccess status +) | $MAILPROG -h $MAILHOST -f $FROM -s "$MSG" $TO +exit 0 diff --git a/net/apcupsd/files/commfailure b/net/apcupsd/files/commfailure new file mode 100644 index 0000000..b899195 --- /dev/null +++ b/net/apcupsd/files/commfailure @@ -0,0 +1,17 @@ +#!/bin/sh +# +# This shell script if placed in /etc/apcupsd +# will be called by /etc/apcupsd/apccontrol when apcupsd +# loses contact with the UPS (i.e. the serial connection is not responding). +# We send an email message to root to notify him. +# +. /etc/apcupsd/apcupsd_mail.conf + +MSG="$HOSTNAME Communications with UPS lost" +# +( + echo "$MSG" + echo " " + /usr/sbin/apcaccess status +) | $MAILPROG -h $MAILHOST -f $FROM -s "$MSG" $TO +exit 0 diff --git a/net/apcupsd/files/commok b/net/apcupsd/files/commok new file mode 100644 index 0000000..cd5d1c6 --- /dev/null +++ b/net/apcupsd/files/commok @@ -0,0 +1,17 @@ +#!/bin/sh +# +# This shell script if placed in /etc/apcupsd +# will be called by /etc/apcupsd/apccontrol when apcupsd +# restores contact with the UPS (i.e. the serial connection is restored). +# We send an email message to root to notify him. +# +. /etc/apcupsd/apcupsd_mail.conf + +MSG="$HOSTNAME Communications with UPS restored" +# +( + echo "$MSG" + echo " " + /usr/sbin/apcaccess status +) | $MAILPROG -h $MAILHOST -f $FROM -s "$MSG" $TO +exit 0 diff --git a/net/apcupsd/files/hosts.conf b/net/apcupsd/files/hosts.conf new file mode 100644 index 0000000..854e008 --- /dev/null +++ b/net/apcupsd/files/hosts.conf @@ -0,0 +1,19 @@ +# Network UPS Tools - hosts.conf +# +# This file does double duty - it lists the systems that multimon will +# monitor, and also specifies the systems that upsstats is allowed to +# watch. It keeps people from feeding random addresses to upsstats, +# among other things. upsimage also uses this file to know who it +# may speak to. upsfstats too. +# +# Usage: list systems running upsd that you want to monitor +# +# MONITOR
"" +# +# Please note, MONITOR must start in column 1 (no spaces permitted) +# +# Example: +# MONITOR 10.64.1.1 "Finance department" +# MONITOR 10.78.1.1 "Sierra High School data room #1" +# +MONITOR 127.0.0.1 "Local Host" diff --git a/net/apcupsd/files/multimon.conf b/net/apcupsd/files/multimon.conf new file mode 100644 index 0000000..4cdf9b0 --- /dev/null +++ b/net/apcupsd/files/multimon.conf @@ -0,0 +1,63 @@ +# Sample multimon configuration file +# +# This file is not required. Without it, multimon will use the default +# field layout. +# +# Temperature selection +# +# Pick "TEMPC" for Celsius or "TEMPF" for Fahrenheit. This will override +# the --enable-celsius setting from the compile. UPSTEMP (below) will +# use this setting by default. + +TEMPC + +# Format: +# FIELD "" "" +# +# is either a word from the UPS protocol like battchg (see the +# table in src/cgi/upsfetch.c) or a special word in uppercase. +# +# Special words are: +# MODEL - Show the model name for this system in cyan +# +# STATUS - Parse the status for this system using the appropriate color +# +# UPSTEMP and AMBTEMP use the default scale. This is set to C if you use +# --enable-celsius at compile time *or* if you use "TEMPC" above. +# +# UPSTEMP - Show the UPS temperature in the default scale (suffix ignored) +# AMBTEMP - Show the ambient temperature in the default scale (suffix ignored) +# +# UPSTEMPC - Show the UPS temperature in degrees C (suffix ignored) +# UPSTEMPF - Show the UPS temperature in degrees F (suffix ignored) +# AMBTEMPC - Show the ambient temperature in degrees C (suffix ignored) +# AMBTEMPF - Show the ambient temperature in degrees F (suffix ignored) +# +# They're called "special" since they actually understand the content +# being printed and do other things based on what's in there. +# +# is what you'd like this column to be called on the page. +# Remember that this is HTML, so you can actually embed markup in here. +# This means you can even include images here. You can include quotes +# (and backslashes!) in the string by escaping them with a backslash (\). +# +# is typically something like % or VAC. It's useful if +# you want to convey the units that apply to a value. +# +# Example config + +FIELD SYSTEM "System" "" +FIELD MODEL "Model" "" +FIELD STATUS "Status" "" +FIELD battpct "Battery Chg" "%" +FIELD utility "Utility" "VAC" +FIELD loadpct "UPS Load" "%" +FIELD UPSTEMP "UPS Temp" "" +FIELD runtime "Batt. Run Time" "min." +FIELD DATA "Data" "All data" + +# These are only useful if you have a Smart-UPS model with the Measure-UPS II +# measurement card. No other models presently support these features. +# +# FIELD AMBTEMP "Ambient Temp" "" +# FIELD HUMIDITY "Ambient Humidity" "%" diff --git a/net/apcupsd/files/offbattery b/net/apcupsd/files/offbattery new file mode 100644 index 0000000..cd5d1c6 --- /dev/null +++ b/net/apcupsd/files/offbattery @@ -0,0 +1,17 @@ +#!/bin/sh +# +# This shell script if placed in /etc/apcupsd +# will be called by /etc/apcupsd/apccontrol when apcupsd +# restores contact with the UPS (i.e. the serial connection is restored). +# We send an email message to root to notify him. +# +. /etc/apcupsd/apcupsd_mail.conf + +MSG="$HOSTNAME Communications with UPS restored" +# +( + echo "$MSG" + echo " " + /usr/sbin/apcaccess status +) | $MAILPROG -h $MAILHOST -f $FROM -s "$MSG" $TO +exit 0 diff --git a/net/apcupsd/files/onbattery b/net/apcupsd/files/onbattery new file mode 100644 index 0000000..ee5f653 --- /dev/null +++ b/net/apcupsd/files/onbattery @@ -0,0 +1,17 @@ +#!/bin/sh +# +# This shell script if placed in /etc/apcupsd +# will be called by /etc/apcupsd/apccontrol when the UPS +# goes on batteries. +# We send an email message to root to notify him. +# +. /etc/apcupsd/apcupsd_mail.conf + +MSG="$HOSTNAME Power Failure !!!" +# +( + echo "$MSG" + echo " " + /usr/sbin/apcaccess status +) | $MAILPROG -h $MAILHOST -f $FROM -s "$MSG" $TO +exit 0 diff --git a/net/apcupsd/patches/010-fix-usb.patch b/net/apcupsd/patches/010-fix-usb.patch new file mode 100644 index 0000000..b313bb2 --- /dev/null +++ b/net/apcupsd/patches/010-fix-usb.patch @@ -0,0 +1,8 @@ +--- a/include/libusb.h.in.orig 2015-02-21 18:53:51.023682068 +0100 ++++ a/include/libusb.h.in 2015-02-21 18:54:14.722788757 +0100 +@@ -6,4 +6,4 @@ + * path at configure time and various apcupsd bits include this + * when they need libusb's usb.h. + */ +-#include "@LIBUSBH@" ++#include "usb.h" diff --git a/net/apinger/Makefile b/net/apinger/Makefile new file mode 100644 index 0000000..5d73ae1 --- /dev/null +++ b/net/apinger/Makefile @@ -0,0 +1,67 @@ +# +# 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:=apinger +PKG_VERSION:=0.6.1 +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/Jajcus/apinger.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=c7da72f7ec26eedd7fd8d224c0e10787b204f94e +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_MAINTAINER:=Alex Samorukov +PKG_LICENSE:= GPL-2.0 + +PKG_FIXUP:=autoreconf + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/apinger + SECTION:=net + CATEGORY:=Network + TITLE:=Tool which monitors various IP devices by simple ICMP echo requests + URL:=https://github.com/Jajcus/apinger + PKG_MAINTAINER:=Alex Samorukov +endef + +define Package/apinger/description + Alarm Pinger (apinger) is a little tool which monitors various IP devices by + simple ICMP echo requests. There are various other tools, that can do this, + but most of them are shell or perl scripts, spawning many processes, thus much + CPU-expensive, especially when one wants continuous monitoring and fast + response on target failure. Alarm Pinger is a single program written in C, so + it doesn't need much CPU power even when monitoring many targets with frequent + probes. Alarm Pinger supports both IPv4 and IPv6. The code have been tested + on Linux and FreeBSD. +endef + +define Package/apinger/conffiles +/etc/apinger.conf +endef + +define Build/Configure + $(call Build/Configure/Default) +endef + +define Package/apinger/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apinger $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/apinger.conf $(1)/etc/apinger.conf + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/apinger.init $(1)/etc/init.d/apinger +endef + +$(eval $(call BuildPackage,apinger)) + diff --git a/net/apinger/files/apinger.init b/net/apinger/files/apinger.init new file mode 100644 index 0000000..8caac38 --- /dev/null +++ b/net/apinger/files/apinger.init @@ -0,0 +1,18 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=80 + +SERVICE_USE_PID=1 + +start() { + service_start /usr/sbin/apinger +} + +stop() { + service_stop /usr/sbin/apinger +} + +reload() { + service_reload /usr/sbin/apinger +} diff --git a/net/apinger/patches/001-autoreconf.patch b/net/apinger/patches/001-autoreconf.patch new file mode 100644 index 0000000..cb5bd45 --- /dev/null +++ b/net/apinger/patches/001-autoreconf.patch @@ -0,0 +1,13 @@ +--- apinger-0.6.1/acinclude.m4 2003-10-21 12:44:48.000000000 +0000 ++++ apinger-0.6.1/acinclude.m4 2015-04-08 15:27:37.451903960 +0000 +@@ -39,9 +39,7 @@ + [$jk_inet_includes + $jk_icmp_includes]) + +-AC_CHECK_MEMBERS([struct icmp.icmp_type, struct icmp.icmp_code,\ +-struct icmp.icmp_cksum, struct icmp.icmp_seq,\ +-struct icmp.icmp_id],[], ++AC_CHECK_MEMBERS([struct icmp.icmp_type, struct icmp.icmp_code,struct icmp.icmp_cksum, struct icmp.icmp_seq,struct icmp.icmp_id],[], + AC_MSG_ERROR(struct icmp not defined or not compatible), + [$jk_inet_includes + $jk_icmp_includes]) diff --git a/net/apinger/patches/002-run_as_user.patch b/net/apinger/patches/002-run_as_user.patch new file mode 100644 index 0000000..16d64ac --- /dev/null +++ b/net/apinger/patches/002-run_as_user.patch @@ -0,0 +1,11 @@ +--- apinger-0.6.1/src/apinger.conf.orig 2015-04-08 16:05:24.558919722 +0000 ++++ apinger-0.6.1/src/apinger.conf 2015-04-08 16:07:47.089170236 +0000 +@@ -9,7 +9,7 @@ + + ## User and group the pinger should run as + user "nobody" +-group "nobody" ++group "nogroup" + + ## Mailer to use (default: "/usr/lib/sendmail -t") + #mailer "/var/qmail/bin/qmail-inject" diff --git a/net/apinger/patches/003-no_docs.patch b/net/apinger/patches/003-no_docs.patch new file mode 100644 index 0000000..c08f44d --- /dev/null +++ b/net/apinger/patches/003-no_docs.patch @@ -0,0 +1,11 @@ +--- apinger-0.6.1/Makefile.am.orig 2015-04-08 16:47:40.999990050 +0000 ++++ apinger-0.6.1/Makefile.am 2015-04-08 16:48:07.565220137 +0000 +@@ -1,7 +1,7 @@ + + EXTRA_DIST = autogen.sh TODO BUGS + +-SUBDIRS = src doc ++SUBDIRS = src + + .PHONY: ChangeLog + diff --git a/net/aria2/Config.in b/net/aria2/Config.in new file mode 100644 index 0000000..b0d7309 --- /dev/null +++ b/net/aria2/Config.in @@ -0,0 +1,45 @@ +menu "Aria2 configuration" + depends on PACKAGE_aria2 + +choice + prompt "SSL library" + default ARIA2_OPENSSL + +config ARIA2_OPENSSL + bool "OpenSSL" + +config ARIA2_GNUTLS + bool "GNUTLS" + +config ARIA2_NOSSL + bool "No SSL support" + +endchoice + +config ARIA2_BITTORRENT + bool "Enable bittorrent support" + depends on ARIA2_OPENSSL + default n + +config ARIA2_METALINK + bool "Enable metalink support" + default n + +config ARIA2_SFTP + bool "Enable sftp support" + default n + +choice + prompt "XML library" + default ARIA2_EXPAT + depends on ARIA2_METALINK + +config ARIA2_EXPAT + bool "EXPAT" + +config ARIA2_LIBXML2 + bool "LIBXML2" + +endchoice + +endmenu diff --git a/net/aria2/Makefile b/net/aria2/Makefile new file mode 100644 index 0000000..81acf83 --- /dev/null +++ b/net/aria2/Makefile @@ -0,0 +1,81 @@ +# +# Copyright (C) 2012-2016 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:=aria2 +PKG_VERSION:=1.28.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=https://github.com/aria2/aria2/releases/download/release-$(PKG_VERSION)/ +PKG_MD5SUM:=f649ab30f3b09d0c0ebb816ce0c0205d +PKG_INSTALL:=1 + +PKG_MAINTAINER:=Imre Kaloz , Hsing-Wang Liao +PKG_LICENSE:=GPLv2 +PKG_LICENSE_FILES:=COPYING + +PKG_CONFIG_DEPENDS := \ + ARIA2_NOSSL \ + ARIA2_OPENSSL \ + ARIA2_GNUTLS \ + ARIA2_BITTORRENT \ + ARIA2_METALINK \ + ARIA2_SFTP \ + ARIA2_EXPAT \ + ARIA2_LIBXML2 + +include $(INCLUDE_DIR)/package.mk + +define Package/aria2/config + source "$(SOURCE)/Config.in" +endef + +define Package/aria2 + SECTION:=net + CATEGORY:=Network + SUBMENU:=File Transfer + TITLE:=lightweight download utility + URL:=https://aria2.github.io/ + DEPENDS:=+zlib +ARIA2_SFTP:libssh2 +ARIA2_LIBXML2:libxml2 +ARIA2_EXPAT:libexpat +libstdcpp +ARIA2_OPENSSL:libopenssl +ARIA2_GNUTLS:libgnutls +endef + +define Package/aria2/description + aria2 is a lightweight multi-protocol & multi-source command-line download + utility +endef + +CONFIGURE_ARGS += \ + --disable-nls \ + $(if $(CONFIG_ARIA2_NOSSL),--disable,--enable)-ssl \ + $(if $(CONFIG_ARIA2_OPENSSL),--with,--without)-openssl \ + $(if $(CONFIG_ARIA2_GNUTLS),--with,--without)-gnutls \ + $(if $(CONFIG_ARIA2_BITTORRENT),--enable,--disable)-bittorrent \ + $(if $(CONFIG_ARIA2_METALINK),--enable,--disable)-metalink \ + $(if $(CONFIG_ARIA2_SFTP),--with,--without)-libssh2 \ + $(if $(CONFIG_ARIA2_LIBXML2),--with,--without)-libxml2 \ + $(if $(CONFIG_ARIA2_EXPAT),--with,--without)-libexpat \ + --without-libnettle \ + --without-libgmp \ + --without-libgcrypt \ + --without-libcares \ + --without-libuv \ + --without-sqlite3 \ + --with-libz + +define Package/aria2/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/aria2c $(1)/usr/bin + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/aria2.init $(1)/etc/init.d/aria2 + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/aria2.conf $(1)/etc/config/aria2 +endef + +$(eval $(call BuildPackage,aria2)) diff --git a/net/aria2/files/aria2.conf b/net/aria2/files/aria2.conf new file mode 100644 index 0000000..e6d7617 --- /dev/null +++ b/net/aria2/files/aria2.conf @@ -0,0 +1,10 @@ + +config aria2 'main' + option enabled '0' + option file_allocation 'none' + option bt_enable_lpd 'true' + option enable_dht 'true' + option follow_torrent 'true' + option user 'root' + option dir '/mnt/sda1/aria2' + option save_session_interval '30' diff --git a/net/aria2/files/aria2.init b/net/aria2/files/aria2.init new file mode 100755 index 0000000..d6bcda4 --- /dev/null +++ b/net/aria2/files/aria2.init @@ -0,0 +1,112 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014-2016 nanpuyue +# Copyright (C) 2016 kuoruan + +START=99 +SERVICE_WRITE_PID=1 +SERVICE_DAEMONIZE=1 + + +append_params() { + local p; local v; local s="$1"; shift + for p in $*; do + config_get v "$s" "$p" + [ -n "$v" ] && ( + p=$(echo "$p" | sed -e 's|_|-|g'); + echo "$p=$v" >> $config_file + ) + done +} + +section_enabled() { + local result + config_get_bool result "$1" 'enabled' 0 + [ $result -eq 1 ] +} + +option_disabled() { + local result + config_get_bool result "$1" "$2" 1 + [ $result -eq 0 ] +} + +start_instance() { + local s="$1" + local user + + section_enabled "$s" || return 1 + + config_get config_dir "$s" 'config_dir' '/var/etc/aria2' + config_get dir "$s" 'dir' + config_get user "$s" 'user' + + config_file="$config_dir/aria2.conf" + session_file="$config_dir/aria2.session" + dht_file="$config_dir/dht.dat" + log_file="$config_dir/aria2.log" + + [ -d "$config_dir" ] || { + mkdir -m 0755 -p "$config_dir" + touch "$config_file" + } + + [ -d "$dir" ] || { + mkdir -m 0755 -p "$dir" # create download dir + touch "$dir" + } + + touch "$session_file" # create session file + + echo -e "enable-rpc=true\nrpc-allow-origin-all=true\nrpc-listen-all=true\nquiet=true" > $config_file + echo -e "continue=true\ninput-file=$session_file\nsave-session=$session_file" >> $config_file + + option_disabled "$s" 'enable_dht' || echo "dht-file-path=$dht_file" >> $config_file + option_disabled "$s" 'enable_log' || { + [ -f "$log_file" ] && echo > $log_file # if log file exist, clear it + echo -e "log=$log_file" >> $config_file + } + + # if user is set, change dir owner + [ -z "$user" ] || { + chown -R $user:$user $config_dir + chown -R $user:$user $dir + } + + append_params "$s" \ + file_allocation bt_enable_lpd enable_dht rpc_user rpc_passwd rpc_listen_port dir bt_tracker disk_cache \ + max_overall_download_limit max_overall_upload_limit max_download_limit max_upload_limit max_concurrent_downloads \ + max_connection_per_server min_split_size split save_session_interval follow_torrent listen_port bt_max_peers \ + peer_id_prefix user_agent rpc_secret log_level + + config_list_foreach "$s" extra_settings append_extrasettings + + SERVICE_UID="$user" \ + service_start /usr/bin/aria2c --conf-path="$config_file" # start service +} + +append_extrasettings() { + echo "$1" >> $config_file +} + +start() { + logger -t ARIA2C 'Starting aria2c service' + config_load 'aria2' + config_foreach start_instance 'aria2' + return 0 +} + +stop() { + if [ -n "`pidof aria2c`" ]; then + logger -t ARIA2C 'Shutting down aria2c service' + service_stop /usr/bin/aria2c + fi + return 0 +} + +restart() { + logger -t ARIA2C 'Restarting aria2c service' + stop + sleep 2 # give time to shutdown + start +} + diff --git a/net/arp-scan/Makefile b/net/arp-scan/Makefile new file mode 100644 index 0000000..78e8412 --- /dev/null +++ b/net/arp-scan/Makefile @@ -0,0 +1,47 @@ +# +# Copyright (C) 2016 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:=arp-scan +PKG_VERSION:=1.9-40-g69b2f70 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-3.0 +PKG_MAINTAINER:=Sergey Urushkin + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/royhills/arp-scan.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=69b2f70588565385f3a61d9b1f100f01747cd5e1 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz + +PKG_FIXUP:=autoreconf + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/arp-scan + SECTION:=net + CATEGORY:=Network + TITLE:=ARP scanner + DEPENDS:=+libpcap + URL:=https://github.com/royhills/arp-scan + PKG_MAINTAINER:=Sergey Urushkin +endef + +define Package/arp-scan/description + ARP scanner +endef + +define Package/arp-scan/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/arp-scan $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,arp-scan)) diff --git a/net/arp-scan/patches/001-cross_compile.patch b/net/arp-scan/patches/001-cross_compile.patch new file mode 100644 index 0000000..aa7f53e --- /dev/null +++ b/net/arp-scan/patches/001-cross_compile.patch @@ -0,0 +1,10 @@ +--- a/acinclude.m4 2016-02-19 15:21:01.000000000 +0300 ++++ b/acinclude.m4 2016-02-19 17:18:50.480874343 +0300 +@@ -211,7 +211,6 @@ + LONG_LONG_INT_FORMAT='' + + case $pgac_cv_snprintf_long_long_int_format in +- cross) AC_MSG_RESULT([cannot test (not on host machine)]);; + ?*) AC_MSG_RESULT([$pgac_cv_snprintf_long_long_int_format]) + LONG_LONG_INT_FORMAT=$pgac_cv_snprintf_long_long_int_format;; + *) AC_MSG_RESULT(none);; diff --git a/net/atftp/Makefile b/net/atftp/Makefile new file mode 100644 index 0000000..9b2404b --- /dev/null +++ b/net/atftp/Makefile @@ -0,0 +1,57 @@ +# +# Copyright (C) 2006-2015 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:=atftp +PKG_VERSION:=0.7.1 +PKG_RELEASE:=5 +PKG_MAINTAINER:=Daniel Danzberger +PKG_LICENSE:=GPL-2.0 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://freefr.dl.sourceforge.net/project/atftp/ +PKG_MD5SUM:=367bf401965fbed04585b1229c2191a8 + +PKG_BUILD_DEPENDS:=libpcre libreadline + +include $(INCLUDE_DIR)/package.mk + +define Package/atftp/Default + SECTION:=net + CATEGORY:=Network + TITLE:=TFTP + SUBMENU:=File Transfer +endef + +define Package/atftp + $(call Package/atftp/Default) + DEPENDS:=+libreadline +libncurses + TITLE+= client +endef + +define Package/atftpd + $(call Package/atftp/Default) + DEPENDS:=+libpcre +libpthread + TITLE+= server +endef + +CONFIGURE_ARGS += \ + --disable-libwrap + +define Package/atftp/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/atftp $(1)/usr/sbin/ +endef + +define Package/atftpd/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/atftpd $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,atftp)) +$(eval $(call BuildPackage,atftpd)) diff --git a/net/atftp/patches/01-missing-u_char-type-patch.patch b/net/atftp/patches/01-missing-u_char-type-patch.patch new file mode 100644 index 0000000..081f4b3 --- /dev/null +++ b/net/atftp/patches/01-missing-u_char-type-patch.patch @@ -0,0 +1,13 @@ +diff --git a/tftpd.h b/tftpd.h +index 945065e..4c2f214 100644 +--- a/tftpd.h ++++ b/tftpd.h +@@ -46,7 +46,7 @@ struct thread_data { + char *mc_addr; /* multicast address */ + struct sockaddr_storage sa_mcast; + union ip_mreq_storage mcastaddr; +- u_char mcast_ttl; ++ unsigned char mcast_ttl; + + /* + * Self can read/write until client_ready is set. Then only allowed to read. diff --git a/net/atftp/patches/02-fix-invalid-read-in-tftp_send_request.patch b/net/atftp/patches/02-fix-invalid-read-in-tftp_send_request.patch new file mode 100644 index 0000000..679af5c --- /dev/null +++ b/net/atftp/patches/02-fix-invalid-read-in-tftp_send_request.patch @@ -0,0 +1,13 @@ +diff --git a/tftp_io.c b/tftp_io.c +index 605a9c2..6cce1f4 100644 +--- a/tftp_io.c ++++ b/tftp_io.c +@@ -64,7 +64,7 @@ int tftp_send_request(int socket, struct sockaddr_storage *sa, short type, + buf_index += strlen(mode); + buf_index++; + +- for (i = 2; ; i++) ++ for (i = 2; i < OPT_NUMBER; i++) + { + if (strlen(tftp_options[i].option) == 0) + break; diff --git a/net/atftp/patches/03-Fix-undefined-reference-linker-errors.patch b/net/atftp/patches/03-Fix-undefined-reference-linker-errors.patch new file mode 100644 index 0000000..c828e1a --- /dev/null +++ b/net/atftp/patches/03-Fix-undefined-reference-linker-errors.patch @@ -0,0 +1,55 @@ +diff --git a/tftp_def.c b/tftp_def.c +index 96abdc5..16240f7 100644 +--- a/tftp_def.c ++++ b/tftp_def.c +@@ -141,7 +141,7 @@ int print_eng(double value, char *string, int size, char *format) + /* + * This is a strncpy function that take care of string NULL termination + */ +-inline char *Strncpy(char *to, const char *from, size_t size) ++char *Strncpy(char *to, const char *from, size_t size) + { + strncpy(to, from, size); + if (size>0) +diff --git a/tftp_def.h b/tftp_def.h +index e4b338d..4418ee7 100644 +--- a/tftp_def.h ++++ b/tftp_def.h +@@ -50,7 +50,7 @@ extern char *tftp_errmsg[9]; + + int timeval_diff(struct timeval *res, struct timeval *t1, struct timeval *t0); + int print_eng(double value, char *string, int size, char *format); +-inline char *Strncpy(char *to, const char *from, size_t size); ++char *Strncpy(char *to, const char *from, size_t size); + int Gethostbyname(char *addr, struct hostent *host); + + char *sockaddr_print_addr(const struct sockaddr_storage *, char *, size_t); +diff --git a/tftpd.h b/tftpd.h +index 945065e..4bd3f17 100644 +--- a/tftpd.h ++++ b/tftpd.h +@@ -93,7 +93,7 @@ int tftpd_list_find_multicast_server_and_add(struct thread_data **thread, + /* + * Defined in tftpd_list.c, operation on client structure list. + */ +-inline void tftpd_clientlist_ready(struct thread_data *thread); ++void tftpd_clientlist_ready(struct thread_data *thread); + void tftpd_clientlist_remove(struct thread_data *thread, + struct client_info *client); + void tftpd_clientlist_free(struct thread_data *thread); +diff --git a/tftpd_list.c b/tftpd_list.c +index f376159..159ffca 100644 +--- a/tftpd_list.c ++++ b/tftpd_list.c +@@ -201,7 +201,7 @@ int tftpd_list_find_multicast_server_and_add(struct thread_data **thread, + return 0; + } + +-inline void tftpd_clientlist_ready(struct thread_data *thread) ++void tftpd_clientlist_ready(struct thread_data *thread) + { + pthread_mutex_lock(&thread->client_mutex); + thread->client_ready = 1; +-- +2.1.4 + diff --git a/net/autossh/Makefile b/net/autossh/Makefile new file mode 100644 index 0000000..9a27767 --- /dev/null +++ b/net/autossh/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2006-2016 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:=autossh +PKG_VERSION:=1.4e +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://www.harding.motd.ca/autossh/ +PKG_MD5SUM:=f86684b96e99d22b2e9d35dc63b0aa29 +PKG_LICENSE:=0BSD + +include $(INCLUDE_DIR)/package.mk + +define Package/autossh + SECTION:=net + CATEGORY:=Network + TITLE:=Autossh client + URL:=http://www.harding.motd.ca/autossh/ + MAINTAINER:=Christian Beier + SUBMENU:=SSH +endef + +define Build/Compile + $(call Build/Compile/Default, -f Makefile \ + CFLAGS="$(TARGET_CFLAGS) -Wall -D\"SSH_PATH=\\\"\$$$$(SSH)\\\"\" -D\"VER=\\\"\$$$$(VER)\\\"\"" \ + all \ + ) +endef + +define Package/autossh/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/autossh $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/autossh.init $(1)/etc/init.d/autossh + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/autossh.config $(1)/etc/config/autossh + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_DATA) ./files/autossh.hotplug $(1)/etc/hotplug.d/iface/20-autossh +endef + +define Package/autossh/conffiles +/etc/config/autossh +endef + +$(eval $(call BuildPackage,autossh)) diff --git a/net/autossh/files/autossh.config b/net/autossh/files/autossh.config new file mode 100644 index 0000000..6ec3238 --- /dev/null +++ b/net/autossh/files/autossh.config @@ -0,0 +1,5 @@ +config autossh + option ssh '-i /etc/dropbear/id_rsa -N -T -R 2222:localhost:22 user@host' + option gatetime '0' + option monitorport '20000' + option poll '600' diff --git a/net/autossh/files/autossh.hotplug b/net/autossh/files/autossh.hotplug new file mode 100644 index 0000000..4f695f4 --- /dev/null +++ b/net/autossh/files/autossh.hotplug @@ -0,0 +1,14 @@ +#!/bin/sh +# Copyright (C) 2007 OpenWrt.org + +/etc/init.d/autossh enabled && { + + [ "$ACTION" = "ifup" ] && { + /etc/init.d/autossh start + } + + [ "$ACTION" = "ifdown" ] && { + /etc/init.d/autossh stop + } + +} diff --git a/net/autossh/files/autossh.init b/net/autossh/files/autossh.init new file mode 100644 index 0000000..f81bf4d --- /dev/null +++ b/net/autossh/files/autossh.init @@ -0,0 +1,30 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2007-2011 OpenWrt.org + +START=80 + +start_instance() { + local section="$1" + + config_get ssh "$section" 'ssh' + config_get gatetime "$section" 'gatetime' + config_get monitorport "$section" 'monitorport' + config_get poll "$section" 'poll' + + export AUTOSSH_GATETIME="${gatetime:-30}" + export AUTOSSH_POLL="${poll:-600}" + service_start /usr/sbin/autossh -M ${monitorport:-20000} -f ${ssh} +} + +boot() { + return +} + +start() { + config_load 'autossh' + config_foreach start_instance 'autossh' +} + +stop() { + service_stop /usr/sbin/autossh +} diff --git a/net/bcp38/Makefile b/net/bcp38/Makefile new file mode 100644 index 0000000..9ca1910 --- /dev/null +++ b/net/bcp38/Makefile @@ -0,0 +1,62 @@ +# +# Copyright (C) 2014 Openwrt.org +# +# This is free software, licensed under the GNU General Public License v2. + +include $(TOPDIR)/rules.mk + +PKG_NAME:=bcp38 +PKG_VERSION:=5 +PKG_RELEASE:=1 +PKG_LICENCE:=GPL-3.0+ + +include $(INCLUDE_DIR)/package.mk + +define Package/bcp38 + SECTION:=net + CATEGORY:=Network + SUBMENU:=Routing and Redirection + TITLE:=BCP38 compliance + URL:=https://github.com/dtaht/ceropackages-3.10 + MAINTAINER:=Toke Høiland-Jørgensen + DEPENDS:=+ipset +endef + +define Package/bcp38/description + bcp38 implements IETF BCP38 for home routers. See https://tools.ietf.org/html/bcp38. +endef + +define Package/bcp38/conffiles +/etc/config/bcp38 +endef + +define Build/Prepare +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/bcp38/install + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/bcp38.config $(1)/etc/config/bcp38 + $(INSTALL_DIR) $(1)/usr/lib/bcp38 + $(INSTALL_BIN) ./files/run.sh $(1)/usr/lib/bcp38/run.sh + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) ./files/bcp38.defaults $(1)/etc/uci-defaults/bcp38 +endef + +define Package/bcp38/postinst +#!/bin/sh +[ -x /etc/uci-defaults/bcp38 ] && /etc/uci-defaults/bcp38 || exit 0 +endef + +define Package/bcp38/postrm +#!/bin/sh +uci delete firewall.bcp38 +uci commit +endef + +$(eval $(call BuildPackage,bcp38)) diff --git a/net/bcp38/files/bcp38.config b/net/bcp38/files/bcp38.config new file mode 100644 index 0000000..08e8e20 --- /dev/null +++ b/net/bcp38/files/bcp38.config @@ -0,0 +1,22 @@ +config bcp38 + option enabled 0 + option interface 'eth1' + option detect_upstream 1 + list match '127.0.0.0/8' + list match '0.0.0.0/8' # RFC 1700 + list match '240.0.0.0/4' # RFC 5745 + list match '192.0.2.0/24' # RFC 5737 + list match '198.51.100.0/24' # RFC 5737 + list match '203.0.113.0/24' # RFC 5737 + list match '192.168.0.0/16' # RFC 1918 + list match '10.0.0.0/8' # RFC 1918 + list match '172.16.0.0/12' # RFC 1918 + list match '169.254.0.0/16' # RFC 3927 + +# list nomatch '172.26.0.0/21' # Example of something not to match +# There is a dhcp trigger to do this for the netmask of a +# double natted connection needed + +# I will argue that this level of indirection doesn't scale +# very well - see how to block china as an example +# http://www.okean.com/china.txt diff --git a/net/bcp38/files/bcp38.defaults b/net/bcp38/files/bcp38.defaults new file mode 100644 index 0000000..d7e0d80 --- /dev/null +++ b/net/bcp38/files/bcp38.defaults @@ -0,0 +1,13 @@ +#!/bin/sh + +uci -q batch <<-EOT + delete firewall.bcp38 + set firewall.bcp38=include + set firewall.bcp38.type=script + set firewall.bcp38.path=/usr/lib/bcp38/run.sh + set firewall.bcp38.family=IPv4 + set firewall.bcp38.reload=1 + commit firewall +EOT + +exit 0 diff --git a/net/bcp38/files/run.sh b/net/bcp38/files/run.sh new file mode 100755 index 0000000..00d5034 --- /dev/null +++ b/net/bcp38/files/run.sh @@ -0,0 +1,104 @@ +#!/bin/sh +# BCP38 filtering implementation for CeroWrt. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Author: Toke Høiland-Jørgensen + +STOP=$1 +IPSET_NAME=bcp38-ipv4 +IPTABLES_CHAIN=BCP38 + +. /lib/functions.sh + +config_load bcp38 + +add_bcp38_rule() +{ + local subnet="$1" + local action="$2" + + if [ "$action" == "nomatch" ]; then + ipset add "$IPSET_NAME" "$subnet" nomatch + else + ipset add "$IPSET_NAME" "$subnet" + fi +} + +detect_upstream() +{ + local interface="$1" + + subnets=$(ip route show dev "$interface" | grep 'scope link' | awk '{print $1}') + for subnet in $subnets; do + # ipset test doesn't work for subnets, so strip out the subnet part + # and test for that; add as exception if there's a match + addr=$(echo $subnet | sed 's|/[0-9]\+$||') + ipset test "$IPSET_NAME" $addr 2>/dev/null && add_bcp38_rule $subnet nomatch + done +} + +run() { + local section="$1" + local enabled + local interface + local detect_upstream + config_get_bool enabled "$section" enabled 0 + config_get interface "$section" interface + config_get detect_upstream "$section" detect_upstream + + if [ "$enabled" -eq "1" -a -n "$interface" -a -z "$STOP" ] ; then + setup_ipset + setup_iptables "$interface" + config_list_foreach "$section" match add_bcp38_rule match + config_list_foreach "$section" nomatch add_bcp38_rule nomatch + [ "$detect_upstream" -eq "1" ] && detect_upstream "$interface" + fi + exit 0 +} + +setup_ipset() +{ + ipset create "$IPSET_NAME" hash:net family ipv4 + ipset flush "$IPSET_NAME" +} + +setup_iptables() +{ + local interface="$1" + iptables -N "$IPTABLES_CHAIN" 2>/dev/null + iptables -F "$IPTABLES_CHAIN" 2>/dev/null + + iptables -I output_rule -m state --state NEW -j "$IPTABLES_CHAIN" + iptables -I input_rule -m state --state NEW -j "$IPTABLES_CHAIN" + iptables -I forwarding_rule -m state --state NEW -j "$IPTABLES_CHAIN" + + # always accept DHCP traffic + iptables -A "$IPTABLES_CHAIN" -p udp --dport 67:68 --sport 67:68 -j RETURN + iptables -A "$IPTABLES_CHAIN" -o "$interface" -m set --match-set "$IPSET_NAME" dst -j REJECT --reject-with icmp-net-unreachable + iptables -A "$IPTABLES_CHAIN" -i "$interface" -m set --match-set "$IPSET_NAME" src -j DROP +} + +destroy_ipset() +{ + ipset flush "$IPSET_NAME" 2>/dev/null + ipset destroy "$IPSET_NAME" 2>/dev/null +} + +destroy_iptables() +{ + iptables -D output_rule -m state --state NEW -j "$IPTABLES_CHAIN" 2>/dev/null + iptables -D input_rule -m state --state NEW -j "$IPTABLES_CHAIN" 2>/dev/null + iptables -D forwarding_rule -m state --state NEW -j "$IPTABLES_CHAIN" 2>/dev/null + iptables -F "$IPTABLES_CHAIN" 2>/dev/null + iptables -X "$IPTABLES_CHAIN" 2>/dev/null +} + +destroy_iptables +destroy_ipset +config_foreach run bcp38 + +exit 0 diff --git a/net/bind/Config.in b/net/bind/Config.in new file mode 100644 index 0000000..f0d4847 --- /dev/null +++ b/net/bind/Config.in @@ -0,0 +1,17 @@ +if PACKAGE_bind-server + +config BIND_ENABLE_FILTER_AAAA + bool + default n + prompt "Enable filtering of AAAA records returned to the client" + help + BIND 9 has an option to filter AAAA (IPv6 address) records + returned to the client based on the transport used for the + query, and other filtering conditions. This filtering does + not affect the recursive queries made by the server (if + any) as a result of the client request. + + Additional details are available at + https://kb.isc.org/article/AA-00576/0/Filter-AAAA-option-in-BIND-9-.html + +endif diff --git a/net/bind/Makefile b/net/bind/Makefile new file mode 100644 index 0000000..959184a --- /dev/null +++ b/net/bind/Makefile @@ -0,0 +1,220 @@ +# +# Copyright (C) 2006-2012 OpenWrt.org +# 2014-2016 Noah Meyerhans +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=bind +PKG_VERSION:=9.10.4-P4 +PKG_RELEASE:=2 +USERID:=bind=57:bind=57 + +PKG_MAINTAINER:=Noah Meyerhans +PKG_LICENSE := BSD-3-Clause + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:= \ + ftp://ftp.isc.org/isc/bind9/$(PKG_VERSION) \ + http://www.mirrorservice.org/sites/ftp.isc.org/isc/bind9/$(PKG_VERSION) +PKG_MD5SUM:=e110904a1d54f83f01d4be8bcd842927 + +PKG_FIXUP:=autoreconf +PKG_REMOVE_FILES:=aclocal.m4 libtool.m4 + +PKG_INSTALL:=1 +PKG_USE_MIPS16:=0 + +PKG_CONFIG_DEPENDS := \ + CONFIG_OPENSSL_WITH_EC \ + CONFIG_BIND_ENABLE_FILTER_AAAA + +include $(INCLUDE_DIR)/package.mk + +define Package/bind/Default + SECTION:=net + CATEGORY:=Network + DEPENDS:=+bind-libs + TITLE:=bind + URL:=https://www.isc.org/software/bind + SUBMENU:=IP Addresses and Names +endef + +define Package/bind-libs + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=+libopenssl + TITLE:=bind shared libraries + URL:=https://www.isc.org/software/bind +endef + +define Package/bind-server + $(call Package/bind/Default) + TITLE+= DNS server +endef + +define Package/bind-server/config + source "$(SOURCE)/Config.in" +endef + +define Package/bind-client + $(call Package/bind/Default) + TITLE+= dynamic DNS client +endef + +define Package/bind-tools + $(call Package/bind/Default) + TITLE+= administration tools (all) +endef + +define Package/bind-rndc + $(call Package/bind/Default) + TITLE+= administration tools (rndc and rndc-confgen only) +endef + +define Package/bind-check + $(call Package/bind/Default) + TITLE+= administration tools (named-checkconf and named-checkzone only) +endef + +define Package/bind-dnssec + $(call Package/bind/Default) + TITLE+= administration tools (dnssec-keygen and dnssec-signzone only) +endef + +define Package/bind-host + $(call Package/bind/Default) + TITLE+= simple DNS client +endef + +define Package/bind-dig + $(call Package/bind/Default) + TITLE+= DNS excavation tool +endef + +export BUILD_CC="$(TARGET_CC)" + +CONFIGURE_ARGS += \ + --enable-shared \ + --enable-static \ + --with-randomdev="/dev/urandom" \ + --disable-threads \ + --disable-linux-caps \ + --with-openssl="$(STAGING_DIR)/usr" \ + --with-libjson=no \ + --with-libtool \ + --with-libxml2=no \ + --enable-epoll=yes \ + --with-gost=no \ + --with-gssapi=no \ + --with-ecdsa=$(if $(CONFIG_OPENSSL_WITH_EC),yes,no) \ + --with-readline=no \ + --sysconfdir=/etc/bind + +ifdef CONFIG_BIND_ENABLE_FILTER_AAAA + CONFIGURE_ARGS += \ + --enable-filter-aaaa +endif + +CONFIGURE_VARS += \ + BUILD_CC="$(TARGET_CC)" \ + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR)/lib/dns \ + BUILD_CC="$(HOSTCC)" \ + CC="$(HOSTCC)" \ + CFLAGS="-O2" \ + LIBS="" \ + gen + $(call Build/Compile/Default) +endef + +define Package/bind-libs/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib +endef + +define Package/bind-server/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/bind + $(CP) \ + ./files/bind/db.0 \ + ./files/bind/db.127 \ + ./files/bind/db.255 \ + ./files/bind/db.local \ + ./files/bind/db.root \ + $(1)/etc/bind/ + $(CP) ./files/bind/named.conf.example $(1)/etc/bind/named.conf + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/named.init $(1)/etc/init.d/named + find $(1)/etc/bind/ -name ".svn" | xargs rm -rf +endef + +define Package/bind-server/conffiles +/etc/bind/db.0 +/etc/bind/db.127 +/etc/bind/db.255 +/etc/bind/db.local +/etc/bind/db.root +/etc/bind/named.conf +endef + +define Package/bind-client/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nsupdate $(1)/usr/bin/ +endef + +define Package/bind-tools/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dig $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/host $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-keygen $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-signzone $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named-checkconf $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named-checkzone $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rndc $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rndc-confgen $(1)/usr/sbin/ +endef + +define Package/bind-rndc/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rndc $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rndc-confgen $(1)/usr/sbin/ +endef + +define Package/bind-check/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named-checkconf $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named-checkzone $(1)/usr/sbin/ +endef + +define Package/bind-dnssec/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-keygen $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-signzone $(1)/usr/sbin/ +endef + +define Package/bind-host/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/host $(1)/usr/bin/ +endef + +define Package/bind-dig/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dig $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,bind-libs)) +$(eval $(call BuildPackage,bind-server)) +$(eval $(call BuildPackage,bind-client)) +$(eval $(call BuildPackage,bind-tools)) +$(eval $(call BuildPackage,bind-rndc)) +$(eval $(call BuildPackage,bind-check)) +$(eval $(call BuildPackage,bind-dnssec)) +$(eval $(call BuildPackage,bind-host)) +$(eval $(call BuildPackage,bind-dig)) diff --git a/net/bind/files/bind/db.0 b/net/bind/files/bind/db.0 new file mode 100644 index 0000000..e3aabdb --- /dev/null +++ b/net/bind/files/bind/db.0 @@ -0,0 +1,12 @@ +; +; BIND reverse data file for broadcast zone +; +$TTL 604800 +@ IN SOA localhost. root.localhost. ( + 1 ; Serial + 604800 ; Refresh + 86400 ; Retry + 2419200 ; Expire + 604800 ) ; Negative Cache TTL +; +@ IN NS localhost. diff --git a/net/bind/files/bind/db.127 b/net/bind/files/bind/db.127 new file mode 100644 index 0000000..cd05bef --- /dev/null +++ b/net/bind/files/bind/db.127 @@ -0,0 +1,13 @@ +; +; BIND reverse data file for local loopback interface +; +$TTL 604800 +@ IN SOA localhost. root.localhost. ( + 1 ; Serial + 604800 ; Refresh + 86400 ; Retry + 2419200 ; Expire + 604800 ) ; Negative Cache TTL +; +@ IN NS localhost. +1.0.0 IN PTR localhost. diff --git a/net/bind/files/bind/db.255 b/net/bind/files/bind/db.255 new file mode 100644 index 0000000..e3aabdb --- /dev/null +++ b/net/bind/files/bind/db.255 @@ -0,0 +1,12 @@ +; +; BIND reverse data file for broadcast zone +; +$TTL 604800 +@ IN SOA localhost. root.localhost. ( + 1 ; Serial + 604800 ; Refresh + 86400 ; Retry + 2419200 ; Expire + 604800 ) ; Negative Cache TTL +; +@ IN NS localhost. diff --git a/net/bind/files/bind/db.local b/net/bind/files/bind/db.local new file mode 100644 index 0000000..66b4892 --- /dev/null +++ b/net/bind/files/bind/db.local @@ -0,0 +1,13 @@ +; +; BIND data file for local loopback interface +; +$TTL 604800 +@ IN SOA localhost. root.localhost. ( + 1 ; Serial + 604800 ; Refresh + 86400 ; Retry + 2419200 ; Expire + 604800 ) ; Negative Cache TTL +; +@ IN NS localhost. +@ IN A 127.0.0.1 diff --git a/net/bind/files/bind/db.root b/net/bind/files/bind/db.root new file mode 100644 index 0000000..f0b79d2 --- /dev/null +++ b/net/bind/files/bind/db.root @@ -0,0 +1,90 @@ +; This file holds the information on root name servers needed to +; initialize cache of Internet domain name servers +; (e.g. reference this file in the "cache . " +; configuration file of BIND domain name servers). +; +; This file is made available by InterNIC +; under anonymous FTP as +; file /domain/named.cache +; on server FTP.INTERNIC.NET +; -OR- RS.INTERNIC.NET +; +; last update: February 17, 2016 +; related version of root zone: 2016021701 +; +; formerly NS.INTERNIC.NET +; +. 3600000 NS A.ROOT-SERVERS.NET. +A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4 +A.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:ba3e::2:30 +; +; FORMERLY NS1.ISI.EDU +; +. 3600000 NS B.ROOT-SERVERS.NET. +B.ROOT-SERVERS.NET. 3600000 A 192.228.79.201 +B.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:84::b +; +; FORMERLY C.PSI.NET +; +. 3600000 NS C.ROOT-SERVERS.NET. +C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12 +C.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2::c +; +; FORMERLY TERP.UMD.EDU +; +. 3600000 NS D.ROOT-SERVERS.NET. +D.ROOT-SERVERS.NET. 3600000 A 199.7.91.13 +D.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2d::d +; +; FORMERLY NS.NASA.GOV +; +. 3600000 NS E.ROOT-SERVERS.NET. +E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10 +; +; FORMERLY NS.ISC.ORG +; +. 3600000 NS F.ROOT-SERVERS.NET. +F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241 +F.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2f::f +; +; FORMERLY NS.NIC.DDN.MIL +; +. 3600000 NS G.ROOT-SERVERS.NET. +G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4 +; +; FORMERLY AOS.ARL.ARMY.MIL +; +. 3600000 NS H.ROOT-SERVERS.NET. +H.ROOT-SERVERS.NET. 3600000 A 198.97.190.53 +H.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:1::53 +; +; FORMERLY NIC.NORDU.NET +; +. 3600000 NS I.ROOT-SERVERS.NET. +I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17 +I.ROOT-SERVERS.NET. 3600000 AAAA 2001:7fe::53 +; +; OPERATED BY VERISIGN, INC. +; +. 3600000 NS J.ROOT-SERVERS.NET. +J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30 +J.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:c27::2:30 +; +; OPERATED BY RIPE NCC +; +. 3600000 NS K.ROOT-SERVERS.NET. +K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129 +K.ROOT-SERVERS.NET. 3600000 AAAA 2001:7fd::1 +; +; OPERATED BY ICANN +; +. 3600000 NS L.ROOT-SERVERS.NET. +L.ROOT-SERVERS.NET. 3600000 A 199.7.83.42 +L.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:3::42 +; +; OPERATED BY WIDE +; +. 3600000 NS M.ROOT-SERVERS.NET. +M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33 +M.ROOT-SERVERS.NET. 3600000 AAAA 2001:dc3::35 +; End of file diff --git a/net/bind/files/bind/named.conf.example b/net/bind/files/bind/named.conf.example new file mode 100644 index 0000000..1624549 --- /dev/null +++ b/net/bind/files/bind/named.conf.example @@ -0,0 +1,45 @@ +// This is the primary configuration file for the BIND DNS server named. + +options { + directory "/tmp"; + + // If your ISP provided one or more IP addresses for stable + // nameservers, you probably want to use them as forwarders. + // Uncomment the following block, and insert the addresses replacing + // the all-0's placeholder. + + // forwarders { + // 0.0.0.0; + // }; + + auth-nxdomain no; # conform to RFC1035 +}; + +// prime the server with knowledge of the root servers +zone "." { + type hint; + file "/etc/bind/db.root"; +}; + +// be authoritative for the localhost forward and reverse zones, and for +// broadcast zones as per RFC 1912 + +zone "localhost" { + type master; + file "/etc/bind/db.local"; +}; + +zone "127.in-addr.arpa" { + type master; + file "/etc/bind/db.127"; +}; + +zone "0.in-addr.arpa" { + type master; + file "/etc/bind/db.0"; +}; + +zone "255.in-addr.arpa" { + type master; + file "/etc/bind/db.255"; +}; diff --git a/net/bind/files/named.init b/net/bind/files/named.init new file mode 100644 index 0000000..b7876d9 --- /dev/null +++ b/net/bind/files/named.init @@ -0,0 +1,35 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014 Noah Meyerhans +# Licensed under the terms of the GNU General Public License version 2 +# or (at your discretion) any later later version + +USE_PROCD=1 + +START=50 + +config_file=/etc/bind/named.conf +pid_file=/var/run/named/named.pid + +logdir=/var/log/named/ +cachedir=/var/cache/bind +libdir=/var/lib/bind + +fix_perms() { + for dir in $libdir $logdir $cachedir; do + test -e "$dir" || { + mkdir -p "$dir" + chgrp bind "$dir" + chmod g+w "$dir" + } + done +} + +start_service() { + user_exists bind 57 || user_add bind 57 + group_exists bind 57 || group_add bind 57 + fix_perms + procd_open_instance + procd_set_param command /usr/sbin/named -u bind -f -c $config_file + procd_set_param respawn + procd_close_instance +} diff --git a/net/bind/patches/001-no-tests.patch b/net/bind/patches/001-no-tests.patch new file mode 100644 index 0000000..321924b --- /dev/null +++ b/net/bind/patches/001-no-tests.patch @@ -0,0 +1,26 @@ +Index: bind-9.10.4-P3/bin/Makefile.in +=================================================================== +--- bind-9.10.4-P3.orig/bin/Makefile.in ++++ bind-9.10.4-P3/bin/Makefile.in +@@ -19,7 +19,7 @@ srcdir = @srcdir@ + VPATH = @srcdir@ + top_srcdir = @top_srcdir@ + +-SUBDIRS = named rndc dig delv dnssec tools tests nsupdate \ ++SUBDIRS = named rndc dig delv dnssec tools nsupdate \ + check confgen @PYTHON_TOOLS@ @PKCS11_TOOLS@ + TARGETS = + +Index: bind-9.10.4-P3/lib/Makefile.in +=================================================================== +--- bind-9.10.4-P3.orig/lib/Makefile.in ++++ bind-9.10.4-P3/lib/Makefile.in +@@ -23,7 +23,7 @@ top_srcdir = @top_srcdir@ + # Attempt to disable parallel processing. + .NOTPARALLEL: + .NO_PARALLEL: +-SUBDIRS = isc isccc dns isccfg bind9 lwres irs tests samples ++SUBDIRS = isc isccc dns isccfg bind9 lwres irs samples + TARGETS = + + @BIND9_MAKE_RULES@ diff --git a/net/bind/patches/002-autoconf-ar-fix.patch b/net/bind/patches/002-autoconf-ar-fix.patch new file mode 100644 index 0000000..c360260 --- /dev/null +++ b/net/bind/patches/002-autoconf-ar-fix.patch @@ -0,0 +1,31 @@ +Index: bind-9.10.4-P3/configure.in +=================================================================== +--- bind-9.10.4-P3.orig/configure.in ++++ bind-9.10.4-P3/configure.in +@@ -167,26 +167,11 @@ esac + # + AC_CONFIG_FILES([make/rules make/includes]) + +-AC_PATH_PROG(AR, ar) +-ARFLAGS="cruv" +-AC_SUBST(AR) +-AC_SUBST(ARFLAGS) +- + # The POSIX ln(1) program. Non-POSIX systems may substitute + # "copy" or something. + LN=ln + AC_SUBST(LN) + +-case "$AR" in +- "") +- AC_MSG_ERROR([ +-ar program not found. Please fix your PATH to include the directory in +-which ar resides, or set AR in the environment with the full path to ar. +-]) +- +- ;; +-esac +- + # + # Etags. + # diff --git a/net/bmon/Makefile b/net/bmon/Makefile new file mode 100644 index 0000000..e39e24e --- /dev/null +++ b/net/bmon/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2007-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:=bmon +PKG_VERSION:=3.9 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/tgraf/bmon/releases/download/v$(PKG_VERSION)/ +PKG_MD5SUM:=a959371dc6f8eecdfe27c088447ec636 +PKG_MAINTAINER:=Baptiste Jonglez +PKG_LICENSE:=MIT + +include $(INCLUDE_DIR)/package.mk + +define Package/bmon + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libncursesw +libnl-core +libnl-route +confuse +terminfo + TITLE:=bmon is a portable bandwidth monitor + URL:=https://github.com/tgraf/bmon/ +endef + +define Package/bmon/description + bmon is a portable bandwidth monitor + and rate estimator running on various + operating systems. It supports various + input methods for different architectures. +endef + +CONFIGURE_ARGS += \ + --disable-cnt-workaround \ + +CONFIGURE_VARS += \ + ac_cv_lib_nl_nl_connect=no \ + +# Needed to compile some objects +TARGET_CFLAGS+= -std=gnu99 + +define Package/bmon/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bmon $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,bmon)) diff --git a/net/bridge-utils/Makefile b/net/bridge-utils/Makefile new file mode 100644 index 0000000..0075c0e --- /dev/null +++ b/net/bridge-utils/Makefile @@ -0,0 +1,59 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=bridge-utils +PKG_VERSION:=1.5 +PKG_RELEASE:=5 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/shemminger/bridge-utils.git +PKG_SOURCE_VERSION:=v${PKG_VERSION} +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz + +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=COPYING +PKG_FIXUP:=autoreconf + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz + +include $(INCLUDE_DIR)/package.mk + +define Package/bridge + SECTION:=net + CATEGORY:=Base system + TITLE:=Ethernet bridging configuration utility + URL:=http://bridge.sourceforge.net/ + PKG_MAINTAINER:=Nikolay Martynov +endef + +define Package/bridge/description + Manage ethernet bridging: a way to connect networks together to + form a larger network. +endef + +TARGET_CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE + +CONFIGURE_ARGS += \ + --with-linux-headers="$(LINUX_DIR)" \ + +define Package/bridge/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/brctl/brctl $(1)/usr/sbin +endef + +define Package/bridge/prerm +#!/bin/sh +$${IPKG_INSTROOT}/bin/busybox brctl -h 2>&1 | grep -q BusyBox && \ +ln -sf ../../bin/busybox $${IPKG_INSTROOT}/usr/sbin/brctl +exit 0 +endef + +$(eval $(call BuildPackage,bridge)) diff --git a/net/bridge-utils/patches/001-libbridge_cflags.patch b/net/bridge-utils/patches/001-libbridge_cflags.patch new file mode 100644 index 0000000..e35a649 --- /dev/null +++ b/net/bridge-utils/patches/001-libbridge_cflags.patch @@ -0,0 +1,11 @@ +--- a/libbridge/Makefile.in ++++ b/libbridge/Makefile.in +@@ -5,7 +5,7 @@ AR=ar + RANLIB=@RANLIB@ + + CC=@CC@ +-CFLAGS = -Wall -g $(KERNEL_HEADERS) ++CFLAGS = -Wall -g @CFLAGS@ $(KERNEL_HEADERS) + + prefix=@prefix@ + exec_prefix=@exec_prefix@ diff --git a/net/bridge-utils/patches/010-fix_struct_in6_addr_usage.patch b/net/bridge-utils/patches/010-fix_struct_in6_addr_usage.patch new file mode 100644 index 0000000..c2087e5 --- /dev/null +++ b/net/bridge-utils/patches/010-fix_struct_in6_addr_usage.patch @@ -0,0 +1,10 @@ +--- a/libbridge/libbridge.h ++++ b/libbridge/libbridge.h +@@ -20,6 +20,7 @@ + #define _LIBBRIDGE_H + + #include ++#include + #include + #include + diff --git a/net/bridge-utils/patches/100-musl-compat.patch b/net/bridge-utils/patches/100-musl-compat.patch new file mode 100644 index 0000000..5655643 --- /dev/null +++ b/net/bridge-utils/patches/100-musl-compat.patch @@ -0,0 +1,11 @@ +--- a/libbridge/libbridge.h ++++ b/libbridge/libbridge.h +@@ -19,6 +19,8 @@ + #ifndef _LIBBRIDGE_H + #define _LIBBRIDGE_H + ++#include ++#include + #include + #include + #include diff --git a/net/bwm-ng/Config.in b/net/bwm-ng/Config.in new file mode 100644 index 0000000..d822e12 --- /dev/null +++ b/net/bwm-ng/Config.in @@ -0,0 +1,35 @@ +# bwm-ng advanced configuration + +menu "Configuration" + depends on PACKAGE_bwm-ng + +config BWMNG_CONFIGFILE + bool "enable configfile support" + default n + +config BWMNG_HTML + bool "enable html output" + default n + +config BWMNG_CSV + bool "enable csv output" + default n + +config BWMNG_EXTENDEDSTATS + bool "enable max, sum and avg stats" + default y + +config BWMNG_LIBNCURSES + bool "enable libncurses support" + default n + +config BWMNG_TIME + bool "enable accurate time calculating" + default y + +config BWMNG_GETOPT_LONG + bool "enable long options" + default n + +endmenu + diff --git a/net/bwm-ng/Makefile b/net/bwm-ng/Makefile new file mode 100644 index 0000000..21c896c --- /dev/null +++ b/net/bwm-ng/Makefile @@ -0,0 +1,61 @@ +# +# Copyright (C) 2014-2015 OpenWrt.org +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=bwm-ng +PKG_VERSION:=0.6.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.gropp.org/bwm-ng +PKG_MD5SUM:=ef0c7669508e95f56250ad4f8db98b7f +PKG_MAINTAINER:=Julen Landa Alustiza +PKG_LICENSE:=GPL2-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/bwm-ng + SECTION:=net + CATEGORY:=Network + DEPENDS:=+BWMNG_LIBNCURSES:libncurses + TITLE:=bwm-ng + URL:=http://www.gropp.org/?id=projects&sub=bwm-ng + MENU:=1 +endef + +define Package/bwm-ng/description + Bandwidth Monitor NG is a small and simple console-based live + network and disk io bandwidth monitor. +endef + +define Package/bwm-ng/config + source "$(SOURCE)/Config.in" +endef + +define Build/Configure + $(call Build/Configure/Default, \ + $(if $(CONFIG_BWMNG_CONFIGFILE),--enable,--disable)-configfile \ + $(if $(CONFIG_BWMNG_HTML),--enable,--disable)-html \ + $(if $(CONFIG_BWMNG_CSV),--enable,--disable)-csv \ + $(if $(CONFIG_BWMNG_EXTENDEDSTATS),--enable,--disable)-extendedstats \ + $(if $(CONFIG_BWMNG_LIBNCURSES),--with,--without)-ncurses \ + $(if $(CONFIG_BWMNG_TIME),--with,--without)-time \ + $(if $(CONFIG_BWMNG_GETOPT_LONG),--with,--without)-getopt_long \ + --with-strip \ + --with-procnetdev \ + --with-diskstats \ + ) +endef + +define Package/bwm-ng/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bwm-ng $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,bwm-ng)) diff --git a/net/cgi-io/Makefile b/net/cgi-io/Makefile new file mode 100644 index 0000000..c36231a --- /dev/null +++ b/net/cgi-io/Makefile @@ -0,0 +1,44 @@ +# +# Copyright (C) 2015 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:=cgi-io +PKG_RELEASE:=1 + +PKG_LICENSE:=GPL-2.0+ + +PKG_MAINTAINER:=John Crispin + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/cgi-io + SECTION:=net + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + DEPENDS:=+libubox +libubus + TITLE:=CGI utility for handling up/downloading of files +endef + +define Package/cgi-io/description + This package contains an cgi utility that is useful for up/downloading files +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) + $(CP) ./src/* $(PKG_BUILD_DIR)/ +endef + +define Package/cgi-io/install + $(INSTALL_DIR) $(1)/usr/libexec $(1)/www/cgi-bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/cgi-io $(1)/usr/libexec + $(LN) ../../usr/libexec/cgi-io $(1)/www/cgi-bin/cgi-upload + $(LN) ../../usr/libexec/cgi-io $(1)/www/cgi-bin/cgi-download +endef + +$(eval $(call BuildPackage,cgi-io)) diff --git a/net/cgi-io/src/CMakeLists.txt b/net/cgi-io/src/CMakeLists.txt new file mode 100644 index 0000000..8a4ca19 --- /dev/null +++ b/net/cgi-io/src/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.6) + +PROJECT(cgi-io C) + +INCLUDE(CheckFunctionExists) + +ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations) + +SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") + +IF(APPLE) + INCLUDE_DIRECTORIES(/opt/local/include) + LINK_DIRECTORIES(/opt/local/lib) +ENDIF() + +ADD_EXECUTABLE(cgi-io main.c multipart_parser.c) +TARGET_LINK_LIBRARIES(cgi-io ubox ubus) + +INSTALL(TARGETS cgi-io RUNTIME DESTINATION sbin) diff --git a/net/cgi-io/src/main.c b/net/cgi-io/src/main.c new file mode 100644 index 0000000..69df2d6 --- /dev/null +++ b/net/cgi-io/src/main.c @@ -0,0 +1,644 @@ +/* + * cgi-io - LuCI non-RPC helper + * + * Copyright (C) 2013 Jo-Philipp Wich + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "multipart_parser.h" + + +enum part { + PART_UNKNOWN, + PART_SESSIONID, + PART_FILENAME, + PART_FILEMODE, + PART_FILEDATA +}; + +const char *parts[] = { + "(bug)", + "sessionid", + "filename", + "filemode", + "filedata", +}; + +struct state +{ + bool is_content_disposition; + enum part parttype; + char *sessionid; + char *filename; + bool filedata; + int filemode; + int filefd; + int tempfd; +}; + +enum { + SES_ACCESS, + __SES_MAX, +}; + +static const struct blobmsg_policy ses_policy[__SES_MAX] = { + [SES_ACCESS] = { .name = "access", .type = BLOBMSG_TYPE_BOOL }, +}; + + +static struct state st; + +static void +session_access_cb(struct ubus_request *req, int type, struct blob_attr *msg) +{ + struct blob_attr *tb[__SES_MAX]; + bool *allow = (bool *)req->priv; + + if (!msg) + return; + + blobmsg_parse(ses_policy, __SES_MAX, tb, blob_data(msg), blob_len(msg)); + + if (tb[SES_ACCESS]) + *allow = blobmsg_get_bool(tb[SES_ACCESS]); +} + +static bool +session_access(const char *sid, const char *obj, const char *func) +{ + uint32_t id; + bool allow = false; + struct ubus_context *ctx; + static struct blob_buf req; + + ctx = ubus_connect(NULL); + + if (!ctx || ubus_lookup_id(ctx, "session", &id)) + goto out; + + blob_buf_init(&req, 0); + blobmsg_add_string(&req, "ubus_rpc_session", sid); + blobmsg_add_string(&req, "scope", "cgi-io"); + blobmsg_add_string(&req, "object", obj); + blobmsg_add_string(&req, "function", func); + + ubus_invoke(ctx, id, "access", req.head, session_access_cb, &allow, 500); + +out: + if (ctx) + ubus_free(ctx); + + return allow; +} + +static char * +md5sum(const char *file) +{ + pid_t pid; + int fds[2]; + static char md5[33]; + + if (pipe(fds)) + return NULL; + + switch ((pid = fork())) + { + case -1: + return NULL; + + case 0: + uloop_done(); + + dup2(fds[1], 1); + + close(0); + close(2); + close(fds[0]); + close(fds[1]); + + if (execl("/bin/busybox", "/bin/busybox", "md5sum", file, NULL)); + return NULL; + + break; + + default: + memset(md5, 0, sizeof(md5)); + read(fds[0], md5, 32); + waitpid(pid, NULL, 0); + close(fds[0]); + close(fds[1]); + } + + return md5; +} + +static char * +datadup(const void *in, size_t len) +{ + char *out = malloc(len + 1); + + if (!out) + return NULL; + + memcpy(out, in, len); + + *(out + len) = 0; + + return out; +} + +static bool +urldecode(char *buf) +{ + char *c, *p; + + if (!buf || !*buf) + return true; + +#define hex(x) \ + (((x) <= '9') ? ((x) - '0') : \ + (((x) <= 'F') ? ((x) - 'A' + 10) : \ + ((x) - 'a' + 10))) + + for (c = p = buf; *p; c++) + { + if (*p == '%') + { + if (!isxdigit(*(p + 1)) || !isxdigit(*(p + 2))) + return false; + + *c = (char)(16 * hex(*(p + 1)) + hex(*(p + 2))); + + p += 3; + } + else if (*p == '+') + { + *c = ' '; + p++; + } + else + { + *c = *p++; + } + } + + *c = 0; + + return true; +} + +static bool +postdecode(char **fields, int n_fields) +{ + char *p; + const char *var; + static char buf[1024]; + int i, len, field, found = 0; + + var = getenv("CONTENT_TYPE"); + + if (!var || strncmp(var, "application/x-www-form-urlencoded", 33)) + return false; + + memset(buf, 0, sizeof(buf)); + + if ((len = read(0, buf, sizeof(buf) - 1)) > 0) + { + for (p = buf, i = 0; i <= len; i++) + { + if (buf[i] == '=') + { + buf[i] = 0; + + for (field = 0; field < (n_fields * 2); field += 2) + { + if (!strcmp(p, fields[field])) + { + fields[field + 1] = buf + i + 1; + found++; + } + } + } + else if (buf[i] == '&' || buf[i] == '\0') + { + buf[i] = 0; + + if (found >= n_fields) + break; + + p = buf + i + 1; + } + } + } + + for (field = 0; field < (n_fields * 2); field += 2) + if (!urldecode(fields[field + 1])) + return false; + + return (found >= n_fields); +} + +static int +response(bool success, const char *message) +{ + char *md5; + struct stat s; + + printf("Status: 200 OK\r\n"); + printf("Content-Type: text/plain\r\n\r\n{\n"); + + if (success) + { + if (!stat(st.filename, &s) && (md5 = md5sum(st.filename)) != NULL) + printf("\t\"size\": %u,\n\t\"checksum\": \"%s\"\n", + (unsigned int)s.st_size, md5); + } + else + { + if (message) + printf("\t\"message\": \"%s\",\n", message); + + printf("\t\"failure\": [ %u, \"%s\" ]\n", errno, strerror(errno)); + + if (st.filefd > -1) + unlink(st.filename); + } + + printf("}\n"); + + return -1; +} + +static int +failure(int e, const char *message) +{ + printf("Status: 500 Internal Server failure\r\n"); + printf("Content-Type: text/plain\r\n\r\n"); + printf("%s", message); + + if (e) + printf(": %s", strerror(e)); + + return -1; +} + +static int +filecopy(void) +{ + int len; + char buf[4096]; + + if (!st.filedata) + { + close(st.tempfd); + errno = EINVAL; + return response(false, "No file data received"); + } + + if (lseek(st.tempfd, 0, SEEK_SET) < 0) + { + close(st.tempfd); + return response(false, "Failed to rewind temp file"); + } + + st.filefd = open(st.filename, O_CREAT | O_TRUNC | O_WRONLY, 0600); + + if (st.filefd < 0) + { + close(st.tempfd); + return response(false, "Failed to open target file"); + } + + while ((len = read(st.tempfd, buf, sizeof(buf))) > 0) + { + if (write(st.filefd, buf, len) != len) + { + close(st.tempfd); + close(st.filefd); + return response(false, "I/O failure while writing target file"); + } + } + + close(st.tempfd); + close(st.filefd); + + if (chmod(st.filename, st.filemode)) + return response(false, "Failed to chmod target file"); + + return 0; +} + +static int +header_field(multipart_parser *p, const char *data, size_t len) +{ + st.is_content_disposition = !strncasecmp(data, "Content-Disposition", len); + return 0; +} + +static int +header_value(multipart_parser *p, const char *data, size_t len) +{ + int i, j; + + if (!st.is_content_disposition) + return 0; + + if (len < 10 || strncasecmp(data, "form-data", 9)) + return 0; + + for (data += 9, len -= 9; *data == ' ' || *data == ';'; data++, len--); + + if (len < 8 || strncasecmp(data, "name=\"", 6)) + return 0; + + for (data += 6, len -= 6, i = 0; i <= len; i++) + { + if (*(data + i) != '"') + continue; + + for (j = 1; j < sizeof(parts) / sizeof(parts[0]); j++) + if (!strncmp(data, parts[j], i)) + st.parttype = j; + + break; + } + + return 0; +} + +static int +data_begin_cb(multipart_parser *p) +{ + char tmpname[24] = "/tmp/luci-upload.XXXXXX"; + + if (st.parttype == PART_FILEDATA) + { + if (!st.sessionid) + return response(false, "File data without session"); + + if (!st.filename) + return response(false, "File data without name"); + + st.tempfd = mkstemp(tmpname); + + if (st.tempfd < 0) + return response(false, "Failed to create temporary file"); + + unlink(tmpname); + } + + return 0; +} + +static int +data_cb(multipart_parser *p, const char *data, size_t len) +{ + switch (st.parttype) + { + case PART_SESSIONID: + st.sessionid = datadup(data, len); + break; + + case PART_FILENAME: + st.filename = datadup(data, len); + break; + + case PART_FILEMODE: + st.filemode = strtoul(data, NULL, 8); + break; + + case PART_FILEDATA: + if (write(st.tempfd, data, len) != len) + { + close(st.tempfd); + return response(false, "I/O failure while writing temporary file"); + } + + if (!st.filedata) + st.filedata = !!len; + + break; + + default: + break; + } + + return 0; +} + +static int +data_end_cb(multipart_parser *p) +{ + if (st.parttype == PART_SESSIONID) + { + if (!session_access(st.sessionid, "upload", "write")) + { + errno = EPERM; + return response(false, "Upload permission denied"); + } + } + else if (st.parttype == PART_FILEDATA) + { + if (st.tempfd < 0) + return response(false, "Internal program failure"); + +#if 0 + /* prepare directory */ + for (ptr = st.filename; *ptr; ptr++) + { + if (*ptr == '/') + { + *ptr = 0; + + if (mkdir(st.filename, 0755)) + { + unlink(st.tmpname); + return response(false, "Failed to create destination directory"); + } + + *ptr = '/'; + } + } +#endif + + if (filecopy()) + return -1; + + return response(true, NULL); + } + + st.parttype = PART_UNKNOWN; + return 0; +} + +static multipart_parser * +init_parser(void) +{ + char *boundary; + const char *var; + + multipart_parser *p; + static multipart_parser_settings s = { + .on_part_data = data_cb, + .on_headers_complete = data_begin_cb, + .on_part_data_end = data_end_cb, + .on_header_field = header_field, + .on_header_value = header_value + }; + + var = getenv("CONTENT_TYPE"); + + if (!var || strncmp(var, "multipart/form-data;", 20)) + return NULL; + + for (var += 20; *var && *var != '='; var++); + + if (*var++ != '=') + return NULL; + + boundary = malloc(strlen(var) + 3); + + if (!boundary) + return NULL; + + strcpy(boundary, "--"); + strcpy(boundary + 2, var); + + st.tempfd = -1; + st.filefd = -1; + st.filemode = 0600; + + p = multipart_parser_init(boundary, &s); + + free(boundary); + + return p; +} + +static int +main_upload(int argc, char *argv[]) +{ + int rem, len; + char buf[4096]; + multipart_parser *p; + + p = init_parser(); + + if (!p) + { + errno = EINVAL; + return response(false, "Invalid request"); + } + + while ((len = read(0, buf, sizeof(buf))) > 0) + { + rem = multipart_parser_execute(p, buf, len); + + if (rem < len) + break; + } + + multipart_parser_free(p); + + /* read remaining post data */ + while ((len = read(0, buf, sizeof(buf))) > 0); + + return 0; +} + +static int +main_backup(int argc, char **argv) +{ + pid_t pid; + time_t now; + int len; + int fds[2]; + char buf[4096]; + char datestr[16] = { 0 }; + char hostname[64] = { 0 }; + char *fields[] = { "sessionid", NULL }; + + if (!postdecode(fields, 1) || !session_access(fields[1], "backup", "read")) + return failure(0, "Backup permission denied"); + + if (pipe(fds)) + return failure(errno, "Failed to spawn pipe"); + + switch ((pid = fork())) + { + case -1: + return failure(errno, "Failed to fork process"); + + case 0: + dup2(fds[1], 1); + + close(0); + close(2); + close(fds[0]); + close(fds[1]); + + chdir("/"); + + execl("/sbin/sysupgrade", "/sbin/sysupgrade", + "--create-backup", "-", NULL); + + return -1; + + default: + now = time(NULL); + strftime(datestr, sizeof(datestr) - 1, "%Y-%m-%d", localtime(&now)); + + if (gethostname(hostname, sizeof(hostname) - 1)) + sprintf(hostname, "OpenWrt"); + + printf("Status: 200 OK\r\n"); + printf("Content-Type: application/x-targz\r\n"); + printf("Content-Disposition: attachment; " + "filename=\"backup-%s-%s.tar.gz\"\r\n\r\n", hostname, datestr); + + while ((len = read(fds[0], buf, sizeof(buf))) > 0) + fwrite(buf, len, 1, stdout); + + waitpid(pid, NULL, 0); + + close(fds[0]); + close(fds[1]); + + return 0; + } +} + +int main(int argc, char **argv) +{ + if (strstr(argv[0], "cgi-upload")) + return main_upload(argc, argv); + else if (strstr(argv[0], "cgi-backup")) + return main_backup(argc, argv); + + return -1; +} diff --git a/net/cgi-io/src/multipart_parser.c b/net/cgi-io/src/multipart_parser.c new file mode 100644 index 0000000..ee82c82 --- /dev/null +++ b/net/cgi-io/src/multipart_parser.c @@ -0,0 +1,309 @@ +/* Based on node-formidable by Felix Geisendörfer + * Igor Afonov - afonov@gmail.com - 2012 + * MIT License - http://www.opensource.org/licenses/mit-license.php + */ + +#include "multipart_parser.h" + +#include +#include +#include + +static void multipart_log(const char * format, ...) +{ +#ifdef DEBUG_MULTIPART + va_list args; + va_start(args, format); + + fprintf(stderr, "[HTTP_MULTIPART_PARSER] %s:%d: ", __FILE__, __LINE__); + vfprintf(stderr, format, args); + fprintf(stderr, "\n"); +#endif +} + +#define NOTIFY_CB(FOR) \ +do { \ + if (p->settings->on_##FOR) { \ + if (p->settings->on_##FOR(p) != 0) { \ + return i; \ + } \ + } \ +} while (0) + +#define EMIT_DATA_CB(FOR, ptr, len) \ +do { \ + if (p->settings->on_##FOR) { \ + if (p->settings->on_##FOR(p, ptr, len) != 0) { \ + return i; \ + } \ + } \ +} while (0) + + +#define LF 10 +#define CR 13 + +struct multipart_parser { + void * data; + + size_t index; + size_t boundary_length; + + unsigned char state; + + const multipart_parser_settings* settings; + + char* lookbehind; + char multipart_boundary[1]; +}; + +enum state { + s_uninitialized = 1, + s_start, + s_start_boundary, + s_header_field_start, + s_header_field, + s_headers_almost_done, + s_header_value_start, + s_header_value, + s_header_value_almost_done, + s_part_data_start, + s_part_data, + s_part_data_almost_boundary, + s_part_data_boundary, + s_part_data_almost_end, + s_part_data_end, + s_part_data_final_hyphen, + s_end +}; + +multipart_parser* multipart_parser_init + (const char *boundary, const multipart_parser_settings* settings) { + + multipart_parser* p = malloc(sizeof(multipart_parser) + + strlen(boundary) + + strlen(boundary) + 9); + + strcpy(p->multipart_boundary, boundary); + p->boundary_length = strlen(boundary); + + p->lookbehind = (p->multipart_boundary + p->boundary_length + 1); + + p->index = 0; + p->state = s_start; + p->settings = settings; + + return p; +} + +void multipart_parser_free(multipart_parser* p) { + free(p); +} + +void multipart_parser_set_data(multipart_parser *p, void *data) { + p->data = data; +} + +void *multipart_parser_get_data(multipart_parser *p) { + return p->data; +} + +size_t multipart_parser_execute(multipart_parser* p, const char *buf, size_t len) { + size_t i = 0; + size_t mark = 0; + char c, cl; + int is_last = 0; + + while(i < len) { + c = buf[i]; + is_last = (i == (len - 1)); + switch (p->state) { + case s_start: + multipart_log("s_start"); + p->index = 0; + p->state = s_start_boundary; + + /* fallthrough */ + case s_start_boundary: + multipart_log("s_start_boundary"); + if (p->index == p->boundary_length) { + if (c != CR) { + return i; + } + p->index++; + break; + } else if (p->index == (p->boundary_length + 1)) { + if (c != LF) { + return i; + } + p->index = 0; + NOTIFY_CB(part_data_begin); + p->state = s_header_field_start; + break; + } + if (c != p->multipart_boundary[p->index]) { + return i; + } + p->index++; + break; + + case s_header_field_start: + multipart_log("s_header_field_start"); + mark = i; + p->state = s_header_field; + + /* fallthrough */ + case s_header_field: + multipart_log("s_header_field"); + if (c == CR) { + p->state = s_headers_almost_done; + break; + } + + if (c == '-') { + break; + } + + if (c == ':') { + EMIT_DATA_CB(header_field, buf + mark, i - mark); + p->state = s_header_value_start; + break; + } + + cl = tolower(c); + if (cl < 'a' || cl > 'z') { + multipart_log("invalid character in header name"); + return i; + } + if (is_last) + EMIT_DATA_CB(header_field, buf + mark, (i - mark) + 1); + break; + + case s_headers_almost_done: + multipart_log("s_headers_almost_done"); + if (c != LF) { + return i; + } + + p->state = s_part_data_start; + break; + + case s_header_value_start: + multipart_log("s_header_value_start"); + if (c == ' ') { + break; + } + + mark = i; + p->state = s_header_value; + + /* fallthrough */ + case s_header_value: + multipart_log("s_header_value"); + if (c == CR) { + EMIT_DATA_CB(header_value, buf + mark, i - mark); + p->state = s_header_value_almost_done; + } + if (is_last) + EMIT_DATA_CB(header_value, buf + mark, (i - mark) + 1); + break; + + case s_header_value_almost_done: + multipart_log("s_header_value_almost_done"); + if (c != LF) { + return i; + } + p->state = s_header_field_start; + break; + + case s_part_data_start: + multipart_log("s_part_data_start"); + NOTIFY_CB(headers_complete); + mark = i; + p->state = s_part_data; + + /* fallthrough */ + case s_part_data: + multipart_log("s_part_data"); + if (c == CR) { + EMIT_DATA_CB(part_data, buf + mark, i - mark); + mark = i; + p->state = s_part_data_almost_boundary; + p->lookbehind[0] = CR; + break; + } + if (is_last) + EMIT_DATA_CB(part_data, buf + mark, (i - mark) + 1); + break; + + case s_part_data_almost_boundary: + multipart_log("s_part_data_almost_boundary"); + if (c == LF) { + p->state = s_part_data_boundary; + p->lookbehind[1] = LF; + p->index = 0; + break; + } + EMIT_DATA_CB(part_data, p->lookbehind, 1); + p->state = s_part_data; + mark = i --; + break; + + case s_part_data_boundary: + multipart_log("s_part_data_boundary"); + if (p->multipart_boundary[p->index] != c) { + EMIT_DATA_CB(part_data, p->lookbehind, 2 + p->index); + p->state = s_part_data; + mark = i --; + break; + } + p->lookbehind[2 + p->index] = c; + if ((++ p->index) == p->boundary_length) { + NOTIFY_CB(part_data_end); + p->state = s_part_data_almost_end; + } + break; + + case s_part_data_almost_end: + multipart_log("s_part_data_almost_end"); + if (c == '-') { + p->state = s_part_data_final_hyphen; + break; + } + if (c == CR) { + p->state = s_part_data_end; + break; + } + return i; + + case s_part_data_final_hyphen: + multipart_log("s_part_data_final_hyphen"); + if (c == '-') { + NOTIFY_CB(body_end); + p->state = s_end; + break; + } + return i; + + case s_part_data_end: + multipart_log("s_part_data_end"); + if (c == LF) { + p->state = s_header_field_start; + NOTIFY_CB(part_data_begin); + break; + } + return i; + + case s_end: + multipart_log("s_end: %02X", (int) c); + break; + + default: + multipart_log("Multipart parser unrecoverable error"); + return 0; + } + ++ i; + } + + return len; +} diff --git a/net/cgi-io/src/multipart_parser.h b/net/cgi-io/src/multipart_parser.h new file mode 100644 index 0000000..87e67f4 --- /dev/null +++ b/net/cgi-io/src/multipart_parser.h @@ -0,0 +1,48 @@ +/* Based on node-formidable by Felix Geisendörfer + * Igor Afonov - afonov@gmail.com - 2012 + * MIT License - http://www.opensource.org/licenses/mit-license.php + */ +#ifndef _multipart_parser_h +#define _multipart_parser_h + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include +#include + +typedef struct multipart_parser multipart_parser; +typedef struct multipart_parser_settings multipart_parser_settings; +typedef struct multipart_parser_state multipart_parser_state; + +typedef int (*multipart_data_cb) (multipart_parser*, const char *at, size_t length); +typedef int (*multipart_notify_cb) (multipart_parser*); + +struct multipart_parser_settings { + multipart_data_cb on_header_field; + multipart_data_cb on_header_value; + multipart_data_cb on_part_data; + + multipart_notify_cb on_part_data_begin; + multipart_notify_cb on_headers_complete; + multipart_notify_cb on_part_data_end; + multipart_notify_cb on_body_end; +}; + +multipart_parser* multipart_parser_init + (const char *boundary, const multipart_parser_settings* settings); + +void multipart_parser_free(multipart_parser* p); + +size_t multipart_parser_execute(multipart_parser* p, const char *buf, size_t len); + +void multipart_parser_set_data(multipart_parser* p, void* data); +void * multipart_parser_get_data(multipart_parser* p); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/net/chaosvpn/Makefile b/net/chaosvpn/Makefile new file mode 100644 index 0000000..f36c8d5 --- /dev/null +++ b/net/chaosvpn/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2010-2015 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:=chaosvpn + +PKG_REV:=2eb24810b5aa0b2d56f21562e52927020dc3090a +PKG_VERSION:=2014-01-24 +PKG_RELEASE=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/ryd/chaosvpn.git +PKG_SOURCE_VERSION:=$(PKG_REV) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_REV).tar.gz +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_LICENSE:=Apache-2.0 +PKG_MAINTAINER:=Norbert Summer + +include $(INCLUDE_DIR)/package.mk + +define Package/chaosvpn + TITLE:=Config generator for chaos vpn + SECTION:=net + CATEGORY:=Network + URL:=https://wiki.hamburg.ccc.de/index.php/ChaosVPN::DebianHowto + SUBMENU:=VPN + DEPENDS:=+tinc +ip +kmod-tun +libopenssl +zlib +endef + +define Package/chaosvpn/description + Configure tincd for the chaosvpn network +endef + +define Package/chaosvpn/conffiles +/etc/tinc/chaosvpn.conf +endef + +MAKE_FLAGS += \ + COPT="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS)" + +define Package/chaosvpn/install + $(INSTALL_DIR) $(1)/etc/tinc/chaos/ $(1)/usr/sbin/ $(1)/etc/init.d/ $(1)/etc/hotplug.d/iface/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/chaosvpn $(1)/usr/sbin/ + $(INSTALL_BIN) ./files/chaosvpn.init $(1)/etc/init.d/chaosvpn + $(INSTALL_BIN) ./files/chaosvpn.hotplug $(1)/etc/hotplug.d/iface/40-chaosvpn + sed -i -e 's/"\/sbin\/ip /"\/usr\/sbin\/ip /' $(PKG_BUILD_DIR)/chaosvpn.conf + $(INSTALL_CONF) $(PKG_BUILD_DIR)/chaosvpn.conf $(1)/etc/tinc/chaosvpn.conf +endef + +$(eval $(call BuildPackage,chaosvpn)) + diff --git a/net/chaosvpn/files/chaosvpn.hotplug b/net/chaosvpn/files/chaosvpn.hotplug new file mode 100755 index 0000000..3044e53 --- /dev/null +++ b/net/chaosvpn/files/chaosvpn.hotplug @@ -0,0 +1,3 @@ +[ "$INTERFACE" == "wan" ] || return +[ "$ACTION" == "ifup" ] && /etc/init.d/chaosvpn restart + diff --git a/net/chaosvpn/files/chaosvpn.init b/net/chaosvpn/files/chaosvpn.init new file mode 100755 index 0000000..f847a9a --- /dev/null +++ b/net/chaosvpn/files/chaosvpn.init @@ -0,0 +1,31 @@ +#!/bin/sh /etc/rc.common +START=99 + +USE_PROCD=1 + +start_service() +{ + #check if chaosvpn is configured + if [ ! -f "/etc/tinc/chaos/rsa_key.pub" -o ! -f "/etc/tinc/chaos/rsa_key.priv" ]; then + logger -t chaosvpn "please generate rsa key pair" + logger -t chaosvpn "tincd -n chaos --generate-keys=2048" + exit 1 + fi + + if [ "`grep unique_name /etc/tinc/chaosvpn.conf | wc -l`" != "0" ]; then + logger -t chaosvpn "/etc/tinc/chaosvpn.conf is not configured yet or contains 'unique_name'" + exit 1 + fi + + procd_open_instance + procd_set_param command /usr/sbin/chaosvpn -r -c /etc/tinc/chaosvpn.conf + procd_close_instance +} + +stop_service() +{ + #force remove tinc pid + if [ -f "/var/run/tinc.chaos.pid" ]; then + rm "/var/run/tinc.chaos.pid" + fi +} diff --git a/net/chrony/Makefile b/net/chrony/Makefile new file mode 100644 index 0000000..db631fe --- /dev/null +++ b/net/chrony/Makefile @@ -0,0 +1,76 @@ +# +# Copyright (C) 2006-2015 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:=chrony +PKG_VERSION:=2.4.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://download.tuxfamily.org/chrony/ +PKG_MD5SUM:=d08dd5a7d79a89891d119adcccb4397d + +PKG_MAINTAINER:=Miroslav Lichvar +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_BUILD_DEPENDS:=+pps-tools + +include $(INCLUDE_DIR)/package.mk + +define Package/chrony + SUBMENU:=Time Synchronization + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libcap + USERID:=chrony=323:chrony=323 + TITLE:=A versatile NTP client and server + URL:=http://chrony.tuxfamily.org/ +endef + +define Package/chrony/description + An NTP client and server designed to perform well in a wide range + of conditions. It can synchronize the system clock with NTP servers, + reference clocks, and manual input using wristwatch and keyboard. +endef + +define Package/chrony/conffiles +/etc/chrony/chrony.conf +/etc/config/chrony +endef + +CONFIGURE_ARGS+= \ + --host-machine=$(shell echo $(GNU_TARGET_NAME) | sed -e 's/-.*//') \ + --host-release="" \ + --host-system=Linux \ + --sysconfdir=/etc/chrony \ + --prefix=/usr \ + --chronysockdir=/var/run/chrony \ + --disable-readline \ + --disable-rtc \ + --disable-asyncdns \ + --with-user=chrony + +CONFIGURE_VARS+=CPPFLAGS=-DNDEBUG + +define Package/chrony/install + $(INSTALL_DIR) $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/chronyd $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/chronyc $(1)/usr/bin + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DIR) $(1)/etc/chrony + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) ./files/chrony.hotplug $(1)/etc/hotplug.d/iface/20-chrony + $(INSTALL_BIN) ./files/chronyd.init $(1)/etc/init.d/chronyd + $(INSTALL_CONF) ./files/chrony.config $(1)/etc/config/chrony + $(INSTALL_CONF) ./files/chrony.conf $(1)/etc/chrony/chrony.conf +endef + +$(eval $(call BuildPackage,chrony)) diff --git a/net/chrony/files/chrony.conf b/net/chrony/files/chrony.conf new file mode 100644 index 0000000..b207c94 --- /dev/null +++ b/net/chrony/files/chrony.conf @@ -0,0 +1,7 @@ +# This file is included from config file generated from /etc/config/chrony + +# Log clock errors above 0.5 seconds +logchange 0.5 + +# Don't log client accesses +noclientlog diff --git a/net/chrony/files/chrony.config b/net/chrony/files/chrony.config new file mode 100644 index 0000000..63f494d --- /dev/null +++ b/net/chrony/files/chrony.config @@ -0,0 +1,14 @@ +config pool + option hostname '2.openwrt.pool.ntp.org' + option maxpoll '12' + option iburst 'yes' + +config dhcp_ntp_server + option iburst 'yes' + +config allow + option interface 'lan' + +config makestep + option threshold '1.0' + option limit '3' diff --git a/net/chrony/files/chrony.hotplug b/net/chrony/files/chrony.hotplug new file mode 100644 index 0000000..6ab2104 --- /dev/null +++ b/net/chrony/files/chrony.hotplug @@ -0,0 +1,44 @@ +#!/bin/sh +# Set chronyd online/offline status, allow NTP access and add servers from DHCP + +[ "$ACTION" = ifup -o "$ACTION" = ifdown ] || exit 0 + +run_command() { + /usr/bin/chronyc -n "$*" > /dev/null 2>&1 +} + +run_command tracking || exit 0 + +. /lib/functions/network.sh + +network_find_wan iface4 +network_find_wan6 iface6 +run_command $([ -n "$iface4" ] && echo online || echo offline) 0.0.0.0/0.0.0.0 +run_command $([ -n "$iface6" ] && echo online || echo offline) ::/0 + +[ "$ACTION" = ifup ] || exit 0 + +. /lib/functions.sh +. /etc/init.d/chronyd + +config_load chrony + +config_foreach handle_allow allow | while read command; do + run_command "$command" +done + +# Add servers from DHCP only if the config has a dhcp_ntp_server section +[ -z "$(config_foreach echo dhcp_ntp_server)" ] && exit 0 + +. /usr/share/libubox/jshn.sh + +for iface in $iface4 $iface6; do + json_load "$(ifstatus $iface)" + json_select data + json_get_var dhcp_ntp_servers ntpserver + + for server in $dhcp_ntp_servers; do + run_command add $(NTP_SOURCE_HOSTNAME=$server config_foreach \ + handle_source dhcp_ntp_server server) + done +done diff --git a/net/chrony/files/chronyd.init b/net/chrony/files/chronyd.init new file mode 100644 index 0000000..f7aee0a --- /dev/null +++ b/net/chrony/files/chronyd.init @@ -0,0 +1,76 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2015 OpenWrt.org + +START=15 +USE_PROCD=1 +PROG=/usr/sbin/chronyd +CONFIGFILE=/var/etc/chrony.conf +INCLUDEFILE=/etc/chrony/chrony.conf + +handle_source() { + local cfg=$1 sourcetype=$2 hostname minpoll maxpoll iburst + + hostname=$NTP_SOURCE_HOSTNAME + [ -z "$hostname" ] && config_get hostname "$cfg" hostname + [ -z "$hostname" ] && return + config_get minpoll "$cfg" minpoll + config_get maxpoll "$cfg" maxpoll + config_get_bool iburst "$cfg" iburst 0 + echo $( + echo $sourcetype $hostname + [ -n "$minpoll" ] && echo minpoll $minpoll + [ -n "$maxpoll" ] && echo maxpoll $maxpoll + [ "$iburst" = "1" ] && echo iburst + ) +} + +handle_allow() { + local cfg=$1 iface wan_iface wan6_iface subnet subnets subnets6 + + network_find_wan wan_iface true + network_find_wan6 wan6_iface true + config_get iface "$cfg" interface + + if [ "$wan_iface" = "$iface" ]; then + echo allow 0/0 + elif [ "$wan6_iface" = "$iface" ]; then + echo allow ::/0 + else + network_get_subnets subnets $iface || \ + network_get_subnets subnets6 $iface || continue + for subnet in $subnets $subnets6; do + echo allow $subnet + done + fi +} + +handle_makestep() { + local cfg=$1 threshold limit + + config_get threshold "$cfg" threshold + config_get limit "$cfg" limit + [ -z "$threshold" -o -z "$limit" ] && return + echo makestep $threshold $limit +} + +start_service() { + . /lib/functions/network.sh + + procd_open_instance + procd_set_param command $PROG -n -f $CONFIGFILE + procd_set_param file $CONFIGFILE + procd_set_param file $INCLUDEFILE + procd_close_instance + + config_load chrony + mkdir -p $(dirname $CONFIGFILE) + + ( + echo include $INCLUDEFILE + config_foreach handle_source server server + config_foreach handle_source pool pool + config_foreach handle_source peer peer + config_foreach handle_allow allow + config_foreach handle_makestep makestep + ) > $CONFIGFILE +} diff --git a/net/chrony/patches/001-freebind_uclibc.patch b/net/chrony/patches/001-freebind_uclibc.patch new file mode 100644 index 0000000..e18d07e --- /dev/null +++ b/net/chrony/patches/001-freebind_uclibc.patch @@ -0,0 +1,13 @@ +diff --git a/sysincl.h b/sysincl.h +index 30e9b48..8fe16c0 100644 +--- a/sysincl.h ++++ b/sysincl.h +@@ -70,4 +70,8 @@ + #include + #endif + ++#if defined(LINUX) && !defined(IP_FREEBIND) ++#define IP_FREEBIND 15 ++#endif ++ + #endif /* GOT_SYSINCL_H */ diff --git a/net/cifs-utils/Makefile b/net/cifs-utils/Makefile new file mode 100644 index 0000000..ed2edd6 --- /dev/null +++ b/net/cifs-utils/Makefile @@ -0,0 +1,45 @@ +# +# Copyright (C) 2007-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:=cifs-utils +PKG_VERSION:=6.4 +PKG_RELEASE:=2 + +PKG_SOURCE_URL:=http://ftp.samba.org/pub/linux-cifs/cifs-utils +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_MD5SUM:=b7d75b67fd3987952896d27256c7293d + +PKG_MAINTAINER:=Florian Fainelli +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=COPYING + +include $(INCLUDE_DIR)/package.mk + +define Package/cifsmount + SECTION:=net + CATEGORY:=Network + DEPENDS:=+kmod-fs-cifs + TITLE:=CIFS mount utilities + URL:=http://wiki.samba.org/index.php/LinuxCIFS_utils +endef + +TARGET_CFLAGS += -Wno-error + +CONFIGURE_ARGS += \ + --exec-prefix=/usr \ + --prefix=/ \ + --with-libcap-ng=no \ + --with-libcap=no + +define Package/cifsmount/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/mount.cifs $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,cifsmount)) diff --git a/net/cifs-utils/patches/001-fix-musl-build.patch b/net/cifs-utils/patches/001-fix-musl-build.patch new file mode 100644 index 0000000..e34d4f1 --- /dev/null +++ b/net/cifs-utils/patches/001-fix-musl-build.patch @@ -0,0 +1,30 @@ +From 6603cef0f06c450196a1bca06bb143d8fcda5651 Mon Sep 17 00:00:00 2001 +From: Felix Janda +Date: Fri, 5 Dec 2014 23:19:29 +0100 +Subject: [PATCH 1/1] mtab.c: include for _PATH_MOUNTED +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Backported from: 6603cef0f06c450196a1bca06bb143d8fcda5651 + +Signed-off-by: Felix Janda +Signed-off-by: Jörg Krause +--- + mtab.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/mtab.c b/mtab.c +index 7b365b3..a662a3c 100644 +--- a/mtab.c ++++ b/mtab.c +@@ -38,6 +38,7 @@ + #include + #include + #include ++#include + #include "mount.h" + #include "config.h" + +-- +2.5.0 diff --git a/net/clamav/Makefile b/net/clamav/Makefile new file mode 100644 index 0000000..3f3edab --- /dev/null +++ b/net/clamav/Makefile @@ -0,0 +1,120 @@ +# +# Copyright (C) 2015 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:=clamav +PKG_VERSION:=0.98.7 +PKG_RELEASE:=1 + +PKG_LICENSE:=GPL-2.0 +PKG_MAINTAINER:=Marko Ratkaj + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://sourceforge.net/projects/clamav/files/clamav/$(PKG_VERSION)/ +PKG_MD5SUM:=157c601161da1c2d5a0e48ea1b49e067 + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/uclibc++.mk +include $(INCLUDE_DIR)/package.mk + +define Package/clamav/Default + SECTION:=net + DEPENDS:=+libpthread +uclibcxx +zlib +libcurl +libopenssl + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + TITLE:=ClamAV + URL:=http://www.clamav.net/ +endef + +define Package/clamav + $(call Package/clamav/Default) +endef + +define Package/freshclam + $(call Package/clamav/Default) + DEPENDS+= +clamav + TITLE+=database updater +endef + +define Package/clamav/description + ClamAV is an open source antivirus engine for detecting trojans, + viruses, malware & other malicious threats. +endef + +define Package/freshclam/description + Database updater for ClamAV +endef + +define Package/clamav/conffiles +endef + +CONFIGURE_VARS += \ + INCLUDES="" \ + CXXFLAGS="$$$$CXXFLAGS -fno-rtti" \ + LIBS="-lpthread" \ + +define Build/Configure + $(call Build/Configure/Default, \ + --sysconfdir=/etc/clamav/ \ + --prefix=/usr/ \ + --exec-prefix=/usr/ \ + --disable-xml \ + --disable-bzip2 \ + --enable-ltdl-install \ + --with-user nobody \ + --with-group nogroup \ + ) +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install +endef + +define Package/clamav/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/clamd $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/clamav-config $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/clambc $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/clamconf $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/clamdscan $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/clamscan $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sigtool $(1)/usr/sbin/ + + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/clamav.h $(1)/usr/include/ + + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib*/* $(1)/usr/lib/ + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/clamav.config $(1)/etc/config/clamav + + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) ./files/clamav.init $(1)/etc/init.d/clamav + + $(INSTALL_DIR) $(1)/usr/share/clamav + $(CP) ./files/bytecode.cvd $(1)/usr/share/clamav/ +endef + +define Package/freshclam/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/freshclam $(1)/usr/sbin/ + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/freshclam.config $(1)/etc/config/freshclam + + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) ./files/freshclam.init $(1)/etc/init.d/freshclam +endef + +$(eval $(call BuildPackage,clamav)) +$(eval $(call BuildPackage,freshclam)) diff --git a/net/clamav/files/bytecode.cvd b/net/clamav/files/bytecode.cvd new file mode 100644 index 0000000000000000000000000000000000000000..07ff8ab014f8f8288b7df3dd11bddd9b777c6fda GIT binary patch literal 68662 zcmd>E1ydbO({pwAPEZx0}C4o12d4BnTM5~gNL1!hl7oW z#h3%!47oT>SqwQ?xDD7?S-F{kMn)X0CM-s#T--b&lI)5`w(KVCtdiym94_+KF6_c; zZYm}QwoV2rszwS<=FaMN8mhA9Qqr~@jzCsc4SQx2I%W}ZQ4=Q%W)~F>S1tz!ab-m( zV`(*Y19y2YGgEVR31gs?x`;I$le{{UmWhn1l!3jQnh}tNMb?%{(w##F$jV~&lS4-G zr-<55B{vl(7Z-M8E)7>!I}Q_|61$-zn~4(8S=!mdU4~iGRMk{S1juG?YsO=1V#mY6 z&dSEg3FKhmAo+jVh{Ita{;xrvwf}M@;EZGBsfxGq5uq29k#4ha*<`vq(=?T&2%keQ zF;#T25;TEA9fqRApf)oN)v0@Zd%T4(){z)Z@_e{Eb6Sk4)f|WViuU)12+7soDq8`s z*4B?5;t#scS%B=GSyr$C0p+#e+vC#Kj#W*%hQd5LRsz!W^mSmx@;%$fU=?Fm_=H!cKE@@(l==f^Hh*K-%T*i=lgnYoI3>UYbL}k zOhVZ`LYwbK97X=41LJ{jz#5GQWcnKsE(5{a zZgg{;@ll^5i*5rLy%?Ev2g8IzrY{0346y8f(q)?Zm5Y*BMU$c|9oEYA81fd*a{I{OIfYt8qy}>la z_=~&z4&v37itMoM6+HgMe|XCVSxuW#6)rhNw>A-J1Jm zSJOB1H>m88avo5;T-jg3p2s8W2&v5Lo4Wo6Zklt%0^ReDg5M!g-eL0sOZGF_Qc6ttp>F5F zAYD7DeP!em)WD_MjKH}f^MErXrj&1p5`$*iP1aA`?MWX|H1;rWFwdRIb`Qwh5E?>q zVcd<(Ycxf6HydJ$5c}vszGWwhb_D~TykS1|W9193=;_Ac<)9{}4N^|5ev?1j6Ab&@ z=5|NVH|21QD}ul#u^VPN^MB3R@P~4dfiMKn>~qKogc-l7dJYJ-rT9ZxIuf-kl78^w z+Dt7n+jF++SNAv=!!2g?K*DVPiWtIXUvVF`_X}R(${CpA8@ekosrI+6@3}w}I~5VC z^PkW!+4F(2DeM`ou(w_=**6G)*>KiBgMuuJ8h~2Nn1=V_dm%(@UyPKJlEM|$K1auYswU@^N6B>DMWrLX#T%PxctH9F1jR5Z|2#;l4fa}^*)Dlk>|tu zFw8DI^?h*Fr;~>S)@;?&uZiJee$`@@hrmR_AIlSR=?7=qo$VDcldAz^&v}xeEv)7Wo>I^14C_P=~m6{K1i2# zx_TWg9?tHr&Q63-5Ifx9+Tq2hdULRhxa?2pMRcnl-0+Af&_N6du6GQ$9E2X8nOXvl zycOpF6z1K@qDKCUKTpGn#Fvs8$cKE-&v(1)CGY7dQC)VE>mUEZ;>GL;a6`{c3o4b&>PiH&KX0Oonv-qMm_XQ&~ z72dgWMvB{+M`{{zDPw zqKk*<0hQpm4Nf<%UQXV&_X9py#({jnHmDwt4$$*WD;FBNy*{%GJThKw9kLzr7B@~f zr2mFoUJ@d>>SDUErNf88mBR;BxPv?{6Aop9_gC6uq1!S!*5Ky#U-uY$6l-n4WwPRj zJUOftCC5b{*RcifHQ)JA5cW8E*R(&5^KHB+y(}2P7ATkp zF%D}yf(o?qm7&aznAzHJsF@aNL;FYI_eE~?TVo$iXe!mfYe385960aHU8d{i*FF$A z{NKwdh;O!jXt3GVFRz|2x6C-~d2!3FpX=8Z$VD?~>^VYB{c|YWuAXf_ycP;UcAkRN zXo!B>>Pd5lT$Q0NF$-=OiRiD(RcGg-*j+AuqBBB)nQM_xjx{iaUkv1$v~JnUunHkWYs&B~ToZNH{l zmFdG!m&z4tBIM&4#g77{E4_ov=M462m@hxPstK~U&d*$~l#r&rkDsx0m?31C`Il@& z<(y6Px^x|dO?lBfyLe=nNBz29M)QC{nF@$Y#9@SwIWzMaWc<=LBQ$ju(J#qzqe##N z`xOGh%Y7LNc0I}#re+E+@k09vlM9h|8L@FGXu`V02m*pxj;jU8f64NT9f>!4k9wR) zVz-`?Z|P+H`ltNUk2)v#<#_(tWWs|)XAT^6NQghdi!O*R5H|Y$eVvw^euO`w8Ru)f zcE7&&Lqlx8$TFZcD_H@h-(==napVMa8iZ@H3D{*$xL1AhaZAJRgn;)SG$kbAlA zbGp|3ET%BYv-^5x`Vb=gy#5lEkF^!;mAqp6NIP296KAiH(t{6rvzI2%aa1K!z*7h)cD91>|1i^W2i{C>8wAosT^w)m|P_bNBmBgr&{br zLayC&fGXS0ZMb4y4%KlutK5h(6CZ+79;^HiI43LwQ!8wd;8wxXPdF<|qN45Q-|U)Q zZQt+MYrYJX(?Ok`J@De%Te@@c5=liful)J!^xW|rt(|F>3{#CoY_ z*{*2NO!@CENi*x8S?*-EBX|AoLcHdl)bg!cF7AlTEDB7%$%gHL_L`SKnST@-kg(Y{ zP3L&!@Th|$$jjA_$1u;@7oJx_?BgGoA-sniMM)cs`zzGRZ;quO8UaJ=r^n-VWrufE zK5(ml3OuprI-z}jhZLVp3u5^CFSPHH{U9fW2E3+rC5T8OEMB!2YD)^IAH)diz#F_G zr4b$-$2`NY+3{rI1`uk?YFf_yhz2bLbrIrHC>{DO%uxOtuX=W0Ai~1(A;tJzbD%K1jUQdh@3i64xr=+>`s4j055i zr0-D6VinUS41Yr~6xO3!5mFASi~T;KhK)rO^1piD4_4TV)j3F3XM5U8vI94Rfxhj+ zye)A#-f}S2y-Hl2%Um(u2tE4F3z242s3U6Ib+>W!w>s`U=GJ{2qq7y+gRY4%ItQgK ziEa7!8rt;PR|0XmJ8jgxpSk)m<@Ga_i>16-YrKMdN0GdWNz5zyQF^@(-_K8t%>m|Y za?8$c8C(Pa9vC+(;wLr~vp?ke%(fclXUJ}$byPP5OgMe?JNh);jF|VNCF}Nf z+q&7OFFJ6_t+$cIW1o{h8!V??BQ_T9%`B-u2!9i>5$_TLMn^Z`K&hWdHrk79AXCx( zh<@csRSko&NrMR7c36jGo!9sL;fooGA+28cpn1NI@N`)55kZ)K%<`9Nk+W!x{Gsyz zsn>Rb{cBW@lf`~$GMHHDTb?&sM0>S8P#shbuh=!8M*W}=7a>Xvk4kVLdQ*moA##K^ zqSAwP+)rb}ZJM8WK6O}hjFX0%RQe*m-DM3;G-T@vdtb*ZD5VO)IDu@R*1RS2H&cs< z=x+G+w#O{!^X4dLXuEEq6Z$o$4cVS|g@}rHoRY}H#(p>6Y07LF{^8VK?Mm2cBX@eU zr8R8B=kr_M~K*F3kb@C!jEQx+a>v$)NV?+R;^ z?n!caXp9?U>+=(9ZF?J(@IC3rGep+&V$9>gbNXkPZq0#NQ5!KelYi|wS=k}eMiOo0 zqaD2^r;vMaCqimtC$g8MeFhX34FT5s#KEvv<6X_s{N1-~D6Y*7m&4$a_cto)t& z<8q;IT_o$2rY}gl*>&}8kO_N5uXQ(yLn*vtq4|0S$65Zst(Jr#Vlh$PEM>-yd)bNL zas`Em=6VKuNSN@($u)}gILq7bM!MvqO2X@_rCa@<_Uq_BuX!IU1>bIe*81+nklCVT zFQP{yKbdt7R@{olBSje?7V)H$Vs7#u`xtreE7=5tsT$Xpj3@r(+~N=3Wjl@zr+efa zylENw-2J}|+$eJDapJ|z^l;16ys$QDd00o$2~q3U#{N{iwYvnB2?%E-<#^AB=O4xp z0UO8|>vkq{b#(UzON8fg8>vn?k@)o%ZnpVvUXzC~Tw0J!>lRK`{EgGu>ZcCtH%~Y8 zT(v?3%cqKd^0s@ zh@0~hQL6h0o*W2&#!IfR*f4)Tz*)=^eDDpE>2-H`Ji==`*Csn;1~D%ay3Aet0x}ab zUF7i@5CyvYmG(RzzM5Wr|B^0f80(?W;>@ewxb?}=;J?AaaCWvBiYvp=78w}qN0|o?{F+|GK(6$9AHSy|Xa$?_e2R(d!-34S2g3 zn?*+?GKcP<%(Y2n!fk>fVfjOB1m(=V9-sp@dIE1*p2-20+hK9H?xX8RM;g0mjth{~ zk!-o!Zp+tvu$6LBw&~~9HROWoPIF?m-dO1#ci~O68T-h6WckBiBZzb?;C~cwT9fAyqIF_lD&*DDnyuE?b z?}d9=kto;SVWv_leA#kR>bI{6w)xWtt(R?E$tC2bt9N>AH&UPZ#(n5Mawz)#6dF{Y z;3a85*EPs9$lYd%e8*jWb+Xd#@yu9m9=$`Pyc)Rcc7B<}QEWYRjNA{^5l6K=fBF}Z|uUPN{>pT}TrQ95I zL`#UuRxoWgtG0(<PWw~)}3mB4L!vtN?Ib{O`N_znb({tO-H< z3+dB)UN?QPR1tsSj_9FHtTT%L7-HrtD_lFB*EqPq9Fn_Y>Ar2^Q9Z43HrP$u^bj;v zx6)Ft-)nKY-LB)R0tJ>3QtX~G*3%sltnD5>A8JH{`AV|U{4QjlcpB)+k+M1-F>^*P$&i6f=wI+&}m#z+6S_0BJuTIYQ&r!zM znmyavb$S<00v6NL*NncJ*}Foz+9g-N-EQ2xAPdmjZRu@nFzEH|Vrct3{ioUP?{1)P z>U{i020v1^AI$r7e15~z+yd_9{n)Z0U}0l_;|8d$(|m#pYbnjC$}%o9c_7)yR<5|4`i==++V@tzu(y3J=s{;p!!eW zu&cbNOr{HF>inJ2_40IagDv3I{%&8VmF2IzbHA~0j&56}<{L1kx{dW(6rJoTM4Z%Q zXKTBqr`x5~JCQzw@jSP%@$2dL?KOe^J@~!bmh2y0@Wzn@);Hgp1D3`($H4IrWSrWb zn-Fi-t`O+d^YE^^*ging?(~FN8dD!zIJtSiC{Jn<)b03Bf2VKO@o8>v4NU*#=IrFz z=H(2QUCzCvy^z(H?7bn!h`~T#UB7HNHu$aWXA9_V2$;dyJ0T+E_nXyHM45Q6~YV9NZAS1v%Wr=!!!>tA-Nu3iOx zmE_9|wMz9dL2qr{E%1%>(C+>7g%dCm+h7FwOo-K`n_B|QPFKV(Y`3ply&P~~W8c5I za$a4SHu!;a@#W?M-PU$vYT)MN1*Ta?w@Y`EQLk^|e!one*pBHk2|Th(TeY%%cr{{m z*JSmjv8C!KOt02wSk5N<$A^=L`}VBu18l~fiT#DP=q7pVvkPcjaPERFCl?yx?h|k$|zrzzj|=|7QTOjq5)}Yn-um?p9c0yMb|6RW4)WP=< zD`~0noekn+JKN6}3c~GFUnvVr0onO zLi+^q$2C5wDVQ-+{S3DZzeqxzRBPUgz38>oXF|?s48HBjh5TO=*(((M$cLMIX+PzA zEa>f7?0pTybGR97iFCeg5Mxj6_dScPYsY0$-igZv&zqwhGzu6%7Bm1OY*$Q}~fgxOY_r@o8A?x<7F~zq+Hh(d=456wQR1 zIsWMSx)w=QcUHUAx6d4$laUqdDd0Ny^kvAk~c84smYxV-h-IWUw0Rlod z1C*~PFp)i#t=@gDSiTk1;Ih|r>#<6uvlhG1$m?VudtQ%n0nWaMFCT61NQk~F!#S_A zMVdq;nQGr4Afor`2|Foes!|Lr36=J6=FckQQO+JU^KjndH?o%RzeqUvVLY=MphR== z4Dub_@J_==Wctv2Lx$KM$^5A6dKU0S)pp7ImT&__Za9Icg0;9o2o}w!k(-TJkQU8% zE+K8*{t!7Io@7zkM`F00teg=Y{-S_2vI^!0HO*Na%J>H-Asvly7tQFDaD8cgP^%4A ze%H6Q6KtFJX}oOb@vP5qjezVv*7BLvSqk$d$-b4DZ-F?-aSzXC>HOvnM!Mv5fsvdoSwBkC{7rI5r=6Lak?%dX> zD2a-pnpeNm>;oc_@9yD&cdL!R<(Fe^_}lJz-S=<3wlKcfj<|MaP1S^W9_!!wNvcmZ zT6MI_WSzY3k2M$HWGU5)4yUaDa2=hy{Ie4+8USx5{FpLD@YwZvdsqv`rurC%jQDjv z>HNs~@lJ@&MDLOp7}Vjv=QFoLh;n7v`Pd0V{<_JJ!ql_zkH}B4e$nM3zmJRWwfH-v z8|Fw99=U|o^#ife*#8HEU9Ufkt_*KG&QzxiNB=ZLUpPv!Se-;<-BQXb*k_Xob- zUzk=zll~CfdIT}Xyv!QkTzTD0DxR0vLbe^*j*vm6y(l6)IBzgD zZ+IsTWPc~5C0J#rxfZofJUezJvQ^dobK@rL>}*zEH|IS%vK_tU1ZYiOwq`E`uA>;3wEmn>`t38UX2 z;b(&HcZw^Ul)xR)i~}4CuUIM^-_EDoKm$*-0tY2bO``puxIqT7II8&B2HqN64>PC_FzigEfG(`YmEXbg2vLI6?9 z()t8NEQeHVEbP$XJ@#-_G>Y1P3WmJ_E#q9{bBKZCtmCRFXf*W3s6hrAgBED}hkpH{ zXl5g#iixxdsrg)Jk_jYqn2GQ-O5CGgm6g7k;+dr!YHCmpryRofHHTD72;+HzRMkYH z=JMg03}bV8X%m%3n3W`ZRRVLRS`5(;M#DfddjJefCv*hbJyuzx!TfGe2zMpH3_xb@ zL_4NgBCoo2xUW1ywKt9{N+q|MdRAi?G)$WsOh!dZO-g^8lHbc3wM#vUJ|0Fk)J`oW z&OX-Liy=Gr4+M)KvnMprB2fpDh*Jm*Ee_+8EQ1e}GQkXFEu^iSWfh7L)d+B>p$7g0ig9dM9J@*wTM0Eo zcsu=WJ3zc4p^^ZIlS&l-nmE1- zPh)^JMm92f^l>$h-xzjsp5{L07NAKCfbSIhAN6G`UzA9S&6y* ztW)!Ui_=TkCriVH3N(^vBSp1Is9I!d!=&ZnGDeFBCK3e%OJ}Ji}cYN>&F-x>*6HPMe=vk!e z_-AMxMC$0r#!Q7R6*mvSirXi5MW!S48lq9xRf8iOf`SVjP;(q3vMRWS$Eep+5s zXIomhxf3!>YIJlwY|%7Ogh*mihGBwQ=-)rG#&)*f{hn2AUd05{OzQOQ}aS4ILp7%YwkkFUy>$ zU{aRC0#{cgKP&})RBH0SbWBnO>{3Sy$K}G-B)DrUrk19t=8tBGprIvOFtRYxb%9FB zkcGwT$LGSi0D+PkL9sbP`x#1|u}maYL`%x6^VyXWMwAFb zuzk*huSIF%=<})bsKwCs6+;{{hS`~JN>MFv+01a`hFKU@bPYiXs3w{U*ma{R&p+nZ zED}|4Xq6SCgdB9?OO2HhB{dwhO@%~7MMMlrK_FCI3RZMg0NtcX#xO2I>KGp{>OC@W zyf&OZS*cJ{MMMc+a~~IrR5T8E%rBJ-gjrXf4=6JhVG%RQqRfq838PM=-NJ}`6G=31 zQ#>FeQ`FZU=3;b;LKufx2OzZO{7$e6LG*B(Jo9eW-BsDP~XfC zJ0rtRFf-_$ zaVFi1h-1%VPjm+vD&Z!HqD#y5=3}-FQ?IrPo|r|b9~*qQMsA1{jcTfCZb&VrDD7;!OkK597$0mO zGkiGfgGe5`%qW7PDVmvPEEa`$38pGmDVY>?9HtR1h>sqF1|!Y_mm)(=Dg-2guBtdd zMvtr#zapDBBI-vQ6$iphjH^{J7^J635-r~aNx>_Iru0@1v!MkNsH;*K=PF@}st(X= z$3%euG#H0PH>_2Ry?ly^AR*C!uTFBHd=(2RjbSAUT1koF5NS+wRU#A6cpdvl8GE#` z9GRoYUMV$elR_Eu2qSHrAK7HMlxl1*J5wK*QE91C5^d!!pRy`x@7GwelG^fKaF!*} zH_I3{DdYj9Z^lQ6RV6cYhf_?7jRO-5@lEh>xM{+gBf>QP1tNy$ONG;8kc}D_l+q%W zafOPI28^4apO+j&S*nQ+hz7;o0#qck#K{;$Xm84gxeGN0N+cvGXbKdwC@IERCson_ ztkHP@Y*MU5T2oM9(E&>`=jS$|xC}SzLu;zgU{$NT`DZL22VIn4lQv#`S!eJ>Y z3*2OHKy7_khSDAYZfum{lU{xop~sz6v|lxVOomIUmW-if+{8~6*D&s%J0m=4Eg!8> zWt>!?L4uh@7+PTh7TXN%@7*Cyv;iEreKNQ_k$$u?ZGBQUia1s#QH?_GLRL%zZEVF< zbq9Rx)Lm9uwm7&U)ws42sW5tm4*7~&>Mqn471Cr{acm3hV5OwQh|#!PvRwKJAu<^i zEG*S5EEA=ErNWvBLkfh{eh_Rgv&?AmxYt>97%e;#I(^AFW(_dq|z{Y87mUlFur!ULoJUhqAZ+wtXPR!3a?N^GieAH8~4CM zW0b6427pT^M_aH9q8(KMGY+FHl4LBL3@8I!Q_VQFnp+6X1XUar6;ZWfjs6-`MN)+@ zZKYyrC2lHBZTJW-p#((=I#obwSf5b7g^GQgzScLws5y7KW3sSW1iZL%mBdo`y0~3x zSvowb2t`_28J4|((c+Na4CNjRC6&-P4MU9)_7SczzooJ=V#fO6D~|TImyYqxkGG48 z(M?~K@GY~w*R!3QhewpQ=na%PUU%nL$*zyLTVe>o?-uikKB?K=Db6a6wzA)+pZ7Z*iK2Dxua(c_9iP`ID2{cSj|Zeujs!JOv{dh-olU7F(I>Yt77w+{U4da}N&9g?NK*&j6~_(l|G*a zDV3X#g0eT!ZP)U5x9N{<6K!|z9XjtH96BW%W$JdHZ!WM~>DhKmPnWK~aZO{|mmfJC zZP@}F*mubXj&FU3WZLh~k#Fx^RX)C-p%@q+ZjZP3m(TK{6CZpV37594ogVLY4_%=7 z->tr%uTg~Jis<~Gk6m?KFPE$1TV)@0Zh@sboK~LlnQwHoYD&OJHL(R}hU&rA%1{`2+o`2smOs3`oX4QEGi=#!x1jj>(ABuEp? zRS8p*<3=IbWSn&!n<1+kg&f@`bk`kd-)~WR(kD@9V3jx%{ltS)LXW7!91QZK^7_}-dBE0;5bk!=9$d>`Iq@v zo^MuTK7MFIN+OjcYGYhLw_2Q#H3f^|clsGnZ;;jp9jVkn7$#?Atv2Vpxk-XGech+Z zl6lE~*KVt=hGrqO>Re8o6s_e6K9csJD|&6Zk&f-QM@C@E|z0s zl9cH%n!2lN{S%has`Qw!g2E!SKSJfzE&;fpLcX}X81f49LF&E#=p>7hUs8y_hQF4k z@FMR!rN@UO4(iCwQiMS$g)7MwjRYY$GTCq~N z=eT`BGFlO9|8I@U>;dR#zr?I-G|QLVf39I!_!4;Dd++FjhqTVl$Rp z4A370r6ik=3O5t?L&P%Xy{~D}cZ65O67}1t{!gId=}5)t<$mUm(qqq0u~*Ja;-gKJ z{1{6RkPJ;q>8S&dFrN!3#hU?MpoPX1_lTofqvx}){xB@e zqdJE$klq6q>YJ(h8`ZKnasgz5SKzNq5_K`)cW4NMq-97*HAP`35d~SEd;P%-RTaJ1mlN|U!e?|e}VU%o($i~$g3$5yk*rC7&^}4B1jTM94{)t zjsc4Svtx|k$>NsL$H0yy!Hz=#3nEgLp*-#E4Q$h5FAZc}u2v$3drN!`uele5sh6=@ zlEBy`iGVO3yN5^g&={P6d!e~lmZ|Kd9;uq7{&BxZkrnBrBr8hOlKdowCKU`cNm3-Z z<3?0!tVcjR@nA=d6s?*F&_au!t#dmm zB!s;JkO!~@NRKe&PGgqSZz#*g{VGT_w{-jzUnr4V0AO);oFv*>qDNXcD@v85U5w01 zRVPKVqZb&P8YcNMNRKED%V|-L)W&Mzx1r&XN}~%*^~&-T>Pph&UAh++iuIJG1069!wAjTO^B?IC+3QVrf{CT? zo60ngE!YhtH8?p(`;+-wQ^X?KQTj^5@SzSY zU0y!AtZap$DAJUz$v$UxrKoVE?a3hRV?Bi|up&K?LK+B+OSHC(lP%N8{GBUYlvb{y zB-ukxQFU-$feN5+i#;hU)SaK_il%!sescTQ0Q=V6Q7;87w~UKa)$94ABt_HIR3S;{ zG%rqbc&UDC+DxJ5Jf|q@r&+5lJr?CEYgKa-X0u=3SZH8ptyZBbE2SwaE89^k1q9ZR zEpQMnA6IEsVq<|MCii;!mfN*OKU>N?L z!%0m*en6=t`$GtKUb$sjs=J+$WrbRYkO?LyBlK}0Wko`%B;5-8KhPX~dTv@h`zW5` zTC*B3v`|&eVUDK6l57f!hBScW=htto&YuXarJ@W9IV3-YU`Z|Ejpu0Zl)?)svF}OI z+ca%8V$C+DPqOIG8K4(dS!Oj%RDJWqJMQ^Fht^|tmsV7sw>BNuv;|l|P;8`0*@@`{ zy@zgicck>06=QU9RlQQ_M!Ze-^l>pIc3O-_PcKuOGO=oSgU0>DXgKvhzR=qY!t~}m zZ~ffDB!vpB(nI57(Wx|3(ReZ}uApo?Ees_l%Tm#`7_xidnN*gUu_*=?Fmkt0-K*X< zn+;hw2ytPay<%3XSZ$*GLewGL^Np|#}u;iYk3sf{rPpR;)BPm>ke0(!xvffm|a zo`S>;oCRbREz4t?1<%>Lh!@yEN-#P+D%V;djE`)yUU?)7t?<3huECEIVsAbeTWuAw z1(7qK(~%BAT~E+XP=a;wPYOA|Kj2v77-7-Qa6$gQ9^no#6M_Kh72Q{vi#p-XI8KH9 zj(8$*EIrm7?Gjz;ntUK&%@~-HHn>cEwmSd)aHqx%!zW&mrsWuDAY0^cfj1`L^M2au zQ+e|COLXx@qk70-`59Y9$+GsJQIP7h_MW8;RBK?@JKx>FIq2jeLkwy9? zxh@S#J1JCNZ)Wd%iZG4JkA4OhD@%_8?^;_d!lbn>k7h1ueXh@HB#(a6Xm~E=Co>N z>x8jvgoVIK#T{pZLW){nW1l4t1ip1S##MJ^D zww6AprIiLT_!lN?F2B#9#W&yG)4S4zt?!>$L&wQide6R76I*DX3-z@#nZ?;dzOk5H zQ4r){TCR{ASBe&C4prJp`Th+`BdMTgci~xn6>$9wlOZy8^R_oEjPBdS9?9VqJFqpV z>EeR;?s2_45Ps$x#Ps<>_MZH-ucw#)iQnb*JT)TN74m8JbOXN9F7e+<_Fgj6C%4D* zMzlJP1y&Guut98)K~|svTHDqwHKG$*(D9pQ>!Sf~kSKPLsH1r{0L%O8l8=uV* zfkk+M23bKncH~#-Ij&YC^R$IxEV+iISn>DOygWZH0b~pP`6;1zW|+FN;tG7x{IBSg z@=D>$9wMto^h7l1VU}biA)i&KhI0p~Tv_xJK%4`$0s zZrjtU#XK!g4IvMk9^0m_8D}e7K+RAQ;jvj2At5{s2gp>fjoUKqNV?Ktoe&(6t1a=2 zfOL-LS8gB}hKhiWARL~?eFtsHM@VBT}q<2K(s*yZ<){JFGZ#;8+*G2}s^T6FC~ zuw5AZ>%1}%x0wDKS|4F*I zMz1F$vt8`*l-$G3?KbeE>n$nE;DK)2MjpSDR0Y7S5fd{US8R}g++AQwfX#tlLa73t z-U-P#L_&`2Eo_7ldhyX3gwq?g#&|{MB}6(WI{Ns5M0kz1=A_kP{c@yWD*V`9g~l5V zNY6Dg*V$UktFz1)BEKV8BuWs{AkP(#<3?PfNszhBHAZ3pEW(gz3L|69@qNu~Sf2h` zBL+AZw=#o8T$J#LMiaI^A}SF(sm>j%6w4>#1>swfouD2g$G-3bkYW)P56@y^VlH6c z=~$6fO{aSX*W=TQ3!P=L^_HAv(PO7?b>f9@Nziir(@D{QzgsH#VMIc*AOj=!Adt}9 zvC+^j!ItPE0TOSq#aXh6CXW;i~0kr7KGq|FE{8z7|>BT}ME>HW=!-IMhd_TH-!W zpb}AQVYM#%6LD}Qusl&wD27?(_6vY4k<@gi8YBjb&PH#;_-s#}uBItE(NPSS7*j0a zq7rXxQljWmVQEN{Xj#u{$=Ey!iEIlEF+Xu#4RmnAU5vS-0{=fZzBVq)fM}5`B3se> z?$CBW{XOrua{O4BNS#vLiUcWzl|@19hjuXV*9Aa&fS%W)C0Pr9Wp@4J&W530p|@70 zTqV!q{yXz;y+Cs#?D04aSaiL}EDZYm#D1W!2~GlVsl32}_Ni4avmU)5A)41WQ9Dvl z&PZ|`WYg(5zGo}-Rs`|Z`Bl-CkESxGRAbDOG|=S_drv8LgE^mwEF6rX6<>gjPZgiJ zC|oW<&iS=dN!07q)H0?2gr+uwPdF|N!Pc9P zTDDt0V}aa2=Ck6i#zcJ)712Gp!|3DjZR%9t@8c~{=TMwvr90u$G`X` zcDOuCIrr*)r0es$hB^rQ6Ifn`u{dBS+?3@(Ox4Z5fzXmY|MKr}56Dx;Eid5dQt+vB zu~fMHeMg;4C)+h?I)4r=|Q<>Ku zbahVwqt8Ci0lYUBk$wM=DOWur#iKqgw5?|cmr0GJ+W1V&2`}~&#h_vy3jU*7#d9=3 z57tzJ{!VoklB8<9B8*50q%`5)AITbY_(Ww5Z`MFysMu%MS%*$E0e2k5OC@pb@=sY# zK5}w0<=H-ultN2SoJT_#&cN5zdf~j-kB*d$Z;aEx&vyab;|nyrXNnSlbF^6*4_n6X zS@V3hjNsrQ>ud!oq!Xi+TRpxfu_E2hIKHhh;oq>&MmyX-l8?t8m%mpu*|R2Yl)~I` zR)?PXJvOM4*==A#SvYRRs-q{`8P>~nb0UAZcHUdghv-t8VDVQ`*%9ypo@!6=imFvU zv>vguFyGeP4&*z2a=5v*wrys*E)B$^gQYyN8$`B+0!>AGUZgNC%W2&udAn#KD-NyS zvnCjxJb6H-zE^jnI`^f*u)y8(z5SO%kV0rkF5(g=%gGqI8Ps^K7=F*@-+@4}q@?k^ z9qB*TWlfJ44ORtozfMzg^A%uF+z$O8KXy*DN38f-oN8lbt$K=- zaL?Pa7P}^B539E-qyp@#gE?vu{K;nvf@|X|ld0GzJsIcakg|n@< z=^k81iB>mCQ`&5JOzCg-6~Z1!TCLWzG=R)`@zCT!j-xl;?5!36kM`_lME63VP<-!O z?_4nEil<%Ij`;E`&h)c5%+I95JOlwPUpcl8rG_3<92_ImNFZ)Ah@OLureE(!d@TPx_(=V;B z^{qgw(-@!On@$s8$v0CiNG8{3x!6b$?$b(f;G@%di@?q$SoZVuaQYL!Hzn@whPO!3 zpUg5N!t*l2RWI)g2VW1wnyM@3<DHR88ZUG}%u($brS7c*ZkpmMRg(Kl!OY0DpZ2u>2f95~9|eNl)5z$Q22IH^I< z-X9LAe$*IKFm*?|8jS{VlimUe3kQsc~T-W zfDb`0Ld8ULV11Dem{Y$o$DCGYHOWbq!K(rvN76EQnklRuaVYFGff6DA68++6foT*e z9x;$Wp}aVC{GZ4PGB$Akeq8sTg9#P3J8(87ET3G~YOG7tOwqkFgSFw!ySXJ{giPJOl5M8iM6>+z{PQ&Pszd1~1~ z8Co)}kfJ0*v=bqEhKTtD{BbnOk_JXkRWX;LoPT8ZX_tvBp=p`Rbb%6}XDNC-{U!B^ z)cwiw<%4$di7I~Gdhd-5VKi7abnGf^$O#W!HF;(Hiv7`Ivq&|a)d^8on?)YBjRw@Z zs1y??7T3~n_QcL(2TLb^@q%18DPXk8t>U!xYqOG#usi1Xk2x~WcWPG3^|$)U%%~gd zRKaon4n{+#=-}ViLnRZoHsh_TnT6qvL@4qFFA|m7)|2(;8{d;cTqEu-QHws37MxI-YgySp>EJHdk`L4y)Ich|uO zcMI+?z|4G{^PPL|k9k)2{FpV>wX3`8?RW2T(b17;Ru!we!F6v2MjuTzEk*0*vILyX zq|*r67yOuBccPQYRMa!LomuxLYlF^~eCE?MFV~D|maXv-zN6!*q^P=IU>0Hg!;e|< zQ5VInAg`jhih^`1fMl0<_MR=)M!lypHo8cHmoq2Jbj}xCtRJrc_Wva~+9|PAM$msU z#*1UFCSM-8Ovtw+Vqz{ca0W4?o#sLwrW(#;tS4eMSX8Bc;(X+n3 zGY`g+EZeO@G3Axc#-3R_|BVp?~OU9`lD_pgKC~j zTUqOBl9)cV;F`U_Pm}F56H6g@HN*9nz?p6r3tsd8O-#KW7EV>jhMy*vDiZLz8{-*!?{P*~V`hYg%2h%<&hGzIjgsyvPq`;i4TNH z8PX|wllOk`lES;lA(4x{qxJr(@H-VRx@dEcj}QMX8$g1L4<})&J7OT`{97Ny!Q5uZ z22rfh8WDwZN{S++{zGMLVV?+^gqnZDhh<{;DfrYd52$U*k025Z*SYAryaVF8y?kKY z?qrh(C7m^IIlvj0*C#E&30IsP$Z-?6L3=4;7)x});Qj&r(mfX;3YaxdO}Pzs-KM>} z<9#^HJDB>xM%4T1lQW+C86p#zCyz;8L2rLt+EhY;g{H|3Zbu#TK|1XDk+oe}FxQRz>e z6Tcrgk9-CwFBts{)X3*M+1LwtDoCsZHNTXTpn)?3bIN%mJF`0E9n$=&lE<3pW^Tkj zD&*s|Cp|& zzT-P^2ldumLQRFCtP5)2u=?aXTW&kEQf{8lSzN+JM8h`Rt*vZunEdeAwz6)v;~SVsg~RmOD~&`VePu zx=-H4|DzCX>B2eT@%z+%cu6-WTt524#~;yzKhVGa5z(bZIE2UD6=xRsEgOA`#~3}! z!{3jl^EK*&vItMf*twGH`Nj6CgDpXEY{#0nh_BJi&{_7}c>q7h3g^#wm)&4do*-np zU5Y-mNL21G(JrApzXxzx+(HS|z$L4SnbSHV3{f;GvY`ajzYr^67dM*SV--vAV{Y&% z3MhrWp-JN|se_p6OHiHyoEDlEa{?W^9_sQHe(O?yXSKrhW z`W$3yg-i_BD$G(z^Xy$F8-vINk?&}bJ<-T;Pl=?}@T6^|l5F4I!8n$8->hhfQ#{ay zzaB-Dhhs1CvAd{0X#P`o673a0@=Vh-765k@|7s(M&#xQf8i}9EFQ7tmRc*?fR03&O z@As|4VHbxW{;}jXrskiF%?p?uCH#A9Ss_YENff^wT5Ybf>65=O#K>tylFK@*jMtHE{_wl5_De?c-F1F! zbgI3>$3HVoj2^bTr8KKGp*V=7*YJ(jrZxS7e>&7s$UMeZSvWHe6NaM=@#vZ4{iBoL z<0X51jEP6SFHfjs$;ef;PAzo*1yYb*dd~+nZJ<#(jLKd$jQ)+kaMnC4oxAc4pXvPi z!uTMT(^5;0K$d5%cxv+RiKVd`z9I)Bk-oKvbeP(Av|qqbR?f(1+g$-^Kk>M7voHlk zJ&sR(McATWreb?c}tmtMbsoKUbdU7B@ zWr}&yoP98tgmO_SiG1+EEhv-xv++7sR2t4%ilX~6!9z5c7OhC(hLy!~3lx_fFa9)dc+^XENOk0S%u z-s0=$W>ct25qQ+_bzd2S#j%efYB_f0JKg(PiqQVv2hq^n%ykD5;r}C|N&d-7`v5CQ zwMg-S1#N<(Tu@M-8)g=yFfezpCPQdCb40kiRlXq3e!=Xa>r8S-e+XEwao6flH1D** zyZkdJ5D37tVDb-b=@%PbZ`O}-LxkXe^x8Y9hJ+O=iNA8Z? zMu*n56os-@csAeHt4O=0HjyuY_j&3NkjL%Ev(s}Z0Zlvw0-KTDc~LwcO`j!n`DlMl zaX9~B3Ncik$P3m3v*<*>%?P>MWwm}-g%-Ske@Z`iYxq8Jcr;t56;s^J?VqLN*ZvBs z`nhBxKEYK}cTdE5Q%iit!q2Hjlg#cU^4N)GMI56ob_KfTS=PNt6Mv_PNHkUtYT_k* zSuAkn@!hix&o1FfGmj|Q5!zk-OpD|ENP>Y`V!d;vV*oM9uO?wMb8EAhJ5Ql8%J0qf}=?-tqbZr%^a z&XfswUCOC;NDLS?BsN`5Uwv(o7mng-^oe4V#(Z=m$UJL<{z0?^A6w5qV6SK8WUEa& zLL1L!GCIV9BgBMVoOi@KjI(^W@tO-dfRo~lLL}^0qX`|Fb0tWiI|~u@i_-oQJRk|S zxalzmk7}_)qqd;Z^7|ov0^?Ij;mh@X zy))j(iSYP;wDy&Vp+Zimy%te1ntxaFNZ2j1L^gE*_xY|!NJ||1%lRMGBphk#KSc+G zUVa{6Iwn97m&LnYr5Eh~$}bgAasbxi(fXD+e- z<_!{#mLK=bm!+a_eQ`9PO~g9ol@LWFSV9)h&k2UY+P5q>q%nDQizrVkfxKSu*c9ov zlCWF%QlOwqur%Fflh|$ESb1MxE_XHc)0nh)o|NiW;9%UbV~HAs$@BM_>G1mM@s78X zQ@g(Q-cC}dPs7x>b3AN+X_M`snbP6FRVK3}h1a(v`+I>eurPbpuT;Lk;p#Bg@;rA| z6FW>OaP-)XUW;i+NH;QRa^KSNw>nNrz@C*`a4(wNa$hW%F&eC}-|igR%hf&m?Y(?R z*bngVF_~1_X}2;$cEG$6QXY57`;u+c2(>;uq=FH3ro&v<^IWx)U_@jR3SW4P;T54U zJi^~&Hs6_vw|UbC(1g{nIeXD?mqWt9!zi~{{T^FSaHjrrJ1X)tz0#pzg)lH<_-XfS zu<#3GBx+oL93g_c4CcNBUkREOxsR3gpJI0<7BWUg0A2<%DJbJXkkOJVA zOMvW&`!i9$%_Sq3EVBR_M^zdoQ7mbW?n|?MEQWCTR3=uDpk#MF)2B(y23wLZf2Hnf zmy7DcY{8Y|*wVMMd0@)w!ewP+9;xB0v6XZMv8YNV<72L2b*=AB<|gsnzknKu?lLt< zWbXN&naLR}fqbX(afCu*i6mXf7{j&AFOzX*Je+$TTAsN3T(R1Ytd#tGy$ieIvGCo= z6pRqn4oV^N6`I{wT3T{pnO@97JNoETmQGh$l03Y5dzWE(MSfnoufx%Dt*yK0Jalp| zyAzuJ{5qyz72*^~7f^`-d~^!j!Qx9gdF1^4@ap6gI!G9+hRAXRJ4mKu499e0-?M$W zzlJJPslpQ4B1i!uO#N{zp4hU3hS9wFUw$2G;7R@al1V$GVC_PhP4MaG*mD*E(v`R3 zq!hZU{o#}?|6fG>WjaFzfX(+r-e-{#9;IdJFV@wJ?pdX0jY&m^+}6jRYzuDrX^6b~ zh3QE(hhtRi+@jI2ZRd`Y@C|3mSK81tX3{@}O8%0~{O!)CSE_lMUF&XU?Wxo+ZaCa# zZLP*KpFZb1XY7=ZpEGo=jR_Z@&#J0ITX{)E4Gepxsa}`IVPZMzqtC>2gteKoj9LvDH zRy%lWevZ5@Iid4O&B@OrE{FAhv5pAT*7{$3I8Tff4j)CwJH7^dBfK56o#8-?E)egS zyeBi+!*4#TJiz!lyYO3fkY(9KI@3IR&8N$yAYW|x#}xcA?@n|_yvrZF1i}7U1>xtB z1K7I$%f<^;5lmZ8Nb_INM=z5te**~4me;y1SC9M6iHDBduZp|$XDZFN$`%BeMUZPK zMZoi|c|Q!?au@`;9EO2!d(=4+g94ubuv7CDFKMV+4+QKCljI9=g8mUBhk|>+cCQUE zK}aF2?L`W9-U2%c5`S$+imsM~J~#Ayq)K=%qX)@^{qCu%_WRW%P)T`#z}nex(I$G4 z`1rWE0j+PxTc@b*@LLamS;Jk}T1UO`ly))SAe>G9=Huk#ueZ^eV@AkZR{6f<{m}bn zTXgt6qbyqB6rXgkn(Mw@fi}T*uP3&}kRU#{uqiT|8@j&9&Au)PK-4f9h8XtV2ScB} z#zKC$ZZ|U3uCepwz54bj-uWqs=0?rihnTydy@jtJd^T#!hxfjN#Za8Su&4X{U_u1@ z*lb%sfasvow5qTQ*pm6AFkbJ8`uSzI?c_BcY4aC~le-C`5KC0nuxrNQDvsFpn6Z2Tpwr8 zZ6D{qdCBHc?7z?XxopV7H6xXM<+)3@W-@M@*olx(6GSFy!uh$$-7BxNv(wk`t(bY? zEFYS=n@Gm5G3&exiytTdnjDdM&UN4wu@tLh(Y21n&XPYeUZVVk<7;u*<^;tUXSKD6 zc2t~xFU)QODpqw}S?JL=_|bVcny_1_kG}W@?(&m{m zH3tPJarr~YJ9JZYkL)cKa&h8?{D14#aJcI}yo@JM0wkgHO&lwTVs1~*z3j@Nk*yir z6g2RzbNWV#6g#rflI^`G%@Z^x)T|62C-zqTnPnny41QMe?^>m3|D;yK55>4bgDb^* zAFk|=O62u~HLGFvev_^;Hb_k?5sknMZ&}uqT^l#gxyyTY+sK^d$=nGgv~{Kryj0^w zX)gmwEwt8#?aPBedSTVo$W#GZmA5m)Vuj*05lC8v{^Pu`Suvm)q5UtZpPH28lD0RS zC|K1e=||#M((=VDbV8@Fu5R*&JXzGMZwM&<+H%2B7dpbX>C*5wGd}534>}ti7wyIk zvESl1sohyDIhr;&<`yzs({NEDkmd8_7NhRTl<}wpIW|wxmlNZC*h&1&P9i>C?IG|# zFArB>a6@!rXnsHVa*}u27mHZ&mpwY9R&|-E0L(Al(v4W|@0~qa0HW`R{#;!nL$c;B zz-(rx6v32NyIlJX4LwuFY@Fehg+Yqya6cGK;e3%`4)Cg`vBp=q_GEB(+n~S4b4Sj# zb<$J{se6r{rrIW4mxE}*qx5DnALvJ!@!6gH$D7Inc*pFfd1s7NpFSyi2Tm1eciy{m z8fibF3G7tJwgWJ)EeSR^0`;G^cC|i=)_WM4$DOI)!7G(n2xO=h zf}w}wC{8%ODZ>AX^kC2h=q}L=f`Wp;=fGa4N9a|BP~Jjna9WvH$%j9~H+mzN-rIK< z27|p=op3u|PqFSEDHUH9W8J@(yq!{-66)p4NPqh1XBB@^;vT)@%Sg;Yq}s>~f~H3k zWbF)Gu5(3Ajk8E{CZ%;^r?_GI+}P$(=TU_tV(@ofWaWmjxi;)9)1djx9NXPB%c9>_ z9ITH&bHA&}?~bZJWgVkGv;_TV05n+fmokd*{!|y?xPCOtTg$oD_HhDP+YS&ev%ZkFQ-MK5y)!$0S9|a7gZTe#$Z*`R&*B%y*DqpQH44TNhRc zrTcyjau#G!kU~{Iaf`Q38WyxxmRhpZA@w+UV+Woe&h*2HAx&$g1OM1=PoBGFucDBVPDYP8kDUM6A8le&&XqpJ1|rUyp>UKA@d)}< zwYf2?;{mS*1+wXW3Q35S9digrp~?X#z2&v#wOS0^T@KfcM+{K$sGn5^)LdkAFu~gw z%u5xD^zSRWBvP_P&0mryG|_58T?D_V&BsleQD!sTobAwXYFb@x z5dZOO2f`D3kz#{GpU>{szU|HlqP29E@O4~ z`r!}!>|YeV|K9%27L>oZ)(804;{{Ule^p2ccF3!1hlrTnwkGw7Vcv$m#x&oHBCY!X zB|_ba5aTSrsJfx($9R(`o~;+L6%W+o5Rso}U zg;HDkBmj&0t@a7|ifI4_66EY3EVS4qj<-zz9o)KtLJ9*_4m+qoPaiWI%w-6IHy_(> zU9B8|I|EAtmZmZ4s5LZryOl)o?vrvNC6Ofe|K_UiRl&{Zk(i$)*ew}V^YI=E;iFGa z1El;}trjYD_D>}0Ei@Ag`-jFkUoPyaBo+k_g#lcrE@?Q#JZ0pc)mBV3@B5yA`4@Lk zO7s~pwcXkco3Gwo4Rw3JqIP;_ak?+W4&3=N5TE~z5hYsPv(E|Kqlb9A8T-3({G}o9 z{`&dlMES&6(L6hOyr`4h3zXL$_~8C=@izCS>E$u5TwhObgX$7{aRX-twz@@8xC`5G zdhNN4h24uYQ1;-$RNul!TQ5wsLDFYwJ6{$UXRsaA^0-(t+r!CDYUKV&m%<&^taUBHw7{YdUFxAv$OU@vG!dtK7VL1yxH*qHJ@0Pu%}KA zjRF;7u@jWL4UK*;k^K7R{EjH|iuv7VwRZe9!x$&_AOOknz8y_;Me?x0J7pgum(S3w z=|4PXsaF}DnP|>`uRWB`oM({F`%NZL?RRSHKCYVTr;RGQyBp$hO*$z4Y-Q21&&_sF zP@Tv|XNXS$a5dQgGDY&>8@?c=GjmrC^{Xi%i^J;^n7K?QROqI?J0ldX$LgMZo=yxN z^S>gBE1y|Y)1VFebuCUhPSAo;veO@cF^OH!#E`>*X0$<_(Z5#vFUf7^T6^cpfkz0x ziSV_-(lc6qqj;*Yww@ETXk3$-#d0)i-b34h)fW6!amEck>^=7Z!f-4?xrh?l_7!{W zq{tt1Qfp-1?onZ^vScii57@ySv}ijMrW|~-H>Q*o`rEyhpHaCRrR!8n6WoH}dg0;U z5m@Oq3x~{^{eYc28l4qR>qY$O;lgSmvFowIc7|yC8y{fdy zC0DmXn!seVVfPv}tiQ!n*mq!hS&xIyg9C^*9({EqxY|dyj(my~>3h*N!4|`ATqfT2 z37_zGzB=Q!pa_zd{1W+daR4E6-X1A3*#VE* zh(Z3h%8xv-8NES&Kbo`x3Z6zeFCKl1h{`}-(eI~%_{CUexJ(Jw(oaI1q2~MXO#Gks zD&;U-l~Mp6Ln->g#hJ6k1R8G@<(@x}*=As_;EPSN+C&*Og*Xbj5Izm{D#KyCX~j{E z0bdn1dBQN*a5O(t9tLy!eF&joWC`I{VL_ct`t$=Q+{Nez((xx1)UiIWxU}6dd8ZcM z9cn;e#Ggi5!T0w*pr2@hTA#6L`z>07KV;2XA+BB>udrKx4|(?sbJT@W)V}c$=}!pB z7fwgidn=YN7SgPNSeTK>f8eoQe7mRma}rUb{G*4ivjE=BZC2>Phf4G|eZDf?AU3{_ zO@85&Ss^*0l;4|bUJlt#WEO_;=^LZDo`xQk6aJ&Eh5>CU26k|Km&zcg>2_vMN z2xB`UTLze{=ojU>ekw)c#Z1=by+O-SSIGl!i2lz!{p4lZ9y*N=XAq}R%Y8WgxGawjUkkYeiV-wK4aB2mS1dZC zl4ZI2L%9cAl6;2G8V({O$rCZ*+f=U4xDPFi!FoUDUk~36C&{KB9Dh5QX2bEg ziXQEk49@V%MO*PWiOFi^fO%xhf_jE;CJjF)AMlx2i zqwF?I4cQJ4IhWu(0@Fz5s|J4|*6AQm%Z6XgoywYGV(VZ~&eka@Fa~n0CLI?+F$az< zZQdvZw|Aocg=QlfFiW4Q+1Lbfe4ix9qiFdo{mnm%fXf_F9ZV{93hYLmvxjqcm+UX( zjF@jvT67qc&5m=hy72y#LkZeqCX&Qqu1E@QC^7af?DS)p>c0v6k`qBe*r=;z^k>Im zYYDeoJFJ}f7jXIT*}Lz)%PiH8d$h3;B{TudKMuN#d2@4g+)kypoO#!K)1e_oI+(5y zyLV?Q+9=;Zzpg}F%z&eWK8OuQ4Q;07`Z(1kYfkG1<~0-Ne$-DozwB{b_`v9Z_}q4V zljZz7E^EZgBk&MaK=h;?KT}irJ9Hx(s2Z|mYu+t=MCJcyL%TsaHcOM3${+sbNW%d# zBtNJ~j7V#|C7g@esUccRXlktHeY7jGcGRZm?&@gg!-!39$TQ)2a6ikJ$cMQ}lP@ug z<;HS*cx&&~v%C!U0*Q@)CmipZsmSY}R4HF-Fl?acx2_Mhub*`-lTYl_-rHCy$D$E8 z+s4^KI$~oDo`F3do9%XM_o}HSE&KT-Mg4;70LYlFSDV>g1ZIMck_|yqc}xYb9u#PJ zbzY+$gA=00*E=h7n=#0GR#?9bVjM}bUXSgZw7NeG(9@>==^mxe7C1P)>il`@sqFAG zR=Uu6Cv`edXfR4qcUQ)+jh80lXx7s5Lg1vtwuGli_z=;?N9Wc6=bJBwA`)F50H%L> zdq1owR&|dUoyyLwqFSygSqg{)*r^9SI>r)jZ9n(T8sPC2Qg?79UUfvI3#R_%e3GHq zC3r6`rrN+5eS{iM;LDS#tY)8<>m9%RltpxRAzFNW|6uN(bbf|xMe!Y-YprM6dFk{W z%0&!9=HJdHn$MUcxM7~qooCa0l3m~ruDUMIiFyCQX0+Rh4GgOty}j-69ZeG&q{3Ga zZwdKf2H+m*KJ_p(94%SO%=UT5Wc;5S2FU7{0>Ag;r$oz*FXmrb7Vlj){$OWr;e*VL z9fbiroWGulIv*U;oaeqZ_#9o%X?Aa?SA1r%7l`>3K(sV4cj23&0(lbdT%_bvp3!JB zFA1P;1S)QW5+OP^M^w|q9&d^hS68x-Ez#r8j?(wt{x56_v%F4AgKMV=66QgsYPrr= zE`Ol;Xg|50A5A*0F}idPyN)hdf&Og-eFcvrQ2#R$KUyMSY3!`+$EAHT;k#eQDum{& z zmozS$YEbhR1{;xSb+M*wF7ytkQxC-YLK~yhMM{I$3*(U$`_lD4-*?in`2`>LRvR=s zAF33!VOqa-x`fL^rtVa)iHTN6gJ#Qbd9Kb*w{yGq%vII?6C+-kuUj1(*N~l;+n~#Y zjuTNPpBBKGpwop{JdDg3D2e$W^OAa+?;NfTM3WxIi(%M=V0#shW1phbpat(ui1_sI z@Bjq{O=QBpd-}{GO4QRKZu!?rO0K`U`8A38S5}*t>qS-jN>sJtMt?z_!Nu**QR_U! zHLpbBui5T0%b8&A@J;kY;>^74!o>ln(1n7P_~ zp&ra3t+QLm>0I67TpBdiZ4eMy7MRUJHYd>1%>g_9 zb`qdYW9U1xdh(vl>&_DvoU^=kxt$4Q*#hjW@M_2g*mE$+sM8qN`2JeYxjb=?SFW|v z{-$DYH{?q+0bHRAaALXHk|vHd(=`}7m4W;m*~-}(IiMt(paU0FtrOQVb+Lm~xXRWK z8;&>9kHQRNXfn0f*#vOF08afhDCmFAm>MEgC;7?d$2M4l(O!W1sMX!h&v(Z2(PcxY zl>U8x<%31S8_*+91E86dQGF6PHe}-s{{4*e>h;&OAVn$f(XTSZt||&wc_p!=5^>oJ z7<@0uJKGxUlkE9lFakzH@?X+O{dyK+j3mnmP0x-NwI-}>EaQUyWYs?Pjtg*5`!Z~C@2DDL-ej%sF$1WTk3Y<;97Hserf(3qqz z8~S9Rrxr9mBt+=Wp%Dr;iiJXkwqX&1|38j9`ef8cQ?;mmlQET_ml`5&1vV3Lu!Gb#;-dpf2MN7yJ(7rxrh?BP_HeN&S7i!6tP!A!cp;AWlVZdqw zIzV4T^*ap@)dR+Sqs+3h@a}aa1}TuI4~J?rENEgd+ImDOu6VU@5aEr{DKw6R8VeTyjXu2BmR`Jl za>Xk*6+X8sq-g2`P%X(gmkg3KLHaWm1wcM17?Ez5kb-=fi$$iAIb>EzqaPA*6KIe?t%9*TPIoYcH?=M*5bd8BD5Kx3rI7 zSI8w&#S%X_z_KU+mYXZ|wO_nIr!U&C`d8_E($0vaQ^u(6?8P?Jy|B6D5uoB>$_3If z0SSoYy*}G-EqSQ3>f;&I?!BcM+3Pl`sXW-za77HD+VbeHIC zcfXLf@1!SNs3hf7d74u$^`(d=>2cw4U!tvG&ijXlDFIVTfsQ%oUPwY}-unes2!V?i z6O-Djrzmn=gU`WATan6sLm=f206-1hQ*U0|lEj0#whRTmc0Xyt+;;#k8y?V+3xU_f zfP3hZbV9Wb#U|Be&|BpC^Z>{KPkS4VWsj8?|Bc+U&8;&@mx#xg>gtQFAoEVtu2+g) zd6A3VNMc9t+5aKH=GTWz+Z+C18G7qoIaykvS?*c>S^h<)`fopE)PEM!ksJ~J2+6r# zm=iWXW}#P6B?|M)k(2$oz~SXdhc?QjLI?KFQNqWfxMz?+WB4^uZ#4cGGv|F%5hL?+ zIonF##z1UPiYEC~c^8deeINNI=5r8lo)xX!E=w4BcLnDxe=@QPMVXwVtcE=)i0bpG zl-7~5AKzcqil^ZmUUY&t!>elK^!-6fhU&3q@Q>Fe&{lgKTkF} z%<&akAOR1$_?Y%IXXkr;rV~XsHOaSrz}iQ|ib19k(k4|V zODRrEvbAtS6zFPZo)w-I){f@q9fA^OED!|wEh~xdj16d#@cCk;vSgS?jPZBx2rtAQ zl@!p(kc`Fr3auRG0`Lg<|BI=L*1bH8?!~pf$R)>HzMweUT)LnT8wn7hJs@wha4vEf zsS7ncGe10d{m7J3vK_MG%KYeEkVWPu9jw!~v9PK>e1<-mu;!L}Gbo;d!LV!0F67~v zdc(TBA=-JxI+~wn?$qX`Btq-t#qi9<=Ns!4mEiuNBil;g!^97A=jhGIW5@pjK>V}? z!PySlAje(l-feV*)13f*x*Dky+C%RzA;7#P?{{s&x zXTls6p((GL{RhJ#Y1@zJt|X0}aZp_o5Hk23L(GEmG+#X>D{*wJ`w{$vRUC>y`x0{- zewy!e+}sc|m4T+~Bv7q~Pyw6Y+pP$$>3SgrCyl?Oo~zB@E-^7ppN>m`)DouQXbP&x zz`f}${E;-Xs+n=Jcfbv_)yu{x6ZhB~U(h;?6}PUFOr}LGB}{(V?Kc~)s%v6RNf!|N ztaIbbGqog87W3>h1aZ4j+;+HNs<25uCH5q0gW`$Awma=vJ1R{_?mH+=Kind|JwRIk zQm~^7R>;IOjH0C*-2H?zp&0>N|1=WhWY!y$5VaQtIoH0#Rt#DXa)zs1fh)p-Tm8TA z4W0G4u+MFu{EjjwMa!>5$t76xv^YbiU1((->H4pDDHTyflSK!v%n)>szfrZwppzyS zJ3}w>S+~K%6eQr&Cg-?Bl-pu#DmoP+S4n(gwb){n)>*DBpd8{Eia!9C&8dY!Dl?q! zKS|6KbU<5pR7!t81Z+_>eX3A2T@^T)Gm|#W!SYzq%Ea;j#bd_voC96+Aw6Rq8_sR zEzf!I#?swdPN2!W^S9?7uY7Y65ICT$wP8;v_IdRmQBTHIJc!=kgJWl6QfI-pL*7m( zujc+lrB3J}AsvygV)~cM*F$UlQ`7X>f|`5JZ_S(CUhA$Cld?yxJCbZqjFggmx2^0S znM^7L*JM0QDxEME<0%^to}ErEkTr~VRK;(>v#z<(kE=ok7J-d*eLoZmc5msX(u zb(}TLzQ+_8e%4FVJi`9g)}}pe-9h6$wh3Ck|U)W32 zRnI}939Q-K47Rap77z3Fd-?bZI{9*cy?yC)S^YN4Du45gy&Wf78f@sj>}_0lyLXC> zU%Oy>y>zTGjBH#lstz)8;pxS3P|5~p27gayxQM5MexAu%WaWiJfCz|A^-YW)o~8s@KP8DOD`loXh8eSR4f`JK?;)q`l=z3twn2O7UG z=5$RBL*c|L$Dm^OGxrbpo|6k22q*~z?nR#X`ob>buc!MOM=v}7@&Y$pSTQa$C@NBa zwRJSDnOI+(KU};%6c7wJQ7yZAsUVCrqMkr(W4uds_oP>%^uYu3{5^fM-HV*p49?4-uhpG2PukPPjy6k1kU|Wui}z z+GocYLu1*RAPfKcQ{OJjR*4Y*ofw7G7!1V`59eOG_{R8 z4(yet3YMhXeeu3j=vma6m=VSA%l&H_zx4AYNTiBG5$l@!ch#mqoQ&Od@JGEf%CG~vDUExeK=0MjK})jBe6*inWb_{jOy6fxb|*c z>mn7f<+Gm&k0AJI9!}05lWMX5?I{E%`nvtzKk>@5Td`vYg)Fe~f7rqU*dpAAAp7kj z`V_P5v+#SP7m#WO2>bnDDwAXfZVn-=%i}ZHo+pK}AgPG!BKgbSGwQmmZTS{xF^qomBHPk*l z%3pt9IXPNUjdX_#C)JmR3=i}hZzB^$-m!`&PmZ-c#)w&}H3IRG4-kn=bb$`f zs0I3fX#Lr#@>}VkQvN_uIlVaVfKjma1#makty?tT^qm)WLf>mPiJ?5jy{49>pt#L| z`+pJ0`g(MsxDD_cVY;Wf5OnxY{OxV~!rZq3F9Uk7HbLGbZ_73+0QrMg$KKTSgZDDk zMFR4z|J&TFN|GG=5fus*e1dfKtWo``zNo3L_CL6MK%E$2a$cKlCZGK_>Ef1IYYmHP`h0| zc!NoDUw!(Vl0Ki9mZn3kv0qyLH8H?=*Si2;ywz?YM@Ccq-s2n2mwWb>s1B7Nabm~`^6Wbk;|bLm43+&-6@ zi9B^^o&Fy_0dNV!pJ~1zJF#y|gX!Wi=#y{NFnW`2(*VygpEaeGR@>{p*{Azz)d;-J z%P#avBOHR&N$6{P}gPVhoXPvjFW91Ifo47!=jNNyZ7U#RvuosvRYCCWlQ zzTQSUm;tnbWsMHkO4uF}CZf2+pUSw({`i8aL?&TD1sQ2bWk2*!ho;?AbJnxEX^>O| zU%rzR6@NHgQI9c}hyjm-njwAn)pxo<7vT#t7Mr%`+y;)!I{D7yHkCPZ3sSsVI&O!W zzp(SB+4EkQga%p`6zyM9C_;=Scs$B{Jnw2QZ$YnM)u@i$e066Zg+84-QG`yH1OU-#v6uNR1;-iFNMPIo(2b+s?f1`Jh3 zYlLM!R8VFHncT5=_J1&?L7EyV&j=y1)w(IGI1IC#O}*u+_@OoP`YIPd1AD$QbbLWU z#=J|0yV21-Qf5@487sF8&i%pfVF?!72(??7}gE> z(#ilL&C*Qs;yi}D>J(N$|-j<(`yu+hE&gyC^1v&9q zchOmCF$xN5ZZ}z3`>!HARptb#&uoLGPIQcpS@V%1Z^*qa%zd-C`FXv>L4lsoQ?Wh3 z#Zh0-#hZHY*w7c`*#U`y?6@=mDDPRwkM{G${T3 zkuZlR;QxdB6R>C@%I*2zqG1wIa?z2ldCWT_DBk|(^Q3-)E0lW`(LJhwpHQRMfpMcN z9PYM%=ujSd`%=l``fn-1pcyj+YTLsn5L~nw zyi`AOumjxafARNs5C+se$o&=XEf_ZDUklY?;Fn!Ml^0+F+^}}~TDV3GejBP@k1seV zLBbaYE-k48kYdqw%IdWZXye;=og3#k(EqgVa_drZ{rvJxQF(!AC%SctbOR!*t34N? z58bO&7d0DR*px#-#C;{h=e5hoV232&e}N;+#weppLUAgYKV|&w3P~5;IQy9H-jYOG zXQ3GD>^fPLgW{_QqPmJ%C5~!HALU*WRYlPP%9|IdHN}yTln3L|Q0uyii5tuRGeV)i z`dj}ZExaiLOm$V6;`X6B4fNfT*D;!vRX7V#&xFiFIqM(i(=?LHs~E3X4pZj}ahAdU2ybim!q2GoJOcK=hio0R|pQGP>;$)Le{{_c(4<6Lr>*?)!Hw^_%jlI4bARN8RXl55!;49d)~`|}`g#dR?gbibY*1`b4Y&p^B;qV` zJuXHK6t@G;&h9{vsqX4(zjdlVa~3u|f>$<(LH`ed_*YEz-_vv_Q|;lvN?0e)3p&J= z@31W4gRKpwtcP1$U37l9l57gf9UUe#29?=z%Gc~un?vl|RoEuSBE)OJm|)D9uf{Ah zPr5&GS!hwXHERaRdp~K!d@@ueC`*>{>Q`y0ROP34o6r8Mj#?q7PJ38;vL0X2NL1Ap zZL)dKWDZ&=bB;%5&~%jz6Xdu3zj*VmzNwW6uqsc@U4YPkyq&Kj5VET^gv-y$dp{FD_%;TfkCC4pih%zQTZquxK(7wK zYw*+M$lA%+)8z{X6!bV0v}*mM1p7v8qEfm-$PzGy6MfRjTytv{h6BX_2AUp0*Ec1I zUrrA*JJ$B1_AZVSqxQPPUsv@yUIupFa!Z6SycVyY^5OH5VR&DHu91%&f~Wt7PK23% zvg!eqcHt1uU*!ttURoW3wr?W&n~ZLF?mm+vM|A*0oaP%U6d%WDFbZYYPEq8^VBU#} zFxk`FADu3LCag4P&mj|?%uhRR{$iaHIUc#1w60>lV#Jj?LL1lyl%gT!5~*4 zdl)D;7XWiKx}i$!2r2+7b)5rH$O|W!5)VOmUFgD z?+1iP+?l9g&a6haTjSRuKMjQKUwOaX@W1yfZ#UpO-krK+Kk;&=ZiY@+gw{~xIrUB= zPdfY$kBHXgQV8g8FAO4w_ak1U0!B5Gct@uWxo|E2G8=Q1ck6_&+%zD%iNuAJN3JTV z|D-1r+m#AqLIx-2M7Ar9!K58Apa%<}7LHGU9Z^MAg;OyZ9>D2E2OxyhN6pt$d}Zp8 zeAd$lB&OmdRM~7+@wS3hIa+#Qh7`H_3S8xEVQsNw)wjpat{r`$?G=4dAT`rl^%KpI zoaEt$@b>Z#m8uJB`vlGN%Bac9x_Ol(qfEQk`^vjj71)D_W#517>z-R2uj7u%-)wcG z4C(r}qkyU!{`HB#d~hB@MDvhInQjP_h2`y0KGR%OTFu4yE7B6a4RwT`>hztdy1W1W z^Em+a4-m=;L9+zfD26(PdcknUYDj7EU%CUJ_2* zw=H=sJS}d=N)jSv%9WQI63rY8<(Aaf{Gp{Uho&EX*FH~FHRRc|!>n$XihN(twE}Q& zXk?Ff?a(JC9&f!ne04Ohnq_aJ76%Hp(cV@Rx})Zcy53--%a{O&V!K5>Q(%SfoL6-P znDTzq>x61d_Kvm3qnRp=q;59wpzG&w9|l8#NF#ks&&JJTl{r*xq7XFJw6W3vJp;Ks zd=q~Ws0&KoyWQ%1l5xXfc)HrqwHblWKwP)Kk7`KCxm z&a=;#Wr^m9q<*&DyW#NFS;2EF;iaG7b6tlF(|9+=r&JJC(*@35@Z+*J z8^Xvi)!UxaP46u-IzdL>!wXzXKgv)QXGXEHQJZv&*BecFWAS_@W0;7n=`YCB@JO(2 zvnayH)@oXHh zR(uv6P@`)4Cv~(9hfKcRhfQ}>4Bs~hhbp}dkAn1delZdSX;LfeAN)}{o3JZCBHiTO zpR59Q2AWV`zOFt8-&}R)B=yVR|In;`6Q_&ciT1)HF4NFNG4(~q%&v{VyYzlkOLX}7 zgg5E3saD9T=2c+gG%599-OgFwl7T=aou7RHacKAE+jw#CZA8JlvTlE#mKG0^He0&iV@uNp5od z>Wz`niShTRx@jE_>si5zTjTfLIMltj8S!>Bd}YuMB5I%r=+Xn{akTQpo`sKg4w6KT z8oEtDE!C!Vp52=#(uBJ~M*1FvE&th1X-=Z%puo@`7B+Bd$ z-`c-*MpzJwJRNA0WV%xYdw`*F#boJyx>(cY%TQaSN#-bm+RZxtB#T!y0Og#M(Fc)EX=HOXP#dN^!y&?TO3lRgv_d6Ef zVG+o;eFD!2t?!?4iH2Teey8_s$P1Hh1ob`q?mZ4O`Q8`>V=f(MD&EHH$ItBJ(rv3W zQ{z${i|SJc={-+X6fBfgeIz^QT^>@=eMqk_S~L~$S;`-_YSV9D#&;)>Jk@5_1q z*`q#`%sBJ_x_$^gEQ7tu*2J~F1kK8S2JhZ^qk7H zkF9gkGy8n^;Qs@aKx)6T*r8w!zkoZT@xY@-pMbnmxb+q^^~Cc zNjO3Y{aT3DH{Dze&^EA z{3vdIVYx)P)Nbn~m-O`{&*O~W*CDVkLS+6*m z3hlENf7MIylW_LSTE4LFUl>6ofs;2wg6Q?E16hj<+bGARaW$JED zv)eReFP1ncUk)T~M*J&O9$l$bPqg%@`jE^crOWl~mmxk0$1i1yb$hL|faTm}pC0)I zH~FwnkK?_o_vOwl`^~jF+fQvjt^F+Rr?;Qce%AJLIIiQTfkN#6mIA`swX_MUWL>A< zPPf_j@3_C}j}s*?uiJO3?&RG?aNU#}==0yJX5BRX#G(5XA2q$mzi!EAK0o*8w)6+G zPh5QC^VMJfM6N9Qa3Kt449 zUIE)g%$K$vbcG@$0V+qkjF3;(5)~6MU)GM>nyx@`CJ4^} z4HR^JLCJC(cZ9-%@VXLpUa&cR(f`Wd@KV&&j9@PMjt=w>1ZUkjl z0Zdtry}m;ia#L;w1^s4z$#UAut*zX0TW$qqzqjAAoKYSl)g(;|a9d7DLBCE1Ct|)7 z%HxvSlcsLsO*xXXU$$$ObIRjn0IikN+j2$<_B-$_7nH}rt`se|{YMJ0c4f;%%$M5x zp|)~yTdtCVrc&gPZHJyXhVYGYkz#*U|{M=D}Sj;ntKrXvz-JPxcHDN`e(#57P$?<&!<;jeu&e#vGKT{@om4xY7VE-y1-++H?aEXYj(!U|9+)|w9E2o9|vtrv_es1`hQ zHmFp4^b}O%c#ubIJHr&zYjjWakk*swR+RSi@Qc3CN(?2`c;tSSEN5y@`L zLH=+7I3Br7{g-hA*UX(7C425U!2K*BE@<&!-V zd&br>L|GW38CeQYiSj9@kU}R5vum{UB}($%%Sw=10G5)3TIs|4XDs8o zm^=e4g{Jg|#&)M4g3FxddTkeX(|E4U&~YS`|<$g)FrSt@hfymwKF2=4+5%DP*m) zuvA8+kV6f^0FJed{oqia0gjb3IduuIAP}sP+UTEs8P~;9Jm$SN%ZaK6Iah#d!-~qK zJ_B4US90kyN5hKRu*M0i^i6H+Nen^C0FXnYwGzWKKn@h;*0Ac(Xzf^Q$10=^NNbsO zofeVJ{=A56+qzB$ur$mz{JDk~Q|2^T22$A#YP?loL#tpoRS*LRD*ky9*$iN9IAi$d zO=M{k)}PlhPGgL1yw!oG)KLzXD=-!-rAWy)VKqz_rqRp5r>Cw%wGj4Obg1iAEQDLx%2_qDm8rce z6D}&Gscq%Do=G3tWjyn;oH2yNmIb47;L{XO8#fB0RNtDGSYmd#Me2taKdXJ+2Ukxm zdo-&B`08EXe0_gzO*3s#U8r8YxccNU2EhH&w;ny{u57jC}#%yTnYqSQjp z6pHQ*d;QN_e5n+zAqqeLm#Ay_i~o8$bkKnVCw+QKl}d>uSAF)uUsb0t(8KfZ`x$#LO z8LnQh@S_=SB%TL#cp4J)jI9i=TGe&br_Xi!;8RgGT}o9~p?TT6zFVP;HkcLR>cxwj zYZ`lWvyxbLGYNWe3yb0ma!%m@7caiJ`r;BtL)0Zo%p^O#%gD^qzutRdC>> zPcMb>+(92z2v!ah&MI^(Wi_>}%vQ`xvDvmFI%sI?itN(aX7jR`kh(Io&m`TbrZy{` zA?FlbS@mqyv-#??4}nvi6beZEMesuG9oiP~bDd1|=WM>YFom%NZZyVPsOdy7}CUVJy=2s}~Kut?Ja0 z)i#%A)OF3ss=a;L+VCNS8n&ASjokQId4F$nJL8gBo0piIZB^Q+g%@XB5$Pqu!4JuO z`7*h`9)0A@`mtf-cj|oy!INhp{YY(-d)o(mu$5U*KTamxqWbKcuTIX4kJNfDywHL^ zIK!Nr3H?yZ)AmHY`rr}^wXqM1k2L2RO)_%$2p#JB@ooz*zIsVxwq3>sPI|N4FY!cY z6o*ef>63YJcjTanQLl5Cc>di?7X0bLFuQ5<>6p36gS6syuvi#t_0q7nPPf z=h754+7979l8-lEqxc#5z_wDMO`KYa&DH^g9>p1YGG=WJ4tbR&$ATiU`Rs#ho1o!C zXb3g7_fFDlc}ddHHXV#ynRD`MRkL`F;_4~VK_OgSo9*h#xvWk;kSrxu7Yc*v_ER1Vq`+%=Pp`eR zH#)+%d*S8D;T`=D%qHd*Lbyp_5Y}Z}V;T|hjFK&^Y^peXDOFS(hJcRr-Lw)H)murz+mF}>!&+f7K zR$3`LPmfOL)7KhcTX`wEr!^vlYV+BxZTUVo>~dP&Jl+_1UF@_S3lEVqFCNao{!rrR zMwTc~BX805R}Yi-&2YCT&vqrkWuKZlQtrtAIEXY<9EN!sU$T?4T};IqY7VEc-;jlVg0BGFOl7} zG-&2_>}q#)x)1nz1RPgC$-&}m?^oLI`>8cadU}N<>ZlJNC+X#t+r3JTUFETx%wd2g z>^UGd({>u}7f{E$oi4xqrgCu2f#Cg^+NOhkBa%~<+Qf1=C-Q2ELmL_KE28RM2zre3goLL504X3VlBn`Z-?IHg)%| zK3;*;rXUd&HK!LZCk09W?)g{u5=T=~mqJxFE$SLgg1-*&!z;w|1@UhXXD%x0Uy-9w z(W?zZKHf~N-e&aUpHEHaEk<6n`2J8QZhyV9KVcb0||8y^g_m4mR{y&r-fB${aKm7RP?^*Qs-xq!NbJ5lFiD+$4 zM59G=q7|wc#ZcRWP@@smFryk}kNe~$AC{Jq4@<2SPW!7-IlUQWnpJ=1@#u2;efr>| zQaA z<%ZUnH>&DI&wp=oZ%TP+v$4L1-adlcPJbJ2qks|Gd;Z~PR>Q!Nr2j(V_V$C31`-U$ z<_r;dd$szx_pPWb{tKplcGp;ZD>bUR=Id8~*Xvgr82$^k4k)`)<2VC|fHeOFC2s`G zMPRJ{3rd>XOzGa*{Il+@2Y;t~YZa*+kZ)!G2!U`tdFK;el<5ZUQk(O%u#48qynYf^ zyOeU7uD*tPDQkus-hH1%Y2FK0UTSHN@kakwfqLtO745P9vx-z9?T=N^KGYtq{dyH3 z`1}^@`bpOH%dDY4lhO*F-bu;nr`&!UD7ce;E^k5sXay_<^a4~c42%NS0#?g^FnROe z>3vf@Ug)$}O#6?QFN2QfKz4fa^y*8duln!4+q7TxpzM_p&Yw*_nA6{CoqoJ{PbK!1 z{=MjhSJ?Bl*xbK?y|e4RCvR7OUxoORjN8P!?(#m5>t1)fH`Cr~@B0Mm8tQ%M-V)r` zDY$u}c=wg#mlyjy?eAdIJ2`n(;CN$b=T5r%m0#K;ADcFAnN@!^hR^rXm%fF4F`nLl zc`e@kM_cl0gMJ-@KF6p1fvL`;GL|%+Ut#2G`7jX1t$ok!TWI-4rG4i+yuz`4lSVF< z4;f)p8abAH5DBBv$hpwlccG=aJRcO&nU7j&?5|oG`3#Q6{vf0>$RH|*=FM>2&|D#+ za^NHL?Ih7XY;qz<_~R&_PCoJ|;LPCTCIA=Cq(Df{q~RIhLMR%fVdVj0pkaTW3a-q= zl>j#uWa1wuA)f(mWLfgXDJU9zT=RjT3Mjh!NtE4Bq7Wyag@n=a!5Wp1H5qs$%tkRG zKUHdbK>Nu^oV;JUl4L&BGlu4iz)*m-`7d;(>NCKq2$tpH0&vg)S>jSy6Zbz4QZ-*8 z42nu$j#qu8fl9gpoZ92Pu|3|K6a&k0xL2epz@>Rqq;l40fQw@44^dYQHZPEyLbxht z1t_)`+VmNq*x}TXfY9|3MlmWN41GjRHc_$jDc==0MzzK-Nh6HN$9^n)q@7;>QTS*n z<_CmkKOGRQpALvD;s?Z>V!kI_Bn7`7DeZmEaDvH-#uH4YOh?L`Df5wHS^09plPT*7 zPo``w1)X9kdqTDe<)|s?Pfdb4b=YJ)F(bJ2edcn;E3HMO-SS}oOC7M51a(3()2 zv)r-OGI)C~Iy(Jm!sN+JwSAV7eZs=F|F$*?C&zNU#-5)EMyq*t5;N!aB9O$w#VO?K zB-Zu-aB~t{djcrIyg~_pi00?l|2U^qW{r&}2-ck^j9s2Ib}6%j+UXw{6|z2-N-;)-(CbB5DVFaNyVd_Y7_|1Du2Xq7Oo2gH<gTHaEQd-WJqC}XRh<6gAnjNcMC5+h->@#Vr+ zT8fPM%OBp-JJYFq6FfJ`+?jY;YpdoqD64tSC zOQs#7ErcyWrp7H!JGXRFA*X%yn_jMvrKQ+JodEijd#$xzV6{IX7mDR(%O}ogyDei( zDMFRw z?Py1mEz2ZaXKr`!%ffO+_A)a@fLIcXb+Wna?P%OyCLtDb+0n+%?S+1Dd&xyf$g&7% z3qWt^*kv!4y&a9)%Ov!LaR+~07}wlhIE?^@hDCR7AMI$|UMAtNa6Hh~o!blR!R;l; zZ3MV99O$&J2k}YkwoJlh;d%$@ws7c3#mRYLnE=X~NailjXbEE%46c(m>A*vF_~{cAl@Cu6e$4 z8J`KN=DBfwF+j)l#Q>ewNjR(=5A^fS`<2VV`*k0n%PQc!0$kS@19V$o3{cr7;kt6W zgI_kT*OI<+IFpaE=^nLC!B}2w?$rfI=W2k4v|uH(rw1Gj0SBdLem&)@ zJ!cB5GBSVYHSYO?fQxeThYO(NDL?U#sl#pg(+NN9Ia4?($HYIM%4hy8;Jo8sj{N;- zH#_1v^C-bBZ-G#Qj0S^>`b=<2PiVRdqPdyg8b)0O7ccglXB#de50}1BPc}Z%_qD3|av|ht7-& z?8jWK0P1sQleY7G#Ln{xDFr$L7adX#09K<~%E1|;OeqNf!)OVyT;Z7QIn(IIk`QYr zuR*+|Z%rpoQ+c=mx}BlRbOXIzK?~2ghZ|_&85%s%y0|@O8fW8>wDJrQVb7Vy$v7s2 zo@cZ2=m`9I>XHhmGeaF|;l2L#YaBrYS&c%iM35k$L#HGN zt;BPtQ3}^4RU;APW`Is-=rN(Egx(tTOav(f(B%w0H)Z&V!X-=Yqn-$IFhIA?@0Dm1 z*+$R`(K=X90A|mbL@i|NQ|hj2OQP zu^xyiR8s^w8la_DVtShN_NEpE{ot}If}9M{=mlNzSZ)f2g3)+XwJL&~4bVYRkV%iY z>D58Odek>6f?N#Hsn<6uE`BSqlOkP@HAzwgxf-BL@9tS~b>Vp}PYRAZ!K;E~g{}$; zbyLXxAqL7P(@g;=>_DGcU*1nJa4LPeRvJiDr2$ZFzCe}M#a0cROJ5e%EQcwer30Ix zt=7fB0 z?a(ay(xnBgPR%Wfogv!NWd#hUB}BQxkxN%8pgT)Kc*Z%H zZTVSBpQG0+%v(8c7C$l3|iN|cSI9P*- zTs}_u*}rhG1ey6fXdw~R{a6Z*8p1)2O}(JCV;D~uhK`~7vBDe}1_y_s(Kw!H%o%QU za1IX1ndy|D^VHV*v~Z93u@p_g%%+8awYcV!&~4> zErBNE9-vmTwk=@*q9t(E*|oJ#Bkpx}4bVC-h7Mceo@fm_EQLA-R9aubbP9A;u8skU z=^WUE5){)VP(|m!BP+#p4M21WJX!^G%bHEsz~j=b0SbmOkM>)DrP~9TN6qKZnz zBP*b+4HGIJ=UYsypx4t4jh28;k$qBgxIDrDwc5L?p7xPi@%F?8w63gR)YJU+`J#`! zp7gZTUE;h`Qz|aN?af04hrM^A?h;pf!Kim7pn~IGZm9PT(PM3g=%Kbl^iG`gV@vyj>EkHJ`EuDa`UjCNtRx29`1?IGJxF6 zt;2pK*?PHkz@6!T8$iwJzp9M;i3DTrXk|Q3Bu6QXpzXDB+z%u=_Px(|I*^>!=@Be@ zK^xn7q-q)4{^>qT!(z{+L{ z_p9Y|nRYQ*J3p4`?xed;pzizAZQ8{|=HA`Yy-8PQ(Drhek4cyFKIv-5ff>pI=B;tchh`A!@HKmb-(s zF5tEo9G3mYYU~AvBfQCJ&Rsy6zSd+vEytX@v{5`QxXgLppBGRka>_$fC#*r-EX@mO z{lK}Nf&F%BTor}L_v8bIL>X{F2}fC8;#qt-`%cYO!OoXYaiG<09LS09OgWI zp8@hX#}ynBfRb?p`cemnKNDQ1w*OjB`>*xbe|4m~LT$~#y@K<^v6b}o*ngd&J)t9^ zrv_cuWB+xAt_eLP^wOZm6&XUkLLR4+bvU5YHADL0UbmYL+P3B(S=W9sxUHbfJ8IeXk%6tN+P3{-5F3aCn%lm_YKP|5uP1c_ zIkPli+xCU7Y)wFHdvS|cHc+z+s`}PeH&0DmY>@q@=?&Gg?Q*i7p_hbS6FU0P*mgOQ7TZXE76GLbEMEd2Uat$9X@K2uT!GA)warXd0KloMVNY_M%0&Upe%0MR;cc zav|rrZB0Vh#jXkqGU?9TT!mcr+6G~lsj=5K2=8p$Mj_X|+$8K9uzBZ_@ZOw03%TtD z7h#vnRr+aF`1%HH6;hVg%1xLey5)QCeA?YU08&1g3J551V9%@<+fWcITd=8Ly=Exb z*9=4NZSdX!!9eP=cQ=~+@phPCCIQS$11t~=(=r8$tvwninx!>X2-ox7@G0op)=jXn zb~7U^-2xl)VSs%-P8}pg^L(NKg5XGXP-Nlr!Vkuqh@wheS&IaG^d4g(qeFxhvr-8i z`1B;D*j7qeO$tnHvSKV-F)OAv8;qsc(^L2GZe_5|R)ftpn3bVi`+Q$)u+{2kJiVX)~(Qrg$=ga(={nuxh-0$F?cv^;0M5I13ybhvDM5TUI+7AYTX7~ z?Q^uw6p}@YRvol>(W?`>Ey*tMhdA?p`AUH>j5uH)69fF_ERHl2e?6=hp7hapWYdMpmQQ6!^%T=*ryC9XbAWiy|{@rThgEZe{lkS|+ zGc5~o%9}WKPmI~TxBQq?`p&6?@dF3m>$0JVoWz=bNL$I340uF$ADS(l??OzxPSqG= z;KNJTs##TUe^&Q`|IOX*Jwl((jC)DLq)!pGxm(FKTR6ol^I-3@`;+0M54$6{?jkWP z&|(YZNbSK^+^3?tlu38NPuk(;=0`^#J+ZmOq$kp9sp{Hh){^e-J&N0b`v9IoxY}k> zV1vyRS{ZD$q0GzxGdUXzx7MmbClfB|06!gjI$UG)bPL|R>NPCK5b8c}>S^d|DOPN< zt!OD`r3bc=_jKCZ?ru*+?!GEt=e-zu?x38glr)jbmsW zFM1Eh-IhIkJt29?BY$PQ;lwe#*`X6B9@4k%lXT0~hdvpPzNqM=qtB`;?e}B4eX&59 z4W@f!x^%^8ej59$7q4O6Gq`oPRT{;Y=6V{I%YVkjI!K)Fh;vSfl~)b9GZ+SjbX>|R32FYkcYoFO)u|_Y z^O(?jK(do-^w$dCI7>fIcw-kU^Ofl^Y%7~f9MraO0w!fEqb(+-4;J&>Glfq@bSdkV zgZZsk3?XsgfT^h!)1qy+JKMfoziO!{yZi8dkb)ZWf)OFW%;-xr=MzW+KNhV3C5-q(pRGqV;E z>HS5t6?uAZk#(=-oke>1v=0>7j79jNwrHX8V}xlb<%30P*^K2BKI68dORQuRkG<%5 zMT?QLVF>A;k-bR+uN?W*$s~$_9ZlxIa3Hj;0$o59+JDX(b@B1zVgRSPJ-QT^h zS?Q)S9eS&m)2+bV7GirJWv?Sz8=}hVm1VfIXSy#q*YkGY_J5^$`&EIGuPIRSH3dq( zRG{Q*3zU2h{ef>^2^_ofNrnAT zkYzJSYi{*3e%0a``+4)#)k_aobLZsP!zjJ4=A5vu&I1xx@sIoEv9#46I^Rj<-Bi_` z&ORmHzZDww;cXD=sGq^2`oUw#LG9N%nDkBc!}~UF$LtBKAKH2yCH0F-+83APms48? z`$)-adI#G_;?s3wqB>hSwrAOjeC(lZlfo~40en`7}pnG^3fOU^9 zp13or-0T+c*Tzf({h*W|HT+L~{JwW@e05{|#`*jtA79x0Pp@=;Un^4-X9|ncC8o06 z*&!@Fg5^umIJANv6pmj1ztRNw_j7W6^#t;Fao~IUng_mzzncT!7oXE6$~(8z#~rPA z1?;;<^ZB;(LnAu1@vltbnfbvnnuXT=^7h5m^7X{_-r4Gl+jnf5%p+siy0Aw~n@Y}K z3u~#RmZh{i_CkGS?mFxh?(Fam%Y|RHw|n|}=kABEdG3DtyEu10eC>1h)4!>6_uph% zxL)Y<3^kR0cA9R6i@kPo>V`XaPE6f|=gv6l#yqcPnf|tO_&eD-2*2vqq4G;N5AWge zm*T@$#`l@N_#8rf_L%rT%w>5ySnEK^Yo5RE#MgDdy=7bKu3PH8{lZI#EO`rYEb$3r z@#^`gTPl8$-n!j}eQm|7@ZYF*&wcX}tDAf2@ww_-MvGrt_3;}0Up7I04%_Qv`tuX@ z`v>*a1@qV36@IRH@867lIi@ezjeRvC`+7^AeC4H1e&tg4C0y#tf&Xa_QXkYg{)(HG z-wslL`}>vt0O8l&uzYw_y)?ys`Mty|1t0#Wi~s!X_uv2i`yc-H@t?o_@%!(7d?o(# zw?FM z|Kl&u|KGp-{Fi_E=RfuM(Les-n?HQ>k3W3(gZb6^iY8SIdb=H4y6#oMpOXfObRh=z=#1Az?`nkrc0$g z1DIjZhYNtET<0t(9Qkkou(qu9Nr{ys_DVO9u**uz&|m3y0NYi2DB#E*iLd!JZ!KbT z*Gx388zc}NKNYQ2G;GYMbu8F`F@t>pbVN(;wPxro2P%dZ)GKRx9OW|N%6|cy-#Hev z0AIkk*FU63xyy`f;Mkq(6Io32~fT-R{wEu4Y5)c`K7g%FZUI_1NN_VgXV zN-k&tu5bz!2d*H|9`JL6fGYqBhYY}o$BoZGat~VucGxp76?_JWWNSvG;gQ{9H)e=H zWVZI$j(fI}BROQY9oY@J?b#Hv5W)?A#^L#q&K4Pr=_rJL#u!IijL!grtYFF9dgN9< z1FU3#p1H$LP0Jn5n8zbGF^}im>A;-roUR%&r#phj`a+y22UtlaZOp1Eg`N(z~w+%gmeK+|k4 zwTX-=Z4Xma_T1jBMHA1%1)v|&Fn%gFS0{9l0#=vb`KKWRx;1CCEt$i_YQ+=NPABh z#(+yyA6#AAqp62$7ZgPYKK*rEL2QM-xWv0XJiJB6wTp*`b{y_ctJ>?&v=mJT3NwZ9 z*)=xL3;5%NuOYPLOB|2PMtvIF?qT0X5?;M+GHJ27&{Rkt!XgoE?yUli;tby(@4+pQ z&w1m(QN6g(13r6c&kq-ePwkysx?T_t?cwqm#TlDFbmB&C?{`hnJ0TrZh>mJXH8tNf z|Hz9!HZ#$jXF;Hw{f*=1T| zD|!2}vii)2k>}2f7<~5GrCl%y;X<{%QGpM>dU3|6*92@uikX`bZjpXA=p`(lE@V$P z(yzU8NaO6;QAWR!vCUSqg4QuCmE`@3)6>Dj)0W|vbmgF~D^=6}Swn~@0XJvBEe6*{ zOc$lW7cb3NaPzc}o_&a;FVeZef!%cCS9B!fx)sxb4cy+(|?3*(*wvtRYKO8XZNRX@wAzeb^ z4oG(hV6nKwR*o5BDyB<0gk`i6i%VS3PVm*u@69zGCST6ZUVQa%i|RKo(xLY1TlDJ} zztbz%dYwp?x5+qvZRHM8hgIw?M`jA`^km!KB`2EOP#C&jf_k4led@Z!= zRojQrM;o#`3rN=^y+Maq-D}#xX;bOVY7NlRm!+Jb&f?d{yxn%HslU5ZAKv8PZKs}B z!okun+v@($z8i@U>1%x*EJ&!V@4{e>3kX^DrWuiIAcO~h?CAB)3hpId4l zrskU$*H}H6es@YpNE-3R^{i4#n@Mj6*OyJ@Q1)@~bq3zAU8O%i@E-mx4ZOtj+tB-~ z4ZT;%eL7su+@ui zUq|y>0e(R9``ur@`S!=(|HFU1`uuM%^uSHy`^_Kz*KhupZ~wPHeDjY#@kjmXyPtme z!@v8-AAb1$n;*Xa;dkGE`~9~+{P_L*6~HWoZiSN-Mk(}C2s2dFcj$lzpc)3$ho2c4 zCrisO1P;fNTajQpQ*Wi8u0ZH@fR`qr0}x>#i61BxJdGT;P}4FC{L;FQZOS2Q*7M1q*QH*Rg-xT|1#R0FU!#dGRwutJ+U7@JVQ zw{*u?Tc~NKI-XZr<7;RFD@xZLSHYI906xv5C}Rb zWCciuK2}M`;T%wfj&wDyvv6o0$O*x8cu3cCEU;&yF^pp;AmlNuD~*A`Od;p13V|NI z1oOq*o&hdE5BSFw5coxsw2UZVT#+jIT|a#4N%Y?&^}|?E8;eOw#w|ciNfYlDs#(3M!bYJFf8mKGm?BWGcd11aRh zmz_Fu5{~Shx-dI+CWT!2vQsx!;oMZDz%1ODtrrNvqg&BADDq5n-if~KRA|6Xe z$*u?fye2r+6sgz}7F*2i(6OaX_>NXsG^_X@LN)c*iF2SIi*umwk8|*DEqFHy4-3E2 zeG8|UOWtdJNL!pwb5lcwlUJ~*3W;B#vxefSunegk)n`hBn3E$?tMUdEyA3BaVyk{rP zhiytPa<+?5$4Q%-_p!(QVjAIOix=PAn{~x;+dJ==4 zQJO7v+oI%;wGkkkJ;%oE#g`m~J~U&T97(AhQ6GG1wkx-japmCWdu>fpBOI`) zgwjKMvlMDW<>BdE`)-`kow@gsH~2Za#^Bkj6>^ktuWBs}Kq0_mi zNWG$cj>9odM=?pnXAeuQ$Sj*5k+U7}&XT1Di&4d^zlLBVFSx zun(`z3Llv%`pZ0mN&5B=jQv4Nz&~66d z!(VL>K7GAG_>fMM`!3*p!|%|5{&ff7(?|f`YkU@@O^=|H3_Qf5}5b8-h2VY&HG)szvfNPtk9^OK8uKz&T<$KGki-uY#e7f?N zseY25^PD`m`w-WZ4NVSiwm|LJafkBkC9twmy*~*LipGATQ}1uigM$W-5PR2UVE4b77tbhj})deZ&iRGLPH4=v!=$q>%r8bdst z`>&f`994>XI)FVNX?6qLeEFUomZH;lcC&9Dxw!6T4!NGCQtXHkv!4lGE8`aAmF3Xd zH==IQd;5I2*x%LP$ivK|QJN;pytEb0|ZV9>jH9_6|K$ z?wnbUHDGtSAKO072unz_khiG5+dMbvciT79_lY_$DJvgt`#FVcj>7E z^Cse;!kw}C;wM3B)#=+4f3N-R+4|`NXQ1mfC?7_Aa1Yk!y<E$Iq`s`lPrts&x7*H1KRR$awqwxvdk0M~`qc-_ zA#wj^tJKfBEjmAHM&G|N4sY*LQ#T<`4hwAAkJmn{R&S-+c4aci(*TJAU)c@4n0L z-}yJ+{Eq+br{90``~UjgfBWh8-~9gFc3@%M_N%a3p?};V$N-JQ*`f&&3u!MNkwZ|>8SM0Ig@;35W7bNvM@f|KlUIN~u6Q4ISd)0HwjdPXP zO8we~yk6uTjQ)bkU$f2olMV`Q_HfC0!N|?hKnh0CNGV*~H{18pzO}*6?b}-Z)V@p0 zAKSOL@1cE1gRkwow(n@)L;Ei6du-p~+N0UeHwo8Oj^pgQ(vsHqon-nU@wHfAV!aka%VUuavhiL;gu!b584RRyEsxzC*i%=}-Dgq@934vuLqxrnRf~8sbP{2V+EF6>qadOba zI5vL{gZ{Bb`g<4^(RnhpR?V$db8FSqS~V+I>&9P8whCLquB}mvKBhOCRWa=R+8PU1 zHg_M^+oN3-aK)VQySsu_f2%l?-cKpD{lZEsNDi%&gY9UaeW)4R$Rpqa|O5M(=1` zjnaFeQM@#Y=SK0=DV~kMPV!8nyGeB-K;vVK0r(rS-5E8g_w*668dHwE;#$TMNrRN{7Wnh8iocu7OqC`oNF|UopTNKR66GhFZh@f*kh){3#oDh=gn3_wN37oU^1Oq+fyRT3{E|^WXQujDCr5kMNL`c}{ibQDsRH&Wq7#yf|t0eFAg|0YvDn`Y!$1 zIW4kJaE!rlo2wWNpUDN`t; zk0Gq1FZ4j2ZS(~SZ=muFO$I2S$u|0$Y|id&Ue33j$e@8j)aXY|x3y}zt%=apfheJ^P1F5C#=cfSwyws&aMq5Y zP7eJ{(?dOF8EV2CXiV%HEw6zCsL^k9+8m+insI{h4QVh@0|$hL9DDTb#I_Ct#1Jb-@*Z*)h`?%t@TK2JyCv$84(%L+kTiy6uue8xl>d>?UP-|RNtMg>j>K9IcwuJ)`x>jL8 z+xCAtIPJQwMdQ(0nSDDV@FkkR{0`QV)>`5^+tFG}T!-GHv)&bQ=%Q+Fv5BH_D?l=> z?B5074?F~LV9$It76hBfe;ktx8rg4dvFb!xTpR~4B9e_YIU&VXIA)y2fSg5ufTt>d zWCVx>Ec^q+fdomBB}gmcv)vPaFQCJzuDLH@x!E_LFdt?y1jOJ|fRqq>$uhA3M8q%% zVj~(9(MW{j#E}!Hg)j0FH7t**c87ADD{Bhs2pm~GD@7bTjtu(@vEPg5({D(P$cY^% zZX&pg<2nNhSQ@ zN>+M?1u=-ox|)`iEFIM~q#(ml`7BYAz)vnM%c5%u21vvP6RN%*W1!B- zq&iR4Vh$Lm?$=9Eb;@B0v7H6da9lMb@mXoo#d`&5I#>C&8I|>cnE1S;?0pQ<&5dc+ z&*PMoz4xbGaJ?&*`46ksD&jlwk$jXWw^nePe=Q_SS|N$T@zOZ7`Eg9U)(_D~L>~r4 z_dT)5Z5hXiuao?*m(-DcZxfV{2!q6#^cSj<6vcPKEBQBDG}***tXKa^f-C zMmr@&DqEnF0D>9=HiC9)EW_SP|1Kq+hv6)wo;=zUPM4_~8FFEJ*P>964H~|*nNoXB z!^lrwniKJGke@G(gmwsMoXM;?w0{$%N_X?Q&aYD zn|3WLMW0&kd5Ud|-AY>^5ylv}l?H8TWdCS9SH-oq;D)wfXIrqNEor?=F@XV>sFT(1 z9n;M%^gNdLnhma-$tRE4{oPmI$WA-0e81gQ%M_;_RGw~k%ar2sBstZy9(TTHaVu{x z3Kc(CxJB7r>f~Cs|Em+k`^N)c9S?lNc;M0ghKu8Y`P!&nre2PNsr02KGdpzSOW^W# zwH*VdbbB%n8(f<33dv{L^R4xf_C8xUn0~5}6b?ik>Bm>x)4sIvU?d%iE3lPtrRvr~ zy~?zo#Y^k6Auyyfqy#hea~oYs-XL+tC98GV4Dvi5X3MjUo3~TvMXb#Q%M_Pqh4ZwR zjB%|AOJmd><$0Ve6ZS)E@bd8KwELD%x4UjF-4dCj zymTz(pVqfa-MlP)ZN6ESy4AUB6u~Q*n zXrAiyC30&qJ}vv&qI@pPx>jW6VDbDd?KH)ux3l%Mr|aQ_7IB*Xl8v6Ho>1$jTCyRp zZ>OEFeW(2~u{6QXBy{iUR&;te@0MC4={7KUR*Y@O^t8U}F2&xOq;6Vh&d*xUmztIH z*b9rzR_gP0@;v3Gt?63oYunT{S#HzN>EZI(On&nG!d$+Z@>DC!RD0)&)3UE==3JI_ z<2^fC2l4w2cwDPa+IZm%U@(-5PVyoOe(egOoK|w2ZDiK0re_C@2ftueUprKZGRdVwSU7>*LmNy@3Fm5;PixQpHnHOoMp;s;d z&fc9*YX1CpXnh^(Wn1dk>Dse|j2DyUa*`*@izz)OhcT;U>7>xpkog7-(#sOeMx^!X zb2Hs2aqtmwhWD@_>|)32raf&u%}LeZ7kDH;+`g}!fNK0i9chDN4KnUfZ~~@7ai=eR zC;vYO^T7pIb>m>=^7>y;08ZK&M%AcIa$YP`b2~aro$NY5U@Hdn!6lyJuS3%C&OZ za6zW|Kq;V5+ZVEHWn4Tgl@`(uYJ!|o-m$vs$6N=vX&T!kiY1+Ml_2KK|2L9XqPyDwZi~mN>HK<+qT>ek&M18CNnu9R?dzf*5etEoq`XBR8+f1N$ zzux`n;o;%o@$194yZgJxyDwiJzC7IB-QC^orvRl9_H7&6jX~+~FBFIg82l-En>#~q z8~j!Dw&Z4*ZL|Zk4ZcFGvQ$ATk&2}vsW?_at{}Q8?IjBHSlQ!VZ{sQs}gF&8>2YOHO*@HY~{UrLS)=xnx5CzYk>hZ5U z{*~ZBjltWHfA&Pw8gr#GXSQ%9YM43&e5zl(C!${2={k*Ork+p`jA&5&hE(u!NQ)dS zxR~ImU}F(QP)!6-G=j^@i_s2(h-Pe@#&_wB@6rh>FV-;V-Mdy^x0B0{8W-yqN%5h776oREoBS=oZWjlMHc z3H~NZBjQs{5tND0Sdld;;iCgklY1jVLzD}JWUGXrFVR(ihl7jIUM)<2marqhp(7*B z1jwT+;r7}q=t;X}AULAtP*EZx2Tw0bm5GR=<562Q(-y&*ZrF-)io93|HdPbJ;6g0z z$fOBSKPF~GP$GhdngfsIf>d}nhcR`4>LIuaSY?d-Py{+WVwNBx1t9%)7DD2{un-Y< zAw^^$SdrVIT(4r*l6g$K-b2NpK`w*D$kDBov=RUQlL2u% z@*Q%j#LgE2!0#6WA9tBS#5_WNPE5Fy2=P+mCUQh?KY^J&Cwp-U?3kF?GtKWsjUemr zeTWH9LBV&$qF?SpJ2==KlKwgpI!G9#l@L2whV1lcg=PM9HEOvPmLW)-C!2N=BOy?! z%1+_hv&jFszsuou6gDjU zhFC&GA=4{X4PUeN5hB9W3D7NM2snlwRl^#yd~Fs5<*zADz2$6OBc2V@TPHW4dOKu*-Cq( zp?Dv}#~?hTlNmQgw&m(jwp@p)^R_3PcB*&lK=JaXZjz4u(k=bmjqY6c5gezPu8}Nm zmACHF#mO{Wl!LTcFz8I3F@+jWbT_T!IP-hl(ozQpzhKXfF-U~@0*=R`O2<}WFfNr? zoF%l$qes-K@8*&lciVQ8O{Ge#6r_`2%QeYuT&Z&{nr3EnNn~ZV!sap=%(*F;yIASN z*&W=D6|D0lDb7>s=xgDi3^J!2Plpm)zgS_S-nmQ-f8X-yKq6zj{+!}=5EuLPb?VBL zaAp2IY|Ot6ngR+mjx!0tcV{C$8P(+J4B;gUkI+7P>ltPYQ9ce*cv*YN8=IjXvu0nO zxl3TnMzb7VKeV@5cS0;af-@=Cmhzbc$uO{j~<7Uo;?+&-^l&0btCab%EH5cf%AX6 z|9N^k{s#9ycVCWM{6F{iKksIK=>1Qw8R66KfB06`pD*9O9sl^{BJa=LpZp!mmoMRt zzTnFj3Sa(kg$U@|x4XN$Z#P^8Wgh^$4w4JkLCuot$6cWMac5LNbaq+fc2fOhU#0Z? zlAdQ5NB9`o4{?>aN?Zw79V)s;`7@kx^xVX!bDc=%lz8Va$e>=@8%pN6ekK2@8Lj-BTn(z6H#sm4x}L5lnK;nwtB(RL5d4Z3fW8zb#}Kx3P4Np z0#8Jp-q*AW@=G0gEsv;=AR(e55FAlo<%BmP8YqmA>vo+H6f&6XI>V7c1{0B(cz|9s zyfk+G!*!D$MBSmHgptmG2$2F&g3wD{ZeDT`wcNaT zg9D##UQljcYHPV(ym%rsqy!K(DFH-7g=d7&QUnDebfl>CEmb`fD4Hgsk)B4d-I_lC zGGcA7kT|h$2l_oj;{Lo6xPZO1~%G zqt7``oHfq*9HC>&7yP;<%nvuX-1(>I znEdOxp(5Rll_K^i zsieJONL?!Cba1%>BCw^Xyg13eZD19PN)a5qLxN}F4BKU_O;DYX7B5)_(F5?Elh*b~ zELSpObMGyF-iP12-}BG^#`C}XuV3%J{qoCi;s1Siceio=_vPVd-~7}<# zmp^j;mu@@%`}%KpcVF-3r+-iL)4#93{c3pB|6?_;?IY5BK5t z_38fjc>MD8aC|&I9{D&u`}XTsdir|&cKq^mcYOTy>Fe?F>EZb0>EY?&>Hhf3@&4)Y z>EZZz|LyO8eEi=}cgHVJ562rA!$Ux0tl`-Qhz|%Mfc#~Oa8ErYkF-2O;E>Nt37g1`+hFe_m%5{|kg^I8?=lnn!nS%nmxep2)$0 zf}MFLS4I6sIX@{pdm@T@=&5|46sJSaWcjjt5f5iHgr3r~CnDvoBP9r=n)-4E+E}*Q zy>xy&6!p|Rdm>WWD^k`g>Zmt5HR>%}Q%+{prJefc6NmP(xumY`)EA#~byf%2*(W*j zAX=PMQN&rFF*Q8O(v()3YanSTVtlRfVW8$EwkeU<*NJvb2$& zbv1xHjbsw^ zsULnvMCkPlx1%b9-iXi>_0*_qKRM({KJ{rg#SABHb1?2QD!qYB%H!uiJuTeO!%MGR zXy5mEmU#${9W%RqN3+YLQ|64ais)h~@!k&di zgqb4;7WN_>SU5;z&){Is!1_ILWN&{57G_I-nlJI8ur1ZhF$szKyzl?%;1F4unItl^ za54cL3kQCkz&w2<@pgr;4om7ax2FPT;b5)O*6Ba6aAsj}9G{1I%Uq;#?t0^oR_tc# zO#J%#*{9NK8gp~VN>+9)qr|DhGIrIq?1Ui{-RwUF-+c&v{ha!|;d)B_J*{1b{Z-NC zs)<>+Ab|ntAEtgPlfwS~X@kDzs=@3vmyN3ja~M9mN^zj8fgtNPIP*RB zevra9G{1ltOl8~VpeUtrHbXh2*=7A4Bos5;`{F-4H>M0X8OKD38|>B~uwz*eQw;q2 z`g#eiR~4WcCyZWI&1)0aIgDf-S*Uz}0moi;pa>-_7mf*-C65-n(OI(&gD1)39IY`= zmq1m!F+R&n!DpVMd=>?0h(+*&7k_x4sjb@YOmuZ?UbizBNf7mX&Br;Bocin(3nl4i z1~HX&x|f-w()SX^S!TL=D}dO;!q@z8<#uM{F2>IPf4Tb&@L!JiUyhsS|3C3xe(d>w zOK3j-{J+M{=l}N)?>qm$Kg#jp>6iO(d^$cpJuL44p1vOMpMH6IIDR=k9mDa<(H|f0 zzun*8)BXMZFJG}z;L}$t;_K7H@t30HhfT7>-ZJ$NO);-iM<<%G2@q`1Ej; zle!;{k5Av89`3*W{f}Sn?*8|EIDS3Kk&k@*@^ts~_4s)I?djp^{^{}fc>l{+lvHy8 zro2yg$1hJ`pB|2n$8S#$M}Oq|{dW~v0+Iwo(R&J!fFOEr;U$1201`kF;3QxO0lnR2 z*yY8QOAR=pwk!ujSWpBwL`EC_17Wi;whec$n2h2aMDxhiJRH3;Ax7um z2ZOV@UfV>uo^S|NmdZ=zP<326JUfUAC>I5URD)DrsvN5xR+^9N7f~E5NR^{qHbtp= zsi>q$sDP?Q1ymVT!_N*uK2+pdv$C(6P!U&M&^o+S98E=8Di=2^TPrR~MN+jT`Kp9# z`Mgv;s!pmwDk(Q`!$ui)2^YuPJTH5*uGP)A-;a#HoMTTCAHDwU5_Csiv|vJ!`IDb;Gxb_v>l#w94Y z^8EbCh3&jimBqzs(qCDB)%vT^U#o7Z3puu7uo6 zJ&y>3Uiw#&Ts7!kmeunB&z^|9x<{}&EO-K7jt+qU^8eZxTAIa%i8?9-O)v0L93vuu z5b33!0?*(yQ`Shar1$rf$-~Q`qC_>|s3xK&5GAUsj!A>g0=&$k&OGs&g9W^h%secF zt3<9+ls_5>M3LecaE8cLrsDrV<`GfVO`7 z7(#P3nO}wJ3CTPiV)1lHMA=le^q&Ys37Je?sEO*LFLR&pfHt8uaT*h+C3rEn2z148 z8gf;wYUznU6d^QvM=bT`icz&>-Yn(};o#J85)z8qGH4jpR$CKvV4yK^Y7?gcyo^AB zt+kz|jc}}u7)m1?15{d}0eQqk00*K3;;K=UNHCbjW-u?B z;n}pxrd5U)_=0!H*8Ls1inVuzwfh6$fXHXvpGu~F9BIgwsRtZTFEbILvDWo~&>ImN zMxZj+pk=eDVUnY>hP3?biO^d^I%`PJ07I-H1FsH6=gpPJGC2<~h{c1)FZx3HD)MiAJNW4lEJ-nbUp{APn*~HJ5 zI9cNC;RQ_r`CN+MEW~e3{HBQCdL8-dHst|_&J&?m@jE|yO?h;a_`_0s7fhihkqhvG zz9=-9WjKu8h@h6CpE#VElP{SF#e)yQGTCSkr{)xcVSajwL`e3r_6Q(C4vj+$Na2kL zIbfJftu}wb3UHOv>Ka|^PzRkct&vTz88ZM32b(g(>d@~kQ)ij_052fRG=xQ8Ihpqr zi3LB4^%V(#(pNBgI3lnFqNJ~k^hN|0Fvh;}>iCF8n-Rp;A+dEx;04|!5;3(i+)J;E zk*L;(00$&F)p|BLhd}X-2w4y?DOOCe9;f)dXrxpjH5e6urv2UM*8+nRNPI(8cnaU=rtludW|S6Fh|vE9Q7KJXL^mMS8Ya!rq^hCjqrlH=rx*N1Kdli zdX1)6fdf)J)2qoji0L(=nd#Mn`YVBZX;iN!P#smTCQxGnwGm*nMXzyPua>E^OnrnG zbVaXmsn@j7Ycjp2qSu6e(rZGAn&+f?O`~2DhM8WI=~bH%lIb;>UK6~)nHnUSUL)Mg zpn6TF*9Zrsbf#C6bBLzb1mdz7*NFfMRRi_k9JkD9l1;*@T$8FXsoDfDV3Vp#=Ud3$ zn$@LePlO>gy7XBAL()aqa1iq9!bMqYb?Sf&%J70^_hl8iV>7F9Cz+KglpMUyCHctJ9Waz5Wj)>*p;84hUj+05VOvwdV| zm9|+IeXF#yO8X2i$X4l)S2vQbwl&H!xf)(j7kuz~x#-u6MZdO1zb=b@jb_xHuK@>N z6Cu>P=$983gc|LnJE_eCv>DMPlG+yi8eY(uM5$gKpxH7d%am()L0@KtWiy&ZGg@m# zQ<~A%7{+FFHQ>OihEn z3L|SXxV4wl)?Q9qctJFYe0%mnjL@oTy9N%B_N+f*d%h7*R%>jZJrT0inyl8`!V8ks zTDPmpYb;Z3nVJ?}kS$Z&E|k}`bLI7|Dz9rzd3}p|RNl}64ns=>*9D@4p)IS8>(ETf zQ?>z*q|HEQuc)29qIU3t)+FL?u@U!{m@TpI;02u}4&CzQv|GHKcJ^}Gm6y{F{V0Cw z0Eg5OA*=YQD;x3LVVK0Pm*O`jQEd`69lXF#vsO};(CU&oj3-Y0(&@shf}rt!KT0-UGqi+KOoLDJDhFBWiZ7K zs#udqj6x$0@PbqnJFF|#G9}BD2Y5j)iXE1U9Tti;ft#Tyc0fHTb^si@fe8JeiXBG9 z4rpeIwPwih?1|V};1mWGiJc>OL8~$`IXc~qGn}1o)dL)uPYwo&*gHFis|Qstdq?O- zDL6Pf-IKE@qLt_1=-Cr-G}&03p1g5X;d&D;S&kDmb1oTE$(S|cU>R$-I7H;e%})`z zHSxJ|c8sS5TxIcH9IbY!&VGs-8>YcT>&wIAf6gYkIww9eH>1L8hli;!Ss&k zGi{j{VUfr(>v)mNonKm?_$1KJp$E$#t+YboBF7*JJ|cz~q*$nXx3FBg)c$FxROv>T zK+z(a^t&^QTUuCx`-Gn&;+92$6VE!-MH1G|6CXQiC4HIzC1Q(bqd3{$UW8e|X=1N% zVG#C9n`@aP3t|=*ee8?mA|dt*;GJGHc;O_dsr*PJK`hB&h|C`w@fi&tE>**u)qHGj zz1TKyl@<}2K-`5hNhccAG-m9vtaGKVqQ8AJK`HoRL6=AAiP#pycHY4&;T-ombNo2cYRds z4A4E-;%^d~yH_Q*1nmBHTbaEvx~m+*TpeM{)4f{%V67<&H{b7PqE#$0n-DQlCCg-J8K1X0IzWwHw%K7{CB8CgX1@yUa& zJo=KEeXs9+(MQAzCq>)u!ZMKJ9JXhFJo zGlI0jF~|qoePE46mn%a$Ey%twV1Q(9-N3ES~{d`1HClywCNa+35kxN!-Xn~_22_*$AxskQ2< zIzq?is@pE$EXsAOcg{ndxAnOXwcv2e_yOQgeL6f-pO&Q zV1Ev+@^IFI*^Y9vXD+1C5vM2vr($fjbNj_$s`OGCt@Kg~?N`;#TB}c9DCRwO`edUG z^LK~2s^;HrWIbPHW{4Fl&+-!5I*srdWfabsjb<_TY_YW@F1i?mECyG(wnb9c5~K&mjEl-NWHrtbP4?aVKnJ$Oh--K2ubho2Qh;klUJHws+1B zgFtFUQ;`u?3=9iiBaIcKDw5D>`mo#z3Ops zGTZyov#(OeEg~{*nAWbf_Huty12z$a7B!-bc3vK4Nj?~57$LmDy<-2U0rx~%_^s_&Sg@ld72)s+~keBmW}uG zy~F=|$}CaLp=KWY}X7`}Qm6hhl4Xv3~CkX@w-o_#1YTYhaL@XK{P&X06)EcIbnf zi>>p(_TnkxyXKj#s^-=dc>9QQoNE*oFpiLt1(ndnR!CU3t*KqOos3LO+j8xgb1vim z9l8-VcLbaQgoLG8xV}Zn(n~)IKZwYL7dp~gExqGP0e0`WfKDdqWsu@-S-h4a31Su+ zPw~!CLV5eHn z(Mv$=KjO0U^~YRx9)6x4f9C1&Wn1}qhWzsk`P0sj&rR)jbdr3_;_;vKJo!uoKTnlE zcB*`XP5q;uEnj=t`FX;;dBVKkI{pisGheo&pQp{=|Fn6XZ{{cC%J1vHySuxuPmd4Z z?tc04{6F{i504KU{6Am6{_L9{%KzgDL*IQi|Ia`-^8bAO@^IYb|GE41?$=xReg2?C zJ5P^Ce+>8j`1L4HkH_%zu$wR^c_qN9eLxqKG^Y&#O$ew%K)#I}XQ0B1Lz$ANRG4rk z;v2bv_(rY~-^6zi-^6zj-^2^VH}Q=4CY=%A#OuU2HMwVpBQWRGmCK)c&O|KhF+bu;e3&N4+Gx>4Nc%_*ms=67_g?XoFFJxOkqs2@5I| zZDuc3SH29f)~6e+_2T;RcI0t;Of@&+nI457fWVJu6G1R*F1LL>#@6(d22 zL(5d5AW_8MnY-;wXEAaVjX!$6UWaK@}wTl6)avAd09JW*KJ+4vSKVAjYgv z6XiD|2&fzJ=VPIP@KkUMlW{0SB_GI8ttX>H$e@1Y9;iVMLNB6h3&B#NhSDw2FxF&j z3ordP%|b^bH^a>|3q+-F)@c^F&@6z)&M7ntsn9GmMzip*L$M+v1dc{~@ULS3c_Iim z4xSPCjR?Zvso=WWK0j$L+qrN4qQ&A;&wadC^j>2AAust zup;M7LcPBJHozz&*4K@2C8z&@7J;wArR>F9dHsQSE4u`~rTw1=;PN^La5?-0aQO+~ zvI5|;AG&TA)?A^CckJ-_Kyj}-K*vS_=3rx=KeyL6Ptv-0epQW(ih?p4e(mB; z5FcBi{UF1_e}2W)Yj!mg{M<-i&oEeg^ot88?Y8-fxxAm#=j#jnTFO=i;h7tMNi)N7 znG4g2i%W4De!UF%V%Jqj7i!ygx2WEDqXYNGJ))c4Bs!=I_v&5N>+8~oeV^K90S>ET zx>fJK+q~6%^rHUiJ#^yhr1%_bqt=@4@G;-@3!dte6}DHDG~Ke^WE|=F(3RH)5t!Z7CK(eTXR!nU!qqS#16^sz!3-O zF`*gOT(r3Cqb*&QxFm1)7KU@{cwctA&G+QJmq5PtAp}4A)a;+RF522g<=yBV;cv3N zqW?>>sVl(R7-`@jyzHG~$J=Vsy>p0RIYFFT=ax{Vp=zNGuUP0J5=`U0Y|C!`^`$=@ zNPN_V9}=RE>cv=?1Co%4Ib1lz&1OZ+8|ILLgZj@R>Lk}njt;F9UqY3R#K##1dW>0G zX~nRe$GynhtxNYCidU~ri-;nv3=(H?E#pM3<3i#XJg`)1i2>`a*{%4P#l=>#)d9)T z!EuVjo@c@)q~K6v{!q;;#l-I9C&R35Io3-C;pNX&2NQiQURjqNUb}c$nJjQJS%7y< z7cq#Ba~d z^^r!uZn-YL9{#iX|9$)N?eXF3kN5w3xPLkxxBUN}e){J9Q2)QWa}5*1e^B-kWe_i3 zND%$#379_O3FxrT6Y!*B5_eVMYa(sC3$1lfl{N;E&K0bYY zdbkfy-;Vyszy9G*$FD~|etG)(^!51o^z}X*AC8Yt-*)>5W*;yF^%ErT(Swrb7DUOT zCrSZiu7e2bQs@HNe{SYG2snbHZ70H(D0wtQ>F_V8K>;;ThyMUbkAi}*4B{oo5D$c7z$U*xM^DlZjc z)uZZsMPg2LK`O**2vy^&AXPSxz*~#dWa=VEQVpRJUu7|`K`-B})N@ZYzvij7bXb$o z4b3%hP#-Es1V>K)!A*aY(`OUg5nLc7um30z5C~#_lXsi{HXY73J;yG4x6NJ5X#RYo z^0Rd1*Sy{973#k=iB6uZ7qygh`^ob8x`^8!7fyC7Zg?vS^!D#uujDtp_0sa0I`>`i zOx) z9hl+yjR=9!aB*4`a}^`?o{HwrCFai+84Xjd-B?>UCimjiPMK8;RJEk0I(<_^t<}Df zF-Ghj-`o_TwglekaK-3h^Gk|JzOoW~jmG77cgE_5rOHVuJTZf)8@EZ}FN5i9U zqKe%DwI*kXgOa20$HIvsYtC-oBXJ&z?8D&l*MI9|)lE(z~irCg1V|fgC!ndZ^o~`a}akT`hxgu?OQ~4`|rD5D6hfpcy+P zP&D}yA)EZM2SPCUBgHq2&maMy2nj@pCcgxgKL*s3dt@^C+fn|;%E%!CZIK}d5|g1V z{)R--1G&f`ByXc{DWMJk3F-g`G(o>{KpRv*2XsNL#{qpHhc=)KaKI4Ap$}*R9N|4lC}N*&mDC4&N9~Pg&bI>Q3wZw>A46wgynPX_V5P6 zQ2bp5pnxbuNTO3&6dmhX#6B;^dM%AZ79=4;BaK5XfV>f*5p`%a>lbo}Qnlpa$O)cN zrejk~E6<(?z3HVhz4U_2C~M&$I*0Znt1BtjDdl?gJw5uu4_ zfLJ;3nfAEORXmO~B(8p6NcEJA(u5P`1BSIh10c}~4t<90p1tPd)eI3z- zHzK%%ezGu1YGF22A=v_(bOV!Y1Cwk6laLvM%H`9#TgEhmN{!J$ux3FP6j?g1iUNJOBVNyYec2TDXh)~O(+Kerlq$hmQ# z3}jQ4xM-^444zcw^C(KlX5w))AcCF!&)qW-BfXp z%)&jG^+u1Q1H}+Yyddgj7@H#^+4Wf-Np?97qHa8ThZja{Aia|)rF(AhiQxyrL-3q& z_-xMQI%aWk2%V6*UG5}E*1JW-LDa3e6OvxCh$wmVZj$C!NH}r~!f^;*f~2_Lg?7IW z?SL8%b;#o4WGw1Dsx5b@G3;UZJy)7qy5pJyJN69knDsAYSl#Rg>BUEqEWO&DpDVHR zOBMD=h5}P#zz!$iYki_p)~MMly|EYL1Qr&r^vIq)doSbjY#A33qG_rmOf zjKfw7m;KvA`*(MX*3DyThdLaypE!tlloi&#!kzr79K>QuUgaWA$Znrc^4jn#oWX~E zMO+_{m1t-cSE`B8OLCgkJVp_ zS!w^=`8^0?C)vhn5p=WV3Hi1Okze;!*GiC5%^*WaG6-uB>6QG7!~FjKmG_LwTl)8WnOg7N!$*2o zE71Y=x@WN5-oGo$Eg$xc%Uk!&V4TivlH_2^By)}VGrgWA|`?gcL8pGL|h6C2mJYkWTQYD$ae`+~Evc)4Bgm|f3z zGZQ(?V#jZMJri2;T5m06zr2;YWi=#Q4Y61avpXzyNZa+byw%tGqO_g!bT>6_C`pfK z;=CafbwMjZdWqs=TH6m#nTwk^nI7~cZFMVqz6&0t6BiYP^va&~bSJ(hG$ce3v6miZ z$4~e*?mS2Ga^k6Ia6nsD+?;t+=;9Kv#>aUzX2j6=i z5OT2Ntp(A{G*!;`6Q^%nQ;*FXJ&QUYb-cAaPKJKCcHptSPmzst59q+WR`B+&WIN~j zUUNJByWaOs$KBclR3eI|kyk!l7yI{ugU!!tr^(A%c)3L>>tKuPoj4~Fy1t?o40tt>X$9rjNVfB~ z(d{d1-d}lfS}{+hTMFCziaOM_ zg+oK0Qs+b{WD*MSSI9yYalQMUQH>h@;n$LMq+z;s*@qs8!#r>`Zi zx|r$-Dq^`J@dqFWa+|0 zgm-D@nWYOS9XxYi(0N54=~(0c^<9sr^sIht?NshFA*s$fS zJOawx@TxmM{h3sgh2tQ-9QF;Ia`ay=UH9$C8oX!6zLx9K%CP6n|8xXgJqfs^kelX@ z^SAeHsn*`>4?pg`er8ycjF1A8Hq+Uqm1}7#pL1$5H;P-0;OstscE)hU5WIZang6yC zY;?N+{#|_)$>{Fx?&0gVr{gcb1^?gE*Qdt~{GU}~z@PtpKm4De_kHj2oAdvD`{nCD z|9$asgADMik^z2sx_i1i^3yL%LcsfPf4C1vIff%2<>~A3@%Z)l<>~I};py?|{`mNZ z`|$Mj`1tg&{QCae=7ZgEKz&fEz}7H-=2U@cFI^yrlBbT6M#TtdImPd3P<8M6UxSxgi)drzP&riaRSuO8 zRqz%2YVei!Rq&NV6@1ludxT)=+c+ZtB&l4%56T$d5t7GmgY&&XL$EM`B|fi7f>L94boG0ggH%>H|@t z&Y1kDCmH1(X7a)*s~`;qokR#I;6X%7o;w%=AsNmR2mzD~s%FVR=obux!62S|VIU0J z)3RPL@)*?||1TVyhCiw~FN+LEk%&9Xht-N#IUJiKmeeCFDWRR5e2G= zkWB;%sF?_LXdO~O4sS%L!vq%uG+|~2ZK>11Z>-MN>g>YI4EkVZkR~%2f|>zM5K$*X zU6c#6KIOvvjtfAWABiJ7j_g=D8uLZ=M`d-?oFdBk$f7KcTypYM zs^`eTKx2aCoM2b{#ne+>x8%U*@<*-!w(KR4ylxx~AG-KsScxY-;`a~-F9}`s+l;H! zz7v)3dF)XBJbK}eumKk#4s#yh*PlGVKY4&xcz}0tz@EBFZ*5p6A+}Sr5=3T3ww+Sv ztpT+MO87LUUGdr8-ug_UTuP(Gp1aMjY#oSaD&Ba$A>~?fTqzDyahG^#53je(eL#b5 z$4@iPMkrh1+p1}!Q*6)RL-6be?|twkL{x*69NKtV&EW^N=7ewcnmu3geYmuJ*ZJJ@ zUIN?eqsBqtFpZ2QCo7-3l3X9EH-`Yu7mm*u=M%#&b34+zE~qp2Re3sL?5R{aJ0tR0 zrH749y7aoWU>cr>DzPMS;Fx4kUb*q)Ve;rK@eKyaxx1Moo$K}4@UkIq=U*D~C3mA! z``a@^f5-x_P4De45iZ!Cw&+?l#R+tOx6K(O_m5YF`nuH#%v^>(=6kx$TYbH? zozW;?OKC8u>(%U6)>Ppw3VwZ0)ys)%PsPg|+cU@96@G2aU(6fn>ddhO51QtWK_IoA zW|Y}vyPL*{k#uF-b9wGqKW))@1MiqOu5Q6TGG|=czqMDZzB*T2D!$AUJI2lLc6PYj zzA|1er5cTHZ->9HVH@Lc89cE)5=VO1y1DT`PI+%#miDcdm&U{EfMMbiZe@@`+(=t{ zNh#O&9m~~eY~)}Y)$0{lXxatw57+GUJ(6Y=Si1CK0W<#5=2PsNPr;{qj^DF^JGdQf z-D@9*eMQn<*~k~N@hKEnPfyD|&OF4klOPHxPtuCsY4z7=x(}z(U#oEthoA2M|Hs|k z-Q(lehhOf${P_5fFZXv3PaE+c_g{YY%@2+L=yU9-=I|esy^ntI-g{3T!TS;kBK`xB zAbeXS$o;=Pe0lix&wn3-Kc4R9!5?4doX_`5Ca!0M0P+FJZ^v(B zjm~gH9**EH#5uULI0rh5b8y#Lmt$dFMm3-kU->X|Pse-R)79(()l9B7r+^9*6Rd({D_Qj7nmQsZxNQe-rH!o@q#f!S3q+WmHGq2AQQBC z*Y+$Eh~U&;upXaUsWrikPn)SuPwHPy9kqvw2#VH2sMb%Xr3CCSB*C#@hBy< zh{|QxX|fhouflgAOQo#EC*svAUO$PKFaU5EKm?~Q(F3Zi#W}_>CM336p~;A=sL8-) z@S_Vkg%>&TJJrAuNBu;Tr@WQK-^nQzJOt0gp3_yQ)WW=0e**KG3*L*LGp{-0>p5Xy zQzwLf2oAQ$?tAd8am*5hcqhA>CdX~bnK%8UKFpg|y84tYZ4ZZ+HGSep0|(%xRs%7Oq|!8O$sAN!>=q!ir2Po@f99sWTtwZ!*b4#+18Jy9R`T^ z0chblV+-BljKOKZfX)vhF)SGvA|l5E6h3S+YfSe5-ds%Lh$A{zxmQ4?Wm}lri!iEd zAlZiE6bgz{;7PGc*;43<$nNZx6aF0iJS-qQ2E3Msih$&}U>mjU5bRTf24in)i{?&n zMV8idYzMWML1D9>bcxxrN#aJ&W<7`O&zih~8lF#Z;MFI4kT`ab`Zb1GRp#kfPM{sq zSVuV(j%Y)QVDWKV150~8bp%{K)eDnCN#L+Wo}?`t;6sWI1K1~V7y$2MZ> zyCv~)J0%t=`%&h@hVHDB-zhWi?!_#7WscWmR?&JXlhQP64i-c;!A6zi?iOY6_KWYQ zWAH0y;~SVjU3577JSqRL_Fqf?{!wVLfU$DaQ7|NJ%loJxLI|NZ}7*ptlw GZUq1nQNSty literal 0 HcmV?d00001 diff --git a/net/clamav/files/clamav.config b/net/clamav/files/clamav.config new file mode 100644 index 0000000..1543caa --- /dev/null +++ b/net/clamav/files/clamav.config @@ -0,0 +1,34 @@ +config clamav 'clamav' + option clamd_config_file '/etc/clamav/clamd.conf' + option LogFile '/tmp/clamd.log' + option LogFileMaxSize '1M' + option LogTime 'no' + option LogVerbose 'no' + option ExtendedDetectionInfo 'no' + option OfficialDatabaseOnly 'no' + option StreamMinPort '1024' + option StreamMaxPort '2048' + option MaxThreads '10' + option ReadTimeout '30' + option CommandReadTimeout '5' + option MaxDirectoryRecursion '15' + option FollowDirectorySymlinks 'no' + option FollowFileSymlinks 'no' + option SelfCheck '600' + option DetectPUA 'yes' + option ScanPE 'yes' + option DisableCertCheck 'no' + option ScanELF 'yes' + option DetectBrokenExecutables 'no' + option ScanOLE2 'yes' + option ScanPDF 'yes' + option ScanSWF 'yes' + option ScanMail 'yes' + option ScanPartialMessages 'no' + option ScanArchive 'yes' + option ArchiveBlockEncrypted 'yes' + option MaxFileSize '10M' + option TemporaryDirectory '/tmp' + option LocalSocket '/var/run/clamav/clamd.sock' + option User 'nobody' + option ExitOnOOM 'yes' diff --git a/net/clamav/files/clamav.init b/net/clamav/files/clamav.init new file mode 100644 index 0000000..b2a8950 --- /dev/null +++ b/net/clamav/files/clamav.init @@ -0,0 +1,116 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 OpenWrt.org + +START=90 +STOP=10 + +USE_PROCD=1 +PROG=/usr/sbin/clamd +CLAMD_CONFIGFILE="/tmp/clamav/clamd.conf" + +validate_clamav_section() { + uci_validate_section clamav clamav "${1}" \ + 'clamd_config_file:string' \ + 'LogFile:string' \ + 'LogFileMaxSize:string' \ + 'LogVerbose:string' \ + 'ExtendedDetectionInfo:string' \ + 'LogTime:string' \ + 'OfficialDatabaseOnly:string' \ + 'StreamMinPort:uinteger' \ + 'StreamMaxPort:uinteger' \ + 'MaxThreads:uinteger' \ + 'ReadTimeout:uinteger' \ + 'CommandReadTimeout:uinteger' \ + 'MaxDirectoryRecursion:uinteger' \ + 'FollowDirectorySymlinks:string' \ + 'FollowFileSymlinks:string' \ + 'SelfCheck:uinteger' \ + 'DetectPUA:string' \ + 'ScanPE:string' \ + 'DisableCertCheck:string' \ + 'ScanELF:string' \ + 'DetectBrokenExecutables:string' \ + 'ScanOLE2:string' \ + 'ScanPDF:string' \ + 'ScanSWF:string' \ + 'ScanMail:string' \ + 'ScanPartialMessages:string' \ + 'ScanArchive:string' \ + 'TemporaryDirectory:string' \ + 'ArchiveBlockEncrypted:string' \ + 'MaxFileSize:string' \ + 'LocalSocket:string' \ + 'User:string' \ + 'ExitOnOOM:string' +} + +start_service() { + local clamd_config_file LogFile LogTime StreamMinPort \ + StreamMaxPort MaxThreads ReadTimeout CommandReadTimeout MaxDirectoryRecursion \ + FollowFileSymlinks FollowDirectorySymlinks SelfCheck DetectPUA ScanPE DisableCertCheck \ + ScanELF DetectBrokenExecutables ScanOLE2 ScanPDF ScanSWF ScanMail ScanPartialMessages \ + ScanArchive TemporaryDirectory ArchiveBlockEncrypted MaxFileSize LocalSocket User + + validate_clamav_section clamav || { + echo "validation failed" + return 1 + } + + mkdir -p /usr/share/clamav + mkdir -p /etc/clamav/ + mkdir -p /var/run/clamav/ + chmod a+rw /var/run/clamav + + mkdir -p $(dirname $CLAMD_CONFIGFILE) + ln -sf $clamd_config_file $CLAMD_CONFIGFILE + + echo "LogFile " $LogFile > $CLAMD_CONFIGFILE + echo "LogFileMaxSize " $LogFileMaxSize >> $CLAMD_CONFIGFILE + echo "LogVerbose " $LogVerbose >> $CLAMD_CONFIGFILE + echo "ExtendedDetectionInfo " $ExtendedDetectionInfo >> $CLAMD_CONFIGFILE + echo "LogTime " $LogTime >> $CLAMD_CONFIGFILE + echo "OfficialDatabaseOnly " $OfficialDatabaseOnly >> $CLAMD_CONFIGFILE + echo "StreamMinPort " $StreamMinPort >> $CLAMD_CONFIGFILE + echo "StreamMaxPort " $StreamMaxPort >> $CLAMD_CONFIGFILE + echo "MaxThreads " $MaxThreads >> $CLAMD_CONFIGFILE + echo "ReadTimeout " $ReadTimeout >> $CLAMD_CONFIGFILE + echo "CommandReadTimeout " $CommandReadTimeout >> $CLAMD_CONFIGFILE + echo "MaxDirectoryRecursion " $MaxDirectoryRecursion >> $CLAMD_CONFIGFILE + echo "FollowDirectorySymlinks " $FollowDirectorySymlinks >> $CLAMD_CONFIGFILE + echo "FollowFileSymlinks " $FollowFileSymlinks >> $CLAMD_CONFIGFILE + echo "SelfCheck " $SelfCheck >> $CLAMD_CONFIGFILE + echo "DetectPUA " $DetectPUA >> $CLAMD_CONFIGFILE + echo "ScanPE " $ScanPE >> $CLAMD_CONFIGFILE + echo "DisableCertCheck " $DisableCertCheck >> $CLAMD_CONFIGFILE + echo "ScanELF " $ScanELF >> $CLAMD_CONFIGFILE + echo "DetectBrokenExecutables " $DetectBrokenExecutables >> $CLAMD_CONFIGFILE + echo "ScanOLE2 " $ScanOLE2 >> $CLAMD_CONFIGFILE + echo "ScanPDF " $ScanPDF >> $CLAMD_CONFIGFILE + echo "ScanSWF " $ScanSWF >> $CLAMD_CONFIGFILE + echo "ScanMail " $ScanMail >> $CLAMD_CONFIGFILE + echo "ScanPartialMessages " $ScanPartialMessages >> $CLAMD_CONFIGFILE + echo "ScanArchive " $ScanArchive >> $CLAMD_CONFIGFILE + echo "TemporaryDirectory " $TemporaryDirectory >> $CLAMD_CONFIGFILE + echo "ArchiveBlockEncrypted " $ArchiveBlockEncrypted >> $CLAMD_CONFIGFILE + echo "MaxFileSize " $MaxFileSize >> $CLAMD_CONFIGFILE + echo "LocalSocket " $LocalSocket >> $CLAMD_CONFIGFILE + echo "User " $User >> $CLAMD_CONFIGFILE + echo "ExitOnOOM " $ExitOnOOM >> $CLAMD_CONFIGFILE + + procd_open_instance + procd_set_param command $PROG -c $CLAMD_CONFIGFILE + procd_set_param file $CLAMD_CONFIGFILE + procd_close_instance +} + +stop_service() +{ + service_stop ${PROG} +} + +service_triggers() +{ + procd_add_reload_trigger "clamav" + procd_add_validation validate_clamav_section +} diff --git a/net/clamav/files/freshclam.config b/net/clamav/files/freshclam.config new file mode 100644 index 0000000..827e8dd --- /dev/null +++ b/net/clamav/files/freshclam.config @@ -0,0 +1,7 @@ +config freshclam 'freshclam' + option freshclam_config_file '/etc/clamav/freshclam.conf' + option UpdateLogFile '/tmp/freshclam.log' + option DatabaseMirror 'database.clamav.net' + option NotifyClamd '/etc/clamav/clamd.conf' + option DatabaseOwner 'root' + option CompressLocalDatabase 'yes' diff --git a/net/clamav/files/freshclam.init b/net/clamav/files/freshclam.init new file mode 100644 index 0000000..37b2767 --- /dev/null +++ b/net/clamav/files/freshclam.init @@ -0,0 +1,63 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 OpenWrt.org + +START=90 +STOP=10 + +USE_PROCD=1 +PROG=/usr/sbin/freshclam +FRESHCLAM_CONFIGFILE="/tmp/clamav/freshclam.conf" + +validate_freshclam_section() { + uci_validate_section freshclam freshclam "${1}" \ + 'freshclam_config_file:string' \ + 'UpdateLogFile:string' \ + 'DatabaseMirror:string' \ + 'NotifyClamd:string' \ + 'DatabaseOwner:string' \ + 'CompressLocalDatabase:string:' +} + +start_service() { + local freshclam_config_file UpdateLogFile DatabaseOwner NotifyClamd DatabaseMirror + + validate_freshclam_section freshclam || { + echo "validation failed" + return 1 + } + + [ -f /tmp/freshclam.pid ] && echo "already running" && return 0 + + mkdir -p /usr/share/clamav + mkdir -p /etc/clamav + touch /tmp/freshclam.log + touch /tmp/freshclam.pid + + mkdir -p $(dirname $FRESHCLAM_CONFIGFILE) + ln -sf $freshclam_config_file $FRESHCLAM_CONFIGFILE + + echo "UpdateLogFile " $UpdateLogFile > $FRESHCLAM_CONFIGFILE + echo "DatabaseMirror " $DatabaseMirror >> $FRESHCLAM_CONFIGFILE + echo "NotifyClamd " $NotifyClamd >> $FRESHCLAM_CONFIGFILE + echo "DatabaseOwner " $DatabaseOwner >> $FRESHCLAM_CONFIGFILE + echo "CompressLocalDatabase " $CompressLocalDatabase >> $FRESHCLAM_CONFIGFILE + + procd_open_instance + procd_set_param command $PROG -d --config-file=$FRESHCLAM_CONFIGFILE -p /tmp/freshclam.pid --no-warnings + procd_set_param file $FRESHCLAM_CONFIGFILE + procd_close_instance +} + +stop_service() +{ + [ ! -f /tmp/freshclam.pid ] && echo "not running" && return 0 + PID=`cat /tmp/freshclam.pid` + kill $PID + rm -f /tmp/freshclam.pid +} + +service_triggers() +{ + procd_add_reload_trigger "freshclam" + procd_add_validation validate_freshclam_section +} diff --git a/net/clamav/patches/001-compile.patch b/net/clamav/patches/001-compile.patch new file mode 100644 index 0000000..3992257 --- /dev/null +++ b/net/clamav/patches/001-compile.patch @@ -0,0 +1,10 @@ +--- a/clamdscan/proto.c ++++ b/clamdscan/proto.c +@@ -55,6 +55,7 @@ + #include "shared/misc.h" + #include "shared/clamdcom.h" + ++#include + #include "proto.h" + #include "client.h" + diff --git a/net/coova-chilli/Config.in b/net/coova-chilli/Config.in new file mode 100644 index 0000000..c0c671f --- /dev/null +++ b/net/coova-chilli/Config.in @@ -0,0 +1,52 @@ +# CoovaChilli advanced configuration + +menu "Configuration" + depends on PACKAGE_coova-chilli + +config COOVACHILLI_PROXY + bool "Enable support for chilli proxy. Required for AAA Proxy through http" + default n + +config COOVACHILLI_REDIR + bool "Enable support for redir server. Required for uamregex" + default n + +config COOVACHILLI_MINIPORTAL + bool "Enable support Coova miniportal" + default n + +config COOVACHILLI_USERAGENT + bool "Enable recording user-agent" + default n + +config COOVACHILLI_DNSLOG + bool "Enable support to log DNS name queries" + default n + +config COOVACHILLI_UAMDOMAINFILE + bool "Enable loading of mass uamdomains from file" + default n + +config COOVACHILLI_LARGELIMITS + bool "Enable larger limits for use with non-embedded systems" + default n + +choice + prompt "SSL library" + default COOVACHILLI_NOSSL + +config COOVACHILLI_NOSSL + bool "No SSL support" + +config COOVACHILLI_MATRIXSSL + bool "MatrixSSL" + +config COOVACHILLI_CYASSL + bool "CyaSSL" + +config COOVACHILLI_OPENSSL + bool "OpenSSL" + +endchoice + +endmenu diff --git a/net/coova-chilli/Makefile b/net/coova-chilli/Makefile new file mode 100644 index 0000000..b926a1d --- /dev/null +++ b/net/coova-chilli/Makefile @@ -0,0 +1,150 @@ +# +# Copyright (C) 2007-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:=coova-chilli +PKG_VERSION:=1.3.0+20141128 +PKG_MAINTAINER:=Imre Kaloz +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=COPYING +PKG_RELEASE:=4 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://github.com/coova/coova-chilli +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=b93de20a288c01c2ba28e96e31ad6da01627f45f +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=2adb27ec56172b18c5beee359dd7898d + +PKG_INSTALL:=1 + +PKG_CONFIG_DEPENDS := \ + COOVACHILLI_MINIPORTAL \ + COOVACHILLI_REDIR \ + COOVACHILLI_USERAGENT \ + COOVACHILLI_DNSLOG \ + COOVACHILLI_UAMDOMAINFILE \ + COOVACHILLI_LARGELIMITS \ + COOVACHILLI_NOSSL \ + COOVACHILLI_MATRIXSSL \ + COOVACHILLI_CYASSL \ + COOVACHILLI_OPENSSL + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/kernel.mk + +define Package/coova-chilli + SUBMENU:=Captive Portals + SECTION:=net + CATEGORY:=Network + DEPENDS:=+kmod-tun +librt +COOVACHILLI_MATRIXSSL:libmatrixssl +COOVACHILLI_CYASSL:libcyassl +COOVACHILLI_OPENSSL:libopenssl + TITLE:=Wireless LAN HotSpot controller (Coova Chilli Version) + URL:=http://www.coova.org/CoovaChilli + MENU:=1 +endef + +define Package/coova-chilli/description + CoovaChilli is an open source access controller for wireless LAN + access points and is based on ChilliSpot. It is used for authenticating + users of a wireless (or wired) LAN. It supports web based login (UAM) + which is today's standard for public HotSpots and it supports Wireless + Protected Access (WPA) which is the standard of the future. + Authentication, authorization and accounting (AAA) is handled by your + favorite radius server. +endef + +define Package/coova-chilli/config + source "$(SOURCE)/Config.in" +endef + +define KernelPackage/ipt-coova + URL:=http://www.coova.org/CoovaChilli + SUBMENU:=Netfilter Extensions + DEPENDS:=coova-chilli +kmod-ipt-core +libxtables + TITLE:=Coova netfilter module + FILES:=$(PKG_BUILD_DIR)/src/linux/xt_*.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoProbe,xt_coova) +endef + +define KernelPackage/ipt-coova/description + Netfilter kernel module for CoovaChilli + Includes: + - coova +endef + +DISABLE_NLS= + +TARGET_CFLAGS += $(FPIC) + +CONFIGURE_VARS += \ + ARCH="$(LINUX_KARCH)" \ + KERNEL_DIR="$(LINUX_DIR)" + +MAKE_FLAGS += \ + ARCH="$(LINUX_KARCH)" \ + KERNEL_DIR="$(LINUX_DIR)" + +MAKE_INSTALL_FLAGS += \ + ARCH="$(LINUX_KARCH)" \ + KERNEL_DIR="$(LINUX_DIR)" \ + INSTALL_MOD_PATH="$(PKG_INSTALL_DIR)" + +define Build/Prepare +$(call Build/Prepare/Default) + ( cd $(PKG_BUILD_DIR) ; \ + [ -f ./configure ] || { \ + ./bootstrap ; \ + } \ + ) +endef + +define Build/Configure + $(call Build/Configure/Default, \ + $(if $(CONFIG_COOVACHILLI_PROXY),--enable,--disable)-chilliproxy \ + $(if $(CONFIG_COOVACHILLI_REDIR),--enable,--disable)-chilliredir \ + $(if $(CONFIG_COOVACHILLI_DNSLOG),--enable,--disable)-dnslog \ + $(if $(CONFIG_COOVACHILLI_MINIPORTAL),--enable,--disable)-miniportal \ + $(if $(CONFIG_COOVACHILLI_USERAGENT),--enable,--disable)-useragent \ + $(if $(CONFIG_COOVACHILLI_LARGELIMITS),--enable,--disable)-largelimits \ + $(if $(CONFIG_COOVACHILLI_UAMDOMAINFILE),--enable,--disable)-uamdomainfile \ + $(if $(CONFIG_COOVACHILLI_MATRIXSSL),--with,--without)-matrixssl \ + $(if $(CONFIG_COOVACHILLI_CYASSL),--with,--without)-cyassl \ + $(if $(CONFIG_COOVACHILLI_OPENSSL),--with,--without)-openssl \ + $(if $(CONFIG_PACKAGE_kmod-ipt-coova),--with-nfcoova) \ + ) +endef + +define Package/coova-chilli/conffiles +/etc/config/chilli +endef + +define Package/coova-chilli/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/chilli.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/chilli + $(CP) $(PKG_INSTALL_DIR)/etc/chilli/* $(1)/etc/chilli/ + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_DATA) ./files/chilli.hotplug $(1)/etc/hotplug.d/iface/30-chilli + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/chilli* $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/ + $(if $(CONFIG_PACKAGE_kmod-ipt-coova), \ + $(INSTALL_DIR) $(1)/usr/lib/iptables; \ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib*.so $(1)/usr/lib/iptables/ \ + ) + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) files/chilli.init $(1)/etc/init.d/chilli + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) files/chilli.config $(1)/etc/config/chilli + $(INSTALL_DIR) $(1)/lib/firewall + $(CP) files/chilli.firewall $(1)/lib/firewall/chilli.sh +endef + +$(eval $(call BuildPackage,coova-chilli)) +$(eval $(call KernelPackage,ipt-coova)) diff --git a/net/coova-chilli/files/chilli.config b/net/coova-chilli/files/chilli.config new file mode 100644 index 0000000..4c037c6 --- /dev/null +++ b/net/coova-chilli/files/chilli.config @@ -0,0 +1,233 @@ +# +# Sample Coova-Chilli configuration file +# + +config chilli + # disable to running chilli. remove this option before running. + option disabled 1 + + # name of TUN device name. required. + option tundev 'tun0' + + # name of network interface + option network '' + + # Include this flag if process is to run in the foreground + #option fg + + # Include this flag to include debug information. + #option debug 9 + + # Re-read configuration file at this interval. Will also cause new domain + # name lookups to be performed. Value is given in seconds. + #option interval 3600 + + # File to store information about the process id of the program. + # The program must have write access to this file/directory. + #option pidfile /var/run/chilli.pid + + # Directory to use for nonvolatile storage. + # The program must have write access to this directory. + # this option is currently ignored + #option statedir ./ + + + # TUN parameters + + # IP network address of external packet data network + # Used to allocate dynamic IP addresses and set up routing. + # Normally you do not need to uncomment this option. + #option net 192.168.182.0/24 + + # Dynamic IP address pool + # Used to allocate dynamic IP addresses to clients. + # If not set it defaults to the net tag. + # Do not uncomment this option unless you are an experienced user! + #option dynip 192.168.182.0/24 + + # Static IP address pool + # Used to allocate static IP addresses to clients. + # Do not uncomment this option unless you are an experienced user! + #option statip 192.168.182.0/24 + + + # Primary DNS server. + # Will be suggested to the client. + # If omitted the system default will be used. + # Normally you do not need to uncomment this option. + #option dns1 172.16.0.5 + + # Secondary DNS server. + # Will be suggested to the client. + # If omitted the system default will be used. + # Normally you do not need to uncomment this option. + #option dns2 172.16.0.6 + + # Domain name + # Will be suggested to the client. + # Normally you do not need to uncomment this option. + #option domain key.chillispot.org + + # Script executed after network interface has been brought up. + # Executed with the following parameters: + # + # Normally you do not need to uncomment this option. + #option ipup /etc/chilli.ipup + + # Script executed after network interface has been taken down. + # Executed with the following parameters: + # + # Normally you do not need to uncomment this option. + #option ipdown /etc/chilli.ipdown + + + # Radius parameters + + # IP address to listen to + # Normally you do not need to uncomment this option. + #option radiuslisten 127.0.0.1 + + # IP address of radius server 1 + # For most installations you need to modify this option. + option radiusserver1 rad01.chillispot.org + + # IP address of radius server 2 + # If you have only one radius server you should set radiusserver2 to the + # same value as radiusserver1. + # For most installations you need to modify this option. + option radiusserver2 rad02.chillispot.org + + # Radius authentication port + # The UDP port number to use for radius authentication requests. + # The same port number is used for both radiusserver1 and radiusserver2. + # Normally you do not need to uncomment this option. + #option radiusauthport 1812 + + # Radius accounting port + # The UDP port number to use for radius accounting requests. + # The same port number is used for both radiusserver1 and radiusserver2. + # Normally you do not need to uncomment this option. + #option radiusacctport 1813 + + # Radius shared secret for both servers + # For all installations you should modify this option. + #option radiussecret testing123 + + # Radius NAS-Identifier + # Normally you do not need to uncomment this option. + #option radiusnasid nas01 + + # WISPr Location ID. Should be in the format: isocc=, + # cc=,ac=,network= + # Normally you do not need to uncomment this option. + #option radiuslocationid isocc=us,cc=1,ac=408,network=ACMEWISP_NewarkAirport + + # WISPr Location Name. Should be in the format: + # , + # Normally you do not need to uncomment this option. + #option radiuslocationname ACMEWISP,Gate_14_Terminal_C_of_Newark_Airport + + + # Radius proxy parameters + + # IP address to listen to + # Normally you do not need to uncomment this option. + #option proxylisten 10.0.0.1 + + # UDP port to listen to. + # If not specified a port will be selected by the system + # Normally you do not need to uncomment this option. + #option proxyport 1645 + + # Client(s) from which we accept radius requests + # Normally you do not need to uncomment this option. + #option proxyclient 10.0.0.1/24 + + # Radius proxy shared secret for all clients + # If not specified defaults to radiussecret + # Normally you do not need to uncomment this option. + #option proxysecret testing123 + + + # DHCP Parameters + + # Ethernet interface to listen to. + # This is the network interface which is connected to the access points. + # In a typical configuration this option should be set to eth1. + option dhcpif eth1 + + # Use specified MAC address. + # An address in the range 00:00:5E:00:02:00 - 00:00:5E:FF:FF:FF falls + # within the IANA range of addresses and is not allocated for other + # purposes. + # Normally you do not need to uncomment this option. + #option dhcpmac 00:00:5E:00:02:00 + + # Time before DHCP lease expires + # Normally you do not need to uncomment this option. + #option lease 600 + + + # Universal access method (UAM) parameters + + # URL of web server handling authentication. + option uamserver https://radius.chillispot.org/hotspotlogin + + # URL of welcome homepage. + # Unauthenticated users will be redirected to this URL. If not specified + # users will be redirected to the uamserver instead. + # Normally you do not need to uncomment this option. + #option uamhomepage http://192.168.182.1/welcome.html + + # Shared between chilli and authentication web server + #option uamsecret ht2eb8ej6s4et3rg1ulp + + # IP address to listen to for authentication requests + # Do not uncomment this option unless you are an experienced user! + #option uamlisten 192.168.182.1 + + # TCP port to listen to for authentication requests + # Do not uncomment this option unless you are an experienced user! + #option uamport 3990 + + # Comma separated list of domain names, IP addresses or network segments + # the client can access without first authenticating. + # It is possible to specify this option multiple times. + # Normally you do not need to uncomment this option. + #option uamallowed www.chillispot.org,10.11.12.0/24 + + # Comma separated list of domain names + # the client can access without first authenticating. + # It is possible to specify this option multiple times. + # Normally you do not need to uncomment this option. + #option uamdomain .chillispot.org,.coova.org + + # If this flag is given unauthenticated users are allowed to use + # any DNS server. + # Normally you do not need to uncomment this option. + #option uamanydns + + + # MAC authentication + + # If this flag is given users will be authenticated only on their MAC + # address. + # Normally you do not need to uncomment this option. + #option macauth + + # List of MAC addresses. + # The MAC addresses specified in this list will be authenticated only on + # their MAC address. + # this option is ignored if the macauth tag is given. + # It is possible to specify this option multiple times. + # Normally you do not need to uncomment this option. + #option macallowed 00-0A-5E-AC-BE-51,00-30-1B-3C-32-E9 + + # Password to use for MAC authentication. + # Normally you do not need to uncomment this option. + #option macpasswd password + + # Suffix to add to MAC address in order to form the username. + # Normally you do not need to uncomment this option. + #option macsuffix suffix + diff --git a/net/coova-chilli/files/chilli.firewall b/net/coova-chilli/files/chilli.firewall new file mode 100644 index 0000000..a5b1d00 --- /dev/null +++ b/net/coova-chilli/files/chilli.firewall @@ -0,0 +1,41 @@ +#!/bin/sh + +chilli_firewall() { + local cfg="$1" + + local network ifname tun + + config_get network "$cfg" network + + . /lib/functions/network.sh + network_get_device ifname ${network:-lan} + + if [ "$ifname" = "" ] + then + config_get ifname "$cfg" dhcpif + fi + + config_get tun "$cfg" tundev + + for n in ACCEPT DROP REJECT + do + iptables -F zone_${network}_${n} + iptables -I zone_${network}_${n} -i $tun -j $n + iptables -I zone_${network}_${n} -o $tun -j $n + done + + iptables -D forward -i ${ifname} -j zone_${network}_forward + iptables -A forward -i ${ifname} -j DROP + iptables -A forward -i $tun -j zone_${network}_forward + + iptables -D input -i ${ifname} -j zone_${network} + iptables -A input -i $tun -j zone_${network} + + iptables -I zone_${network} -p tcp --dport 3990 -j ACCEPT + iptables -I zone_${network} -p tcp --dport 3991 -j ACCEPT +} + +chilli_post_core_cb() { + config_load chilli + config_foreach chilli_firewall chilli +} diff --git a/net/coova-chilli/files/chilli.hotplug b/net/coova-chilli/files/chilli.hotplug new file mode 100644 index 0000000..e12812b --- /dev/null +++ b/net/coova-chilli/files/chilli.hotplug @@ -0,0 +1,7 @@ +#!/bin/sh + +[ "$ACTION" == "ifup" ] || exit 0 + +[ "$INTERFACE" = "wan" ] && { + /etc/init.d/chilli restart +} diff --git a/net/coova-chilli/files/chilli.init b/net/coova-chilli/files/chilli.init new file mode 100644 index 0000000..0103a23 --- /dev/null +++ b/net/coova-chilli/files/chilli.init @@ -0,0 +1,61 @@ +#!/bin/sh /etc/rc.common + +START=30 +STOP=90 + +config_cb() { + chilli_inst=$2 + if [ "$chilli_inst" != "" ] + then + rm -f /var/run/chilli_${chilli_inst}.* + chilli_conf=/var/run/chilli_${chilli_inst}.conf + eval "start_chilli_$chilli_inst=1" + fi +} + +option_cb() { + case "$1" in + # UCI settings + network) + . /lib/functions/network.sh + local ifname + network_get_device ifname $2 + echo "dhcpif=\"$ifname\"" >> $chilli_conf + ;; + disabled) + eval "start_chilli_$chilli_inst=0" + ;; + # boolean settings + dhcpbroadcast|nodynip|vlanlocation|locationstopstart|locationcopycalled|locationimmediateupdate|locationopt82|coanoipcheck|noradallow|proxymacaccept|proxyonacct|dhcpmacset|dhcpradius|noc2c|eapolenable|uamanydns|uamanyip|uamnatanyip|nouamsuccess|nowispr1|nowispr2|domaindnslocal|radsec|macauth|macreauth|macauthdeny|macallowlocal|strictmacauth|strictdhcp|ieee8021q|only8021q|radiusoriginalurl|swapoctets|statusfilesave|wpaguests|openidauth|papalwaysok|mschapv2|chillixml|acctupdate|dnsparanoia|seskeepalive|usetap|noarpentries|framedservice|scalewin|redir|injectwispr|redirurl|routeonetone|nousergardendata|uamgardendata|uamotherdata|withunixipc|uamallowpost|redirssl|uamuissl|layer3|patricia|redirdnsreq|dhcpnotidle|ipv6|ipv6only) + [ "$2" = "true" -o "$2" = "1" ] && echo "$1" >> $chilli_conf + ;; + *) + echo "$1=\"$2\"" >> $chilli_conf + ;; + esac +} + +start_chilli() { + local cfg="$1" + local start_chilli=$(eval "echo \$start_chilli_$cfg") + [ "$start_chilli" = "0" ] && return + local base=/var/run/chilli_${cfg} + chilli -c ${base}.conf \ + --pidfile ${base}.pid \ + --cmdsocket ${base}.sock \ + --unixipc ${base}.ipc & +} + +start() { + config_load chilli + config_foreach start_chilli chilli +} + +stop() { + ls /var/run/chilli*.pid 2>/dev/null && { + kill $(cat /var/run/chilli*.pid) + sleep 1 + killall -9 chilli + rm -f /var/run/chilli* + } +} diff --git a/net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch b/net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch new file mode 100644 index 0000000..2efecbe --- /dev/null +++ b/net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch @@ -0,0 +1,24 @@ +--- a/src/system.h ++++ b/src/system.h +@@ -83,10 +83,6 @@ + #include + #endif + +-#ifdef HAVE_SYS_SYSINFO_H +-#include +-#endif +- + #ifdef HAVE_TIME_H + #include + #endif +@@ -139,6 +135,10 @@ + #include + #endif + ++#ifdef HAVE_SYS_SYSINFO_H ++#include ++#endif ++ + #elif defined (__FreeBSD__) || defined (__APPLE__) || defined (__OpenBSD__) || defined (__NetBSD__) + #include + #include diff --git a/net/coova-chilli/patches/200-fix_compile_kmod.patch b/net/coova-chilli/patches/200-fix_compile_kmod.patch new file mode 100644 index 0000000..2722578 --- /dev/null +++ b/net/coova-chilli/patches/200-fix_compile_kmod.patch @@ -0,0 +1,17 @@ +--- a/src/linux/Makefile ++++ b/src/linux/Makefile +@@ -21,11 +21,11 @@ lib%.so: lib%.o + $(CC) $(CFLAGS) -shared -o $@ $^; + + lib%.o: lib%.c +- $(CC) $(CFLAGS) -fPIC -O2 -Wall -I${KERNEL_DIR}/include -D_INIT=lib$*_init -c -o $@ $<; ++ $(CC) $(CFLAGS) -D_INIT=lib$*_init -c -o $@ $<; + + install: modules_install libxt_coova.so +- mkdir -p $(DESTDIR)/lib/xtables/ +- cp libxt_coova.so $(DESTDIR)/lib/xtables/ ++ mkdir -p $(DESTDIR)/usr/lib/iptables/ ++ cp libxt_coova.so $(DESTDIR)/usr/lib/iptables/ + + distdir: + diff --git a/net/coova-chilli/patches/201-fix_dereferencing_pointers.patch b/net/coova-chilli/patches/201-fix_dereferencing_pointers.patch new file mode 100644 index 0000000..d608835 --- /dev/null +++ b/net/coova-chilli/patches/201-fix_dereferencing_pointers.patch @@ -0,0 +1,49 @@ +--- a/src/linux/xt_coova.c ++++ b/src/linux/xt_coova.c +@@ -292,6 +292,8 @@ static int coova_mt_check(const struct x + struct coova_table *t; + #ifdef CONFIG_PROC_FS + struct proc_dir_entry *pde; ++ kuid_t uid; ++ kgid_t gid; + #endif + unsigned i; + int ret = 0; +@@ -330,8 +332,9 @@ static int coova_mt_check(const struct x + ret = -ENOMEM; + goto out; + } +- pde->uid = ip_list_uid; +- pde->gid = ip_list_gid; ++ uid = make_kuid(&init_user_ns, ip_list_uid); ++ gid = make_kgid(&init_user_ns, ip_list_gid); ++ proc_set_user(pde, uid, gid); + #endif + spin_lock_bh(&coova_lock); + list_add_tail(&t->list, &tables); +@@ -445,14 +448,13 @@ static const struct seq_operations coova + + static int coova_seq_open(struct inode *inode, struct file *file) + { +- struct proc_dir_entry *pde = PDE(inode); + struct coova_iter_state *st; + + st = __seq_open_private(file, &coova_seq_ops, sizeof(*st)); + if (st == NULL) + return -ENOMEM; + +- st->table = pde->data; ++ st->table = PDE_DATA(inode); + return 0; + } + +@@ -460,8 +462,7 @@ static ssize_t + coova_mt_proc_write(struct file *file, const char __user *input, + size_t size, loff_t *loff) + { +- const struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); +- struct coova_table *t = pde->data; ++ struct coova_table *t = PDE_DATA(file->f_path.dentry->d_inode); + struct coova_entry *e; + char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de")]; + const char *c = buf; diff --git a/net/coova-chilli/patches/300-fix-compile-with-cyassl.patch b/net/coova-chilli/patches/300-fix-compile-with-cyassl.patch new file mode 100644 index 0000000..3b61d49 --- /dev/null +++ b/net/coova-chilli/patches/300-fix-compile-with-cyassl.patch @@ -0,0 +1,28 @@ +--- a/src/md5.h ++++ b/src/md5.h +@@ -28,6 +28,14 @@ + #define MD5Update MD5_Update + #define MD5Final MD5_Final + ++#elif HAVE_CYASSL ++#include ++ ++#define MD5Init MD5_Init ++#define MD5Update MD5_Update ++#define MD5Final MD5_Final ++ ++typedef struct CYASSL_MD5_CTX MD5_CTX; + #else + + struct MD5Context { +--- a/src/md5.c ++++ b/src/md5.c +@@ -18,7 +18,7 @@ + #include /* for memcpy() */ + #include "md5.h" + +-#ifndef HAVE_OPENSSL ++#if !defined(HAVE_OPENSSL) && !defined(HAVE_CYASSL) + + void byteReverse(unsigned char *buf, size_t longs); + diff --git a/net/coova-chilli/patches/400-fix-compile-with-musl.patch b/net/coova-chilli/patches/400-fix-compile-with-musl.patch new file mode 100644 index 0000000..a810a73 --- /dev/null +++ b/net/coova-chilli/patches/400-fix-compile-with-musl.patch @@ -0,0 +1,61 @@ +--- a/src/system.h ++++ b/src/system.h +@@ -78,11 +78,6 @@ + #include + #endif + +-#ifdef HAVE_LINUX_SYSINFO_H +-#define _LINUX_KERNEL_H +-#include +-#endif +- + #ifdef HAVE_TIME_H + #include + #endif +@@ -123,6 +118,11 @@ + #include + #endif + ++#ifdef HAVE_SYS_SYSINFO_H ++#define _LINUX_SYSINFO_H ++#include ++#endif ++ + #if defined(__linux__) + #include + #include +@@ -135,10 +135,6 @@ + #include + #endif + +-#ifdef HAVE_SYS_SYSINFO_H +-#include +-#endif +- + #elif defined (__FreeBSD__) || defined (__APPLE__) || defined (__OpenBSD__) || defined (__NetBSD__) + #include + #include +@@ -170,10 +166,6 @@ + #include + #endif + +-#ifdef HAVE_NET_ETHERNET_H +-#include +-#endif +- + #ifdef HAVE_ASM_TYPES_H + #include + #endif +--- a/src/chilli_limits.h ++++ b/src/chilli_limits.h +@@ -18,8 +18,8 @@ + * + */ + +-#ifndef _LIMITS_H +-#define _LIMITS_H ++#ifndef _CHILLI_LIMITS_H ++#define _CHILLI_LIMITS_H + + /* + * extracted from various .h files, needs some cleanup. diff --git a/net/cshark/Makefile b/net/cshark/Makefile new file mode 100644 index 0000000..88fd17d --- /dev/null +++ b/net/cshark/Makefile @@ -0,0 +1,75 @@ +# +# Copyright (C) 2014-2015 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:=cshark +PKG_VERSION:=2015-11-24 +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/cloudshark/cshark.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=e575ab3d35d75a6f70488001fcba45690ebe9b3e +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/cshark + SECTION:=net + CATEGORY:=Network + TITLE:=CloudShark capture tool + URL:=http://www.cloudshark.org/ + DEPENDS:=+libjson-c +libpcap +libuci +libubox +libuclient +libustream-polarssl + MAINTAINER:=Luka Perkov +endef + +define Package/luci-app-cshark + SECTION:=luci + CATEGORY:=LuCI + SUBMENU:=3. Applications + TITLE:=Cloudshark capture tool Web UI + DEPENDS:=+cshark +luci + MAINTAINER:=Luka Perkov +endef + +CMAKE_OPTIONS = \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DWITH_DEBUG=OFF \ + +define Package/cshark/conffiles +/etc/config/cshark +endef + +define Package/cshark/install + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/cshark \ + $(1)/sbin/ + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) \ + $(PKG_BUILD_DIR)/config/cshark \ + $(1)/etc/config/ + + $(INSTALL_DIR) $(1)/etc/ssl/certs + $(INSTALL_CONF) \ + $(PKG_BUILD_DIR)/config/ca-the_usertrust_network.pem \ + $(1)/etc/ssl/certs/ +endef + +define Package/luci-app-cshark/install + $(INSTALL_DIR) $(1)/usr/lib/lua/luci + $(CP) -R $(PKG_BUILD_DIR)/openwrt/luci/luasrc/* $(1)/usr/lib/lua/luci/ +endef + +$(eval $(call BuildPackage,cshark)) +$(eval $(call BuildPackage,luci-app-cshark)) diff --git a/net/ctorrent-svn/Makefile b/net/ctorrent-svn/Makefile new file mode 100644 index 0000000..0725f59 --- /dev/null +++ b/net/ctorrent-svn/Makefile @@ -0,0 +1,98 @@ +# +# Copyright (C) 2006-2015 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:=ctorrent-svn +PKG_REV:=322 +PKG_VERSION:=r$(PKG_REV) +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://svn.code.sf.net/p/dtorrent/code/dtorrent/trunk +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=$(PKG_REV) +PKG_SOURCE_PROTO:=svn + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) +PKG_CHECK_FORMAT_SECURITY:=0 + +include $(INCLUDE_DIR)/package.mk + +define Package/ctorrent-svn/Default + SUBMENU:=BitTorrent + SECTION:=net + CATEGORY:=Network + DEPENDS:=+uclibcxx + TITLE:=console-based BitTorrent client + MAINTAINER:=Peter Wagner + URL:=http://www.rahul.net/dholmes/ctorrent/ +endef + +define Package/ctorrent-svn/Default/description + CTorrent is a BitTorrent client written in the C programming language, + known to be a very robust and mature programming language, which produces + fast and optimized application. +endef + +define Package/ctorrent-svn +$(call Package/ctorrent-svn/Default) + TITLE+= (with OpenSSL support) + DEPENDS+=+libopenssl + VARIANT:=ssl +endef + +define Package/ctorrent-svn/description +$(call Package/ctorrent-svn/Default/description) + This package is built with OpenSSL support. +endef + +define Package/ctorrent-svn-nossl +$(call Package/ctorrent-svn/Default) + TITLE+= (with builtin SHA-1) + VARIANT:=nossl +endef + +define Package/ctorrent-svn-nossl/description +$(call Package/ctorrent-svn/Default/description) + This package is built with builtin (Steve Reid's public-domain) SHA-1 support +endef + +CONFIGURE_VARS += \ + CXX="g++-uc" \ + LIBS="-nodefaultlibs -luClibc++ $(LIBGCC_S) -lc" + +ifeq ($(BUILD_VARIANT),ssl) + CONFIGURE_ARGS += \ + --with-ssl="$(STAGING_DIR)/usr" +endif + +ifeq ($(BUILD_VARIANT),nossl) + CONFIGURE_ARGS += \ + --with-ssl=no +endif + +define Build/Configure + (cd $(PKG_BUILD_DIR); touch \ + configure.ac \ + aclocal.m4 \ + Makefile.in \ + config.h.in \ + configure \ + ); + $(call Build/Configure/Default) +endef + +define Package/ctorrent-svn/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ctorrent $(1)/usr/bin/ctorrent +endef + +Package/ctorrent-svn-nossl/install = $(Package/ctorrent-svn/install) + +$(eval $(call BuildPackage,ctorrent-svn)) +$(eval $(call BuildPackage,ctorrent-svn-nossl)) diff --git a/net/ctorrent-svn/patches/100-compile-fix.patch b/net/ctorrent-svn/patches/100-compile-fix.patch new file mode 100644 index 0000000..bb7d33f --- /dev/null +++ b/net/ctorrent-svn/patches/100-compile-fix.patch @@ -0,0 +1,88 @@ +diff --git a/btconfig.cpp b/btconfig.cpp +index e1badd0..aaa6feb 100644 +--- a/btconfig.cpp ++++ b/btconfig.cpp +@@ -828,7 +828,7 @@ void CfgCTCS(Config *config) + strncpy(CTCS.m_host, *cfg_ctcs, MAXHOSTNAMELEN-1); + CTCS.m_host[MAXHOSTNAMELEN-1] = '\0'; + if( (s = strchr(CTCS.m_host, ':')) ) *s='\0'; +- CTCS.m_port = atoi(s = (strchr(*cfg_ctcs, ':')+1)); ++ CTCS.m_port = atoi(s = (char*)(strchr(*cfg_ctcs, ':')+1)); + if( strchr(s, ':') ) + CONSOLE.Input("Enter CTCS password: ", CTCS.m_pass, CTCS_PASS_SIZE); + else *CTCS.m_pass = '\0'; +diff --git a/btcontent.cpp b/btcontent.cpp +index d84f450..88ccb50 100644 +--- a/btcontent.cpp ++++ b/btcontent.cpp +@@ -1408,27 +1408,27 @@ void btContent::CompletionCommand() + ptmp = cmdstr + strlen(cmdstr); + parg = strstr(parg, "&t") + 2; + strcat(pt, parg); +- pt = strstr(ptmp, "&t"); +- if( pd ) pd = strstr(ptmp, "&d"); +- if( pw ) pw = strstr(ptmp, "&w"); ++ pt = (char *)strstr(ptmp, "&t"); ++ if( pd ) pd = (char *)strstr(ptmp, "&d"); ++ if( pw ) pw = (char *)strstr(ptmp, "&w"); + } + if( pd && (!pt || pd < pt) && (!pw || pd < pw) ){ + strcpy(pd, m_btfiles.GetDataName()); + ptmp = cmdstr + strlen(cmdstr); + parg = strstr(parg, "&d") + 2; + strcat(pd, parg); +- pd = strstr(ptmp, "&d"); +- if( pt ) pt = strstr(ptmp, "&t"); +- if( pw ) pw = strstr(ptmp, "&w"); ++ pd = (char *)strstr(ptmp, "&d"); ++ if( pt ) pt = (char *)strstr(ptmp, "&t"); ++ if( pw ) pw = (char *)strstr(ptmp, "&w"); + } + if( pw && (!pt || pw < pt) && (!pd || pw < pd) ){ + strcpy(pw, wd); + ptmp = cmdstr + strlen(cmdstr); + parg = strstr(parg, "&w") + 2; + strcat(pw, parg); +- pw = strstr(ptmp, "&w"); +- if( pt ) pt = strstr(ptmp, "&t"); +- if( pd ) pd = strstr(ptmp, "&d"); ++ pw = (char *)strstr(ptmp, "&w"); ++ if( pt ) pt = (char *)strstr(ptmp, "&t"); ++ if( pd ) pd = (char *)strstr(ptmp, "&d"); + } + } + } +diff --git a/console.cpp b/console.cpp +index bdadb61..5ab2492 100644 +--- a/console.cpp ++++ b/console.cpp +@@ -511,11 +511,8 @@ void ConStream::Error(int sev, const char *message, ...) + va_list ap; + + va_start(ap, message); +- if( g_console_ready ) CONSOLE.Error(sev, message, ap); +- else{ + vfprintf(stderr, message, ap); + fflush(stderr); +- } + va_end(ap); + } + +@@ -1766,7 +1763,7 @@ void Console::Warning(int sev, const char *message, ...) + va_end(ap); + } + +- ++/* + void Console::Error(int sev, const char *message, va_list ap) + { + vsnprintf(m_buffer, sizeof(m_buffer), message, ap); +@@ -1778,7 +1775,7 @@ void Console::Error(int sev, const char *message, va_list ap) + m_warnings.AddMessage(sev, m_buffer); + if( sev && *cfg_ctcs ) CTCS.Send_Info(sev, m_buffer); + } +- ++*/ + + void Console::Debug(const char *message, ...) + { diff --git a/net/ctorrent-svn/patches/300-negative.patch b/net/ctorrent-svn/patches/300-negative.patch new file mode 100644 index 0000000..e1e1e65 --- /dev/null +++ b/net/ctorrent-svn/patches/300-negative.patch @@ -0,0 +1,14 @@ +diff --git a/bencode.cpp b/bencode.cpp +index fef82ba..b7f14bc 100644 +--- a/bencode.cpp ++++ b/bencode.cpp +@@ -45,6 +45,9 @@ size_t buf_int(const char *b, size_t len, char beginchar, char endchar, + p++; + len--; + } ++ if( *p == '-'){ ++ p++; len--; ++ } + + for( psave = p; len && isdigit(*p); p++, len-- ); + diff --git a/net/ctorrent-svn/patches/400-musl-compat.patch b/net/ctorrent-svn/patches/400-musl-compat.patch new file mode 100644 index 0000000..e17c147 --- /dev/null +++ b/net/ctorrent-svn/patches/400-musl-compat.patch @@ -0,0 +1,10 @@ +--- a/compat.c ++++ b/compat.c +@@ -51,6 +51,7 @@ int snprintf(char *str, size_t size, con + + #ifndef HAVE_STRNSTR + #include ++#include + /* FUNCTION PROGRAMER: Siberiaic Sang */ + char *strnstr(const char *haystack, const char *needle, size_t haystacklen) + { diff --git a/net/ctorrent/Makefile b/net/ctorrent/Makefile new file mode 100644 index 0000000..6a8e481 --- /dev/null +++ b/net/ctorrent/Makefile @@ -0,0 +1,84 @@ +# +# Copyright (C) 2006-2015 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:=ctorrent +PKG_VERSION:=dnh3.3.2 +PKG_RELEASE:=7 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/dtorrent \ + http://www.rahul.net/dholmes/ctorrent/ +PKG_MD5SUM:=59b23dd05ff70791cd6449effa7fc3b6 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/uclibc++.mk +include $(INCLUDE_DIR)/package.mk + +define Package/ctorrent/Default + SUBMENU:=BitTorrent + SECTION:=net + CATEGORY:=Network + DEPENDS:=$(CXX_DEPENDS) + TITLE:=console-based BitTorrent client + MAINTAINER:=Peter Wagner + URL:=http://www.rahul.net/dholmes/ctorrent/ +endef + +define Package/ctorrent/Default/description + CTorrent is a BitTorrent client written in the C programming language, + known to be a very robust and mature programming language, which produces + fast and optimized application. +endef + +define Package/ctorrent +$(call Package/ctorrent/Default) + TITLE+= (with OpenSSL support) + DEPENDS+=+libopenssl + VARIANT:=ssl +endef + +define Package/ctorrent/description +$(call Package/ctorrent/Default/description) + This package is built with OpenSSL support. +endef + +define Package/ctorrent-nossl +$(call Package/ctorrent/Default) + TITLE+= (with builtin SHA-1) + VARIANT:=nossl +endef + +define Package/ctorrent-nossl/description +$(call Package/ctorrent/Default/description) + This package is built with builtin (Steve Reid's public-domain) SHA-1 support +endef + +CONFIGURE_VARS += \ + CXXFLAGS="$$$$CXXFLAGS -fno-rtti" + +ifeq ($(BUILD_VARIANT),ssl) + CONFIGURE_ARGS += \ + --with-ssl="$(STAGING_DIR)/usr" +endif + +ifeq ($(BUILD_VARIANT),nossl) + CONFIGURE_ARGS += \ + --with-ssl=no +endif + +define Package/ctorrent/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/bin/$(PKG_NAME) +endef + +Package/ctorrent-nossl/install = $(Package/ctorrent/install) + +$(eval $(call BuildPackage,ctorrent)) +$(eval $(call BuildPackage,ctorrent-nossl)) diff --git a/net/ctorrent/patches/100-CVE-2009-1759.patch b/net/ctorrent/patches/100-CVE-2009-1759.patch new file mode 100644 index 0000000..86ae1d7 --- /dev/null +++ b/net/ctorrent/patches/100-CVE-2009-1759.patch @@ -0,0 +1,364 @@ +Patch for CVE-2009-1759. +Source: Upstream SVN, rev 302 from the dtorrent-3 branch. + +Index: a/bencode.h +=================================================================== +--- a/bencode.h (revision 300) ++++ b/bencode.h (revision 302) +@@ -25,7 +25,7 @@ + size_t decode_list(const char *b,size_t len,const char *keylist); + size_t decode_rev(const char *b,size_t len,const char *keylist); + size_t decode_query(const char *b,size_t len,const char *keylist,const char **ps,size_t *pi,int64_t *pl,int method); +-size_t decode_list2path(const char *b, size_t n, char *pathname); ++size_t decode_list2path(const char *b, size_t n, char *pathname, size_t maxlen); + size_t bencode_buf(const char *str,size_t len,FILE *fp); + size_t bencode_str(const char *str, FILE *fp); + size_t bencode_int(const uint64_t integer, FILE *fp); +Index: a/bencode.cpp +=================================================================== +--- a/bencode.cpp (revision 300) ++++ b/bencode.cpp (revision 302) +@@ -233,22 +233,28 @@ + return bencode_end_dict_list(fp); + } + +-size_t decode_list2path(const char *b, size_t n, char *pathname) ++size_t decode_list2path(const char *b, size_t n, char *pathname, size_t maxlen) + { + const char *pb = b; + const char *s = (char *) 0; ++ const char *endmax = pathname + maxlen - 1; + size_t r,q; + + if( 'l' != *pb ) return 0; + pb++; + n--; + if( !n ) return 0; +- for(; n;){ ++ while( n && pathname < endmax ){ + if(!(r = buf_str(pb, n, &s, &q)) ) return 0; ++ if( q >= maxlen ) return 0; + memcpy(pathname, s, q); + pathname += q; +- pb += r; n -= r; +- if( 'e' != *pb ){*pathname = PATH_SP, pathname++;} else break; ++ maxlen -= q; ++ pb += r; ++ n -= r; ++ if( 'e' == *pb ) break; ++ if( pathname >= endmax ) return 0; ++ *pathname++ = PATH_SP; + } + *pathname = '\0'; + return (pb - b + 1); +Index: a/btfiles.cpp +=================================================================== +--- a/btfiles.cpp (revision 300) ++++ b/btfiles.cpp (revision 302) +@@ -449,7 +449,8 @@ + return 0; + } + +-int btFiles::BuildFromMI(const char *metabuf, const size_t metabuf_len, const char *saveas) ++int btFiles::BuildFromMI(const char *metabuf, const size_t metabuf_len, ++ const char *saveas, unsigned char exam_only) + { + char path[MAXPATHLEN]; + const char *s, *p; +@@ -458,11 +459,19 @@ + int f_warned = 0; + + if( !decode_query(metabuf, metabuf_len, "info|name", &s, &q, (int64_t*)0, +- QUERY_STR) || MAXPATHLEN <= q ) ++ QUERY_STR) || MAXPATHLEN <= q ){ ++ errno = EINVAL; + return -1; ++ } + + memcpy(path, s, q); + path[q] = '\0'; ++ if( !exam_only && ++ (PATH_SP == path[0] || '/' == path[0] || 0==strncmp("..", path, 2)) ){ ++ CONSOLE.Warning(1, "error, unsafe path \"%s\" in torrent data", path); ++ errno = EINVAL; ++ return -1; ++ } + + r = decode_query(metabuf, metabuf_len, "info|files", (const char**)0, &q, + (int64_t*)0, QUERY_POS); +@@ -471,21 +480,31 @@ + BTFILE *pbf_last = (BTFILE*) 0; + BTFILE *pbf = (BTFILE*) 0; + size_t dl; ++ unsigned long nfiles = 0; ++ + if( decode_query(metabuf,metabuf_len,"info|length", +- (const char**) 0,(size_t*) 0,(int64_t*) 0,QUERY_LONG) ) ++ (const char**) 0,(size_t*) 0,(int64_t*) 0,QUERY_LONG) ){ ++ errno = EINVAL; + return -1; ++ } + + if( saveas ){ + m_directory = new char[strlen(saveas) + 1]; + #ifndef WINDOWS +- if(!m_directory) return -1; ++ if( !m_directory ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + strcpy(m_directory,saveas); + }else{ + int f_conv; + char *tmpfn = new char[strlen(path)*2+5]; + #ifndef WINDOWS +- if( !tmpfn ) return -1; ++ if( !tmpfn ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + if( f_conv = ConvertFilename(tmpfn, path, strlen(path)*2+5) ){ + if( arg_flg_convert_filenames ){ +@@ -493,6 +512,7 @@ + #ifndef WINDOWS + if( !m_directory ){ + delete []tmpfn; ++ errno = ENOMEM; + return -1; + } + #endif +@@ -507,7 +527,10 @@ + if( !f_conv || !arg_flg_convert_filenames ){ + m_directory = new char[strlen(path) + 1]; + #ifndef WINDOWS +- if( !m_directory ) return -1; ++ if( !m_directory ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + strcpy(m_directory,path); + } +@@ -517,24 +540,50 @@ + p = metabuf + r + 1; + q--; + for(; q && 'e' != *p; p += dl, q -= dl){ +- if(!(dl = decode_dict(p, q, (const char*) 0)) ) return -1; +- if( !decode_query(p, dl, "length", (const char**) 0, +- (size_t*) 0,&t,QUERY_LONG) ) return -1; ++ if( !(dl = decode_dict(p, q, (const char*) 0)) || ++ !decode_query(p, dl, "length", (const char**) 0, (size_t*) 0, &t, ++ QUERY_LONG) ){ ++ errno = EINVAL; ++ return -1; ++ } + pbf = _new_bfnode(); + #ifndef WINDOWS +- if( !pbf ) return -1; ++ if( !pbf ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif ++ nfiles++; + pbf->bf_length = t; + m_total_files_length += t; + r = decode_query(p, dl, "path", (const char **)0, &n, (int64_t*)0, + QUERY_POS); +- if( !r ) return -1; +- if(!decode_list2path(p + r, n, path)) return -1; ++ if( !r || !decode_list2path(p + r, n, path, sizeof(path)) ){ ++ CONSOLE.Warning(1, ++ "error, invalid path in torrent data for file %lu at offset %llu", ++ nfiles, m_total_files_length - t); ++ delete pbf; ++ errno = EINVAL; ++ return -1; ++ } ++ if( !exam_only && ++ (PATH_SP == path[0] || '/' == path[0] || 0==strncmp("..", path, 2)) ){ ++ CONSOLE.Warning(1, ++ "error, unsafe path \"%s\" in torrent data for file %lu", ++ path, nfiles); ++ delete pbf; ++ errno = EINVAL; ++ return -1; ++ } + ++ + int f_conv; + char *tmpfn = new char[strlen(path)*2+5]; + #ifndef WINDOWS +- if( !tmpfn ) return -1; ++ if( !tmpfn ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + if( f_conv = ConvertFilename(tmpfn, path, strlen(path)*2+5) ){ + if( arg_flg_convert_filenames ){ +@@ -542,6 +591,7 @@ + #ifndef WINDOWS + if( !pbf->bf_filename ){ + delete []tmpfn; ++ errno = ENOMEM; + return -1; + } + #endif +@@ -556,7 +606,10 @@ + if( !f_conv || !arg_flg_convert_filenames ){ + pbf->bf_filename = new char[strlen(path) + 1]; + #ifndef WINDOWS +- if( !pbf->bf_filename ) return -1; ++ if( !pbf->bf_filename ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + strcpy(pbf->bf_filename, path); + } +@@ -564,30 +617,42 @@ + pbf_last = pbf; + } + }else{ +- if( !decode_query(metabuf,metabuf_len,"info|length", +- (const char**) 0,(size_t*) 0,&t,QUERY_LONG) ) ++ if( !decode_query(metabuf,metabuf_len, "info|length", ++ (const char**)0, (size_t*) 0, &t, QUERY_LONG) ){ ++ errno = EINVAL; + return -1; ++ } + m_btfhead = _new_bfnode(); + #ifndef WINDOWS +- if( !m_btfhead) return -1; ++ if( !m_btfhead ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + m_btfhead->bf_length = m_total_files_length = t; + if( saveas ){ + m_btfhead->bf_filename = new char[strlen(saveas) + 1]; + #ifndef WINDOWS +- if(!m_btfhead->bf_filename ) return -1; ++ if( !m_btfhead->bf_filename ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + strcpy(m_btfhead->bf_filename, saveas); + }else if( arg_flg_convert_filenames ){ + char *tmpfn = new char[strlen(path)*2+5]; + #ifndef WINDOWS +- if( !tmpfn ) return -1; ++ if( !tmpfn ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + ConvertFilename(tmpfn, path, strlen(path)*2+5); + m_btfhead->bf_filename = new char[strlen(tmpfn) + 1]; + #ifndef WINDOWS + if( !m_btfhead->bf_filename ){ + delete []tmpfn; ++ errno = ENOMEM; + return -1; + } + #endif +@@ -596,7 +661,10 @@ + }else{ + m_btfhead->bf_filename = new char[strlen(path) + 1]; + #ifndef WINDOWS +- if(!m_btfhead->bf_filename ) return -1; ++ if( !m_btfhead->bf_filename ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + strcpy(m_btfhead->bf_filename, path); + } +@@ -694,6 +762,32 @@ + size_t btFiles::FillMetaInfo(FILE* fp) + { + BTFILE *p; ++ const char *refname, *s; ++ char path[MAXPATHLEN]; ++ ++ refname = m_directory ? m_directory : m_btfhead->bf_filename; ++ while( (s = strchr(refname, PATH_SP)) && *(s + 1) ){ ++ refname = s + 1; ++ } ++ if( m_directory && '.' == *refname ){ ++ char dir[MAXPATHLEN]; ++ if( getcwd(dir, sizeof(dir)) && 0==chdir(m_directory) ){ ++ if( getcwd(path, sizeof(path)) ){ ++ refname = path; ++ while( (s = strchr(refname, PATH_SP)) && *(s + 1) ){ ++ refname = s + 1; ++ } ++ } ++ chdir(dir); ++ } ++ } ++ if( '/' == *refname || '\0' == *refname || '.' == *refname ){ ++ CONSOLE.Warning(1, "error, inappropriate file or directory name \"%s\"", ++ m_directory ? m_directory : m_btfhead->bf_filename); ++ errno = EINVAL; ++ return 0; ++ } ++ + if( m_directory ){ + // multi files + if( bencode_str("files", fp) != 1 ) return 0; +@@ -715,16 +809,15 @@ + if(bencode_end_dict_list(fp) != 1 ) return 0; + + if(bencode_str("name", fp) != 1) return 0; +- return bencode_str(m_directory, fp); +- ++ return bencode_str(refname, fp); + }else{ + if( bencode_str("length", fp) != 1 ) return 0; + if( bencode_int(m_btfhead->bf_length, fp) != 1) return 0; + + if( bencode_str("name", fp) != 1 ) return 0; +- return bencode_str(m_btfhead->bf_filename, fp); ++ return bencode_str(refname, fp); + } +- return 1; ++ return 0; + } + + +Index: a/btcontent.cpp +=================================================================== +--- a/btcontent.cpp (revision 300) ++++ b/btcontent.cpp (revision 302) +@@ -357,7 +357,11 @@ + + cfg_req_queue_length = (m_piece_length / cfg_req_slice_size) * 2 - 1; + +- if( m_btfiles.BuildFromMI(b, flen, saveas) < 0 ) ERR_RETURN(); ++ if( m_btfiles.BuildFromMI(b, flen, saveas, arg_flg_exam_only) < 0 ){ ++ if( EINVAL == errno ) ++ CONSOLE.Warning(1, "Torrent metainfo file data is invalid or unusable."); ++ ERR_RETURN(); ++ } + + delete []b; + b = (char *)0; +Index: a/btfiles.h +=================================================================== +--- a/btfiles.h (revision 300) ++++ b/btfiles.h (revision 302) +@@ -61,7 +61,7 @@ + + int BuildFromFS(const char *pathname); + int BuildFromMI(const char *metabuf, const size_t metabuf_len, +- const char *saveas); ++ const char *saveas, unsigned char exam_only); + + char *GetDataName() const; + uint64_t GetTotalLength() const { return m_total_files_length; } diff --git a/net/ctorrent/patches/100-negative-ints.patch b/net/ctorrent/patches/100-negative-ints.patch new file mode 100644 index 0000000..864ce1b --- /dev/null +++ b/net/ctorrent/patches/100-negative-ints.patch @@ -0,0 +1,13 @@ +--- a/bencode.cpp ++++ b/bencode.cpp +@@ -44,6 +44,10 @@ size_t buf_long(const char *b,size_t len + p++; len--; + } + ++ if( *p == '-'){ ++ p++; len--; ++ } ++ + for(psave = p; len && isdigit(*p); p++,len--) ; + + if(!len || MAX_INT_SIZ < (p - psave) || *p != endchar) return 0; diff --git a/net/ctorrent/patches/200-musl-compat.patch b/net/ctorrent/patches/200-musl-compat.patch new file mode 100644 index 0000000..65cb71e --- /dev/null +++ b/net/ctorrent/patches/200-musl-compat.patch @@ -0,0 +1,10 @@ +--- a/compat.c ++++ b/compat.c +@@ -63,6 +63,7 @@ int snprintf(char *str, size_t size, con + + #ifndef HAVE_STRNSTR + #include ++#include + /* FUNCTION PROGRAMER: Siberiaic Sang */ + char *strnstr(const char *haystack, const char *needle, size_t haystacklen) + { diff --git a/net/daemonlogger/Makefile b/net/daemonlogger/Makefile new file mode 100644 index 0000000..41853f2 --- /dev/null +++ b/net/daemonlogger/Makefile @@ -0,0 +1,47 @@ +# +# Copyright (C) 2007-2011 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:=daemonlogger +PKG_VERSION:=1.2.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/daemonlogger +PKG_MD5SUM:=acb64aa6cd5777e297569f100b5c39ee + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_MAINTAINER:=Mirko Vogt + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/daemonlogger + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpcap +libdnet + TITLE:=Software Network Tap + URL:=http://www.snort.org/snort-downloads/additional-downloads +endef + +CONFIGURE_VARS += \ + BUILD_CC="$(TARGET_CC)" \ + HOSTCC="$(HOSTCC)" + +MAKE_FLAGS := CCOPT="$(TARGET_CFLAGS)" INCLS="-I. $(TARGET_CPPFLAGS)" + +define Package/daemonlogger/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/daemonlogger $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,daemonlogger)) diff --git a/net/dansguardian/Makefile b/net/dansguardian/Makefile new file mode 100644 index 0000000..eefefaa --- /dev/null +++ b/net/dansguardian/Makefile @@ -0,0 +1,78 @@ +# +# Copyright (C) 2008-2015 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:=dansguardian +PKG_VERSION:=2.12.0.3 +PKG_RELEASE:=1 + +PKG_LICENSE:=GPL-2.0 +PKG_MAINTAINER:=Luka Perkov + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=@SF/dansguardian +PKG_MD5SUM:=2a88d0392cd28eaec02b7ee727b2e253 + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/uclibc++.mk +include $(INCLUDE_DIR)/package.mk + +define Package/dansguardian + SECTION:=net + DEPENDS:=+libpthread $(CXX_DEPENDS) +zlib + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + TITLE:=DansGuardian + URL:=http://dansguardian.org +endef + +define Package/dansguardian/conffiles +/etc/dansguardian/dansguardianf1.conf +/etc/config/dansguardian +endef + +CONFIGURE_VARS += \ + INCLUDES="" \ + CXXFLAGS="$$$$CXXFLAGS -fno-rtti" \ + LIBS="-lpthread" \ + +define Build/Configure + $(call Build/Configure/Default,\ + --disable-clamav \ + --with-sysconfsubdir=dansguardian \ + --with-proxyuser=root \ + --with-proxygroup=root \ + --disable-pcre \ + ) +endef + +define Package/dansguardian/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dansguardian $(1)/usr/sbin/ + + $(INSTALL_DIR) $(1)/etc + $(CP) $(PKG_INSTALL_DIR)/etc/dansguardian $(1)/etc/ + $(INSTALL_CONF) ./files/dansguardianf1.conf $(1)/etc/dansguardian/dansguardianf1.conf + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/dansguardian.config $(1)/etc/config/dansguardian + + $(INSTALL_DIR) $(1)/usr/share/dansguardian + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/dansguardian/transparent1x1.gif $(1)/usr/share/dansguardian/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/dansguardian/blockedflash.swf $(1)/usr/share/dansguardian/ + + $(INSTALL_DIR) $(1)/usr/share/dansguardian/languages/ukenglish + $(CP) $(PKG_INSTALL_DIR)/usr/share/dansguardian/languages/ukenglish/* $(1)/usr/share/dansguardian/languages/ukenglish/ + + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) ./files/dansguardian.init $(1)/etc/init.d/dansguardian +endef + +$(eval $(call BuildPackage,dansguardian)) diff --git a/net/dansguardian/files/dansguardian.config b/net/dansguardian/files/dansguardian.config new file mode 100644 index 0000000..86640af --- /dev/null +++ b/net/dansguardian/files/dansguardian.config @@ -0,0 +1,71 @@ +config dansguardian 'dansguardian' + option config_file '/etc/dansguardian/dansguardianf1.conf' + option accessdeniedaddress 'http://YOURSERVER.YOURDOMAIN/cgi-bin/dansguardian.pl' + option bannediplist '/etc/dansguardian/lists/bannediplist' + option contentscanexceptions 'off' + option contentscannertimeout '60' + option createlistcachefiles 'on' + option custombannedflashfile '/usr/share/dansguardian/blockedflash.swf' + option custombannedimagefile '/usr/share/dansguardian/transparent1x1.gif' + option deletedownloadedtempfiles 'on' + option downloadmanager '/etc/dansguardian/downloadmanagers/default.conf' + option exceptioniplist '/etc/dansguardian/lists/exceptioniplist' + option filecachedir '/tmp' + option filtergroups '1' + option filtergroupslist '/etc/dansguardian/lists/filtergroupslist' + option filterip '' + option filterports '8080' + option forcequicksearch 'off' + option forwardedfor 'off' + option hexdecodecontent 'off' + option initialtrickledelay '20' + option ipcfilename '/tmp/.dguardianipc' + option ipipcfilename '/tmp/.dguardianipipc' + option languagedir '/usr/share/dansguardian/languages' + option language 'ukenglish' + option logadblocks 'off' + option logchildprocesshandling 'off' + option logclienthostnames 'off' + option logconnectionhandlingerrors 'on' + option logexceptionhits '2' + option logfileformat '1' + option loglevel '2' + option loglocation '/dev/null' + option logsyslog 'on' + option loguseragent 'off' + option maxagechildren '500' + option maxchildren '120' + option maxcontentfilecachescansize '20000' + option maxcontentfiltersize '256' + option maxcontentramcachescansize '2000' + option maxips '0' + option maxsparechildren '32' + option maxuploadsize '-1' + option minchildren '8' + option minsparechildren '4' + option nodaemon 'off' + option nologger 'off' + option nonstandarddelimiter 'on' + option perroomblockingdirectory '/etc/dansguardian/lists/bannedrooms/' + option phrasefiltermode '2' + option prefercachedlists 'off' + option preforkchildren '6' + option preservecase '0' + option proxyip '127.0.0.1' + option proxyport '3128' + option proxytimeout '20' + option recheckreplacedurls 'off' + option reportinglevel '3' + option reverseaddresslookups 'off' + option reverseclientiplookups 'off' + option scancleancache 'on' + option showweightedfound 'on' + option softrestart 'off' + option trickledelay '10' + option urlcacheage '900' + option urlcachenumber '1000' + option urlipcfilename '/tmp/.dguardianurlipc' + option usecustombannedflash 'on' + option usecustombannedimage 'on' + option usexforwardedfor 'off' + option weightedphrasemode '2' diff --git a/net/dansguardian/files/dansguardian.init b/net/dansguardian/files/dansguardian.init new file mode 100644 index 0000000..67ec6bd --- /dev/null +++ b/net/dansguardian/files/dansguardian.init @@ -0,0 +1,190 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 OpenWrt.org + +START=90 +STOP=10 + +USE_PROCD=1 +PROG=/usr/sbin/dansguardian +CONFIGFILE="/tmp/dansguardian/dansguardian.conf" + +validate_dansguardian_section() { + uci_validate_section dansguardian dansguardian "${1}" \ + 'config_file:string' \ + 'accessdeniedaddress:string' \ + 'bannediplist:string' \ + 'contentscanexceptions:string' \ + 'contentscannertimeout:uinteger' \ + 'createlistcachefiles:string' \ + 'custombannedflashfile:string' \ + 'custombannedimagefile:string' \ + 'deletedownloadedtempfiles:string' \ + 'downloadmanager:string' \ + 'exceptioniplist:string' \ + 'filecachedir:string' \ + 'filtergroups:uinteger' \ + 'filtergroupslist:string' \ + 'filterip:ipaddr' \ + 'filterports:port:8080' \ + 'forcequicksearch:string' \ + 'forwardedfor:string' \ + 'hexdecodecontent:string' \ + 'initialtrickledelay:uinteger' \ + 'ipcfilename:string' \ + 'ipipcfilename:string' \ + 'languagedir:string' \ + 'language:string' \ + 'logadblocks:string' \ + 'logchildprocesshandling:string' \ + 'logclienthostnames:string' \ + 'logconnectionhandlingerrors:string' \ + 'logexceptionhits:range(0,2)' \ + 'logfileformat:range(1,4)' \ + 'loglevel:range(0,3)' \ + 'loglocation:string' \ + 'loguseragent:string' \ + 'maxagechildren:uinteger' \ + 'maxchildren:uinteger' \ + 'maxcontentfilecachescansize:uinteger' \ + 'maxcontentfiltersize:uinteger' \ + 'maxcontentramcachescansize:uinteger' \ + 'maxips:uinteger' \ + 'maxsparechildren:uinteger' \ + 'maxuploadsize:integer' \ + 'minchildren:uinteger' \ + 'minsparechildren:uinteger' \ + 'nodaemon:string' \ + 'nologger:string' \ + 'nonstandarddelimiter:string' \ + 'perroomblockingdirectory:string' \ + 'phrasefiltermode:range(0,3)' \ + 'prefercachedlists:string' \ + 'preforkchildren:uinteger' \ + 'preservecase:range(0,2)' \ + 'proxyip:ipaddr' \ + 'proxyport:port:3128' \ + 'proxytimeout:range(20,30)' \ + 'recheckreplacedurls:string' \ + 'reportinglevel:range(-1,3)' \ + 'reverseaddresslookups:string' \ + 'reverseclientiplookups:string' \ + 'scancleancache:string' \ + 'showweightedfound:string' \ + 'softrestart:string' \ + 'trickledelay:uinteger' \ + 'urlcacheage:uinteger' \ + 'urlcachenumber:uinteger' \ + 'urlipcfilename:string' \ + 'usecustombannedflash:string' \ + 'usecustombannedimage:string' \ + 'usexforwardedfor:string' \ + 'weightedphrasemode:range(0,2)' +} + +start_service() { + local config_file accessdeniedaddress bannediplist contentscanexceptions contentscannertimeout \ + createlistcachefiles custombannedflashfile custombannedimagefile deletedownloadedtempfiles \ + downloadmanager exceptioniplist filecachedir filtergroups filtergroupslist filterip filterports \ + forcequicksearch forwardedfor hexdecodecontent initialtrickledelay ipcfilename ipipcfilename \ + language languagedir logadblocks logchildprocesshandling logclienthostnames logconnectionhandlingerrors \ + logexceptionhits logfileformat loglevel loguseragent maxagechildren maxchildren maxcontentfilecachescansize \ + maxcontentfiltersize maxcontentramcachescansize maxips maxsparechildren maxuploadsize minchildren minsparechildren \ + nodaemon nologger nonstandarddelimiter perroomblockingdirectory phrasefiltermode prefercachedlists preforkchildren \ + preservecase proxyip proxyport proxytimeout recheckreplacedurls reportinglevel reverseaddresslookups \ + reverseclientiplookups scancleancache showweightedfound softrestart trickledelay urlcacheage urlcachenumber \ + urlipcfilename usecustombannedflash usecustombannedimage usexforwardedfor weightedphrasemode + + validate_dansguardian_section dansguardian || { + echo "validation failed" + return 1 + } + + mkdir -p $(dirname $CONFIGFILE) + ln -sf $config_file $(dirname $CONFIGFILE) + + echo "accessdeniedaddress = " $accessdeniedaddress > $CONFIGFILE + echo "bannediplist = " $bannediplist >> $CONFIGFILE + echo "contentscanexceptions = " $contentscanexceptions >> $CONFIGFILE + echo "contentscannertimeout = " $contentscannertimeout >> $CONFIGFILE + echo "createlistcachefiles = " $createlistcachefiles >> $CONFIGFILE + echo "custombannedflashfile = " $custombannedflashfile >> $CONFIGFILE + echo "custombannedimagefile = " $custombannedimagefile >> $CONFIGFILE + echo "deletedownloadedtempfiles = " $deletedownloadedtempfiles >> $CONFIGFILE + echo "downloadmanager = " $downloadmanager >> $CONFIGFILE + echo "exceptioniplist = " $exceptioniplist >> $CONFIGFILE + echo "filecachedir = " $filecachedir >> $CONFIGFILE + echo "filtergroups = " $filtergroups >> $CONFIGFILE + echo "filtergroupslist = " $filtergroupslist >> $CONFIGFILE + echo "filterip = " $filterip >> $CONFIGFILE + echo "filterports = " $filterports >> $CONFIGFILE + echo "forcequicksearch = " $forcequicksearch >> $CONFIGFILE + echo "forwardedfor = " $forwardedfor >> $CONFIGFILE + echo "hexdecodecontent = " $hexdecodecontent >> $CONFIGFILE + echo "initialtrickledelay = " $initialtrickledelay >> $CONFIGFILE + echo "ipcfilename = " $ipcfilename >> $CONFIGFILE + echo "ipipcfilename = " $ipipcfilename >> $CONFIGFILE + echo "language = " $language >> $CONFIGFILE + echo "languagedir = " $languagedir >> $CONFIGFILE + echo "logadblocks = " $logadblocks >> $CONFIGFILE + echo "logchildprocesshandling = " $logchildprocesshandling >> $CONFIGFILE + echo "logclienthostnames = " $logclienthostnames >> $CONFIGFILE + echo "logconnectionhandlingerrors = " $logconnectionhandlingerrors >> $CONFIGFILE + echo "logexceptionhits = " $logexceptionhits >> $CONFIGFILE + echo "logfileformat = " $logfileformat >> $CONFIGFILE + echo "loglevel = " $loglevel >> $CONFIGFILE + echo "loglocation = " $loglocation >> $CONFIGFILE + echo "loguseragent = " $loguseragent >> $CONFIGFILE + echo "maxagechildren = " $maxagechildren >> $CONFIGFILE + echo "maxchildren = " $maxchildren >> $CONFIGFILE + echo "maxcontentfilecachescansize = " $maxcontentfilecachescansize >> $CONFIGFILE + echo "maxcontentfiltersize = " $maxcontentfiltersize >> $CONFIGFILE + echo "maxcontentramcachescansize = " $maxcontentramcachescansize >> $CONFIGFILE + echo "maxips = " $maxips >> $CONFIGFILE + echo "maxsparechildren = " $maxsparechildren >> $CONFIGFILE + echo "maxuploadsize = " $maxuploadsize >> $CONFIGFILE + echo "minchildren = " $minchildren >> $CONFIGFILE + echo "minsparechildren = " $minsparechildren >> $CONFIGFILE + echo "nodaemon = " $nodaemon >> $CONFIGFILE + echo "nologger = " $nologger >> $CONFIGFILE + echo "nonstandarddelimiter = " $nonstandarddelimiter >> $CONFIGFILE + echo "perroomblockingdirectory = " $perroomblockingdirectory >> $CONFIGFILE + echo "phrasefiltermode = " $phrasefiltermode >> $CONFIGFILE + echo "prefercachedlists = " $prefercachedlists >> $CONFIGFILE + echo "preforkchildren = " $preforkchildren >> $CONFIGFILE + echo "preservecase = " $preservecase >> $CONFIGFILE + echo "proxyip = " $proxyip >> $CONFIGFILE + echo "proxyport = " $proxyport >> $CONFIGFILE + echo "proxytimeout = " $proxytimeout >> $CONFIGFILE + echo "recheckreplacedurls = " $recheckreplacedurls >> $CONFIGFILE + echo "reportinglevel = " $reportinglevel >> $CONFIGFILE + echo "reverseaddresslookups = " $reverseaddresslookups >> $CONFIGFILE + echo "reverseclientiplookups = " $reverseclientiplookups >> $CONFIGFILE + echo "scancleancache = " $scancleancache >> $CONFIGFILE + echo "showweightedfound = " $showweightedfound >> $CONFIGFILE + echo "softrestart = " $softrestart >> $CONFIGFILE + echo "trickledelay = " $trickledelay >> $CONFIGFILE + echo "urlcacheage = " $urlcacheage >> $CONFIGFILE + echo "urlcachenumber = " $urlcachenumber >> $CONFIGFILE + echo "urlipcfilename = " $urlipcfilename >> $CONFIGFILE + echo "usecustombannedflash = " $usecustombannedflash >> $CONFIGFILE + echo "usecustombannedimage = " $usecustombannedimage >> $CONFIGFILE + echo "usexforwardedfor = " $usexforwardedfor >> $CONFIGFILE + echo "weightedphrasemode = " $weightedphrasemode >> $CONFIGFILE + + procd_open_instance + procd_set_param command $PROG -N -c "$CONFIGFILE" + procd_set_param file $CONFIGFILE + procd_set_param respawn + procd_close_instance +} + +stop_service() +{ + dansguardian -s | awk -F':' '{ print $2}' | xargs kill -9 +} + +service_triggers() +{ + procd_add_reload_trigger "dansguardian" + procd_add_validation validate_dansguardian_section +} diff --git a/net/dansguardian/files/dansguardianf1.conf b/net/dansguardian/files/dansguardianf1.conf new file mode 100644 index 0000000..01e09ae --- /dev/null +++ b/net/dansguardian/files/dansguardianf1.conf @@ -0,0 +1,348 @@ +# DansGuardian filter group config file for version 2.12.0.0 + + +# Filter group mode +# This option determines whether members of this group have their web access +# unfiltered, filtered, or banned. This mechanism replaces the "banneduserlist" +# and "exceptionuserlist" files from previous versions. +# +# 0 = banned +# 1 = filtered +# 2 = unfiltered (exception) +# +# Only filter groups with a mode of 1 need to define phrase, URL, site, extension, +# mimetype and PICS lists; in other modes, these options are ignored to conserve +# memory. +# +# Defaults to 0 if unspecified. +# Unauthenticated users are treated as being in the first filter group. +groupmode = 1 + +# Filter group name +# Used to fill in the -FILTERGROUP- placeholder in the HTML template file, and to +# name the group in the access logs +# Defaults to empty string +#groupname = '' + +# Content filtering files location +bannedphraselist = '/etc/dansguardian/lists/bannedphraselist' +weightedphraselist = '/etc/dansguardian/lists/weightedphraselist' +exceptionphraselist = '/etc/dansguardian/lists/exceptionphraselist' +bannedsitelist = '/etc/dansguardian/lists/bannedsitelist' +greysitelist = '/etc/dansguardian/lists/greysitelist' +exceptionsitelist = '/etc/dansguardian/lists/exceptionsitelist' +bannedurllist = '/etc/dansguardian/lists/bannedurllist' +greyurllist = '/etc/dansguardian/lists/greyurllist' +exceptionurllist = '/etc/dansguardian/lists/exceptionurllist' +exceptionregexpurllist = '/etc/dansguardian/lists/exceptionregexpurllist' +bannedregexpurllist = '/etc/dansguardian/lists/bannedregexpurllist' +picsfile = '/etc/dansguardian/lists/pics' +contentregexplist = '/etc/dansguardian/lists/contentregexplist' +urlregexplist = '/etc/dansguardian/lists/urlregexplist' + +# Filetype filtering +# +# Blanket download blocking +# If enabled, all files will be blocked, unless they match the +# exceptionextensionlist or exceptionmimetypelist. +# These lists do not override virus scanning. +# Exception lists defined above override all types of filtering, including +# the blanket download block. +# Defaults to disabled. +# (on | off) +# +blockdownloads = off +exceptionextensionlist = '/etc/dansguardian/lists/exceptionextensionlist' +exceptionmimetypelist = '/etc/dansguardian/lists/exceptionmimetypelist' +# +# Use the following lists to block specific kinds of file downloads. +# The two exception lists above can be used to override these. +# +bannedextensionlist = '/etc/dansguardian/lists/bannedextensionlist' +bannedmimetypelist = '/etc/dansguardian/lists/bannedmimetypelist' +# +# In either file filtering mode, the following list can be used to override +# MIME type & extension blocks for particular domains & URLs (trusted download sites). +# +exceptionfilesitelist = '/etc/dansguardian/lists/exceptionfilesitelist' +exceptionfileurllist = '/etc/dansguardian/lists/exceptionfileurllist' + +# Categorise without blocking: +# Supply categorised lists here and the category string shall be logged against +# matching requests, but matching these lists does not perform any filtering +# action. +#logsitelist = '/etc/dansguardian/lists/logsitelist' +#logurllist = '/etc/dansguardian/lists/logurllist' +#logregexpurllist = '/etc/dansguardian/lists/logregexpurllist' + +# Outgoing HTTP header rules: +# Optional lists for blocking based on, and modification of, outgoing HTTP +# request headers. Format for headerregexplist is one modification rule per +# line, similar to content/URL modifications. Format for +# bannedregexpheaderlist is one regular expression per line, with matching +# headers causing a request to be blocked. +# Headers are matched/replaced on a line-by-line basis, not as a contiguous +# block. +# Use for example, to remove cookies or prevent certain user-agents. +headerregexplist = '/etc/dansguardian/lists/headerregexplist' +bannedregexpheaderlist = '/etc/dansguardian/lists/bannedregexpheaderlist' + +# Weighted phrase mode +# Optional; overrides the weightedphrasemode option in dansguardian.conf +# for this particular group. See documentation for supported values in +# that file. +#weightedphrasemode = 0 + +# Naughtiness limit +# This the limit over which the page will be blocked. Each weighted phrase is given +# a value either positive or negative and the values added up. Phrases to do with +# good subjects will have negative values, and bad subjects will have positive +# values. See the weightedphraselist file for examples. +# As a guide: +# 50 is for young children, 100 for old children, 160 for young adults. +naughtynesslimit = 50 + +# Search term blocking +# Search terms can be extracted from search URLs and filtered using the +# bannedphraselist, weightedphraselist and exceptionphraselist, with a separate +# threshold for blocking than that used for normal page content. +# To do this, the first two options below must be enabled. +# +# Search engine regular expression list +# List of regular expressions for matching search engine URLs. It is assumed +# that the search terms themselves will be contained within the first submatch +# of each expression. +#searchengineregexplist = '/etc/dansguardian/lists/searchengineregexplist' +# +# Search term limit +# The limit over which requests will be blocked for containing search terms +# which match the weightedphraselist. This should usually be lower than the +# 'naughtynesslimit' value above, because the amount of text being filtered +# is only a few words, rather than a whole page. +# This option must be uncommented if searchengineregexplist is uncommented. +# A value of 0 here indicates that search terms should be extracted, +# for logging/reporting purposes, but no filtering should be performed +# on the resulting text. +#searchtermlimit = 30 +# +# Search term lists +# If the three lines below are uncommented, search term blocking will use +# the banned, weighted & exception phrases from these lists, instead of using +# the same phrase lists as for page content. This is optional but recommended, +# as weights for individual phrases in the "normal" lists may not be +# appropriate for blocking when those phrases appear in a much smaller block +# of text. +# Please note that all or none of the below should be uncommented, not a +# mixture. +#bannedsearchtermlist = '/etc/dansguardian/lists/bannedsearchtermlist' +#weightedsearchtermlist = '/etc/dansguardian/lists/weightedsearchtermlist' +#exceptionsearchtermlist = '/etc/dansguardian/lists/exceptionsearchtermlist' + +# Category display threshold +# This option only applies to pages blocked by weighted phrase filtering. +# Defines the minimum score that must be accumulated within a particular +# category in order for it to show up on the block pages' category list. +# All categories under which the page scores positively will be logged; those +# that were not displayed to the user appear in brackets. +# +# -1 = display only the highest scoring category +# 0 = display all categories (default) +# > 0 = minimum score for a category to be displayed +categorydisplaythreshold = 0 + +# Embedded URL weighting +# When set to something greater than zero, this option causes URLs embedded within a +# page's HTML (from links, image tags, etc.) to be extracted and checked against the +# bannedsitelist and bannedurllist. Each link to a banned page causes the amount set +# here to be added to the page's weighting. +# The behaviour of this option with regards to multiple occurrences of a site/URL is +# affected by the weightedphrasemode setting. +# +# NB: Currently, this feature uses regular expressions that require the PCRE library. +# As such, it is only available if you compiled DansGuardian with '--enable-pcre=yes'. +# You can check compile-time options by running 'dansguardian -v'. +# +# Set to 0 to disable. +# Defaults to 0. +# WARNING: This option is highly CPU intensive! +embeddedurlweight = 0 + +# Enable PICS rating support +# +# Defaults to disabled +# (on | off) +enablepics = off + +# Temporary Denied Page Bypass +# This provides a link on the denied page to bypass the ban for a few minutes. To be +# secure it uses a random hashed secret generated at daemon startup. You define the +# number of seconds the bypass will function for before the deny will appear again. +# To allow the link on the denied page to appear you will need to edit the template.html +# or dansguardian.pl file for your language. +# 300 = enable for 5 minutes +# 0 = disable ( defaults to 0 ) +# -1 = enable but you require a separate program/CGI to generate a valid link +bypass = 0 + +# Temporary Denied Page Bypass Secret Key +# Rather than generating a random key you can specify one. It must be more than 8 chars. +# '' = generate a random one (recommended and default) +# 'Mary had a little lamb.' = an example +# '76b42abc1cd0fdcaf6e943dcbc93b826' = an example +bypasskey = '' + +# Infection/Scan Error Bypass +# Similar to the 'bypass' setting, but specifically for bypassing files scanned and found +# to be infected, or files that trigger scanner errors - for example, archive types with +# recognised but unsupported compression schemes, or corrupt archives. +# The option specifies the number of seconds for which the bypass link will be valid. +# 300 = enable for 5 minutes +# 0 = disable (default) +# -1 = enable, but require a separate program/CGI to generate a valid link +infectionbypass = 0 + +# Infection/Scan Error Bypass Secret Key +# Same as the 'bypasskey' option, but used for infection bypass mode. +infectionbypasskey = '' + +# Infection/Scan Error Bypass on Scan Errors Only +# Enable this option to allow infectionbypass links only when virus scanning fails, +# not when a file is found to contain a virus. +# on = enable (default and highly recommended) +# off = disable +infectionbypasserrorsonly = on + +# Disable content scanning +# If you enable this option you will disable content scanning for this group. +# Content scanning primarily is AV scanning (if enabled) but could include +# other types. +# (on|off) default = off. +disablecontentscan = off + +# Enable Deep URL Analysis +# When enabled, DG looks for URLs within URLs, checking against the bannedsitelist and +# bannedurllist. This can be used, for example, to block images originating from banned +# sites from appearing in Google Images search results, as the original URLs are +# embedded in the thumbnail GET requests. +# (on|off) default = off +deepurlanalysis = off + +# reportinglevel +# +# -1 = log, but do not block - Stealth mode +# 0 = just say 'Access Denied' +# 1 = report why but not what denied phrase +# 2 = report fully +# 3 = use HTML template file (accessdeniedaddress ignored) - recommended +# +# If defined, this overrides the global setting in dansguardian.conf for +# members of this filter group. +# +#reportinglevel = 3 + +# accessdeniedaddress is the address of your web server to which the cgi +# dansguardian reporting script was copied. Only used in reporting levels +# 1 and 2. +# +# This webserver must be either: +# 1. Non-proxied. Either a machine on the local network, or listed as an +# exception in your browser's proxy configuration. +# 2. Added to the exceptionsitelist. Option 1 is preferable; this option is +# only for users using both transparent proxying and a non-local server +# to host this script. +# +# If defined, this overrides the global setting in dansguardian.conf for +# members of this filter group. +# +#accessdeniedaddress = 'http://YOURSERVER.YOURDOMAIN/cgi-bin/dansguardian.pl' + +# HTML Template override +# If defined, this specifies a custom HTML template file for members of this +# filter group, overriding the global setting in dansguardian.conf. This is +# only used in reporting level 3. +# +# The default template file path is //template.html +# e.g. /usr/share/dansguardian/languages/ukenglish/template.html when using 'ukenglish' +# language. +# +# This option generates a file path of the form: +# // +# e.g. /usr/share/dansguardian/languages/ukenglish/custom.html +# +#htmltemplate = 'custom.html' + +# Email reporting - original patch by J. Gauthier + +# Use SMTP +# If on, will enable system wide events to be reported by email. +# need to configure mail program (see 'mailer' in global config) +# and email recipients +# default usesmtp = off +#!! Not compiled !!usesmtp = off + +# mailfrom +# who the email would come from +# example: mailfrom = 'dansguardian@mycompany.com' +#!! Not compiled !!mailfrom = '' + +# avadmin +# who the virus emails go to (if notify av is on) +# example: avadmin = 'admin@mycompany.com' +#!! Not compiled !!avadmin = '' + +# contentdmin +# who the content emails go to (when thresholds are exceeded) +# and contentnotify is on +# example: contentadmin = 'admin@mycompany.com' +#!! Not compiled !!contentadmin = '' + +# avsubject +# Subject of the email sent when a virus is caught. +# only applicable if notifyav is on +# default avsubject = 'dansguardian virus block' +#!! Not compiled !!avsubject = 'dansguardian virus block' + +# content +# Subject of the email sent when violation thresholds are exceeded +# default contentsubject = 'dansguardian violation' +#!! Not compiled !!contentsubject = 'dansguardian violation' + +# notifyAV +# This will send a notification, if usesmtp/notifyav is on, any time an +# infection is found. +# Important: If this option is off, viruses will still be recorded like a +# content infraction. +#!! Not compiled !!notifyav = off + +# notifycontent +# This will send a notification, if usesmtp is on, based on thresholds +# below +#!! Not compiled !!notifycontent = off + +# thresholdbyuser +# results are only predictable with user authenticated configs +# if enabled the violation/threshold count is kept track of by the user +#!! Not compiled !!thresholdbyuser = off + +#violations +# number of violations before notification +# setting to 0 will never trigger a notification +#!! Not compiled !!violations = 0 + +#threshold +# this is in seconds. If 'violations' occur in 'threshold' seconds, then +# a notification is made. +# if this is set to 0, then whenever the set number of violations are made a +# notifaction will be sent. +#!! Not compiled !!threshold = 0 + +#SSL certificate checking +# Check that ssl certificates for servers on https connections are valid +# and signed by a ca in the configured path +sslcertcheck = off + +#SSL man in the middle +# Forge ssl certificates for all sites, decrypt the data then re encrypt it +# using a different private key. Used to filter ssl sites +sslmitm = off + diff --git a/net/dansguardian/patches/001-compile.patch b/net/dansguardian/patches/001-compile.patch new file mode 100644 index 0000000..db8efa4 --- /dev/null +++ b/net/dansguardian/patches/001-compile.patch @@ -0,0 +1,29 @@ +--- a/configure ++++ b/configure +@@ -827,7 +827,7 @@ sysconfdir='${prefix}/etc' + sharedstatedir='${prefix}/com' + localstatedir='${prefix}/var' + includedir='${prefix}/include' +-oldincludedir='/usr/include' ++oldincludedir='${prefix}/usr/include' + docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' + infodir='${datarootdir}/info' + htmldir='${docdir}' +@@ -5265,7 +5265,7 @@ $as_echo_n "checking for zlib... " >&6; + # Check whether --with-zlib was given. + if test "${with_zlib+set}" = set; then : + withval=$with_zlib; # check for header & func (in library) in given prefix +- CPPFLAGS="${CPPFLAGS} -I${withval}/include" ++ CPPFLAGS="${CPPFLAGS}" + if test "x$staticzlib" = "xtrue"; then + LIBS="-Bstatic -L${withval} -lz -Bdynamic ${LIBS}" + else +@@ -7095,7 +7095,7 @@ $as_echo "#define ENABLE_NTLM /**/" >>co + if test "${with_libiconv+set}" = set; then : + withval=$with_libiconv; # check for header & func (in library) in given prefix + if test "x$withval" != "x"; then +- CPPFLAGS="${CPPFLAGS} -I${withval}/include" ++ CPPFLAGS="${CPPFLAGS}" + LIBS="-L${withval}/lib -liconv ${LIBS}" + else + LIBS="-liconv ${LIBS}" diff --git a/net/darkstat/Makefile b/net/darkstat/Makefile new file mode 100644 index 0000000..027ad36 --- /dev/null +++ b/net/darkstat/Makefile @@ -0,0 +1,66 @@ +# +# Copyright (C) 2007-2016 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:=darkstat +PKG_VERSION:=3.0.719 +PKG_RELEASE:=1 + +PKG_MAINTAINER:=Jean-Michel Lacroix + +PKG_LICENSE:=GPL-2.0 BSD-ISC +PKG_LICENSE_FILES:=COPYING.GPL LICENSE + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://unix4lyfe.org/darkstat +PKG_MD5SUM:=963145de05cb21f4d93a9c244beeaea0 + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/darkstat + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpcap +zlib + TITLE:=Network bandwidth monitor + URL:=http://unix4lyfe.org/darkstat/ +endef + +define Package/darkstat/description +darkstat is a packet sniffer that runs as a background process on a cable/DSL +router, gathers all sorts of statistics about network usage, and serves them +over HTTP. +endef + +define Package/darkstat/conffiles +/etc/config/darkstat +endef + +CONFIGURE_ARGS += \ + --disable-debug \ + --with-chroot-dir=/var/empty + +TARGET_CFLAGS += -std=gnu99 + +define Build/Compile + $(HOSTCC) $(PKG_BUILD_DIR)/static/c-ify.c \ + -o $(PKG_BUILD_DIR)/c-ify + $(call Build/Compile/Default) +endef + +define Package/darkstat/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/darkstat $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/darkstat.init $(1)/etc/init.d/darkstat + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/darkstat.config $(1)/etc/config/darkstat +endef + +$(eval $(call BuildPackage,darkstat)) diff --git a/net/darkstat/files/darkstat.config b/net/darkstat/files/darkstat.config new file mode 100644 index 0000000..ba7c1c2 --- /dev/null +++ b/net/darkstat/files/darkstat.config @@ -0,0 +1,20 @@ +config darkstat + option interface 'lan' + option syslog false + option verbose true + option no_daemon false + option no_promisc false + option no_dns false + option no_macs false + option no_lastseen false +# option httpaddr '0.0.0.0' +# option httpport '667' +# option network_filter 'not (src net 192.168.1 and dst net 192.168.1)' +# option network_netmask '192.168.1.0/255.255.255.0' + option local_only false +# option hosts_max '1000' +# option hosts_keep '500' +# option ports_max '60' +# option ports_keep '30' +# option highest_port '65534' + diff --git a/net/darkstat/files/darkstat.init b/net/darkstat/files/darkstat.init new file mode 100755 index 0000000..27d063e --- /dev/null +++ b/net/darkstat/files/darkstat.init @@ -0,0 +1,97 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2007-2016 OpenWrt.org + +START=60 +APP=darkstat +RUN_D=/var/empty +PID_F=$RUN_D/darkstat.pid + +SYSLOG="" +VERBOSE="" +NODAEMON="" +NOPROMISC="" +NODNS="" +NOMACS="" +NOLASTSEEN="" +LOCAL="" +paramstr="" + +export_bool () { + local option="$1" + local section="$2" + local _keystr="$3" + local _loctmp + paramstr="" + config_get_bool _loctmp "$section" "$option" + if [ -n "$_loctmp" ]; then + if [ 1 -eq "$_loctmp" ]; then + paramstr="${_keystr} " + fi + fi +} + +start() { + mkdir -p $RUN_D + . /lib/functions/network.sh + config_load darkstat + config_foreach start_darkstat darkstat +} + +start_darkstat() { + local cfg="$1" + config_get interface $cfg interface + export_bool syslog $cfg "--syslog" + SYSLOG=$paramstr + export_bool verbose $cfg "--verbose" + VERBOSE=$paramstr + export_bool no_daemon $cfg "--no-daemon" + NODAEMON=$paramstr + export_bool no_promisc $cfg "--no-promisc" + NOPROMISC=$paramstr + export_bool no_dns $cfg "--no-dns" + NODNS=$paramstr + export_bool no_macs $cfg "--no-macs" + NOMACS=$paramstr + export_bool no_lastseen $cfg "--no-lastseen" + NOLASTSEEN=$paramstr + config_get httpaddr $cfg httpaddr + config_get httpport $cfg httpport + config_get network_filter $cfg network_filter + config_get network_netmask $cfg network_netmask + export_bool local_only $cfg "--local-only" + LOCAL=$paramstr + config_get hosts_max $cfg hosts_max + config_get hosts_keep $cfg hosts_keep + config_get ports_max $cfg ports_max + config_get ports_keep $cfg ports_keep + config_get highest_port $cfg highest_port + + + network_get_device ifname "$interface" && { + /usr/sbin/$APP -i "$ifname" \ + ${SYSLOG} \ + ${VERBOSE} \ + ${NODAEMON} \ + ${NOPROMISC} \ + ${NODNS} \ + ${NOMACS} \ + ${NOLASTSEEN} \ + ${httpaddr:+-b "$httpaddr"} \ + ${httpport:+-p "$httpport"} \ + ${network_filter:+-f "$network_filter"} \ + ${network_netmask:+-l "$network_netmask"} \ + ${LOCAL} \ + ${hosts_max:+--hosts-max "$hosts_max"} \ + ${hosts_keep:+--hosts-keep "$hosts_keep"} \ + ${ports_max:+--ports-max "$ports_max"} \ + ${ports_keep:+--ports-keep "$ports_keep"} \ + ${highest_port:+--highest-port "$highest_port"} \ + --chroot $RUN_D \ + --pidfile $PID_F + } +} + +stop() { + start-stop-daemon -K -n $APP -p $PID_F -s TERM + rm -f $PID_F +} diff --git a/net/darkstat/patches/100-do-not-use-NI_IDN.patch b/net/darkstat/patches/100-do-not-use-NI_IDN.patch new file mode 100644 index 0000000..7f7eecd --- /dev/null +++ b/net/darkstat/patches/100-do-not-use-NI_IDN.patch @@ -0,0 +1,12 @@ +--- a/dns.c ++++ b/dns.c +@@ -347,9 +347,6 @@ dns_main(void) + + reply.addr = ip; + flags = NI_NAMEREQD; +-# ifdef NI_IDN +- flags |= NI_IDN; +-# endif + switch (ip.family) { + case IPv4: + sin.sin_family = AF_INET; diff --git a/net/davfs2/Makefile b/net/davfs2/Makefile new file mode 100644 index 0000000..4e1f092 --- /dev/null +++ b/net/davfs2/Makefile @@ -0,0 +1,71 @@ +# +# Copyright (C) 2006-2015 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:=davfs2 +PKG_VERSION:=1.5.4 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://download.savannah.gnu.org/releases/davfs2/ +PKG_MD5SUM:=c9f0b557275b7ec88fec751bf22f30cf + +PKG_FIXUP:=gettext-version autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/davfs2 + SECTION:=net + CATEGORY:=Network + SUBMENU:=Filesystem + DEPENDS=+libneon +kmod-fuse +libfuse + TITLE:=Mount a WebDAV resource as a regular file system. + URL:=http://savannah.nongnu.org/projects/davfs2/ + MAINTAINER:=Federico Di Marco +endef + +define Package/davfs2/description + Web Distributed Authoring and Versioning (WebDAV), an extension to the HTTP-protocol, + allows authoring of resources on a remote web server.davfs2 provides the ability to + access such resources like a typical filesystem, allowing for use by standard + applications with no built-in support for WebDAV. + + davfs2 is designed to fully integrate into the filesystem semantics of Unix-like + systems (mount, umount, etc.). davfs2 makes mounting by unprivileged users as easy + and secure as possible. + + davfs2 does extensive caching to make the file system responsive, to avoid + unnecessary network traffic and to prevent data loss, and to cope for slow or + unreliable connections. + + davfs2 will work with most WebDAV servers needing little or no configuration. +endef + +define Package/davfs2/conffiles +/etc/davfs2/davfs2.conf +endef + +TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include + +TARGET_CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE + +CONFIGURE_VARS += \ + LDFLAGS="$(TARGET_LDFLAGS) -L$(TOOLCHAIN_DIR)/usr/lib -L$(TOOLCHAIN_DIR)/lib" + +CONFIGURE_ARGS += --with-neon="$(STAGING_DIR)/usr" + +define Package/davfs2/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mount.davfs $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/umount.davfs $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DIR) $(1)/etc/davfs2 + $(INSTALL_DATA) files/$(PKG_NAME).conf $(1)/etc/davfs2 +endef + +$(eval $(call BuildPackage,davfs2)) diff --git a/net/davfs2/files/davfs2.conf b/net/davfs2/files/davfs2.conf new file mode 100644 index 0000000..4cf501b --- /dev/null +++ b/net/davfs2/files/davfs2.conf @@ -0,0 +1,9 @@ +# +# davfs2 configuration file +# please see http://linux.die.net/man/5/davfs2.conf for details +# + +dav_user nobody +dav_group nogroup +cache_dir /tmp/davfs2 +cache_size 4 diff --git a/net/davfs2/patches/010-main_code_fix.patch b/net/davfs2/patches/010-main_code_fix.patch new file mode 100644 index 0000000..d91336d --- /dev/null +++ b/net/davfs2/patches/010-main_code_fix.patch @@ -0,0 +1,22 @@ +--- a/src/cache.c ++++ b/src/cache.c +@@ -58,7 +58,7 @@ + #ifdef HAVE_SYS_TYPES_H + #include + #endif +-#include ++#include + + #include + #include +--- a/src/webdav.c ++++ b/src/webdav.c +@@ -2033,7 +2033,7 @@ ssl_verify(void *userdata, int failures, + len = getline(&s, &n, stdin); + if (len < 0) + abort(); +- if (rpmatch(s) > 0) ++ if ((s[0]=='y' || s[0]=='Y') > 0) + ret = 0; + free(s); + } diff --git a/net/davfs2/patches/100-musl-compat.patch b/net/davfs2/patches/100-musl-compat.patch new file mode 100644 index 0000000..e819cbc --- /dev/null +++ b/net/davfs2/patches/100-musl-compat.patch @@ -0,0 +1,194 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -42,7 +42,7 @@ DAV_CHECK_NEON + # Checks for header files. + AC_HEADER_DIRENT + AC_HEADER_STDC +-AC_CHECK_HEADERS([fcntl.h libintl.h langinfo.h limits.h locale.h mntent.h stddef.h stdint.h stdlib.h string.h sys/file.h sys/mount.h sys/time.h syslog.h termios.h unistd.h utime.h]) ++AC_CHECK_HEADERS([error.h fcntl.h libintl.h langinfo.h limits.h locale.h mntent.h stddef.h stdint.h stdlib.h string.h sys/file.h sys/mount.h sys/time.h sys/select.h sys/types.h syslog.h termios.h unistd.h utime.h]) + + # Checks for typedefs, structures, and compiler characteristics. + AC_C_CONST +@@ -78,7 +78,7 @@ AC_FUNC_SELECT_ARGTYPES + AC_FUNC_STRFTIME + AC_FUNC_STAT + AC_FUNC_UTIME_NULL +-AC_CHECK_FUNCS([endpwent ftruncate getmntent memset mkdir nl_langinfo rpmatch select setlocale strcasecmp strchr strdup strerror strpbrk strrchr strstr strtol strtoull utime]) ++AC_CHECK_FUNCS([endpwent ftruncate getmntent memset mkdir nl_langinfo rpmatch select setlocale strcasecmp strchr strdup strerror strpbrk strrchr strstr strtol strtoull utime canonicalize_file_name fopencookie]) + + # Misc. + DAV_DEFAULTS +--- a/src/cache.c ++++ b/src/cache.c +@@ -19,12 +19,12 @@ + + + #include "config.h" ++#include "compat.h" + + #ifdef HAVE_DIRENT_H + #include + #endif + #include +-#include + #ifdef HAVE_FCNTL_H + #include + #endif +--- a/src/dav_fuse.c ++++ b/src/dav_fuse.c +@@ -47,6 +47,9 @@ + #ifdef HAVE_SYS_STAT_H + #include + #endif ++#ifdef HAVE_SYS_SELECT_H ++#include ++#endif + + #include "defaults.h" + #include "mount_davfs.h" +--- a/src/kernel_interface.c ++++ b/src/kernel_interface.c +@@ -19,8 +19,8 @@ + + + #include "config.h" ++#include "compat.h" + +-#include + #ifdef HAVE_FCNTL_H + #include + #endif +@@ -51,6 +51,9 @@ + #ifdef HAVE_SYS_STAT_H + #include + #endif ++#ifdef HAVE_SYS_TYPES_H ++#include ++#endif + #include + + #include "defaults.h" +--- a/src/mount_davfs.c ++++ b/src/mount_davfs.c +@@ -19,10 +19,10 @@ + + + #include "config.h" ++#include "compat.h" + + #include + #include +-#include + #ifdef HAVE_FCNTL_H + #include + #endif +--- a/src/umount_davfs.c ++++ b/src/umount_davfs.c +@@ -19,8 +19,8 @@ + + + #include "config.h" ++#include "compat.h" + +-#include + #include + #include + #ifdef HAVE_LIBINTL_H +--- a/src/webdav.c ++++ b/src/webdav.c +@@ -19,9 +19,9 @@ + + + #include "config.h" ++#include "compat.h" + + #include +-#include + #ifdef HAVE_FCNTL_H + #include + #endif +@@ -368,6 +368,7 @@ dav_init_webdav(const dav_args *args) + error(EXIT_FAILURE, errno, _("socket library initialization failed")); + + if (args->neon_debug & ~NE_DBG_HTTPPLAIN) { ++#ifdef HAVE_FOPENCOOKIE + char *buf = malloc(log_bufsize); + cookie_io_functions_t *log_func = malloc(sizeof(cookie_io_functions_t)); + if (!log_func) abort(); +@@ -380,6 +381,9 @@ dav_init_webdav(const dav_args *args) + error(EXIT_FAILURE, errno, + _("can't open stream to log neon-messages")); + ne_debug_init(log_stream, args->neon_debug); ++#else ++ error(EXIT_FAILURE, 0, "neon debugging unsupported"); ++#endif + } + + session = ne_session_create(args->scheme, args->host, args->port); +--- /dev/null ++++ b/src/compat.h +@@ -0,0 +1,64 @@ ++#ifndef _COMPAT_H ++#define _COMPAT_H ++ ++#ifndef _PATH_MOUNTED ++# define _PATH_MOUNTED "/proc/mounts" ++#endif ++ ++#ifndef _PATH_MNTTAB ++# define _PATH_MNTTAB "/etc/fstab" ++#endif ++ ++#ifdef HAVE_ERROR_H ++# include ++#else ++# include ++# include ++# include ++# include ++static void error_at_line(int status, int errnum, const char *filename, ++ unsigned int linenum, const char *format, ...) ++{ ++ va_list ap; ++ ++ fflush(stdout); ++ ++ if (filename != NULL) ++ fprintf(stderr, "%s:%u: ", filename, linenum); ++ ++ va_start(ap, format); ++ vfprintf(stderr, format, ap); ++ va_end(ap); ++ ++ if (errnum != 0) ++ fprintf(stderr, ": %s", strerror(errnum)); ++ ++ fprintf(stderr, "\n"); ++ ++ if (status != 0) ++ exit(status); ++} ++ ++#define error(status, errnum, format...) \ ++ error_at_line(status, errnum, NULL, 0, format) ++ ++#endif /* HAVE_ERROR_H */ ++ ++#ifndef HAVE_CANONICALIZE_FILE_NAME ++#include ++#include ++#include ++static char * canonicalize_file_name(const char *path) ++{ ++ char buf[PATH_MAX] = { }; ++ ++ snprintf(buf, sizeof(buf) - 1, "%s", path); ++ ++ if (!realpath(path, buf)) ++ return NULL; ++ ++ return strdup(buf); ++} ++#endif ++ ++#endif /* _COMPAT_H */ diff --git a/net/davfs2/patches/200-davfs2-1.5.4-no-forced-stack-protector.patch b/net/davfs2/patches/200-davfs2-1.5.4-no-forced-stack-protector.patch new file mode 100644 index 0000000..f581e05 --- /dev/null +++ b/net/davfs2/patches/200-davfs2-1.5.4-no-forced-stack-protector.patch @@ -0,0 +1,12 @@ +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -32,8 +32,7 @@ mount_davfs_SOURCES = cache.c dav_coda.c + kernel_interface.h mount_davfs.h webdav.h + umount_davfs_SOURCES = umount_davfs.c defaults.h + +-AM_CFLAGS = -Wall -Werror=format-security \ +- -fstack-protector-strong --param=ssp-buffer-size=4 ++AM_CFLAGS = -Wall -Werror=format-security + DEFS = -DPROGRAM_NAME=\"mount.davfs\" \ + -DDAV_SYS_CONF_DIR=\"$(pkgsysconfdir)\" \ + -DDAV_LOCALSTATE_DIR=\"$(dav_localstatedir)\" \ diff --git a/net/ddns-scripts/Makefile b/net/ddns-scripts/Makefile new file mode 100755 index 0000000..6be7846 --- /dev/null +++ b/net/ddns-scripts/Makefile @@ -0,0 +1,364 @@ +# +# Copyright (C) 2008-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=ddns-scripts +# Version == major.minor.patch +# increase on new functionality (minor) or patches (patch) +PKG_VERSION:=2.7.6 +# Release == build +# increase on changes of services files or tld_names.dat +PKG_RELEASE:=4 + +PKG_LICENSE:=GPL-2.0 +PKG_MAINTAINER:=Christian Schoenebeck + +include $(INCLUDE_DIR)/package.mk + +# no default dependencies +PKG_DEFAULT_DEPENDS= + +define Package/$(PKG_NAME)/Default + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names + PKGARCH:=all +endef + +###### ************************************************************************* +define Package/$(PKG_NAME) + $(call Package/$(PKG_NAME)/Default) + TITLE:=Dynamic DNS Client scripts (with IPv6 support) +endef +# shown in LuCI package description +define Package/$(PKG_NAME)/description + Dynamic DNS Client scripts (with IPv6 support) - Info: http://wiki.openwrt.org/doc/howto/ddns.client +endef +# shown in menuconfig +define Package/$(PKG_NAME)/config + help + A highly configurable set of scripts for doing dynamic dns updates. + - IPv6 support + - DNS server support + - Glue Record support (require BIND host or KNOT host) + - DNS requests via TCP + - Proxy server support + - log file support + - support to run once + Version: $(PKG_VERSION)-$(PKG_RELEASE) + Info : http://wiki.openwrt.org/doc/howto/ddns.client +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_cloudflare + $(call Package/$(PKG_NAME)/Default) + TITLE:=CloudFlare.com API v1 (deprecated) + DEPENDS:=$(PKG_NAME) +endef +define Package/$(PKG_NAME)_cloudflare/description + Dynamic DNS Client scripts extension for CloudFlare.com API-v1 (deprecated) +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_cloudflare.com-v4 + $(call Package/$(PKG_NAME)/Default) + TITLE:=CloudFlare.com API v4 (require cURL) + DEPENDS:=$(PKG_NAME) +curl +endef +define Package/$(PKG_NAME)_cloudflare.com-v4/description + Dynamic DNS Client scripts extension for CloudFlare.com API-v4 (require/install cURL) +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_godaddy.com-v1 + $(call Package/$(PKG_NAME)/Default) + TITLE:=GoDaddy.com (require cURL) + DEPENDS:=$(PKG_NAME) +curl +endef +define Package/$(PKG_NAME)_godaddy.com-v1/description + Dynamic DNS Client scripts extension for GoDaddy.com (require/install cURL) +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_no-ip_com + $(call Package/$(PKG_NAME)/Default) + TITLE:=DDNS extension for No-IP.com + DEPENDS:=$(PKG_NAME) +endef +define Package/$(PKG_NAME)_no-ip_com/description + Dynamic DNS Client scripts extension for No-IP.com +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_nsupdate + $(call Package/$(PKG_NAME)/Default) + TITLE:=DDNS extension using Bind nsupdate + DEPENDS:=$(PKG_NAME) +bind-client +endef +define Package/$(PKG_NAME)_nsupdate/description + Dynamic DNS Client scripts extension for direct updates using Bind nsupdate +endef +define Package/$(PKG_NAME)_nsupdate/config + help + The script directly updates a PowerDNS (or maybe bind server) via nsupdate + from bind-client package. It requires + "option dns_server" to be set to the server to be used by nsupdate. + "option username" should be set to the key name and + "option password" to the base64 encoded shared secret. + +endef + +###### ************************************************************************* +define Build/Configure +endef +define Build/Compile + $(CP) ./files $(PKG_BUILD_DIR) + for FILE in `find $(PKG_BUILD_DIR)/files -type f`; do \ + $(SED) 's/^\s*#/#/' \ + -e '/^#\s\|^#$$$$/d' \ + -e 's/\s#\s.*$$$$//' \ + -e 's/\s*$$$$//' \ + -e '/^\/\/\s/d' \ + -e '/^\s*$$$$/d' $$$$FILE; \ + done + # ensure that VERSION inside dynamic_dns_functions.sh reflect PKG_VERSION of Makefile + $(SED) '/^VERSION=*/s/.*/VERSION="$(PKG_VERSION)"/' $(PKG_BUILD_DIR)/files/dynamic_dns_functions.sh + $(CP) ./tools $(PKG_BUILD_DIR) + chmod 755 $(PKG_BUILD_DIR)/tools/* + $(PKG_BUILD_DIR)/tools/public_suffix_list.sh + mv -f $(PKG_BUILD_DIR)/tools/public_suffix_list.dat.gz \ + $(PKG_BUILD_DIR)/files/public_suffix_list.dat.gz +endef + +define Package/$(PKG_NAME)/conffiles +/etc/config/ddns +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)/preinst + #!/bin/sh + # if NOT run buildroot and PKG_UPGRADE then stop service + [ -z "$${IPKG_INSTROOT}" -a "$${PKG_UPGRADE}" = "1" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.hotplug $(1)/etc/hotplug.d/iface/95-ddns + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.init $(1)/etc/init.d/ddns + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) $(PKG_BUILD_DIR)/files/ddns.config $(1)/etc/config/ddns + + $(INSTALL_DIR) $(1)/etc/ddns + $(INSTALL_DATA) $(PKG_BUILD_DIR)/files/services* $(1)/etc/ddns + + $(INSTALL_DIR) $(1)/usr/lib/ddns + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/dynamic_dns_*.sh $(1)/usr/lib/ddns +endef +define Package/$(PKG_NAME)/postinst + #!/bin/sh + # if NOT run buildroot and PKG_UPGRADE then (re)start service if enabled + [ -z "$${IPKG_INSTROOT}" -a "$${PKG_UPGRADE}" = "1" ] \ + && /etc/init.d/ddns enabled \ + && /etc/init.d/ddns start >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)/prerm + #!/bin/sh + # if run within buildroot exit + [ -n "$${IPKG_INSTROOT}" ] && exit 0 + + # stop running scripts + /etc/init.d/ddns stop + /etc/init.d/ddns disable + + # clear LuCI indexcache + rm -f /tmp/luci-indexcache >/dev/null 2>&1 + + exit 0 # suppress errors +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_cloudflare/preinst + #!/bin/sh + # if NOT run buildroot then stop service + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_cloudflare/install + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_cloudflare + $(INSTALL_DIR) $(1)/usr/lib/ddns + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_cloudflare_com_v1.sh $(1)/usr/lib/ddns + $(INSTALL_DIR) $(1)/usr/share + $(INSTALL_DATA) $(PKG_BUILD_DIR)/files/public_suffix_list.dat.gz $(1)/usr/share +endef +define Package/$(PKG_NAME)_cloudflare/postinst + #!/bin/sh + # if NOT upgrading add entries + [ "$${PKG_UPGRADE}" = "1" ] || { + printf "%s\\t%s\\n" '"cloudflare.com-v1"' '"update_cloudflare_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services + printf "%s\\t%s\\n" '"cloudflare.com-v1"' '"update_cloudflare_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6 + } + # on real system restart service if enabled + [ -z "$${IPKG_INSTROOT}" ] \ + && /etc/init.d/ddns enabled \ + && /etc/init.d/ddns start >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_cloudflare/prerm + #!/bin/sh + # if NOT run buildroot then stop service + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + /bin/sed -i '/cloudflare\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1 + /bin/sed -i '/cloudflare\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1 + exit 0 # suppress errors +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_cloudflare.com-v4/preinst + #!/bin/sh + # if NOT run buildroot then stop service + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_cloudflare.com-v4/install + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_cloudflare.com-v4 + $(INSTALL_DIR) $(1)/usr/lib/ddns + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_cloudflare_com_v4.sh $(1)/usr/lib/ddns +endef +define Package/$(PKG_NAME)_cloudflare.com-v4/postinst + #!/bin/sh + # if NOT upgrading add entries + [ "$${PKG_UPGRADE}" = "1" ] || { + printf "%s\\t%s\\n" '"cloudflare.com-v4"' '"update_cloudflare_com_v4.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services + printf "%s\\t%s\\n" '"cloudflare.com-v4"' '"update_cloudflare_com_v4.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6 + } + # on real system restart service if enabled + [ -z "$${IPKG_INSTROOT}" ] \ + && /etc/init.d/ddns enabled \ + && /etc/init.d/ddns start >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_cloudflare.com-v4/prerm + #!/bin/sh + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + /bin/sed -i '/cloudflare\.com-v4/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1 + /bin/sed -i '/cloudflare\.com-v4/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1 + exit 0 # suppress errors +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_godaddy.com-v1/preinst + #!/bin/sh + # if NOT run buildroot then stop service + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_godaddy.com-v1/install + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_godaddy.com-v1 + $(INSTALL_DIR) $(1)/usr/lib/ddns + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_godaddy_com_v1.sh $(1)/usr/lib/ddns +endef +define Package/$(PKG_NAME)_godaddy.com-v1/postinst + #!/bin/sh + # if NOT upgrading add entries + [ "$${PKG_UPGRADE}" = "1" ] || { + printf "%s\\t%s\\n" '"godaddy.com-v1"' '"update_godaddy_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services + printf "%s\\t%s\\n" '"godaddy.com-v1"' '"update_godaddy_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6 + } + # on real system restart service if enabled + [ -z "$${IPKG_INSTROOT}" ] \ + && /etc/init.d/ddns enabled \ + && /etc/init.d/ddns start >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_godaddy.com-v1/prerm + #!/bin/sh + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + /bin/sed -i '/godaddy\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1 + /bin/sed -i '/godaddy\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1 + exit 0 # suppress errors +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_no-ip_com/preinst + #!/bin/sh + # if NOT run buildroot then stop service + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_no-ip_com/install + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_no-ip_com + $(INSTALL_DIR) $(1)/usr/lib/ddns + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_no-ip_com.sh $(1)/usr/lib/ddns +endef +define Package/$(PKG_NAME)_no-ip_com/postinst + #!/bin/sh + # if NOT upgrading add entries + [ "$${PKG_UPGRADE}" = "1" ] || { + printf "%s\\t%s\\n" '"no-ip.com"' '"update_no-ip_com.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services + } + # on real system restart service if enabled + [ -z "$${IPKG_INSTROOT}" ] \ + && /etc/init.d/ddns enabled \ + && /etc/init.d/ddns start >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_no-ip_com/prerm + #!/bin/sh + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + /bin/sed -i '/no-ip\.com/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1 + exit 0 # suppress errors +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_nsupdate/preinst + #!/bin/sh + # if NOT run buildroot then stop service + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_nsupdate/install + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_nsupdate + $(INSTALL_DIR) $(1)/usr/lib/ddns + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_nsupdate.sh $(1)/usr/lib/ddns +endef +define Package/$(PKG_NAME)_nsupdate/postinst + #!/bin/sh + # if NOT upgrading add entries + [ "$${PKG_UPGRADE}" = "1" ] || { + printf "%s\\t%s\\n" '"bind-nsupdate"' '"update_nsupdate.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services + printf "%s\\t%s\\n" '"bind-nsupdate"' '"update_nsupdate.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6 + } + # on real system restart service if enabled + [ -z "$${IPKG_INSTROOT}" ] \ + && /etc/init.d/ddns enabled \ + && /etc/init.d/ddns start >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_nsupdate/prerm + #!/bin/sh + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + /bin/sed -i '/bind-nsupdate/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1 + /bin/sed -i '/bind-nsupdate/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1 + exit 0 # suppress errors +endef + +###### ************************************************************************* +$(eval $(call BuildPackage,$(PKG_NAME))) +$(eval $(call BuildPackage,$(PKG_NAME)_cloudflare)) +$(eval $(call BuildPackage,$(PKG_NAME)_cloudflare.com-v4)) +$(eval $(call BuildPackage,$(PKG_NAME)_godaddy.com-v1)) +$(eval $(call BuildPackage,$(PKG_NAME)_no-ip_com)) +$(eval $(call BuildPackage,$(PKG_NAME)_nsupdate)) diff --git a/net/ddns-scripts/files/ddns.config b/net/ddns-scripts/files/ddns.config new file mode 100644 index 0000000..6d6b810 --- /dev/null +++ b/net/ddns-scripts/files/ddns.config @@ -0,0 +1,32 @@ +# +# Please read http://wiki.openwrt.org/doc/uci/ddns +# +config ddns "global" + option ddns_dateformat "%F %R" +# option ddns_rundir "/var/run/ddns" +# option ddns_logdir "/var/log/ddns" + option ddns_loglines "250" + option upd_privateip "0" + + +config service "myddns_ipv4" + option service_name "dyndns.org" + option lookup_host "yourhost.example.com" + option domain "yourhost.example.com" + option username "your_username" + option password "your_password" + option interface "wan" + option ip_source "network" + option ip_network "wan" + +config service "myddns_ipv6" + option update_url "http://[USERNAME]:[PASSWORD]@your.provider.net/nic/update?hostname=[DOMAIN]&myip=[IP]" + option lookup_host "yourhost.example.com" + option domain "yourhost.example.com" + option username "your_username" + option password "your_password" + option use_ipv6 "1" + option interface "wan6" + option ip_source "network" + option ip_network "wan6" + diff --git a/net/ddns-scripts/files/ddns.defaults b/net/ddns-scripts/files/ddns.defaults new file mode 100755 index 0000000..8631208 --- /dev/null +++ b/net/ddns-scripts/files/ddns.defaults @@ -0,0 +1,99 @@ +#!/bin/sh + +# using function to not confuse function calls with existing ones inside /lib/functions.sh +update_ddns_config() { + udc_uci="$(which uci) -q" # ignore errors + udc_pkg="ddns" + udc_cfg="" + udc_name="" + udc_var="" + udc_val="" + package() { return 0; } + config () { + udc_cfg="$1" + udc_name="$2" + + # Type = ddns Name = global + if [ "$udc_cfg" = "$udc_pkg" -a "$udc_name" = "global" ]; then + option() { return 0; } + # rename options + $udc_uci rename $udc_pkg.$udc_name.allow_local_ip="upd_privateip" + $udc_uci rename $udc_pkg.$udc_name.date_format="ddns_dateformat" + $udc_uci rename $udc_pkg.$udc_name.log_dir="ddns_logdir" + $udc_uci rename $udc_pkg.$udc_name.log_lines="ddns_loglines" + $udc_uci rename $udc_pkg.$udc_name.run_dir="ddns_rundir" + + # Type = service Name = ??? + elif [ "$udc_cfg" = "service" ]; then + option() { + udc_var="$1"; shift + udc_val="$*" + # fix some option service_name values + case "$udc_var" in + service_name) + case "$udc_val" in + freedns\.afraid\.org|afraid\.org) + $udc_uci set $udc_pkg.$udc_name.$udc_var="afraid.org-keyauth";; + Bind-nsupdate) + $udc_uci set $udc_pkg.$udc_name.$udc_var="bind-nsupdate";; + CloudFlare|cloudflare\.com) + $udc_uci set $udc_pkg.$udc_name.$udc_var="cloudflare.com-v1";; + dyndns\.org|dyndns\.com) + $udc_uci set $udc_pkg.$udc_name.$udc_var="dyn.com";; + free\.editdns\.net) + $udc_uci set $udc_pkg.$udc_name.$udc_var="editdns.net";; + domains\.google\.com) + $udc_uci set $udc_pkg.$udc_name.$udc_var="google.com";; + loopia\.com) + $udc_uci set $udc_pkg.$udc_name.$udc_var="loopia.se";; + NoIP\.com|No-IP\.com) + $udc_uci set $udc_pkg.$udc_name.$udc_var="no-ip.com";; + spdns\.de) + $udc_uci set $udc_pkg.$udc_name.$udc_var="spdyn.de";; + strato\.de) + $udc_uci set $udc_pkg.$udc_name.$udc_var="strato.com";; + *) + # all others leave unchanged + ;; + esac + # rename option service_name to option upd_provider +# $udc_uci rename $udc_pkg.$udc_name.$udc_var="upd_provider" + ;; + *) + # leave all other options currently unchanged + ;; + esac + return 0 + } + return 0 + + # ignore unknown + else + return 0 + fi + } + + # read package config file + udc_data=$($udc_uci -S -n export "$udc_pkg") + udc_ret="$?" + # No error and udc_data then execute (eval) + # this will call functions defined above + [ "$udc_ret" -eq 0 -a -n "$udc_data" ] && eval "$udc_data" + + # add config ddns "global" (ignore error if exists) + $udc_uci set ddns.global="$udc_pkg" + + # write changes to config file + $udc_uci commit "$udc_pkg" + + unset udc_uci udc_pkg udc_cfg udc_name udc_var udc_val udc_ret udc_data + return 0 +} + +# do existing config update +update_ddns_config + +# clear Ludc_uci indexcache +rm -f /tmp/luci-indexcache >/dev/null 2>&1 + +return 0 diff --git a/net/ddns-scripts/files/ddns.hotplug b/net/ddns-scripts/files/ddns.hotplug new file mode 100755 index 0000000..9ef172d --- /dev/null +++ b/net/ddns-scripts/files/ddns.hotplug @@ -0,0 +1,11 @@ +#!/bin/sh + +# there are other ACTIONs like ifupdate we don't need +case "$ACTION" in + ifup) # OpenWrt is giving a network not phys. Interface + /etc/init.d/ddns enabled && /usr/lib/ddns/dynamic_dns_updater.sh -n "$INTERFACE" -- start + ;; + ifdown) + /usr/lib/ddns/dynamic_dns_updater.sh -n "$INTERFACE" -- stop + ;; +esac diff --git a/net/ddns-scripts/files/ddns.init b/net/ddns-scripts/files/ddns.init new file mode 100755 index 0000000..b2156a6 --- /dev/null +++ b/net/ddns-scripts/files/ddns.init @@ -0,0 +1,27 @@ +#!/bin/sh /etc/rc.common +START=95 +STOP=10 + +boot() { + return 0 +} + +reload() { + /usr/lib/ddns/dynamic_dns_updater.sh -- reload + return 0 +} + +restart() { + /usr/lib/ddns/dynamic_dns_updater.sh -- stop + sleep 1 # give time to shutdown + /usr/lib/ddns/dynamic_dns_updater.sh -- start +} + +start() { + /usr/lib/ddns/dynamic_dns_updater.sh -- start +} + +stop() { + /usr/lib/ddns/dynamic_dns_updater.sh -- stop + return 0 +} diff --git a/net/ddns-scripts/files/dynamic_dns_functions.sh b/net/ddns-scripts/files/dynamic_dns_functions.sh new file mode 100755 index 0000000..8d64851 --- /dev/null +++ b/net/ddns-scripts/files/dynamic_dns_functions.sh @@ -0,0 +1,1357 @@ +#!/bin/sh +# /usr/lib/ddns/dynamic_dns_functions.sh +# +#.Distributed under the terms of the GNU General Public License (GPL) version 2.0 +# Original written by Eric Paul Bishop, January 2008 +# (Loosely) based on the script on the one posted by exobyte in the forums here: +# http://forum.openwrt.org/viewtopic.php?id=14040 +# extended and partial rewritten +#.2014-2016 Christian Schoenebeck +# +# function timeout +# copied from http://www.ict.griffith.edu.au/anthony/software/timeout.sh +# @author Anthony Thyssen 6 April 2011 +# +# variables in small chars are read from /etc/config/ddns +# variables in big chars are defined inside these scripts as global vars +# variables in big chars beginning with "__" are local defined inside functions only +# set -vx #script debugger + +. /lib/functions.sh +. /lib/functions/network.sh + +# GLOBAL VARIABLES # +VERSION="2.7.6" +SECTION_ID="" # hold config's section name +VERBOSE=1 # default mode is log to console, but easily changed with parameter +MYPROG=$(basename $0) # my program call name + +LOGFILE="" # logfile - all files are set in dynamic_dns_updater.sh +PIDFILE="" # pid file +UPDFILE="" # store UPTIME of last update +DATFILE="" # save stdout data of WGet and other external programs called +ERRFILE="" # save stderr output of WGet and other external programs called +TLDFILE=/usr/share/public_suffix_list.dat.gz # TLD file used by split_FQDN + +CHECK_SECONDS=0 # calculated seconds out of given +FORCE_SECONDS=0 # interval and unit +RETRY_SECONDS=0 # in configuration + +LAST_TIME=0 # holds the uptime of last successful update +CURR_TIME=0 # holds the current uptime +NEXT_TIME=0 # calculated time for next FORCED update +EPOCH_TIME=0 # seconds since 1.1.1970 00:00:00 + +REGISTERED_IP="" # holds the IP read from DNS +LOCAL_IP="" # holds the local IP read from the box + +URL_USER="" # url encoded $username from config file +URL_PASS="" # url encoded $password from config file +URL_PENC="" # url encoded $param_enc from config file + +UPD_ANSWER="" # Answer given by service on success + +ERR_LAST=0 # used to save $? return code of program and function calls +ERR_UPDATE=0 # error counter on different local and registered ip + +PID_SLEEP=0 # ProcessID of current background "sleep" + +# regular expression to detect IPv4 / IPv6 +# IPv4 0-9 1-3x "." 0-9 1-3x "." 0-9 1-3x "." 0-9 1-3x +IPV4_REGEX="[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}" +# IPv6 ( ( 0-9a-f 1-4char ":") min 1x) ( ( 0-9a-f 1-4char )optional) ( (":" 0-9a-f 1-4char ) min 1x) +IPV6_REGEX="\(\([0-9A-Fa-f]\{1,4\}:\)\{1,\}\)\(\([0-9A-Fa-f]\{1,4\}\)\{0,1\}\)\(\(:[0-9A-Fa-f]\{1,4\}\)\{1,\}\)" + +# detect if called by ddns-lucihelper.sh script, disable retrys (empty variable == false) +LUCI_HELPER=$(printf %s "$MYPROG" | grep -i "luci") + +# Name Server Lookup Programs +BIND_HOST=$(which host) +KNOT_HOST=$(which khost) +DRILL=$(which drill) +HOSTIP=$(which hostip) +NSLOOKUP=$(which nslookup) +NSLOOKUP_MUSL=$($(which nslookup) localhost 2>&1 | grep -F "(null)") # not empty busybox compiled with musl + +# Transfer Programs +WGET=$(which wget) +WGET_SSL=$(which wget-ssl) + +CURL=$(which curl) +# CURL_SSL not empty then SSL support available +CURL_SSL=$($(which curl) -V 2>/dev/null | grep "Protocols:" | grep -F "https") +# CURL_PROXY not empty then Proxy support available +CURL_PROXY=$(find /lib /usr/lib -name libcurl.so* -exec grep -i "all_proxy" {} 2>/dev/null \;) + +UCLIENT_FETCH=$(which uclient-fetch) +# UCLIENT_FETCH_SSL not empty then SSL support available +UCLIENT_FETCH_SSL=$(find /lib /usr/lib -name libustream-ssl.so* 2>/dev/null) + +# Global configuration settings +# allow NON-public IP's +upd_privateip=$(uci -q get ddns.global.allow_local_ip) || upd_privateip=0 + +# directory to store run information to. +ddns_rundir=$(uci -q get ddns.global.run_dir) || ddns_rundir="/var/run/ddns" +[ -d $ddns_rundir ] || mkdir -p -m755 $ddns_rundir + +# directory to store log files +ddns_logdir=$(uci -q get ddns.global.log_dir) || ddns_logdir="/var/log/ddns" +[ -d $ddns_logdir ] || mkdir -p -m755 $ddns_logdir + +# number of lines to before rotate logfile +ddns_loglines=$(uci -q get ddns.global.log_lines) || ddns_loglines=250 +ddns_loglines=$((ddns_loglines + 1)) # correct sed handling + +# format to show date information in log and luci-app-ddns default ISO 8601 format +ddns_dateformat=$(uci -q get ddns.global.date_format) || ddns_dateformat="%F %R" +DATE_PROG="date +'$ddns_dateformat'" + +# USE_CURL if GNU Wget and cURL installed normally Wget is used by do_transfer() +# to change this use global option use_curl '1' +USE_CURL=$(uci -q get ddns.global.use_curl) || USE_CURL=0 # read config +[ -n "$CURL" ] || USE_CURL=0 # check for cURL + +# loads all options for a given package and section +# also, sets all_option_variables to a list of the variable names +# $1 = ddns, $2 = SECTION_ID +load_all_config_options() +{ + local __PKGNAME="$1" + local __SECTIONID="$2" + local __VAR + local __ALL_OPTION_VARIABLES="" + + # this callback loads all the variables in the __SECTIONID section when we do + # config_load. We need to redefine the option_cb for different sections + # so that the active one isn't still active after we're done with it. For reference + # the $1 variable is the name of the option and $2 is the name of the section + config_cb() + { + if [ ."$2" = ."$__SECTIONID" ]; then + option_cb() + { + __ALL_OPTION_VARIABLES="$__ALL_OPTION_VARIABLES $1" + } + else + option_cb() { return 0; } + fi + } + + config_load "$__PKGNAME" + + # Given SECTION_ID not found so no data, so return 1 + [ -z "$__ALL_OPTION_VARIABLES" ] && return 1 + + for __VAR in $__ALL_OPTION_VARIABLES + do + config_get "$__VAR" "$__SECTIONID" "$__VAR" + done + return 0 +} + +# read's all service sections from ddns config +# $1 = Name of variable to store +load_all_service_sections() { + local __DATA="" + config_cb() + { + # only look for section type "service", ignore everything else + [ "$1" = "service" ] && __DATA="$__DATA $2" + } + config_load "ddns" + + eval "$1=\"$__DATA\"" + return +} + +# starts updater script for all given sections or only for the one given +# $1 = interface (Optional: when given only scripts are started +# configured for that interface) +# used by /etc/hotplug.d/iface/95-ddns on IFUP +# and by /etc/init.d/ddns start +start_daemon_for_all_ddns_sections() +{ + local __EVENTIF="$1" + local __SECTIONS="" + local __SECTIONID="" + local __IFACE="" + + load_all_service_sections __SECTIONS + for __SECTIONID in $__SECTIONS; do + config_get __IFACE "$__SECTIONID" interface "wan" + [ -z "$__EVENTIF" -o "$__IFACE" = "$__EVENTIF" ] || continue + if [ $VERBOSE -eq 0 ]; then # start in background + /usr/lib/ddns/dynamic_dns_updater.sh -v 0 -S "$__SECTIONID" -- start & + else + /usr/lib/ddns/dynamic_dns_updater.sh -v "$VERBOSE" -S "$__SECTIONID" -- start + fi + done +} + +# stop sections process incl. childs (sleeps) +# $1 = section +stop_section_processes() { + local __PID=0 + local __PIDFILE="$ddns_rundir/$1.pid" + [ $# -ne 1 ] && write_log 12 "Error calling 'stop_section_processes()' - wrong number of parameters" + + [ -e "$__PIDFILE" ] && { + __PID=$(cat $__PIDFILE) + ps | grep "^[\t ]*$__PID" >/dev/null 2>&1 && kill $__PID || __PID=0 # terminate it + } + [ $__PID -eq 0 ] # report if process was running +} + +# stop updater script for all defines sections or only for one given +# $1 = interface (optional) +# used by /etc/hotplug.d/iface/95-ddns on 'ifdown' +# and by /etc/init.d/ddns stop +# needed because we also need to kill "sleep" child processes +stop_daemon_for_all_ddns_sections() { + local __EVENTIF="$1" + local __SECTIONS="" + local __SECTIONID="" + local __IFACE="" + + load_all_service_sections __SECTIONS + for __SECTIONID in $__SECTIONS; do + config_get __IFACE "$__SECTIONID" interface "wan" + [ -z "$__EVENTIF" -o "$__IFACE" = "$__EVENTIF" ] || continue + stop_section_processes "$__SECTIONID" + done +} + +# reports to console, logfile, syslog +# $1 loglevel 7 == Debug to 0 == EMERG +# value +10 will exit the scripts +# $2..n text to report +write_log() { + local __LEVEL __EXIT __CMD __MSG + local __TIME=$(date +%H%M%S) + [ $1 -ge 10 ] && { + __LEVEL=$(($1-10)) + __EXIT=1 + } || { + __LEVEL=$1 + __EXIT=0 + } + shift # remove loglevel + [ $__EXIT -eq 0 ] && __MSG="$*" || __MSG="$* - TERMINATE" + case $__LEVEL in # create log message and command depending on loglevel + 0) __CMD="logger -p user.emerg -t ddns-scripts[$$] $SECTION_ID: $__MSG" + __MSG=" $__TIME EMERG : $__MSG" ;; + 1) __CMD="logger -p user.alert -t ddns-scripts[$$] $SECTION_ID: $__MSG" + __MSG=" $__TIME ALERT : $__MSG" ;; + 2) __CMD="logger -p user.crit -t ddns-scripts[$$] $SECTION_ID: $__MSG" + __MSG=" $__TIME CRIT : $__MSG" ;; + 3) __CMD="logger -p user.err -t ddns-scripts[$$] $SECTION_ID: $__MSG" + __MSG=" $__TIME ERROR : $__MSG" ;; + 4) __CMD="logger -p user.warn -t ddns-scripts[$$] $SECTION_ID: $__MSG" + __MSG=" $__TIME WARN : $__MSG" ;; + 5) __CMD="logger -p user.notice -t ddns-scripts[$$] $SECTION_ID: $__MSG" + __MSG=" $__TIME note : $__MSG" ;; + 6) __CMD="logger -p user.info -t ddns-scripts[$$] $SECTION_ID: $__MSG" + __MSG=" $__TIME info : $__MSG" ;; + 7) __MSG=" $__TIME : $__MSG";; + *) return;; + esac + + # verbose echo + [ $VERBOSE -gt 0 -o $__EXIT -gt 0 ] && echo -e "$__MSG" + # write to logfile + if [ ${use_logfile:-1} -eq 1 -o $VERBOSE -gt 1 ]; then + echo -e "$__MSG" >> $LOGFILE + # VERBOSE > 1 then NO loop so NO truncate log to $ddns_loglines lines + [ $VERBOSE -gt 1 ] || sed -i -e :a -e '$q;N;'$ddns_loglines',$D;ba' $LOGFILE + fi + [ -n "$LUCI_HELPER" ] && return # nothing else todo when running LuCI helper script + [ $__LEVEL -eq 7 ] && return # no syslog for debug messages + __CMD=$(echo -e "$__CMD" | tr -d '\n' | tr '\t' ' ') # remove \n \t chars + [ $__EXIT -eq 1 ] && { + $__CMD # force syslog before exit + exit 1 + } + [ $use_syslog -eq 0 ] && return + [ $((use_syslog + __LEVEL)) -le 7 ] && $__CMD + + return +} + +# replace all special chars to their %hex value +# used for USERNAME and PASSWORD in update_url +# unchanged: "-"(minus) "_"(underscore) "."(dot) "~"(tilde) +# to verify: "'"(single quote) '"'(double quote) # because shell delimiter +# "$"(Dollar) # because used as variable output +# tested with the following string stored via Luci Application as password / username +# A B!"#AA$1BB%&'()*+,-./:;<=>?@[\]^_`{|}~ without problems at Dollar or quotes +urlencode() { + # $1 Name of Variable to store encoded string to + # $2 string to encode + local __STR __LEN __CHAR __OUT + local __ENC="" + local __POS=1 + + [ $# -ne 2 ] && write_log 12 "Error calling 'urlencode()' - wrong number of parameters" + + __STR="$2" # read string to encode + __LEN=${#__STR} # get string length + + while [ $__POS -le $__LEN ]; do + # read one chat of the string + __CHAR=$(expr substr "$__STR" $__POS 1) + + case "$__CHAR" in + [-_.~a-zA-Z0-9] ) + # standard char + __OUT="${__CHAR}" + ;; + * ) + # special char get %hex code + __OUT=$(printf '%%%02x' "'$__CHAR" ) + ;; + esac + __ENC="${__ENC}${__OUT}" # append to encoded string + __POS=$(( $__POS + 1 )) # increment position + done + + eval "$1=\"$__ENC\"" # transfer back to variable + return 0 +} + +# extract url or script for given DDNS Provider from +# file /etc/ddns/services for IPv4 or from +# file /etc/ddns/services_ipv6 for IPv6 +# $1 Name of Variable to store url to +# $2 Name of Variable to store script to +# $3 Name of Variable to store service answer to +get_service_data() { + [ $# -ne 3 ] && write_log 12 "Error calling 'get_service_data()' - wrong number of parameters" + + __FILE="/etc/ddns/services" # IPv4 + [ $use_ipv6 -ne 0 ] && __FILE="/etc/ddns/services_ipv6" # IPv6 + + # workaround with variables; pipe create subshell with no give back of variable content + mkfifo pipe_$$ + # only grep without # or whitespace at linestart | remove " +# grep -v -E "(^#|^[[:space:]]*$)" $__FILE | sed -e s/\"//g > pipe_$$ & + sed '/^#/d; /^[ \t]*$/d; s/\"//g' $__FILE > pipe_$$ & + + while read __SERVICE __DATA __ANSWER; do + if [ "$__SERVICE" = "$service_name" ]; then + # check if URL or SCRIPT is given + __URL=$(echo "$__DATA" | grep "^http") + [ -z "$__URL" ] && __SCRIPT="/usr/lib/ddns/$__DATA" + + eval "$1=\"$__URL\"" + eval "$2=\"$__SCRIPT\"" + eval "$3=\"$__ANSWER\"" + rm pipe_$$ + return 0 + fi + done < pipe_$$ + rm pipe_$$ + + eval "$1=\"\"" # no service match clear variables + eval "$2=\"\"" + eval "$3=\"\"" + return 1 +} + +# Calculate seconds from interval and unit +# $1 Name of Variable to store result in +# $2 Number and +# $3 Unit of time interval +get_seconds() { + [ $# -ne 3 ] && write_log 12 "Error calling 'get_seconds()' - wrong number of parameters" + case "$3" in + "days" ) eval "$1=$(( $2 * 86400 ))";; + "hours" ) eval "$1=$(( $2 * 3600 ))";; + "minutes" ) eval "$1=$(( $2 * 60 ))";; + * ) eval "$1=$2";; + esac + return 0 +} + +timeout() { + #.copied from http://www.ict.griffith.edu.au/anthony/software/timeout.sh + # only did the following changes + # - commented out "#!/bin/bash" and usage section + # - replace exit by return for usage as function + # - some reformatting + # + # timeout [-SIG] time [--] command args... + # + # Run the given command until completion, but kill it if it runs too long. + # Specifically designed to exit immediately (no sleep interval) and clean up + # nicely without messages or leaving any extra processes when finished. + # + # Example use + # timeout 5 countdown + # + # Based on notes in my "Shell Script Hints", section "Command Timeout" + # http://www.ict.griffith.edu.au/~anthony/info/shell/script.hints + # + # This script uses a lot of tricks to terminate both the background command, + # the timeout script, and even the sleep process. It also includes trap + # commands to prevent sub-shells reporting expected "Termination Errors". + # + # It took years of occasional trials, errors and testing to get a pure bash + # timeout command working as well as this does. + # + #.Anthony Thyssen 6 April 2011 + # +# PROGNAME=$(type $0 | awk '{print $3}') # search for executable on path +# PROGDIR=$(dirname $PROGNAME) # extract directory of program +# PROGNAME=$(basename $PROGNAME) # base name of program + + # output the script comments as docs +# Usage() { +# echo >&2 "$PROGNAME:" "$@" +# sed >&2 -n '/^###/q; /^#/!q; s/^#//; s/^ //; 3s/^/Usage: /; 2,$ p' "$PROGDIR/$PROGNAME" +# exit 10; +# } + + SIG=-TERM + + while [ $# -gt 0 ]; do + case "$1" in + --) + # forced end of user options + shift; + break ;; +# -\?|--help|--doc*) +# Usage ;; + [0-9]*) + TIMEOUT="$1" ;; + -*) + SIG="$1" ;; + *) + # unforced end of user options + break ;; + esac + shift # next option + done + + # run main command in backgrounds and get its pid + "$@" & + command_pid=$! + + # timeout sub-process abort countdown after ABORT seconds! also backgrounded + sleep_pid=0 + ( + # cleanup sleep process + trap 'kill -TERM $sleep_pid; return 1' 1 2 3 15 + # sleep timeout period in background + sleep $TIMEOUT & + sleep_pid=$! + wait $sleep_pid + # Abort the command + kill $SIG $command_pid >/dev/null 2>&1 + return 1 + ) & + timeout_pid=$! + + # Wait for main command to finished or be timed out + wait $command_pid + status=$? + + # Clean up timeout sub-shell - if it is still running! + kill $timeout_pid 2>/dev/null + wait $timeout_pid 2>/dev/null + + # Uncomment to check if a LONG sleep still running (no sleep should be) + # sleep 1 + # echo "-----------" + # /bin/ps j # uncomment to show if abort "sleep" is still sleeping + + return $status +} + +# verify given host and port is connectable +# $1 Host/IP to verify +# $2 Port to verify +verify_host_port() { + local __HOST=$1 + local __PORT=$2 + local __NC=$(which nc) + local __NCEXT=$($(which nc) --help 2>&1 | grep "\-w" 2>/dev/null) # busybox nc compiled with extensions + local __IP __IPV4 __IPV6 __RUNPROG __PROG __ERR + # return codes + # 1 system specific error + # 2 nslookup/host error + # 3 nc (netcat) error + # 4 unmatched IP version + + [ $# -ne 2 ] && write_log 12 "Error calling 'verify_host_port()' - wrong number of parameters" + + # check if ip or FQDN was given + __IPV4=$(echo $__HOST | grep -m 1 -o "$IPV4_REGEX$") # do not detect ip in 0.0.0.0.example.com + __IPV6=$(echo $__HOST | grep -m 1 -o "$IPV6_REGEX") + # if FQDN given get IP address + [ -z "$__IPV4" -a -z "$__IPV6" ] && { + if [ -n "$BIND_HOST" ]; then # use BIND host if installed + __PROG="BIND host" + __RUNPROG="$BIND_HOST $__HOST >$DATFILE 2>$ERRFILE" + elif [ -n "$KNOT_HOST" ]; then # use Knot host if installed + __PROG="Knot host" + __RUNPROG="$KNOT_HOST $__HOST >$DATFILE 2>$ERRFILE" + elif [ -n "$DRILL" ]; then # use drill if installed + __PROG="drill" + __RUNPROG="$DRILL -V0 $__HOST A >$DATFILE 2>$ERRFILE" # IPv4 + __RUNPROG="$__RUNPROG; $DRILL -V0 $__HOST AAAA >>$DATFILE 2>>$ERRFILE" # IPv6 + elif [ -n "$HOSTIP" ]; then # use hostip if installed + __PROG="hostip" + __RUNPROG="$HOSTIP $__HOST >$DATFILE 2>$ERRFILE" # IPv4 + __RUNPROG="$__RUNPROG; $HOSTIP -6 $__HOST >>$DATFILE 2>>$ERRFILE" # IPv6 + else # use BusyBox nslookup + __PROG="BusyBox nslookup" + __RUNPROG="$NSLOOKUP $__HOST >$DATFILE 2>$ERRFILE" + fi + write_log 7 "#> $__RUNPROG" + eval $__RUNPROG + __ERR=$? + # command error + [ $__ERR -gt 0 ] && { + write_log 3 "DNS Resolver Error - $__PROG Error '$__ERR'" + write_log 7 "$(cat $ERRFILE)" + return 2 + } + # extract IP address + if [ -n "$BIND_HOST" -o -n "$KNOT_HOST" ]; then # use BIND host or Knot host if installed + __IPV4=$(cat $DATFILE | awk -F "address " '/has address/ {print $2; exit}' ) + __IPV6=$(cat $DATFILE | awk -F "address " '/has IPv6/ {print $2; exit}' ) + elif [ -n "$DRILL" ]; then # use drill if installed + __IPV4=$(cat $DATFILE | awk '/^'"$lookup_host"'/ {print $5}' | grep -m 1 -o "$IPV4_REGEX") + __IPV6=$(cat $DATFILE | awk '/^'"$lookup_host"'/ {print $5}' | grep -m 1 -o "$IPV6_REGEX") + elif [ -n "$HOSTIP" ]; then # use hostip if installed + __IPV4=$(cat $DATFILE | grep -m 1 -o "$IPV4_REGEX") + __IPV6=$(cat $DATFILE | grep -m 1 -o "$IPV6_REGEX") + else # use BusyBox nslookup + __IPV4=$(cat $DATFILE | sed -ne "/^Name:/,\$ { s/^Address[0-9 ]\{0,\}: \($IPV4_REGEX\).*$/\\1/p }") + __IPV6=$(cat $DATFILE | sed -ne "/^Name:/,\$ { s/^Address[0-9 ]\{0,\}: \($IPV6_REGEX\).*$/\\1/p }") + fi + } + + # check IP version if forced + if [ $force_ipversion -ne 0 ]; then + __ERR=0 + [ $use_ipv6 -eq 0 -a -z "$__IPV4" ] && __ERR=4 + [ $use_ipv6 -eq 1 -a -z "$__IPV6" ] && __ERR=6 + [ $__ERR -gt 0 ] && { + [ -n "$LUCI_HELPER" ] && return 4 + write_log 14 "Verify host Error '4' - Forced IP Version IPv$__ERR don't match" + } + fi + + # verify nc command + # busybox nc compiled without -l option "NO OPT l!" -> critical error + $__NC --help 2>&1 | grep -i "NO OPT l!" >/dev/null 2>&1 && \ + write_log 12 "Busybox nc (netcat) compiled without '-l' option, error 'NO OPT l!'" + # busybox nc compiled with extensions + $__NC --help 2>&1 | grep "\-w" >/dev/null 2>&1 && __NCEXT="TRUE" + + # connectivity test + # run busybox nc to HOST PORT + # busybox might be compiled with "FEATURE_PREFER_IPV4_ADDRESS=n" + # then nc will try to connect via IPv6 if there is any IPv6 available on any host interface + # not worrying, if there is an IPv6 wan address + # so if not "force_ipversion" to use_ipv6 then connect test via ipv4, if available + [ $force_ipversion -ne 0 -a $use_ipv6 -ne 0 -o -z "$__IPV4" ] && __IP=$__IPV6 || __IP=$__IPV4 + + if [ -n "$__NCEXT" ]; then # BusyBox nc compiled with extensions (timeout support) + __RUNPROG="$__NC -w 1 $__IP $__PORT $DATFILE 2>$ERRFILE" + write_log 7 "#> $__RUNPROG" + eval $__RUNPROG + __ERR=$? + [ $__ERR -eq 0 ] && return 0 + write_log 3 "Connect error - BusyBox nc (netcat) Error '$__ERR'" + write_log 7 "$(cat $ERRFILE)" + return 3 + else # nc compiled without extensions (no timeout support) + __RUNPROG="timeout 2 -- $__NC $__IP $__PORT $DATFILE 2>$ERRFILE" + write_log 7 "#> $__RUNPROG" + eval $__RUNPROG + __ERR=$? + [ $__ERR -eq 0 ] && return 0 + write_log 3 "Connect error - BusyBox nc (netcat) timeout Error '$__ERR'" + return 3 + fi +} + +# verify given DNS server if connectable +# $1 DNS server to verify +verify_dns() { + local __ERR=255 # last error buffer + local __CNT=0 # error counter + + [ $# -ne 1 ] && write_log 12 "Error calling 'verify_dns()' - wrong number of parameters" + write_log 7 "Verify DNS server '$1'" + + while [ $__ERR -ne 0 ]; do + # DNS uses port 53 + verify_host_port "$1" "53" + __ERR=$? + if [ -n "$LUCI_HELPER" ]; then # no retry if called by LuCI helper script + return $__ERR + elif [ $__ERR -ne 0 -a $VERBOSE -gt 1 ]; then # VERBOSE > 1 then NO retry + write_log 4 "Verify DNS server '$1' failed - Verbose Mode: $VERBOSE - NO retry on error" + return $__ERR + elif [ $__ERR -ne 0 ]; then + __CNT=$(( $__CNT + 1 )) # increment error counter + # if error count > retry_count leave here + [ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \ + write_log 14 "Verify DNS server '$1' failed after $retry_count retries" + + write_log 4 "Verify DNS server '$1' failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds" + sleep $RETRY_SECONDS & + PID_SLEEP=$! + wait $PID_SLEEP # enable trap-handler + PID_SLEEP=0 + fi + done + return 0 +} + +# analyze and verify given proxy string +# $1 Proxy-String to verify +verify_proxy() { + # complete entry user:password@host:port + # inside user and password NO '@' of ":" allowed + # host and port only host:port + # host only host ERROR unsupported + # IPv4 address instead of host 123.234.234.123 + # IPv6 address instead of host [xxxx:....:xxxx] in square bracket + local __TMP __HOST __PORT + local __ERR=255 # last error buffer + local __CNT=0 # error counter + + [ $# -ne 1 ] && write_log 12 "Error calling 'verify_proxy()' - wrong number of parameters" + write_log 7 "Verify Proxy server 'http://$1'" + + # try to split user:password "@" host:port + __TMP=$(echo $1 | awk -F "@" '{print $2}') + # no "@" found - only host:port is given + [ -z "$__TMP" ] && __TMP="$1" + # now lets check for IPv6 address + __HOST=$(echo $__TMP | grep -m 1 -o "$IPV6_REGEX") + # IPv6 host address found read port + if [ -n "$__HOST" ]; then + # IPv6 split at "]:" + __PORT=$(echo $__TMP | awk -F "]:" '{print $2}') + else + __HOST=$(echo $__TMP | awk -F ":" '{print $1}') + __PORT=$(echo $__TMP | awk -F ":" '{print $2}') + fi + # No Port detected - EXITING + [ -z "$__PORT" ] && { + [ -n "$LUCI_HELPER" ] && return 5 + write_log 14 "Invalid Proxy server Error '5' - proxy port missing" + } + + while [ $__ERR -gt 0 ]; do + verify_host_port "$__HOST" "$__PORT" + __ERR=$? + if [ -n "$LUCI_HELPER" ]; then # no retry if called by LuCI helper script + return $__ERR + elif [ $__ERR -gt 0 -a $VERBOSE -gt 1 ]; then # VERBOSE > 1 then NO retry + write_log 4 "Verify Proxy server '$1' failed - Verbose Mode: $VERBOSE - NO retry on error" + return $__ERR + elif [ $__ERR -gt 0 ]; then + __CNT=$(( $__CNT + 1 )) # increment error counter + # if error count > retry_count leave here + [ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \ + write_log 14 "Verify Proxy server '$1' failed after $retry_count retries" + + write_log 4 "Verify Proxy server '$1' failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds" + sleep $RETRY_SECONDS & + PID_SLEEP=$! + wait $PID_SLEEP # enable trap-handler + PID_SLEEP=0 + fi + done + return 0 +} + +do_transfer() { + # $1 # URL to use + local __URL="$1" + local __ERR=0 + local __CNT=0 # error counter + local __PROG __RUNPROG + + [ $# -ne 1 ] && write_log 12 "Error in 'do_transfer()' - wrong number of parameters" + + # lets prefer GNU Wget because it does all for us - IPv4/IPv6/HTTPS/PROXY/force IP version + if [ -n "$WGET_SSL" -a $USE_CURL -eq 0 ]; then # except global option use_curl is set to "1" + __PROG="$WGET_SSL -nv -t 1 -O $DATFILE -o $ERRFILE" # non_verbose no_retry outfile errfile + # force network/ip to use for communication + if [ -n "$bind_network" ]; then + local __BINDIP + # set correct program to detect IP + [ $use_ipv6 -eq 0 ] && __RUNPROG="network_get_ipaddr" || __RUNPROG="network_get_ipaddr6" + eval "$__RUNPROG __BINDIP $bind_network" || \ + write_log 13 "Can not detect local IP using '$__RUNPROG $bind_network' - Error: '$?'" + write_log 7 "Force communication via IP '$__BINDIP'" + __PROG="$__PROG --bind-address=$__BINDIP" + fi + # force ip version to use + if [ $force_ipversion -eq 1 ]; then + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG -4" || __PROG="$__PROG -6" # force IPv4/IPv6 + fi + # set certificate parameters + if [ $use_https -eq 1 ]; then + if [ "$cacert" = "IGNORE" ]; then # idea from Ticket #15327 to ignore server cert + __PROG="$__PROG --no-check-certificate" + elif [ -f "$cacert" ]; then + __PROG="$__PROG --ca-certificate=${cacert}" + elif [ -d "$cacert" ]; then + __PROG="$__PROG --ca-directory=${cacert}" + elif [ -n "$cacert" ]; then # it's not a file and not a directory but given + write_log 14 "No valid certificate(s) found at '$cacert' for HTTPS communication" + fi + fi + # disable proxy if no set (there might be .wgetrc or .curlrc or wrong environment set) + [ -z "$proxy" ] && __PROG="$__PROG --no-proxy" + + __RUNPROG="$__PROG '$__URL'" # build final command + __PROG="GNU Wget" # reuse for error logging + + # 2nd choice is cURL IPv4/IPv6/HTTPS + # libcurl might be compiled without Proxy or HTTPS Support + elif [ -n "$CURL" ]; then + __PROG="$CURL -RsS -o $DATFILE --stderr $ERRFILE" + # check HTTPS support + [ -z "$CURL_SSL" -a $use_https -eq 1 ] && \ + write_log 13 "cURL: libcurl compiled without https support" + # force network/interface-device to use for communication + if [ -n "$bind_network" ]; then + local __DEVICE + network_get_physdev __DEVICE $bind_network || \ + write_log 13 "Can not detect local device using 'network_get_physdev $bind_network' - Error: '$?'" + write_log 7 "Force communication via device '$__DEVICE'" + __PROG="$__PROG --interface $__DEVICE" + fi + # force ip version to use + if [ $force_ipversion -eq 1 ]; then + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG -4" || __PROG="$__PROG -6" # force IPv4/IPv6 + fi + # set certificate parameters + if [ $use_https -eq 1 ]; then + if [ "$cacert" = "IGNORE" ]; then # idea from Ticket #15327 to ignore server cert + __PROG="$__PROG --insecure" # but not empty better to use "IGNORE" + elif [ -f "$cacert" ]; then + __PROG="$__PROG --cacert $cacert" + elif [ -d "$cacert" ]; then + __PROG="$__PROG --capath $cacert" + elif [ -n "$cacert" ]; then # it's not a file and not a directory but given + write_log 14 "No valid certificate(s) found at '$cacert' for HTTPS communication" + fi + fi + # disable proxy if no set (there might be .wgetrc or .curlrc or wrong environment set) + # or check if libcurl compiled with proxy support + if [ -z "$proxy" ]; then + __PROG="$__PROG --noproxy '*'" + elif [ -z "$CURL_PROXY" ]; then + # if libcurl has no proxy support and proxy should be used then force ERROR + write_log 13 "cURL: libcurl compiled without Proxy support" + fi + + __RUNPROG="$__PROG '$__URL'" # build final command + __PROG="cURL" # reuse for error logging + + # uclient-fetch possibly with ssl support if /lib/libustream-ssl.so installed + elif [ -n "$UCLIENT_FETCH" ]; then + __PROG="$UCLIENT_FETCH -q -O $DATFILE" + # force network/ip not supported + [ -n "$__BINDIP" ] && \ + write_log 14 "uclient-fetch: FORCE binding to specific address not supported" + # force ip version to use + if [ $force_ipversion -eq 1 ]; then + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG -4" || __PROG="$__PROG -6" # force IPv4/IPv6 + fi + # https possibly not supported + [ $use_https -eq 1 -a -z "$UCLIENT_FETCH_SSL" ] && \ + write_log 14 "uclient-fetch: no HTTPS support! Additional install one of ustream-ssl packages" + # proxy support + [ -z "$proxy" ] && __PROG="$__PROG -Y off" || __PROG="$__PROG -Y on" + # https & certificates + if [ $use_https -eq 1 ]; then + if [ "$cacert" = "IGNORE" ]; then + __PROG="$__PROG --no-check-certificate" + elif [ -f "$cacert" ]; then + __PROG="$__PROG --ca-certificate=$cacert" + elif [ -n "$cacert" ]; then # it's not a file; nothing else supported + write_log 14 "No valid certificate file '$cacert' for HTTPS communication" + fi + fi + __RUNPROG="$__PROG '$__URL' 2>$ERRFILE" # build final command + __PROG="uclient-fetch" # reuse for error logging + + # Busybox Wget or any other wget in search $PATH (did not support neither IPv6 nor HTTPS) + elif [ -n "$WGET" ]; then + __PROG="$WGET -q -O $DATFILE" + # force network/ip not supported + [ -n "$__BINDIP" ] && \ + write_log 14 "BusyBox Wget: FORCE binding to specific address not supported" + # force ip version not supported + [ $force_ipversion -eq 1 ] && \ + write_log 14 "BusyBox Wget: Force connecting to IPv4 or IPv6 addresses not supported" + # https not supported + [ $use_https -eq 1 ] && \ + write_log 14 "BusyBox Wget: no HTTPS support" + # disable proxy if no set (there might be .wgetrc or .curlrc or wrong environment set) + [ -z "$proxy" ] && __PROG="$__PROG -Y off" + + __RUNPROG="$__PROG '$__URL' 2>$ERRFILE" # build final command + __PROG="Busybox Wget" # reuse for error logging + + else + write_log 13 "Neither 'Wget' nor 'cURL' nor 'uclient-fetch' installed or executable" + fi + + while : ; do + write_log 7 "#> $__RUNPROG" + eval $__RUNPROG # DO transfer + __ERR=$? # save error code + [ $__ERR -eq 0 ] && return 0 # no error leave + [ -n "$LUCI_HELPER" ] && return 1 # no retry if called by LuCI helper script + + write_log 3 "$__PROG Error: '$__ERR'" + write_log 7 "$(cat $ERRFILE)" # report error + + [ $VERBOSE -gt 1 ] && { + # VERBOSE > 1 then NO retry + write_log 4 "Transfer failed - Verbose Mode: $VERBOSE - NO retry on error" + return 1 + } + + __CNT=$(( $__CNT + 1 )) # increment error counter + # if error count > retry_count leave here + [ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \ + write_log 14 "Transfer failed after $retry_count retries" + + write_log 4 "Transfer failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds" + sleep $RETRY_SECONDS & + PID_SLEEP=$! + wait $PID_SLEEP # enable trap-handler + PID_SLEEP=0 + done + # we should never come here there must be a programming error + write_log 12 "Error in 'do_transfer()' - program coding error" +} + +send_update() { + # $1 # IP to set at DDNS service provider + local __IP + + [ $# -ne 1 ] && write_log 12 "Error calling 'send_update()' - wrong number of parameters" + + if [ $upd_privateip -eq 0 ]; then + # verify given IP / no private IPv4's / no IPv6 addr starting with fxxx of with ":" + [ $use_ipv6 -eq 0 ] && __IP=$(echo $1 | grep -v -E "(^0|^10\.|^100\.6[4-9]\.|^100\.[7-9][0-9]\.|^100\.1[0-1][0-9]\.|^100\.12[0-7]\.|^127|^169\.254|^172\.1[6-9]\.|^172\.2[0-9]\.|^172\.3[0-1]\.|^192\.168)") + [ $use_ipv6 -eq 1 ] && __IP=$(echo $1 | grep "^[0-9a-eA-E]") + else + __IP=$(echo $1 | grep -m 1 -o "$IPV4_REGEX") # valid IPv4 or + [ -z "$__IP" ] && __IP=$(echo $1 | grep -m 1 -o "$IPV6_REGEX") # IPv6 + fi + [ -z "$__IP" ] && { + write_log 3 "No or private or invalid IP '$1' given! Please check your configuration" + return 127 + } + + if [ -n "$update_script" ]; then + write_log 7 "parsing script '$update_script'" + . $update_script + else + local __URL __ERR + + # do replaces in URL + __URL=$(echo $update_url | sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \ + -e "s#\[PARAMENC\]#$URL_PENC#g" -e "s#\[PARAMOPT\]#$param_opt#g" \ + -e "s#\[DOMAIN\]#$domain#g" -e "s#\[IP\]#$__IP#g") + [ $use_https -ne 0 ] && __URL=$(echo $__URL | sed -e 's#^http:#https:#') + + do_transfer "$__URL" || return 1 + + write_log 7 "DDNS Provider answered:\n$(cat $DATFILE)" + + [ -z "$UPD_ANSWER" ] && return 0 # not set then ignore + + grep -i -E "$UPD_ANSWER" $DATFILE >/dev/null 2>&1 + return $? # "0" if found + fi +} + +get_local_ip () { + # $1 Name of Variable to store local IP (LOCAL_IP) + local __CNT=0 # error counter + local __RUNPROG __DATA __URL __ERR + + [ $# -ne 1 ] && write_log 12 "Error calling 'get_local_ip()' - wrong number of parameters" + write_log 7 "Detect local IP on '$ip_source'" + + while : ; do + if [ -n "$ip_network" ]; then + # set correct program + [ $use_ipv6 -eq 0 ] && __RUNPROG="network_get_ipaddr" \ + || __RUNPROG="network_get_ipaddr6" + eval "$__RUNPROG __DATA $ip_network" || \ + write_log 13 "Can not detect local IP using $__RUNPROG '$ip_network' - Error: '$?'" + [ -n "$__DATA" ] && write_log 7 "Local IP '$__DATA' detected on network '$ip_network'" + elif [ -n "$ip_interface" ]; then + local __DATA4=""; local __DATA6="" + if [ -n "$(which ip)" ]; then # ip program installed + write_log 7 "#> ip -o addr show dev $ip_interface scope global >$DATFILE 2>$ERRFILE" + ip -o addr show dev $ip_interface scope global >$DATFILE 2>$ERRFILE + __ERR=$? + if [ $__ERR -eq 0 ]; then + # DATFILE (sample) + # 5: eth1: mtu 1500 qdisc fq_codel state UP qlen 1000\ link/ether 08:00:27:d0:10:32 brd ff:ff:ff:ff:ff:ff + # 5: eth1 inet 172.27.10.128/24 brd 172.27.10.255 scope global eth1\ valid_lft forever preferred_lft forever + # 5: eth1 inet 172.55.55.155/24 brd 172.27.10.255 scope global eth1\ valid_lft 12345sec preferred_lft 12345sec + # 5: eth1 inet6 2002:b0c7:f326::806b:c629:b8b9:433/128 scope global dynamic \ valid_lft 8026sec preferred_lft 8026sec + # 5: eth1 inet6 fd43:5368:6f6d:6500:806b:c629:b8b9:433/128 scope global dynamic \ valid_lft 8026sec preferred_lft 8026sec + # 5: eth1 inet6 fd43:5368:6f6d:6500:a00:27ff:fed0:1032/64 scope global dynamic \ valid_lft 14352sec preferred_lft 14352sec + # 5: eth1 inet6 2002:b0c7:f326::a00:27ff:fed0:1032/64 scope global dynamic \ valid_lft 14352sec preferred_lft 14352sec + + # remove remove remove replace remove remove + # BROADCAST inet6 fxxx sec forever=>-1 between / and pref.. linestart to inet + sed -i "/BROADCAST/d; /inet6 f/d; s/sec//g; s/forever/-1/g; s/\/.*preferred_lft//g; s/^.*$ip_interface *//g" $DATFILE + + local __TIME4=0; local __TIME6=0 + local __TYP __ADR __TIME + while read __TYP __ADR __TIME; do + __TIME=${__TIME:-0} # supress shell errors on last (empty) line of DATFILE + # IPversion no "-1" record stored - now "-1" record or new time > oldtime + [ "$__TYP" = "inet6" -a $__TIME6 -ge 0 -a \( $__TIME -lt 0 -o $__TIME -gt $__TIME6 \) ] && { + __DATA6="$__ADR" + __TIME6="$__TIME" + } + [ "$__TYP" = "inet" -a $__TIME4 -ge 0 -a \( $__TIME -lt 0 -o $__TIME -gt $__TIME4 \) ] && { + __DATA4="$__ADR" + __TIME4="$__TIME" + } + done < $DATFILE + else + write_log 3 "ip Error: '$__ERR'" + write_log 7 "$(cat $ERRFILE)" # report error + fi + else # use deprecated ifconfig + write_log 7 "#> ifconfig $ip_interface >$DATFILE 2>$ERRFILE" + ifconfig $ip_interface >$DATFILE 2>$ERRFILE + __ERR=$? + if [ $__ERR -eq 0 ]; then + __DATA4=$(awk ' + /inet addr:/ { # Filter IPv4 + # inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0 + $1=""; # remove inet + $3=""; # remove Bcast: ... + $4=""; # remove Mask: ... + FS=":"; # separator ":" + $0=$0; # reread to activate separator + $1=""; # remove addr + FS=" "; # set back separator to default " " + $0=$0; # reread to activate separator (remove whitespaces) + print $1; # print IPv4 addr + }' $DATFILE + ) + __DATA6=$(awk ' + /inet6/ && /: [0-9a-eA-E]/ { # Filter IPv6 exclude fxxx + # inet6 addr: 2001:db8::xxxx:xxxx/32 Scope:Global + FS="/"; # separator "/" + $0=$0; # reread to activate separator + $2=""; # remove everything behind "/" + FS=" "; # set back separator to default " " + $0=$0; # reread to activate separator + print $3; # print IPv6 addr + }' $DATFILE + ) + else + write_log 3 "ifconfig Error: '$__ERR'" + write_log 7 "$(cat $ERRFILE)" # report error + fi + fi + [ $use_ipv6 -eq 0 ] && __DATA="$__DATA4" || __DATA="$__DATA6" + [ -n "$__DATA" ] && write_log 7 "Local IP '$__DATA' detected on interface '$ip_interface'" + elif [ -n "$ip_script" ]; then + write_log 7 "#> $ip_script >$DATFILE 2>$ERRFILE" + eval $ip_script >$DATFILE 2>$ERRFILE + __ERR=$? + if [ $__ERR -eq 0 ]; then + __DATA=$(cat $DATFILE) + [ -n "$__DATA" ] && write_log 7 "Local IP '$__DATA' detected via script '$ip_script'" + else + write_log 3 "$ip_script Error: '$__ERR'" + write_log 7 "$(cat $ERRFILE)" # report error + fi + elif [ -n "$ip_url" ]; then + do_transfer "$ip_url" + # use correct regular expression + [ $use_ipv6 -eq 0 ] \ + && __DATA=$(grep -m 1 -o "$IPV4_REGEX" $DATFILE) \ + || __DATA=$(grep -m 1 -o "$IPV6_REGEX" $DATFILE) + [ -n "$__DATA" ] && write_log 7 "Local IP '$__DATA' detected on web at '$ip_url'" + else + write_log 12 "Error in 'get_local_ip()' - unhandled ip_source '$ip_source'" + fi + # valid data found return here + [ -n "$__DATA" ] && { + eval "$1=\"$__DATA\"" + return 0 + } + + [ -n "$LUCI_HELPER" ] && return 1 # no retry if called by LuCI helper script + + write_log 7 "Data detected:" + write_log 7 "$(cat $DATFILE)" + + [ $VERBOSE -gt 1 ] && { + # VERBOSE > 1 then NO retry + write_log 4 "Get local IP via '$ip_source' failed - Verbose Mode: $VERBOSE - NO retry on error" + return 1 + } + + __CNT=$(( $__CNT + 1 )) # increment error counter + # if error count > retry_count leave here + [ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \ + write_log 14 "Get local IP via '$ip_source' failed after $retry_count retries" + write_log 4 "Get local IP via '$ip_source' failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds" + sleep $RETRY_SECONDS & + PID_SLEEP=$! + wait $PID_SLEEP # enable trap-handler + PID_SLEEP=0 + done + # we should never come here there must be a programming error + write_log 12 "Error in 'get_local_ip()' - program coding error" +} + +get_registered_ip() { + # $1 Name of Variable to store public IP (REGISTERED_IP) + # $2 (optional) if set, do not retry on error + local __CNT=0 # error counter + local __ERR=255 + local __REGEX __PROG __RUNPROG __DATA __IP + # return codes + # 1 no IP detected + + [ $# -lt 1 -o $# -gt 2 ] && write_log 12 "Error calling 'get_registered_ip()' - wrong number of parameters" + [ $is_glue -eq 1 -a -z "$BIND_HOST" ] && write_log 14 "Lookup of glue records is only supported using BIND host" + write_log 7 "Detect registered/public IP" + + # set correct regular expression + [ $use_ipv6 -eq 0 ] && __REGEX="$IPV4_REGEX" || __REGEX="$IPV6_REGEX" + + if [ -n "$BIND_HOST" ]; then + __PROG="$BIND_HOST" + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG -t A" || __PROG="$__PROG -t AAAA" + if [ $force_ipversion -eq 1 ]; then # force IP version + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG -4" || __PROG="$__PROG -6" + fi + [ $force_dnstcp -eq 1 ] && __PROG="$__PROG -T" # force TCP + [ $is_glue -eq 1 ] && __PROG="$__PROG -v" # use verbose output to get additional section + + __RUNPROG="$__PROG $lookup_host $dns_server >$DATFILE 2>$ERRFILE" + __PROG="BIND host" + elif [ -n "$KNOT_HOST" ]; then + __PROG="$KNOT_HOST" + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG -t A" || __PROG="$__PROG -t AAAA" + if [ $force_ipversion -eq 1 ]; then # force IP version + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG -4" || __PROG="$__PROG -6" + fi + [ $force_dnstcp -eq 1 ] && __PROG="$__PROG -T" # force TCP + + __RUNPROG="$__PROG $lookup_host $dns_server >$DATFILE 2>$ERRFILE" + __PROG="Knot host" + elif [ -n "$DRILL" ]; then + __PROG="$DRILL -V0" # drill options name @server type + if [ $force_ipversion -eq 1 ]; then # force IP version + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG -4" || __PROG="$__PROG -6" + fi + [ $force_dnstcp -eq 1 ] && __PROG="$__PROG -t" || __PROG="$__PROG -u" # force TCP + __PROG="$__PROG $lookup_host" + [ -n "$dns_server" ] && __PROG="$__PROG @$dns_server" + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG A" || __PROG="$__PROG AAAA" + + __RUNPROG="$__PROG >$DATFILE 2>$ERRFILE" + __PROG="drill" + elif [ -n "$HOSTIP" ]; then # hostip package installed + __PROG="$HOSTIP" + [ $force_dnstcp -ne 0 ] && \ + write_log 14 "hostip - no support for 'DNS over TCP'" + + # is IP given as dns_server ? + __IP=$(echo $dns_server | grep -m 1 -o "$IPV4_REGEX") + [ -z "$__IP" ] && __IP=$(echo $dns_server | grep -m 1 -o "$IPV6_REGEX") + + # we got NO ip for dns_server, so build command + [ -z "$__IP" -a -n "$dns_server" ] && { + __IP="\`$HOSTIP" + [ $use_ipv6 -eq 1 -a $force_ipversion -eq 1 ] && __IP="$__IP -6" + __IP="$__IP $dns_server | grep -m 1 -o" + [ $use_ipv6 -eq 1 -a $force_ipversion -eq 1 ] \ + && __IP="$__IP '$IPV6_REGEX'" \ + || __IP="$__IP '$IPV4_REGEX'" + __IP="$__IP \`" + } + + [ $use_ipv6 -eq 1 ] && __PROG="$__PROG -6" + [ -n "$dns_server" ] && __PROG="$__PROG -r $__IP" + __RUNPROG="$__PROG $lookup_host >$DATFILE 2>$ERRFILE" + __PROG="hostip" + elif [ -n "$NSLOOKUP" ]; then # last use BusyBox nslookup + [ $force_dnstcp -ne 0 ] && \ + write_log 14 "Busybox nslookup - no support for 'DNS over TCP'" + [ -n "$NSLOOKUP_MUSL" -a -n "$dns_server" ] && \ + write_log 14 "Busybox compiled with musl - nslookup don't support the use of DNS Server" + [ $force_ipversion -ne 0 ] && \ + write_log 5 "Busybox nslookup - no support to 'force IP Version' (ignored)" + + __RUNPROG="$NSLOOKUP $lookup_host $dns_server >$DATFILE 2>$ERRFILE" + __PROG="BusyBox nslookup" + else # there must be an error + write_log 12 "Error in 'get_registered_ip()' - no supported Name Server lookup software accessible" + fi + + while : ; do + write_log 7 "#> $__RUNPROG" + eval $__RUNPROG + __ERR=$? + if [ $__ERR -ne 0 ]; then + write_log 3 "$__PROG error: '$__ERR'" + write_log 7 "$(cat $ERRFILE)" + else + if [ -n "$BIND_HOST" ]; then + if [ $is_glue -eq 1 ]; then + __DATA=$(cat $DATFILE | grep "^$lookup_host" | grep -m 1 -o "$__REGEX" ) + else + __DATA=$(cat $DATFILE | awk -F "address " '/has/ {print $2; exit}' ) + fi + elif [ -n "$KNOT_HOST" ]; then + __DATA=$(cat $DATFILE | awk -F "address " '/has/ {print $2; exit}' ) + elif [ -n "$DRILL" ]; then + __DATA=$(cat $DATFILE | awk '/^'"$lookup_host"'/ {print $5; exit}' ) + elif [ -n "$HOSTIP" ]; then + __DATA=$(cat $DATFILE | grep -m 1 -o "$__REGEX") + elif [ -n "$NSLOOKUP" ]; then + __DATA=$(cat $DATFILE | sed -ne "/^Name:/,\$ { s/^Address[0-9 ]\{0,\}: \($__REGEX\).*$/\\1/p }" ) + fi + [ -n "$__DATA" ] && { + write_log 7 "Registered IP '$__DATA' detected" + eval "$1=\"$__DATA\"" # valid data found + return 0 # leave here + } + write_log 4 "NO valid IP found" + __ERR=127 + fi + + [ -n "$LUCI_HELPER" ] && return $__ERR # no retry if called by LuCI helper script + [ -n "$2" ] && return $__ERR # $2 is given -> no retry + [ $VERBOSE -gt 1 ] && { + # VERBOSE > 1 then NO retry + write_log 4 "Get registered/public IP for '$lookup_host' failed - Verbose Mode: $VERBOSE - NO retry on error" + return $__ERR + } + + __CNT=$(( $__CNT + 1 )) # increment error counter + # if error count > retry_count leave here + [ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \ + write_log 14 "Get registered/public IP for '$lookup_host' failed after $retry_count retries" + + write_log 4 "Get registered/public IP for '$lookup_host' failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds" + sleep $RETRY_SECONDS & + PID_SLEEP=$! + wait $PID_SLEEP # enable trap-handler + PID_SLEEP=0 + done + # we should never come here there must be a programming error + write_log 12 "Error in 'get_registered_ip()' - program coding error" +} + +get_uptime() { + # $1 Variable to store result in + [ $# -ne 1 ] && write_log 12 "Error calling 'verify_host_port()' - wrong number of parameters" + local __UPTIME=$(cat /proc/uptime) + eval "$1=\"${__UPTIME%%.*}\"" +} + +trap_handler() { + # $1 trap signal + # $2 optional (exit status) + local __PIDS __PID + local __ERR=${2:-0} + local __OLD_IFS=$IFS + local __NEWLINE_IFS=' +' # __NEWLINE_IFS + + [ $PID_SLEEP -ne 0 ] && kill -$1 $PID_SLEEP 2>/dev/null # kill pending sleep if exist + + case $1 in + 0) if [ $__ERR -eq 0 ]; then + write_log 5 "PID '$$' exit normal at $(eval $DATE_PROG)\n" + else + write_log 4 "PID '$$' exit WITH ERROR '$__ERR' at $(eval $DATE_PROG)\n" + fi ;; + 1) write_log 6 "PID '$$' received 'SIGHUP' at $(eval $DATE_PROG)" + # reload config via starting the script again + /usr/lib/ddns/dynamic_dns_updater.sh -v "0" -S "$__SECTIONID" -- start || true + exit 0 ;; # and leave this one + 2) write_log 5 "PID '$$' terminated by 'SIGINT' at $(eval $DATE_PROG)\n";; + 3) write_log 5 "PID '$$' terminated by 'SIGQUIT' at $(eval $DATE_PROG)\n";; + 15) write_log 5 "PID '$$' terminated by 'SIGTERM' at $(eval $DATE_PROG)\n";; + *) write_log 13 "Unhandled signal '$1' in 'trap_handler()'";; + esac + + __PIDS=$(pgrep -P $$) # get my childs (pgrep prints with "newline") + IFS=$__NEWLINE_IFS + for __PID in $__PIDS; do + kill -$1 $__PID # terminate it + done + IFS=$__OLD_IFS + + # remove out and err file + [ -f $DATFILE ] && rm -f $DATFILE + [ -f $ERRFILE ] && rm -f $ERRFILE + + # exit with correct handling: + # remove trap handling settings and send kill to myself + trap - 0 1 2 3 15 + [ $1 -gt 0 ] && kill -$1 $$ +} + +split_FQDN() { + # $1 FQDN to split + # $2 name of variable to store TLD + # $3 name of variable to store (reg)Domain + # $4 name of variable to store Host/Subdomain + + [ $# -ne 4 ] && write_log 12 "Error calling 'split_FQDN()' - wrong number of parameters" + [ -z "$1" ] && write_log 12 "Error calling 'split_FQDN()' - missing FQDN to split" + [ -f $TLDFILE ] || write_log 12 "Error calling 'split_FQDN()' - missing file '$TLDFILE'" + + local _HOST _FDOM _CTLD _FTLD + local _SET="$@" # save given function parameters + + local _PAR=$(echo "$1" | tr [A-Z] [a-z] | tr "." " ") # to lower and replace DOT with SPACE + set -- $_PAR # set new as function parameters + _PAR="" # clear variable for later reuse + while [ -n "$1" ] ; do # as long we have parameters + _PAR="$1 $_PAR" # invert order of parameters + shift + done + set -- $_PAR # use new as function parameters + _PAR="" # clear variable + + while [ -n "$1" ] ; do # as long we have parameters + if [ -z "$_CTLD" ]; then # first loop + _CTLD="$1" # CURRENT TLD to look at + shift + else + _CTLD="$1.$_CTLD" # Next TLD to look at + shift + fi + # check if TLD exact match in tld_names.dat, save TLD + zcat $TLDFILE | grep -E "^$_CTLD$" >/dev/null 2>&1 && { + _FTLD="$_CTLD" # save found + _FDOM="$1" # save domain next step might be invalid + continue + } + # check if match any "*" in tld_names.dat, + zcat $TLDFILE | grep -E "^\*.$_CTLD$" >/dev/null 2>&1 && { + [ -z "$1" ] && break # no more data break + # check if next level TLD match excludes "!" in tld_names.dat + if zcat $TLDFILE | grep -E "^!$1.$_CTLD$" >/dev/null 2>&1 ; then + _FTLD="$_CTLD" # Yes + else + _FTLD="$1.$_CTLD" + shift + fi + _FDOM="$1"; shift + } + [ -n "$_FTLD" ] && break # we have something valid, break + done + + # the leftover parameters are the HOST/SUBDOMAIN + while [ -n "$1" ]; do + _HOST="$1 $_HOST" # remember we need to invert + shift + done + _HOST=$(echo $_HOST | tr " " ".") # insert DOT + + set -- $_SET # set back parameters from function call + [ -n "$_FTLD" ] && { + eval "$2=$_FTLD" # set TLD + eval "$3=$_FDOM" # set registrable domain + eval "$4=$_HOST" # set HOST/SUBDOMAIN + return 0 + } + eval "$2=''" # clear TLD + eval "$3=''" # clear registrable domain + eval "$4=''" # clear HOST/SUBDOMAIN + return 1 +} + +expand_ipv6() { + # Original written for bash by + #.Author: Florian Streibelt + # Date: 08.04.2012 + # License: Public Domain, but please be fair and + # attribute the original author(s) and provide + # a link to the original source for corrections: + #. https://github.com/mutax/IPv6-Address-checks + + # $1 IPv6 to expand + # $2 name of variable to store expanded IPv6 + [ $# -ne 2 ] && write_log 12 "Error calling 'expand_ipv6()' - wrong number of parameters" + + INPUT="$(echo "$1" | tr 'A-F' 'a-f')" + [ "$INPUT" = "::" ] && INPUT="::0" # special case :: + + O="" + + while [ "$O" != "$INPUT" ]; do + O="$INPUT" + + # fill all words with zeroes + INPUT=$( echo "$INPUT" | sed -e 's|:\([0-9a-f]\{3\}\):|:0\1:|g' \ + -e 's|:\([0-9a-f]\{3\}\)$|:0\1|g' \ + -e 's|^\([0-9a-f]\{3\}\):|0\1:|g' \ + -e 's|:\([0-9a-f]\{2\}\):|:00\1:|g' \ + -e 's|:\([0-9a-f]\{2\}\)$|:00\1|g' \ + -e 's|^\([0-9a-f]\{2\}\):|00\1:|g' \ + -e 's|:\([0-9a-f]\):|:000\1:|g' \ + -e 's|:\([0-9a-f]\)$|:000\1|g' \ + -e 's|^\([0-9a-f]\):|000\1:|g' ) + + done + + # now expand the :: + ZEROES="" + + echo "$INPUT" | grep -qs "::" + if [ "$?" -eq 0 ]; then + GRPS="$( echo "$INPUT" | sed 's|[0-9a-f]||g' | wc -m )" + GRPS=$(( GRPS-1 )) # remove carriage return + MISSING=$(( 8-GRPS )) + while [ $MISSING -gt 0 ]; do + ZEROES="$ZEROES:0000" + MISSING=$(( MISSING-1 )) + done + + # be careful where to place the : + INPUT=$( echo "$INPUT" | sed -e 's|\(.\)::\(.\)|\1'$ZEROES':\2|g' \ + -e 's|\(.\)::$|\1'$ZEROES':0000|g' \ + -e 's|^::\(.\)|'$ZEROES':0000:\1|g;s|^:||g' ) + fi + + # an expanded address has 39 chars + CR + if [ $(echo $INPUT | wc -m) != 40 ]; then + write_log 4 "Error in 'expand_ipv6()' - invalid IPv6 found: '$1' expanded: '$INPUT'" + eval "$2='invalid'" + return 1 + fi + + # echo the fully expanded version of the address + eval "$2=$INPUT" + return 0 +} diff --git a/net/ddns-scripts/files/dynamic_dns_lucihelper.sh b/net/ddns-scripts/files/dynamic_dns_lucihelper.sh new file mode 100755 index 0000000..b2831e6 --- /dev/null +++ b/net/ddns-scripts/files/dynamic_dns_lucihelper.sh @@ -0,0 +1,171 @@ +#!/bin/sh +# /usr/lib/ddns/dynamic_dns_lucihelper.sh +# +#.Distributed under the terms of the GNU General Public License (GPL) version 2.0 +#.2014-2016 Christian Schoenebeck +# This script is used by luci-app-ddns +# +# variables in small chars are read from /etc/config/ddns as parameter given here +# variables in big chars are defined inside these scripts as gloval vars +# variables in big chars beginning with "__" are local defined inside functions only +# set -vx #script debugger + +. /usr/lib/ddns/dynamic_dns_functions.sh # global vars are also defined here + +usage() { + cat << EOF + +Usage: + $MYPROG [options] -- command + +Commands: + get_local_ip using given INTERFACE or NETWORK or SCRIPT or URL + get_registered_ip for given FQDN + verify_dns given DNS-SERVER + verify_proxy given PROXY + start start given SECTION + reload force running ddns processes to reload changed configuration + restart restart all ddns processes + +Parameters: + -6 => use_ipv6=1 (default 0) + -d DNS-SERVER => dns_server=SERVER[:PORT] + -f => force_ipversion=1 (default 0) + -g => is_glue=1 (default 0) + -i INTERFACE => ip_interface=INTERFACE; ip_source="interface" + -l FQDN => lookup_host=FQDN + -n NETWORK => ip_network=NETWORK; ip_source="network" + -p PROXY => proxy=[USER:PASS@]PROXY:PORT + -s SCRIPT => ip_script=SCRIPT; ip_source="script" + -t => force_dnstcp=1 (default 0) + -u URL => ip_url=URL; ip_source="web" + -S SECTION SECTION to start + + -h => show this help and exit + -L => use_logfile=1 (default 0) + -v LEVEL => VERBOSE=LEVEL (default 0) + -V => show version and exit + +EOF +} + +usage_err() { + printf %s\\n "$MYPROG: $@" >&2 + usage >&2 + exit 255 +} + +# preset some variables, wrong or not set in ddns-functions.sh +SECTION_ID="lucihelper" +LOGFILE="$ddns_logdir/$SECTION_ID.log" +DATFILE="$ddns_rundir/$SECTION_ID.$$.dat" # save stdout data of WGet and other extern programs called +ERRFILE="$ddns_rundir/$SECTION_ID.$$.err" # save stderr output of WGet and other extern programs called +DDNSPRG="/usr/lib/ddns/dynamic_dns_updater.sh" +VERBOSE=0 # no console logging +# global variables normally set by reading DDNS UCI configuration +use_syslog=0 # no syslog +use_logfile=0 # no logfile + +use_ipv6=0 # Use IPv6 - default IPv4 +force_ipversion=0 # Force IP Version - default 0 - No +force_dnstcp=0 # Force TCP on DNS - default 0 - No +is_glue=0 # Is glue record - default 0 - No +use_https=0 # not needed but must be set + +while getopts ":6d:fghi:l:n:p:s:S:tu:Lv:V" OPT; do + case "$OPT" in + 6) use_ipv6=1;; + d) dns_server="$OPTARG";; + f) force_ipversion=1;; + g) is_glue=1;; + i) ip_interface="$OPTARG"; ip_source="interface";; + l) lookup_host="$OPTARG";; + n) ip_network="$OPTARG"; ip_source="network";; + p) proxy="$OPTARG";; + s) ip_script="$OPTARG"; ip_source="script";; + t) force_dnstcp=1;; + u) ip_url="$OPTARG"; ip_source="web";; + h) usage; exit 255;; + L) use_logfile=1;; + v) VERBOSE=$OPTARG;; + S) SECTION=$OPTARG;; + V) printf %s\\n "ddns-scripts $VERSION"; exit 255;; + :) usage_err "option -$OPTARG missing argument";; + \?) usage_err "invalid option -$OPTARG";; + *) usage_err "unhandled option -$OPT $OPTARG";; + esac +done +shift $((OPTIND - 1 )) # OPTIND is 1 based + +[ $# -eq 0 ] && usage_err "missing command" + +__RET=0 +case "$1" in + get_registered_ip) + [ -z "$lookup_host" ] && usage_err "command 'get_registered_ip': 'lookup_host' not set" + write_log 7 "-----> get_registered_ip IP" + IP="" + get_registered_ip IP + __RET=$? + [ $__RET -ne 0 ] && IP="" + printf "%s" "$IP" + ;; + verify_dns) + [ -z "$dns_server" ] && usage_err "command 'verify_dns': 'dns_server' not set" + write_log 7 "-----> verify_dns '$dns_server'" + verify_dns "$dns_server" + __RET=$? + ;; + verify_proxy) + [ -z "$proxy" ] && usage_err "command 'verify_proxy': 'proxy' not set" + write_log 7 "-----> verify_proxy '$proxy'" + verify_proxy "$proxy" + __RET=$? + ;; + get_local_ip) + [ -z "$ip_source" ] && usage_err "command 'get_local_ip': 'ip_source' not set" + [ -n "$proxy" -a "$ip_source" = "web" ] && { + # proxy defined, used for ip_source=web + export HTTP_PROXY="http://$proxy" + export HTTPS_PROXY="http://$proxy" + export http_proxy="http://$proxy" + export https_proxy="http://$proxy" + } + # don't need IP only the return code + IP="" + if [ "$ip_source" = "web" -o "$ip_source" = "script" ]; then + # we wait only 3 seconds for an + # answer from "web" or "script" + write_log 7 "-----> timeout 3 -- get_local_ip IP" + timeout 3 -- get_local_ip IP + else + write_log 7 "-----> get_local_ip IP" + get_local_ip IP + fi + __RET=$? + ;; + start) + [ -z "$SECTION" ] && usage_err "command 'start': 'SECTION' not set" + if [ $VERBOSE -eq 0 ]; then # start in background + $DDNSPRG -v 0 -S $SECTION -- start & + else + $DDNSPRG -v $VERBOSE -S $SECTION -- start + fi + ;; + reload) + $DDNSPRG -- reload + ;; + restart) + $DDNSPRG -- stop + sleep 1 + $DDNSPRG -- start + ;; + *) + __RET=255 + ;; +esac + +# remove out and err file +[ -f $DATFILE ] && rm -f $DATFILE +[ -f $ERRFILE ] && rm -f $ERRFILE +return $__RET diff --git a/net/ddns-scripts/files/dynamic_dns_updater.sh b/net/ddns-scripts/files/dynamic_dns_updater.sh new file mode 100755 index 0000000..c58be2e --- /dev/null +++ b/net/ddns-scripts/files/dynamic_dns_updater.sh @@ -0,0 +1,419 @@ +#!/bin/sh +# /usr/lib/ddns/dynamic_dns_updater.sh +# +#.Distributed under the terms of the GNU General Public License (GPL) version 2.0 +# Original written by Eric Paul Bishop, January 2008 +# (Loosely) based on the script on the one posted by exobyte in the forums here: +# http://forum.openwrt.org/viewtopic.php?id=14040 +# extended and partial rewritten +#.2014-2016 Christian Schoenebeck +# +# variables in small chars are read from /etc/config/ddns +# variables in big chars are defined inside these scripts as global vars +# variables in big chars beginning with "__" are local defined inside functions only +# set -vx #script debugger + +. $(dirname $0)/dynamic_dns_functions.sh # global vars are also defined here + +usage() { + cat << EOF + +Usage: + $MYPROG [options] -- command + +Commands: +start Start SECTION or NETWORK or all +stop Stop NETWORK or all + +Parameters: + -n NETWORK Start/Stop sections in background monitoring NETWORK, force VERBOSE=0 + -S SECTION SECTION to start + use either -N NETWORK or -S SECTION + + -h show this help and exit + -V show version and exit + -v LEVEL VERBOSE=LEVEL (default 1) + '0' NO output to console + '1' output to console + '2' output to console AND logfile + + run once WITHOUT retry on error + '3' output to console AND logfile + + run once WITHOUT retry on error + + NOT sending update to DDNS service + +EOF +} + +usage_err() { + printf %s\\n "$MYPROG: $@" >&2 + usage >&2 + exit 1 +} + +while getopts ":hv:n:S:V" OPT; do + case "$OPT" in + h) usage; exit 0;; + v) VERBOSE=$OPTARG;; + n) NETWORK=$OPTARG;; + S) SECTION_ID=$OPTARG;; + V) printf %s\\n "ddns-scripts $VERSION"; exit 0;; + :) usage_err "option -$OPTARG missing argument";; + \?) usage_err "invalid option -$OPTARG";; + *) usage_err "unhandled option -$OPT $OPTARG";; + esac +done +shift $((OPTIND - 1 )) # OPTIND is 1 based + +[ -n "$NETWORK" -a -n "$SECTION_ID" ] && usage_err "use either option '-N' or '-S' not both" +[ $# -eq 0 ] && usage_err "missing command" +[ $# -gt 1 ] && usage_err "to much commands" + +case "$1" in + start) + if [ -n "$NETWORK" ]; then + start_daemon_for_all_ddns_sections "$NETWORK" + exit 0 + fi + if [ -z "$SECTION_ID" ]; then + start_daemon_for_all_ddns_sections + exit 0 + fi + ;; + stop) + if [ -n "$INTERFACE" ]; then + stop_daemon_for_all_ddns_sections "$NETWORK" + exit 0 + else + stop_daemon_for_all_ddns_sections + exit 0 + fi + exit 1 + ;; + reload) + killall -1 dynamic_dns_updater.sh 2>/dev/null + exit $? + ;; + *) usage_err "unknown command - $1";; +esac + +# set file names +PIDFILE="$ddns_rundir/$SECTION_ID.pid" # Process ID file +UPDFILE="$ddns_rundir/$SECTION_ID.update" # last update successful send (system uptime) +DATFILE="$ddns_rundir/$SECTION_ID.dat" # save stdout data of WGet and other extern programs called +ERRFILE="$ddns_rundir/$SECTION_ID.err" # save stderr output of WGet and other extern programs called +LOGFILE="$ddns_logdir/$SECTION_ID.log" # log file + +# VERBOSE > 1 delete logfile if exist to create an empty one +# only with this data of this run for easier diagnostic +# new one created by write_log function +[ $VERBOSE -gt 1 -a -f $LOGFILE ] && rm -f $LOGFILE + +# TRAP handler +trap "trap_handler 0 \$?" 0 # handle script exit with exit status +trap "trap_handler 1" 1 # SIGHUP Hangup / reload config +trap "trap_handler 2" 2 # SIGINT Terminal interrupt +trap "trap_handler 3" 3 # SIGQUIT Terminal quit +# trap "trap_handler 9" 9 # SIGKILL no chance to trap +trap "trap_handler 15" 15 # SIGTERM Termination + +################################################################################ +# Leave this comment here, to clearly document variable names that are expected/possible +# Use load_all_config_options to load config options, which is a much more flexible solution. +# +# config_load "ddns" +# config_get $SECTION_ID BCP 38.")) + +s = m:section(TypedSection, "bcp38", translate("BCP38 config")) +s.anonymous = true +-- BASIC +e = s:option(Flag, "enabled", translate("Enable")) +e.rmempty = false + +a = s:option(Flag, "detect_upstream", translate("Auto-detect upstream IP"), + translate("Attempt to automatically detect if the upstream IP " .. + "will be blocked by the configuration, and add an exception if it will. " .. + "If this does not work correctly, you can add exceptions manually below.")) +a.rmempty = false + +n = s:option(ListValue, "interface", translate("Interface name"), translate("Interface to apply the blocking to " .. + "(should be the upstream WAN interface).")) +for _, iface in ipairs(ifaces) do + if iface:is_up() then + n:value(iface:name()) + end +end +n.rmempty = false + +ma = s:option(DynamicList, "match", + translate("Blocked IP ranges")) + +ma.datatype = "ip4addr" + +nm = s:option(DynamicList, "nomatch", + translate("Allowed IP ranges"), translate("Takes precedence over blocked ranges. ".. + "Use to whitelist your upstream network if you're behind a double NAT " .. + "and the auto-detection doesn't work.")) + +nm.datatype = "ip4addr" + + +return m diff --git a/net/luci-app-bcp38/files/bcp38-controller.lua b/net/luci-app-bcp38/files/bcp38-controller.lua new file mode 100644 index 0000000..7ea2283 --- /dev/null +++ b/net/luci-app-bcp38/files/bcp38-controller.lua @@ -0,0 +1,7 @@ +module("luci.controller.bcp38", package.seeall) + +function index() + entry({"admin", "network", "firewall", "bcp38"}, + cbi("bcp38"), + _("BCP38"), 50).dependent = false +end diff --git a/net/luci-app-bcp38/files/uci-defaults-bcp38 b/net/luci-app-bcp38/files/uci-defaults-bcp38 new file mode 100755 index 0000000..c204236 --- /dev/null +++ b/net/luci-app-bcp38/files/uci-defaults-bcp38 @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@bcp38[-1] + add ucitrack bcp38 + add_list ucitrack.@bcp38[0].affects=firewall + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/net/luci-app-clamav/Makefile b/net/luci-app-clamav/Makefile new file mode 100644 index 0000000..fed8e63 --- /dev/null +++ b/net/luci-app-clamav/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2015 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-clamav +PKG_RELEASE:=20150520 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +PKG_LICENSE:=Apache-2.0 +PKG_MAINTAINER:=Marko Ratkaj + +include $(INCLUDE_DIR)/package.mk + +define Package/luci-app-clamav + SECTION:=luci + CATEGORY:=LuCI + SUBMENU:=3. Applications + TITLE:=ClamAV Web UI + DEPENDS:=+luci-mod-admin-full +clamav +endef + +define Package/luci-app-clamav/description + This package will install ClamAV Web UI. +endef + +define Build/Prepare +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/luci-app-clamav/install + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/ + $(INSTALL_BIN) \ + ./files/controller/clamav-controller.lua \ + $(1)/usr/lib/lua/luci/controller/clamav.lua + + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/ + $(INSTALL_BIN) \ + ./files/model/cbi/clamav-cbi.lua \ + $(1)/usr/lib/lua/luci/model/cbi/clamav.lua +endef + +$(eval $(call BuildPackage,luci-app-clamav)) diff --git a/net/luci-app-clamav/files/controller/clamav-controller.lua b/net/luci-app-clamav/files/controller/clamav-controller.lua new file mode 100644 index 0000000..02f3bfc --- /dev/null +++ b/net/luci-app-clamav/files/controller/clamav-controller.lua @@ -0,0 +1,22 @@ +--[[ + +LuCI ClamAV module + +Copyright (C) 2015, Itus Networks, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Author: Marko Ratkaj + Luka Perkov + +]]-- + +module("luci.controller.clamav", package.seeall) + +function index() + entry({"admin", "services", "clamav"}, cbi("clamav"), _("ClamAV")) +end diff --git a/net/luci-app-clamav/files/model/cbi/clamav-cbi.lua b/net/luci-app-clamav/files/model/cbi/clamav-cbi.lua new file mode 100644 index 0000000..ff98139 --- /dev/null +++ b/net/luci-app-clamav/files/model/cbi/clamav-cbi.lua @@ -0,0 +1,178 @@ +--[[ + +LuCI ClamAV module + +Copyright (C) 2015, Itus Networks, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Author: Marko Ratkaj + Luka Perkov + +]]-- + +local fs = require "nixio.fs" +local sys = require "luci.sys" +require "ubus" + +m = Map("clamav", translate("ClamAV")) +m.on_after_commit = function() luci.sys.call("/etc/init.d/clamav restart") end + +s = m:section(TypedSection, "clamav") +s.anonymous = true +s.addremove = false + +s:tab("tab_advanced", translate("Settings")) +s:tab("tab_logs", translate("Log")) + +--------------- Settings -------------- + +LogFileMaxSize = s:taboption("tab_advanced", Value, "LogFileMaxSize", translate("Max size of log file")) +LogFileMaxSize:value("512K", translate("512K")) +LogFileMaxSize:value("1M", translate("1M")) +LogFileMaxSize:value("2M", translate("2M")) +LogFileMaxSize.default = "1M" + +LogTime = s:taboption("tab_advanced", ListValue, "LogTime", translate("Log time with each message")) +LogTime:value("no", translate("No")) +LogTime:value("yes", translate("Yes")) +LogTime.default = "no" + +LogVerbose = s:taboption("tab_advanced", ListValue, "LogVerbose", translate("Enable verbose logging")) +LogVerbose:value("no", translate("No")) +LogVerbose:value("yes", translate("Yes")) +LogVerbose.default = "no" + +ExtendedDetectionInfo = s:taboption("tab_advanced", ListValue, "ExtendedDetectionInfo", translate("Log additional infection info")) +ExtendedDetectionInfo:value("no", translate("No")) +ExtendedDetectionInfo:value("yes", translate("Yes")) +ExtendedDetectionInfo.default = "no" + +dummy3 = s:taboption("tab_advanced", DummyValue, "") +dummy4 = s:taboption("tab_advanced", DummyValue, "") + +MaxDirectoryRecursion = s:taboption("tab_advanced", Value, "MaxDirectoryRecursion", translate("Max directory scan depth")) +MaxDirectoryRecursion:value("15", translate("15")) +MaxDirectoryRecursion:value("20", translate("20")) +MaxDirectoryRecursion.default = "15" + +FollowDirectorySymlink = s:taboption("tab_advanced", ListValue, "FollowDirectorySymlink", translate("Follow directory symlinks")) +FollowDirectorySymlink:value("no", translate("No")) +FollowDirectorySymlink:value("yes", translate("Yes")) +FollowDirectorySymlink.default = "no" + +FollowFileSymlinks = s:taboption("tab_advanced", ListValue, "FollowFileSymlinks", translate("Follow file symlinks")) +FollowFileSymlinks:value("no", translate("No")) +FollowFileSymlinks:value("yes", translate("Yes")) +FollowFileSymlinks.default = "no" + +DetectPUA = s:taboption("tab_advanced", ListValue, "DetectPUA", translate("Detect possibly unwanted apps")) +DetectPUA:value("no", translate("No")) +DetectPUA:value("yes", translate("Yes")) +DetectPUA.default = "no" + +ScanPE = s:taboption("tab_advanced", ListValue, "ScanPE", translate("Scan portable executables")) +ScanPE:value("no", translate("No")) +ScanPE:value("yes", translate("Yes")) +ScanPE.default = "yes" + +ScanELF = s:taboption("tab_advanced", ListValue, "ScanELF", translate("Scan ELF files")) +ScanELF:value("no", translate("No")) +ScanELF:value("yes", translate("Yes")) +ScanELF.default = "yes" + +DetectBrokenExecutables = s:taboption("tab_advanced", ListValue, "DetectBrokenExecutables", translate("Detect broken executables")) +DetectBrokenExecutables:value("no", translate("No")) +DetectBrokenExecutables:value("yes", translate("Yes")) +DetectBrokenExecutables.default = "no" + +ScanOLE2 = s:taboption("tab_advanced", ListValue, "ScanOLE2", translate("Scan MS Office and .msi files")) +ScanOLE2:value("no", translate("No")) +ScanOLE2:value("yes", translate("Yes")) +ScanOLE2.default = "yes" + +ScanPDF = s:taboption("tab_advanced", ListValue, "ScanPDF", translate("Scan pdf files")) +ScanPDF:value("no", translate("No")) +ScanPDF:value("yes", translate("Yes")) +ScanPDF.default = "yes" + +ScanSWF = s:taboption("tab_advanced", ListValue, "ScanSWF", translate("Scan swf files")) +ScanSWF:value("no", translate("No")) +ScanSWF:value("yes", translate("Yes")) +ScanSWF.default = "yes" + +ScanMail = s:taboption("tab_advanced", ListValue, "ScanMail", translate("Scan emails")) +ScanMail:value("no", translate("No")) +ScanMail:value("yes", translate("Yes")) +ScanMail.default = "yes" + +ScanPartialMessages = s:taboption("tab_advanced", ListValue, "ScanPartialMessages", translate("Scan RFC1341 messages split over many emails")) +ScanPartialMessages:value("no", translate("No")) +ScanPartialMessages:value("yes", translate("Yes")) +ScanPartialMessages.default = "no" + +ScanArchive = s:taboption("tab_advanced", ListValue, "ScanArchive", translate("Scan archives")) +ScanArchive:value("no", translate("No")) +ScanArchive:value("yes", translate("Yes")) +ScanArchive.default = "yes" + +ArchiveBlockEncrypted = s:taboption("tab_advanced", ListValue, "ArchiveBlockEncrypted", translate("Block encrypted archives")) +ArchiveBlockEncrypted:value("no", translate("No")) +ArchiveBlockEncrypted:value("yes", translate("Yes")) +ArchiveBlockEncrypted.default = "no" + +dummy5 = s:taboption("tab_advanced", DummyValue, "") +dummy6 = s:taboption("tab_advanced", DummyValue, "") + +StreamMinPort = s:taboption("tab_advanced", Value, "StreamMinPort", translate("Port range, lowest port")) +StreamMinPort.datatype = "portrange" +StreamMinPort:value("1024",translate("1024")) +StreamMinPort.default = "1024" + +StreamMaxPort = s:taboption("tab_advanced", Value, "StreamMaxPort", translate("Port range, highest port")) +StreamMaxPort.datatype = "portrange" +StreamMaxPort:value("2048",translate("2048")) +StreamMaxPort.default = "2048" + +MaxThreads = s:taboption("tab_advanced", Value, "MaxThreads", translate("Max number of threads")) +MaxThreads.datatype = "and(uinteger,min(1))" +MaxThreads:value("10",translate("10")) +MaxThreads:value("20",translate("20")) +MaxThreads.default = "10" + +SelfCheck = s:taboption("tab_advanced", Value, "SelfCheck", translate("Database check every N sec")) +SelfCheck.datatype = "and(uinteger,min(1))" +SelfCheck:value("600",translate("600")) +SelfCheck.default = "600" + +MaxFileSize = s:taboption("tab_advanced", Value, "MaxFileSize", translate("Max size of scanned file")) +MaxFileSize.datatype = "string" +MaxFileSize:value("150M",translate("150M")) +MaxFileSize:value("50M",translate("50M")) +MaxFileSize.default = "150M" + +------------------ Log -------------------- + +clamav_logfile = s:taboption("tab_logs", TextValue, "lines", "") +clamav_logfile.wrap = "off" +clamav_logfile.rows = 25 +clamav_logfile.rmempty = true + +function clamav_logfile.cfgvalue() + local uci = require "luci.model.uci".cursor_state() + local file = "/tmp/clamd.log" + if file then + return fs.readfile(file) or "" + else + return "" + end +end + +function clamav_logfile.write() +end + +return m diff --git a/net/luci-app-e2guardian/Makefile b/net/luci-app-e2guardian/Makefile new file mode 100644 index 0000000..880f373 --- /dev/null +++ b/net/luci-app-e2guardian/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2015 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-e2guardian +PKG_RELEASE:=20150520 + +PKG_LICENSE:=Apache-2.0 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/luci-app-e2guardian + SECTION:=luci + CATEGORY:=LuCI + SUBMENU:=3. Applications + TITLE:=E2Guardian Web UI + DEPENDS:=+luci-mod-admin-full +e2guardian + MAINTAINER:=Marko Ratkaj +endef + +define Package/luci-app-e2guardian/description + This package will install E2Guardian Web UI. +endef + +define Build/Prepare +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/luci-app-e2guardian/install + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/ + $(INSTALL_BIN) \ + ./files/e2guardian-controller.lua \ + $(1)/usr/lib/lua/luci/controller/e2guardian.lua + + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/ + $(INSTALL_BIN) \ + ./files//e2guardian-cbi.lua \ + $(1)/usr/lib/lua/luci/model/cbi/e2guardian.lua +endef + +$(eval $(call BuildPackage,luci-app-e2guardian)) diff --git a/net/luci-app-e2guardian/files/e2guardian-cbi.lua b/net/luci-app-e2guardian/files/e2guardian-cbi.lua new file mode 100644 index 0000000..b621321 --- /dev/null +++ b/net/luci-app-e2guardian/files/e2guardian-cbi.lua @@ -0,0 +1,399 @@ +--[[ + +LuCI E2Guardian module + +Copyright (C) 2015, Itus Networks, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Author: Marko Ratkaj + Luka Perkov + +]]-- + +local fs = require "nixio.fs" +local sys = require "luci.sys" + +m = Map("e2guardian", translate("E2Guardian")) +m.on_after_commit = function() luci.sys.call("/etc/init.d/e2guardian restart") end + +s = m:section(TypedSection, "e2guardian") +s.anonymous = true +s.addremove = false + +s:tab("tab_general", translate("General Settings")) +s:tab("tab_additional", translate("Additional Settings")) +s:tab("tab_logs", translate("Logs")) + + +----------------- General Settings Tab ----------------------- + +filterip = s:taboption("tab_general", Value, "filterip", translate("IP that E2Guardian listens")) +filterip.datatype = "ip4addr" + +filterports = s:taboption("tab_general", Value, "filterports", translate("Port that E2Guardian listens")) +filterports.datatype = "portrange" +filterports.placeholder = "0-65535" + +proxyip = s:taboption("tab_general", Value, "proxyip", translate("IP address of the proxy")) +proxyip.datatype = "ip4addr" +proxyip.default = "127.0.0.1" + +proxyport = s:taboption("tab_general", Value, "proxyport", translate("Port of the proxy")) +proxyport.datatype = "portrange" +proxyport.placeholder = "0-65535" + +languagedir = s:taboption("tab_general", Value, "languagedir", translate("Language dir")) +languagedir.datatype = "string" +languagedir.default = "/usr/share/e2guardian/languages" + +language = s:taboption("tab_general", Value, "language", translate("Language to use")) +language.datatype = "string" +language.default = "ukenglish" + +loglevel = s:taboption("tab_general", ListValue, "loglevel", translate("Logging Settings")) +loglevel:value("0", translate("none")) +loglevel:value("1", translate("just denied")) +loglevel:value("2", translate("all text based")) +loglevel:value("3", translate("all requests")) +loglevel.default = "2" + +logexceptionhits = s:taboption("tab_general", ListValue, "logexceptionhits", translate("Log Exception Hits")) +logexceptionhits:value("0", translate("never")) +logexceptionhits:value("1", translate("log, but don't mark as exceptions")) +logexceptionhits:value("2", translate("log and mark")) +logexceptionhits.default = "2" + +logfileformat = s:taboption("tab_general", ListValue, "logfileformat", translate("Log File Format")) +logfileformat:value("1", translate("DansgGuardian format, space delimited")) +logfileformat:value("2", translate("CSV-style format")) +logfileformat:value("3", translate("Squid Log File Format")) +logfileformat:value("4", translate("Tab delimited")) +logfileformat:value("5", translate("Protex format")) +logfileformat:value("6", translate("Protex format with server field blanked")) +logfileformat.default = "1" + +accessdeniedaddress = s:taboption("tab_general", Value, "accessdeniedaddress", translate("Access denied address"), +translate("Server to which the cgi e2guardian reporting script was copied. Reporting levels 1 and 2 only")) +accessdeniedaddress.datatype = "string" +accessdeniedaddress.default = "http://YOURSERVER.YOURDOMAIN/cgi-bin/e2guardian.pl" + +usecustombannedimage = s:taboption("tab_general", ListValue, "usecustombannedimage", translate("Banned image replacement")) +usecustombannedimage:value("on", translate("Yes")) +usecustombannedimage:value("off", translate("No")) +usecustombannedimage.default = "on" + +custombannedimagefile = s:taboption("tab_general", Value, "custombannedimagefile", translate("Custom banned image file")) +custombannedimagefile.datatype = "string" +custombannedimagefile.default = "/usr/share/e2guardian/transparent1x1.gif" + +usecustombannedflash = s:taboption("tab_general", ListValue, "usecustombannedflash", translate("Banned flash replacement")) +usecustombannedflash:value("on", translate("Yes")) +usecustombannedflash:value("off", translate("No")) +usecustombannedflash.default = "on" + +custombannedflashfile = s:taboption("tab_general", Value, "custombannedflashfile", translate("Custom banned flash file")) +custombannedflashfile.datatype = "string" +custombannedflashfile.default = "/usr/share/e2guardian/blockedflash.swf" + +filtergroups = s:taboption("tab_general", Value, "filtergroups", translate("Number of filter groups")) +filtergroups.datatype = "and(uinteger,min(1))" +filtergroups.default = "1" + +filtergroupslist = s:taboption("tab_general", Value, "filtergroupslist", translate("List of filter groups")) +filtergroupslist.datatype = "string" +filtergroupslist.default = "/etc/e2guardian/lists/filtergroupslist" + +bannediplist = s:taboption("tab_general", Value, "bannediplist", translate("List of banned IPs")) +bannediplist.datatype = "string" +bannediplist.default = "/etc/e2guardian/lists/bannediplist" + +exceptioniplist = s:taboption("tab_general", Value, "exceptioniplist", translate("List of IP exceptions")) +exceptioniplist.datatype = "string" +exceptioniplist.default = "/etc/e2guardian/lists/exceptioniplist" + +perroomblockingdirectory = s:taboption("tab_general", Value, "perroomblockingdirectory", translate("Per-Room blocking definition directory")) +perroomblockingdirectory.datatype = "string" +perroomblockingdirectory.default = "/etc/e2guardian/lists/bannedrooms/" + +showweightedfound = s:taboption("tab_general", ListValue, "showweightedfound", translate("Show weighted phrases found")) +showweightedfound:value("on", translate("Yes")) +showweightedfound:value("off", translate("No")) +showweightedfound.default = "on" + +weightedphrasemode = s:taboption("tab_general", ListValue, "weightedphrasemode", translate("Weighted phrase mode")) +weightedphrasemode:value("0", translate("off")) +weightedphrasemode:value("1", translate("on, normal operation")) +weightedphrasemode:value("2", translate("on, phrase found only counts once on a page")) +weightedphrasemode.default = "2" + +urlcachenumber = s:taboption("tab_general", Value, "urlcachenumber", translate("Clean result caching for URLs")) +urlcachenumber.datatype = "and(uinteger,min(0))" +urlcachenumber.default = "1000" + +urlcacheage = s:taboption("tab_general", Value, "urlcacheage", translate("Age before they should be ignored in seconds")) +urlcacheage.datatype = "and(uinteger,min(0))" +urlcacheage.default = "900" + +scancleancache = s:taboption("tab_general", ListValue, "scancleancache", translate("Cache for content (AV) scans as 'clean'")) +scancleancache:value("on", translate("Yes")) +scancleancache:value("off", translate("No")) +scancleancache.default = "on" + +phrasefiltermode = s:taboption("tab_general", ListValue, "phrasefiltermode", translate("Filtering options")) +phrasefiltermode:value("0", translate("raw")) +phrasefiltermode:value("1", translate("smart")) +phrasefiltermode:value("2", translate("both raw and smart")) +phrasefiltermode:value("3", translate("meta/title")) +phrasefiltermode.default = "2" + +preservecase = s:taboption("tab_general", ListValue, "perservecase", translate("Lower caseing options")) +preservecase:value("0", translate("force lower case")) +preservecase:value("1", translate("don't change")) +preservecase:value("2", translate("scan fist in lower, then in original")) +preservecase.default = "0" + +hexdecodecontent = s:taboption("tab_general", ListValue, "hexdecodecontent", translate("Hex decoding options")) +hexdecodecontent:value("on", translate("Yes")) +hexdecodecontent:value("off", translate("No")) +hexdecodecontent.default = "off" + +forcequicksearch = s:taboption("tab_general", ListValue, "forcequicksearch", translate("Quick search")) +forcequicksearch:value("on", translate("Yes")) +forcequicksearch:value("off", translate("No")) +forcequicksearch.default = "off" + +reverseaddresslookups= s:taboption("tab_general", ListValue, "reverseaddresslookups", translate("Reverse lookups for banned site and URLs")) +reverseaddresslookups:value("on", translate("Yes")) +reverseaddresslookups:value("off", translate("No")) +reverseaddresslookups.default = "off" + +reverseclientiplookups = s:taboption("tab_general", ListValue, "reverseclientiplookups", translate("Reverse lookups for banned and exception IP lists")) +reverseclientiplookups:value("on", translate("Yes")) +reverseclientiplookups:value("off", translate("No")) +reverseclientiplookups.default = "off" + +logclienthostnames = s:taboption("tab_general", ListValue, "logclienthostnames", translate("Perform reverse lookups on client IPs for successful requests")) +logclienthostnames:value("on", translate("Yes")) +logclienthostnames:value("off", translate("No")) +logclienthostnames.default = "off" + +createlistcachefiles = s:taboption("tab_general", ListValue, "createlistcachefiles", translate("Build bannedsitelist and bannedurllist cache files")) +createlistcachefiles:value("on",translate("Yes")) +createlistcachefiles:value("off",translate("No")) +createlistcachefiles.default = "on" + +prefercachedlists = s:taboption("tab_general", ListValue, "prefercachedlists", translate("Prefer cached list files")) +prefercachedlists:value("on", translate("Yes")) +prefercachedlists:value("off", translate("No")) +prefercachedlists.default = "off" + +maxuploadsize = s:taboption("tab_general", Value, "maxuploadsize", translate("Max upload size (in Kbytes)")) +maxuploadsize:value("-1", translate("no blocking")) +maxuploadsize:value("0", translate("complete block")) +maxuploadsize.default = "-1" + +maxcontentfiltersize = s:taboption("tab_general", Value, "maxcontentfiltersize", translate("Max content filter size"), +translate("The value must not be higher than max content ram cache scan size or 0 to match it")) +maxcontentfiltersize.datatype = "and(uinteger,min(0))" +maxcontentfiltersize.default = "256" + +maxcontentramcachescansize = s:taboption("tab_general", Value, "maxcontentramcachescansize", translate("Max content ram cache scan size"), +translate("This is the max size of file that DG will download and cache in RAM")) +maxcontentramcachescansize.datatype = "and(uinteger,min(0))" +maxcontentramcachescansize.default = "2000" + +maxcontentfilecachescansize = s:taboption("tab_general", Value, "maxcontentfilecachescansize", translate("Max content file cache scan size")) +maxcontentfilecachescansize.datatype = "and(uinteger,min(0))" +maxcontentfilecachescansize.default = "20000" + +proxytimeout = s:taboption("tab_general", Value, "proxytimeout", translate("Proxy timeout (5-100)")) +proxytimeout.datatype = "range(5,100)" +proxytimeout.default = "20" + +proxyexchange = s:taboption("tab_general", Value, "proxyexchange", translate("Proxy header excahnge (20-300)")) +proxyexchange.datatype = "range(20,300)" +proxyexchange.default = "20" + +pcontimeout = s:taboption("tab_general", Value, "pcontimeout", translate("Pconn timeout"), +translate("How long a persistent connection will wait for other requests")) +pcontimeout.datatype = "range(5,300)" +pcontimeout.default = "55" + +filecachedir = s:taboption("tab_general", Value, "filecachedir", translate("File cache directory")) +filecachedir.datatype = "string" +filecachedir.default = "/tmp" + +deletedownloadedtempfiles = s:taboption("tab_general", ListValue, "deletedownloadedtempfiles", translate("Delete file cache after user completes download")) +deletedownloadedtempfiles:value("on", translate("Yes")) +deletedownloadedtempfiles:value("off", translate("No")) +deletedownloadedtempfiles.default = "on" + +initialtrickledelay = s:taboption("tab_general", Value, "initialtrickledelay", translate("Initial Trickle delay"), +translate("Number of seconds a browser connection is left waiting before first being sent *something* to keep it alive")) +initialtrickledelay.datatype = "and(uinteger,min(0))" +initialtrickledelay.default = "20" + +trickledelay = s:taboption("tab_general", Value, "trickledelay", translate("Trickle delay"), +translate("Number of seconds a browser connection is left waiting before being sent more *something* to keep it alive")) +trickledelay.datatype = "and(uinteger,min(0))" +trickledelay.default = "10" + +downloadmanager = s:taboption("tab_general", Value, "downloadmanager", translate("Download manager")) +downloadmanager.datatype = "string" +downloadmanager.default = "/etc/e2guardian/downloadmanagers/default.conf" + +contentscannertimeout = s:taboption("tab_general", Value, "contentscannertimeout", translate("Content scanner timeout")) +contentscannertimeout.datatype = "and(uinteger,min(0))" +contentscannertimeout.default = "60" + +contentscanexceptions = s:taboption("tab_general", ListValue, "contentscanexceptions", translate("Content scan exceptions")) +contentscanexceptions:value("on", translate("Yes")) +contentscanexceptions:value("off", translate("No")) +contentscanexceptions.default = "off" + +recheckreplacedurls = s:taboption("tab_general", ListValue, "recheckreplacedurls", translate("e-check replaced URLs")) +recheckreplacedurls:value("on", translate("Yes")) +recheckreplacedurls:value("off", translate("No")) +recheckreplacedurls.default = "off" + +forwardedfor = s:taboption("tab_general", ListValue, "forwardedfor", translate("Misc setting: forwardedfor"), +translate("If on, it may help solve some problem sites that need to know the source ip.")) +forwardedfor:value("on", translate("Yes")) +forwardedfor:value("off", translate("No")) +forwardedfor.default = "off" + +usexforwardedfor = s:taboption("tab_general", ListValue, "usexforwardedfor", translate("Misc setting: usexforwardedfor"), +translate("This is for when you have squid between the clients and E2Guardian")) +usexforwardedfor:value("on", translate("Yes")) +usexforwardedfor:value("off", translate("No")) +usexforwardedfor.default = "off" + +logconnectionhandlingerrors = s:taboption("tab_general", ListValue, "logconnectionhandlingerrors", translate("Log debug info about log()ing and accept()ing")) +logconnectionhandlingerrors:value("on", translate("Yes")) +logconnectionhandlingerrors:value("off", translate("No")) +logconnectionhandlingerrors.default = "on" + +logchildprocesshandling = s:taboption("tab_general", ListValue, "logchildprocesshandling", translate("Log child process handling")) +logchildprocesshandling:value("on", translate("Yes")) +logchildprocesshandling:value("off", translate("No")) +logchildprocesshandling.default = "off" + +maxchildren = s:taboption("tab_general", Value, "maxchildren", translate("Max number of processes to spawn")) +maxchildren.datatype = "and(uinteger,min(0))" +maxchildren.default = "180" + +minchildren = s:taboption("tab_general", Value, "minchildren", translate("Min number of processes to spawn")) +minchildren.datatype = "and(uinteger,min(0))" +minchildren.default = "20" + +minsparechildren = s:taboption("tab_general", Value, "minsparechildren", translate("Min number of processes to keep ready")) +minsparechildren.datatype = "and(uinteger,min(0))" +minsparechildren.default = "16" + +preforkchildren = s:taboption("tab_general", Value, "preforkchildren", translate("Sets minimum nuber of processes when it runs out")) +preforkchildren.datatype = "and(uinteger,min(0))" +preforkchildren.default = "10" + +maxsparechildren = s:taboption("tab_general", Value, "maxsparechildren", translate("Sets the maximum number of processes to have doing nothing")) +maxsparechildren.datatype = "and(uinteger,min(0))" +maxsparechildren.default = "32" + +maxagechildren = s:taboption("tab_general", Value, "maxagechildren", translate("Max age of child process")) +maxagechildren.datatype = "and(uinteger,min(0))" +maxagechildren.default = "500" + +maxips = s:taboption("tab_general", Value, "maxips", translate("Max number of clinets allowed to connect")) +maxips:value("0", translate("no limit")) +maxips.default = "0" + +ipipcfilename = s:taboption("tab_general", Value, "ipipcfilename", translate("IP list IPC server directory and filename")) +ipipcfilename.datatype = "string" +ipipcfilename.default = "/tmp/.dguardianipc" + +urlipcfilename = s:taboption("tab_general", Value, "urlipcfilename", translate("Defines URL list IPC server directory and filename used to communicate with the URL cache process")) +urlipcfilename.datatype = "string" +urlipcfilename.default = "/tmp/.dguardianurlipc" + +ipcfilename = s:taboption("tab_general", Value, "ipcfilename", translate("Defines URL list IPC server directory and filename used to communicate with the URL cache process")) +ipcfilename.datatype = "string" +ipcfilename.default = "/tmp/.dguardianipipc" + +nodeamon = s:taboption("tab_general", ListValue, "nodeamon", translate("Disable deamoning")) +nodeamon:value("on", translate("Yes")) +nodeamon:value("off", translate("No")) +nodeamon.default = "off" + +nologger = s:taboption("tab_general", ListValue, "nologger", translate("Disable logger")) +nologger:value("on", translate("Yes")) +nologger:value("off", translate("No")) +nologger.default = "off" + +logadblock = s:taboption("tab_general", ListValue, "logadblock", translate("Enable logging of ADs")) +logadblock:value("on", translate("Yes")) +logadblock:value("off", translate("No")) +logadblock.default = "off" + +loguseragent = s:taboption("tab_general", ListValue, "loguseragent", translate("Enable logging of client user agent")) +loguseragent:value("on", translate("Yes")) +loguseragent:value("off", translate("No")) +loguseragent.default = "off" + +softrestart = s:taboption("tab_general", ListValue, "softrestart", translate("Enable soft restart")) +softrestart:value("on", translate("Yes")) +softrestart:value("off", translate("No")) +softrestart.default = "off" + + +------------------------ Additional Settings Tab ---------------------------- + +e2guardian_config_file = s:taboption("tab_additional", TextValue, "_data", "") +e2guardian_config_file.wrap = "off" +e2guardian_config_file.rows = 25 +e2guardian_config_file.rmempty = false + +function e2guardian_config_file.cfgvalue() + local uci = require "luci.model.uci".cursor_state() + file = "/etc/e2guardian/e2guardianf1.conf" + if file then + return fs.readfile(file) or "" + else + return "" + end +end + +function e2guardian_config_file.write(self, section, value) + if value then + local uci = require "luci.model.uci".cursor_state() + file = "/etc/e2guardian/e2guardianf1.conf" + fs.writefile(file, value:gsub("\r\n", "\n")) + end +end + + +---------------------------- Logs Tab ----------------------------- + +e2guardian_logfile = s:taboption("tab_logs", TextValue, "lines", "") +e2guardian_logfile.wrap = "off" +e2guardian_logfile.rows = 25 +e2guardian_logfile.rmempty = true + +function e2guardian_logfile.cfgvalue() + local uci = require "luci.model.uci".cursor_state() + file = "/tmp/e2guardian/access.log" + if file then + return fs.readfile(file) or "" + else + return "Can't read log file" + end +end + +function e2guardian_logfile.write() + return "" +end + +return m diff --git a/net/luci-app-e2guardian/files/e2guardian-controller.lua b/net/luci-app-e2guardian/files/e2guardian-controller.lua new file mode 100644 index 0000000..dd545f5 --- /dev/null +++ b/net/luci-app-e2guardian/files/e2guardian-controller.lua @@ -0,0 +1,22 @@ +--[[ + +LuCI E2Guardian module + +Copyright (C) 2015, Itus Networks, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Author: Marko Ratkaj + Luka Perkov + +]]-- + +module("luci.controller.e2guardian", package.seeall) + +function index() + entry({"admin", "services", "e2guardian"}, cbi("e2guardian"), _("E2Guardian")) +end diff --git a/net/luci-app-squid/Makefile b/net/luci-app-squid/Makefile new file mode 100644 index 0000000..91ce724 --- /dev/null +++ b/net/luci-app-squid/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2015 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-squid +PKG_RELEASE:=20150608 + +PKG_LICENSE:=Apache-2.0 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/luci-app-squid + SECTION:=luci + CATEGORY:=LuCI + SUBMENU:=3. Applications + TITLE:=Squid Web UI + DEPENDS:=+luci-mod-admin-full +squid + MAINTAINER:=Marko Ratkaj +endef + +define Package/luci-app-squid/description + This package will install Squid Web UI. +endef + +define Build/Prepare +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/luci-app-squid/install + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/ + $(INSTALL_BIN) \ + ./files/squid-controller.lua \ + $(1)/usr/lib/lua/luci/controller/squid.lua + + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/ + $(INSTALL_BIN) \ + ./files//squid-cbi.lua \ + $(1)/usr/lib/lua/luci/model/cbi/squid.lua +endef + +$(eval $(call BuildPackage,luci-app-squid)) diff --git a/net/luci-app-squid/files/squid-cbi.lua b/net/luci-app-squid/files/squid-cbi.lua new file mode 100644 index 0000000..0ac554a --- /dev/null +++ b/net/luci-app-squid/files/squid-cbi.lua @@ -0,0 +1,67 @@ +--[[ + +LuCI Squid module + +Copyright (C) 2015, OpenWrt.org + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Author: Marko Ratkaj + +]]-- + +local fs = require "nixio.fs" +local sys = require "luci.sys" +require "ubus" + +m = Map("squid", translate("Squid")) +m.on_after_commit = function() luci.sys.call("/etc/init.d/squid restart") end + +s = m:section(TypedSection, "squid") +s.anonymous = true +s.addremove = false + +s:tab("general", translate("General Settings")) + +http_port = s:taboption("general", Value, "http_port", translate("Port")) +http_port.datatype = "portrange" +http_port.placeholder = "0-65535" + +visible_hostname = s:taboption("general", Value, "visible_hostname", translate("Visible Hostname")) +visible_hostname.datatype="string" +visible_hostname.placeholder = "OpenWrt" + +coredump_dir = s:taboption("general", Value, "coredump_dir", translate("Coredump files directory")) +coredump_dir.datatype="string" +coredump_dir.placeholder = "/tmp/squid" + +s:tab("advanced", translate("Advanced Settings")) + +squid_config_file = s:taboption("advanced", TextValue, "_data", "") +squid_config_file.wrap = "off" +squid_config_file.rows = 25 +squid_config_file.rmempty = false + +function squid_config_file.cfgvalue() + local uci = require "luci.model.uci".cursor_state() + local file = uci:get("squid", "squid", "config_file") + if file then + return fs.readfile(file) or "" + else + return "" + end +end + +function squid_config_file.write(self, section, value) + if value then + local uci = require "luci.model.uci".cursor_state() + local file = uci:get("squid", "squid", "config_file") + fs.writefile(file, value:gsub("\r\n", "\n")) + end +end + +return m diff --git a/net/luci-app-squid/files/squid-controller.lua b/net/luci-app-squid/files/squid-controller.lua new file mode 100644 index 0000000..09946a1 --- /dev/null +++ b/net/luci-app-squid/files/squid-controller.lua @@ -0,0 +1,21 @@ +--[[ + +LuCI Squid module + +Copyright (C) 2015, OpenWrt.org + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Author: Marko Ratkaj + +]]-- + +module("luci.controller.squid", package.seeall) + +function index() + entry({"admin", "services", "squid"}, cbi("squid"), _("Squid")) +end diff --git a/net/mac-telnet/Makefile b/net/mac-telnet/Makefile new file mode 100644 index 0000000..024ce75 --- /dev/null +++ b/net/mac-telnet/Makefile @@ -0,0 +1,71 @@ +# +# Copyright (C) 2014-2015 OpenWrt.org +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=mac-telnet +PKG_VERSION:=2015-09-02 +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/jow-/MAC-Telnet.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=37d83cbc9c07266d6c957d27bf75285b305eceab +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_LICENSE:=GPL-2.0+ +PKG_MAINTAINER:=Jo-Philipp Wich + +include $(INCLUDE_DIR)/package.mk + +TARGET_CFLAGS += -ffunction-sections -fdata-sections $(if $(CONFIG_MACTELNET_PLAIN_SUPPORT),-DTELNET_SUPPORT) +TARGET_LDFLAGS += -Wl,--gc-sections + +# 1: name +# 2: executable +define BuildPlugin + define Package/mac-telnet-$(1) + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libubox + TITLE:=MAC-Telnet / MAC-SSH $(1) + URL:=https://github.com/jow-/MAC-Telnet + endef + + define Package/mac-telnet-$(1)/description + Open source MAC Telnet client and server utilities for connecting to + Mikrotik RouterOS routers and Linux machines via MAC address. + endef + + define Package/mac-telnet-$(1)/install + $(INSTALL_DIR) $$(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(2) $$(1)/usr/sbin/ + $(call Package/mac-telnet-$(1)/install-extra) + endef + + $$(eval $$(call BuildPackage,mac-telnet-$(1))) +endef + +define Package/mac-telnet-server/config + config MACTELNET_PLAIN_SUPPORT + bool "Include support for plain telnet connections" + depends on PACKAGE_mac-telnet-server + default y + help + Disable this option to only support SSH logins to the + MAC-Telnet server. +endef + +define Package/mac-telnet-server/install-extra + $(INSTALL_DIR) $$(1)/etc/init.d + $(INSTALL_BIN) ./files/mactelnet.init $$(1)/etc/init.d/mactelnet + $(INSTALL_DIR) $$(1)/etc/config + $(INSTALL_DATA) ./files/mactelnet.config $$(1)/etc/config/mactelnet +endef + + +$(eval $(call BuildPlugin,server,mactelnetd)) +$(eval $(call BuildPlugin,client,mactelnet)) +$(eval $(call BuildPlugin,ping,macping)) +$(eval $(call BuildPlugin,discover,mndp)) diff --git a/net/mac-telnet/files/mactelnet.config b/net/mac-telnet/files/mactelnet.config new file mode 100644 index 0000000..ddf7157 --- /dev/null +++ b/net/mac-telnet/files/mactelnet.config @@ -0,0 +1,9 @@ +# Global settings for MAC-Telnet daemon +config mactelnetd + option sshmode '0' + list interface 'lan' + +# Define a MAC-Telnet login, multiple login sections allowed +config login + option username 'root' + option password '' diff --git a/net/mac-telnet/files/mactelnet.init b/net/mac-telnet/files/mactelnet.init new file mode 100755 index 0000000..701ce98 --- /dev/null +++ b/net/mac-telnet/files/mactelnet.init @@ -0,0 +1,80 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014 OpenWrt.org + +START=60 + +USE_PROCD=1 + +PROG=/usr/sbin/mactelnetd +USERS=/var/etc/mactelnetd.users +SSHMODE=0 + +add_account() { + local cfg="$1" + local user pass + + [ $SSHMODE -eq 0 ] || { + [ -n "$already_warned" ] || { + echo "mactelnet.$cfg: login sections ignored in SSH mode" >&1 + already_warned=1 + } + return + } + + config_get username "$cfg" username + config_get password "$cfg" password + + [ -n "$username" ] || { + echo "mactelnet.$cfg: username missing" >&2 + return + } + + [ -n "$password" ] || { + echo "mactelnet.$cfg: password missing" >&2 + return + } + + echo "$username:$password" >> $USERS +} + +add_interface() { + local iface="$1" + local device + + [ -n "$iface" ] || return + + if network_get_physdev device "$iface"; then + procd_append_param command -i "$device" + fi + + procd_add_reload_interface_trigger "$iface" +} + +add_globals() { + local cfg="$1" + + config_get_bool SSHMODE "$cfg" sshmode 0 + [ $SSHMODE -eq 0 ] || procd_append_param command -S + + config_list_foreach "$cfg" interface add_interface +} + +start_service() { + . /lib/functions/network.sh + + procd_open_instance + + procd_add_reload_trigger mactelnet + procd_set_param command "$PROG" -f + + config_load mactelnet + config_foreach add_globals mactelnetd + + [ $SSHMODE -eq 1 ] || { + rm -f $USERS + config_foreach add_account login + } + + procd_close_instance +} + diff --git a/net/mdnsresponder/Makefile b/net/mdnsresponder/Makefile new file mode 100644 index 0000000..4b2f5be --- /dev/null +++ b/net/mdnsresponder/Makefile @@ -0,0 +1,164 @@ +# +# 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:=mDNSResponder +PKG_VERSION:=576.30.4 +PKG_RELEASE:=1 + +PKG_SOURCE:=mDNSResponder-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://opensource.apple.com/tarballs/mDNSResponder/ +PKG_MD5SUM:=940057ac8b513b00e8e9ca12ef796762 +PKG_MAINTAINER:=Steven Barth +PKG_LICENSE:=Apache-2.0 + +PKG_BUILD_DIR:=$(BUILD_DIR)/mDNSResponder-$(PKG_VERSION) + +PKG_BUILD_PARALLEL:=0 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +# sys/capability.h is not part of *libc* +PKG_BUILD_DEPENDS:=libcap + +define Package/mDNSResponder/Default + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names + TITLE:=mDNS + URL:=http://developer.apple.com/networking/bonjour/ +endef + +define Package/mDNSResponder/Default/description + Bonjour, also known as zero-configuration networking, enables + automatic discovery of computers, devices, and services on + IP networks. +endef + +define Package/mdns-utils +$(call Package/mDNSResponder/Default) + TITLE+= client utilities + DEPENDS+= +mdnsd +endef + +define Package/mdns-utils/description +$(call Package/mDNSResponder/Default/description) + . + This package contains mDNS client utilities: + - dns-sd + - mDNSClient + - mDNSIdentify + - mDNSNetMonitor + - mDNSProxyResponder + - mDNSResponder +endef + +define Package/mdnsd +$(call Package/mDNSResponder/Default) + TITLE+= server daemon +endef + +define Package/mdnsd/description +$(call Package/mDNSResponder/Default/description) + . + This package contains the mDNS server daemon. +endef + +define Package/mdnsresponder +$(call Package/mDNSResponder/Default) + TITLE+= suite (meta) + DEPENDS+= +mdns-utils +mdnsd +endef + +define Package/mdnsresponder/description +$(call Package/mDNSResponder/Default/description) + . + This meta package contains only dependencies on other packages. +endef + +# I have no idea why -lc is required, but without it, C library symbols are +# not found: +MAKE_FLAGS += \ + LD="$(TARGET_CC)" \ + CFLAGS_DEBUG="$(TARGET_CFLAGS)" \ + LINKOPTS=-lc \ + LDCONFIG= \ + ETCBASE="$(PKG_INSTALL_DIR)/etc" \ + INSTBASE="$(PKG_INSTALL_DIR)/usr" \ + NSSINSTPATH="$(PKG_INSTALL_DIR)/lib" \ + MANPATH="$(PKG_INSTALL_DIR)/usr/man" \ + STARTUPSCRIPTDIR="$(PKG_INSTALL_DIR)/etc/init.d" \ + RUNLEVELSCRIPTSDIR="$(PKG_INSTALL_DIR)/etc/rc.d" \ + os=linux-uclibc +MAKE_PATH = mDNSPosix + +define Build/Compile + $(call Build/Compile/Default) + # XXX: mDNSResponder's "make install" does not seem to create: + mkdir -p $(PKG_INSTALL_DIR)/lib/ + mkdir -p $(PKG_INSTALL_DIR)/usr/bin/ + mkdir -p $(PKG_INSTALL_DIR)/usr/sbin/ + mkdir -p $(PKG_INSTALL_DIR)/usr/lib/ + mkdir -p $(PKG_INSTALL_DIR)/usr/man/man5/ + mkdir -p $(PKG_INSTALL_DIR)/usr/man/man8/ + mkdir -p $(PKG_INSTALL_DIR)/usr/include/ + mkdir -p $(PKG_INSTALL_DIR)/etc/ + mkdir -p $(PKG_INSTALL_DIR)/etc/init.d/ + mkdir -p $(PKG_INSTALL_DIR)/etc/rc.d/ + mkdir -p $(PKG_INSTALL_DIR)/etc/rc.d/rc2.d/ + mkdir -p $(PKG_INSTALL_DIR)/etc/rc.d/rc3.d/ + mkdir -p $(PKG_INSTALL_DIR)/etc/rc.d/rc4.d/ + mkdir -p $(PKG_INSTALL_DIR)/etc/rc.d/rc5.d/ + mkdir -p $(PKG_INSTALL_DIR)/etc/rc.d/rc0.d/ + mkdir -p $(PKG_INSTALL_DIR)/etc/rc.d/rc6.d/ +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/mDNSShared/dns_sd.h $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/mDNSPosix/build/prod/*.so* $(1)/usr/lib/ +endef + +define Package/mdns-utils/install + $(INSTALL_DIR) $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/dns-sd $(1)/usr/bin/ + $(CP) $(PKG_BUILD_DIR)/mDNSPosix/build/prod/mDNSClientPosix $(1)/usr/bin/mDNSClient + $(CP) $(PKG_BUILD_DIR)/mDNSPosix/build/prod/mDNSIdentify $(1)/usr/bin/mDNSIdentify + $(CP) $(PKG_BUILD_DIR)/mDNSPosix/build/prod/mDNSNetMonitor $(1)/usr/bin/mDNSNetMonitor + $(CP) $(PKG_BUILD_DIR)/mDNSPosix/build/prod/mDNSProxyResponderPosix $(1)/usr/bin/mDNSProxyResponder + $(CP) $(PKG_BUILD_DIR)/mDNSPosix/build/prod/mDNSResponderPosix $(1)/usr/bin/mDNSResponder + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) ./files/mDNSResponder.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/mDNSResponder.init $(1)/etc/init.d/mDNSResponder +endef + +define Package/mdns-utils/conffiles +/etc/mDNSResponder.conf +endef + +define Package/mdnsd/install + $(INSTALL_DIR) $(1)/usr/sbin/ + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/mdnsd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/mdnsd.init $(1)/etc/init.d/mdnsd + $(INSTALL_DIR) $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdns_sd.so.1 $(1)/usr/lib/ + $(LN) -s libdns_sd.so.1 $(1)/usr/lib/libdns_sd.so +endef + +define Package/mdnsresponder/install + : +endef + +$(eval $(call BuildPackage,mdns-utils)) +$(eval $(call BuildPackage,mdnsd)) +$(eval $(call BuildPackage,mdnsresponder)) diff --git a/net/mdnsresponder/files/mDNSResponder.conf b/net/mdnsresponder/files/mDNSResponder.conf new file mode 100644 index 0000000..23aab16 --- /dev/null +++ b/net/mdnsresponder/files/mDNSResponder.conf @@ -0,0 +1,4 @@ +"OpenWrt SSH" +_ssh._tcp. local +22 +OpenWrt SSH server diff --git a/net/mdnsresponder/files/mDNSResponder.init b/net/mdnsresponder/files/mDNSResponder.init new file mode 100644 index 0000000..87f9e90 --- /dev/null +++ b/net/mdnsresponder/files/mDNSResponder.init @@ -0,0 +1,14 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2009-2011 OpenWrt.org + +START=61 + +SERVICE_USE_PID=1 + +start() { + service_start /usr/bin/mDNSResponder -b -f /etc/mDNSResponder.conf +} + +stop() { + service_stop /usr/bin/mDNSResponder +} diff --git a/net/mdnsresponder/files/mdnsd.init b/net/mdnsresponder/files/mdnsd.init new file mode 100755 index 0000000..817604b --- /dev/null +++ b/net/mdnsresponder/files/mdnsd.init @@ -0,0 +1,14 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2009-2014 OpenWrt.org + +START=60 +STOP=10 +USE_PROCD=1 + +start_service() { + procd_open_instance + procd_set_param command /usr/sbin/mdnsd -debug + procd_set_param respawn + procd_close_instance +} + diff --git a/net/mdnsresponder/patches/001-cross_compile.patch b/net/mdnsresponder/patches/001-cross_compile.patch new file mode 100644 index 0000000..b1685fc --- /dev/null +++ b/net/mdnsresponder/patches/001-cross_compile.patch @@ -0,0 +1,115 @@ +--- a/Clients/Makefile ++++ b/Clients/Makefile +@@ -27,6 +27,8 @@ + + ############################################################################# + ++CC = @cc ++ + # On OS X the dns_sd library functions are included in libSystem, which is implicitly linked with every executable + # If /usr/lib/libSystem.dylib exists, then we're on OS X, so we don't need also to link the "dns_sd" shared library + ifneq "$(wildcard /usr/lib/libSystem.dylib)" "" +@@ -46,10 +48,10 @@ build: + mkdir build + + build/dns-sd: build dns-sd.c ClientCommon.c +- $(CC) $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -Wall -o $@ ++ $(CC) $(CFLAGS) $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -Wall -o $@ + + build/dns-sd64: build dns-sd.c ClientCommon.c +- $(CC) $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -Wall -o $@ -m64 ++ $(CC) $(CFLAGS) $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -Wall -o $@ -m64 + + # Note, we can make a 'fat' version of dns-sd using 'lipo', as shown below, but we + # don't, because we don't want or need a 'fat' version of dns-sd, because it will +--- a/mDNSPosix/Makefile ++++ b/mDNSPosix/Makefile +@@ -54,11 +54,12 @@ COREDIR = ../mDNSCore + SHAREDDIR ?= ../mDNSShared + JDK = /usr/jdk + +-CC = @cc ++CC = @gcc + BISON = @bison + FLEX = @flex + ST = @strip +-LD = ld -shared ++LD = @ld ++SOOPTS = -shared + CP = cp + RM = rm + LN = ln -s -f +@@ -92,7 +93,7 @@ CFLAGS_DEBUG = -O0 -DMDNS_DEBUGMSGS=0 + CFLAGS_OS = -DNOT_HAVE_DAEMON -DNOT_HAVE_SA_LEN -DNOT_HAVE_SOCKLEN_T -DNOT_HAVE_IF_NAMETOINDEX \ + -DLOG_PERROR=0 -D_XPG4_2 -D__EXTENSIONS__ -DHAVE_BROKEN_RECVIF_NAME -DTARGET_OS_SOLARIS + CC = gcc +-LD = gcc -shared ++LD = gcc + LINKOPTS = -lsocket -lnsl -lresolv + JAVACFLAGS_OS += -I$(JDK)/include/solaris + ifneq ($(DEBUG),1) +@@ -148,7 +149,8 @@ CFLAGS_OS = -DHAVE_IPV6 -no-cpp-precomp + -D__MAC_OS_X_VERSION_MIN_REQUIRED=__MAC_OS_X_VERSION_10_4 \ + -D__APPLE_USE_RFC_2292 #-Wunreachable-code + CC = gcc +-LD = $(CC) -dynamiclib ++LD = $(CC) ++SOOPTS= -dynamiclib + LINKOPTS = -lSystem + LDSUFFIX = dylib + JDK = /System/Library/Frameworks/JavaVM.framework/Home +@@ -170,8 +172,9 @@ NSSLIBFILE := $(NSSLIBNAME)-$(NSSVERSIO + NSSLINKNAME := $(NSSLIBNAME).so.2 + NSSINSTPATH := /lib + +-# If not otherwise defined, we install into /usr/lib and /usr/include ++# If not otherwise defined, we install into /usr/lib, /usr/include and /etc + # and our startup script is called mdns (e.g. /etc/init.d/mdns) ++ETCBASE?=/etc + INSTBASE?=/usr + STARTUPSCRIPTNAME?=mdns + +@@ -257,7 +260,7 @@ libdns_sd: setup $(BUILDDIR)/libdns_sd.$ + CLIENTLIBOBJS = $(OBJDIR)/dnssd_clientlib.c.so.o $(OBJDIR)/dnssd_clientstub.c.so.o $(OBJDIR)/dnssd_ipc.c.so.o + + $(BUILDDIR)/libdns_sd.$(LDSUFFIX): $(CLIENTLIBOBJS) +- @$(LD) $(LINKOPTS) -o $@ $+ ++ @$(LD) $(SOOPTS) $(LINKOPTS) -o $@ $+ + @$(STRIP) $@ + + Clients: setup libdns_sd ../Clients/build/dns-sd +@@ -292,7 +295,7 @@ InstalledManPages: $(MANPATH)/man8/mdnsd + InstalledClients: $(INSTBASE)/bin/dns-sd + @echo $+ " installed" + +-InstalledNSS: $(NSSINSTPATH)/$(NSSLINKNAME) /etc/nss_mdns.conf $(MANPATH)/man5/nss_mdns.conf.5 $(MANPATH)/man8/libnss_mdns.8 ++InstalledNSS: $(NSSINSTPATH)/$(NSSLINKNAME) $(ETCBASE)/nss_mdns.conf $(MANPATH)/man5/nss_mdns.conf.5 $(MANPATH)/man8/libnss_mdns.8 + @echo $+ " installed" + + # Note: If daemon already installed, we make sure it's stopped before overwriting it +@@ -347,19 +350,21 @@ $(INSTBASE)/bin/dns-sd: ../Clients/build + + $(NSSINSTPATH)/$(NSSLINKNAME): $(NSSINSTPATH)/$(NSSLIBFILE) + $(LN) $< $@ +- ldconfig ++ifdef LDCONFIG ++ $(LDCONFIG) ++endif + + $(NSSINSTPATH)/$(NSSLIBFILE): $(BUILDDIR)/$(NSSLIBFILE) + $(CP) $< $@ + chmod 444 $@ + +-/etc/nss_mdns.conf: nss_mdns.conf ++$(ETCBASE)/nss_mdns.conf: nss_mdns.conf + $(CP) $< $@ + chmod 444 $@ + # Check the nsswitch.conf file. + # If 'mdns' does not already appear on the "hosts:" line, then add it right before 'dns' +- cp -f /etc/nsswitch.conf /etc/nsswitch.conf.pre-mdns +- sed -e '/mdns/!s/^\(hosts:.*\)dns\(.*\)/\1mdns dns\2/' /etc/nsswitch.conf.pre-mdns > /etc/nsswitch.conf ++ -[ -f $(ETCBASE)/nsswitch.conf ] && cp -f $(ETCBASE)/nsswitch.conf $(ETCBASE)/nsswitch.conf.pre-mdns ++ -[ -f $(ETCBASE)/nsswitch.conf ] && sed -e '/mdns/!s/^\(hosts:.*\)dns\(.*\)/\1mdns dns\2/' $(ETCBASE)/nsswitch.conf.pre-mdns > $(ETCBASE)/nsswitch.conf + + ############################################################################# + diff --git a/net/mdnsresponder/patches/100-linux_fixes.patch b/net/mdnsresponder/patches/100-linux_fixes.patch new file mode 100644 index 0000000..df56608 --- /dev/null +++ b/net/mdnsresponder/patches/100-linux_fixes.patch @@ -0,0 +1,403 @@ +diff --git a/.gitignore b/.gitignore +new file mode 100644 +index 0000000..920cdfc +--- /dev/null ++++ b/.gitignore +@@ -0,0 +1,4 @@ ++Clients/build ++mDNSPosix/build ++mDNSPosix/objects ++ +diff --git a/Clients/Makefile b/Clients/Makefile +index 383af31..925c20e 100755 +--- a/Clients/Makefile ++++ b/Clients/Makefile +@@ -34,7 +34,7 @@ TARGETS = build/dns-sd build/dns-sd64 + LIBS = + else + TARGETS = build/dns-sd +-LIBS = -L../mDNSPosix/build/prod/ -ldns_sd ++LIBS ?= -L../mDNSPosix/build/prod/ -ldns_sd + endif + + all: $(TARGETS) +diff --git a/mDNSPosix/PosixDaemon.c b/mDNSPosix/PosixDaemon.c +index 88b3292..e86a6c7 100644 +--- a/mDNSPosix/PosixDaemon.c ++++ b/mDNSPosix/PosixDaemon.c +@@ -37,6 +37,11 @@ + #include + #include + #include ++#ifdef __linux__ ++#include /* !!! We require libcap-dev for this. Oh well. */ ++/* prctl is required to enable inheriting of capabilities across setuid */ ++#include ++#endif /* __linux__ */ + + #if __APPLE__ + #undef daemon +@@ -184,16 +189,50 @@ int main(int argc, char **argv) + + Reconfigure(&mDNSStorage); + ++#ifdef __linux__ ++ /* ++ * SO_BINDTODEVICE is privileged operation; however, we can get ++ * around it using capabilities instead of remaining root. ++ */ ++ if (mStatus_NoError == err) ++ { ++ if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) < 0) ++ perror("prctl PR_SET_KEEPCAPS"); ++ } ++#endif /* __linux__ */ ++ + // Now that we're finished with anything privileged, switch over to running as "nobody" + if (mStatus_NoError == err) + { + const struct passwd *pw = getpwnam("nobody"); + if (pw != NULL) ++ { + setuid(pw->pw_uid); ++#ifdef __linux__ ++ struct __user_cap_header_struct ch; ++ struct __user_cap_data_struct cd[_LINUX_CAPABILITY_U32S_3]; ++ ++ memset(&ch, 0, sizeof(ch)); ++ ch.version = _LINUX_CAPABILITY_VERSION_3; ++ ch.pid = getpid(); ++ memset(&cd[0], 0, sizeof(cd)); ++ /* CAP_NET_RAW is required to use SO_BINDTODEVICE */ ++ int caps = CAP_TO_MASK(CAP_NET_RAW); ++ cd[0].permitted = caps; ++ cd[0].effective = caps; ++ if (capset(&ch, &cd[0]) < 0) ++ perror("capset"); ++#endif /* __linux__ */ ++ } + else + LogMsg("WARNING: mdnsd continuing as root because user \"nobody\" does not exist"); + } + ++#ifdef __linux__ ++ if (mStatus_NoError == err) ++ err = mDNSPlatformPosixRefreshInterfaceList(&mDNSStorage); ++#endif /* __linux__ */ ++ + if (mStatus_NoError == err) + err = MainLoop(&mDNSStorage); + +diff --git a/mDNSPosix/Responder.c b/mDNSPosix/Responder.c +index 3996b7b..e58d8eb 100755 +--- a/mDNSPosix/Responder.c ++++ b/mDNSPosix/Responder.c +@@ -603,7 +603,8 @@ static mStatus RegisterServicesInFile(const char *filePath) + status = mStatus_UnknownErr; + } + +- assert(0 == fclose(fp)); ++ int rv = fclose(fp); ++ assert(0 == rv); + + return status; + } +diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c +index 6effa12..7c1d6eb 100755 +--- a/mDNSPosix/mDNSPosix.c ++++ b/mDNSPosix/mDNSPosix.c +@@ -138,7 +138,7 @@ mDNSlocal void SockAddrTomDNSAddr(const struct sockaddr *const sa, mDNSAddr *ipA + + // mDNS core calls this routine when it needs to send a packet. + mDNSexport mStatus mDNSPlatformSendUDP(const mDNS *const m, const void *const msg, const mDNSu8 *const end, +- mDNSInterfaceID InterfaceID, UDPSocket *src, const mDNSAddr *dst, ++ mDNSInterfaceID InterfaceID, UDPSocket *src, const mDNSAddr *dst, + mDNSIPPort dstPort, mDNSBool useBackgroundTrafficClass) + { + int err = 0; +@@ -583,9 +583,17 @@ mDNSlocal void FreePosixNetworkInterface(PosixNetworkInterface *intf) + { + assert(intf != NULL); + if (intf->intfName != NULL) free((void *)intf->intfName); +- if (intf->multicastSocket4 != -1) assert(close(intf->multicastSocket4) == 0); ++ if (intf->multicastSocket4 != -1) ++ { ++ int rv = close(intf->multicastSocket4); ++ assert(rv == 0); ++ } + #if HAVE_IPV6 +- if (intf->multicastSocket6 != -1) assert(close(intf->multicastSocket6) == 0); ++ if (intf->multicastSocket6 != -1) ++ { ++ int rv = close(intf->multicastSocket6); ++ assert(rv == 0); ++ } + #endif + + // Move interface to the RecentInterfaces list for a minute +@@ -724,6 +732,29 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf + if (err < 0) { err = errno; perror("setsockopt - IP_MULTICAST_TTL"); } + } + ++#ifdef __linux__ ++#ifdef SO_BINDTODEVICE ++ if (err == 0 && interfaceIndex) ++ { ++ char ifname[IFNAMSIZ]; ++ if (if_indextoname(interfaceIndex, ifname)) ++ { ++ err = setsockopt(*sktPtr, SOL_SOCKET, SO_BINDTODEVICE, ifname, strlen(ifname)); ++ if (err < 0) ++ { ++ err = errno; ++ perror("setsockopt - SO_BINDTODEVICE"); ++ } ++ } ++ else ++ { ++ err = errno; ++ perror("if_indextoname"); ++ } ++ } ++#endif /* SO_BINDTODEVICE */ ++#endif /* __linux__ */ ++ + // And start listening for packets + if (err == 0) + { +@@ -805,6 +836,29 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf + if (err < 0) { err = errno; perror("setsockopt - IPV6_MULTICAST_HOPS"); } + } + ++#ifdef __linux__ ++#ifdef SO_BINDTODEVICE ++ if (err == 0 && interfaceIndex) ++ { ++ char ifname[IFNAMSIZ]; ++ if (if_indextoname(interfaceIndex, ifname)) ++ { ++ err = setsockopt(*sktPtr, SOL_SOCKET, SO_BINDTODEVICE, ifname, strlen(ifname)); ++ if (err < 0) ++ { ++ err = errno; ++ perror("setsockopt - SO_BINDTODEVICE"); ++ } ++ } ++ else ++ { ++ err = errno; ++ perror("if_indextoname"); ++ } ++ } ++#endif /* SO_BINDTODEVICE */ ++#endif /* __linux__ */ ++ + // And start listening for packets + if (err == 0) + { +@@ -836,7 +890,12 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf + } + + // Clean up +- if (err != 0 && *sktPtr != -1) { assert(close(*sktPtr) == 0); *sktPtr = -1; } ++ if (err != 0 && *sktPtr != -1) ++ { ++ int rv = close(*sktPtr); ++ assert(rv == 0); ++ *sktPtr = -1; ++ } + assert((err == 0) == (*sktPtr != -1)); + return err; + } +@@ -938,19 +997,14 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) + int err = 0; + struct ifi_info *intfList = get_ifi_info(AF_INET, mDNStrue); + struct ifi_info *firstLoopback = NULL; ++ struct ifi_info **p = &intfList; + + assert(m != NULL); + debugf("SetupInterfaceList"); + +- if (intfList == NULL) err = ENOENT; +- + #if HAVE_IPV6 +- if (err == 0) /* Link the IPv6 list to the end of the IPv4 list */ +- { +- struct ifi_info **p = &intfList; +- while (*p) p = &(*p)->ifi_next; +- *p = get_ifi_info(AF_INET6, mDNStrue); +- } ++ while (*p) p = &(*p)->ifi_next; ++ *p = get_ifi_info(AF_INET6, mDNStrue); + #endif + + if (err == 0) +@@ -1026,7 +1080,7 @@ mDNSlocal mStatus OpenIfNotifySocket(int *pFD) + /* Subscribe the socket to Link & IP addr notifications. */ + mDNSPlatformMemZero(&snl, sizeof snl); + snl.nl_family = AF_NETLINK; +- snl.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR; ++ snl.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR; + ret = bind(sock, (struct sockaddr *) &snl, sizeof snl); + if (0 == ret) + *pFD = sock; +@@ -1104,11 +1158,18 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) + PrintNetLinkMsg(pNLMsg); + #endif + ++ // this result isn't used anywhere as a number, just as ++ // non-zero - however, I have seen devices with more than 32 ++ // interfaces at some point.. ++ // (on Linux, every tunnel increases index for example) ++ + // Process the NetLink message + if (pNLMsg->nlmsg_type == RTM_GETLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) +- result |= 1 << ((struct ifinfomsg*) NLMSG_DATA(pNLMsg))->ifi_index; ++ result |= 1; ++ // << ((struct ifinfomsg*) NLMSG_DATA(pNLMsg))->ifi_index; + else if (pNLMsg->nlmsg_type == RTM_DELADDR || pNLMsg->nlmsg_type == RTM_NEWADDR) +- result |= 1 << ((struct ifaddrmsg*) NLMSG_DATA(pNLMsg))->ifa_index; ++ result |= 1; ++ // << ((struct ifaddrmsg*) NLMSG_DATA(pNLMsg))->ifa_index; + + // Advance pNLMsg to the next message in the buffer + if ((pNLMsg->nlmsg_flags & NLM_F_MULTI) != 0 && pNLMsg->nlmsg_type != NLMSG_DONE) +@@ -1279,8 +1340,12 @@ mDNSexport mStatus mDNSPlatformInit(mDNS *const m) + if (err == mStatus_NoError) err = SetupSocket(&sa, zeroIPPort, 0, &m->p->unicastSocket6); + #endif + ++ // In Linux case, we can't set up sockets with different owner - ++ // it blows up SO_REUSEPORT. So we do this step bit later. ++#ifndef __linux__ + // Tell mDNS core about the network interfaces on this machine. + if (err == mStatus_NoError) err = SetupInterfaceList(m); ++#endif /* !__linux__ */ + + // Tell mDNS core about DNS Servers + mDNS_Lock(m); +@@ -1313,9 +1378,17 @@ mDNSexport void mDNSPlatformClose(mDNS *const m) + { + assert(m != NULL); + ClearInterfaceList(m); +- if (m->p->unicastSocket4 != -1) assert(close(m->p->unicastSocket4) == 0); ++ if (m->p->unicastSocket4 != -1) ++ { ++ int rv = close(m->p->unicastSocket4); ++ assert(rv == 0); ++ } + #if HAVE_IPV6 +- if (m->p->unicastSocket6 != -1) assert(close(m->p->unicastSocket6) == 0); ++ if (m->p->unicastSocket6 != -1) ++ { ++ int rv = close(m->p->unicastSocket6); ++ assert(rv == 0); ++ } + #endif + } + +@@ -1571,14 +1644,14 @@ mDNSexport mStatus mDNSPlatformClearSPSMACAddr(void) + mDNSexport mDNSu16 mDNSPlatformGetUDPPort(UDPSocket *sock) + { + (void) sock; // unused +- ++ + return (mDNSu16)-1; + } + + mDNSexport mDNSBool mDNSPlatformInterfaceIsD2D(mDNSInterfaceID InterfaceID) + { + (void) InterfaceID; // unused +- ++ + return mDNSfalse; + } + +diff --git a/mDNSPosix/mDNSUNP.c b/mDNSPosix/mDNSUNP.c +index b392fc7..f551ad5 100755 +--- a/mDNSPosix/mDNSUNP.c ++++ b/mDNSPosix/mDNSUNP.c +@@ -63,6 +63,7 @@ + #if defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX + #include + #include ++#include + + /* Converts a prefix length to IPv6 network mask */ + void plen_to_mask(int plen, char *addr) { +@@ -86,7 +87,7 @@ struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases) + FILE *fp; + char addr[8][5]; + int flags, myflags, index, plen, scope; +- char ifname[9], lastname[IFNAMSIZ]; ++ char ifname[IFNAMSIZ], lastname[IFNAMSIZ]; + char addr6[32+7+1]; /* don't forget the seven ':' */ + struct addrinfo hints, *res0; + struct sockaddr_in6 *sin6; +@@ -94,7 +95,8 @@ struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases) + int err; + int sockfd = -1; + struct ifreq ifr; +- ++ char mask[64] = "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %"; ++ sprintf(mask+strlen(mask), "%ds\n", IFNAMSIZ); + res0=NULL; + ifihead = NULL; + ifipnext = &ifihead; +@@ -106,11 +108,12 @@ struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases) + goto gotError; + } + while (fscanf(fp, +- "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %8s\n", ++ mask, + addr[0],addr[1],addr[2],addr[3], + addr[4],addr[5],addr[6],addr[7], + &index, &plen, &scope, &flags, ifname) != EOF) { + ++ if (flags & IFA_F_DEPRECATED) continue; + myflags = 0; + if (strncmp(lastname, ifname, IFNAMSIZ) == 0) { + if (doaliases == 0) +@@ -204,8 +207,11 @@ gotError: + res0=NULL; + } + done: ++ if (fp) ++ fclose(fp); + if (sockfd != -1) { +- assert(close(sockfd) == 0); ++ int rv = close(sockfd); ++ assert(rv == 0); + } + return(ifihead); /* pointer to first structure in linked list */ + } +diff --git a/mDNSShared/dnsextd_parser.y b/mDNSShared/dnsextd_parser.y +index 18c5990..d4b63ce 100644 +--- a/mDNSShared/dnsextd_parser.y ++++ b/mDNSShared/dnsextd_parser.y +@@ -15,6 +15,8 @@ + * limitations under the License. + */ + ++%parse-param { void *context } ++ + %{ + #include + #include +@@ -23,7 +25,7 @@ + #include "DebugServices.h" + #include "dnsextd.h" + +-void yyerror( const char* error ); ++void yyerror( void *context, const char* error ); + int yylex(void); + + +@@ -378,7 +380,7 @@ int yywrap(void); + + extern int yylineno; + +-void yyerror( const char *str ) ++void yyerror( void *context, const char *str ) + { + fprintf( stderr,"%s:%d: error: %s\n", g_filename, yylineno, str ); + } diff --git a/net/mdnsresponder/patches/114-fix_posix_build.patch b/net/mdnsresponder/patches/114-fix_posix_build.patch new file mode 100644 index 0000000..d3fbae5 --- /dev/null +++ b/net/mdnsresponder/patches/114-fix_posix_build.patch @@ -0,0 +1,11 @@ +--- a/mDNSPosix/mDNSPosix.c ++++ b/mDNSPosix/mDNSPosix.c +@@ -1673,7 +1673,7 @@ mDNSexport mDNSs32 mDNSPlatformGetServic + return -1; + } + +-mDNSexport void mDNSPlatformSetDelegatePID(UDPSocket *src, const mDNSAddr *dst, DNSQuestion *q) ++mDNSexport void mDNSPlatformSetuDNSSocktOpt(UDPSocket *src, const mDNSAddr *dst, DNSQuestion *q) + { + (void) src; + (void) dst; diff --git a/net/memcached/Makefile b/net/memcached/Makefile new file mode 100644 index 0000000..bd5267a --- /dev/null +++ b/net/memcached/Makefile @@ -0,0 +1,72 @@ +# +# Copyright (C) 2009-2012 OpenWrt.org +# Copyright (C) 2009-2014 Thomas Heil +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=memcached +PKG_VERSION:=1.4.31 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://memcached.org/files +PKG_MD5SUM:=c19bb0e77e720f64f33ecb43de28a1b4 + +PKG_MAINTAINER:=Thomas Heil + +PKG_LICENSE:=BSD-3-Clause +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/memcached + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libevent2 +libpthread + TITLE:=The high-performance, distributed memory object caching system + URL:=http://memcached.org/ +endef + +define Package/memcached/description + Free and open source, high-performance, distributed memory object caching system +endef + +define Package/memcached/conffiles +/etc/config/memcached +endef + +ifeq ($(CONFIG_BIG_ENDIAN),y) +CONFIGURE_VARS += ac_cv_c_endian=big +else +CONFIGURE_VARS += ac_cv_c_endian=little +endif + +CONFIGURE_ARGS += \ + --with-libevent=$(STAGING_DIR)/usr/include/libevent \ + --disable-docs \ + --disable-dtrace \ + --disable-coverage \ + --disable-sasl + +TARGET_CFLAGS += \ + -std=gnu99 + +TARGET_LDFLAGS = \ + -L$(STAGING_DIR)/usr/lib/libevent -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib + +define Package/memcached/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/memcached $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/memcached.config $(1)/etc/config/memcached + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/memcached.init $(1)/etc/init.d/memcached +endef + +$(eval $(call BuildPackage,memcached)) diff --git a/net/memcached/files/memcached.config b/net/memcached/files/memcached.config new file mode 100644 index 0000000..4071116 --- /dev/null +++ b/net/memcached/files/memcached.config @@ -0,0 +1,6 @@ +config memcached + option user 'nobody' + option maxconn '1024' + option listen '0.0.0.0' + option port '11211' + option memory '64' diff --git a/net/memcached/files/memcached.init b/net/memcached/files/memcached.init new file mode 100644 index 0000000..063bf64 --- /dev/null +++ b/net/memcached/files/memcached.init @@ -0,0 +1,27 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2010-2011 OpenWrt.org + +START=80 + +start_instance () { + local section="$1" + + config_get user "$section" user + config_get maxconn "$section" maxconn + config_get listen "$section" listen + config_get port "$section" port + config_get memory "$section" memory + + service_start /usr/bin/memcached -d -u ${user:-nobody} \ + -c ${maxconn:-1024} -l ${listen:-0.0.0.0} \ + -p ${port:-11211} -U ${port:-11211} -m ${memory:-64} +} + +start() { + config_load 'memcached' + config_foreach start_instance 'memcached' +} + +stop() { + service_stop /usr/bin/memcached +} diff --git a/net/memcached/patches/100-fix_iov_max.patch b/net/memcached/patches/100-fix_iov_max.patch new file mode 100644 index 0000000..55a980c --- /dev/null +++ b/net/memcached/patches/100-fix_iov_max.patch @@ -0,0 +1,25 @@ +Index: memcached-1.4.26/memcached.c +=================================================================== +--- memcached-1.4.26.orig/memcached.c ++++ memcached-1.4.26/memcached.c +@@ -13,6 +13,10 @@ + * Anatoly Vorobey + * Brad Fitzpatrick + */ ++#ifndef __need_IOV_MAX ++#define __need_IOV_MAX ++#endif ++ + #include "memcached.h" + #include + #include +@@ -30,9 +34,6 @@ + #define _P1003_1B_VISIBLE + #endif + /* need this to get IOV_MAX on some platforms. */ +-#ifndef __need_IOV_MAX +-#define __need_IOV_MAX +-#endif + #include + #include + #include diff --git a/net/mii-tool/Makefile b/net/mii-tool/Makefile new file mode 100644 index 0000000..e9c793d --- /dev/null +++ b/net/mii-tool/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2006-2010 OpenWrt.org +# Copyright (C) 2016 Stijn Segers +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=mii-tool +PKG_VERSION=2016-10-06-$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://git.code.sf.net/p/net-tools/code +PKG_SOURCE_VERSION:=115f1af2494ded1fcd21c8419d5e289bc4df380f +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_MAINTAINER:=Stijn Segers + +include $(INCLUDE_DIR)/package.mk + +define Package/mii-tool + SECTION:=net + CATEGORY:=Network + TITLE:=configure media type using MII commands + URL:=http://net-tools.sourceforge.net/ +endef + +define Package/mii-tool/description + The mii-tool command allows you to set or autodetect the media type + or mii chipset-based ethernet devices. It traditionally had been + distributed in the net-tools package. This is a single distribution + optimized for embedded systems and fully automated cross/-sysroot-builds +endef + +define Build/Configure + # Failed configure.sh leaves stub config.h around. + rm -f $(PKG_BUILD_DIR)/config.h + ( cd $(PKG_BUILD_DIR); yes $$$$'\n' | ./configure.sh config.in ) +endef + +define Package/mii-tool/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/mii-tool $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,mii-tool)) diff --git a/net/mini_snmpd/Makefile b/net/mini_snmpd/Makefile new file mode 100644 index 0000000..f86539a --- /dev/null +++ b/net/mini_snmpd/Makefile @@ -0,0 +1,66 @@ +# +# Copyright (C) 2009-2016 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:=mini_snmpd +PKG_VERSION:=1.4-rc1 +PKG_RELEASE:=2 +PKG_MAINTAINER:=Luke McKee +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/troglobit/mini-snmpd.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=203d92e60ed09466d6676c6ad20ad6cb2ce08a5d +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz + +PKG_FIXUP:=autoreconf +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 +# As warned by upstream maintainer and binutils +# however compiler warnings can be ignored until next binutils release +# https://github.com/wongsyrone/openwrt-1/issues/67 +# PKG_SSP:=0 +# PKG_RELRO:=0 + +include $(INCLUDE_DIR)/package.mk + +define Package/mini_snmpd + SECTION:=net + CATEGORY:=Network + TITLE:=A tiny SNMP server for embedded systems + URL:=http://troglobit.github.io/mini-snmpd.html +# uncomment if you just want the binary, not the init script +# openwrt requires init script runtime dependencies be defined for make menuconfig +# (e.g busybox sysntpd) + DEPENDS:=+jsonfilter +ubus +procd +ubox +endef + +CONFIGURE_ARGS+= \ + $(if $(CONFIG_IPV6),,--disable-ipv6) + +# Configure weirdness - Disabled by default, explicitately disabling turns feature on! +# --disable-debug \ +# --disable-demo - Upstream Github Issue #4 Fixed 20160707 + +define Package/mini_snmpd/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/mini_snmpd $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/mini_snmpd.config $(1)/etc/config/mini_snmpd + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/mini_snmpd.init $(1)/etc/init.d/mini_snmpd +endef + +define Package/mini_snmpd/conffiles +/etc/config/mini_snmpd +endef + +$(eval $(call BuildPackage,mini_snmpd)) diff --git a/net/mini_snmpd/files/mini_snmpd.config b/net/mini_snmpd/files/mini_snmpd.config new file mode 100644 index 0000000..c06f7b1 --- /dev/null +++ b/net/mini_snmpd/files/mini_snmpd.config @@ -0,0 +1,26 @@ +# you may add more than the 'default' mini_snmpd instances provided they all bind to different ports/interfaces +# to get around max 4 interface or mountpoint limit constrained by mini_snmpd's mib +config mini_snmpd 'default' + option enabled 1 + option ipv6 0 + # Verbose flag given to mini_snmpd, extra verbose is only possible with compile time config flags + option debug 0 + # Turn on community authentication (snmp agent must use community name) + option auth 0 + option community 'public' + option contact 'OpenWRT router ' + option location 'Undisclosed' + # to listen on all interfaces you need to set option listen_interface '' + option listen_interface 'lan' + #option udp_port '161' + #option tcp_port '161' + #option vendor_oid '' + option mib_timeout 1 + # enable basic disk usage statistics on specified mountpoint + list disks '/overlay' + list disks '/tmp' + # enable basic network statistics on specified interface + # 4 interfaces maximum per instance, as named in /etc/config/network and luci + # not physical device names + list interfaces 'lan' + list interfaces 'wan' diff --git a/net/mini_snmpd/files/mini_snmpd.init b/net/mini_snmpd/files/mini_snmpd.init new file mode 100644 index 0000000..0fb63d4 --- /dev/null +++ b/net/mini_snmpd/files/mini_snmpd.init @@ -0,0 +1,240 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2009-2016 OpenWrt.org +# Copyright (C) 2016 Luke McKee +# Procd init script reference: http://wiki.prplfoundation.org/wiki/Procd_reference + +START=98 +USE_PROCD=1 +PROG=/usr/bin/mini_snmpd +NAME=mini_snmpd + +_log() { + logger -p daemon.info -t mini_snmpd "$@" +} + +_err() { + logger -p daemon.err -t mini_snmpd "$@" +} + + +# mini_snmpd 1.3+ now starts later in the game. Expects filesystems monitored to be already mounted, or wont pass args to mini_snmpd +# and at least configuration entry for network physical interface defined in /etc/config/network +# It handles network interfaces not yet present (e.g. ppp) but will statfs() the root/wrong filesystem if device not mounted +# Tip: complex scripts run faster without in openwrt if you stop busybox forking and searching for applets. Faster bootups +# CONFIG_BUSYBOX_CONFIG_FEATURE_SH_NOFORK +# CONFIG_BUSYBOX_CONFIG_FEATURE_PREFER_APPLETS +# BUSYBOX_CONFIG_ASH_OPTIMIZE_FOR_SIZE [=n] +# CONFIG_BUSYBOX_CONFIG_ASH_CMDCMD + +mini_snmpd_validation="enabled:bool:0 \ + ipv6:bool:0 \ + debug:bool:0 \ + auth:bool:1 \ + community:rangelength(1,32):public \ + contact:maxlength(255) \ + location:maxlength(255) \ + listen_interface:uciname \ + udp_port:port \ + tcp_port:port \ + vendor_oid:string \ + mib_timeout:and(min(1),uinteger) \ + disks:list(directory) \ + interfaces:list(uciname) \ + respawn_threshold:uinteger respawn_timeout:uinteger respawn_retry:uinteger" +# busybox ash has no array variable support, when put validations in a string be careful to have no spaces in each validate constraint +# this makes it very difficult to use the 'or(uciname, "all")' test, so listen_interface '' or undefined now meands bind to "all". +# this is the sarafice you have to make to avoid typing it all in twice in this script so we can give feedback to user on what's misconfigered +# in syslog + +append_disk() { + local disk="$1" disk_count + [ -z $disk_count ] && disk_count=0 + if grep -qF "$disk" /proc/mounts ; then + # check the fileystem is mountpoint, and directory search permissions available for statfs() + # presence as a directory -d test done is already done by uci_validate_section() + [ -x "$disk" ] || { + _err "$cfg: mountpoint $disk for snmp monitoring EACCES error. Check permissions, ignoring" + return 1 + } + if [ $disk_count -lt 4 ] ; then + append disks_arg "$disk" ',' + disk_count=$((disk_count++)) + else + _err "$cfg: more than 4 mountpoints defined in uci. Disc $disk ignored." + fi + else + _err "$cfg: mountpoint $disk for snmp monitoring not mounted, ignoring." + fi +} + +append_interface() { + local name="$1" netdev netdev_count + [ -z $netdev_count ] && netdev_count=0 + # for the purposes of snmp monitoring it doesn't need to be up, it just needs to exist in /proc/net/dev + netdev=$(ubus -S call network.interface dump|jsonfilter -e "@.interface[@.interface=\"$name\"].l3_device") + if [ -n "$netdev" ] && grep -qF "$netdev" /proc/net/dev ]; then + [ $netdev_count -ge 4 ] && { + _err "$cfg: too many network interfaces configured, ignoring $name" + return + } + netdev_count=$((netdev_count++)) + if [ -n "$interfaces_arg" ]; then + append interfaces_arg "$netdev" ',' + else + append interfaces_arg "$netdev" + fi + else + _err "$cfg: physical interface for network $name not found in uci or kernel so not monitoring" + fi +} + +append_arg() { + local var="$2" + local opt="$1" + [ -n "$var" ] && procd_append_param command $opt "$var" +} + +watch_interfaces() { + local cfg="$1" + local enabled listen_interface # listen_interface_up + config_get_bool enabled "$cfg" "enabled" '1' + [ "$enabled" -gt 0 ] || return 0 + config_get listen_interface "$cfg" listen_interface + # listen_interface_up=$(ubus -S call network.interface dump | jsonfilter -e "@.interface[@.interface=\"$listen_interface\"].up") + # If the interface is up & instance is running we'll watch at the instance level and only restart that instance if it's bound interface changes + # Regardless of ubus knowing about an interface (in the case it's not yet configured) + [ -n "$listen_interface" ] && trigger_interfaces="${listen_interface} ${trigger_interfaces} " +} + +validate_mini_snmpd_section() { + # validate a mini_snmpd instance in uci config file mini_snmpd + # http://luci.subsignal.org/trac/wiki/Documentation/Datatypes ubox/validate/validate.c + uci_validate_section mini_snmpd mini_snmpd "${1}" $mini_snmpd_validation +} + + +service_triggers() { + config_load 'mini_snmpd' + procd_open_trigger + procd_add_config_trigger "config.change" "mini_snmpd" /etc/init.d/mini_snmpd reload + config_foreach watch_interfaces 'mini_snmpd' + # this only watches interfaces for which there is no running instance due to interface down / not in ubus + # hence start not reload, this trigger will not affect running instances as another start will not change their procd command arguments + # or stop the already running process + [ -n "$trigger_interfaces" ] & { + for n in $trigger_interfaces ; do + procd_add_interface_trigger "interface.*" $n /etc/init.d/mini_snmpd start + done + } + procd_close_trigger + procd_add_validation validate_mini_snmpd_section +} + + +start_instance() { + local cfg validation_failed validation_err disks_arg interfaces_arg + cfg="$1" + #uci_validate_section should unset undefined variables from other instances + #however defining uci variables as local will scope them to this instance + #"local variables are also visible to functions called by the parent function" so it's good practice + local enabled ipv6 debug auth community contact location listen_interface \ + udp_port tcp_port vendor_oid mib_timeout + local disks="" interfaces="" + validate_mini_snmpd_section "$cfg" 2>/dev/null || validation_failed=1 + [ "$enabled" == 1 ] || { + _log "instance:$cfg disabled not starting" + return 1 + } + + local listen_interface_json listen_interface_ip listen_interface_device listen_interface_up ubus_exit ubus_err + [ -n "$listen_interface" ] && { + listen_interface_json=$(ubus -S call network.interface.$listen_interface status) + ubus_exit=$? + [ $ubus_exit = 4 ] && { + _err "$cfg: listen_interface $listen_interface not properly configured in ubus network.interface.* not starting this instance " + return 1 + } + [ $ubus_exit = 255 -a -z "$listen_interface_json" ] && { + _log "$cfg: ubusd not yet up, will try to start mini_snmpd shorlty when procd detects $listen_interface comes up" + return 1 + } + [ -z "$listen_interface_json" ] && { + ubus_err=`ubus call network.interface.$listen_interface status 2>&1 >/dev/null` + _err "$cfg: unknown ubus error. exit: $ubus_exit errormsg: $ubus_err " + return 1 + } + listen_interface_up=$(jsonfilter -s "$listen_interface_json" -e '@.up') + if [ "$ipv6" = 1 ]; then + listen_interface_ip=$(jsonfilter -s "$listen_interface_json" -e "@['ipv6-address'][0].address") + else + listen_interface_ip=$(jsonfilter -s "$listen_interface_json" -e "@['ipv4-address'][0].address") + fi + [ -n "$listen_interface_ip" -a "$listen_interface_up" = 'true' ] || { + _log "$cfg:listen interface $listen_interface not up yet / not configured properly" + _log "$cfg:procd will try again when interface state changes" + return 1 + } + listen_interface_device=$(jsonfilter -s "$listen_interface_json" -e '@.l3_device') + } + + [ $validation_failed ] && { + _err "validation of $NAME configuration for $cfg instance failed, all tests should be within constraints" + _err "please edit the configuration values below using [l]uci " + validation_err=`/sbin/validate_data mini_snmpd mini_snmpd "$cfg" $mini_snmpd_validation 2>&1 | sed '/with\ false$/!d;s/validates\ as\ /needs\ to\ be\ /;s/with\ false//' ` + _err "${validation_err}" + return 1 + } + config_list_foreach "$cfg" 'disks' append_disk + config_list_foreach "$cfg" 'interfaces' append_interface + # test if variables are unset or zero length + [ -z "${disks_arg:+1}" -a -z "${interfaces_arg:+1}" ] && { + _err "$cfg: you haven't sucessfully configured any mountpoints or disks for this instance, not starting" + return 1 + } + + procd_open_instance + + procd_set_param command "$PROG" -n + procd_set_param stdout "1" + procd_set_param stderr "1" + # don't the like default respawn values? you can override through uci. + # vars left as global so you only need to do it in the first mini_snmpd instance + procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-10} ${respawn_retry:-1} + # this monitors ubus changes + [ -n "$listen_interface" ] && { + #procd_open_trigger + #procd_add_interface_trigger "interface.*" $listen_interface /etc/init.d/mini_snmpd reload + #procd_close_trigger + procd_add_reload_interface_trigger $listen_interface #or use shorthand of above + } + # this re-starts the daemon if a properly configured network interface is changed whilst it is already running + # igmpproxy has this as well as "procd_set_param netdev" + + append_arg "-c" "$community" + append_arg "-L" "${location}" + append_arg "-C" "${contact}" + append_arg "-p" $udp_port + append_arg "-P" $tcp_port + append_arg "-V" "${vendor_oid}" + append_arg "-t" $mib_timeout + + [ "$ipv6" = 1 ] && procd_append_param command "-6" + [ "$debug" = 1 ] && procd_append_param command "-v" + # uci_validate_section() aka /sbin/validate_data can only cast default values not defined in /etc/config/* to string + # e.g. ="1" however it sets bools defined in /etc/config/* to =1 / =0 + [ "$auth" = 1 -o "$auth" = "1" ] && procd_append_param command "-a" + [ -n "$disks_arg" ] && procd_append_param command "-d $disks_arg" + [ -n "$interfaces_arg" ] && procd_append_param command "-i $interfaces_arg" + [ -n "$listen_interface_device" ] && { + procd_append_param command "-I" "$listen_interface_device" + # and this monitors the hardware device for changes outside of ubus - just a guess + procd_set_param netdev $listen_interface_device + } + procd_close_instance +} + +start_service() { + config_load 'mini_snmpd' + config_foreach start_instance 'mini_snmpd' +} + diff --git a/net/miniupnpc/Makefile b/net/miniupnpc/Makefile new file mode 100644 index 0000000..fbf6222 --- /dev/null +++ b/net/miniupnpc/Makefile @@ -0,0 +1,73 @@ +# +# 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:=miniupnpc +PKG_VERSION:=1.9 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://miniupnp.free.fr/files +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=5ef3ba321e6df72d6519b728b292073e +PKG_MAINTAINER:=Steven Barth + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/miniupnpc/Default + TITLE:=Lightweight UPnP + URL:=http://miniupnp.tuxfamily.org/ +endef + +define Package/miniupnpc + $(call Package/miniupnpc/Default) + SECTION:=net + CATEGORY:=Network + SUBMENU:=Firewall + TITLE+= client + DEPENDS:=+libminiupnpc +endef + +define Package/libminiupnpc + $(call Package/miniupnpc/Default) + SECTION:=libs + CATEGORY:=Libraries + TITLE+= library +endef + +TARGET_CFLAGS += $(FPIC) + +MAKE_FLAGS += \ + OS="Linux" \ + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include/miniupnpc + $(CP) \ + $(PKG_INSTALL_DIR)/usr/include/miniupnpc/*.h \ + $(1)/usr/include/miniupnpc/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/*.{so*,a} \ + $(1)/usr/lib/ +endef + +define Package/miniupnpc/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/upnpc $(1)/usr/bin/ +endef + +define Package/libminiupnpc/install + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/lib/libminiupnpc.so.* \ + $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,miniupnpc)) +$(eval $(call BuildPackage,libminiupnpc)) diff --git a/net/miniupnpc/patches/100-no_minixml_test.patch b/net/miniupnpc/patches/100-no_minixml_test.patch new file mode 100644 index 0000000..93f6772 --- /dev/null +++ b/net/miniupnpc/patches/100-no_minixml_test.patch @@ -0,0 +1,13 @@ +--- a/Makefile ++++ b/Makefile +@@ -151,8 +151,8 @@ installpythonmodule3: pythonmodule3 + python3 setup.py install + + validateminixml: minixmlvalid +- @echo "minixml validation test" +- ./minixmlvalid ++ @echo "(skipping) minixml validation test" ++# ./minixmlvalid + touch $@ + + validateminiwget: testminiwget minihttptestserver testminiwget.sh diff --git a/net/miniupnpc/patches/200-miniupnpc_desc.patch b/net/miniupnpc/patches/200-miniupnpc_desc.patch new file mode 100644 index 0000000..320707e --- /dev/null +++ b/net/miniupnpc/patches/200-miniupnpc_desc.patch @@ -0,0 +1,11 @@ +--- a/upnpcommands.c ++++ b/upnpcommands.c +@@ -367,7 +367,7 @@ UPNP_AddPortMapping(const char * control + AddPortMappingArgs[5].elt = "NewEnabled"; + AddPortMappingArgs[5].val = "1"; + AddPortMappingArgs[6].elt = "NewPortMappingDescription"; +- AddPortMappingArgs[6].val = desc?desc:"libminiupnpc"; ++ AddPortMappingArgs[6].val = desc?desc:"miniupnpc"; + AddPortMappingArgs[7].elt = "NewLeaseDuration"; + AddPortMappingArgs[7].val = leaseDuration?leaseDuration:"0"; + if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype, diff --git a/net/mtr/Makefile b/net/mtr/Makefile new file mode 100644 index 0000000..ac07cb3 --- /dev/null +++ b/net/mtr/Makefile @@ -0,0 +1,73 @@ +# +# Copyright (C) 2006-2015 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:=mtr +PKG_REV:=dd2b75080bc5406ba0b438953b36b72204ba114b +PKG_VERSION:=0.85+newdns-$(PKG_REV) +PKG_RELEASE:=2 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/traviscross/mtr.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=$(PKG_REV) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/mtr + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libncurses + TITLE:=Full screen ncurses traceroute tool + URL:=http://www.bitwizard.nl/mtr/ + PKG_MAINTAINER:=Jonathan McCrohan +endef + +define Package/mtr/description + mtr combines the functionality of the 'traceroute' and 'ping' programs + in a single network diagnostic tool. + As mtr starts, it investigates the network connection between the host + mtr runs on and a user-specified destination host. After it + determines the address of each network hop between the machines, + it sends a sequence ICMP ECHO requests to each one to determine the + quality of the link to each machine. As it does this, it prints + running statistics about each machine. +endef + +CONFIGURE_ARGS += \ + --without-gtk \ + --without-glib \ + $(call autoconf_bool,CONFIG_IPV6,ipv6) + +define Build/Configure + (cd $(PKG_BUILD_DIR); touch \ + configure.in \ + aclocal.m4 \ + Makefile.in \ + img/Makefile.in \ + stamp-h.in \ + config.h.in \ + configure \ + ); + $(call Build/Configure/Default) +endef + +define Package/mtr/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/mtr $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,mtr)) diff --git a/net/mtr/patches/100-disabled-ipv6-fix.patch b/net/mtr/patches/100-disabled-ipv6-fix.patch new file mode 100644 index 0000000..5ef9984 --- /dev/null +++ b/net/mtr/patches/100-disabled-ipv6-fix.patch @@ -0,0 +1,49 @@ +--- a/net.c ++++ b/net.c +@@ -307,9 +307,11 @@ void net_send_tcp(int index) + struct sockaddr_storage local; + struct sockaddr_storage remote; + struct sockaddr_in *local4 = (struct sockaddr_in *) &local; +- struct sockaddr_in6 *local6 = (struct sockaddr_in6 *) &local; + struct sockaddr_in *remote4 = (struct sockaddr_in *) &remote; ++#ifdef ENABLE_IPV6 ++ struct sockaddr_in6 *local6 = (struct sockaddr_in6 *) &local; + struct sockaddr_in6 *remote6 = (struct sockaddr_in6 *) &remote; ++#endif + socklen_t len; + + ttl = index + 1; +@@ -566,8 +568,10 @@ void net_send_query(int index) + + /* sendto() assumes packet length includes the IPv4 header but not the + IPv6 header. */ +- spacketsize = abs(packetsize) - +- ( ( af == AF_INET ) ? 0 : sizeof (struct ip6_hdr) ); ++ spacketsize = abs(packetsize); ++#ifdef ENABLE_IPV6 ++ spacketsize -= ( ( af == AF_INET ) ? 0 : sizeof (struct ip6_hdr) ); ++#endif + rv = sendto(sendsock, packet, spacketsize, 0, remotesockaddr, salen); + if (first && (rv < 0) && ((errno == EINVAL) || (errno == EMSGSIZE))) { + /* Try the first packet again using host byte order. */ +--- a/dns.c ++++ b/dns.c +@@ -49,7 +49,7 @@ + #include + #include + //#include +-//#include ++#include + #include + #include + #include +--- a/net.h ++++ b/net.h +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + #ifdef ENABLE_IPV6 + #include diff --git a/net/mwan3-luci/Makefile b/net/mwan3-luci/Makefile new file mode 100644 index 0000000..b4b49ce --- /dev/null +++ b/net/mwan3-luci/Makefile @@ -0,0 +1,41 @@ +# +# 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.4 +PKG_RELEASE:=4 +PKG_MAINTAINER:=Aedan Renner +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 +luci-mod-admin-full +luci-app-firewall +luci-lib-nixio + PKGARCH:=all + MAINTAINER:=Aedan Renner +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 physical or logical +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)) diff --git a/net/mwan3-luci/files/etc/hotplug.d/iface/16-mwancustombak b/net/mwan3-luci/files/etc/hotplug.d/iface/16-mwancustombak new file mode 100755 index 0000000..6e2875e --- /dev/null +++ b/net/mwan3-luci/files/etc/hotplug.d/iface/16-mwancustombak @@ -0,0 +1,38 @@ +#!/bin/sh + +# to enable this script uncomment the case loop at the bottom +# to report mwan status on interface hotplug ifup/ifdown events modify the lines in the send_alert function + +send_alert() +{ + # variable "$1" stores the MWAN 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 -p /var/state get system.@system[0].hostname)" ] has triggered a hotplug [ "$ACTION" ] event on "$(date +"%a %b %d %Y %T %Z")"" + + # get current interface, policy and rule status + local CURRENT_STATUS="$(/usr/sbin/mwan3 status)" + + # get last 50 MWAN systemlog messages + local MWAN_LOG="$(echo -e "Last 50 MWAN 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$MWAN_LOG")" +} + +#case "$ACTION" in +# ifup) +# gather_event_info +# ;; +# +# ifdown) +# gather_event_info +# ;; +#esac + +exit 0 diff --git a/net/mwan3-luci/files/etc/uci-defaults/mwan-luci b/net/mwan3-luci/files/etc/uci-defaults/mwan-luci new file mode 100755 index 0000000..ff9a229 --- /dev/null +++ b/net/mwan3-luci/files/etc/uci-defaults/mwan-luci @@ -0,0 +1,14 @@ +#!/bin/sh + +# replace existing mwan ucitrack entry +uci -q batch <<-EOF >/dev/null + del ucitrack.@mwan3[-1] + add ucitrack mwan3 + set ucitrack.@mwan3[-1].exec="/usr/sbin/mwan3 restart" + commit ucitrack +EOF + +# remove LuCI cache +rm -rf /tmp/luci-indexcache /tmp/luci-modulecache + +exit 0 diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/controller/mwan3.lua b/net/mwan3-luci/files/usr/lib/lua/luci/controller/mwan3.lua new file mode 100644 index 0000000..bd34360 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/controller/mwan3.lua @@ -0,0 +1,322 @@ +module("luci.controller.mwan3", package.seeall) + +sys = require "luci.sys" +ut = require "luci.util" + +ip = "/usr/bin/ip -4 " + +function index() + if not nixio.fs.access("/etc/config/mwan3") then + return + end + + entry({"admin", "network", "mwan"}, + alias("admin", "network", "mwan", "overview"), + _("Load Balancing"), 600) + + entry({"admin", "network", "mwan", "overview"}, + alias("admin", "network", "mwan", "overview", "overview_interface"), + _("Overview"), 10) + entry({"admin", "network", "mwan", "overview", "overview_interface"}, + template("mwan/overview_interface")) + entry({"admin", "network", "mwan", "overview", "interface_status"}, + call("interfaceStatus")) + entry({"admin", "network", "mwan", "overview", "overview_detailed"}, + template("mwan/overview_detailed")) + entry({"admin", "network", "mwan", "overview", "detailed_status"}, + call("detailedStatus")) + + entry({"admin", "network", "mwan", "configuration"}, + alias("admin", "network", "mwan", "configuration", "interface"), + _("Configuration"), 20) + entry({"admin", "network", "mwan", "configuration", "interface"}, + arcombine(cbi("mwan/interface"), cbi("mwan/interfaceconfig")), + _("Interfaces"), 10).leaf = true + entry({"admin", "network", "mwan", "configuration", "member"}, + arcombine(cbi("mwan/member"), cbi("mwan/memberconfig")), + _("Members"), 20).leaf = true + entry({"admin", "network", "mwan", "configuration", "policy"}, + arcombine(cbi("mwan/policy"), cbi("mwan/policyconfig")), + _("Policies"), 30).leaf = true + entry({"admin", "network", "mwan", "configuration", "rule"}, + arcombine(cbi("mwan/rule"), cbi("mwan/ruleconfig")), + _("Rules"), 40).leaf = true + + entry({"admin", "network", "mwan", "advanced"}, + alias("admin", "network", "mwan", "advanced", "hotplugscript"), + _("Advanced"), 100) + entry({"admin", "network", "mwan", "advanced", "hotplugscript"}, + form("mwan/advanced_hotplugscript")) + entry({"admin", "network", "mwan", "advanced", "mwanconfig"}, + form("mwan/advanced_mwanconfig")) + entry({"admin", "network", "mwan", "advanced", "networkconfig"}, + form("mwan/advanced_networkconfig")) + entry({"admin", "network", "mwan", "advanced", "diagnostics"}, + template("mwan/advanced_diagnostics")) + entry({"admin", "network", "mwan", "advanced", "diagnostics_display"}, + call("diagnosticsData"), nil).leaf = true + entry({"admin", "network", "mwan", "advanced", "troubleshooting"}, + template("mwan/advanced_troubleshooting")) + entry({"admin", "network", "mwan", "advanced", "troubleshooting_display"}, + call("troubleshootingData")) +end + +function getInterfaceStatus(ruleNumber, interfaceName) + if ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".enabled")) == "1" then + if ut.trim(sys.exec(ip .. "route list table " .. ruleNumber)) ~= "" then + if ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".track_ip")) ~= "" then + return "online" + else + return "notMonitored" + end + else + return "offline" + end + else + return "notEnabled" + end +end + +function getInterfaceName() + local ruleNumber, status = 0, "" + uci.cursor():foreach("mwan3", "interface", + function (section) + ruleNumber = ruleNumber+1 + status = status .. section[".name"] .. "[" .. getInterfaceStatus(ruleNumber, section[".name"]) .. "]" + end + ) + return status +end + +function interfaceStatus() + local ntm = require "luci.model.network".init() + + local mArray = {} + + -- overview status + local statusString = getInterfaceName() + if statusString ~= "" then + mArray.wans = {} + wansid = {} + + for wanName, interfaceState in string.gfind(statusString, "([^%[]+)%[([^%]]+)%]") do + local wanInterfaceName = ut.trim(sys.exec("uci -p /var/state get network." .. wanName .. ".ifname")) + if wanInterfaceName == "" then + wanInterfaceName = "X" + end + local wanDeviceLink = ntm:get_interface(wanInterfaceName) + wanDeviceLink = wanDeviceLink and wanDeviceLink:get_network() + wanDeviceLink = wanDeviceLink and wanDeviceLink:adminlink() or "#" + wansid[wanName] = #mArray.wans + 1 + mArray.wans[wansid[wanName]] = { name = wanName, link = wanDeviceLink, ifname = wanInterfaceName, status = interfaceState } + end + end + + -- overview status log + local mwanLog = ut.trim(sys.exec("logread | grep mwan3 | tail -n 50 | sed 'x;1!H;$!d;x'")) + if mwanLog ~= "" then + mArray.mwanlog = { mwanLog } + end + + luci.http.prepare_content("application/json") + luci.http.write_json(mArray) +end + +function detailedStatus() + local mArray = {} + + -- detailed mwan status + local detailStatusInfo = ut.trim(sys.exec("/usr/sbin/mwan3 status")) + if detailStatusInfo ~= "" then + mArray.mwandetail = { detailStatusInfo } + end + + luci.http.prepare_content("application/json") + luci.http.write_json(mArray) +end + +function diagnosticsData(interface, tool, task) + function getInterfaceNumber() + local number = 0 + uci.cursor():foreach("mwan3", "interface", + function (section) + number = number+1 + if section[".name"] == interface then + interfaceNumber = number + end + end + ) + end + + local mArray = {} + + local results = "" + if tool == "service" then + os.execute("/usr/sbin/mwan3 " .. task) + if task == "restart" then + results = "MWAN3 restarted" + elseif task == "stop" then + results = "MWAN3 stopped" + else + results = "MWAN3 started" + end + else + local interfaceDevice = ut.trim(sys.exec("uci -p /var/state get network." .. interface .. ".ifname")) + if interfaceDevice ~= "" then + if tool == "ping" then + local gateway = ut.trim(sys.exec("route -n | awk '{if ($8 == \"" .. interfaceDevice .. "\" && $1 == \"0.0.0.0\" && $3 == \"0.0.0.0\") print $2}'")) + if gateway ~= "" then + if task == "gateway" then + local pingCommand = "ping -c 3 -W 2 -I " .. interfaceDevice .. " " .. gateway + results = pingCommand .. "\n\n" .. sys.exec(pingCommand) + else + local tracked = ut.trim(sys.exec("uci -p /var/state get mwan3." .. interface .. ".track_ip")) + if tracked ~= "" then + for z in tracked:gmatch("[^ ]+") do + local pingCommand = "ping -c 3 -W 2 -I " .. interfaceDevice .. " " .. z + results = results .. pingCommand .. "\n\n" .. sys.exec(pingCommand) .. "\n\n" + end + else + results = "No tracking IP addresses configured on " .. interface + end + end + else + results = "No default gateway for " .. interface .. " found. Default route does not exist or is configured incorrectly" + end + elseif tool == "rulechk" then + getInterfaceNumber() + local rule1 = sys.exec(ip .. "rule | grep $(echo $((" .. interfaceNumber .. " + 1000)))") + local rule2 = sys.exec(ip .. "rule | grep $(echo $((" .. interfaceNumber .. " + 2000)))") + if rule1 ~= "" and rule2 ~= "" then + results = "All required interface IP rules found:\n\n" .. rule1 .. rule2 + elseif rule1 ~= "" or rule2 ~= "" then + results = "Missing 1 of the 2 required interface IP rules\n\n\nRules found:\n\n" .. rule1 .. rule2 + else + results = "Missing both of the required interface IP rules" + end + elseif tool == "routechk" then + getInterfaceNumber() + local routeTable = sys.exec(ip .. "route list table " .. interfaceNumber) + if routeTable ~= "" then + results = "Interface routing table " .. interfaceNumber .. " was found:\n\n" .. routeTable + else + results = "Missing required interface routing table " .. interfaceNumber + end + elseif tool == "hotplug" then + if task == "ifup" then + os.execute("/usr/sbin/mwan3 ifup " .. interface) + results = "Hotplug ifup sent to interface " .. interface .. "..." + else + os.execute("/usr/sbin/mwan3 ifdown " .. interface) + results = "Hotplug ifdown sent to interface " .. interface .. "..." + end + end + else + results = "Unable to perform diagnostic tests on " .. interface .. ". There is no physical or virtual device associated with this interface" + end + end + if results ~= "" then + results = ut.trim(results) + mArray.diagnostics = { results } + end + + luci.http.prepare_content("application/json") + luci.http.write_json(mArray) +end + +function troubleshootingData() + local ver = require "luci.version" + + local mArray = {} + + -- software versions + local wrtRelease = ut.trim(ver.distversion) + if wrtRelease ~= "" then + wrtRelease = "OpenWrt - " .. wrtRelease + else + wrtRelease = "OpenWrt - unknown" + end + local luciRelease = ut.trim(ver.luciversion) + if luciRelease ~= "" then + luciRelease = "\nLuCI - " .. luciRelease + else + luciRelease = "\nLuCI - unknown" + end + local mwanVersion = ut.trim(sys.exec("opkg info mwan3 | grep Version | awk '{print $2}'")) + if mwanVersion ~= "" then + mwanVersion = "\n\nmwan3 - " .. mwanVersion + else + mwanVersion = "\n\nmwan3 - unknown" + end + local mwanLuciVersion = ut.trim(sys.exec("opkg info luci-app-mwan3 | grep Version | awk '{print $2}'")) + if mwanLuciVersion ~= "" then + mwanLuciVersion = "\nmwan3-luci - " .. mwanLuciVersion + else + mwanLuciVersion = "\nmwan3-luci - unknown" + end + mArray.versions = { wrtRelease .. luciRelease .. mwanVersion .. mwanLuciVersion } + + -- mwan config + local mwanConfig = ut.trim(sys.exec("cat /etc/config/mwan3")) + if mwanConfig == "" then + mwanConfig = "No data found" + end + mArray.mwanconfig = { mwanConfig } + + -- network config + local networkConfig = ut.trim(sys.exec("cat /etc/config/network | sed -e 's/.*username.*/ USERNAME HIDDEN/' -e 's/.*password.*/ PASSWORD HIDDEN/'")) + if networkConfig == "" then + networkConfig = "No data found" + end + mArray.netconfig = { networkConfig } + + -- ifconfig + local ifconfig = ut.trim(sys.exec("ifconfig")) + if ifconfig == "" then + ifconfig = "No data found" + end + mArray.ifconfig = { ifconfig } + + -- route -n + local routeShow = ut.trim(sys.exec("route -n")) + if routeShow == "" then + routeShow = "No data found" + end + mArray.routeshow = { routeShow } + + -- ip rule show + local ipRuleShow = ut.trim(sys.exec(ip .. "rule show")) + if ipRuleShow == "" then + ipRuleShow = "No data found" + end + mArray.iprule = { ipRuleShow } + + -- ip route list table 1-250 + local routeList, routeString = ut.trim(sys.exec(ip .. "rule | sed 's/://g' | awk '$1>=2001 && $1<=2250' | awk '{print $NF}'")), "" + if routeList ~= "" then + for line in routeList:gmatch("[^\r\n]+") do + routeString = routeString .. line .. "\n" .. sys.exec(ip .. "route list table " .. line) + end + routeString = ut.trim(routeString) + else + routeString = "No data found" + end + mArray.routelist = { routeString } + + -- default firewall output policy + local firewallOut = ut.trim(sys.exec("uci -p /var/state get firewall.@defaults[0].output")) + if firewallOut == "" then + firewallOut = "No data found" + end + mArray.firewallout = { firewallOut } + + -- iptables + local iptables = ut.trim(sys.exec("iptables -L -t mangle -v -n")) + if iptables == "" then + iptables = "No data found" + end + mArray.iptables = { iptables } + + luci.http.prepare_content("application/json") + luci.http.write_json(mArray) +end diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/advanced_hotplugscript.lua b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/advanced_hotplugscript.lua new file mode 100644 index 0000000..0e7b8b1 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/advanced_hotplugscript.lua @@ -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-mwancustom" +scriptBackup = "/etc/hotplug.d/iface/16-mwancustombak" + +if luci.http.formvalue("cbid.luci.1._restorebak") then -- restore button has been clicked + luci.http.redirect(luci.dispatcher.build_url("admin/network/mwan/advanced/hotplugscript") .. "?restore=yes") +elseif luci.http.formvalue("restore") == "yes" then -- restore script from backup + os.execute("cp -f " .. scriptBackup .. " " .. script) +end + + +m5 = SimpleForm("luci", nil) + m5:append(Template("mwan/advanced_hotplugscript")) -- highlight current tab + +f = m5:section(SimpleSection, nil, + translate("This section allows you to modify the contents of /etc/hotplug.d/iface/16-mwancustom
" .. + "This is useful for running system commands and/or scripts based on interface ifup or ifdown hotplug events

" .. + "Notes:
" .. + "The first line of the script must be "#!/bin/sh" without quotes
" .. + "Lines beginning with # are comments and are not executed

" .. + "Available variables:
" .. + "$ACTION is the hotplug event (ifup, ifdown)
" .. + "$INTERFACE is the interface name (wan1, wan2, etc.)
" .. + "$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 " .. scriptBackup .. " " .. 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 diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/advanced_mwanconfig.lua b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/advanced_mwanconfig.lua new file mode 100644 index 0000000..e0a99e8 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/advanced_mwanconfig.lua @@ -0,0 +1,32 @@ +-- ------ mwan configuration ------ -- + +ut = require "luci.util" + +mwanConfig = "/etc/config/mwan3" + + +m5 = SimpleForm("luci", nil) + m5:append(Template("mwan/advanced_mwanconfig")) -- 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(mwanConfig) or "" + end + + function t.write(self, section, data) -- format and write new data to script + return nixio.fs.writefile(mwanConfig, "\n" .. ut.trim(data:gsub("\r\n", "\n")) .. "\n") + end + + function f.handle(self, state, data) + return true + end + + +return m5 diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/advanced_networkconfig.lua b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/advanced_networkconfig.lua new file mode 100644 index 0000000..b93d897 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/advanced_networkconfig.lua @@ -0,0 +1,32 @@ +-- ------ network configuration ------ -- + +ut = require "luci.util" + +networkConfig = "/etc/config/network" + + +m5 = SimpleForm("networkconf", nil) + m5:append(Template("mwan/advanced_networkconfig")) -- 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(networkConfig) or "" + end + + function t.write(self, section, data) -- format and write new data to script + return nixio.fs.writefile(networkConfig, "\n" .. ut.trim(data:gsub("\r\n", "\n")) .. "\n") + end + + function f.handle(self, state, data) + return true + end + + +return m5 diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interface.lua b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interface.lua new file mode 100644 index 0000000..a8e68a0 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interface.lua @@ -0,0 +1,266 @@ +-- ------ extra functions ------ -- + +function interfaceCheck() -- find issues with too many interfaces, reliability and metric + uci.cursor():foreach("mwan3", "interface", + function (section) + local interfaceName = section[".name"] + interfaceNumber = interfaceNumber+1 -- count number of mwan interfaces configured + -- create list of metrics for none and duplicate checking + local metricValue = ut.trim(sys.exec("uci -p /var/state get network." .. interfaceName .. ".metric")) + if metricValue == "" then + errorFound = 1 + errorNoMetricList = errorNoMetricList .. interfaceName .. " " + else + metricList = metricList .. interfaceName .. " " .. metricValue .. "\n" + end + -- check if any interfaces have a higher reliability requirement than tracking IPs configured + local trackingNumber = tonumber(ut.trim(sys.exec("echo $(uci -p /var/state get mwan3." .. interfaceName .. ".track_ip) | wc -w"))) + if trackingNumber > 0 then + local reliabilityNumber = tonumber(ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".reliability"))) + if reliabilityNumber and reliabilityNumber > trackingNumber then + errorFound = 1 + errorReliabilityList = errorReliabilityList .. interfaceName .. " " + 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 -p /var/state get network." .. interfaceName)) == "interface" then + local interfaceDevice = ut.trim(sys.exec("uci -p /var/state get network." .. interfaceName .. ".ifname")) + if interfaceDevice == "uci: Entry not found" or interfaceDevice == "" then + errorFound = 1 + errorNetConfigList = errorNetConfigList .. interfaceName .. " " + errorRouteList = errorRouteList .. interfaceName .. " " + else + local routeCheck = ut.trim(sys.exec("route -n | awk '{if ($8 == \"" .. interfaceDevice .. "\" && $1 == \"0.0.0.0\" && $3 == \"0.0.0.0\") print $1}'")) + if routeCheck == "" then + errorFound = 1 + errorRouteList = errorRouteList .. interfaceName .. " " + end + end + else + errorFound = 1 + errorNetConfigList = errorNetConfigList .. interfaceName .. " " + errorRouteList = errorRouteList .. interfaceName .. " " + end + end + ) + -- check if any interfaces have duplicate metrics + local metricDuplicateNumbers = sys.exec("echo '" .. metricList .. "' | awk '{print $2}' | uniq -d") + if metricDuplicateNumbers ~= "" then + errorFound = 1 + local metricDuplicates = "" + for line in metricDuplicateNumbers:gmatch("[^\r\n]+") do + metricDuplicates = sys.exec("echo '" .. metricList .. "' | grep '" .. line .. "' | awk '{print $1}'") + errorDuplicateMetricList = errorDuplicateMetricList .. metricDuplicates + end + errorDuplicateMetricList = sys.exec("echo '" .. errorDuplicateMetricList .. "' | tr '\n' ' '") + end +end + +function interfaceWarnings() -- display status and warning messages at the top of the page + local warnings = "" + if interfaceNumber <= 250 then + warnings = "There are currently " .. interfaceNumber .. " of 250 supported interfaces configured" + else + warnings = "WARNING: " .. interfaceNumber .. " interfaces are configured exceeding the maximum of 250!" + end + if errorReliabilityList ~= " " then + warnings = warnings .. "

WARNING: some interfaces have a higher reliability requirement than there are tracking IP addresses!" + end + if errorRouteList ~= " " then + warnings = warnings .. "

WARNING: some interfaces have no default route in the main routing table!" + end + if errorNetConfigList ~= " " then + warnings = warnings .. "

WARNING: some interfaces are configured incorrectly or not at all in /etc/config/network!" + end + if errorNoMetricList ~= " " then + warnings = warnings .. "

WARNING: some interfaces have no metric configured in /etc/config/network!" + end + if errorDuplicateMetricList ~= " " then + warnings = warnings .. "

WARNING: some interfaces have duplicate metrics configured in /etc/config/network!" + end + return warnings +end + +-- ------ interface configuration ------ -- + +dsp = require "luci.dispatcher" +sys = require "luci.sys" +ut = require "luci.util" + +interfaceNumber = 0 +metricList = "" +errorFound = 0 +errorDuplicateMetricList = " " +errorNetConfigList = " " +errorNoMetricList = " " +errorReliabilityList = " " +errorRouteList = " " +interfaceCheck() + + +m5 = Map("mwan3", translate("MWAN Interface Configuration"), + translate(interfaceWarnings())) + m5:append(Template("mwan/config_css")) + + +mwan_interface = m5:section(TypedSection, "interface", translate("Interfaces"), + translate("MWAN supports up to 250 physical and/or logical interfaces
" .. + "MWAN requires that all interfaces have a unique metric configured in /etc/config/network
" .. + "Names must match the interface name found in /etc/config/network (see advanced tab)
" .. + "Names may contain characters A-Z, a-z, 0-9, _ and no spaces
" .. + "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", "mwan", "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", "mwan", "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) + tracked = self.map:get(s, "track_ip") + if tracked then + local ipList = "" + for k,v in pairs(tracked) do + ipList = ipList .. v .. "
" + end + return ipList + 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 timeoutValue = self.map:get(s, "timeout") + if timeoutValue then + return timeoutValue .. "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 intervalValue = self.map:get(s, "interval") + if intervalValue then + return intervalValue .. "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 metricValue = sys.exec("uci -p /var/state get network." .. s .. ".metric") + if metricValue ~= "" then + return metricValue + else + return "—" + end + end + +errors = mwan_interface:option(DummyValue, "errors", translate("Errors")) + errors.rawhtml = true + function errors.cfgvalue(self, s) + if errorFound == 1 then + local mouseOver, lineBreak = "", "" + if string.find(errorReliabilityList, " " .. s .. " ") then + mouseOver = "Higher reliability requirement than there are tracking IP addresses" + lineBreak = " " + end + if string.find(errorRouteList, " " .. s .. " ") then + mouseOver = mouseOver .. lineBreak .. "No default route in the main routing table" + lineBreak = " " + end + if string.find(errorNetConfigList, " " .. s .. " ") then + mouseOver = mouseOver .. lineBreak .. "Configured incorrectly or not at all in /etc/config/network" + lineBreak = " " + end + if string.find(errorNoMetricList, " " .. s .. " ") then + mouseOver = mouseOver .. lineBreak .. "No metric configured in /etc/config/network" + lineBreak = " " + end + if string.find(errorDuplicateMetricList, " " .. s .. " ") then + mouseOver = mouseOver .. lineBreak .. "Duplicate metric configured in /etc/config/network" + end + if mouseOver == "" then + return "" + else + return "\"error\"" + end + else + return "" + end + end + + +return m5 diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interfaceconfig.lua b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interfaceconfig.lua new file mode 100644 index 0000000..387ff01 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interfaceconfig.lua @@ -0,0 +1,190 @@ +-- ------ extra functions ------ -- + +function interfaceCheck() + metricValue = ut.trim(sys.exec("uci -p /var/state get network." .. arg[1] .. ".metric")) + if metricValue == "" then -- no metric + errorNoMetric = 1 + else -- if metric exists create list of interface metrics to compare against for duplicates + uci.cursor():foreach("mwan3", "interface", + function (section) + local metricValue = ut.trim(sys.exec("uci -p /var/state get network." .. section[".name"] .. ".metric")) + metricList = metricList .. section[".name"] .. " " .. metricValue .. "\n" + end + ) + -- compare metric against list + local metricDuplicateNumbers, metricDuplicates = sys.exec("echo '" .. metricList .. "' | awk '{print $2}' | uniq -d"), "" + for line in metricDuplicateNumbers:gmatch("[^\r\n]+") do + metricDuplicates = sys.exec("echo '" .. metricList .. "' | grep '" .. line .. "' | awk '{print $1}'") + errorDuplicateMetricList = errorDuplicateMetricList .. metricDuplicates + end + if sys.exec("echo '" .. errorDuplicateMetricList .. "' | grep -w " .. arg[1]) ~= "" then + errorDuplicateMetric = 1 + end + end + -- check if this interface has a higher reliability requirement than track IPs configured + local trackingNumber = tonumber(ut.trim(sys.exec("echo $(uci -p /var/state get mwan3." .. arg[1] .. ".track_ip) | wc -w"))) + if trackingNumber > 0 then + local reliabilityNumber = tonumber(ut.trim(sys.exec("uci -p /var/state get mwan3." .. arg[1] .. ".reliability"))) + if reliabilityNumber and reliabilityNumber > trackingNumber then + errorReliability = 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 -p /var/state get network." .. arg[1])) == "interface" then + local interfaceDevice = ut.trim(sys.exec("uci -p /var/state get network." .. arg[1] .. ".ifname")) + if interfaceDevice == "uci: Entry not found" or interfaceDevice == "" then + errorNetConfig = 1 + errorRoute = 1 + else + local routeCheck = ut.trim(sys.exec("route -n | awk '{if ($8 == \"" .. interfaceDevice .. "\" && $1 == \"0.0.0.0\" && $3 == \"0.0.0.0\") print $1}'")) + if routeCheck == "" then + errorRoute = 1 + end + end + else + errorNetConfig = 1 + errorRoute = 1 + end +end + +function interfaceWarnings() -- display warning messages at the top of the page + local warns, lineBreak = "", "" + if errorReliability == 1 then + warns = "WARNING: this interface has a higher reliability requirement than there are tracking IP addresses!" + lineBreak = "

" + end + if errorRoute == 1 then + warns = warns .. lineBreak .. "WARNING: this interface has no default route in the main routing table!" + lineBreak = "

" + end + if errorNetConfig == 1 then + warns = warns .. lineBreak .. "WARNING: this interface is configured incorrectly or not at all in /etc/config/network!" + lineBreak = "

" + end + if errorNoMetric == 1 then + warns = warns .. lineBreak .. "WARNING: this interface has no metric configured in /etc/config/network!" + elseif errorDuplicateMetric == 1 then + warns = warns .. lineBreak .. "WARNING: this and other interfaces have duplicate metrics configured in /etc/config/network!" + end + return warns +end + +-- ------ interface configuration ------ -- + +dsp = require "luci.dispatcher" +sys = require "luci.sys" +ut = require "luci.util" +arg[1] = arg[1] or "" + +metricValue = "" +metricList = "" +errorDuplicateMetricList = "" +errorNoMetric = 0 +errorDuplicateMetric = 0 +errorRoute = 0 +errorNetConfig = 0 +errorReliability = 0 +interfaceCheck() + + +m5 = Map("mwan3", translate("MWAN Interface Configuration - " .. arg[1]), + translate(interfaceWarnings())) + m5.redirect = dsp.build_url("admin", "network", "mwan", "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 errorNoMetric == 0 then + return metricValue + else + return "—" + end + end + + +return m5 diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/member.lua b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/member.lua new file mode 100644 index 0000000..3bccbd9 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/member.lua @@ -0,0 +1,46 @@ +-- ------ member configuration ------ -- + +ds = require "luci.dispatcher" + + +m5 = Map("mwan3", translate("MWAN Member Configuration")) + m5:append(Template("mwan/config_css")) + + +mwan_member = m5:section(TypedSection, "member", translate("Members"), + translate("Members are profiles attaching a metric and weight to an MWAN interface
" .. + "Names may contain characters A-Z, a-z, 0-9, _ and no spaces
" .. + "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", "mwan", "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", "mwan", "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 diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/memberconfig.lua b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/memberconfig.lua new file mode 100644 index 0000000..181d22e --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/memberconfig.lua @@ -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("MWAN Member Configuration - ") .. arg[1]) + m5.redirect = dsp.build_url("admin", "network", "mwan", "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 diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/policy.lua b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/policy.lua new file mode 100644 index 0000000..e141d69 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/policy.lua @@ -0,0 +1,95 @@ +-- ------ extra functions ------ -- + +function policyCheck() -- 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 + nameTooLong = 1 + err_name_list = err_name_list .. section[".name"] .. " " + end + end + ) +end + +function policyWarn() -- display status and warning messages at the top of the page + if nameTooLong == 1 then + return "WARNING: Some policies have names exceeding the maximum of 15 characters!" + else + return "" + end +end + +-- ------ policy configuration ------ -- + +ds = require "luci.dispatcher" +sys = require "luci.sys" + +nameTooLong = 0 +err_name_list = " " +policyCheck() + + +m5 = Map("mwan3", translate("MWAN Policy Configuration"), + translate(policyWarn())) + m5:append(Template("mwan/config_css")) + + +mwan_policy = m5:section(TypedSection, "policy", translate("Policies"), + translate("Policies are profiles grouping one or more members controlling how MWAN distributes traffic
" .. + "Member interfaces with lower metrics are used first. Interfaces with the same metric load-balance
" .. + "Load-balanced member interfaces distribute more traffic out those with higher weights
" .. + "Names may contain characters A-Z, a-z, 0-9, _ and no spaces. Names must be 15 characters or less
" .. + "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", "mwan", "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", "mwan", "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 memberConfig, memberList = self.map:get(s, "use_member"), "" + if memberConfig then + for k,v in pairs(memberConfig) do + memberList = memberList .. v .. "
" + end + return memberList + else + return "—" + end + + end + +last_resort = mwan_policy:option(DummyValue, "last_resort", translate("Last resort")) + last_resort.rawhtml = true + function last_resort.cfgvalue(self, s) + local action = self.map:get(s, "last_resort") + if action == "blackhole" then + return "blackhole (drop)" + elseif action == "default" then + return "default (use main routing table)" + else + return "unreachable (reject)" + 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 "\"error\"" + end + end + + +return m5 diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/policyconfig.lua b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/policyconfig.lua new file mode 100644 index 0000000..f48a104 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/policyconfig.lua @@ -0,0 +1,65 @@ +-- ------ extra functions ------ -- + +function policyCheck() -- check to see if this policy's name exceed the maximum of 15 characters + policyNameLength = string.len(arg[1]) + if policyNameLength > 15 then + nameTooLong = 1 + end +end + +function policyWarn() -- display status and warning messages at the top of the page + if nameTooLong == 1 then + return "WARNING: this policy's name is " .. policyNameLength .. " characters exceeding the maximum of 15!" + else + return "" + end +end + +function cbiAddMember(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 "" + +nameTooLong = 0 +policyCheck() + + +m5 = Map("mwan3", translate("MWAN Policy Configuration - " .. arg[1]), + translate(policyWarn())) + m5.redirect = dsp.build_url("admin", "network", "mwan", "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")) + cbiAddMember(use_member) + +last_resort = mwan_policy:option(ListValue, "last_resort", translate("Last resort"), + translate("When all policy members are offline use this behavior for matched traffic")) + last_resort.default = "unreachable" + last_resort:value("unreachable", translate("unreachable (reject)")) + last_resort:value("blackhole", translate("blackhole (drop)")) + last_resort:value("default", translate("default (use main routing table)")) + + +-- ------ 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 diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/rule.lua b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/rule.lua new file mode 100644 index 0000000..a22e010 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/rule.lua @@ -0,0 +1,141 @@ +-- ------ extra functions ------ -- + +function ruleCheck() -- determine if rules needs a proper protocol configured + uci.cursor():foreach("mwan3", "rule", + function (section) + local sourcePort = ut.trim(sys.exec("uci -p /var/state get mwan3." .. section[".name"] .. ".src_port")) + local destPort = ut.trim(sys.exec("uci -p /var/state get mwan3." .. section[".name"] .. ".dest_port")) + if sourcePort ~= "" or destPort ~= "" then -- ports configured + local protocol = ut.trim(sys.exec("uci -p /var/state get mwan3." .. section[".name"] .. ".proto")) + if protocol == "" or protocol == "all" then -- no or improper protocol + error_protocol_list = error_protocol_list .. section[".name"] .. " " + end + end + end + ) +end + +function ruleWarn() -- display warning messages at the top of the page + if error_protocol_list ~= " " then + return "WARNING: some rules have a port configured with no or improper protocol specified! Please configure a specific protocol!" + else + return "" + end +end + +-- ------ rule configuration ------ -- + +dsp = require "luci.dispatcher" +sys = require "luci.sys" +ut = require "luci.util" + +error_protocol_list = " " +ruleCheck() + + +m5 = Map("mwan3", translate("MWAN Rule Configuration"), + translate(ruleWarn())) + m5:append(Template("mwan/config_css")) + + +mwan_rule = m5:section(TypedSection, "rule", translate("Traffic Rules"), + translate("Rules specify which traffic will use a particular MWAN policy based on IP address, port or protocol
" .. + "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
" .. + "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
" .. + "Names may contain characters A-Z, a-z, 0-9, _ and no spaces
" .. + "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", "mwan", "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", "mwan", "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 + +sticky = mwan_rule:option(DummyValue, "sticky", translate("Sticky")) + sticky.rawhtml = true + function sticky.cfgvalue(self, s) + if self.map:get(s, "sticky") == "1" then + stickied = 1 + return "Yes" + else + stickied = nil + return "No" + end + end + +timeout = mwan_rule:option(DummyValue, "timeout", translate("Sticky timeout")) + timeout.rawhtml = true + function timeout.cfgvalue(self, s) + if stickied then + local timeoutValue = self.map:get(s, "timeout") + if timeoutValue then + return timeoutValue .. "s" + else + return "600s" + end + else + return "—" + end + end + +ipset = mwan_rule:option(DummyValue, "ipset", translate("IPset")) + ipset.rawhtml = true + function ipset.cfgvalue(self, s) + return self.map:get(s, "ipset") or "—" + 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(error_protocol_list, " " .. s .. " ") then + return "" + else + return "\"error\"" + end + end + + +return m5 diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/ruleconfig.lua b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/ruleconfig.lua new file mode 100644 index 0000000..f7fb341 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/ruleconfig.lua @@ -0,0 +1,113 @@ +-- ------ extra functions ------ -- + +function ruleCheck() -- determine if rule needs a protocol specified + local sourcePort = ut.trim(sys.exec("uci -p /var/state get mwan3." .. arg[1] .. ".src_port")) + local destPort = ut.trim(sys.exec("uci -p /var/state get mwan3." .. arg[1] .. ".dest_port")) + if sourcePort ~= "" or destPort ~= "" then -- ports configured + local protocol = ut.trim(sys.exec("uci -p /var/state get mwan3." .. arg[1] .. ".proto")) + if protocol == "" or protocol == "all" then -- no or improper protocol + error_protocol = 1 + end + end +end + +function ruleWarn() -- display warning message at the top of the page + if error_protocol == 1 then + return "WARNING: this rule is incorrectly configured with no or improper protocol specified! Please configure a specific protocol!" + else + return "" + end +end + +function cbiAddPolicy(field) + uci.cursor():foreach("mwan3", "policy", + function (section) + field:value(section[".name"]) + end + ) +end + +function cbiAddProtocol(field) + local protocols = ut.trim(sys.exec("cat /etc/protocols | grep ' # ' | awk '{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(protocols, "%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 "" + +error_protocol = 0 +ruleCheck() + + +m5 = Map("mwan3", translate("MWAN Rule Configuration - ") .. arg[1], + translate(ruleWarn())) + m5.redirect = dsp.build_url("admin", "network", "mwan", "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") + cbiAddProtocol(proto) + +sticky = mwan_rule:option(ListValue, "sticky", translate("Sticky"), + translate("Traffic from the same source IP address that previously matched this rule within the sticky timeout period will use the same WAN interface")) + sticky.default = "0" + sticky:value("1", translate("Yes")) + sticky:value("0", translate("No")) + +timeout = mwan_rule:option(Value, "timeout", translate("Sticky timeout"), + translate("Seconds. Acceptable values: 1-1000000. Defaults to 600 if not set")) + timeout.datatype = "range(1, 1000000)" + +ipset = mwan_rule:option(Value, "ipset", translate("IPset"), + translate("Name of IPset rule. Requires IPset rule in /etc/dnsmasq.conf (eg \"ipset=/youtube.com/youtube\")")) + +use_policy = mwan_rule:option(Value, "use_policy", translate("Policy assigned")) + cbiAddPolicy(use_policy) + use_policy:value("unreachable", translate("unreachable (reject)")) + use_policy:value("blackhole", translate("blackhole (drop)")) + use_policy:value("default", translate("default (use main routing table)")) + + +-- ------ 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 diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/view/admin_status/index/mwan.htm b/net/mwan3-luci/files/usr/lib/lua/luci/view/admin_status/index/mwan.htm new file mode 100644 index 0000000..53b997a --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/view/admin_status/index/mwan.htm @@ -0,0 +1 @@ +<%+mwan/openwrt_overview_status%> diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_diagnostics.htm b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_diagnostics.htm new file mode 100644 index 0000000..1961569 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_diagnostics.htm @@ -0,0 +1,128 @@ +<%+header%> + + + +<% + local uci = require "luci.model.uci" + + interfaceNames = "" + uci.cursor():foreach("mwan3", "interface", + function (section) + interfaceNames = interfaceNames .. section[".name"] .. " " + end + ) +%> + + + + +
+
+ <%:MWAN Interface Diagnostics%> + +
+ + + + + + +
+
+
+ <%:MWAN Service Control%> +
+ + + +
+
+ +
+ + + +<%+footer%> diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_hotplugscript.htm b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_hotplugscript.htm new file mode 100644 index 0000000..cbef94b --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_hotplugscript.htm @@ -0,0 +1,23 @@ + + + diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_mwanconfig.htm b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_mwanconfig.htm new file mode 100644 index 0000000..5d83bdd --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_mwanconfig.htm @@ -0,0 +1,23 @@ + + + diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_networkconfig.htm b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_networkconfig.htm new file mode 100644 index 0000000..5c06d36 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_networkconfig.htm @@ -0,0 +1,23 @@ + + + diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_troubleshooting.htm b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_troubleshooting.htm new file mode 100644 index 0000000..514d91f --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/advanced_troubleshooting.htm @@ -0,0 +1,71 @@ +<%+header%> + + + + + + +
+
+ <%:Troubleshooting Data%> +
<%:Loading%> Collecting data...
+
+
+ + + +<%+footer%> diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/config_css.htm b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/config_css.htm new file mode 100644 index 0000000..99da487 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/config_css.htm @@ -0,0 +1,34 @@ + diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/openwrt_overview_status.htm b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/openwrt_overview_status.htm new file mode 100644 index 0000000..9329b92 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/openwrt_overview_status.htm @@ -0,0 +1,83 @@ + + +
+ <%:MWAN Interface Live Status%> +
<%:Loading%> Collecting data...
+
+ + diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/overview_detailed.htm b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/overview_detailed.htm new file mode 100644 index 0000000..b80b9f3 --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/overview_detailed.htm @@ -0,0 +1,51 @@ +<%+header%> + + + + + + +
+
+ <%:MWAN Detailed Status%> +
<%:Loading%> Collecting data...
+
+
+ + + +<%+footer%> diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/overview_interface.htm b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/overview_interface.htm new file mode 100644 index 0000000..472c7ce --- /dev/null +++ b/net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/overview_interface.htm @@ -0,0 +1,122 @@ +<%+header%> + + + + + + +
+
+ <%:MWAN Interface Live Status%> +
<%:Loading%> Collecting data...
+
+
+ <%:MWAN Interface Systemlog%> +
<%:Loading%> Collecting data...
+
+
+ + + +<%+footer%> diff --git a/net/mwan3/Makefile b/net/mwan3/Makefile new file mode 100644 index 0000000..01f9e07 --- /dev/null +++ b/net/mwan3/Makefile @@ -0,0 +1,45 @@ +# +# 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:=2.0 +PKG_RELEASE:=3 +PKG_MAINTAINER:=Jeroen Louwes +PKG_LICENSE:=GPLv2 + +include $(INCLUDE_DIR)/package.mk + +define Package/mwan3 + SECTION:=net + CATEGORY:=Network + SUBMENU:=Routing and Redirection + DEPENDS:=+ip +ipset +iptables +iptables-mod-conntrack-extra +iptables-mod-ipopt + TITLE:=Multiwan hotplug script with connection tracking support + MAINTAINER:=Jeroen Louwes + 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 + +$(eval $(call BuildPackage,mwan3)) diff --git a/net/mwan3/files/etc/config/mwan3 b/net/mwan3/files/etc/config/mwan3 new file mode 100644 index 0000000..0ebe38d --- /dev/null +++ b/net/mwan3/files/etc/config/mwan3 @@ -0,0 +1,73 @@ + +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 'https' + option sticky '1' + option dest_port '443' + option proto 'tcp' + option use_policy 'balanced' + +config rule 'default_rule' + option dest_ip '0.0.0.0/0' + option use_policy 'balanced' + diff --git a/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 b/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 new file mode 100644 index 0000000..86e60e1 --- /dev/null +++ b/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 @@ -0,0 +1,60 @@ +#!/bin/sh + +. /lib/functions.sh +. /lib/functions/network.sh +. /lib/mwan3/mwan3.sh + +config_load mwan3 + +config_get enabled $INTERFACE enabled 0 +[ "$enabled" == "1" ] || exit 0 + +[ "$ACTION" == "ifup" -o "$ACTION" == "ifdown" ] || exit 1 +[ -n "$INTERFACE" ] || exit 2 + +if [ "$ACTION" == "ifup" ]; then + [ -n "$DEVICE" ] || exit 3 +fi + +[ -x /usr/bin/ip ] || exit 4 +[ -x /usr/sbin/ipset ] || exit 5 +[ -x /usr/sbin/iptables ] || exit 6 +[ -x /usr/sbin/ip6tables ] || exit 7 +[ -x /usr/bin/logger ] || exit 8 + +config_get family $INTERFACE family ipv4 + +if [ "$family" == "ipv4" ]; then + network_get_gateway gateway $INTERFACE +elif [ "$family" == "ipv6" ]; then + network_get_gateway6 gateway $INTERFACE +fi + +[ -n "$gateway" ] || exit 9 + +$LOG notice "$ACTION interface $INTERFACE (${DEVICE:-unknown})" + +mwan3_set_connected_iptables + +case "$ACTION" in + ifup) + mwan3_set_general_rules + mwan3_set_general_iptables + mwan3_create_iface_rules $INTERFACE $DEVICE + mwan3_create_iface_iptables $INTERFACE $DEVICE + mwan3_create_iface_route $INTERFACE $DEVICE + mwan3_track $INTERFACE $DEVICE + mwan3_set_policies_iptables + mwan3_set_user_rules + ;; + ifdown) + mwan3_delete_iface_rules $INTERFACE + mwan3_delete_iface_iptables $INTERFACE + mwan3_delete_iface_route $INTERFACE + mwan3_delete_iface_ipset_entries $INTERFACE + mwan3_set_policies_iptables + mwan3_set_user_rules + ;; +esac + +exit 0 diff --git a/net/mwan3/files/lib/mwan3/mwan3.sh b/net/mwan3/files/lib/mwan3/mwan3.sh new file mode 100644 index 0000000..1e1de96 --- /dev/null +++ b/net/mwan3/files/lib/mwan3/mwan3.sh @@ -0,0 +1,806 @@ +#!/bin/sh + +IP4="/usr/bin/ip -4" +IP6="/usr/bin/ip -6" +IPS="/usr/sbin/ipset" +IPT4="/usr/sbin/iptables -t mangle -w" +IPT6="/usr/sbin/ip6tables -t mangle -w" +LOG="/usr/bin/logger -t mwan3 -p" + +mwan3_get_iface_id() +{ + local _tmp _iface _iface_count + + _iface="$2" + + mwan3_get_id() + { + let _iface_count++ + [ "$1" == "$_iface" ] && _tmp=$_iface_count + } + config_foreach mwan3_get_id interface + export "$1=$_tmp" +} + +mwan3_set_connected_iptables() +{ + local connected_network_v4 connected_network_v6 + + $IPS -! create mwan3_connected_v4 hash:net + $IPS create mwan3_connected_v4_temp hash:net + + for connected_network_v4 in $($IP4 route | awk '{print $1}' | egrep '[0-9]{1,3}(\.[0-9]{1,3}){3}'); do + $IPS -! add mwan3_connected_v4_temp $connected_network_v4 + done + + for connected_network_v4 in $($IP4 route list table 0 | awk '{print $2}' | egrep '[0-9]{1,3}(\.[0-9]{1,3}){3}'); do + $IPS -! add mwan3_connected_v4_temp $connected_network_v4 + done + + $IPS add mwan3_connected_v4_temp 224.0.0.0/3 + + $IPS swap mwan3_connected_v4_temp mwan3_connected_v4 + $IPS destroy mwan3_connected_v4_temp + + $IPS -! create mwan3_connected_v6 hash:net family inet6 + $IPS create mwan3_connected_v6_temp hash:net family inet6 + + for connected_network_v6 in $($IP6 route | awk '{print $1}' | egrep '([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])'); do + $IPS -! add mwan3_connected_v6_temp $connected_network_v6 + done + + $IPS swap mwan3_connected_v6_temp mwan3_connected_v6 + $IPS destroy mwan3_connected_v6_temp + + $IPS -! create mwan3_connected list:set + $IPS -! add mwan3_connected mwan3_connected_v4 + $IPS -! add mwan3_connected mwan3_connected_v6 +} + +mwan3_set_general_rules() +{ + local IP + + for IP in "$IP4" "$IP6"; do + + if [ -z "$($IP rule list | awk '$1 == "2253:"')" ]; then + $IP rule add pref 2253 fwmark 0xfd00/0xff00 blackhole + fi + + if [ -z "$($IP rule list | awk '$1 == "2254:"')" ]; then + $IP rule add pref 2254 fwmark 0xfe00/0xff00 unreachable + fi + done +} + +mwan3_set_general_iptables() +{ + local IPT + + for IPT in "$IPT4" "$IPT6"; do + + if ! $IPT -S mwan3_ifaces_in &> /dev/null; then + $IPT -N mwan3_ifaces_in + fi + + if ! $IPT -S mwan3_connected &> /dev/null; then + $IPT -N mwan3_connected + $IPS -! create mwan3_connected list:set + $IPT -A mwan3_connected -m set --match-set mwan3_connected dst -j MARK --set-xmark 0xff00/0xff00 + fi + + if ! $IPT -S mwan3_ifaces_out &> /dev/null; then + $IPT -N mwan3_ifaces_out + fi + + if ! $IPT -S mwan3_rules &> /dev/null; then + $IPT -N mwan3_rules + fi + + if ! $IPT -S mwan3_hook &> /dev/null; then + $IPT -N mwan3_hook + $IPT -A mwan3_hook -j CONNMARK --restore-mark --nfmask 0xff00 --ctmask 0xff00 + $IPT -A mwan3_hook -m mark --mark 0x0/0xff00 -j mwan3_ifaces_in + $IPT -A mwan3_hook -m mark --mark 0x0/0xff00 -j mwan3_connected + $IPT -A mwan3_hook -m mark --mark 0x0/0xff00 -j mwan3_ifaces_out + $IPT -A mwan3_hook -m mark --mark 0x0/0xff00 -j mwan3_rules + $IPT -A mwan3_hook -j CONNMARK --save-mark --nfmask 0xff00 --ctmask 0xff00 + $IPT -A mwan3_hook -m mark ! --mark 0xff00/0xff00 -j mwan3_connected + fi + + if ! $IPT -S PREROUTING | grep mwan3_hook &> /dev/null; then + $IPT -A PREROUTING -j mwan3_hook + fi + + if ! $IPT -S OUTPUT | grep mwan3_hook &> /dev/null; then + $IPT -A OUTPUT -j mwan3_hook + fi + done +} + +mwan3_create_iface_iptables() +{ + local id family src_ip src_ipv6 + + config_get family $1 family ipv4 + mwan3_get_iface_id id $1 + + [ -n "$id" ] || return 0 + + if [ "$family" == "ipv4" ]; then + + network_get_ipaddr src_ip $1 + + $IPS -! create mwan3_connected list:set + + if ! $IPT4 -S mwan3_ifaces_in &> /dev/null; then + $IPT4 -N mwan3_ifaces_in + fi + + if ! $IPT4 -S mwan3_ifaces_out &> /dev/null; then + $IPT4 -N mwan3_ifaces_out + fi + + if ! $IPT4 -S mwan3_iface_in_$1 &> /dev/null; then + $IPT4 -N mwan3_iface_in_$1 + fi + + if ! $IPT4 -S mwan3_iface_out_$1 &> /dev/null; then + $IPT4 -N mwan3_iface_out_$1 + fi + + $IPT4 -F mwan3_iface_in_$1 + $IPT4 -A mwan3_iface_in_$1 -i $2 -m set --match-set mwan3_connected src -m mark --mark 0x0/0xff00 -m comment --comment "default" -j MARK --set-xmark 0xff00/0xff00 + $IPT4 -A mwan3_iface_in_$1 -i $2 -m mark --mark 0x0/0xff00 -m comment --comment "$1" -j MARK --set-xmark $(($id*256))/0xff00 + + $IPT4 -D mwan3_ifaces_in -m mark --mark 0x0/0xff00 -j mwan3_iface_in_$1 &> /dev/null + $IPT4 -A mwan3_ifaces_in -m mark --mark 0x0/0xff00 -j mwan3_iface_in_$1 + + $IPT4 -F mwan3_iface_out_$1 + $IPT4 -A mwan3_iface_out_$1 -s $src_ip -m mark --mark 0x0/0xff00 -m comment --comment "$1" -j MARK --set-xmark $(($id*256))/0xff00 + + $IPT4 -D mwan3_ifaces_out -m mark --mark 0x0/0xff00 -j mwan3_iface_out_$1 &> /dev/null + $IPT4 -A mwan3_ifaces_out -m mark --mark 0x0/0xff00 -j mwan3_iface_out_$1 + fi + + if [ "$family" == "ipv6" ]; then + + network_get_ipaddr6 src_ipv6 $1 + + $IPS -! create mwan3_connected_v6 hash:net family inet6 + + if ! $IPT6 -S mwan3_ifaces_in &> /dev/null; then + $IPT6 -N mwan3_ifaces_in + fi + + if ! $IPT6 -S mwan3_ifaces_out &> /dev/null; then + $IPT6 -N mwan3_ifaces_out + fi + + if ! $IPT6 -S mwan3_iface_in_$1 &> /dev/null; then + $IPT6 -N mwan3_iface_in_$1 + fi + + if ! $IPT6 -S mwan3_iface_out_$1 &> /dev/null; then + $IPT6 -N mwan3_iface_out_$1 + fi + + $IPT6 -F mwan3_iface_in_$1 + $IPT6 -A mwan3_iface_in_$1 -i $2 -m set --match-set mwan3_connected_v6 src -m mark --mark 0x0/0xff00 -m comment --comment "default" -j MARK --set-xmark 0xff00/0xff00 + $IPT6 -A mwan3_iface_in_$1 -i $2 -m mark --mark 0x0/0xff00 -m comment --comment "$1" -j MARK --set-xmark $(($id*256))/0xff00 + + $IPT6 -D mwan3_ifaces_in -m mark --mark 0x0/0xff00 -j mwan3_iface_in_$1 &> /dev/null + $IPT6 -A mwan3_ifaces_in -m mark --mark 0x0/0xff00 -j mwan3_iface_in_$1 + + $IPT6 -F mwan3_iface_out_$1 + $IPT6 -A mwan3_iface_out_$1 -s $src_ipv6 -m mark --mark 0x0/0xff00 -m comment --comment "$1" -j MARK --set-xmark $(($id*256))/0xff00 + + $IPT6 -D mwan3_ifaces_out -m mark --mark 0x0/0xff00 -j mwan3_iface_out_$1 &> /dev/null + $IPT6 -A mwan3_ifaces_out -m mark --mark 0x0/0xff00 -j mwan3_iface_out_$1 + fi +} + +mwan3_delete_iface_iptables() +{ + config_get family $1 family ipv4 + + if [ "$family" == "ipv4" ]; then + + $IPT4 -D mwan3_ifaces_in -m mark --mark 0x0/0xff00 -j mwan3_iface_in_$1 &> /dev/null + $IPT4 -F mwan3_iface_in_$1 &> /dev/null + $IPT4 -X mwan3_iface_in_$1 &> /dev/null + + $IPT4 -D mwan3_ifaces_out -m mark --mark 0x0/0xff00 -j mwan3_iface_out_$1 &> /dev/null + $IPT4 -F mwan3_iface_out_$1 &> /dev/null + $IPT4 -X mwan3_iface_out_$1 &> /dev/null + fi + + if [ "$family" == "ipv6" ]; then + + $IPT6 -D mwan3_ifaces_in -m mark --mark 0x0/0xff00 -j mwan3_iface_in_$1 &> /dev/null + $IPT6 -F mwan3_iface_in_$1 &> /dev/null + $IPT6 -X mwan3_iface_in_$1 &> /dev/null + + $IPT6 -D mwan3_ifaces_out -m mark --mark 0x0/0xff00 -j mwan3_iface_out_$1 &> /dev/null + $IPT6 -F mwan3_iface_out_$1 &> /dev/null + $IPT6 -X mwan3_iface_out_$1 &> /dev/null + fi +} + +mwan3_create_iface_route() +{ + local id route_args + + config_get family $1 family ipv4 + mwan3_get_iface_id id $1 + + [ -n "$id" ] || return 0 + + if [ "$family" == "ipv4" ]; then + + network_get_gateway route_args $1 + route_args="via $route_args dev $2" + + $IP4 route flush table $id + $IP4 route add table $id default $route_args + fi + + if [ "$family" == "ipv6" ]; then + + network_get_gateway6 route_args $1 + route_args="via $route_args dev $2" + + $IP6 route flush table $id + $IP6 route add table $id default $route_args + fi +} + +mwan3_delete_iface_route() +{ + local id + + config_get family $1 family ipv4 + mwan3_get_iface_id id $1 + + [ -n "$id" ] || return 0 + + if [ "$family" == "ipv4" ]; then + $IP4 route flush table $id + fi + + if [ "$family" == "ipv6" ]; then + $IP6 route flush table $id + fi +} + +mwan3_create_iface_rules() +{ + local id family + + config_get family $1 family ipv4 + mwan3_get_iface_id id $1 + + [ -n "$id" ] || return 0 + + if [ "$family" == "ipv4" ]; then + + while [ -n "$($IP4 rule list | awk '$1 == "'$(($id+1000)):'"')" ]; do + $IP4 rule del pref $(($id+1000)) + done + + while [ -n "$($IP4 rule list | awk '$1 == "'$(($id+2000)):'"')" ]; do + $IP4 rule del pref $(($id+2000)) + done + + $IP4 rule add pref $(($id+1000)) iif $2 lookup main + $IP4 rule add pref $(($id+2000)) fwmark $(($id*256))/0xff00 lookup $id + fi + + if [ "$family" == "ipv6" ]; then + + while [ -n "$($IP6 rule list | awk '$1 == "'$(($id+1000)):'"')" ]; do + $IP6 rule del pref $(($id+1000)) + done + + while [ -n "$($IP6 rule list | awk '$1 == "'$(($id+2000)):'"')" ]; do + $IP6 rule del pref $(($id+2000)) + done + + $IP6 rule add pref $(($id+1000)) iif $2 lookup main + $IP6 rule add pref $(($id+2000)) fwmark $(($id*256))/0xff00 lookup $id + fi +} + +mwan3_delete_iface_rules() +{ + local id family + + config_get family $1 family ipv4 + mwan3_get_iface_id id $1 + + [ -n "$id" ] || return 0 + + if [ "$family" == "ipv4" ]; then + + while [ -n "$($IP4 rule list | awk '$1 == "'$(($id+1000)):'"')" ]; do + $IP4 rule del pref $(($id+1000)) + done + + while [ -n "$($IP4 rule list | awk '$1 == "'$(($id+2000)):'"')" ]; do + $IP4 rule del pref $(($id+2000)) + done + fi + + if [ "$family" == "ipv6" ]; then + + while [ -n "$($IP6 rule list | awk '$1 == "'$(($id+1000)):'"')" ]; do + $IP6 rule del pref $(($id+1000)) + done + + while [ -n "$($IP6 rule list | awk '$1 == "'$(($id+2000)):'"')" ]; do + $IP6 rule del pref $(($id+2000)) + done + fi +} + +mwan3_delete_iface_ipset_entries() +{ + local id setname entry + + mwan3_get_iface_id id $1 + + [ -n "$id" ] || return 0 + + for setname in $(ipset -n list | grep ^mwan3_sticky_); do + for entry in $(ipset list $setname | grep "$(echo $(($id*256)) | awk '{ printf "0x%08x", $1; }')" | cut -d ' ' -f 1); do + $IPS del $setname $entry + done + done +} + +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 $1 track_ip mwan3_list_track_ips + + 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 + + if [ -n "$track_ips" ]; then + config_get reliability $1 reliability 1 + config_get count $1 count 1 + config_get timeout $1 timeout 4 + config_get interval $1 interval 10 + config_get down $1 down 5 + config_get up $1 up 5 + + [ -x /usr/sbin/mwan3track ] && /usr/sbin/mwan3track $1 $2 $reliability $count $timeout $interval $down $up $track_ips & + fi +} + +mwan3_set_policy() +{ + local iface_count id iface family metric probability weight + + config_get iface $1 interface + config_get metric $1 metric 1 + config_get weight $1 weight 1 + + [ -n "$iface" ] || return 0 + + mwan3_get_iface_id id $iface + + [ -n "$id" ] || return 0 + + config_get family $iface family ipv4 + + if [ "$family" == "ipv4" ]; then + + if [ -n "$($IP4 route list table $id)" ]; then + if [ "$metric" -lt "$lowest_metric_v4" ]; then + + total_weight_v4=$weight + $IPT4 -F mwan3_policy_$policy + $IPT4 -A mwan3_policy_$policy -m mark --mark 0x0/0xff00 -m comment --comment "$iface $weight $weight" -j MARK --set-xmark $(($id*256))/0xff00 + + lowest_metric_v4=$metric + + elif [ "$metric" -eq "$lowest_metric_v4" ]; then + + total_weight_v4=$(($total_weight_v4+$weight)) + probability=$(($weight*1000/$total_weight_v4)) + + 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" + + $IPT4 -I mwan3_policy_$policy -m mark --mark 0x0/0xff00 $probability -m comment --comment "$iface $weight $total_weight_v4" -j MARK --set-xmark $(($id*256))/0xff00 + fi + fi + fi + + if [ "$family" == "ipv6" ]; then + + if [ -n "$($IP6 route list table $id)" ]; then + if [ "$metric" -lt "$lowest_metric_v6" ]; then + + total_weight_v6=$weight + $IPT6 -F mwan3_policy_$policy + $IPT6 -A mwan3_policy_$policy -m mark --mark 0x0/0xff00 -m comment --comment "$iface $weight $weight" -j MARK --set-xmark $(($id*256))/0xff00 + + lowest_metric_v6=$metric + + elif [ "$metric" -eq "$lowest_metric_v6" ]; then + + total_weight_v6=$(($total_weight_v6+$weight)) + probability=$(($weight*1000/$total_weight_v6)) + + 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" + + $IPT6 -I mwan3_policy_$policy -m mark --mark 0x0/0xff00 $probability -m comment --comment "$iface $weight $total_weight_v6" -j MARK --set-xmark $(($id*256))/0xff00 + fi + fi + fi +} + +mwan3_create_policies_iptables() +{ + local last_resort lowest_metric_v4 lowest_metric_v6 total_weight_v4 total_weight_v6 policy IPT + + policy="$1" + + config_get last_resort $1 last_resort unreachable + + if [ "$1" != $(echo "$1" | cut -c1-15) ]; then + $LOG warn "Policy $1 exceeds max of 15 chars. Not setting policy" && return 0 + fi + + for IPT in "$IPT4" "$IPT6"; do + + if ! $IPT -S mwan3_policy_$1 &> /dev/null; then + $IPT -N mwan3_policy_$1 + fi + + $IPT -F mwan3_policy_$1 + + case "$last_resort" in + blackhole) + $IPT -A mwan3_policy_$1 -m mark --mark 0x0/0xff00 -m comment --comment "blackhole" -j MARK --set-xmark 0xfd00/0xff00 + ;; + default) + $IPT -A mwan3_policy_$1 -m mark --mark 0x0/0xff00 -m comment --comment "default" -j MARK --set-xmark 0xff00/0xff00 + ;; + *) + $IPT -A mwan3_policy_$1 -m mark --mark 0x0/0xff00 -m comment --comment "unreachable" -j MARK --set-xmark 0xfe00/0xff00 + ;; + esac + done + + lowest_metric_v4=256 + total_weight_v4=0 + + lowest_metric_v6=256 + total_weight_v6=0 + + config_list_foreach $1 use_member mwan3_set_policy +} + +mwan3_set_policies_iptables() +{ + config_foreach mwan3_create_policies_iptables policy +} + +mwan3_set_sticky_iptables() +{ + local id iface + + for iface in $($IPT4 -S $policy | cut -s -d'"' -f2 | awk '{print $1}'); do + + if [ "$iface" == "$1" ]; then + + mwan3_get_iface_id id $1 + + [ -n "$id" ] || return 0 + + for IPT in "$IPT4" "$IPT6"; do + if [ -n "$($IPT -S mwan3_iface_in_$1 2> /dev/null)" -a -n "$($IPT -S mwan3_iface_out_$1 2> /dev/null)" ]; then + $IPT -I mwan3_rule_$rule -m mark --mark $(($id*256))/0xff00 -m set ! --match-set mwan3_sticky_$rule src,src -j MARK --set-xmark 0x0/0xff00 + $IPT -I mwan3_rule_$rule -m mark --mark 0/0xff00 -j MARK --set-xmark $(($id*256))/0xff00 + fi + done + fi + done +} + +mwan3_set_user_iptables_rule() +{ + local ipset family proto policy src_ip src_port sticky dest_ip dest_port use_policy timeout rule policy IPT + + rule="$1" + + config_get sticky $1 sticky 0 + config_get timeout $1 timeout 600 + config_get ipset $1 ipset + 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 + config_get family $1 family any + + if [ "$1" != $(echo "$1" | cut -c1-15) ]; then + $LOG warn "Rule $1 exceeds max of 15 chars. Not setting rule" && return 0 + fi + + if [ -n "$ipset" ]; then + ipset="-m set --match-set $ipset dst" + fi + + if [ -n "$use_policy" ]; then + if [ "$use_policy" == "default" ]; then + policy="MARK --set-xmark 0xff00/0xff00" + elif [ "$use_policy" == "unreachable" ]; then + policy="MARK --set-xmark 0xfe00/0xff00" + elif [ "$use_policy" == "blackhole" ]; then + policy="MARK --set-xmark 0xfd00/0xff00" + else + if [ "$sticky" -eq 1 ]; then + + policy="mwan3_policy_$use_policy" + + for IPT in "$IPT4" "$IPT6"; do + if ! $IPT -S $policy &> /dev/null; then + $IPT -N $policy + fi + + if ! $IPT -S mwan3_rule_$1 &> /dev/null; then + $IPT -N mwan3_rule_$1 + fi + + $IPT -F mwan3_rule_$1 + done + + $IPS -! create mwan3_sticky_v4_$rule hash:ip,mark markmask 0xff00 timeout $timeout + $IPS -! create mwan3_sticky_v6_$rule hash:ip,mark markmask 0xff00 timeout $timeout family inet6 + $IPS -! create mwan3_sticky_$rule list:set + $IPS -! add mwan3_sticky_$rule mwan3_sticky_v4_$rule + $IPS -! add mwan3_sticky_$rule mwan3_sticky_v6_$rule + + config_foreach mwan3_set_sticky_iptables interface + + for IPT in "$IPT4" "$IPT6"; do + $IPT -A mwan3_rule_$1 -m mark --mark 0/0xff00 -j $policy + $IPT -A mwan3_rule_$1 -m mark ! --mark 0xfc00/0xfc00 -j SET --del-set mwan3_sticky_$rule src,src + $IPT -A mwan3_rule_$1 -m mark ! --mark 0xfc00/0xfc00 -j SET --add-set mwan3_sticky_$rule src,src + done + + policy="mwan3_rule_$1" + else + policy="mwan3_policy_$use_policy" + + for IPT in "$IPT4" "$IPT6"; do + if ! $IPT -S $policy &> /dev/null; then + $IPT -N $policy + fi + done + + fi + fi + + if [ "$family" == "any" ]; then + + for IPT in "$IPT4" "$IPT6"; do + case $proto in + tcp|udp) + $IPT -A mwan3_rules -p $proto -s $src_ip -d $dest_ip $ipset -m multiport --sports $src_port -m multiport --dports $dest_port -m mark --mark 0/0xff00 -m comment --comment "$1" -j $policy &> /dev/null + ;; + *) + $IPT -A mwan3_rules -p $proto -s $src_ip -d $dest_ip $ipset -m mark --mark 0/0xff00 -m comment --comment "$1" -j $policy &> /dev/null + ;; + esac + done + + elif [ "$family" == "ipv4" ]; then + + case $proto in + tcp|udp) + $IPT4 -A mwan3_rules -p $proto -s $src_ip -d $dest_ip $ipset -m multiport --sports $src_port -m multiport --dports $dest_port -m mark --mark 0/0xff00 -m comment --comment "$1" -j $policy &> /dev/null + ;; + *) + $IPT4 -A mwan3_rules -p $proto -s $src_ip -d $dest_ip $ipset -m mark --mark 0/0xff00 -m comment --comment "$1" -j $policy &> /dev/null + ;; + esac + + elif [ "$family" == "ipv6" ]; then + + case $proto in + tcp|udp) + $IPT6 -A mwan3_rules -p $proto -s $src_ip -d $dest_ip $ipset -m multiport --sports $src_port -m multiport --dports $dest_port -m mark --mark 0/0xff00 -m comment --comment "$1" -j $policy &> /dev/null + ;; + *) + $IPT6 -A mwan3_rules -p $proto -s $src_ip -d $dest_ip $ipset -m mark --mark 0/0xff00 -m comment --comment "$1" -j $policy &> /dev/null + ;; + esac + fi + fi +} + +mwan3_set_user_rules() +{ + local IPT + + for IPT in "$IPT4" "$IPT6"; do + + if ! $IPT -S mwan3_rules &> /dev/null; then + $IPT -N mwan3_rules + fi + + $IPT -F mwan3_rules + done + + config_foreach mwan3_set_user_iptables_rule rule +} + +mwan3_report_iface_status() +{ + local device result track_ips tracking IP IPT + + mwan3_get_iface_id id $1 + network_get_device device $1 + config_get enabled "$1" enabled 0 + config_get family "$1" family ipv4 + + if [ "$family" == "ipv4" ]; then + IP="$IP4" + IPT="$IPT4" + fi + + if [ "$family" == "ipv6" ]; then + IP="$IP6" + IPT="$IPT6" + fi + + if [ -z "$id" -o -z "$device" ]; then + result="unknown" + elif [ -n "$($IP rule | awk '$1 == "'$(($id+1000)):'"')"i -a -n "$($IP rule | awk '$1 == "'$(($id+2000)):'"')" -a -n "$($IPT -S mwan3_iface_in_$1 2> /dev/null)" -a -n "$($IPT -S mwan3_iface_out_$1 2> /dev/null)" -a -n "$($IP route list table $id default dev $device 2> /dev/null)" ]; then + result="online" + elif [ -n "$($IP rule | awk '$1 == "'$(($id+1000)):'"')" -o -n "$($IP rule | awk '$1 == "'$(($id+2000)):'"')" -o -n "$($IPT -S mwan3_iface_in_$1 2> /dev/null)" -o -n "$($IPT -S mwan3_iface_out_$1 2> /dev/null)" -o -n "$($IP route list table $id default dev $device 2> /dev/null)" ]; then + result="error" + else + if [ "$enabled" == "1" ]; then + result="offline" + else + result="disabled" + fi + fi + + mwan3_list_track_ips() + { + track_ips="$1 $track_ips" + } + config_list_foreach $1 track_ip mwan3_list_track_ips + + if [ -n "$track_ips" ]; then + 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 + else + tracking="not enabled" + fi + + echo " interface $1 is $result and tracking is $tracking" +} + +mwan3_report_policies_v4() +{ + local percent policy share total_weight weight iface + + for policy in $($IPT4 -S | awk '{print $2}' | grep mwan3_policy_ | sort -u); do + echo "$policy:" | sed 's/mwan3_policy_//' + + [ -n "$total_weight" ] || total_weight=$($IPT4 -S $policy | cut -s -d'"' -f2 | head -1 | awk '{print $3}') + + if [ ! -z "${total_weight##*[!0-9]*}" ]; then + for iface in $($IPT4 -S $policy | cut -s -d'"' -f2 | awk '{print $1}'); do + weight=$($IPT4 -S $policy | cut -s -d'"' -f2 | awk '$1 == "'$iface'"' | awk '{print $2}') + percent=$(($weight*100/$total_weight)) + echo " $iface ($percent%)" + done + else + echo " $($IPT4 -S $policy | sed '/.*--comment \([^ ]*\) .*$/!d;s//\1/;q')" + fi + + unset total_weight + + echo -e + done +} + +mwan3_report_policies_v6() +{ + local percent policy share total_weight weight iface + + for policy in $($IPT6 -S | awk '{print $2}' | grep mwan3_policy_ | sort -u); do + echo "$policy:" | sed 's/mwan3_policy_//' + + [ -n "$total_weight" ] || total_weight=$($IPT6 -S $policy | cut -s -d'"' -f2 | head -1 | awk '{print $3}') + + if [ ! -z "${total_weight##*[!0-9]*}" ]; then + for iface in $($IPT6 -S $policy | cut -s -d'"' -f2 | awk '{print $1}'); do + weight=$($IPT6 -S $policy | cut -s -d'"' -f2 | awk '$1 == "'$iface'"' | awk '{print $2}') + percent=$(($weight*100/$total_weight)) + echo " $iface ($percent%)" + done + else + echo " $($IPT6 -S $policy | sed '/.*--comment \([^ ]*\) .*$/!d;s//\1/;q')" + fi + + unset total_weight + + echo -e + done +} + +mwan3_report_connected_v4() +{ + local address + + if [ -n "$($IPT4 -S mwan3_connected 2> /dev/null)" ]; then + for address in $($IPS list mwan3_connected_v4 | egrep '[0-9]{1,3}(\.[0-9]{1,3}){3}'); do + echo " $address" + done + fi +} + +mwan3_report_connected_v6() +{ + local address + + if [ -n "$($IPT6 -S mwan3_connected 2> /dev/null)" ]; then + for address in $($IPS list mwan3_connected_v6 | egrep '([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])'); do + echo " $address" + done + fi +} + +mwan3_report_rules_v4() +{ + if [ -n "$($IPT4 -S mwan3_rules 2> /dev/null)" ]; then + $IPT4 -L mwan3_rules -n -v 2> /dev/null | tail -n+3 | sed 's/mark.*//' | sed 's/mwan3_policy_/- /' | sed 's/mwan3_rule_/S /' + fi +} + +mwan3_report_rules_v6() +{ + if [ -n "$($IPT6 -S mwan3_rules 2> /dev/null)" ]; then + $IPT6 -L mwan3_rules -n -v 2> /dev/null | tail -n+3 | sed 's/mark.*//' | sed 's/mwan3_policy_/- /' | sed 's/mwan3_rule_/S /' + fi +} diff --git a/net/mwan3/files/usr/sbin/mwan3 b/net/mwan3/files/usr/sbin/mwan3 new file mode 100755 index 0000000..405cd43 --- /dev/null +++ b/net/mwan3/files/usr/sbin/mwan3 @@ -0,0 +1,182 @@ +#!/bin/sh + +[ -x /usr/bin/ip ] || exit 4 +[ -x /usr/sbin/ipset ] || exit 5 +[ -x /usr/sbin/iptables ] || exit 6 +[ -x /usr/sbin/ip6tables ] || exit 7 +[ -x /usr/bin/logger ] || exit 8 + +. /lib/functions.sh +. /lib/functions/network.sh +. /lib/mwan3/mwan3.sh + +help() +{ + cat < Load rules and routes for specific interface + ifdown Unload rules and routes for specific interface + interfaces Show interfaces status + policies Show currently active policy + connected Show directly connected networks + rules Show active rules + status Show all status + +EOF +} + +ifdown() +{ + if [ -z "$1" ]; then + echo "Error: Expecting interface. Usage: mwan3 ifdown " && exit 0 + fi + + if [ -n "$2" ]; then + echo "Error: Too many arguments. Usage: mwan3 ifdown " && exit 0 + fi + + ACTION=ifdown INTERFACE=$1 /sbin/hotplug-call iface + + if [ -e /var/run/mwan3track-$1.pid ] ; then + kill $(cat /var/run/mwan3track-$1.pid) + rm /var/run/mwan3track-$1.pid + fi +} + +ifup() +{ + local device enabled + + config_load mwan3 + + if [ -z "$1" ]; then + echo "Expecting interface. Usage: mwan3 ifup " && exit 0 + fi + + if [ -n "$2" ]; then + echo "Too many arguments. Usage: mwan3 ifup " && exit 0 + fi + + config_get enabled "$1" enabled 0 + + device=$(uci -p /var/state get 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 + + echo "Interface status:" + config_foreach mwan3_report_iface_status interface + echo -e +} + +policies() +{ + echo "Current ipv4 policies:" + mwan3_report_policies_v4 + echo -e + echo "Current ipv6 policies:" + mwan3_report_policies_v6 + echo -e +} + +connected() +{ + echo "Directly connected ipv4 networks:" + mwan3_report_connected_v4 + echo -e + echo "Directly connected ipv6 networks:" + mwan3_report_connected_v6 + echo -e +} + +rules() +{ + echo "Active ipv4 user rules:" + mwan3_report_rules_v4 + echo -e + echo "Active ipv6 user rules:" + mwan3_report_rules_v6 + echo -e +} + +status() +{ + interfaces + policies + connected + rules +} + +start() +{ + config_load mwan3 + config_foreach ifup interface +} + +stop() +{ + local ipset route rule table IP IPT + + killall mwan3track &> /dev/null + rm /var/run/mwan3track-* &> /dev/null + + for IP in "$IP4" "$IP6"; do + + 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 route flush table $route &> /dev/null + done + + for rule in $($IP rule list | egrep '^[1-2][0-9]{3}\:' | cut -d ':' -f 1); do + $IP rule del pref $rule &> /dev/null + done + done + + for IPT in "$IPT4" "$IPT6"; do + + $IPT -D PREROUTING -j mwan3_hook &> /dev/null + $IPT -D OUTPUT -j mwan3_hook &> /dev/null + + for table in $($IPT -S | awk '{print $2}' | grep mwan3 | sort -u); do + $IPT -F $table &> /dev/null + done + + for table in $($IPT -S | awk '{print $2}' | grep mwan3 | sort -u); do + $IPT -X $table &> /dev/null + done + done + + for ipset in $($IPS -n list | grep mwan3_); do + $IPS -q destroy $ipset + done + + for ipset in $($IPS -n list | grep mwan3 | grep -E '_v4|_v6'); do + $IPS -q destroy $ipset + done +} + +restart() { + stop + start +} + +case "$1" in + ifup|ifdown|interfaces|policies|connected|rules|status|start|stop|restart) + $* + ;; + *) + help + ;; +esac + +exit 0 diff --git a/net/mwan3/files/usr/sbin/mwan3track b/net/mwan3/files/usr/sbin/mwan3track new file mode 100755 index 0000000..35f97fe --- /dev/null +++ b/net/mwan3/files/usr/sbin/mwan3track @@ -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 -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 diff --git a/net/nbd/Makefile b/net/nbd/Makefile new file mode 100644 index 0000000..130b31b --- /dev/null +++ b/net/nbd/Makefile @@ -0,0 +1,88 @@ +# +# Copyright (C) 2006-2015 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:=nbd +PKG_VERSION:=3.11 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@SF/nbd +PKG_MD5SUM:=73d11644a28b9f335292cdb3bdc4b74b +PKG_LICENSE:=GPL-2.0+ +PKG_MAINTAINER:=Marcin Jurkowski + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +# -liconv due to glib2, to be revisited later +include $(INCLUDE_DIR)/nls.mk + +PKG_BUILD_DEPENDS:=glib2 libintl + +define Package/nbd + SECTION:=net + CATEGORY:=Network + TITLE:=Network Block Device utilities + URL:=http://nbd.sourceforge.net + DEPENDS:=+kmod-nbd +endef + +define Package/nbd/description + This package contains the network block device client. +endef + +define Package/nbd-server + SECTION:=net + CATEGORY:=Network + TITLE:=Network Block Device Server + URL:=http://nbd.sourceforge.net + DEPENDS:=+glib2 +endef + +define Package/nbd-server/description + This package contains the network block device server. +endef + +CONFIGURE_ARGS += \ + --disable-glibtest + +TARGET_CFLAGS += --std=gnu99 -DNODAEMON + +define Package/nbd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nbd-client $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/nbd-client.conf $(1)/etc/config/nbd-client + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/nbd-client.init $(1)/etc/init.d/nbd-client +endef + +define Package/nbd/conffiles +/etc/config/nbd-client +endef + +$(eval $(call BuildPackage,nbd)) + +define Package/nbd-server/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nbd-server $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/nbd-server.conf $(1)/etc/config/nbd-server + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/nbd-server.init $(1)/etc/init.d/nbd-server +endef + +define Package/nbd-server/conffiles +/etc/config/nbd-server +/etc/nbd-server/conf.d +/etc/nbd-server/allow +endef + +$(eval $(call BuildPackage,nbd-server)) diff --git a/net/nbd/files/nbd-client.conf b/net/nbd/files/nbd-client.conf new file mode 100644 index 0000000..e355c61 --- /dev/null +++ b/net/nbd/files/nbd-client.conf @@ -0,0 +1,9 @@ +config nbd-client nbd0 + option enabled '0' + option server '127.0.0.1' + option port 10809 + option sdp 0 + option swap 0 + option persist 0 + option blocksize 1024 + option exportname foo diff --git a/net/nbd/files/nbd-client.init b/net/nbd/files/nbd-client.init new file mode 100644 index 0000000..e10c220 --- /dev/null +++ b/net/nbd/files/nbd-client.init @@ -0,0 +1,69 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 OpenWrt.org + +START=90 +STOP=10 +USE_PROCD=1 + +append_arg() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}" +} + +append_bool() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get_bool val "$cfg" "$var" "$def" + [ "$val" = 1 ] && procd_append_param command "$opt" +} + +start_instance() { + local cfg="$1" + local enabled + + config_get_bool enabled "$cfg" 'enabled' '0' + [ "$enabled" = 0 ] && return 1 + + procd_open_instance + + procd_set_param command /usr/sbin/nbd-client + + append_arg "$cfg" server + append_arg "$cfg" port + # device path + procd_append_param command "/dev/$cfg" + procd_append_param command -nofork + append_bool "$cfg" sdp "-sdp" + append_bool "$cfg" swap "-swap" + append_bool "$cfg" persist "-persist" + append_arg "$cfg" blocksize "-block-size" + append_arg "$cfg" timeout "-timeout" + append_arg "$cfg" exportname "-name" + + procd_close_instance +} + +service_triggers() { + procd_add_reload_trigger "nbd-client" +} + +start_service() { + config_load nbd-client + config_foreach start_instance nbd-client +} + +stop_service() { + for dev in /dev/nbd*; do + nbd-client -d $dev 1>/dev/null 2>&1 + done +} diff --git a/net/nbd/files/nbd-server.conf b/net/nbd/files/nbd-server.conf new file mode 100644 index 0000000..ec9a1c3 --- /dev/null +++ b/net/nbd/files/nbd-server.conf @@ -0,0 +1,31 @@ +config nbd-server + option enabled 0 +# option port 10809 +# option user root +# option group root +# option allowlist 0 +# option includedir '/etc/nbd-server/conf.d' +# option listenaddr '0.0.0.0' +# option oldstyle 0 + +config share usb_sda1 + option filename '/dev/sda1' +# option authfile '/etc/nbd-server/allow' +# option timeout 0 +# option flush 0 +# option fua 0 +# option rotational 0 +# option sync 0 +# option discard 0 +# option maxconnections 10 +# option filesize 1000000 +# option multifile 0 +# option copyonwrite 0 +# option sparse_cow 1 +# option readonly 0 +# option prerun '/bin/true' +# option postrun '/bin/true' +# option virtstyle 'ipliteral' +# option oldstyle_port 12345 +# option oldstyle_listenaddr '0.0.0.0' + diff --git a/net/nbd/files/nbd-server.init b/net/nbd/files/nbd-server.init new file mode 100644 index 0000000..ae3db24 --- /dev/null +++ b/net/nbd/files/nbd-server.init @@ -0,0 +1,112 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 OpenWrt.org + +START=60 +STOP=40 +USE_PROCD=1 + +PROG=/usr/bin/nbd-server +CONFIGFILE="/var/etc/nbd-server.conf" + + +append_plain() { + echo "$1" >> $CONFIGFILE +} + +append_val_str() { + local resultname="$1" + local cfg="$2" + local uciname="${3:-$1}" + local value= + + config_get value "$cfg" "$uciname" + + if [ -z "$value" ]; then + return + fi + append_plain "$resultname = $value" +} + +append_val_bool() { + local resultname="$1" + local cfg="$2" + local uciname="${3:-$1}" + local value= + + config_get_bool value "$cfg" "$uciname" + if [ -z "$value" ]; then + return + fi + + [ $value == 1 ] && value="true" || value="false" + append_plain "$resultname = $value" +} + +config_handle_generic() { + local cfg="$1" + + append_plain "[generic]" + append_val_str user "$cfg" + append_val_str group "$cfg" + append_val_str port "$cfg" + append_val_str listenaddr "$cfg" + append_val_bool allowlist "$cfg" + append_val_str includedir "$cfg" + append_val_bool oldstyle "$cfg" + + config_get_bool SERVICE_ENABLED "$cfg" enabled 0 +} + +config_handle_share() { + local cfg="$1" + + append_plain + append_plain "[$cfg]" + append_val_str exportname "$cfg" filename + append_val_str timeout "$cfg" + append_val_str maxconnections "$cfg" + append_val_str authfile "$cfg" + append_val_str filesize "$cfg" + append_val_str readonly "$cfg" + append_val_str multifile "$cfg" + append_val_str copyonwrite "$cfg" + append_val_bool sparse_cow "$cfg" + append_val_bool flush "$cfg" + append_val_bool fua "$cfg" + append_val_bool rotational "$cfg" + append_val_bool sync "$cfg" + append_val_bool discard "$cfg" + append_val_str prerun "$cfg" + append_val_str postrun "$cfg" + append_val_str virtstyle "$cfg" + append_val_str port "$cfg" oldstyle_port + append_val_str listenaddr "$cfg" oldstyle_listenaddr +} + +start_instance() { + local cfg="$1" + local enabled + + config_get_bool enabled "$cfg" 'enabled' '0' + [ "$enabled" = 0 ] && return 1 + + procd_open_instance + procd_set_param command $PROG --config-file=$CONFIGFILE + procd_set_param file $CONFIGFILE + procd_close_instance +} + +start_service() { + config_load nbd-server + + mkdir -p $(dirname $CONFIGFILE) + echo "# auto-generated config file from /etc/config/nbd-server" > $CONFIGFILE + config_foreach config_handle_generic nbd-server + config_foreach config_handle_share share + + config_foreach start_instance nbd-server +} + +service_triggers() { + procd_add_reload_trigger "nbd-server" +} diff --git a/net/ncp/Makefile b/net/ncp/Makefile new file mode 100644 index 0000000..56bd08b --- /dev/null +++ b/net/ncp/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2016 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:=ncp +PKG_VERSION:=1.2.4 +PKG_RELEASE:=1 + +PKG_LICENSE:=FREE +PKG_LICENSE_FILES:= + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://dl.fefe.de/ +PKG_MD5SUM:=421c4855bd3148b7d0a4342942b4bf13 + +PKG_BUILD_DEPENDS:=libowfat + +PKG_MAINTAINER:=Andreas Shimokawa + +include $(INCLUDE_DIR)/package.mk + +define Package/ncp + SECTION:=net + CATEGORY:=Network + TITLE:=copy files over the network + URL:=https://www.fefe.de/ncp/ +endef + +define Package/ncp/description + copy files over the network +endef + +define Build/Compile + cd $(PKG_BUILD_DIR); \ + $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) -I$(STAGING_DIR)/usr/include/libowfat ncp.c -lowfat -o ncp +endef + +define Package/ncp/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ncp $(1)/usr/bin/ + ln -sf ncp $(1)/usr/bin/npush + ln -sf ncp $(1)/usr/bin/npoll +endef + +$(eval $(call BuildPackage,ncp)) diff --git a/net/net-snmp/Makefile b/net/net-snmp/Makefile new file mode 100644 index 0000000..ddd2da4 --- /dev/null +++ b/net/net-snmp/Makefile @@ -0,0 +1,257 @@ +# +# Copyright (C) 2006-2015 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:=net-snmp +PKG_VERSION:=5.4.4 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/net-snmp +PKG_MD5SUM:=95aa054f3c99a1ce242807d7eaf98619 +PKG_MAINTAINER:=Jo-Philipp Wich +PKG_LICENSE:=MIT BSD-3-Clause-Clear + +PKG_FIXUP = patch-libtool + +include $(INCLUDE_DIR)/package.mk + +define Package/net-snmp/Default + SECTION:=net + CATEGORY:=Network + URL:=http://www.net-snmp.org/ +endef + +define Package/net-snmp/Default/description + Simple Network Management Protocol (SNMP) is a widely used protocol for + monitoring the health and welfare of network equipment (eg. routers), + computer equipment and even devices like UPSs. Net-SNMP is a suite of + applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both + IPv4 and IPv6. +endef + + +define Package/libnetsnmp +$(call Package/net-snmp/Default) + SECTION:=libs + CATEGORY:=Libraries + TITLE:=Open source SNMP implementation (libraries) +endef + +define Package/libnetsnmp/description +$(call Package/net-snmp/Default/description) + . + This package contains shared libraries, needed by other programs. +endef + + +define Package/snmp-utils +$(call Package/net-snmp/Default) + DEPENDS:=+libnetsnmp + TITLE:=Open source SNMP implementation (utilities) +endef + +define Package/snmp-utils/description +$(call Package/net-snmp/Default/description) + . + This package contains SNMP client utilities. +endef + + +define Package/snmpd +$(call Package/net-snmp/Default) + DEPENDS:=+libnetsnmp + TITLE:=Open source SNMP implementation (daemon) +endef + +define Package/snmpd/description +$(call Package/net-snmp/Default/description) + . + This package contains the SNMP agent, dynamically linked. +endef + + +define Package/snmpd-static +$(call Package/net-snmp/Default) + TITLE:=Open source SNMP implementation (daemon) +endef + +define Package/snmpd-static/description +$(call Package/net-snmp/Default/description) + . + This package contains the SNMP agent, statically linked. +endef + + +SNMP_MIB_MODULES_INCLUDED = \ + host/hr_device \ + host/hr_disk \ + host/hr_filesys \ + host/hr_network \ + host/hr_partition \ + host/hr_proc \ + host/hr_storage \ + host/hr_system \ + ieee802dot11 \ + if-mib/ifXTable \ + mibII/at \ + mibII/icmp \ + mibII/ifTable \ + mibII/ip \ + mibII/snmp_mib \ + mibII/sysORTable \ + mibII/system_mib \ + mibII/tcp \ + mibII/udp \ + mibII/vacm_context \ + mibII/vacm_vars \ + snmpv3/snmpEngine \ + snmpv3/snmpMPDStats \ + snmpv3/usmConf \ + snmpv3/usmStats \ + snmpv3/usmUser \ + tunnel \ + ucd-snmp/disk \ + ucd-snmp/dlmod \ + ucd-snmp/extensible \ + ucd-snmp/loadave \ + ucd-snmp/memory \ + ucd-snmp/pass \ + ucd-snmp/pass_persist \ + ucd-snmp/proc \ + ucd-snmp/vmstat \ + util_funcs \ + utilities/execute \ + +SNMP_MIB_MODULES_EXCLUDED = \ + agent_mibs \ + agentx \ + disman/event \ + disman/schedule \ + hardware \ + host \ + if-mib \ + mibII \ + notification \ + notification-log-mib \ + snmpv3mibs \ + target \ + tcp-mib \ + ucd_snmp \ + udp-mib \ + utilities \ + +SNMP_TRANSPORTS_INCLUDED = Callback UDP + +SNMP_TRANSPORTS_EXCLUDED = TCP TCPIPv6 Unix + +TARGET_CFLAGS += $(FPIC) + +CONFIGURE_ARGS += \ + --enable-mfd-rewrites \ + --enable-shared \ + --enable-static \ + --with-endianness=$(if $(CONFIG_BIG_ENDIAN),big,little) \ + --with-logfile=/var/log/snmpd.log \ + --with-persistent-directory=/usr/lib/snmp/ \ + --with-default-snmp-version=1 \ + --with-sys-contact=root@localhost \ + --with-sys-location=Unknown \ + --enable-applications \ + --disable-debugging \ + --disable-manuals \ + --disable-mibs \ + --disable-scripts \ + --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \ + --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \ + --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \ + --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \ + --without-openssl \ + --without-libwrap \ + --without-rpm \ + --without-zlib \ + $(call autoconf_bool,CONFIG_IPV6,ipv6) \ + +ifeq ($(CONFIG_IPV6),y) +SNMP_TRANSPORTS_INCLUDED+= UDPIPv6 +endif + +TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/usr/lib + +ifdef CONFIG_PACKAGE_snmpd-static + define Build/Compile/static + $(MAKE) -C $(PKG_BUILD_DIR)/agent \ + LDFLAGS="$(TARGET_LDFLAGS) -lm -static" \ + EXEEXT="-static" \ + snmpd-static + endef +endif + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \ + LDFLAGS="$(TARGET_LDFLAGS) -lm -lc" \ + all install + $(Build/Compile/static) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(2)/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(2)/bin/ + $(SED) 's,=/usr,=$(STAGING_DIR)/usr,g' $(2)/bin/net-snmp-config + + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(1)/usr/lib/ +endef + +define Package/libnetsnmp/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/ +endef + +define Package/snmpd/conffiles +/etc/config/snmpd +endef + +define Package/snmpd/install + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd + $(INSTALL_DIR) $(1)/etc/snmp + ln -sf /var/run/snmpd.conf $(1)/etc/snmp/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd $(1)/usr/sbin/snmpd +endef + +define Package/snmpd-static/conffiles +/etc/config/snmpd +endef + +define Package/snmpd-static/install + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd + $(INSTALL_DIR) $(1)/etc/snmp + ln -sf /var/run/snmpd.conf $(1)/etc/snmp/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/agent/snmpd-static $(1)/usr/sbin/snmpd +endef + +define Package/snmp-utils/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,libnetsnmp)) +$(eval $(call BuildPackage,snmp-utils)) +$(eval $(call BuildPackage,snmpd)) +$(eval $(call BuildPackage,snmpd-static)) diff --git a/net/net-snmp/files/snmpd.conf b/net/net-snmp/files/snmpd.conf new file mode 100644 index 0000000..4bdc3d4 --- /dev/null +++ b/net/net-snmp/files/snmpd.conf @@ -0,0 +1,82 @@ +config agent + option agentaddress UDP:161 + +config com2sec public + option secname ro + option source default + option community public + +config com2sec private + option secname rw + option source localhost + option community private + +config group public_v1 + option group public + option version v1 + option secname ro + +config group public_v2c + option group public + option version v2c + option secname ro + +config group public_usm + option group public + option version usm + option secname ro + +config group private_v1 + option group private + option version v1 + option secname rw + +config group private_v2c + option group private + option version v2c + option secname rw + +config group private_usm + option group private + option version usm + option secname rw + +config view all + option viewname all + option type included + option oid .1 + +config access public_access + option group public + option context none + option version any + option level noauth + option prefix exact + option read all + option write none + option notify none + +config access private_access + option group private + option context none + option version any + option level noauth + option prefix exact + option read all + option write all + option notify all + +config system + option sysLocation 'office' + option sysContact 'bofh@example.com' + option sysName 'HeartOfGold' +# option sysServices 72 +# option sysDescr 'adult playground' +# option sysObjectID '1.2.3.4' + +config exec + option name filedescriptors + option prog /bin/cat + option args /proc/sys/fs/file-nr +# option miboid 1.2.3.4 + diff --git a/net/net-snmp/files/snmpd.init b/net/net-snmp/files/snmpd.init new file mode 100644 index 0000000..ff78097 --- /dev/null +++ b/net/net-snmp/files/snmpd.init @@ -0,0 +1,241 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008 OpenWrt.org +START=50 + +USE_PROCD=1 +PROG="/usr/sbin/snmpd" + +CONFIGFILE="/var/run/snmpd.conf" + +snmpd_agent_add() { + local cfg="$1" + + config_get agentaddress "$cfg" agentaddress + [ -n "$agentaddress" ] || return 0 + echo "agentaddress $agentaddress" >> $CONFIGFILE +} + +snmpd_system_add() { + local cfg="$1" + config_get syslocation "$cfg" sysLocation + [ -n "$syslocation" ] && echo "sysLocation $syslocation" >> $CONFIGFILE + config_get syscontact "$cfg" sysContact + [ -n "$syscontact" ] && echo "sysContact $syscontact" >> $CONFIGFILE + config_get sysname "$cfg" sysName + [ -n "$sysname" ] && echo "sysName $sysname" >> $CONFIGFILE + config_get sysservice "$cfg" sysService + [ -n "$sysservice" ] && echo "sysService $sysservice" >> $CONFIGFILE + config_get sysdescr "$cfg" sysDescr + [ -n "$sysdescr" ] && echo "sysDescr $sysdescr" >> $CONFIGFILE + config_get sysobjectid "$cfg" sysObjectID + [ -n "$sysobjectid" ] && echo "sysObjectID $sysobjectid" >> $CONFIGFILE +} + +snmpd_com2sec_add() { + local cfg="$1" + config_get secname "$cfg" secname + [ -n "$secname" ] || return 0 + config_get source "$cfg" source + [ -n "$source" ] || return 0 + config_get community "$cfg" community + [ -n "$community" ] || return 0 + echo "com2sec $secname $source $community" >> $CONFIGFILE +} + +snmpd_com2sec6_add() { + local cfg="$1" + config_get secname "$cfg" secname + [ -n "$secname" ] || return 0 + config_get source "$cfg" source + [ -n "$source" ] || return 0 + config_get community "$cfg" community + [ -n "$community" ] || return 0 + echo "com2sec6 $secname $source $community" >> $CONFIGFILE +} + +snmpd_group_add() { + local cfg="$1" + config_get group "$cfg" group + [ -n "$group" ] || return 0 + config_get version "$cfg" version + [ -n "$version" ] || return 0 + config_get secname "$cfg" secname + [ -n "$secname" ] || return 0 + echo "group $group $version $secname" >> $CONFIGFILE +} + +snmpd_view_add() { + local cfg="$1" + config_get viewname "$cfg" viewname + [ -n "$viewname" ] || return 0 + config_get type "$cfg" type + [ -n "$type" ] || return 0 + config_get oid "$cfg" oid + [ -n "$oid" ] || return 0 + # optional mask + config_get mask "$cfg" mask + echo "view $viewname $type $oid $mask" >> $CONFIGFILE +} + +snmpd_access_add() { + local cfg="$1" + config_get group "$cfg" group + [ -n "$group" ] || return 0 + config_get context "$cfg" context + [ -n $context ] || return 0 + [ "$context" == "none" ] && context='""' + config_get version "$cfg" version + [ -n "$version" ] || return 0 + config_get level "$cfg" level + [ -n "$level" ] || return 0 + config_get prefix "$cfg" prefix + [ -n "$prefix" ] || return 0 + config_get read "$cfg" read + [ -n "$read" ] || return 0 + config_get write "$cfg" write + [ -n "$write" ] || return 0 + config_get notify "$cfg" notify + [ -n "$notify" ] || return 0 + echo "access $group $context $version $level $prefix $read $write $notify" >> $CONFIGFILE +} + +snmpd_trap_hostname_add() { + local cfg="$1" + config_get hostname "$cfg" HostName + config_get port "$cfg" Port + config_get community "$cfg" Community + config_get type "$cfg" Type + echo "$type $hostname $community $port" >> $CONFIGFILE +} + +snmpd_trap_ip_add() { + local cfg="$1" + config_get host_ip "$cfg" HostIP + config_get port "$cfg" Port + config_get community "$cfg" Community + config_get type "$cfg" Type + echo "$type $host_ip $community $port" >> $CONFIGFILE +} + +snmpd_access_default_add() { + local cfg="$1" + config_get mode "$cfg" Mode + config_get community "$cfg" CommunityName + config_get oidrestrict "$cfg" RestrictOID + config_get oid "$cfg" RestrictedOID + echo -n "$mode $community default" >> $CONFIGFILE + [ "$oidrestrict" == "yes" ] && echo " $oid" >> $CONFIGFILE + [ "$oidrestrict" == "no" ] && echo "" >> $CONFIGFILE +} + +snmpd_access_HostName_add() { + local cfg="$1" + config_get hostname "$cfg" HostName + config_get mode "$cfg" Mode + config_get community "$cfg" CommunityName + config_get oidrestrict "$cfg" RestrictOID + config_get oid "$cfg" RestrictedOID + echo -n "$mode $community $hostname" >> $CONFIGFILE + [ "$oidrestrict" == "yes" ] && echo " $oid" >> $CONFIGFILE + [ "$oidrestrict" == "no" ] && echo "" >> $CONFIGFILE +} + +snmpd_access_HostIP_add() { + local cfg="$1" + config_get host_ip "$cfg" HostIP + config_get ip_mask "$cfg" IPMask + config_get mode "$cfg" Mode + config_get community "$cfg" CommunityName + config_get oidrestrict "$cfg" RestrictOID + config_get oid "$cfg" RestrictedOID + echo -n "$mode $community $host_ip/$ip_mask" >> $CONFIGFILE + [ "$oidrestrict" == "yes" ] && echo " $oid" >> $CONFIGFILE + [ "$oidrestrict" == "no" ] && echo "" >> $CONFIGFILE +} + +snmpd_pass_add() { + local cfg="$1" + local pass='pass' + + config_get miboid "$cfg" miboid + [ -n "$miboid" ] || return 0 + config_get prog "$cfg" prog + [ -n "$prog" ] || return 0 + config_get_bool persist "$cfg" persist 0 + [ $persist -ne 0 ] && pass='pass_persist' + config_get priority "$cfg" priority + priority=${priority:+-p $priority} + echo "$pass $priority $miboid $prog" >> $CONFIGFILE +} + +snmpd_exec_add() { + local cfg="$1" + + config_get name "$cfg" name + [ -n "$name" ] || return 0 + config_get prog "$cfg" prog + [ -n "$prog" ] || return 0 + config_get args "$cfg" args + config_get miboid "$cfg" miboid + echo "exec $miboid $name $prog $args" >> $CONFIGFILE +} + +snmpd_disk_add() { + local cfg="$1" + local disk='disk' + + config_get partition "$cfg" partition + [ -n "$partition" ] || return 0 + config_get size "$cfg" size + [ -n "$size" ] || return 0 + echo "$disk $partition $size" >> $CONFIGFILE +} + +start_service() { + [ -f "$CONFIGFILE" ] && rm -f "$CONFIGFILE" + + procd_open_instance + + config_load snmpd + + config_foreach snmpd_agent_add agent + config_foreach snmpd_system_add system + config_foreach snmpd_com2sec_add com2sec + config_foreach snmpd_com2sec6_add com2sec6 + config_foreach snmpd_group_add group + config_foreach snmpd_view_add view + config_foreach snmpd_access_add access + config_foreach snmpd_trap_hostname_add trap_HostName + config_foreach snmpd_trap_ip_add trap_HostIP + config_foreach snmpd_access_default_add access_default + config_foreach snmpd_access_HostName_add access_HostName + config_foreach snmpd_access_HostIP_add access_HostIP + config_foreach snmpd_pass_add pass + config_foreach snmpd_exec_add exec + config_foreach snmpd_disk_add disk + + procd_set_param command $PROG -Lf /dev/null -f + procd_set_param file $CONFIGFILE + procd_set_param respawn + + for iface in $(ls /sys/class/net 2>/dev/null); do + procd_append_param netdev "$iface" + done + + procd_close_instance +} + +stop_service() { + [ -f "$CONFIGFILE" ] && rm -f "$CONFIGFILE" +} + +service_triggers(){ + local script=$(readlink "$initscript") + local name=$(basename ${script:-$initscript}) + + procd_open_trigger + procd_add_raw_trigger "interface.*" 2000 /etc/init.d/$name reload + procd_close_trigger + + procd_add_reload_trigger 'snmpd' +} diff --git a/net/net-snmp/patches/100-debian-statistics.patch b/net/net-snmp/patches/100-debian-statistics.patch new file mode 100644 index 0000000..c937fca --- /dev/null +++ b/net/net-snmp/patches/100-debian-statistics.patch @@ -0,0 +1,22 @@ +--- a/agent/mibgroup/mibII/interfaces.c ++++ b/agent/mibgroup/mibII/interfaces.c +@@ -1561,6 +1561,10 @@ Interface_Scan_Init(void) + struct ifnet *nnew; + char *stats, *ifstart = line; + ++ /* Ignore interfaces with no statistics. */ ++ if (strstr(line, "No statistics available.")) ++ continue; ++ + if (line[strlen(line) - 1] == '\n') + line[strlen(line) - 1] = '\0'; + +@@ -1594,7 +1598,7 @@ Interface_Scan_Init(void) + &coll) != 5)) { + if ((scan_line_to_use == scan_line_2_2) + && !strstr(line, "No statistics available")) +- snmp_log(LOG_ERR, ++ snmp_log(LOG_DEBUG, + "/proc/net/dev data format error, line ==|%s|", + line); + continue; diff --git a/net/net-snmp/patches/110-debian-makefiles.patch b/net/net-snmp/patches/110-debian-makefiles.patch new file mode 100644 index 0000000..5ce771c --- /dev/null +++ b/net/net-snmp/patches/110-debian-makefiles.patch @@ -0,0 +1,40 @@ +--- a/local/Makefile.in ++++ b/local/Makefile.in +@@ -100,7 +100,7 @@ tkmib.made: $(srcdir)/tkmib + + mib2c.made: $(srcdir)/mib2c + if test "x$(PERL)" != "x" ; then \ +- $(PERL) -p -e 's%^#!.*/perl.*%#!$(PERL)%;s#/usr/local/share/snmp#$(snmplibdir)#;' ${srcdir}/mib2c > mib2c.made; \ ++ $(PERL) -p -e 's%^#!.*/perl.*%#!$(PERL)%;s#/usr/local/share/snmp#$(snmplibdir)#;s#/usr/local/etc/snmp#$(SNMPCONFPATH)#;' ${srcdir}/mib2c > mib2c.made; \ + else \ + touch mib2c.made; \ + fi +--- a/mibs/Makefile.in ++++ b/mibs/Makefile.in +@@ -48,11 +48,15 @@ NETSNMPMIBS = NET-SNMP-TC.txt NET-SNMP-M + UCDMIBS = UCD-SNMP-MIB.txt UCD-DEMO-MIB.txt UCD-IPFWACC-MIB.txt \ + UCD-DLMOD-MIB.txt UCD-DISKIO-MIB.txt + ++EXTRAMIBS = BGP4-MIB.txt BRIDGE-MIB.txt GNOME-SMI.txt OSPF-MIB.txt \ ++ OSPF-TRAP-MIB.txt RIPv2-MIB.txt SOURCE-ROUTING-MIB.txt \ ++ LM-SENSORS-MIB.txt ++ + DEFAULTMIBS = @default_mibs_install@ + + MIBS = $(V1MIBS) $(V2MIBS) $(V3MIBS) $(RFCMIBS) \ + $(AGENTMIBS) $(IANAMIBS) \ +- $(NETSNMPMIBS) $(UCDMIBS) $(DEFAULTMIBS) ++ $(NETSNMPMIBS) $(UCDMIBS) $(DEFAULTMIBS) $(EXTRAMIBS) + + all: standardall + +--- a/Makefile.top ++++ b/Makefile.top +@@ -26,6 +26,7 @@ man8dir = $(mandir)/man8 + snmplibdir = $(datadir)/snmp + mibdir = $(snmplibdir)/mibs + persistentdir = @PERSISTENT_DIRECTORY@ ++sysconfdir = @sysconfdir@ + DESTDIR = @INSTALL_PREFIX@ + INSTALL_PREFIX = $(DESTDIR) + diff --git a/net/net-snmp/patches/120-debian-searchdirs.patch b/net/net-snmp/patches/120-debian-searchdirs.patch new file mode 100644 index 0000000..d8c88f3 --- /dev/null +++ b/net/net-snmp/patches/120-debian-searchdirs.patch @@ -0,0 +1,14 @@ +--- a/local/mib2c ++++ b/local/mib2c +@@ -60,8 +60,9 @@ $currentlevel = -1; + if($ENV{MIB2C_DIR}) { + push @def_search_dirs, split(/:/, $ENV{MIB2C_DIR}); + } +-push @def_search_dirs, "/usr/local/share/snmp/"; +-push @def_search_dirs, "/usr/local/share/snmp/mib2c-data"; ++push @def_search_dirs, "/etc/snmp/"; ++push @def_search_dirs, "/usr/share/snmp/"; ++push @def_search_dirs, "/usr/share/snmp/mib2c-data"; + push @def_search_dirs, "./mib2c-conf.d"; + + sub usage { diff --git a/net/net-snmp/patches/130-debian-extramibs.patch b/net/net-snmp/patches/130-debian-extramibs.patch new file mode 100644 index 0000000..e741ee7 --- /dev/null +++ b/net/net-snmp/patches/130-debian-extramibs.patch @@ -0,0 +1,6261 @@ +--- /dev/null ++++ b/mibs/BGP4-MIB.txt +@@ -0,0 +1,929 @@ ++ BGP4-MIB DEFINITIONS ::= BEGIN ++ ++ IMPORTS ++ MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE, ++ IpAddress, Integer32, Counter32, Gauge32, mib-2 ++ FROM SNMPv2-SMI ++ MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP ++ FROM SNMPv2-CONF; ++ ++ bgp MODULE-IDENTITY ++ LAST-UPDATED "9902100000Z" ++ ORGANIZATION "IETF IDR Working Group" ++ CONTACT-INFO "E-mail: idr@merit.net ++ ++ Susan Hares (Editor) ++ Merit Network ++ 4251 Plymouth Road ++ Suite C ++ Ann Arbor, MI 48105-2785 ++ Tel: +1 734 936 2095 ++ Fax: +1 734 647 3185 ++ E-mail: skh@merit.edu ++ ++ Jeff Johnson (Editor) ++ RedBack Networks, Inc. ++ 1389 Moffett Park Drive ++ Sunnyvale, CA 94089-1134 ++ Tel: +1 408 548 3516 ++ Fax: +1 408 548 3599 ++ E-mail: jeff@redback.com" ++ DESCRIPTION ++ "The MIB module for BGP-4." ++ REVISION "9902100000Z" ++ DESCRIPTION ++ "Corrected duplicate OBJECT IDENTIFIER ++ assignment in the conformance information." ++ REVISION "9601080000Z" ++ DESCRIPTION ++ "1) Fixed the definitions of the traps to ++ make them equivalent to their initial ++ definition in RFC 1269. ++ 2) Added compliance and conformance info." ++ ::= { mib-2 15 } ++ ++ bgpVersion OBJECT-TYPE ++ SYNTAX OCTET STRING (SIZE (1..255)) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "Vector of supported BGP protocol version ++ numbers. Each peer negotiates the version ++ from this vector. Versions are identified ++ via the string of bits contained within this ++ object. The first octet contains bits 0 to ++ 7, the second octet contains bits 8 to 15, ++ and so on, with the most significant bit ++ referring to the lowest bit number in the ++ octet (e.g., the MSB of the first octet ++ refers to bit 0). If a bit, i, is present ++ and set, then the version (i+1) of the BGP ++ is supported." ++ ::= { bgp 1 } ++ ++ bgpLocalAs OBJECT-TYPE ++ SYNTAX INTEGER (0..65535) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The local autonomous system number." ++ ::= { bgp 2 } ++ ++ ++ ++ -- BGP Peer table. This table contains, one entry per BGP ++ -- peer, information about the BGP peer. ++ ++ bgpPeerTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF BgpPeerEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "BGP peer table. This table contains, ++ one entry per BGP peer, information about the ++ connections with BGP peers." ++ ::= { bgp 3 } ++ ++ bgpPeerEntry OBJECT-TYPE ++ SYNTAX BgpPeerEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "Entry containing information about the ++ connection with a BGP peer." ++ INDEX { bgpPeerRemoteAddr } ++ ::= { bgpPeerTable 1 } ++ ++ BgpPeerEntry ::= SEQUENCE { ++ bgpPeerIdentifier ++ IpAddress, ++ bgpPeerState ++ INTEGER, ++ bgpPeerAdminStatus ++ INTEGER, ++ bgpPeerNegotiatedVersion ++ Integer32, ++ bgpPeerLocalAddr ++ IpAddress, ++ bgpPeerLocalPort ++ INTEGER, ++ bgpPeerRemoteAddr ++ IpAddress, ++ bgpPeerRemotePort ++ INTEGER, ++ bgpPeerRemoteAs ++ INTEGER, ++ bgpPeerInUpdates ++ Counter32, ++ bgpPeerOutUpdates ++ Counter32, ++ bgpPeerInTotalMessages ++ Counter32, ++ bgpPeerOutTotalMessages ++ Counter32, ++ bgpPeerLastError ++ OCTET STRING, ++ bgpPeerFsmEstablishedTransitions ++ Counter32, ++ bgpPeerFsmEstablishedTime ++ Gauge32, ++ bgpPeerConnectRetryInterval ++ INTEGER, ++ bgpPeerHoldTime ++ INTEGER, ++ bgpPeerKeepAlive ++ INTEGER, ++ bgpPeerHoldTimeConfigured ++ INTEGER, ++ bgpPeerKeepAliveConfigured ++ INTEGER, ++ bgpPeerMinASOriginationInterval ++ INTEGER, ++ bgpPeerMinRouteAdvertisementInterval ++ INTEGER, ++ bgpPeerInUpdateElapsedTime ++ Gauge32 ++ } ++ ++ bgpPeerIdentifier OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The BGP Identifier of this entry's BGP peer." ++ ::= { bgpPeerEntry 1 } ++ ++ bgpPeerState OBJECT-TYPE ++ SYNTAX INTEGER { ++ idle(1), ++ connect(2), ++ active(3), ++ opensent(4), ++ openconfirm(5), ++ established(6) ++ } ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The BGP peer connection state." ++ ::= { bgpPeerEntry 2 } ++ ++ bgpPeerAdminStatus OBJECT-TYPE ++ SYNTAX INTEGER { ++ stop(1), ++ start(2) ++ } ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "The desired state of the BGP connection. A ++ transition from 'stop' to 'start' will cause ++ the BGP Start Event to be generated. A ++ transition from 'start' to 'stop' will cause ++ the BGP Stop Event to be generated. This ++ parameter can be used to restart BGP peer ++ connections. Care should be used in providing ++ write access to this object without adequate ++ authentication." ++ ::= { bgpPeerEntry 3 } ++ ++ bgpPeerNegotiatedVersion OBJECT-TYPE ++ SYNTAX Integer32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The negotiated version of BGP running between ++ the two peers." ++ ::= { bgpPeerEntry 4 } ++ ++ bgpPeerLocalAddr OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The local IP address of this entry's BGP ++ connection." ++ ::= { bgpPeerEntry 5 } ++ ++ bgpPeerLocalPort OBJECT-TYPE ++ SYNTAX INTEGER (0..65535) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The local port for the TCP connection between ++ the BGP peers." ++ ::= { bgpPeerEntry 6 } ++ ++ bgpPeerRemoteAddr OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The remote IP address of this entry's BGP ++ peer." ++ ::= { bgpPeerEntry 7 } ++ ++ bgpPeerRemotePort OBJECT-TYPE ++ SYNTAX INTEGER (0..65535) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The remote port for the TCP connection between ++ the BGP peers. Note that the objects ++ bgpPeerLocalAddr, bgpPeerLocalPort, ++ bgpPeerRemoteAddr and bgpPeerRemotePort ++ provide the appropriate reference to the ++ standard MIB TCP connection table." ++ ::= { bgpPeerEntry 8 } ++ ++ bgpPeerRemoteAs OBJECT-TYPE ++ SYNTAX INTEGER (0..65535) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The remote autonomous system number." ++ ::= { bgpPeerEntry 9 } ++ ++ bgpPeerInUpdates OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of BGP UPDATE messages received on ++ this connection. This object should be ++ initialized to zero (0) when the connection is ++ established." ++ ::= { bgpPeerEntry 10 } ++ ++ bgpPeerOutUpdates OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of BGP UPDATE messages transmitted ++ on this connection. This object should be ++ initialized to zero (0) when the connection is ++ established." ++ ::= { bgpPeerEntry 11 } ++ ++ bgpPeerInTotalMessages OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The total number of messages received from the ++ remote peer on this connection. This object ++ should be initialized to zero when the ++ connection is established." ++ ::= { bgpPeerEntry 12 } ++ ++ bgpPeerOutTotalMessages OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The total number of messages transmitted to ++ the remote peer on this connection. This object ++ should be initialized to zero when the ++ connection is established." ++ ::= { bgpPeerEntry 13 } ++ ++ bgpPeerLastError OBJECT-TYPE ++ SYNTAX OCTET STRING (SIZE (2)) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The last error code and subcode seen by this ++ peer on this connection. If no error has ++ occurred, this field is zero. Otherwise, the ++ first byte of this two byte OCTET STRING ++ contains the error code, and the second byte ++ contains the subcode." ++ ::= { bgpPeerEntry 14 } ++ ++ bgpPeerFsmEstablishedTransitions OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The total number of times the BGP FSM ++ transitioned into the established state." ++ ::= { bgpPeerEntry 15 } ++ ++ bgpPeerFsmEstablishedTime OBJECT-TYPE ++ SYNTAX Gauge32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "This timer indicates how long (in seconds) this ++ peer has been in the Established state or how long ++ since this peer was last in the Established state. ++ It is set to zero when a new peer is configured or ++ the router is booted." ++ ::= { bgpPeerEntry 16 } ++ ++ bgpPeerConnectRetryInterval OBJECT-TYPE ++ SYNTAX INTEGER (1..65535) ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "Time interval in seconds for the ConnectRetry ++ timer. The suggested value for this timer is ++ 120 seconds." ++ ::= { bgpPeerEntry 17 } ++ ++ bgpPeerHoldTime OBJECT-TYPE ++ SYNTAX INTEGER ( 0 | 3..65535 ) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "Time interval in seconds for the Hold Timer ++ established with the peer. The value of this ++ object is calculated by this BGP speaker by ++ using the smaller of the value in ++ bgpPeerHoldTimeConfigured and the Hold Time ++ received in the OPEN message. This value ++ must be at lease three seconds if it is not ++ zero (0) in which case the Hold Timer has ++ not been established with the peer, or, the ++ value of bgpPeerHoldTimeConfigured is zero (0)." ++ ::= { bgpPeerEntry 18 } ++ ++ bgpPeerKeepAlive OBJECT-TYPE ++ SYNTAX INTEGER ( 0 | 1..21845 ) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "Time interval in seconds for the KeepAlive ++ timer established with the peer. The value of ++ this object is calculated by this BGP speaker ++ such that, when compared with bgpPeerHoldTime, ++ it has the same proportion as what ++ bgpPeerKeepAliveConfigured has when compared ++ with bgpPeerHoldTimeConfigured. If the value ++ of this object is zero (0), it indicates that ++ the KeepAlive timer has not been established ++ with the peer, or, the value of ++ bgpPeerKeepAliveConfigured is zero (0)." ++ ::= { bgpPeerEntry 19 } ++ ++ bgpPeerHoldTimeConfigured OBJECT-TYPE ++ SYNTAX INTEGER ( 0 | 3..65535 ) ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "Time interval in seconds for the Hold Time ++ configured for this BGP speaker with this peer. ++ This value is placed in an OPEN message sent to ++ this peer by this BGP speaker, and is compared ++ with the Hold Time field in an OPEN message ++ received from the peer when determining the Hold ++ Time (bgpPeerHoldTime) with the peer. This value ++ must not be less than three seconds if it is not ++ zero (0) in which case the Hold Time is NOT to be ++ established with the peer. The suggested value for ++ this timer is 90 seconds." ++ ::= { bgpPeerEntry 20 } ++ ++ bgpPeerKeepAliveConfigured OBJECT-TYPE ++ SYNTAX INTEGER ( 0 | 1..21845 ) ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "Time interval in seconds for the KeepAlive timer ++ configured for this BGP speaker with this peer. ++ The value of this object will only determine the ++ KEEPALIVE messages' frequency relative to the value ++ specified in bgpPeerHoldTimeConfigured; the actual ++ time interval for the KEEPALIVE messages is ++ indicated by bgpPeerKeepAlive. A reasonable ++ maximum value for this timer would be configured to ++ be one third of that of bgpPeerHoldTimeConfigured. ++ If the value of this object is zero (0), no ++ periodical KEEPALIVE messages are sent to the peer ++ after the BGP connection has been established. The ++ suggested value for this timer is 30 seconds." ++ ::= { bgpPeerEntry 21 } ++ ++ bgpPeerMinASOriginationInterval OBJECT-TYPE ++ SYNTAX INTEGER (1..65535) ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "Time interval in seconds for the ++ MinASOriginationInterval timer. ++ The suggested value for this timer is 15 seconds." ++ ::= { bgpPeerEntry 22 } ++ ++ bgpPeerMinRouteAdvertisementInterval OBJECT-TYPE ++ SYNTAX INTEGER (1..65535) ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "Time interval in seconds for the ++ MinRouteAdvertisementInterval timer. ++ The suggested value for this timer is 30 seconds." ++ ::= { bgpPeerEntry 23 } ++ ++ bgpPeerInUpdateElapsedTime OBJECT-TYPE ++ SYNTAX Gauge32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "Elapsed time in seconds since the last BGP ++ UPDATE message was received from the peer. ++ Each time bgpPeerInUpdates is incremented, ++ the value of this object is set to zero (0)." ++ ::= { bgpPeerEntry 24 } ++ ++ ++ ++ bgpIdentifier OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The BGP Identifier of local system." ++ ::= { bgp 4 } ++ ++ ++ ++ -- Received Path Attribute Table. This table contains, ++ -- one entry per path to a network, path attributes ++ -- received from all peers running BGP version 3 or less. ++ -- This table is obsolete, having been replaced in ++ -- functionality with the bgp4PathAttrTable. ++ ++ bgpRcvdPathAttrTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF BgpPathAttrEntry ++ MAX-ACCESS not-accessible ++ STATUS obsolete ++ DESCRIPTION ++ "The BGP Received Path Attribute Table contains ++ information about paths to destination networks ++ received from all peers running BGP version 3 or ++ less." ++ ::= { bgp 5 } ++ ++ bgpPathAttrEntry OBJECT-TYPE ++ SYNTAX BgpPathAttrEntry ++ MAX-ACCESS not-accessible ++ STATUS obsolete ++ DESCRIPTION ++ "Information about a path to a network." ++ INDEX { bgpPathAttrDestNetwork, ++ bgpPathAttrPeer } ++ ::= { bgpRcvdPathAttrTable 1 } ++ ++ BgpPathAttrEntry ::= SEQUENCE { ++ bgpPathAttrPeer ++ IpAddress, ++ bgpPathAttrDestNetwork ++ IpAddress, ++ bgpPathAttrOrigin ++ INTEGER, ++ bgpPathAttrASPath ++ OCTET STRING, ++ bgpPathAttrNextHop ++ IpAddress, ++ bgpPathAttrInterASMetric ++ Integer32 ++ } ++ ++ bgpPathAttrPeer OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS obsolete ++ DESCRIPTION ++ "The IP address of the peer where the path ++ information was learned." ++ ::= { bgpPathAttrEntry 1 } ++ ++ bgpPathAttrDestNetwork OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS obsolete ++ DESCRIPTION ++ "The address of the destination network." ++ ::= { bgpPathAttrEntry 2 } ++ ++ bgpPathAttrOrigin OBJECT-TYPE ++ SYNTAX INTEGER { ++ igp(1),-- networks are interior ++ egp(2),-- networks learned via EGP ++ incomplete(3) -- undetermined ++ } ++ MAX-ACCESS read-only ++ STATUS obsolete ++ DESCRIPTION ++ "The ultimate origin of the path information." ++ ::= { bgpPathAttrEntry 3 } ++ ++ bgpPathAttrASPath OBJECT-TYPE ++ SYNTAX OCTET STRING (SIZE (2..255)) ++ MAX-ACCESS read-only ++ STATUS obsolete ++ DESCRIPTION ++ "The set of ASs that must be traversed to reach ++ the network. This object is probably best ++ represented as SEQUENCE OF INTEGER. For SMI ++ compatibility, though, it is represented as ++ OCTET STRING. Each AS is represented as a pair ++ of octets according to the following algorithm: ++ ++ first-byte-of-pair = ASNumber / 256; ++ second-byte-of-pair = ASNumber & 255;" ++ ::= { bgpPathAttrEntry 4 } ++ ++ bgpPathAttrNextHop OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS obsolete ++ DESCRIPTION ++ "The address of the border router that should ++ be used for the destination network." ++ ::= { bgpPathAttrEntry 5 } ++ ++ bgpPathAttrInterASMetric OBJECT-TYPE ++ SYNTAX Integer32 ++ MAX-ACCESS read-only ++ STATUS obsolete ++ DESCRIPTION ++ "The optional inter-AS metric. If this ++ attribute has not been provided for this route, ++ the value for this object is 0." ++ ::= { bgpPathAttrEntry 6 } ++ ++ ++ ++ -- BGP-4 Received Path Attribute Table. This table contains, ++ -- one entry per path to a network, path attributes ++ -- received from all peers running BGP-4. ++ ++ bgp4PathAttrTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF Bgp4PathAttrEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "The BGP-4 Received Path Attribute Table contains ++ information about paths to destination networks ++ received from all BGP4 peers." ++ ::= { bgp 6 } ++ ++ bgp4PathAttrEntry OBJECT-TYPE ++ SYNTAX Bgp4PathAttrEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "Information about a path to a network." ++ INDEX { bgp4PathAttrIpAddrPrefix, ++ bgp4PathAttrIpAddrPrefixLen, ++ bgp4PathAttrPeer } ++ ::= { bgp4PathAttrTable 1 } ++ ++ Bgp4PathAttrEntry ::= SEQUENCE { ++ bgp4PathAttrPeer ++ IpAddress, ++ bgp4PathAttrIpAddrPrefixLen ++ INTEGER, ++ bgp4PathAttrIpAddrPrefix ++ IpAddress, ++ bgp4PathAttrOrigin ++ INTEGER, ++ bgp4PathAttrASPathSegment ++ OCTET STRING, ++ bgp4PathAttrNextHop ++ IpAddress, ++ bgp4PathAttrMultiExitDisc ++ INTEGER, ++ bgp4PathAttrLocalPref ++ INTEGER, ++ bgp4PathAttrAtomicAggregate ++ INTEGER, ++ bgp4PathAttrAggregatorAS ++ INTEGER, ++ bgp4PathAttrAggregatorAddr ++ IpAddress, ++ bgp4PathAttrCalcLocalPref ++ INTEGER, ++ bgp4PathAttrBest ++ INTEGER, ++ bgp4PathAttrUnknown ++ OCTET STRING ++ } ++ ++ bgp4PathAttrPeer OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The IP address of the peer where the path ++ information was learned." ++ ::= { bgp4PathAttrEntry 1 } ++ bgp4PathAttrIpAddrPrefixLen OBJECT-TYPE ++ SYNTAX INTEGER (0..32) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "Length in bits of the IP address prefix in the ++ Network Layer Reachability Information field." ++ ::= { bgp4PathAttrEntry 2 } ++ ++ bgp4PathAttrIpAddrPrefix OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "An IP address prefix in the Network Layer ++ Reachability Information field. This object ++ is an IP address containing the prefix with ++ length specified by bgp4PathAttrIpAddrPrefixLen. ++ Any bits beyond the length specified by ++ bgp4PathAttrIpAddrPrefixLen are zeroed." ++ ::= { bgp4PathAttrEntry 3 } ++ ++ bgp4PathAttrOrigin OBJECT-TYPE ++ SYNTAX INTEGER { ++ igp(1),-- networks are interior ++ egp(2),-- networks learned via EGP ++ incomplete(3) -- undetermined ++ } ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The ultimate origin of the path information." ++ ::= { bgp4PathAttrEntry 4 } ++ ++ bgp4PathAttrASPathSegment OBJECT-TYPE ++ SYNTAX OCTET STRING (SIZE (2..255)) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The sequence of AS path segments. Each AS ++ path segment is represented by a triple ++ . ++ ++ The type is a 1-octet field which has two ++ possible values: ++ 1 AS_SET: unordered set of ASs a ++ route in the UPDATE message ++ has traversed ++ 2 AS_SEQUENCE: ordered set of ASs ++ a route in the UPDATE message ++ has traversed. ++ ++ The length is a 1-octet field containing the ++ number of ASs in the value field. ++ ++ The value field contains one or more AS ++ numbers, each AS is represented in the octet ++ string as a pair of octets according to the ++ following algorithm: ++ ++ first-byte-of-pair = ASNumber / 256; ++ second-byte-of-pair = ASNumber & 255;" ++ ::= { bgp4PathAttrEntry 5 } ++ ++ bgp4PathAttrNextHop OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The address of the border router that should ++ be used for the destination network." ++ ::= { bgp4PathAttrEntry 6 } ++ ++ bgp4PathAttrMultiExitDisc OBJECT-TYPE ++ SYNTAX INTEGER (-1..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "This metric is used to discriminate between ++ multiple exit points to an adjacent autonomous ++ system. A value of -1 indicates the absence of ++ this attribute." ++ ::= { bgp4PathAttrEntry 7 } ++ ++ bgp4PathAttrLocalPref OBJECT-TYPE ++ SYNTAX INTEGER (-1..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The originating BGP4 speaker's degree of ++ preference for an advertised route. A value of ++ -1 indicates the absence of this attribute." ++ ::= { bgp4PathAttrEntry 8 } ++ ++ bgp4PathAttrAtomicAggregate OBJECT-TYPE ++ SYNTAX INTEGER { ++ lessSpecificRrouteNotSelected(1), ++ lessSpecificRouteSelected(2) ++ } ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "Whether or not a system has selected ++ a less specific route without selecting a ++ more specific route." ++ ::= { bgp4PathAttrEntry 9 } ++ ++ bgp4PathAttrAggregatorAS OBJECT-TYPE ++ SYNTAX INTEGER (0..65535) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The AS number of the last BGP4 speaker that ++ performed route aggregation. A value of zero (0) ++ indicates the absence of this attribute." ++ ::= { bgp4PathAttrEntry 10 } ++ ++ bgp4PathAttrAggregatorAddr OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The IP address of the last BGP4 speaker that ++ performed route aggregation. A value of ++ 0.0.0.0 indicates the absence of this attribute." ++ ::= { bgp4PathAttrEntry 11 } ++ ++ bgp4PathAttrCalcLocalPref OBJECT-TYPE ++ SYNTAX INTEGER (-1..2147483647) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The degree of preference calculated by the ++ receiving BGP4 speaker for an advertised route. ++ A value of -1 indicates the absence of this ++ attribute." ++ ::= { bgp4PathAttrEntry 12 } ++ ++ bgp4PathAttrBest OBJECT-TYPE ++ SYNTAX INTEGER { ++ false(1),-- not chosen as best route ++ true(2) -- chosen as best route ++ } ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "An indication of whether or not this route ++ was chosen as the best BGP4 route." ++ ::= { bgp4PathAttrEntry 13 } ++ ++ bgp4PathAttrUnknown OBJECT-TYPE ++ SYNTAX OCTET STRING (SIZE(0..255)) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "One or more path attributes not understood ++ by this BGP4 speaker. Size zero (0) indicates ++ the absence of such attribute(s). Octets ++ beyond the maximum size, if any, are not ++ recorded by this object." ++ ::= { bgp4PathAttrEntry 14 } ++ ++ ++ -- Traps. ++ ++ -- note that in RFC 1657, bgpTraps was incorrectly ++ -- assigned a value of { bgp 7 }, and each of the ++ -- traps had the bgpPeerRemoteAddr object inappropriately ++ -- removed from their OBJECTS clause. The following ++ -- definitions restore the semantics of the traps as ++ -- they were initially defined in RFC 1269. ++ ++ -- { bgp 7 } is unused ++ ++ bgpTraps OBJECT IDENTIFIER ::= { bgp 0 } ++ ++ bgpEstablished NOTIFICATION-TYPE ++ OBJECTS { bgpPeerRemoteAddr, ++ bgpPeerLastError, ++ bgpPeerState } ++ STATUS current ++ DESCRIPTION ++ "The BGP Established event is generated when ++ the BGP FSM enters the ESTABLISHED state." ++ ::= { bgpTraps 1 } ++ ++ bgpBackwardTransition NOTIFICATION-TYPE ++ OBJECTS { bgpPeerRemoteAddr, ++ bgpPeerLastError, ++ bgpPeerState } ++ STATUS current ++ DESCRIPTION ++ "The BGPBackwardTransition Event is generated ++ when the BGP FSM moves from a higher numbered ++ state to a lower numbered state." ++ ::= { bgpTraps 2 } ++ ++ -- conformance information ++ ++ bgpMIBConformance OBJECT IDENTIFIER ::= { bgp 8 } ++ bgpMIBCompliances OBJECT IDENTIFIER ::= { bgpMIBConformance 1 } ++ bgpMIBGroups OBJECT IDENTIFIER ::= { bgpMIBConformance 2 } ++ ++ -- compliance statements ++ ++ bgpMIBCompliance MODULE-COMPLIANCE ++ STATUS current ++ DESCRIPTION ++ "The compliance statement for entities which ++ implement the BGP4 mib." ++ MODULE -- this module ++ MANDATORY-GROUPS { bgp4MIBGlobalsGroup, ++ bgp4MIBPeerGroup, ++ bgp4MIBPathAttrGroup, ++ bgp4MIBNotificationGroup } ++ ::= { bgpMIBCompliances 1 } ++ ++ -- units of conformance ++ ++ bgp4MIBGlobalsGroup OBJECT-GROUP ++ OBJECTS { bgpVersion, ++ bgpLocalAs, ++ bgpIdentifier } ++ STATUS current ++ DESCRIPTION ++ "A collection of objects providing information ++ on global BGP state." ++ ::= { bgpMIBGroups 1 } ++ ++ bgp4MIBPeerGroup OBJECT-GROUP ++ OBJECTS { bgpPeerIdentifier, ++ bgpPeerState, ++ bgpPeerAdminStatus, ++ bgpPeerNegotiatedVersion, ++ bgpPeerLocalAddr, ++ bgpPeerLocalPort, ++ bgpPeerRemoteAddr, ++ bgpPeerRemotePort, ++ bgpPeerRemoteAs, ++ bgpPeerInUpdates, ++ bgpPeerOutUpdates, ++ bgpPeerInTotalMessages, ++ bgpPeerOutTotalMessages, ++ bgpPeerLastError, ++ bgpPeerFsmEstablishedTransitions, ++ bgpPeerFsmEstablishedTime, ++ bgpPeerConnectRetryInterval, ++ bgpPeerHoldTime, ++ bgpPeerKeepAlive, ++ bgpPeerHoldTimeConfigured, ++ bgpPeerKeepAliveConfigured, ++ bgpPeerMinASOriginationInterval, ++ bgpPeerMinRouteAdvertisementInterval, ++ bgpPeerInUpdateElapsedTime } ++ STATUS current ++ DESCRIPTION ++ "A collection of objects for managing ++ BGP peers." ++ ::= { bgpMIBGroups 2 } ++ ++ bgp4MIBRcvdPathAttrGroup OBJECT-GROUP ++ OBJECTS { bgpPathAttrPeer, ++ bgpPathAttrDestNetwork, ++ bgpPathAttrOrigin, ++ bgpPathAttrASPath, ++ bgpPathAttrNextHop, ++ bgpPathAttrInterASMetric } ++ STATUS obsolete ++ DESCRIPTION ++ "A collection of objects for managing BGP ++ path entries. ++ ++ This conformance group is obsolete, ++ replaced by bgp4MIBPathAttrGroup." ++ ::= { bgpMIBGroups 3 } ++ ++ bgp4MIBPathAttrGroup OBJECT-GROUP ++ OBJECTS { bgp4PathAttrPeer, ++ bgp4PathAttrIpAddrPrefixLen, ++ bgp4PathAttrIpAddrPrefix, ++ bgp4PathAttrOrigin, ++ bgp4PathAttrASPathSegment, ++ bgp4PathAttrNextHop, ++ bgp4PathAttrMultiExitDisc, ++ bgp4PathAttrLocalPref, ++ bgp4PathAttrAtomicAggregate, ++ bgp4PathAttrAggregatorAS, ++ bgp4PathAttrAggregatorAddr, ++ bgp4PathAttrCalcLocalPref, ++ bgp4PathAttrBest, ++ bgp4PathAttrUnknown } ++ STATUS current ++ DESCRIPTION ++ "A collection of objects for managing ++ BGP path entries." ++ ::= { bgpMIBGroups 4 } ++ ++ bgp4MIBNotificationGroup NOTIFICATION-GROUP ++ NOTIFICATIONS { bgpEstablished, ++ bgpBackwardTransition } ++ STATUS current ++ DESCRIPTION ++ "A collection of notifications for signaling ++ changes in BGP peer relationships." ++ ::= { bgpMIBGroups 5 } ++ ++ END +--- /dev/null ++++ b/mibs/BRIDGE-MIB.txt +@@ -0,0 +1,1075 @@ ++BRIDGE-MIB DEFINITIONS ::= BEGIN ++ ++IMPORTS ++ Counter, TimeTicks ++ FROM RFC1155-SMI ++ mib-2 ++ FROM RFC1213-MIB ++ OBJECT-TYPE ++ FROM RFC-1212 ++ TRAP-TYPE ++ FROM RFC-1215; ++ ++-- All representations of MAC addresses in this MIB Module ++-- use, as a textual convention (i.e. this convention does ++-- not affect their encoding), the data type: ++MacAddress ::= OCTET STRING (SIZE (6)) -- a 6 octet address ++ -- in the ++ -- "canonical" ++ -- order ++-- defined by IEEE 802.1a, i.e., as if it were transmitted ++-- least significant bit first, even though 802.5 (in ++-- contrast to other n802.x protocols) requires MAC ++-- addresses to be transmitted most significant bit first. ++-- ++-- 16-bit addresses, if needed, are represented by setting ++-- their upper 4 octets to all 0's, i.e., AAFF would be ++-- represented as 00000000AAFF. ++ ++-- Similarly, all representations of Bridge-Id in this MIB ++-- Module use, as a textual convention (i.e. this ++-- convention does not affect their encoding), the data ++-- type: ++BridgeId ::= OCTET STRING (SIZE (8)) -- the ++ -- Bridge-Identifier ++ -- as used in the ++ -- Spanning Tree ++-- Protocol to uniquely identify a bridge. Its first two ++-- octets (in network byte order) contain a priority ++-- value and its last 6 octets contain the MAC address ++-- used to refer to a bridge in a unique fashion ++-- (typically, the numerically smallest MAC address ++-- of all ports on the bridge). ++ ++-- Several objects in this MIB module represent values of ++-- timers used by the Spanning Tree Protocol. In this ++-- MIB, these timers have values in units of hundreths of ++-- a second (i.e. 1/100 secs). ++-- These timers, when stored in a Spanning Tree Protocol's ++-- BPDU, are in units of 1/256 seconds. Note, however, ++-- that 802.1D-1990 specifies a settable granularity of ++-- no more than 1 second for these timers. To avoid ++-- ambiguity, a data type is defined here as a textual ++-- convention and all representation of these timers ++-- in this MIB module are defined using this data type. An ++-- algorithm is also defined for converting between the ++-- different units, to ensure a timer's value is not ++-- distorted by multiple conversions. ++-- The data type is: ++ ++Timeout ::= INTEGER -- a STP timer in units of 1/100 seconds ++ ++-- To convert a Timeout value into a value in units of ++-- 1/256 seconds, the following algorithm should be used: ++-- ++-- b = floor( (n * 256) / 100) ++-- ++-- where: ++-- floor = quotient [ignore remainder] ++-- n is the value in 1/100 second units ++-- b is the value in 1/256 second units ++-- ++-- To convert the value from 1/256 second units back to ++-- 1/100 seconds, the following algorithm should be used: ++-- ++-- n = ceiling( (b * 100) / 256) ++-- ++-- where: ++-- ceiling = quotient [if remainder is 0], or ++-- quotient + 1 [if remainder is non-zero] ++-- n is the value in 1/100 second units ++-- b is the value in 1/256 second units ++-- ++-- Note: it is important that the arithmetic operations are ++-- done in the order specified (i.e., multiply first, divide ++-- second). ++ ++ dot1dBridge OBJECT IDENTIFIER ::= { mib-2 17 } ++ ++-- groups in the Bridge MIB ++ ++dot1dBase OBJECT IDENTIFIER ::= { dot1dBridge 1 } ++ ++dot1dStp OBJECT IDENTIFIER ::= { dot1dBridge 2 } ++ ++dot1dSr OBJECT IDENTIFIER ::= { dot1dBridge 3 } ++-- separately documented ++ ++dot1dTp OBJECT IDENTIFIER ::= { dot1dBridge 4 } ++ ++dot1dStatic OBJECT IDENTIFIER ::= { dot1dBridge 5 } ++ ++-- the dot1dBase group ++ ++-- Implementation of the dot1dBase group is mandatory for all ++-- bridges. ++ ++dot1dBaseBridgeAddress OBJECT-TYPE ++ SYNTAX MacAddress ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The MAC address used by this bridge when it must ++ be referred to in a unique fashion. It is ++ recommended that this be the numerically smallest ++ MAC address of all ports that belong to this ++ bridge. However it is only required to be unique. ++ When concatenated with dot1dStpPriority a unique ++ BridgeIdentifier is formed which is used in the ++ Spanning Tree Protocol." ++ REFERENCE ++ "IEEE 802.1D-1990: Sections 6.4.1.1.3 and 3.12.5" ++ ::= { dot1dBase 1 } ++ ++dot1dBaseNumPorts OBJECT-TYPE ++ SYNTAX INTEGER ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The number of ports controlled by this bridging ++ entity." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 6.4.1.1.3" ++ ::= { dot1dBase 2 } ++ ++dot1dBaseType OBJECT-TYPE ++ SYNTAX INTEGER { ++ unknown(1), ++ transparent-only(2), ++ sourceroute-only(3), ++ srt(4) ++ } ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "Indicates what type of bridging this bridge can ++ perform. If a bridge is actually performing a ++ certain type of bridging this will be indicated by ++ entries in the port table for the given type." ++ ::= { dot1dBase 3 } ++ ++-- The Generic Bridge Port Table ++ ++dot1dBasePortTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF Dot1dBasePortEntry ++ ACCESS not-accessible ++ STATUS mandatory ++ DESCRIPTION ++ "A table that contains generic information about ++ every port that is associated with this bridge. ++ Transparent, source-route, and srt ports are ++ included." ++ ::= { dot1dBase 4 } ++ ++dot1dBasePortEntry OBJECT-TYPE ++ SYNTAX Dot1dBasePortEntry ++ ACCESS not-accessible ++ STATUS mandatory ++ DESCRIPTION ++ "A list of information for each port of the ++ bridge." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 6.4.2, 6.6.1" ++ INDEX { dot1dBasePort } ++ ::= { dot1dBasePortTable 1 } ++ ++Dot1dBasePortEntry ::= ++ SEQUENCE { ++ dot1dBasePort ++ INTEGER, ++ dot1dBasePortIfIndex ++ INTEGER, ++ dot1dBasePortCircuit ++ ++ OBJECT IDENTIFIER, ++ dot1dBasePortDelayExceededDiscards ++ Counter, ++ dot1dBasePortMtuExceededDiscards ++ Counter ++ } ++ ++dot1dBasePort OBJECT-TYPE ++ SYNTAX INTEGER (1..65535) ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The port number of the port for which this entry ++ contains bridge management information." ++ ::= { dot1dBasePortEntry 1 } ++ ++dot1dBasePortIfIndex OBJECT-TYPE ++ SYNTAX INTEGER ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The value of the instance of the ifIndex object, ++ defined in MIB-II, for the interface corresponding ++ to this port." ++ ::= { dot1dBasePortEntry 2 } ++ ++dot1dBasePortCircuit OBJECT-TYPE ++ SYNTAX OBJECT IDENTIFIER ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "For a port which (potentially) has the same value ++ of dot1dBasePortIfIndex as another port on the ++ same bridge, this object contains the name of an ++ object instance unique to this port. For example, ++ in the case where multiple ports correspond one- ++ to-one with multiple X.25 virtual circuits, this ++ value might identify an (e.g., the first) object ++ instance associated with the X.25 virtual circuit ++ corresponding to this port. ++ ++ For a port which has a unique value of ++ dot1dBasePortIfIndex, this object can have the ++ value { 0 0 }." ++ ::= { dot1dBasePortEntry 3 } ++ ++dot1dBasePortDelayExceededDiscards OBJECT-TYPE ++ SYNTAX Counter ++ ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The number of frames discarded by this port due ++ to excessive transit delay through the bridge. It ++ is incremented by both transparent and source ++ route bridges." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 6.6.1.1.3" ++ ::= { dot1dBasePortEntry 4 } ++ ++dot1dBasePortMtuExceededDiscards OBJECT-TYPE ++ SYNTAX Counter ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The number of frames discarded by this port due ++ to an excessive size. It is incremented by both ++ transparent and source route bridges." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 6.6.1.1.3" ++ ::= { dot1dBasePortEntry 5 } ++ ++-- the dot1dStp group ++ ++-- Implementation of the dot1dStp group is optional. It is ++-- implemented by those bridges that support the Spanning Tree ++-- Protocol. ++ ++dot1dStpProtocolSpecification OBJECT-TYPE ++ SYNTAX INTEGER { ++ unknown(1), ++ decLb100(2), ++ ieee8021d(3) ++ } ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "An indication of what version of the Spanning ++ Tree Protocol is being run. The value ++ 'decLb100(2)' indicates the DEC LANbridge 100 ++ Spanning Tree protocol. IEEE 802.1d ++ implementations will return 'ieee8021d(3)'. If ++ future versions of the IEEE Spanning Tree Protocol ++ are released that are incompatible with the ++ current version a new value will be defined." ++ ++ ::= { dot1dStp 1 } ++ ++dot1dStpPriority OBJECT-TYPE ++ SYNTAX INTEGER (0..65535) ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "The value of the write-able portion of the Bridge ++ ID, i.e., the first two octets of the (8 octet ++ long) Bridge ID. The other (last) 6 octets of the ++ Bridge ID are given by the value of ++ dot1dBaseBridgeAddress." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.3.7" ++ ::= { dot1dStp 2 } ++ ++dot1dStpTimeSinceTopologyChange OBJECT-TYPE ++ SYNTAX TimeTicks ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The time (in hundredths of a second) since the ++ last time a topology change was detected by the ++ bridge entity." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 6.8.1.1.3" ++ ::= { dot1dStp 3 } ++ ++dot1dStpTopChanges OBJECT-TYPE ++ SYNTAX Counter ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The total number of topology changes detected by ++ this bridge since the management entity was last ++ reset or initialized." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 6.8.1.1.3" ++ ::= { dot1dStp 4 } ++ ++dot1dStpDesignatedRoot OBJECT-TYPE ++ SYNTAX BridgeId ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The bridge identifier of the root of the spanning ++ tree as determined by the Spanning Tree Protocol ++ as executed by this node. This value is used as ++ ++ the Root Identifier parameter in all Configuration ++ Bridge PDUs originated by this node." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.3.1" ++ ::= { dot1dStp 5 } ++ ++dot1dStpRootCost OBJECT-TYPE ++ SYNTAX INTEGER ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The cost of the path to the root as seen from ++ this bridge." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.3.2" ++ ::= { dot1dStp 6 } ++ ++dot1dStpRootPort OBJECT-TYPE ++ SYNTAX INTEGER ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The port number of the port which offers the ++ lowest cost path from this bridge to the root ++ bridge." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.3.3" ++ ::= { dot1dStp 7 } ++ ++dot1dStpMaxAge OBJECT-TYPE ++ SYNTAX Timeout ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The maximum age of Spanning Tree Protocol ++ information learned from the network on any port ++ before it is discarded, in units of hundredths of ++ a second. This is the actual value that this ++ bridge is currently using." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.3.4" ++ ::= { dot1dStp 8 } ++ ++dot1dStpHelloTime OBJECT-TYPE ++ SYNTAX Timeout ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ ++ "The amount of time between the transmission of ++ Configuration bridge PDUs by this node on any port ++ when it is the root of the spanning tree or trying ++ to become so, in units of hundredths of a second. ++ This is the actual value that this bridge is ++ currently using." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.3.5" ++ ::= { dot1dStp 9 } ++ ++dot1dStpHoldTime OBJECT-TYPE ++ SYNTAX INTEGER ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "This time value determines the interval length ++ during which no more than two Configuration bridge ++ PDUs shall be transmitted by this node, in units ++ of hundredths of a second." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.3.14" ++ ::= { dot1dStp 10 } ++ ++dot1dStpForwardDelay OBJECT-TYPE ++ SYNTAX Timeout ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "This time value, measured in units of hundredths ++ of a second, controls how fast a port changes its ++ spanning state when moving towards the Forwarding ++ state. The value determines how long the port ++ stays in each of the Listening and Learning ++ states, which precede the Forwarding state. This ++ value is also used, when a topology change has ++ been detected and is underway, to age all dynamic ++ entries in the Forwarding Database. [Note that ++ this value is the one that this bridge is ++ currently using, in contrast to ++ dot1dStpBridgeForwardDelay which is the value that ++ this bridge and all others would start using ++ if/when this bridge were to become the root.]" ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.3.6" ++ ::= { dot1dStp 11 } ++ ++dot1dStpBridgeMaxAge OBJECT-TYPE ++ SYNTAX Timeout (600..4000) ++ ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "The value that all bridges use for MaxAge when ++ this bridge is acting as the root. Note that ++ 802.1D-1990 specifies that the range for this ++ parameter is related to the value of ++ dot1dStpBridgeHelloTime. The granularity of this ++ timer is specified by 802.1D-1990 to be 1 second. ++ An agent may return a badValue error if a set is ++ attempted to a value which is not a whole number ++ of seconds." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.3.8" ++ ::= { dot1dStp 12 } ++ ++dot1dStpBridgeHelloTime OBJECT-TYPE ++ SYNTAX Timeout (100..1000) ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "The value that all bridges use for HelloTime when ++ this bridge is acting as the root. The ++ granularity of this timer is specified by 802.1D- ++ 1990 to be 1 second. An agent may return a ++ badValue error if a set is attempted to a value ++ which is not a whole number of seconds." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.3.9" ++ ::= { dot1dStp 13 } ++ ++dot1dStpBridgeForwardDelay OBJECT-TYPE ++ SYNTAX Timeout (400..3000) ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "The value that all bridges use for ForwardDelay ++ when this bridge is acting as the root. Note that ++ 802.1D-1990 specifies that the range for this ++ parameter is related to the value of ++ dot1dStpBridgeMaxAge. The granularity of this ++ timer is specified by 802.1D-1990 to be 1 second. ++ An agent may return a badValue error if a set is ++ attempted to a value which is not a whole number ++ of seconds." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.3.10" ++ ::= { dot1dStp 14 } ++ ++-- The Spanning Tree Port Table ++ ++dot1dStpPortTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF Dot1dStpPortEntry ++ ACCESS not-accessible ++ STATUS mandatory ++ DESCRIPTION ++ "A table that contains port-specific information ++ for the Spanning Tree Protocol." ++ ::= { dot1dStp 15 } ++ ++dot1dStpPortEntry OBJECT-TYPE ++ SYNTAX Dot1dStpPortEntry ++ ACCESS not-accessible ++ STATUS mandatory ++ DESCRIPTION ++ "A list of information maintained by every port ++ about the Spanning Tree Protocol state for that ++ port." ++ INDEX { dot1dStpPort } ++ ::= { dot1dStpPortTable 1 } ++ ++Dot1dStpPortEntry ::= ++ SEQUENCE { ++ dot1dStpPort ++ INTEGER, ++ dot1dStpPortPriority ++ INTEGER, ++ dot1dStpPortState ++ INTEGER, ++ dot1dStpPortEnable ++ INTEGER, ++ dot1dStpPortPathCost ++ INTEGER, ++ dot1dStpPortDesignatedRoot ++ BridgeId, ++ dot1dStpPortDesignatedCost ++ INTEGER, ++ dot1dStpPortDesignatedBridge ++ BridgeId, ++ dot1dStpPortDesignatedPort ++ OCTET STRING, ++ dot1dStpPortForwardTransitions ++ Counter ++ } ++ ++dot1dStpPort OBJECT-TYPE ++ SYNTAX INTEGER (1..65535) ++ ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The port number of the port for which this entry ++ contains Spanning Tree Protocol management ++ information." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 6.8.2.1.2" ++ ::= { dot1dStpPortEntry 1 } ++ ++dot1dStpPortPriority OBJECT-TYPE ++ SYNTAX INTEGER (0..255) ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "The value of the priority field which is ++ contained in the first (in network byte order) ++ octet of the (2 octet long) Port ID. The other ++ octet of the Port ID is given by the value of ++ dot1dStpPort." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.5.1" ++ ::= { dot1dStpPortEntry 2 } ++ ++dot1dStpPortState OBJECT-TYPE ++ SYNTAX INTEGER { ++ disabled(1), ++ blocking(2), ++ listening(3), ++ learning(4), ++ forwarding(5), ++ broken(6) ++ } ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The port's current state as defined by ++ application of the Spanning Tree Protocol. This ++ state controls what action a port takes on ++ reception of a frame. If the bridge has detected ++ a port that is malfunctioning it will place that ++ port into the broken(6) state. For ports which ++ are disabled (see dot1dStpPortEnable), this object ++ will have a value of disabled(1)." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.5.2" ++ ::= { dot1dStpPortEntry 3 } ++ ++dot1dStpPortEnable OBJECT-TYPE ++ SYNTAX INTEGER { ++ enabled(1), ++ disabled(2) ++ } ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "The enabled/disabled status of the port." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.5.2" ++ ::= { dot1dStpPortEntry 4 } ++ ++dot1dStpPortPathCost OBJECT-TYPE ++ SYNTAX INTEGER (1..65535) ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "The contribution of this port to the path cost of ++ paths towards the spanning tree root which include ++ this port. 802.1D-1990 recommends that the ++ default value of this parameter be in inverse ++ proportion to the speed of the attached LAN." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.5.3" ++ ::= { dot1dStpPortEntry 5 } ++ ++dot1dStpPortDesignatedRoot OBJECT-TYPE ++ SYNTAX BridgeId ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The unique Bridge Identifier of the Bridge ++ recorded as the Root in the Configuration BPDUs ++ transmitted by the Designated Bridge for the ++ segment to which the port is attached." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.5.4" ++ ::= { dot1dStpPortEntry 6 } ++ ++dot1dStpPortDesignatedCost OBJECT-TYPE ++ SYNTAX INTEGER ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The path cost of the Designated Port of the ++ segment connected to this port. This value is ++ compared to the Root Path Cost field in received ++ ++ bridge PDUs." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.5.5" ++ ::= { dot1dStpPortEntry 7 } ++ ++dot1dStpPortDesignatedBridge OBJECT-TYPE ++ SYNTAX BridgeId ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The Bridge Identifier of the bridge which this ++ port considers to be the Designated Bridge for ++ this port's segment." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.5.6" ++ ::= { dot1dStpPortEntry 8 } ++ ++dot1dStpPortDesignatedPort OBJECT-TYPE ++ SYNTAX OCTET STRING (SIZE (2)) ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The Port Identifier of the port on the Designated ++ Bridge for this port's segment." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 4.5.5.7" ++ ::= { dot1dStpPortEntry 9 } ++ ++dot1dStpPortForwardTransitions OBJECT-TYPE ++ SYNTAX Counter ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The number of times this port has transitioned ++ from the Learning state to the Forwarding state." ++ ::= { dot1dStpPortEntry 10 } ++ ++-- the dot1dTp group ++ ++-- Implementation of the dot1dTp group is optional. It is ++-- implemented by those bridges that support the transparent ++-- bridging mode. A transparent or SRT bridge will implement ++-- this group. ++ ++dot1dTpLearnedEntryDiscards OBJECT-TYPE ++ SYNTAX Counter ++ ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The total number of Forwarding Database entries, ++ which have been or would have been learnt, but ++ have been discarded due to a lack of space to ++ store them in the Forwarding Database. If this ++ counter is increasing, it indicates that the ++ Forwarding Database is regularly becoming full (a ++ condition which has unpleasant performance effects ++ on the subnetwork). If this counter has a ++ significant value but is not presently increasing, ++ it indicates that the problem has been occurring ++ but is not persistent." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 6.7.1.1.3" ++ ::= { dot1dTp 1 } ++ ++dot1dTpAgingTime OBJECT-TYPE ++ SYNTAX INTEGER (10..1000000) ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "The timeout period in seconds for aging out ++ dynamically learned forwarding information. ++ 802.1D-1990 recommends a default of 300 seconds." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 6.7.1.1.3" ++ ::= { dot1dTp 2 } ++ ++-- The Forwarding Database for Transparent Bridges ++ ++dot1dTpFdbTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF Dot1dTpFdbEntry ++ ACCESS not-accessible ++ STATUS mandatory ++ DESCRIPTION ++ "A table that contains information about unicast ++ entries for which the bridge has forwarding and/or ++ filtering information. This information is used ++ by the transparent bridging function in ++ determining how to propagate a received frame." ++ ::= { dot1dTp 3 } ++ ++dot1dTpFdbEntry OBJECT-TYPE ++ SYNTAX Dot1dTpFdbEntry ++ ACCESS not-accessible ++ STATUS mandatory ++ DESCRIPTION ++ "Information about a specific unicast MAC address ++ for which the bridge has some forwarding and/or ++ filtering information." ++ INDEX { dot1dTpFdbAddress } ++ ::= { dot1dTpFdbTable 1 } ++ ++Dot1dTpFdbEntry ::= ++ SEQUENCE { ++ dot1dTpFdbAddress ++ MacAddress, ++ dot1dTpFdbPort ++ INTEGER, ++ dot1dTpFdbStatus ++ INTEGER ++ } ++ ++dot1dTpFdbAddress OBJECT-TYPE ++ SYNTAX MacAddress ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "A unicast MAC address for which the bridge has ++ forwarding and/or filtering information." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 3.9.1, 3.9.2" ++ ::= { dot1dTpFdbEntry 1 } ++ ++dot1dTpFdbPort OBJECT-TYPE ++ SYNTAX INTEGER ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "Either the value '0', or the port number of the ++ port on which a frame having a source address ++ equal to the value of the corresponding instance ++ of dot1dTpFdbAddress has been seen. A value of ++ '0' indicates that the port number has not been ++ learned but that the bridge does have some ++ forwarding/filtering information about this ++ address (e.g. in the dot1dStaticTable). ++ Implementors are encouraged to assign the port ++ value to this object whenever it is learned even ++ for addresses for which the corresponding value of ++ dot1dTpFdbStatus is not learned(3)." ++ ::= { dot1dTpFdbEntry 2 } ++ ++dot1dTpFdbStatus OBJECT-TYPE ++ SYNTAX INTEGER { ++ other(1), ++ invalid(2), ++ learned(3), ++ self(4), ++ mgmt(5) ++ } ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The status of this entry. The meanings of the ++ values are: ++ other(1) : none of the following. This would ++ include the case where some other ++ MIB object (not the corresponding ++ instance of dot1dTpFdbPort, nor an ++ entry in the dot1dStaticTable) is ++ being used to determine if and how ++ frames addressed to the value of ++ the corresponding instance of ++ dot1dTpFdbAddress are being ++ forwarded. ++ invalid(2) : this entry is not longer valid ++ (e.g., it was learned but has since ++ aged-out), but has not yet been ++ flushed from the table. ++ learned(3) : the value of the corresponding ++ instance of dot1dTpFdbPort was ++ learned, and is being used. ++ self(4) : the value of the corresponding ++ instance of dot1dTpFdbAddress ++ represents one of the bridge's ++ addresses. The corresponding ++ instance of dot1dTpFdbPort ++ indicates which of the bridge's ++ ports has this address. ++ mgmt(5) : the value of the corresponding ++ instance of dot1dTpFdbAddress is ++ also the value of an existing ++ instance of dot1dStaticAddress." ++ ::= { dot1dTpFdbEntry 3 } ++ ++-- Port Table for Transparent Bridges ++ ++dot1dTpPortTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF Dot1dTpPortEntry ++ ACCESS not-accessible ++ STATUS mandatory ++ DESCRIPTION ++ "A table that contains information about every ++ port that is associated with this transparent ++ bridge." ++ ::= { dot1dTp 4 } ++ ++dot1dTpPortEntry OBJECT-TYPE ++ SYNTAX Dot1dTpPortEntry ++ ACCESS not-accessible ++ STATUS mandatory ++ DESCRIPTION ++ "A list of information for each port of a ++ transparent bridge." ++ INDEX { dot1dTpPort } ++ ::= { dot1dTpPortTable 1 } ++ ++Dot1dTpPortEntry ::= ++ SEQUENCE { ++ dot1dTpPort ++ INTEGER, ++ dot1dTpPortMaxInfo ++ INTEGER, ++ dot1dTpPortInFrames ++ Counter, ++ dot1dTpPortOutFrames ++ Counter, ++ dot1dTpPortInDiscards ++ Counter ++ } ++ ++dot1dTpPort OBJECT-TYPE ++ SYNTAX INTEGER (1..65535) ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The port number of the port for which this entry ++ contains Transparent bridging management ++ information." ++ ::= { dot1dTpPortEntry 1 } ++ ++-- It would be nice if we could use ifMtu as the size of the ++-- largest INFO field, but we can't because ifMtu is defined ++-- to be the size that the (inter-)network layer can use which ++-- can differ from the MAC layer (especially if several layers ++-- of encapsulation are used). ++ ++dot1dTpPortMaxInfo OBJECT-TYPE ++ SYNTAX INTEGER ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The maximum size of the INFO (non-MAC) field that ++ this port will receive or transmit." ++ ::= { dot1dTpPortEntry 2 } ++ ++dot1dTpPortInFrames OBJECT-TYPE ++ SYNTAX Counter ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The number of frames that have been received by ++ this port from its segment. Note that a frame ++ received on the interface corresponding to this ++ port is only counted by this object if and only if ++ it is for a protocol being processed by the local ++ bridging function, including bridge management ++ frames." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 6.6.1.1.3" ++ ::= { dot1dTpPortEntry 3 } ++ ++dot1dTpPortOutFrames OBJECT-TYPE ++ SYNTAX Counter ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The number of frames that have been transmitted ++ by this port to its segment. Note that a frame ++ transmitted on the interface corresponding to this ++ port is only counted by this object if and only if ++ it is for a protocol being processed by the local ++ bridging function, including bridge management ++ frames." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 6.6.1.1.3" ++ ::= { dot1dTpPortEntry 4 } ++ ++dot1dTpPortInDiscards OBJECT-TYPE ++ SYNTAX Counter ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "Count of valid frames received which were ++ discarded (i.e., filtered) by the Forwarding ++ Process." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 6.6.1.1.3" ++ ::= { dot1dTpPortEntry 5 } ++-- The Static (Destination-Address Filtering) Database ++ ++-- Implementation of this group is optional. ++ ++dot1dStaticTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF Dot1dStaticEntry ++ ACCESS not-accessible ++ STATUS mandatory ++ DESCRIPTION ++ "A table containing filtering information ++ configured into the bridge by (local or network) ++ management specifying the set of ports to which ++ frames received from specific ports and containing ++ specific destination addresses are allowed to be ++ forwarded. The value of zero in this table as the ++ port number from which frames with a specific ++ destination address are received, is used to ++ specify all ports for which there is no specific ++ entry in this table for that particular ++ destination address. Entries are valid for ++ unicast and for group/broadcast addresses." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 6.7.2" ++ ::= { dot1dStatic 1 } ++ ++dot1dStaticEntry OBJECT-TYPE ++ SYNTAX Dot1dStaticEntry ++ ACCESS not-accessible ++ STATUS mandatory ++ DESCRIPTION ++ "Filtering information configured into the bridge ++ by (local or network) management specifying the ++ set of ports to which frames received from a ++ specific port and containing a specific ++ destination address are allowed to be forwarded." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 6.7.2" ++ INDEX { dot1dStaticAddress, dot1dStaticReceivePort } ++ ::= { dot1dStaticTable 1 } ++ ++Dot1dStaticEntry ::= ++ SEQUENCE { ++ dot1dStaticAddress ++ MacAddress, ++ dot1dStaticReceivePort ++ INTEGER, ++ dot1dStaticAllowedToGoTo ++ OCTET STRING, ++ dot1dStaticStatus ++ INTEGER ++ } ++ ++dot1dStaticAddress OBJECT-TYPE ++ SYNTAX MacAddress ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "The destination MAC address in a frame to which ++ this entry's filtering information applies. This ++ object can take the value of a unicast address, a ++ group address or the broadcast address." ++ REFERENCE ++ "IEEE 802.1D-1990: Section 3.9.1, 3.9.2" ++ ::= { dot1dStaticEntry 1 } ++ ++dot1dStaticReceivePort OBJECT-TYPE ++ SYNTAX INTEGER ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "Either the value '0', or the port number of the ++ port from which a frame must be received in order ++ for this entry's filtering information to apply. ++ A value of zero indicates that this entry applies ++ on all ports of the bridge for which there is no ++ other applicable entry." ++ ::= { dot1dStaticEntry 2 } ++ ++dot1dStaticAllowedToGoTo OBJECT-TYPE ++ SYNTAX OCTET STRING ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "The set of ports to which frames received from a ++ specific port and destined for a specific MAC ++ ++ address, are allowed to be forwarded. Each octet ++ within the value of this object specifies a set of ++ eight ports, with the first octet specifying ports ++ 1 through 8, the second octet specifying ports 9 ++ through 16, etc. Within each octet, the most ++ significant bit represents the lowest numbered ++ port, and the least significant bit represents the ++ highest numbered port. Thus, each port of the ++ bridge is represented by a single bit within the ++ value of this object. If that bit has a value of ++ '1' then that port is included in the set of ++ ports; the port is not included if its bit has a ++ value of '0'. (Note that the setting of the bit ++ corresponding to the port from which a frame is ++ received is irrelevant.) The default value of ++ this object is a string of ones of appropriate ++ length." ++ ::= { dot1dStaticEntry 3 } ++ ++dot1dStaticStatus OBJECT-TYPE ++ SYNTAX INTEGER { ++ other(1), ++ invalid(2), ++ permanent(3), ++ deleteOnReset(4), ++ deleteOnTimeout(5) ++ } ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "This object indicates the status of this entry. ++ The default value is permanent(3). ++ other(1) - this entry is currently in use but ++ the conditions under which it will ++ remain so are different from each of the ++ following values. ++ invalid(2) - writing this value to the object ++ removes the corresponding entry. ++ permanent(3) - this entry is currently in use ++ and will remain so after the next reset ++ of the bridge. ++ deleteOnReset(4) - this entry is currently in ++ use and will remain so until the next ++ reset of the bridge. ++ deleteOnTimeout(5) - this entry is currently ++ in use and will remain so until it is ++ aged out." ++ ++ ::= { dot1dStaticEntry 4 } ++ ++-- Traps for use by Bridges ++ ++-- Traps for the Spanning Tree Protocol ++ ++newRoot TRAP-TYPE ++ ENTERPRISE dot1dBridge ++ DESCRIPTION ++ "The newRoot trap indicates that the sending agent ++ has become the new root of the Spanning Tree; the ++ trap is sent by a bridge soon after its election ++ as the new root, e.g., upon expiration of the ++ Topology Change Timer immediately subsequent to ++ its election. Implementation of this trap is ++ optional." ++ ::= 1 ++ ++topologyChange TRAP-TYPE ++ ENTERPRISE dot1dBridge ++ DESCRIPTION ++ "A topologyChange trap is sent by a bridge when ++ any of its configured ports transitions from the ++ Learning state to the Forwarding state, or from ++ the Forwarding state to the Blocking state. The ++ trap is not sent if a newRoot trap is sent for the ++ same transition. Implementation of this trap is ++ optional." ++ ::= 2 ++ ++END +--- /dev/null ++++ b/mibs/GNOME-SMI.txt +@@ -0,0 +1,88 @@ ++GNOME-SMI DEFINITIONS ::= BEGIN ++ ++IMPORTS ++ MODULE-IDENTITY, ++ OBJECT-IDENTITY, ++ enterprises ++ FROM SNMPv2-SMI; ++ ++gnome MODULE-IDENTITY ++ LAST-UPDATED "200709070000Z" ++ ORGANIZATION "GNOME project" ++ CONTACT-INFO ++ "GNU Network Object Model Environment project ++ ++ see http://www.gnome.org for contact persons of a particular ++ area or subproject of GNOME. ++ ++ Administrative contact for MIB module: ++ ++ Jochen Friedrich ++ Ramsaystr. 9 ++ 63450 Hanau ++ Germany ++ ++ email: jochen@scram.de" ++ DESCRIPTION ++ "The Structure of GNOME." ++ ++ -- revision history ++ ++ REVISION "200709070000Z" -- Sep 07, 2007 ++ DESCRIPTION ++ "Fixed wrong enterprise number (how comes this ++ typo was unnoticed for so long?)." ++ ++ REVISION "200505070000Z" -- May 07, 2005 ++ DESCRIPTION ++ "Added gnomeLDAP subtree for LDAP definitions." ++ ++ REVISION "200312070000Z" -- December 07, 2003 ++ DESCRIPTION ++ "Added gnomeSysadmin subtree for GNOME project system administration. ++ Updated contact info." ++ ++ REVISION "9809010000Z" -- September 01, 1998 ++ DESCRIPTION ++ "Initial version." ++ ++ ::= { enterprises 3319 } -- assigned by IANA ++ ++gnomeProducts OBJECT-IDENTITY ++ STATUS current ++ DESCRIPTION ++ "gnomeProducts is the root OBJECT IDENTIFIER from ++ which sysObjectID values are assigned." ++ ::= { gnome 1 } ++ ++gnomeMgmt OBJECT-IDENTITY ++ STATUS current ++ DESCRIPTION ++ "gnomeMgmt defines the subtree for production GNOME related ++ MIB registrations." ++ ::= { gnome 2 } ++ ++gnomeTest OBJECT-IDENTITY ++ STATUS current ++ DESCRIPTION ++ "gnomeTest defines the subtree for testing GNOME related ++ MIB registrations." ++ ::= { gnome 3 } ++ ++gnomeSysadmin OBJECT-IDENTITY ++ STATUS current ++ DESCRIPTION ++ "gnomeSysadmin defines the subtree for GNOME related Sysadmin ++ MIB registrations." ++ ::= { gnome 4 } ++ ++gnomeLDAP OBJECT-IDENTITY ++ STATUS current ++ DESCRIPTION ++ "gnomeLDAP defines the subtree for GNOME related LDAP ++ registrations." ++ ::= { gnome 5 } ++ ++-- more to come if necessary. ++ ++END +--- /dev/null ++++ b/mibs/OSPF-MIB.txt +@@ -0,0 +1,2723 @@ ++OSPF-MIB DEFINITIONS ::= BEGIN ++ ++ IMPORTS ++ MODULE-IDENTITY, OBJECT-TYPE, Counter32, Gauge32, ++ Integer32, IpAddress ++ FROM SNMPv2-SMI ++ TEXTUAL-CONVENTION, TruthValue, RowStatus ++ FROM SNMPv2-TC ++ MODULE-COMPLIANCE, OBJECT-GROUP FROM SNMPv2-CONF ++ mib-2 FROM RFC1213-MIB; ++ ++-- This MIB module uses the extended OBJECT-TYPE macro as ++-- defined in [9]. ++ ++ospf MODULE-IDENTITY ++ LAST-UPDATED "9501201225Z" -- Fri Jan 20 12:25:50 PST 1995 ++ ORGANIZATION "IETF OSPF Working Group" ++ CONTACT-INFO ++ " Fred Baker ++ Postal: Cisco Systems ++ 519 Lado Drive ++ Santa Barbara, California 93111 ++ Tel: +1 805 681 0115 ++ E-Mail: fred@cisco.com ++ ++ Rob Coltun ++ Postal: RainbowBridge Communications ++ Tel: (301) 340-9416 ++ E-Mail: rcoltun@rainbow-bridge.com" ++ DESCRIPTION ++ "The MIB module to describe the OSPF Version 2 ++ Protocol" ++ ::= { mib-2 14 } ++ ++-- The Area ID, in OSPF, has the same format as an IP Address, ++-- but has the function of defining a summarization point for ++-- Link State Advertisements ++ ++AreaID ::= TEXTUAL-CONVENTION ++ STATUS current ++ DESCRIPTION ++ "An OSPF Area Identifier." ++ SYNTAX IpAddress ++ ++ ++-- The Router ID, in OSPF, has the same format as an IP Address, ++-- but identifies the router independent of its IP Address. ++ ++RouterID ::= TEXTUAL-CONVENTION ++ STATUS current ++ DESCRIPTION ++ "A OSPF Router Identifier." ++ SYNTAX IpAddress ++ ++ ++-- The OSPF Metric is defined as an unsigned value in the range ++ ++Metric ::= TEXTUAL-CONVENTION ++ STATUS current ++ DESCRIPTION ++ "The OSPF Internal Metric." ++ SYNTAX Integer32 (0..'FFFF'h) ++ ++BigMetric ::= TEXTUAL-CONVENTION ++ STATUS current ++ DESCRIPTION ++ "The OSPF External Metric." ++ SYNTAX Integer32 (0..'FFFFFF'h) ++ ++-- Status Values ++ ++Status ::= TEXTUAL-CONVENTION ++ STATUS current ++ DESCRIPTION ++ "The status of an interface: 'enabled' indicates that ++ it is willing to communicate with other OSPF Routers, ++ while 'disabled' indicates that it is not." ++ SYNTAX INTEGER { enabled (1), disabled (2) } ++ ++-- Time Durations measured in seconds ++ ++PositiveInteger ::= TEXTUAL-CONVENTION ++ STATUS current ++ DESCRIPTION ++ "A positive integer. Values in excess are precluded as ++ unnecessary and prone to interoperability issues." ++ SYNTAX Integer32 (0..'7FFFFFFF'h) ++ ++HelloRange ::= TEXTUAL-CONVENTION ++ STATUS current ++ DESCRIPTION ++ "The range of intervals on which hello messages are ++ exchanged." ++ SYNTAX Integer32 (1..'FFFF'h) ++ ++UpToMaxAge ::= TEXTUAL-CONVENTION ++ STATUS current ++ DESCRIPTION ++ "The values that one might find or configure for ++ variables bounded by the maximum age of an LSA." ++ SYNTAX Integer32 (0..3600) ++ ++ ++-- The range of ifIndex ++ ++InterfaceIndex ::= TEXTUAL-CONVENTION ++ STATUS current ++ DESCRIPTION ++ "The range of ifIndex." ++ SYNTAX Integer32 ++ ++ ++-- Potential Priorities for the Designated Router Election ++ ++DesignatedRouterPriority ::= TEXTUAL-CONVENTION ++ STATUS current ++ DESCRIPTION ++ "The values defined for the priority of a system for ++ becoming the designated router." ++ SYNTAX Integer32 (0..'FF'h) ++ ++TOSType ::= TEXTUAL-CONVENTION ++ STATUS current ++ DESCRIPTION ++ "Type of Service is defined as a mapping to the IP Type of ++ Service Flags as defined in the IP Forwarding Table MIB ++ ++ +-----+-----+-----+-----+-----+-----+-----+-----+ ++ | | | | ++ | PRECEDENCE | TYPE OF SERVICE | 0 | ++ | | | | ++ +-----+-----+-----+-----+-----+-----+-----+-----+ ++ ++ IP TOS IP TOS ++ Field Policy Field Policy ++ ++ Contents Code Contents Code ++ 0 0 0 0 ==> 0 0 0 0 1 ==> 2 ++ 0 0 1 0 ==> 4 0 0 1 1 ==> 6 ++ 0 1 0 0 ==> 8 0 1 0 1 ==> 10 ++ 0 1 1 0 ==> 12 0 1 1 1 ==> 14 ++ 1 0 0 0 ==> 16 1 0 0 1 ==> 18 ++ 1 0 1 0 ==> 20 1 0 1 1 ==> 22 ++ 1 1 0 0 ==> 24 1 1 0 1 ==> 26 ++ 1 1 1 0 ==> 28 1 1 1 1 ==> 30 ++ ++ The remaining values are left for future definition." ++ SYNTAX Integer32 (0..30) ++ ++ ++-- OSPF General Variables ++ ++-- These parameters apply globally to the Router's ++-- OSPF Process. ++ ++ospfGeneralGroup OBJECT IDENTIFIER ::= { ospf 1 } ++ ++ ++ ospfRouterId OBJECT-TYPE ++ SYNTAX RouterID ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "A 32-bit integer uniquely identifying the ++ router in the Autonomous System. ++ ++ By convention, to ensure uniqueness, this ++ should default to the value of one of the ++ router's IP interface addresses." ++ REFERENCE ++ "OSPF Version 2, C.1 Global parameters" ++ ::= { ospfGeneralGroup 1 } ++ ++ ++ ospfAdminStat OBJECT-TYPE ++ SYNTAX Status ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "The administrative status of OSPF in the ++ router. The value 'enabled' denotes that the ++ OSPF Process is active on at least one inter- ++ face; 'disabled' disables it on all inter- ++ faces." ++ ::= { ospfGeneralGroup 2 } ++ ++ ospfVersionNumber OBJECT-TYPE ++ SYNTAX INTEGER { version2 (2) } ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The current version number of the OSPF proto- ++ col is 2." ++ REFERENCE ++ "OSPF Version 2, Title" ++ ::= { ospfGeneralGroup 3 } ++ ++ ++ ospfAreaBdrRtrStatus OBJECT-TYPE ++ SYNTAX TruthValue ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "A flag to note whether this router is an area ++ border router." ++ REFERENCE ++ "OSPF Version 2, Section 3 Splitting the AS into ++ Areas" ++ ::= { ospfGeneralGroup 4 } ++ ++ ++ ospfASBdrRtrStatus OBJECT-TYPE ++ SYNTAX TruthValue ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "A flag to note whether this router is config- ++ ured as an Autonomous System border router." ++ REFERENCE ++ "OSPF Version 2, Section 3.3 Classification of ++ routers" ++ ::= { ospfGeneralGroup 5 } ++ ++ ospfExternLsaCount OBJECT-TYPE ++ SYNTAX Gauge32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of external (LS type 5) link-state ++ advertisements in the link-state database." ++ REFERENCE ++ "OSPF Version 2, Appendix A.4.5 AS external link ++ advertisements" ++ ::= { ospfGeneralGroup 6 } ++ ++ ++ ospfExternLsaCksumSum OBJECT-TYPE ++ SYNTAX Integer32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The 32-bit unsigned sum of the LS checksums of ++ the external link-state advertisements con- ++ tained in the link-state database. This sum ++ can be used to determine if there has been a ++ change in a router's link state database, and ++ to compare the link-state database of two ++ routers." ++ ::= { ospfGeneralGroup 7 } ++ ++ ++ ospfTOSSupport OBJECT-TYPE ++ SYNTAX TruthValue ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "The router's support for type-of-service rout- ++ ing." ++ REFERENCE ++ "OSPF Version 2, Appendix F.1.2 Optional TOS ++ support" ++ ::= { ospfGeneralGroup 8 } ++ ++ ospfOriginateNewLsas OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of new link-state advertisements ++ that have been originated. This number is in- ++ cremented each time the router originates a new ++ LSA." ++ ::= { ospfGeneralGroup 9 } ++ ++ ++ ospfRxNewLsas OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of link-state advertisements re- ++ ceived determined to be new instantiations. ++ This number does not include newer instantia- ++ tions of self-originated link-state advertise- ++ ments." ++ ::= { ospfGeneralGroup 10 } ++ ++ ospfExtLsdbLimit OBJECT-TYPE ++ SYNTAX Integer32 (-1..'7FFFFFFF'h) ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "The maximum number of non-default AS- ++ external-LSAs entries that can be stored in the ++ link-state database. If the value is -1, then ++ there is no limit. ++ ++ When the number of non-default AS-external-LSAs ++ in a router's link-state database reaches ++ ospfExtLsdbLimit, the router enters Overflow- ++ State. The router never holds more than ++ ospfExtLsdbLimit non-default AS-external-LSAs ++ in its database. OspfExtLsdbLimit MUST be set ++ identically in all routers attached to the OSPF ++ backbone and/or any regular OSPF area. (i.e., ++ OSPF stub areas and NSSAs are excluded)." ++ DEFVAL { -1 } ++ ::= { ospfGeneralGroup 11 } ++ ++ ospfMulticastExtensions OBJECT-TYPE ++ SYNTAX Integer32 ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "A Bit Mask indicating whether the router is ++ forwarding IP multicast (Class D) datagrams ++ based on the algorithms defined in the Multi- ++ cast Extensions to OSPF. ++ ++ Bit 0, if set, indicates that the router can ++ forward IP multicast datagrams in the router's ++ directly attached areas (called intra-area mul- ++ ticast routing). ++ ++ Bit 1, if set, indicates that the router can ++ forward IP multicast datagrams between OSPF ++ areas (called inter-area multicast routing). ++ ++ Bit 2, if set, indicates that the router can ++ forward IP multicast datagrams between Auto- ++ nomous Systems (called inter-AS multicast rout- ++ ing). ++ ++ Only certain combinations of bit settings are ++ allowed, namely: 0 (no multicast forwarding is ++ enabled), 1 (intra-area multicasting only), 3 ++ (intra-area and inter-area multicasting), 5 ++ (intra-area and inter-AS multicasting) and 7 ++ (multicasting everywhere). By default, no mul- ++ ticast forwarding is enabled." ++ DEFVAL { 0 } ++ ::= { ospfGeneralGroup 12 } ++ ++ ospfExitOverflowInterval OBJECT-TYPE ++ SYNTAX PositiveInteger ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "The number of seconds that, after entering ++ OverflowState, a router will attempt to leave ++ OverflowState. This allows the router to again ++ originate non-default AS-external-LSAs. When ++ set to 0, the router will not leave Overflow- ++ State until restarted." ++ DEFVAL { 0 } ++ ::= { ospfGeneralGroup 13 } ++ ++ ++ ospfDemandExtensions OBJECT-TYPE ++ SYNTAX TruthValue ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "The router's support for demand routing." ++ REFERENCE ++ "OSPF Version 2, Appendix on Demand Routing" ++ ::= { ospfGeneralGroup 14 } ++ ++ ++-- The OSPF Area Data Structure contains information ++-- regarding the various areas. The interfaces and ++-- virtual links are configured as part of these areas. ++-- Area 0.0.0.0, by definition, is the Backbone Area ++ ++ ++ ospfAreaTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF OspfAreaEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "Information describing the configured parame- ++ ters and cumulative statistics of the router's ++ attached areas." ++ REFERENCE ++ "OSPF Version 2, Section 6 The Area Data Struc- ++ ture" ++ ::= { ospf 2 } ++ ++ ++ ospfAreaEntry OBJECT-TYPE ++ SYNTAX OspfAreaEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "Information describing the configured parame- ++ ters and cumulative statistics of one of the ++ router's attached areas." ++ INDEX { ospfAreaId } ++ ::= { ospfAreaTable 1 } ++ ++OspfAreaEntry ::= ++ SEQUENCE { ++ ospfAreaId ++ AreaID, ++ ospfAuthType ++ Integer32, ++ ospfImportAsExtern ++ INTEGER, ++ ospfSpfRuns ++ Counter32, ++ ospfAreaBdrRtrCount ++ Gauge32, ++ ospfAsBdrRtrCount ++ Gauge32, ++ ospfAreaLsaCount ++ Gauge32, ++ ospfAreaLsaCksumSum ++ Integer32, ++ ospfAreaSummary ++ INTEGER, ++ ospfAreaStatus ++ RowStatus ++ } ++ ++ ospfAreaId OBJECT-TYPE ++ SYNTAX AreaID ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "A 32-bit integer uniquely identifying an area. ++ Area ID 0.0.0.0 is used for the OSPF backbone." ++ REFERENCE ++ "OSPF Version 2, Appendix C.2 Area parameters" ++ ::= { ospfAreaEntry 1 } ++ ++ ++ ospfAuthType OBJECT-TYPE ++ SYNTAX Integer32 ++ -- none (0), ++ -- simplePassword (1) ++ -- md5 (2) ++ -- reserved for specification by IANA (> 2) ++ MAX-ACCESS read-create ++ STATUS obsolete ++ DESCRIPTION ++ "The authentication type specified for an area. ++ Additional authentication types may be assigned ++ locally on a per Area basis." ++ REFERENCE ++ "OSPF Version 2, Appendix E Authentication" ++ DEFVAL { 0 } -- no authentication, by default ++ ::= { ospfAreaEntry 2 } ++ ++ ospfImportAsExtern OBJECT-TYPE ++ SYNTAX INTEGER { ++ importExternal (1), ++ importNoExternal (2), ++ importNssa (3) ++ } ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The area's support for importing AS external ++ link- state advertisements." ++ REFERENCE ++ "OSPF Version 2, Appendix C.2 Area parameters" ++ DEFVAL { importExternal } ++ ::= { ospfAreaEntry 3 } ++ ++ ++ ospfSpfRuns OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of times that the intra-area route ++ table has been calculated using this area's ++ link-state database. This is typically done ++ using Dijkstra's algorithm." ++ ::= { ospfAreaEntry 4 } ++ ++ ++ ospfAreaBdrRtrCount OBJECT-TYPE ++ SYNTAX Gauge32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The total number of area border routers reach- ++ able within this area. This is initially zero, ++ and is calculated in each SPF Pass." ++ ::= { ospfAreaEntry 5 } ++ ++ ospfAsBdrRtrCount OBJECT-TYPE ++ SYNTAX Gauge32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The total number of Autonomous System border ++ routers reachable within this area. This is ++ initially zero, and is calculated in each SPF ++ Pass." ++ ::= { ospfAreaEntry 6 } ++ ++ ++ ospfAreaLsaCount OBJECT-TYPE ++ SYNTAX Gauge32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The total number of link-state advertisements ++ in this area's link-state database, excluding ++ AS External LSA's." ++ ::= { ospfAreaEntry 7 } ++ ++ ++ ospfAreaLsaCksumSum OBJECT-TYPE ++ SYNTAX Integer32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The 32-bit unsigned sum of the link-state ad- ++ vertisements' LS checksums contained in this ++ area's link-state database. This sum excludes ++ external (LS type 5) link-state advertisements. ++ The sum can be used to determine if there has ++ been a change in a router's link state data- ++ base, and to compare the link-state database of ++ two routers." ++ DEFVAL { 0 } ++ ::= { ospfAreaEntry 8 } ++ ++ ospfAreaSummary OBJECT-TYPE ++ SYNTAX INTEGER { ++ noAreaSummary (1), ++ sendAreaSummary (2) ++ } ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The variable ospfAreaSummary controls the im- ++ port of summary LSAs into stub areas. It has ++ no effect on other areas. ++ ++ If it is noAreaSummary, the router will neither ++ originate nor propagate summary LSAs into the ++ stub area. It will rely entirely on its de- ++ fault route. ++ ++ If it is sendAreaSummary, the router will both ++ summarize and propagate summary LSAs." ++ DEFVAL { noAreaSummary } ++ ::= { ospfAreaEntry 9 } ++ ++ ++ ospfAreaStatus OBJECT-TYPE ++ SYNTAX RowStatus ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "This variable displays the status of the en- ++ try. Setting it to 'invalid' has the effect of ++ rendering it inoperative. The internal effect ++ (row removal) is implementation dependent." ++ ::= { ospfAreaEntry 10 } ++ ++ ++-- OSPF Area Default Metric Table ++ ++-- The OSPF Area Default Metric Table describes the metrics ++-- that a default Area Border Router will advertise into a ++-- Stub area. ++ ++ ++ ospfStubAreaTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF OspfStubAreaEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "The set of metrics that will be advertised by ++ a default Area Border Router into a stub area." ++ REFERENCE ++ "OSPF Version 2, Appendix C.2, Area Parameters" ++ ::= { ospf 3 } ++ ++ ++ ospfStubAreaEntry OBJECT-TYPE ++ SYNTAX OspfStubAreaEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "The metric for a given Type of Service that ++ will be advertised by a default Area Border ++ Router into a stub area." ++ REFERENCE ++ "OSPF Version 2, Appendix C.2, Area Parameters" ++ INDEX { ospfStubAreaId, ospfStubTOS } ++ ::= { ospfStubAreaTable 1 } ++ ++OspfStubAreaEntry ::= ++ SEQUENCE { ++ ospfStubAreaId ++ AreaID, ++ ospfStubTOS ++ TOSType, ++ ospfStubMetric ++ BigMetric, ++ ospfStubStatus ++ RowStatus, ++ ospfStubMetricType ++ INTEGER ++ } ++ ++ ospfStubAreaId OBJECT-TYPE ++ SYNTAX AreaID ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The 32 bit identifier for the Stub Area. On ++ creation, this can be derived from the in- ++ stance." ++ ::= { ospfStubAreaEntry 1 } ++ ++ ++ ospfStubTOS OBJECT-TYPE ++ SYNTAX TOSType ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The Type of Service associated with the ++ metric. On creation, this can be derived from ++ the instance." ++ ::= { ospfStubAreaEntry 2 } ++ ++ ++ ospfStubMetric OBJECT-TYPE ++ SYNTAX BigMetric ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The metric value applied at the indicated type ++ of service. By default, this equals the least ++ metric at the type of service among the inter- ++ faces to other areas." ++ ::= { ospfStubAreaEntry 3 } ++ ++ ++ ospfStubStatus OBJECT-TYPE ++ SYNTAX RowStatus ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "This variable displays the status of the en- ++ try. Setting it to 'invalid' has the effect of ++ rendering it inoperative. The internal effect ++ (row removal) is implementation dependent." ++ ::= { ospfStubAreaEntry 4 } ++ ++ ospfStubMetricType OBJECT-TYPE ++ SYNTAX INTEGER { ++ ospfMetric (1), -- OSPF Metric ++ comparableCost (2), -- external type 1 ++ nonComparable (3) -- external type 2 ++ } ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "This variable displays the type of metric ad- ++ vertised as a default route." ++ DEFVAL { ospfMetric } ++ ::= { ospfStubAreaEntry 5 } ++ ++-- OSPF Link State Database ++ ++-- The Link State Database contains the Link State ++-- Advertisements from throughout the areas that the ++-- device is attached to. ++ ++ ++ ospfLsdbTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF OspfLsdbEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "The OSPF Process's Link State Database." ++ REFERENCE ++ "OSPF Version 2, Section 12 Link State Adver- ++ tisements" ++ ::= { ospf 4 } ++ ++ ++ ospfLsdbEntry OBJECT-TYPE ++ SYNTAX OspfLsdbEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "A single Link State Advertisement." ++ INDEX { ospfLsdbAreaId, ospfLsdbType, ++ ospfLsdbLsid, ospfLsdbRouterId } ++ ::= { ospfLsdbTable 1 } ++ ++OspfLsdbEntry ::= ++ SEQUENCE { ++ ospfLsdbAreaId ++ AreaID, ++ ospfLsdbType ++ INTEGER, ++ ospfLsdbLsid ++ IpAddress, ++ ospfLsdbRouterId ++ RouterID, ++ ospfLsdbSequence ++ Integer32, ++ ospfLsdbAge ++ Integer32, ++ ospfLsdbChecksum ++ Integer32, ++ ospfLsdbAdvertisement ++ OCTET STRING ++ } ++ ospfLsdbAreaId OBJECT-TYPE ++ SYNTAX AreaID ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The 32 bit identifier of the Area from which ++ the LSA was received." ++ REFERENCE ++ "OSPF Version 2, Appendix C.2 Area parameters" ++ ::= { ospfLsdbEntry 1 } ++ ++-- External Link State Advertisements are permitted ++-- for backward compatibility, but should be displayed in ++-- the ospfExtLsdbTable rather than here. ++ ++ ospfLsdbType OBJECT-TYPE ++ SYNTAX INTEGER { ++ routerLink (1), ++ networkLink (2), ++ summaryLink (3), ++ asSummaryLink (4), ++ asExternalLink (5), -- but see ospfExtLsdbTable ++ multicastLink (6), ++ nssaExternalLink (7) ++ } ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The type of the link state advertisement. ++ Each link state type has a separate advertise- ++ ment format." ++ REFERENCE ++ "OSPF Version 2, Appendix A.4.1 The Link State ++ Advertisement header" ++ ::= { ospfLsdbEntry 2 } ++ ++ ospfLsdbLsid OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The Link State ID is an LS Type Specific field ++ containing either a Router ID or an IP Address; ++ it identifies the piece of the routing domain ++ that is being described by the advertisement." ++ REFERENCE ++ "OSPF Version 2, Section 12.1.4 Link State ID" ++ ::= { ospfLsdbEntry 3 } ++ ospfLsdbRouterId OBJECT-TYPE ++ SYNTAX RouterID ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The 32 bit number that uniquely identifies the ++ originating router in the Autonomous System." ++ REFERENCE ++ "OSPF Version 2, Appendix C.1 Global parameters" ++ ::= { ospfLsdbEntry 4 } ++ ++-- Note that the OSPF Sequence Number is a 32 bit signed ++-- integer. It starts with the value '80000001'h, ++-- or -'7FFFFFFF'h, and increments until '7FFFFFFF'h ++-- Thus, a typical sequence number will be very negative. ++ ++ ospfLsdbSequence OBJECT-TYPE ++ SYNTAX Integer32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The sequence number field is a signed 32-bit ++ integer. It is used to detect old and dupli- ++ cate link state advertisements. The space of ++ sequence numbers is linearly ordered. The ++ larger the sequence number the more recent the ++ advertisement." ++ REFERENCE ++ "OSPF Version 2, Section 12.1.6 LS sequence ++ number" ++ ::= { ospfLsdbEntry 5 } ++ ++ ++ ospfLsdbAge OBJECT-TYPE ++ SYNTAX Integer32 -- Should be 0..MaxAge ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "This field is the age of the link state adver- ++ tisement in seconds." ++ REFERENCE ++ "OSPF Version 2, Section 12.1.1 LS age" ++ ::= { ospfLsdbEntry 6 } ++ ++ ospfLsdbChecksum OBJECT-TYPE ++ SYNTAX Integer32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "This field is the checksum of the complete ++ contents of the advertisement, excepting the ++ age field. The age field is excepted so that ++ an advertisement's age can be incremented ++ without updating the checksum. The checksum ++ used is the same that is used for ISO connec- ++ tionless datagrams; it is commonly referred to ++ as the Fletcher checksum." ++ REFERENCE ++ "OSPF Version 2, Section 12.1.7 LS checksum" ++ ::= { ospfLsdbEntry 7 } ++ ++ ++ ospfLsdbAdvertisement OBJECT-TYPE ++ SYNTAX OCTET STRING (SIZE (1..65535)) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The entire Link State Advertisement, including ++ its header." ++ REFERENCE ++ "OSPF Version 2, Section 12 Link State Adver- ++ tisements" ++ ::= { ospfLsdbEntry 8 } ++ ++ ++-- Address Range Table ++ ++-- The Address Range Table acts as an adjunct to the Area ++-- Table; It describes those Address Range Summaries that ++-- are configured to be propagated from an Area to reduce ++-- the amount of information about it which is known beyond ++-- its borders. ++ ++ ospfAreaRangeTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF OspfAreaRangeEntry ++ MAX-ACCESS not-accessible ++ STATUS obsolete ++ DESCRIPTION ++ "A range if IP addresses specified by an IP ++ address/IP network mask pair. For example, ++ class B address range of X.X.X.X with a network ++ mask of 255.255.0.0 includes all IP addresses ++ from X.X.0.0 to X.X.255.255" ++ REFERENCE ++ "OSPF Version 2, Appendix C.2 Area parameters" ++ ::= { ospf 5 } ++ ospfAreaRangeEntry OBJECT-TYPE ++ SYNTAX OspfAreaRangeEntry ++ MAX-ACCESS not-accessible ++ STATUS obsolete ++ DESCRIPTION ++ "A range if IP addresses specified by an IP ++ address/IP network mask pair. For example, ++ class B address range of X.X.X.X with a network ++ mask of 255.255.0.0 includes all IP addresses ++ from X.X.0.0 to X.X.255.255" ++ REFERENCE ++ "OSPF Version 2, Appendix C.2 Area parameters" ++ INDEX { ospfAreaRangeAreaId, ospfAreaRangeNet } ++ ::= { ospfAreaRangeTable 1 } ++ ++OspfAreaRangeEntry ::= ++ SEQUENCE { ++ ospfAreaRangeAreaId ++ AreaID, ++ ospfAreaRangeNet ++ IpAddress, ++ ospfAreaRangeMask ++ IpAddress, ++ ospfAreaRangeStatus ++ RowStatus, ++ ospfAreaRangeEffect ++ INTEGER ++ } ++ ++ ospfAreaRangeAreaId OBJECT-TYPE ++ SYNTAX AreaID ++ MAX-ACCESS read-only ++ STATUS obsolete ++ DESCRIPTION ++ "The Area the Address Range is to be found ++ within." ++ REFERENCE ++ "OSPF Version 2, Appendix C.2 Area parameters" ++ ::= { ospfAreaRangeEntry 1 } ++ ++ ++ ospfAreaRangeNet OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS obsolete ++ DESCRIPTION ++ "The IP Address of the Net or Subnet indicated ++ by the range." ++ REFERENCE ++ "OSPF Version 2, Appendix C.2 Area parameters" ++ ::= { ospfAreaRangeEntry 2 } ++ ++ ++ ospfAreaRangeMask OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-create ++ STATUS obsolete ++ DESCRIPTION ++ "The Subnet Mask that pertains to the Net or ++ Subnet." ++ REFERENCE ++ "OSPF Version 2, Appendix C.2 Area parameters" ++ ::= { ospfAreaRangeEntry 3 } ++ ++ ospfAreaRangeStatus OBJECT-TYPE ++ SYNTAX RowStatus ++ MAX-ACCESS read-create ++ STATUS obsolete ++ DESCRIPTION ++ "This variable displays the status of the en- ++ try. Setting it to 'invalid' has the effect of ++ rendering it inoperative. The internal effect ++ (row removal) is implementation dependent." ++ ::= { ospfAreaRangeEntry 4 } ++ ++ ++ ospfAreaRangeEffect OBJECT-TYPE ++ SYNTAX INTEGER { ++ advertiseMatching (1), ++ doNotAdvertiseMatching (2) ++ } ++ MAX-ACCESS read-create ++ STATUS obsolete ++ DESCRIPTION ++ "Subnets subsumed by ranges either trigger the ++ advertisement of the indicated summary (adver- ++ tiseMatching), or result in the subnet's not ++ being advertised at all outside the area." ++ DEFVAL { advertiseMatching } ++ ::= { ospfAreaRangeEntry 5 } ++ ++ ++ ++-- OSPF Host Table ++ ++-- The Host/Metric Table indicates what hosts are directly ++-- attached to the Router, and what metrics and types of ++-- service should be advertised for them. ++ ++ ospfHostTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF OspfHostEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "The list of Hosts, and their metrics, that the ++ router will advertise as host routes." ++ REFERENCE ++ "OSPF Version 2, Appendix C.6 Host route param- ++ eters" ++ ::= { ospf 6 } ++ ++ ++ ospfHostEntry OBJECT-TYPE ++ SYNTAX OspfHostEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "A metric to be advertised, for a given type of ++ service, when a given host is reachable." ++ INDEX { ospfHostIpAddress, ospfHostTOS } ++ ::= { ospfHostTable 1 } ++ ++OspfHostEntry ::= ++ SEQUENCE { ++ ospfHostIpAddress ++ IpAddress, ++ ospfHostTOS ++ TOSType, ++ ospfHostMetric ++ Metric, ++ ospfHostStatus ++ RowStatus, ++ ospfHostAreaID ++ AreaID ++ } ++ ++ ospfHostIpAddress OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The IP Address of the Host." ++ REFERENCE ++ "OSPF Version 2, Appendix C.6 Host route parame- ++ ters" ++ ::= { ospfHostEntry 1 } ++ ++ ++ ospfHostTOS OBJECT-TYPE ++ SYNTAX TOSType ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The Type of Service of the route being config- ++ ured." ++ REFERENCE ++ "OSPF Version 2, Appendix C.6 Host route parame- ++ ters" ++ ::= { ospfHostEntry 2 } ++ ++ ++ ospfHostMetric OBJECT-TYPE ++ SYNTAX Metric ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The Metric to be advertised." ++ REFERENCE ++ "OSPF Version 2, Appendix C.6 Host route parame- ++ ters" ++ ::= { ospfHostEntry 3 } ++ ++ ospfHostStatus OBJECT-TYPE ++ SYNTAX RowStatus ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "This variable displays the status of the en- ++ try. Setting it to 'invalid' has the effect of ++ rendering it inoperative. The internal effect ++ (row removal) is implementation dependent." ++ ::= { ospfHostEntry 4 } ++ ++ ++ ospfHostAreaID OBJECT-TYPE ++ SYNTAX AreaID ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The Area the Host Entry is to be found within. ++ By default, the area that a subsuming OSPF in- ++ terface is in, or 0.0.0.0" ++ REFERENCE ++ "OSPF Version 2, Appendix C.2 Area parameters" ++ ::= { ospfHostEntry 5 } ++ ++ ++-- OSPF Interface Table ++ ++-- The OSPF Interface Table augments the ipAddrTable ++-- with OSPF specific information. ++ ++ ospfIfTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF OspfIfEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "The OSPF Interface Table describes the inter- ++ faces from the viewpoint of OSPF." ++ REFERENCE ++ "OSPF Version 2, Appendix C.3 Router interface ++ parameters" ++ ::= { ospf 7 } ++ ++ ++ ospfIfEntry OBJECT-TYPE ++ SYNTAX OspfIfEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "The OSPF Interface Entry describes one inter- ++ face from the viewpoint of OSPF." ++ INDEX { ospfIfIpAddress, ospfAddressLessIf } ++ ::= { ospfIfTable 1 } ++ ++OspfIfEntry ::= ++ SEQUENCE { ++ ospfIfIpAddress ++ IpAddress, ++ ospfAddressLessIf ++ Integer32, ++ ospfIfAreaId ++ AreaID, ++ ospfIfType ++ INTEGER, ++ ospfIfAdminStat ++ Status, ++ ospfIfRtrPriority ++ DesignatedRouterPriority, ++ ospfIfTransitDelay ++ UpToMaxAge, ++ ospfIfRetransInterval ++ UpToMaxAge, ++ ospfIfHelloInterval ++ HelloRange, ++ ospfIfRtrDeadInterval ++ PositiveInteger, ++ ospfIfPollInterval ++ PositiveInteger, ++ ospfIfState ++ INTEGER, ++ ospfIfDesignatedRouter ++ IpAddress, ++ ospfIfBackupDesignatedRouter ++ IpAddress, ++ ospfIfEvents ++ Counter32, ++ ospfIfAuthType ++ INTEGER, ++ ospfIfAuthKey ++ OCTET STRING, ++ ospfIfStatus ++ RowStatus, ++ ospfIfMulticastForwarding ++ INTEGER, ++ ospfIfDemand ++ TruthValue ++ } ++ ++ ospfIfIpAddress OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The IP address of this OSPF interface." ++ ::= { ospfIfEntry 1 } ++ ++ ospfAddressLessIf OBJECT-TYPE ++ SYNTAX Integer32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "For the purpose of easing the instancing of ++ addressed and addressless interfaces; This ++ variable takes the value 0 on interfaces with ++ IP Addresses, and the corresponding value of ++ ifIndex for interfaces having no IP Address." ++ ::= { ospfIfEntry 2 } ++ ospfIfAreaId OBJECT-TYPE ++ SYNTAX AreaID ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "A 32-bit integer uniquely identifying the area ++ to which the interface connects. Area ID ++ 0.0.0.0 is used for the OSPF backbone." ++ DEFVAL { '00000000'H } -- 0.0.0.0 ++ ::= { ospfIfEntry 3 } ++ ++ ospfIfType OBJECT-TYPE ++ SYNTAX INTEGER { ++ broadcast (1), ++ nbma (2), ++ pointToPoint (3), ++ pointToMultipoint (5) ++ } ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The OSPF interface type. ++ ++ By way of a default, this field may be intuited ++ from the corresponding value of ifType. Broad- ++ cast LANs, such as Ethernet and IEEE 802.5, ++ take the value 'broadcast', X.25 and similar ++ technologies take the value 'nbma', and links ++ that are definitively point to point take the ++ value 'pointToPoint'." ++ ::= { ospfIfEntry 4 } ++ ++ ++ ospfIfAdminStat OBJECT-TYPE ++ SYNTAX Status ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The OSPF interface's administrative status. ++ The value formed on the interface, and the in- ++ terface will be advertised as an internal route ++ to some area. The value 'disabled' denotes ++ that the interface is external to OSPF." ++ DEFVAL { enabled } ++ ::= { ospfIfEntry 5 } ++ ++ ospfIfRtrPriority OBJECT-TYPE ++ SYNTAX DesignatedRouterPriority ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The priority of this interface. Used in ++ multi-access networks, this field is used in ++ the designated router election algorithm. The ++ value 0 signifies that the router is not eligi- ++ ble to become the designated router on this ++ particular network. In the event of a tie in ++ this value, routers will use their Router ID as ++ a tie breaker." ++ DEFVAL { 1 } ++ ::= { ospfIfEntry 6 } ++ ++ ++ ospfIfTransitDelay OBJECT-TYPE ++ SYNTAX UpToMaxAge ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The estimated number of seconds it takes to ++ transmit a link state update packet over this ++ interface." ++ DEFVAL { 1 } ++ ::= { ospfIfEntry 7 } ++ ++ ++ ospfIfRetransInterval OBJECT-TYPE ++ SYNTAX UpToMaxAge ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The number of seconds between link-state ad- ++ vertisement retransmissions, for adjacencies ++ belonging to this interface. This value is ++ also used when retransmitting database descrip- ++ tion and link-state request packets." ++ DEFVAL { 5 } ++ ::= { ospfIfEntry 8 } ++ ++ ++ ospfIfHelloInterval OBJECT-TYPE ++ SYNTAX HelloRange ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The length of time, in seconds, between the ++ Hello packets that the router sends on the in- ++ terface. This value must be the same for all ++ routers attached to a common network." ++ DEFVAL { 10 } ++ ::= { ospfIfEntry 9 } ++ ++ ++ ospfIfRtrDeadInterval OBJECT-TYPE ++ SYNTAX PositiveInteger ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The number of seconds that a router's Hello ++ packets have not been seen before it's neigh- ++ bors declare the router down. This should be ++ some multiple of the Hello interval. This ++ value must be the same for all routers attached ++ to a common network." ++ DEFVAL { 40 } ++ ::= { ospfIfEntry 10 } ++ ++ ++ ospfIfPollInterval OBJECT-TYPE ++ SYNTAX PositiveInteger ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The larger time interval, in seconds, between ++ the Hello packets sent to an inactive non- ++ broadcast multi- access neighbor." ++ DEFVAL { 120 } ++ ::= { ospfIfEntry 11 } ++ ++ ++ ospfIfState OBJECT-TYPE ++ SYNTAX INTEGER { ++ down (1), ++ loopback (2), ++ waiting (3), ++ pointToPoint (4), ++ designatedRouter (5), ++ backupDesignatedRouter (6), ++ otherDesignatedRouter (7) ++ } ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The OSPF Interface State." ++ DEFVAL { down } ++ ::= { ospfIfEntry 12 } ++ ++ ++ ospfIfDesignatedRouter OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The IP Address of the Designated Router." ++ DEFVAL { '00000000'H } -- 0.0.0.0 ++ ::= { ospfIfEntry 13 } ++ ++ ++ ospfIfBackupDesignatedRouter OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The IP Address of the Backup Designated ++ Router." ++ DEFVAL { '00000000'H } -- 0.0.0.0 ++ ::= { ospfIfEntry 14 } ++ ++ ospfIfEvents OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of times this OSPF interface has ++ changed its state, or an error has occurred." ++ ::= { ospfIfEntry 15 } ++ ++ ++ ospfIfAuthKey OBJECT-TYPE ++ SYNTAX OCTET STRING (SIZE (0..256)) ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The Authentication Key. If the Area's Author- ++ ization Type is simplePassword, and the key ++ length is shorter than 8 octets, the agent will ++ left adjust and zero fill to 8 octets. ++ ++ Note that unauthenticated interfaces need no ++ authentication key, and simple password authen- ++ tication cannot use a key of more than 8 oc- ++ tets. Larger keys are useful only with authen- ++ tication mechanisms not specified in this docu- ++ ment. ++ ++ When read, ospfIfAuthKey always returns an Oc- ++ tet String of length zero." ++ REFERENCE ++ "OSPF Version 2, Section 9 The Interface Data ++ Structure" ++ DEFVAL { '0000000000000000'H } -- 0.0.0.0.0.0.0.0 ++ ::= { ospfIfEntry 16 } ++ ++ ospfIfStatus OBJECT-TYPE ++ SYNTAX RowStatus ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "This variable displays the status of the en- ++ try. Setting it to 'invalid' has the effect of ++ rendering it inoperative. The internal effect ++ (row removal) is implementation dependent." ++ ::= { ospfIfEntry 17 } ++ ++ ++ ospfIfMulticastForwarding OBJECT-TYPE ++ SYNTAX INTEGER { ++ blocked (1), -- no multicast forwarding ++ multicast (2), -- using multicast address ++ unicast (3) -- to each OSPF neighbor ++ } ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The way multicasts should forwarded on this ++ interface; not forwarded, forwarded as data ++ link multicasts, or forwarded as data link uni- ++ casts. Data link multicasting is not meaning- ++ ful on point to point and NBMA interfaces, and ++ setting ospfMulticastForwarding to 0 effective- ++ ly disables all multicast forwarding." ++ DEFVAL { blocked } ++ ::= { ospfIfEntry 18 } ++ ++ ++ ospfIfDemand OBJECT-TYPE ++ SYNTAX TruthValue ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "Indicates whether Demand OSPF procedures (hel- ++ lo supression to FULL neighbors and setting the ++ DoNotAge flag on proogated LSAs) should be per- ++ formed on this interface." ++ DEFVAL { false } ++ ::= { ospfIfEntry 19 } ++ ++ ++ ospfIfAuthType OBJECT-TYPE ++ SYNTAX INTEGER (0..255) ++ -- none (0), ++ -- simplePassword (1) ++ -- md5 (2) ++ -- reserved for specification by IANA (> 2) ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The authentication type specified for an in- ++ terface. Additional authentication types may ++ be assigned locally." ++ REFERENCE ++ "OSPF Version 2, Appendix E Authentication" ++ DEFVAL { 0 } -- no authentication, by default ++ ::= { ospfIfEntry 20 } ++ ++ ++-- OSPF Interface Metric Table ++ ++-- The Metric Table describes the metrics to be advertised ++-- for a specified interface at the various types of service. ++-- As such, this table is an adjunct of the OSPF Interface ++-- Table. ++ ++-- Types of service, as defined by RFC 791, have the ability ++-- to request low delay, high bandwidth, or reliable linkage. ++ ++-- For the purposes of this specification, the measure of ++-- bandwidth ++ ++-- Metric = 10^8 / ifSpeed ++ ++-- is the default value. For multiple link interfaces, note ++-- that ifSpeed is the sum of the individual link speeds. ++-- This yields a number having the following typical values: ++ ++-- Network Type/bit rate Metric ++ ++-- >= 100 MBPS 1 ++-- Ethernet/802.3 10 ++-- E1 48 ++-- T1 (ESF) 65 ++-- 64 KBPS 1562 ++-- 56 KBPS 1785 ++-- 19.2 KBPS 5208 ++-- 9.6 KBPS 10416 ++ ++-- Routes that are not specified use the default (TOS 0) metric ++ ++ ospfIfMetricTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF OspfIfMetricEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "The TOS metrics for a non-virtual interface ++ identified by the interface index." ++ REFERENCE ++ "OSPF Version 2, Appendix C.3 Router interface ++ parameters" ++ ::= { ospf 8 } ++ ++ ospfIfMetricEntry OBJECT-TYPE ++ SYNTAX OspfIfMetricEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "A particular TOS metric for a non-virtual in- ++ terface identified by the interface index." ++ REFERENCE ++ "OSPF Version 2, Appendix C.3 Router interface ++ parameters" ++ INDEX { ospfIfMetricIpAddress, ++ ospfIfMetricAddressLessIf, ++ ospfIfMetricTOS } ++ ::= { ospfIfMetricTable 1 } ++ ++OspfIfMetricEntry ::= ++ SEQUENCE { ++ ospfIfMetricIpAddress ++ IpAddress, ++ ospfIfMetricAddressLessIf ++ Integer32, ++ ospfIfMetricTOS ++ TOSType, ++ ospfIfMetricValue ++ Metric, ++ ospfIfMetricStatus ++ RowStatus ++ } ++ ++ ospfIfMetricIpAddress OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The IP address of this OSPF interface. On row ++ creation, this can be derived from the in- ++ stance." ++ ::= { ospfIfMetricEntry 1 } ++ ++ ospfIfMetricAddressLessIf OBJECT-TYPE ++ SYNTAX Integer32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "For the purpose of easing the instancing of ++ addressed and addressless interfaces; This ++ variable takes the value 0 on interfaces with ++ IP Addresses, and the value of ifIndex for in- ++ terfaces having no IP Address. On row crea- ++ tion, this can be derived from the instance." ++ ::= { ospfIfMetricEntry 2 } ++ ++ ++ ospfIfMetricTOS OBJECT-TYPE ++ SYNTAX TOSType ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The type of service metric being referenced. ++ On row creation, this can be derived from the ++ instance." ++ ::= { ospfIfMetricEntry 3 } ++ ++ ++ ospfIfMetricValue OBJECT-TYPE ++ SYNTAX Metric ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The metric of using this type of service on ++ this interface. The default value of the TOS 0 ++ Metric is 10^8 / ifSpeed." ++ ::= { ospfIfMetricEntry 4 } ++ ++ ospfIfMetricStatus OBJECT-TYPE ++ SYNTAX RowStatus ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "This variable displays the status of the en- ++ try. Setting it to 'invalid' has the effect of ++ rendering it inoperative. The internal effect ++ (row removal) is implementation dependent." ++ ::= { ospfIfMetricEntry 5 } ++ ++ ++-- OSPF Virtual Interface Table ++ ++-- The Virtual Interface Table describes the virtual ++-- links that the OSPF Process is configured to ++-- carry on. ++ ++ ospfVirtIfTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF OspfVirtIfEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "Information about this router's virtual inter- ++ faces." ++ REFERENCE ++ "OSPF Version 2, Appendix C.4 Virtual link ++ parameters" ++ ::= { ospf 9 } ++ ++ ++ ospfVirtIfEntry OBJECT-TYPE ++ SYNTAX OspfVirtIfEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "Information about a single Virtual Interface." ++ INDEX { ospfVirtIfAreaId, ospfVirtIfNeighbor } ++ ::= { ospfVirtIfTable 1 } ++ ++OspfVirtIfEntry ::= ++ SEQUENCE { ++ ospfVirtIfAreaId ++ AreaID, ++ ospfVirtIfNeighbor ++ RouterID, ++ ospfVirtIfTransitDelay ++ UpToMaxAge, ++ ospfVirtIfRetransInterval ++ UpToMaxAge, ++ ospfVirtIfHelloInterval ++ HelloRange, ++ ospfVirtIfRtrDeadInterval ++ PositiveInteger, ++ ospfVirtIfState ++ INTEGER, ++ ospfVirtIfEvents ++ Counter32, ++ ospfVirtIfAuthType ++ INTEGER, ++ ospfVirtIfAuthKey ++ OCTET STRING, ++ ospfVirtIfStatus ++ RowStatus ++ } ++ ++ ospfVirtIfAreaId OBJECT-TYPE ++ SYNTAX AreaID ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The Transit Area that the Virtual Link ++ traverses. By definition, this is not 0.0.0.0" ++ ::= { ospfVirtIfEntry 1 } ++ ++ ++ ospfVirtIfNeighbor OBJECT-TYPE ++ SYNTAX RouterID ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The Router ID of the Virtual Neighbor." ++ ::= { ospfVirtIfEntry 2 } ++ ++ ++ ospfVirtIfTransitDelay OBJECT-TYPE ++ SYNTAX UpToMaxAge ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The estimated number of seconds it takes to ++ transmit a link- state update packet over this ++ interface." ++ DEFVAL { 1 } ++ ::= { ospfVirtIfEntry 3 } ++ ++ ++ ospfVirtIfRetransInterval OBJECT-TYPE ++ SYNTAX UpToMaxAge ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The number of seconds between link-state ad- ++ vertisement retransmissions, for adjacencies ++ belonging to this interface. This value is ++ also used when retransmitting database descrip- ++ tion and link-state request packets. This ++ value should be well over the expected round- ++ trip time." ++ DEFVAL { 5 } ++ ::= { ospfVirtIfEntry 4 } ++ ++ ++ ospfVirtIfHelloInterval OBJECT-TYPE ++ SYNTAX HelloRange ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The length of time, in seconds, between the ++ Hello packets that the router sends on the in- ++ terface. This value must be the same for the ++ virtual neighbor." ++ DEFVAL { 10 } ++ ::= { ospfVirtIfEntry 5 } ++ ++ ++ ospfVirtIfRtrDeadInterval OBJECT-TYPE ++ SYNTAX PositiveInteger ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The number of seconds that a router's Hello ++ packets have not been seen before it's neigh- ++ bors declare the router down. This should be ++ some multiple of the Hello interval. This ++ value must be the same for the virtual neigh- ++ bor." ++ DEFVAL { 60 } ++ ::= { ospfVirtIfEntry 6 } ++ ++ ++ ospfVirtIfState OBJECT-TYPE ++ SYNTAX INTEGER { ++ down (1), -- these use the same encoding ++ pointToPoint (4) -- as the ospfIfTable ++ } ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "OSPF virtual interface states." ++ DEFVAL { down } ++ ::= { ospfVirtIfEntry 7 } ++ ++ ++ ospfVirtIfEvents OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of state changes or error events on ++ this Virtual Link" ++ ::= { ospfVirtIfEntry 8 } ++ ++ ++ ospfVirtIfAuthKey OBJECT-TYPE ++ SYNTAX OCTET STRING (SIZE(0..256)) ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "If Authentication Type is simplePassword, the ++ device will left adjust and zero fill to 8 oc- ++ tets. ++ ++ Note that unauthenticated interfaces need no ++ authentication key, and simple password authen- ++ tication cannot use a key of more than 8 oc- ++ tets. Larger keys are useful only with authen- ++ tication mechanisms not specified in this docu- ++ ment. ++ ++ When read, ospfVifAuthKey always returns a ++ string of length zero." ++ REFERENCE ++ "OSPF Version 2, Section 9 The Interface Data ++ Structure" ++ DEFVAL { '0000000000000000'H } -- 0.0.0.0.0.0.0.0 ++ ::= { ospfVirtIfEntry 9 } ++ ++ ++ ospfVirtIfStatus OBJECT-TYPE ++ SYNTAX RowStatus ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "This variable displays the status of the en- ++ try. Setting it to 'invalid' has the effect of ++ rendering it inoperative. The internal effect ++ (row removal) is implementation dependent." ++ ::= { ospfVirtIfEntry 10 } ++ ++ ++ ospfVirtIfAuthType OBJECT-TYPE ++ SYNTAX INTEGER (0..255) ++ -- none (0), ++ -- simplePassword (1) ++ -- md5 (2) ++ -- reserved for specification by IANA (> 2) ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The authentication type specified for a virtu- ++ al interface. Additional authentication types ++ may be assigned locally." ++ REFERENCE ++ "OSPF Version 2, Appendix E Authentication" ++ DEFVAL { 0 } -- no authentication, by default ++ ::= { ospfVirtIfEntry 11 } ++ ++ ++-- OSPF Neighbor Table ++ ++-- The OSPF Neighbor Table describes all neighbors in ++-- the locality of the subject router. ++ ++ ospfNbrTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF OspfNbrEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "A table of non-virtual neighbor information." ++ REFERENCE ++ "OSPF Version 2, Section 10 The Neighbor Data ++ Structure" ++ ::= { ospf 10 } ++ ++ ++ ospfNbrEntry OBJECT-TYPE ++ SYNTAX OspfNbrEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "The information regarding a single neighbor." ++ REFERENCE ++ "OSPF Version 2, Section 10 The Neighbor Data ++ Structure" ++ INDEX { ospfNbrIpAddr, ospfNbrAddressLessIndex } ++ ::= { ospfNbrTable 1 } ++ ++OspfNbrEntry ::= ++ SEQUENCE { ++ ospfNbrIpAddr ++ IpAddress, ++ ospfNbrAddressLessIndex ++ InterfaceIndex, ++ ospfNbrRtrId ++ RouterID, ++ ospfNbrOptions ++ Integer32, ++ ospfNbrPriority ++ DesignatedRouterPriority, ++ ospfNbrState ++ INTEGER, ++ ospfNbrEvents ++ Counter32, ++ ospfNbrLsRetransQLen ++ Gauge32, ++ ospfNbmaNbrStatus ++ RowStatus, ++ ospfNbmaNbrPermanence ++ INTEGER, ++ ospfNbrHelloSuppressed ++ TruthValue ++ } ++ ++ ospfNbrIpAddr OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The IP address this neighbor is using in its ++ IP Source Address. Note that, on addressless ++ links, this will not be 0.0.0.0, but the ad- ++ dress of another of the neighbor's interfaces." ++ ::= { ospfNbrEntry 1 } ++ ++ ++ ospfNbrAddressLessIndex OBJECT-TYPE ++ SYNTAX InterfaceIndex ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "On an interface having an IP Address, zero. ++ On addressless interfaces, the corresponding ++ value of ifIndex in the Internet Standard MIB. ++ On row creation, this can be derived from the ++ instance." ++ ::= { ospfNbrEntry 2 } ++ ++ ++ ospfNbrRtrId OBJECT-TYPE ++ SYNTAX RouterID ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "A 32-bit integer (represented as a type IpAd- ++ dress) uniquely identifying the neighboring ++ router in the Autonomous System." ++ DEFVAL { '00000000'H } -- 0.0.0.0 ++ ::= { ospfNbrEntry 3 } ++ ++ ++ ospfNbrOptions OBJECT-TYPE ++ SYNTAX Integer32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "A Bit Mask corresponding to the neighbor's op- ++ tions field. ++ ++ Bit 0, if set, indicates that the system will ++ operate on Type of Service metrics other than ++ TOS 0. If zero, the neighbor will ignore all ++ metrics except the TOS 0 metric. ++ ++ Bit 1, if set, indicates that the associated ++ area accepts and operates on external informa- ++ tion; if zero, it is a stub area. ++ ++ Bit 2, if set, indicates that the system is ca- ++ pable of routing IP Multicast datagrams; i.e., ++ that it implements the Multicast Extensions to ++ OSPF. ++ ++ Bit 3, if set, indicates that the associated ++ area is an NSSA. These areas are capable of ++ carrying type 7 external advertisements, which ++ are translated into type 5 external advertise- ++ ments at NSSA borders." ++ REFERENCE ++ "OSPF Version 2, Section 12.1.2 Options" ++ DEFVAL { 0 } ++ ::= { ospfNbrEntry 4 } ++ ++ ++ ospfNbrPriority OBJECT-TYPE ++ SYNTAX DesignatedRouterPriority ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The priority of this neighbor in the designat- ++ ed router election algorithm. The value 0 sig- ++ nifies that the neighbor is not eligible to be- ++ come the designated router on this particular ++ network." ++ DEFVAL { 1 } ++ ::= { ospfNbrEntry 5 } ++ ++ ++ ospfNbrState OBJECT-TYPE ++ SYNTAX INTEGER { ++ down (1), ++ attempt (2), ++ init (3), ++ twoWay (4), ++ exchangeStart (5), ++ exchange (6), ++ loading (7), ++ full (8) ++ } ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The State of the relationship with this Neigh- ++ bor." ++ REFERENCE ++ "OSPF Version 2, Section 10.1 Neighbor States" ++ DEFVAL { down } ++ ::= { ospfNbrEntry 6 } ++ ++ ++ ospfNbrEvents OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of times this neighbor relationship ++ has changed state, or an error has occurred." ++ ::= { ospfNbrEntry 7 } ++ ++ ++ ospfNbrLsRetransQLen OBJECT-TYPE ++ SYNTAX Gauge32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The current length of the retransmission ++ queue." ++ ::= { ospfNbrEntry 8 } ++ ++ ++ ospfNbmaNbrStatus OBJECT-TYPE ++ SYNTAX RowStatus ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "This variable displays the status of the en- ++ try. Setting it to 'invalid' has the effect of ++ rendering it inoperative. The internal effect ++ (row removal) is implementation dependent." ++ ::= { ospfNbrEntry 9 } ++ ++ ++ ospfNbmaNbrPermanence OBJECT-TYPE ++ SYNTAX INTEGER { ++ dynamic (1), -- learned through protocol ++ permanent (2) -- configured address ++ } ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "This variable displays the status of the en- ++ try. 'dynamic' and 'permanent' refer to how ++ the neighbor became known." ++ DEFVAL { permanent } ++ ::= { ospfNbrEntry 10 } ++ ++ ++ ospfNbrHelloSuppressed OBJECT-TYPE ++ SYNTAX TruthValue ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "Indicates whether Hellos are being suppressed ++ to the neighbor" ++ ::= { ospfNbrEntry 11 } ++ ++ ++-- OSPF Virtual Neighbor Table ++ ++-- This table describes all virtual neighbors. ++-- Since Virtual Links are configured in the ++-- virtual interface table, this table is read-only. ++ ++ ospfVirtNbrTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF OspfVirtNbrEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "A table of virtual neighbor information." ++ REFERENCE ++ "OSPF Version 2, Section 15 Virtual Links" ++ ::= { ospf 11 } ++ ++ ++ ospfVirtNbrEntry OBJECT-TYPE ++ SYNTAX OspfVirtNbrEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "Virtual neighbor information." ++ INDEX { ospfVirtNbrArea, ospfVirtNbrRtrId } ++ ::= { ospfVirtNbrTable 1 } ++ ++OspfVirtNbrEntry ::= ++ SEQUENCE { ++ ospfVirtNbrArea ++ AreaID, ++ ospfVirtNbrRtrId ++ RouterID, ++ ospfVirtNbrIpAddr ++ IpAddress, ++ ospfVirtNbrOptions ++ Integer32, ++ ospfVirtNbrState ++ INTEGER, ++ ospfVirtNbrEvents ++ Counter32, ++ ospfVirtNbrLsRetransQLen ++ Gauge32, ++ ospfVirtNbrHelloSuppressed ++ TruthValue ++ } ++ ++ ospfVirtNbrArea OBJECT-TYPE ++ SYNTAX AreaID ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The Transit Area Identifier." ++ ::= { ospfVirtNbrEntry 1 } ++ ++ ++ ospfVirtNbrRtrId OBJECT-TYPE ++ SYNTAX RouterID ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "A 32-bit integer uniquely identifying the ++ neighboring router in the Autonomous System." ++ ::= { ospfVirtNbrEntry 2 } ++ ++ ++ ospfVirtNbrIpAddr OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The IP address this Virtual Neighbor is us- ++ ing." ++ ::= { ospfVirtNbrEntry 3 } ++ ++ ++ ospfVirtNbrOptions OBJECT-TYPE ++ SYNTAX Integer32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "A Bit Mask corresponding to the neighbor's op- ++ tions field. ++ ++ Bit 1, if set, indicates that the system will ++ operate on Type of Service metrics other than ++ TOS 0. If zero, the neighbor will ignore all ++ metrics except the TOS 0 metric. ++ ++ Bit 2, if set, indicates that the system is ++ Network Multicast capable; ie, that it imple- ++ ments OSPF Multicast Routing." ++ ::= { ospfVirtNbrEntry 4 } ++ ospfVirtNbrState OBJECT-TYPE ++ SYNTAX INTEGER { ++ down (1), ++ attempt (2), ++ init (3), ++ twoWay (4), ++ exchangeStart (5), ++ exchange (6), ++ loading (7), ++ full (8) ++ } ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The state of the Virtual Neighbor Relation- ++ ship." ++ ::= { ospfVirtNbrEntry 5 } ++ ++ ++ ospfVirtNbrEvents OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of times this virtual link has ++ changed its state, or an error has occurred." ++ ::= { ospfVirtNbrEntry 6 } ++ ++ ++ ospfVirtNbrLsRetransQLen OBJECT-TYPE ++ SYNTAX Gauge32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The current length of the retransmission ++ queue." ++ ::= { ospfVirtNbrEntry 7 } ++ ++ ++ ospfVirtNbrHelloSuppressed OBJECT-TYPE ++ SYNTAX TruthValue ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "Indicates whether Hellos are being suppressed ++ to the neighbor" ++ ::= { ospfVirtNbrEntry 8 } ++ ++-- OSPF Link State Database, External ++ ++-- The Link State Database contains the Link State ++-- Advertisements from throughout the areas that the ++-- device is attached to. ++ ++-- This table is identical to the OSPF LSDB Table in ++-- format, but contains only External Link State ++-- Advertisements. The purpose is to allow external ++-- LSAs to be displayed once for the router rather ++-- than once in each non-stub area. ++ ++ ospfExtLsdbTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF OspfExtLsdbEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "The OSPF Process's Links State Database." ++ REFERENCE ++ "OSPF Version 2, Section 12 Link State Adver- ++ tisements" ++ ::= { ospf 12 } ++ ++ ++ ospfExtLsdbEntry OBJECT-TYPE ++ SYNTAX OspfExtLsdbEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "A single Link State Advertisement." ++ INDEX { ospfExtLsdbType, ospfExtLsdbLsid, ospfExtLsdbRouterId } ++ ::= { ospfExtLsdbTable 1 } ++ ++OspfExtLsdbEntry ::= ++ SEQUENCE { ++ ospfExtLsdbType ++ INTEGER, ++ ospfExtLsdbLsid ++ IpAddress, ++ ospfExtLsdbRouterId ++ RouterID, ++ ospfExtLsdbSequence ++ Integer32, ++ ospfExtLsdbAge ++ Integer32, ++ ospfExtLsdbChecksum ++ Integer32, ++ ospfExtLsdbAdvertisement ++ OCTET STRING ++ } ++ ++ ospfExtLsdbType OBJECT-TYPE ++ SYNTAX INTEGER { ++ asExternalLink (5) ++ } ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The type of the link state advertisement. ++ Each link state type has a separate advertise- ++ ment format." ++ REFERENCE ++ "OSPF Version 2, Appendix A.4.1 The Link State ++ Advertisement header" ++ ::= { ospfExtLsdbEntry 1 } ++ ++ ++ ospfExtLsdbLsid OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The Link State ID is an LS Type Specific field ++ containing either a Router ID or an IP Address; ++ it identifies the piece of the routing domain ++ that is being described by the advertisement." ++ REFERENCE ++ "OSPF Version 2, Section 12.1.4 Link State ID" ++ ::= { ospfExtLsdbEntry 2 } ++ ++ ++ ospfExtLsdbRouterId OBJECT-TYPE ++ SYNTAX RouterID ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The 32 bit number that uniquely identifies the ++ originating router in the Autonomous System." ++ REFERENCE ++ "OSPF Version 2, Appendix C.1 Global parameters" ++ ::= { ospfExtLsdbEntry 3 } ++ ++-- Note that the OSPF Sequence Number is a 32 bit signed ++-- integer. It starts with the value '80000001'h, ++-- or -'7FFFFFFF'h, and increments until '7FFFFFFF'h ++-- Thus, a typical sequence number will be very negative. ++ ospfExtLsdbSequence OBJECT-TYPE ++ SYNTAX Integer32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The sequence number field is a signed 32-bit ++ integer. It is used to detect old and dupli- ++ cate link state advertisements. The space of ++ sequence numbers is linearly ordered. The ++ larger the sequence number the more recent the ++ advertisement." ++ REFERENCE ++ "OSPF Version 2, Section 12.1.6 LS sequence ++ number" ++ ::= { ospfExtLsdbEntry 4 } ++ ++ ++ ospfExtLsdbAge OBJECT-TYPE ++ SYNTAX Integer32 -- Should be 0..MaxAge ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "This field is the age of the link state adver- ++ tisement in seconds." ++ REFERENCE ++ "OSPF Version 2, Section 12.1.1 LS age" ++ ::= { ospfExtLsdbEntry 5 } ++ ++ ++ ospfExtLsdbChecksum OBJECT-TYPE ++ SYNTAX Integer32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "This field is the checksum of the complete ++ contents of the advertisement, excepting the ++ age field. The age field is excepted so that ++ an advertisement's age can be incremented ++ without updating the checksum. The checksum ++ used is the same that is used for ISO connec- ++ tionless datagrams; it is commonly referred to ++ as the Fletcher checksum." ++ REFERENCE ++ "OSPF Version 2, Section 12.1.7 LS checksum" ++ ::= { ospfExtLsdbEntry 6 } ++ ++ ++ ospfExtLsdbAdvertisement OBJECT-TYPE ++ SYNTAX OCTET STRING (SIZE(36)) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The entire Link State Advertisement, including ++ its header." ++ REFERENCE ++ "OSPF Version 2, Section 12 Link State Adver- ++ tisements" ++ ::= { ospfExtLsdbEntry 7 } ++ ++ ++-- OSPF Use of the CIDR Route Table ++ ++ospfRouteGroup OBJECT IDENTIFIER ::= { ospf 13 } ++ ++-- The IP Forwarding Table defines a number of objects for use by ++-- the routing protocol to externalize its information. Most of ++-- the variables (ipForwardDest, ipForwardMask, ipForwardPolicy, ++-- ipForwardNextHop, ipForwardIfIndex, ipForwardType, ++-- ipForwardProto, ipForwardAge, and ipForwardNextHopAS) are ++-- defined there. ++ ++-- Those that leave some discretion are defined here. ++ ++-- ipCidrRouteProto is, of course, ospf (13). ++ ++-- ipCidrRouteAge is the time since the route was first calculated, ++-- as opposed to the time since the last SPF run. ++ ++-- ipCidrRouteInfo is an OBJECT IDENTIFIER for use by the routing ++-- protocol. The following values shall be found there depending ++-- on the way the route was calculated. ++ ++ospfIntraArea OBJECT IDENTIFIER ::= { ospfRouteGroup 1 } ++ospfInterArea OBJECT IDENTIFIER ::= { ospfRouteGroup 2 } ++ospfExternalType1 OBJECT IDENTIFIER ::= { ospfRouteGroup 3 } ++ospfExternalType2 OBJECT IDENTIFIER ::= { ospfRouteGroup 4 } ++ ++-- ipCidrRouteMetric1 is, by definition, the primary routing ++-- metric. Therefore, it should be the metric that route ++-- selection is based on. For intra-area and inter-area routes, ++-- it is an OSPF metric. For External Type 1 (comparable value) ++-- routes, it is an OSPF metric plus the External Metric. For ++-- external Type 2 (non-comparable value) routes, it is the ++-- external metric. ++ ++-- ipCidrRouteMetric2 is, by definition, a secondary routing ++-- metric. Therefore, it should be the metric that breaks a tie ++-- among routes having equal metric1 values and the same ++-- calculation rule. For intra-area, inter-area routes, and ++-- External Type 1 (comparable value) routes, it is unused. For ++-- external Type 2 (non-comparable value) routes, it is the metric ++-- to the AS border router. ++ ++-- ipCidrRouteMetric3, ipCidrRouteMetric4, and ipCidrRouteMetric5 are ++-- unused. ++ ++-- ++-- The OSPF Area Aggregate Table ++-- ++-- This table replaces the OSPF Area Summary Table, being an ++-- extension of that for CIDR routers. ++ ++ ospfAreaAggregateTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF OspfAreaAggregateEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "A range of IP addresses specified by an IP ++ address/IP network mask pair. For example, ++ class B address range of X.X.X.X with a network ++ mask of 255.255.0.0 includes all IP addresses ++ from X.X.0.0 to X.X.255.255. Note that if ++ ranges are configured such that one range sub- ++ sumes another range (e.g., 10.0.0.0 mask ++ 255.0.0.0 and 10.1.0.0 mask 255.255.0.0), the ++ most specific match is the preferred one." ++ REFERENCE ++ "OSPF Version 2, Appendix C.2 Area parameters" ++ ::= { ospf 14 } ++ ++ ++ ospfAreaAggregateEntry OBJECT-TYPE ++ SYNTAX OspfAreaAggregateEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "A range of IP addresses specified by an IP ++ address/IP network mask pair. For example, ++ class B address range of X.X.X.X with a network ++ mask of 255.255.0.0 includes all IP addresses ++ from X.X.0.0 to X.X.255.255. Note that if ++ ranges are range configured such that one range ++ subsumes another range (e.g., 10.0.0.0 mask ++ 255.0.0.0 and 10.1.0.0 mask 255.255.0.0), the ++ most specific match is the preferred one." ++ REFERENCE ++ "OSPF Version 2, Appendix C.2 Area parameters" ++ INDEX { ospfAreaAggregateAreaID, ospfAreaAggregateLsdbType, ++ ospfAreaAggregateNet, ospfAreaAggregateMask } ++ ::= { ospfAreaAggregateTable 1 } ++ ++ ++OspfAreaAggregateEntry ::= ++ SEQUENCE { ++ ospfAreaAggregateAreaID ++ AreaID, ++ ospfAreaAggregateLsdbType ++ INTEGER, ++ ospfAreaAggregateNet ++ IpAddress, ++ ospfAreaAggregateMask ++ IpAddress, ++ ospfAreaAggregateStatus ++ RowStatus, ++ ospfAreaAggregateEffect ++ INTEGER ++ } ++ ++ ospfAreaAggregateAreaID OBJECT-TYPE ++ SYNTAX AreaID ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The Area the Address Aggregate is to be found ++ within." ++ REFERENCE ++ "OSPF Version 2, Appendix C.2 Area parameters" ++ ::= { ospfAreaAggregateEntry 1 } ++ ++ ++ ospfAreaAggregateLsdbType OBJECT-TYPE ++ SYNTAX INTEGER { ++ summaryLink (3), ++ nssaExternalLink (7) ++ } ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The type of the Address Aggregate. This field ++ specifies the Lsdb type that this Address Ag- ++ gregate applies to." ++ REFERENCE ++ "OSPF Version 2, Appendix A.4.1 The Link State ++ Advertisement header" ++ ::= { ospfAreaAggregateEntry 2 } ++ ++ ++ ospfAreaAggregateNet OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The IP Address of the Net or Subnet indicated ++ by the range." ++ REFERENCE ++ "OSPF Version 2, Appendix C.2 Area parameters" ++ ::= { ospfAreaAggregateEntry 3 } ++ ++ ++ ospfAreaAggregateMask OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The Subnet Mask that pertains to the Net or ++ Subnet." ++ REFERENCE ++ "OSPF Version 2, Appendix C.2 Area parameters" ++ ::= { ospfAreaAggregateEntry 4 } ++ ++ ++ ospfAreaAggregateStatus OBJECT-TYPE ++ SYNTAX RowStatus ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "This variable displays the status of the en- ++ try. Setting it to 'invalid' has the effect of ++ rendering it inoperative. The internal effect ++ (row removal) is implementation dependent." ++ ::= { ospfAreaAggregateEntry 5 } ++ ++ ++ ospfAreaAggregateEffect OBJECT-TYPE ++ SYNTAX INTEGER { ++ advertiseMatching (1), ++ doNotAdvertiseMatching (2) ++ } ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "Subnets subsumed by ranges either trigger the ++ advertisement of the indicated aggregate (ad- ++ vertiseMatching), or result in the subnet's not ++ being advertised at all outside the area." ++ DEFVAL { advertiseMatching } ++ ::= { ospfAreaAggregateEntry 6 } ++ ++ ++-- conformance information ++ ++ospfConformance OBJECT IDENTIFIER ::= { ospf 15 } ++ ++ospfGroups OBJECT IDENTIFIER ::= { ospfConformance 1 } ++ospfCompliances OBJECT IDENTIFIER ::= { ospfConformance 2 } ++ ++-- compliance statements ++ ++ ospfCompliance MODULE-COMPLIANCE ++ STATUS current ++ DESCRIPTION ++ "The compliance statement " ++ MODULE -- this module ++ MANDATORY-GROUPS { ++ ospfBasicGroup, ++ ospfAreaGroup, ++ ospfStubAreaGroup, ++ ospfIfGroup, ++ ospfIfMetricGroup, ++ ospfVirtIfGroup, ++ ospfNbrGroup, ++ ospfVirtNbrGroup, ++ ospfAreaAggregateGroup ++ } ++ ::= { ospfCompliances 1 } ++ ++ ++-- units of conformance ++ ++ ospfBasicGroup OBJECT-GROUP ++ OBJECTS { ++ ospfRouterId, ++ ospfAdminStat, ++ ospfVersionNumber, ++ ospfAreaBdrRtrStatus, ++ ospfASBdrRtrStatus, ++ ospfExternLsaCount, ++ ospfExternLsaCksumSum, ++ ospfTOSSupport, ++ ospfOriginateNewLsas, ++ ospfRxNewLsas, ++ ospfExtLsdbLimit, ++ ospfMulticastExtensions, ++ ospfExitOverflowInterval, ++ ospfDemandExtensions ++ } ++ STATUS current ++ DESCRIPTION ++ "These objects are required for OSPF systems." ++ ::= { ospfGroups 1 } ++ ++ ++ ospfAreaGroup OBJECT-GROUP ++ OBJECTS { ++ ospfAreaId, ++ ospfImportAsExtern, ++ ospfSpfRuns, ++ ospfAreaBdrRtrCount, ++ ospfAsBdrRtrCount, ++ ospfAreaLsaCount, ++ ospfAreaLsaCksumSum, ++ ospfAreaSummary, ++ ospfAreaStatus ++ } ++ STATUS current ++ DESCRIPTION ++ "These objects are required for OSPF systems ++ supporting areas." ++ ::= { ospfGroups 2 } ++ ++ ++ ospfStubAreaGroup OBJECT-GROUP ++ OBJECTS { ++ ospfStubAreaId, ++ ospfStubTOS, ++ ospfStubMetric, ++ ospfStubStatus, ++ ospfStubMetricType ++ } ++ STATUS current ++ DESCRIPTION ++ "These objects are required for OSPF systems ++ supporting stub areas." ++ ::= { ospfGroups 3 } ++ ++ ++ ospfLsdbGroup OBJECT-GROUP ++ OBJECTS { ++ ospfLsdbAreaId, ++ ospfLsdbType, ++ ospfLsdbLsid, ++ ospfLsdbRouterId, ++ ospfLsdbSequence, ++ ospfLsdbAge, ++ ospfLsdbChecksum, ++ ospfLsdbAdvertisement ++ } ++ STATUS current ++ DESCRIPTION ++ "These objects are required for OSPF systems ++ that display their link state database." ++ ::= { ospfGroups 4 } ++ ++ ++ ospfAreaRangeGroup OBJECT-GROUP ++ OBJECTS { ++ ospfAreaRangeAreaId, ++ ospfAreaRangeNet, ++ ospfAreaRangeMask, ++ ospfAreaRangeStatus, ++ ospfAreaRangeEffect ++ } ++ STATUS obsolete ++ DESCRIPTION ++ "These objects are required for non-CIDR OSPF ++ systems that support multiple areas." ++ ::= { ospfGroups 5 } ++ ++ ++ ospfHostGroup OBJECT-GROUP ++ OBJECTS { ++ ospfHostIpAddress, ++ ospfHostTOS, ++ ospfHostMetric, ++ ospfHostStatus, ++ ospfHostAreaID ++ } ++ STATUS current ++ DESCRIPTION ++ "These objects are required for OSPF systems ++ that support attached hosts." ++ ::= { ospfGroups 6 } ++ ++ ++ ospfIfGroup OBJECT-GROUP ++ OBJECTS { ++ ospfIfIpAddress, ++ ospfAddressLessIf, ++ ospfIfAreaId, ++ ospfIfType, ++ ospfIfAdminStat, ++ ospfIfRtrPriority, ++ ospfIfTransitDelay, ++ ospfIfRetransInterval, ++ ospfIfHelloInterval, ++ ospfIfRtrDeadInterval, ++ ospfIfPollInterval, ++ ospfIfState, ++ ospfIfDesignatedRouter, ++ ospfIfBackupDesignatedRouter, ++ ospfIfEvents, ++ ospfIfAuthType, ++ ospfIfAuthKey, ++ ospfIfStatus, ++ ospfIfMulticastForwarding, ++ ospfIfDemand ++ } ++ STATUS current ++ DESCRIPTION ++ "These objects are required for OSPF systems." ++ ::= { ospfGroups 7 } ++ ++ ++ ospfIfMetricGroup OBJECT-GROUP ++ OBJECTS { ++ ospfIfMetricIpAddress, ++ ospfIfMetricAddressLessIf, ++ ospfIfMetricTOS, ++ ospfIfMetricValue, ++ ospfIfMetricStatus ++ } ++ STATUS current ++ DESCRIPTION ++ "These objects are required for OSPF systems." ++ ::= { ospfGroups 8 } ++ ++ ++ ospfVirtIfGroup OBJECT-GROUP ++ OBJECTS { ++ ospfVirtIfAreaId, ++ ospfVirtIfNeighbor, ++ ospfVirtIfTransitDelay, ++ ospfVirtIfRetransInterval, ++ ospfVirtIfHelloInterval, ++ ospfVirtIfRtrDeadInterval, ++ ospfVirtIfState, ++ ospfVirtIfEvents, ++ ospfVirtIfAuthType, ++ ospfVirtIfAuthKey, ++ ospfVirtIfStatus ++ } ++ STATUS current ++ DESCRIPTION ++ "These objects are required for OSPF systems." ++ ::= { ospfGroups 9 } ++ ++ ++ ospfNbrGroup OBJECT-GROUP ++ OBJECTS { ++ ospfNbrIpAddr, ++ ospfNbrAddressLessIndex, ++ ospfNbrRtrId, ++ ospfNbrOptions, ++ ospfNbrPriority, ++ ospfNbrState, ++ ospfNbrEvents, ++ ospfNbrLsRetransQLen, ++ ospfNbmaNbrStatus, ++ ospfNbmaNbrPermanence, ++ ospfNbrHelloSuppressed ++ } ++ STATUS current ++ DESCRIPTION ++ "These objects are required for OSPF systems." ++ ::= { ospfGroups 10 } ++ ++ ++ ospfVirtNbrGroup OBJECT-GROUP ++ OBJECTS { ++ ospfVirtNbrArea, ++ ospfVirtNbrRtrId, ++ ospfVirtNbrIpAddr, ++ ospfVirtNbrOptions, ++ ospfVirtNbrState, ++ ospfVirtNbrEvents, ++ ospfVirtNbrLsRetransQLen, ++ ospfVirtNbrHelloSuppressed ++ } ++ STATUS current ++ DESCRIPTION ++ "These objects are required for OSPF systems." ++ ::= { ospfGroups 11 } ++ ++ ++ ospfExtLsdbGroup OBJECT-GROUP ++ OBJECTS { ++ ospfExtLsdbType, ++ ospfExtLsdbLsid, ++ ospfExtLsdbRouterId, ++ ospfExtLsdbSequence, ++ ospfExtLsdbAge, ++ ospfExtLsdbChecksum, ++ ospfExtLsdbAdvertisement ++ } ++ STATUS current ++ DESCRIPTION ++ "These objects are required for OSPF systems ++ that display their link state database." ++ ::= { ospfGroups 12 } ++ ++ ++ ospfAreaAggregateGroup OBJECT-GROUP ++ OBJECTS { ++ ospfAreaAggregateAreaID, ++ ospfAreaAggregateLsdbType, ++ ospfAreaAggregateNet, ++ ospfAreaAggregateMask, ++ ospfAreaAggregateStatus, ++ ospfAreaAggregateEffect ++ } ++ STATUS current ++ DESCRIPTION ++ "These objects are required for OSPF systems." ++ ::= { ospfGroups 13 } ++ ++END +--- /dev/null ++++ b/mibs/OSPF-TRAP-MIB.txt +@@ -0,0 +1,443 @@ ++OSPF-TRAP-MIB DEFINITIONS ::= BEGIN ++ ++ IMPORTS ++ MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE, IpAddress ++ FROM SNMPv2-SMI ++ MODULE-COMPLIANCE, OBJECT-GROUP ++ FROM SNMPv2-CONF ++ ospfRouterId, ospfIfIpAddress, ospfAddressLessIf, ospfIfState, ++ ospfVirtIfAreaId, ospfVirtIfNeighbor, ospfVirtIfState, ++ ospfNbrIpAddr, ospfNbrAddressLessIndex, ospfNbrRtrId, ++ ospfNbrState, ospfVirtNbrArea, ospfVirtNbrRtrId, ospfVirtNbrState, ++ ospfLsdbType, ospfLsdbLsid, ospfLsdbRouterId, ospfLsdbAreaId, ++ ospfExtLsdbLimit, ospf ++ FROM OSPF-MIB; ++ ++ ospfTrap MODULE-IDENTITY ++ LAST-UPDATED "9501201225Z" -- Fri Jan 20 12:25:50 PST 1995 ++ ORGANIZATION "IETF OSPF Working Group" ++ CONTACT-INFO ++ " Fred Baker ++ Postal: Cisco Systems ++ 519 Lado Drive ++ Santa Barbara, California 93111 ++ Tel: +1 805 681 0115 ++ E-Mail: fred@cisco.com ++ ++ Rob Coltun ++ Postal: RainbowBridge Communications ++ Tel: (301) 340-9416 ++ E-Mail: rcoltun@rainbow-bridge.com" ++ DESCRIPTION ++ "The MIB module to describe traps for the OSPF ++ Version 2 Protocol." ++ ::= { ospf 16 } ++ ++-- Trap Support Objects ++ ++-- The following are support objects for the OSPF traps. ++ ++ospfTrapControl OBJECT IDENTIFIER ::= { ospfTrap 1 } ++ospfTraps OBJECT IDENTIFIER ::= { ospfTrap 2 } ++ ++ ospfSetTrap OBJECT-TYPE ++ SYNTAX OCTET STRING (SIZE(4)) ++ MAX-ACCESS read-write ++ STATUS current ++ DESCRIPTION ++ "A four-octet string serving as a bit map for ++ the trap events defined by the OSPF traps. This ++ object is used to enable and disable specific ++ OSPF traps where a 1 in the bit field ++ represents enabled. The right-most bit (least ++ significant) represents trap 0." ++ ::= { ospfTrapControl 1 } ++ ++ ++ ospfConfigErrorType OBJECT-TYPE ++ SYNTAX INTEGER { ++ badVersion (1), ++ areaMismatch (2), ++ unknownNbmaNbr (3), -- Router is Dr eligible ++ unknownVirtualNbr (4), ++ authTypeMismatch(5), ++ authFailure (6), ++ netMaskMismatch (7), ++ helloIntervalMismatch (8), ++ deadIntervalMismatch (9), ++ optionMismatch (10) } ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "Potential types of configuration conflicts. ++ Used by the ospfConfigError and ospfConfigVir- ++ tError traps." ++ ::= { ospfTrapControl 2 } ++ ++ ++ ospfPacketType OBJECT-TYPE ++ SYNTAX INTEGER { ++ hello (1), ++ dbDescript (2), ++ lsReq (3), ++ lsUpdate (4), ++ lsAck (5) } ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "OSPF packet types." ++ ::= { ospfTrapControl 3 } ++ ++ ++ ospfPacketSrc OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The IP address of an inbound packet that can- ++ not be identified by a neighbor instance." ++ ::= { ospfTrapControl 4 } ++ ++ ++-- Traps ++ ++ ++ ospfIfStateChange NOTIFICATION-TYPE ++ OBJECTS { ++ ospfRouterId, -- The originator of the trap ++ ospfIfIpAddress, ++ ospfAddressLessIf, ++ ospfIfState -- The new state ++ } ++ STATUS current ++ DESCRIPTION ++ "An ospfIfStateChange trap signifies that there ++ has been a change in the state of a non-virtual ++ OSPF interface. This trap should be generated ++ when the interface state regresses (e.g., goes ++ from Dr to Down) or progresses to a terminal ++ state (i.e., Point-to-Point, DR Other, Dr, or ++ Backup)." ++ ::= { ospfTraps 16 } ++ ++ ++ ospfVirtIfStateChange NOTIFICATION-TYPE ++ OBJECTS { ++ ospfRouterId, -- The originator of the trap ++ ospfVirtIfAreaId, ++ ospfVirtIfNeighbor, ++ ospfVirtIfState -- The new state ++ } ++ STATUS current ++ DESCRIPTION ++ "An ospfIfStateChange trap signifies that there ++ has been a change in the state of an OSPF vir- ++ tual interface. ++ This trap should be generated when the inter- ++ face state regresses (e.g., goes from Point- ++ to-Point to Down) or progresses to a terminal ++ state (i.e., Point-to-Point)." ++ ::= { ospfTraps 1 } ++ ++ ++ ospfNbrStateChange NOTIFICATION-TYPE ++ OBJECTS { ++ ospfRouterId, -- The originator of the trap ++ ospfNbrIpAddr, ++ ospfNbrAddressLessIndex, ++ ospfNbrRtrId, ++ ospfNbrState -- The new state ++ } ++ STATUS current ++ DESCRIPTION ++ "An ospfNbrStateChange trap signifies that ++ there has been a change in the state of a non- ++ virtual OSPF neighbor. This trap should be ++ generated when the neighbor state regresses ++ (e.g., goes from Attempt or Full to 1-Way or ++ Down) or progresses to a terminal state (e.g., ++ 2-Way or Full). When an neighbor transitions ++ from or to Full on non-broadcast multi-access ++ and broadcast networks, the trap should be gen- ++ erated by the designated router. A designated ++ router transitioning to Down will be noted by ++ ospfIfStateChange." ++ ::= { ospfTraps 2 } ++ ++ ++ ospfVirtNbrStateChange NOTIFICATION-TYPE ++ OBJECTS { ++ ospfRouterId, -- The originator of the trap ++ ospfVirtNbrArea, ++ ospfVirtNbrRtrId, ++ ospfVirtNbrState -- The new state ++ } ++ STATUS current ++ DESCRIPTION ++ "An ospfIfStateChange trap signifies that there ++ has been a change in the state of an OSPF vir- ++ tual neighbor. This trap should be generated ++ when the neighbor state regresses (e.g., goes ++ from Attempt or Full to 1-Way or Down) or ++ progresses to a terminal state (e.g., Full)." ++ ::= { ospfTraps 3 } ++ ospfIfConfigError NOTIFICATION-TYPE ++ OBJECTS { ++ ospfRouterId, -- The originator of the trap ++ ospfIfIpAddress, ++ ospfAddressLessIf, ++ ospfPacketSrc, -- The source IP address ++ ospfConfigErrorType, -- Type of error ++ ospfPacketType ++ } ++ STATUS current ++ DESCRIPTION ++ "An ospfIfConfigError trap signifies that a ++ packet has been received on a non-virtual in- ++ terface from a router whose configuration ++ parameters conflict with this router's confi- ++ guration parameters. Note that the event op- ++ tionMismatch should cause a trap only if it ++ prevents an adjacency from forming." ++ ::= { ospfTraps 4 } ++ ++ ++ ospfVirtIfConfigError NOTIFICATION-TYPE ++ OBJECTS { ++ ospfRouterId, -- The originator of the trap ++ ospfVirtIfAreaId, ++ ospfVirtIfNeighbor, ++ ospfConfigErrorType, -- Type of error ++ ospfPacketType ++ } ++ STATUS current ++ DESCRIPTION ++ "An ospfConfigError trap signifies that a pack- ++ et has been received on a virtual interface ++ from a router whose configuration parameters ++ conflict with this router's configuration ++ parameters. Note that the event optionMismatch ++ should cause a trap only if it prevents an ad- ++ jacency from forming." ++ ::= { ospfTraps 5 } ++ ++ ++ ospfIfAuthFailure NOTIFICATION-TYPE ++ OBJECTS { ++ ospfRouterId, -- The originator of the trap ++ ospfIfIpAddress, ++ ospfAddressLessIf, ++ ospfPacketSrc, -- The source IP address ++ ospfConfigErrorType, -- authTypeMismatch or ++ -- authFailure ++ ospfPacketType ++ } ++ STATUS current ++ DESCRIPTION ++ "An ospfIfAuthFailure trap signifies that a ++ packet has been received on a non-virtual in- ++ terface from a router whose authentication key ++ or authentication type conflicts with this ++ router's authentication key or authentication ++ type." ++ ::= { ospfTraps 6 } ++ ++ ++ ospfVirtIfAuthFailure NOTIFICATION-TYPE ++ OBJECTS { ++ ospfRouterId, -- The originator of the trap ++ ospfVirtIfAreaId, ++ ospfVirtIfNeighbor, ++ ospfConfigErrorType, -- authTypeMismatch or ++ -- authFailure ++ ospfPacketType ++ } ++ STATUS current ++ DESCRIPTION ++ "An ospfVirtIfAuthFailure trap signifies that a ++ packet has been received on a virtual interface ++ from a router whose authentication key or au- ++ thentication type conflicts with this router's ++ authentication key or authentication type." ++ ::= { ospfTraps 7 } ++ ++ ++ ospfIfRxBadPacket NOTIFICATION-TYPE ++ OBJECTS { ++ ospfRouterId, -- The originator of the trap ++ ospfIfIpAddress, ++ ospfAddressLessIf, ++ ospfPacketSrc, -- The source IP address ++ ospfPacketType ++ } ++ STATUS current ++ DESCRIPTION ++ "An ospfIfRxBadPacket trap signifies that an ++ OSPF packet has been received on a non-virtual ++ interface that cannot be parsed." ++ ::= { ospfTraps 8 } ++ ++ ospfVirtIfRxBadPacket NOTIFICATION-TYPE ++ OBJECTS { ++ ospfRouterId, -- The originator of the trap ++ ospfVirtIfAreaId, ++ ospfVirtIfNeighbor, ++ ospfPacketType ++ } ++ STATUS current ++ DESCRIPTION ++ "An ospfRxBadPacket trap signifies that an OSPF ++ packet has been received on a virtual interface ++ that cannot be parsed." ++ ::= { ospfTraps 9 } ++ ++ ++ ospfTxRetransmit NOTIFICATION-TYPE ++ OBJECTS { ++ ospfRouterId, -- The originator of the trap ++ ospfIfIpAddress, ++ ospfAddressLessIf, ++ ospfNbrRtrId, -- Destination ++ ospfPacketType, ++ ospfLsdbType, ++ ospfLsdbLsid, ++ ospfLsdbRouterId ++ } ++ STATUS current ++ DESCRIPTION ++ "An ospfTxRetransmit trap signifies than an ++ OSPF packet has been retransmitted on a non- ++ virtual interface. All packets that may be re- ++ transmitted are associated with an LSDB entry. ++ The LS type, LS ID, and Router ID are used to ++ identify the LSDB entry." ++ ::= { ospfTraps 10 } ++ ++ ++ ospfVirtIfTxRetransmit NOTIFICATION-TYPE ++ OBJECTS { ++ ospfRouterId, -- The originator of the trap ++ ospfVirtIfAreaId, ++ ospfVirtIfNeighbor, ++ ospfPacketType, ++ ospfLsdbType, ++ ospfLsdbLsid, ++ ospfLsdbRouterId ++ } ++ STATUS current ++ DESCRIPTION ++ "An ospfTxRetransmit trap signifies than an ++ OSPF packet has been retransmitted on a virtual ++ interface. All packets that may be retransmit- ++ ted are associated with an LSDB entry. The LS ++ type, LS ID, and Router ID are used to identify ++ the LSDB entry." ++ ::= { ospfTraps 11 } ++ ++ ++ ospfOriginateLsa NOTIFICATION-TYPE ++ OBJECTS { ++ ospfRouterId, -- The originator of the trap ++ ospfLsdbAreaId, -- 0.0.0.0 for AS Externals ++ ospfLsdbType, ++ ospfLsdbLsid, ++ ospfLsdbRouterId ++ } ++ STATUS current ++ DESCRIPTION ++ "An ospfOriginateLsa trap signifies that a new ++ LSA has been originated by this router. This ++ trap should not be invoked for simple refreshes ++ of LSAs (which happesn every 30 minutes), but ++ instead will only be invoked when an LSA is ++ (re)originated due to a topology change. Addi- ++ tionally, this trap does not include LSAs that ++ are being flushed because they have reached ++ MaxAge." ++ ::= { ospfTraps 12 } ++ ++ ++ ospfMaxAgeLsa NOTIFICATION-TYPE ++ OBJECTS { ++ ospfRouterId, -- The originator of the trap ++ ospfLsdbAreaId, -- 0.0.0.0 for AS Externals ++ ospfLsdbType, ++ ospfLsdbLsid, ++ ospfLsdbRouterId ++ } ++ STATUS current ++ DESCRIPTION ++ "An ospfMaxAgeLsa trap signifies that one of ++ the LSA in the router's link-state database has ++ aged to MaxAge." ++ ::= { ospfTraps 13 } ++ ++ ++ ospfLsdbOverflow NOTIFICATION-TYPE ++ OBJECTS { ++ ospfRouterId, -- The originator of the trap ++ ospfExtLsdbLimit ++ } ++ STATUS current ++ DESCRIPTION ++ "An ospfLsdbOverflow trap signifies that the ++ number of LSAs in the router's link-state data- ++ base has exceeded ospfExtLsdbLimit." ++ ::= { ospfTraps 14 } ++ ++ ++ ospfLsdbApproachingOverflow NOTIFICATION-TYPE ++ OBJECTS { ++ ospfRouterId, -- The originator of the trap ++ ospfExtLsdbLimit ++ } ++ STATUS current ++ DESCRIPTION ++ "An ospfLsdbApproachingOverflow trap signifies ++ that the number of LSAs in the router's link- ++ state database has exceeded ninety percent of ++ ospfExtLsdbLimit." ++ ::= { ospfTraps 15 } ++ ++ ++-- conformance information ++ ++ospfTrapConformance OBJECT IDENTIFIER ::= { ospfTrap 3 } ++ ++ospfTrapGroups OBJECT IDENTIFIER ::= { ospfTrapConformance 1 } ++ospfTrapCompliances OBJECT IDENTIFIER ::= { ospfTrapConformance 2 } ++ ++-- compliance statements ++ ++ ospfTrapCompliance MODULE-COMPLIANCE ++ STATUS current ++ DESCRIPTION ++ "The compliance statement " ++ MODULE -- this module ++ MANDATORY-GROUPS { ospfTrapControlGroup } ++ ++ ++ GROUP ospfTrapControlGroup ++ DESCRIPTION ++ "This group is optional but recommended for all ++ OSPF systems" ++ ::= { ospfTrapCompliances 1 } ++ ++ ++-- units of conformance ++ ++ ospfTrapControlGroup OBJECT-GROUP ++ OBJECTS { ++ ospfSetTrap, ++ ospfConfigErrorType, ++ ospfPacketType, ++ ospfPacketSrc ++ } ++ STATUS current ++ DESCRIPTION ++ "These objects are required to control traps ++ from OSPF systems." ++ ::= { ospfTrapGroups 1 } ++ ++ ++END +--- /dev/null ++++ b/mibs/RIPv2-MIB.txt +@@ -0,0 +1,530 @@ ++ RIPv2-MIB DEFINITIONS ::= BEGIN ++ ++ IMPORTS ++ MODULE-IDENTITY, OBJECT-TYPE, Counter32, ++ TimeTicks, IpAddress FROM SNMPv2-SMI ++ TEXTUAL-CONVENTION, RowStatus FROM SNMPv2-TC ++ MODULE-COMPLIANCE, OBJECT-GROUP FROM SNMPv2-CONF ++ mib-2 FROM RFC1213-MIB; ++ ++ -- This MIB module uses the extended OBJECT-TYPE macro as ++ -- defined in [9]. ++ ++ rip2 MODULE-IDENTITY ++ LAST-UPDATED "9407272253Z" -- Wed Jul 27 22:53:04 PDT 1994 ++ ORGANIZATION "IETF RIP-II Working Group" ++ CONTACT-INFO ++ " Fred Baker ++ Postal: Cisco Systems ++ 519 Lado Drive ++ Santa Barbara, California 93111 ++ Tel: +1 805 681 0115 ++ E-Mail: fbaker@cisco.com ++ ++ Postal: Gary Malkin ++ Xylogics, Inc. ++ 53 Third Avenue ++ Burlington, MA 01803 ++ ++ Phone: (617) 272-8140 ++ EMail: gmalkin@Xylogics.COM" ++ DESCRIPTION ++ "The MIB module to describe the RIP2 Version 2 Protocol" ++ ::= { mib-2 23 } ++ ++ -- RIP-2 Management Information Base ++ ++ -- the RouteTag type represents the contents of the ++ -- Route Domain field in the packet header or route entry. ++ -- The use of the Route Domain is deprecated. ++ ++ RouteTag ::= TEXTUAL-CONVENTION ++ STATUS current ++ DESCRIPTION ++ "the RouteTag type represents the contents of the Route Domain ++ field in the packet header or route entry" ++ SYNTAX OCTET STRING (SIZE (2)) ++ ++--4.1 Global Counters ++ ++-- The RIP-2 Globals Group. ++-- Implementation of this group is mandatory for systems ++-- which implement RIP-2. ++ ++-- These counters are intended to facilitate debugging quickly ++-- changing routes or failing neighbors ++ ++rip2Globals OBJECT IDENTIFIER ::= { rip2 1 } ++ ++ rip2GlobalRouteChanges OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of route changes made to the IP Route ++ Database by RIP. This does not include the refresh ++ of a route's age." ++ ::= { rip2Globals 1 } ++ ++ rip2GlobalQueries OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of responses sent to RIP queries ++ from other systems." ++ ::= { rip2Globals 2 } ++ ++--4.2 RIP Interface Tables ++ ++-- RIP Interfaces Groups ++-- Implementation of these Groups is mandatory for systems ++-- which implement RIP-2. ++ ++-- The RIP Interface Status Table. ++ ++ rip2IfStatTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF Rip2IfStatEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "A list of subnets which require separate ++ status monitoring in RIP." ++ ::= { rip2 2 } ++ ++ rip2IfStatEntry OBJECT-TYPE ++ SYNTAX Rip2IfStatEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "A Single Routing Domain in a single Subnet." ++ INDEX { rip2IfStatAddress } ++ ::= { rip2IfStatTable 1 } ++ ++ Rip2IfStatEntry ::= ++ SEQUENCE { ++ rip2IfStatAddress ++ IpAddress, ++ rip2IfStatRcvBadPackets ++ Counter32, ++ rip2IfStatRcvBadRoutes ++ Counter32, ++ rip2IfStatSentUpdates ++ Counter32, ++ rip2IfStatStatus ++ RowStatus ++ } ++ ++ rip2IfStatAddress OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The IP Address of this system on the indicated ++ subnet. For unnumbered interfaces, the value 0.0.0.N, ++ where the least significant 24 bits (N) is the ifIndex ++ for the IP Interface in network byte order." ++ ::= { rip2IfStatEntry 1 } ++ ++ rip2IfStatRcvBadPackets OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of RIP response packets received by ++ the RIP process which were subsequently discarded ++ for any reason (e.g. a version 0 packet, or an ++ unknown command type)." ++ ::= { rip2IfStatEntry 2 } ++ ++ rip2IfStatRcvBadRoutes OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of routes, in valid RIP packets, ++ which were ignored for any reason (e.g. unknown ++ address family, or invalid metric)." ++ ::= { rip2IfStatEntry 3 } ++ ++ rip2IfStatSentUpdates OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of triggered RIP updates actually ++ sent on this interface. This explicitly does ++ NOT include full updates sent containing new ++ information." ++ ::= { rip2IfStatEntry 4 } ++ ++ rip2IfStatStatus OBJECT-TYPE ++ SYNTAX RowStatus ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "Writing invalid has the effect of deleting ++ this interface." ++ ::= { rip2IfStatEntry 5 } ++ ++-- The RIP Interface Configuration Table. ++ ++ rip2IfConfTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF Rip2IfConfEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "A list of subnets which require separate ++ configuration in RIP." ++ ::= { rip2 3 } ++ ++ rip2IfConfEntry OBJECT-TYPE ++ SYNTAX Rip2IfConfEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "A Single Routing Domain in a single Subnet." ++ INDEX { rip2IfConfAddress } ++ ::= { rip2IfConfTable 1 } ++ ++ Rip2IfConfEntry ::= ++ SEQUENCE { ++ rip2IfConfAddress ++ IpAddress, ++ rip2IfConfDomain ++ RouteTag, ++ rip2IfConfAuthType ++ INTEGER, ++ rip2IfConfAuthKey ++ OCTET STRING (SIZE(0..16)), ++ rip2IfConfSend ++ INTEGER, ++ rip2IfConfReceive ++ INTEGER, ++ rip2IfConfDefaultMetric ++ INTEGER, ++ rip2IfConfStatus ++ RowStatus, ++ rip2IfConfSrcAddress ++ IpAddress ++ } ++ ++ rip2IfConfAddress OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The IP Address of this system on the indicated ++ subnet. For unnumbered interfaces, the value 0.0.0.N, ++ where the least significant 24 bits (N) is the ifIndex ++ for the IP Interface in network byte order." ++ ::= { rip2IfConfEntry 1 } ++ ++ rip2IfConfDomain OBJECT-TYPE ++ SYNTAX RouteTag ++ MAX-ACCESS read-create ++ STATUS obsolete ++ DESCRIPTION ++ "Value inserted into the Routing Domain field ++ of all RIP packets sent on this interface." ++ DEFVAL { '0000'h } ++ ::= { rip2IfConfEntry 2 } ++ ++ rip2IfConfAuthType OBJECT-TYPE ++ SYNTAX INTEGER { ++ noAuthentication (1), ++ simplePassword (2), ++ md5 (3) ++ } ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The type of Authentication used on this ++ interface." ++ DEFVAL { noAuthentication } ++ ::= { rip2IfConfEntry 3 } ++ ++ rip2IfConfAuthKey OBJECT-TYPE ++ SYNTAX OCTET STRING (SIZE(0..16)) ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The value to be used as the Authentication Key ++ whenever the corresponding instance of ++ rip2IfConfAuthType has a value other than ++ noAuthentication. A modification of the corresponding ++ instance of rip2IfConfAuthType does not modify ++ the rip2IfConfAuthKey value. If a string shorter ++ than 16 octets is supplied, it will be left- ++ justified and padded to 16 octets, on the right, ++ with nulls (0x00). ++ ++ Reading this object always results in an OCTET ++ STRING of length zero; authentication may not ++ be bypassed by reading the MIB object." ++ DEFVAL { ''h } ++ ::= { rip2IfConfEntry 4 } ++ ++ rip2IfConfSend OBJECT-TYPE ++ SYNTAX INTEGER { ++ doNotSend (1), ++ ripVersion1 (2), ++ rip1Compatible (3), ++ ripVersion2 (4), ++ ripV1Demand (5), ++ ripV2Demand (6) ++ } ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "What the router sends on this interface. ++ ripVersion1 implies sending RIP updates compliant ++ with RFC 1058. rip1Compatible implies ++ broadcasting RIP-2 updates using RFC 1058 route ++ subsumption rules. ripVersion2 implies ++ multicasting RIP-2 updates. ripV1Demand indicates ++ the use of Demand RIP on a WAN interface under RIP ++ Version 1 rules. ripV2Demand indicates the use of ++ Demand RIP on a WAN interface under Version 2 rules." ++ DEFVAL { rip1Compatible } ++ ::= { rip2IfConfEntry 5 } ++ ++ rip2IfConfReceive OBJECT-TYPE ++ SYNTAX INTEGER { ++ rip1 (1), ++ rip2 (2), ++ rip1OrRip2 (3), ++ doNotRecieve (4) ++ } ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "This indicates which version of RIP updates ++ are to be accepted. Note that rip2 and ++ rip1OrRip2 implies reception of multicast ++ packets." ++ DEFVAL { rip1OrRip2 } ++ ::= { rip2IfConfEntry 6 } ++ ++ rip2IfConfDefaultMetric OBJECT-TYPE ++ SYNTAX INTEGER ( 0..15 ) ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "This variable indicates the metric that is to ++ be used for the default route entry in RIP updates ++ originated on this interface. A value of zero ++ indicates that no default route should be ++ originated; in this case, a default route via ++ another router may be propagated." ++ ::= { rip2IfConfEntry 7 } ++ ++ rip2IfConfStatus OBJECT-TYPE ++ SYNTAX RowStatus ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "Writing invalid has the effect of deleting ++ this interface." ++ ::= { rip2IfConfEntry 8 } ++ ++ rip2IfConfSrcAddress OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-create ++ STATUS current ++ DESCRIPTION ++ "The IP Address this system will use as a source ++ address on this interface. If it is a numbered ++ interface, this MUST be the same value as ++ rip2IfConfAddress. On unnumbered interfaces, ++ it must be the value of rip2IfConfAddress for ++ some interface on the system." ++ ::= { rip2IfConfEntry 9 } ++ ++--4.3 Peer Table ++ ++-- Peer Table ++ ++-- The RIP Peer Group ++-- Implementation of this Group is Optional ++ ++-- This group provides information about active peer ++-- relationships intended to assist in debugging. An ++-- active peer is a router from which a valid RIP ++-- updated has been heard in the last 180 seconds. ++ ++ rip2PeerTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF Rip2PeerEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "A list of RIP Peers." ++ ::= { rip2 4 } ++ ++ rip2PeerEntry OBJECT-TYPE ++ SYNTAX Rip2PeerEntry ++ MAX-ACCESS not-accessible ++ STATUS current ++ DESCRIPTION ++ "Information regarding a single routing peer." ++ INDEX { rip2PeerAddress, rip2PeerDomain } ++ ::= { rip2PeerTable 1 } ++ ++ Rip2PeerEntry ::= ++ SEQUENCE { ++ rip2PeerAddress ++ IpAddress, ++ rip2PeerDomain ++ RouteTag, ++ rip2PeerLastUpdate ++ TimeTicks, ++ rip2PeerVersion ++ INTEGER, ++ rip2PeerRcvBadPackets ++ Counter32, ++ rip2PeerRcvBadRoutes ++ Counter32 ++ } ++ ++ rip2PeerAddress OBJECT-TYPE ++ SYNTAX IpAddress ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The IP Address that the peer is using as its source ++ address. Note that on an unnumbered link, this may ++ not be a member of any subnet on the system." ++ ::= { rip2PeerEntry 1 } ++ ++ rip2PeerDomain OBJECT-TYPE ++ SYNTAX RouteTag ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The value in the Routing Domain field in RIP ++ packets received from the peer. As domain suuport ++ is deprecated, this must be zero." ++ ::= { rip2PeerEntry 2 } ++ ++ rip2PeerLastUpdate OBJECT-TYPE ++ SYNTAX TimeTicks ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The value of sysUpTime when the most recent ++ RIP update was received from this system." ++ ::= { rip2PeerEntry 3 } ++ ++ rip2PeerVersion OBJECT-TYPE ++ SYNTAX INTEGER ( 0..255 ) ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The RIP version number in the header of the ++ last RIP packet received." ++ ::= { rip2PeerEntry 4 } ++ ++ rip2PeerRcvBadPackets OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of RIP response packets from this ++ peer discarded as invalid." ++ ::= { rip2PeerEntry 5 } ++ ++ ++ rip2PeerRcvBadRoutes OBJECT-TYPE ++ SYNTAX Counter32 ++ MAX-ACCESS read-only ++ STATUS current ++ DESCRIPTION ++ "The number of routes from this peer that were ++ ignored because the entry format was invalid." ++ ::= { rip2PeerEntry 6 } ++ ++-- conformance information ++ ++rip2Conformance OBJECT IDENTIFIER ::= { rip2 5 } ++ ++rip2Groups OBJECT IDENTIFIER ::= { rip2Conformance 1 } ++rip2Compliances OBJECT IDENTIFIER ::= { rip2Conformance 2 } ++ ++-- compliance statements ++rip2Compliance MODULE-COMPLIANCE ++ STATUS current ++ DESCRIPTION ++ "The compliance statement " ++ MODULE -- this module ++ MANDATORY-GROUPS { ++ rip2GlobalGroup, ++ rip2IfStatGroup, ++ rip2IfConfGroup, ++ rip2PeerGroup ++ } ++ GROUP rip2GlobalGroup ++ DESCRIPTION ++ "This group defines global controls for RIP-II systems." ++ GROUP rip2IfStatGroup ++ DESCRIPTION ++ "This group defines interface statistics for RIP-II systems." ++ GROUP rip2IfConfGroup ++ DESCRIPTION ++ "This group defines interface configuration for RIP-II systems." ++ GROUP rip2PeerGroup ++ DESCRIPTION ++ "This group defines peer information for RIP-II systems." ++ ::= { rip2Compliances 1 } ++ ++-- units of conformance ++ ++rip2GlobalGroup OBJECT-GROUP ++ OBJECTS { ++ rip2GlobalRouteChanges, ++ rip2GlobalQueries ++ } ++ STATUS current ++ DESCRIPTION ++ "This group defines global controls for RIP-II systems." ++ ::= { rip2Groups 1 } ++rip2IfStatGroup OBJECT-GROUP ++ OBJECTS { ++ rip2IfStatAddress, ++ rip2IfStatRcvBadPackets, ++ rip2IfStatRcvBadRoutes, ++ rip2IfStatSentUpdates, ++ rip2IfStatStatus ++ } ++ STATUS current ++ DESCRIPTION ++ "This group defines interface statistics for RIP-II systems." ++ ::= { rip2Groups 2 } ++rip2IfConfGroup OBJECT-GROUP ++ OBJECTS { ++ rip2IfConfAddress, ++ rip2IfConfAuthType, ++ rip2IfConfAuthKey, ++ rip2IfConfSend, ++ rip2IfConfReceive, ++ rip2IfConfDefaultMetric, ++ rip2IfConfStatus, ++ rip2IfConfSrcAddress ++ } ++ STATUS current ++ DESCRIPTION ++ "This group defines interface configuration for RIP-II systems." ++ ::= { rip2Groups 3 } ++rip2PeerGroup OBJECT-GROUP ++ OBJECTS { ++ rip2PeerAddress, ++ rip2PeerDomain, ++ rip2PeerLastUpdate, ++ rip2PeerVersion, ++ rip2PeerRcvBadPackets, ++ rip2PeerRcvBadRoutes ++ } ++ STATUS current ++ DESCRIPTION ++ "This group defines peer information for RIP-II systems." ++ ::= { rip2Groups 4 } ++END +--- /dev/null ++++ b/mibs/SOURCE-ROUTING-MIB.txt +@@ -0,0 +1,452 @@ ++SOURCE-ROUTING-MIB DEFINITIONS ::= BEGIN ++ ++IMPORTS ++ Counter, Gauge ++ FROM RFC1155-SMI ++ dot1dBridge, dot1dSr ++ FROM BRIDGE-MIB ++ OBJECT-TYPE ++ FROM RFC-1212; ++ ++-- groups in the SR MIB ++ ++-- dot1dSr is imported from the Bridge MIB ++ ++dot1dPortPair OBJECT IDENTIFIER ::= { dot1dBridge 10 } ++ ++-- the dot1dSr group ++ ++-- this group is implemented by those bridges that ++-- support the source route bridging mode, including Source ++-- Routing and SRT bridges. ++ ++dot1dSrPortTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF Dot1dSrPortEntry ++ ACCESS not-accessible ++ STATUS mandatory ++ DESCRIPTION ++ "A table that contains information about every ++ port that is associated with this source route ++ bridge." ++ ::= { dot1dSr 1 } ++ ++dot1dSrPortEntry OBJECT-TYPE ++ SYNTAX Dot1dSrPortEntry ++ ACCESS not-accessible ++ STATUS mandatory ++ DESCRIPTION ++ "A list of information for each port of a source ++ route bridge." ++ INDEX { dot1dSrPort } ++ ++ ::= { dot1dSrPortTable 1 } ++ ++Dot1dSrPortEntry ::= ++ SEQUENCE { ++ dot1dSrPort ++ INTEGER, ++ dot1dSrPortHopCount ++ INTEGER, ++ dot1dSrPortLocalSegment ++ INTEGER, ++ dot1dSrPortBridgeNum ++ INTEGER, ++ dot1dSrPortTargetSegment ++ INTEGER, ++ dot1dSrPortLargestFrame ++ INTEGER, ++ dot1dSrPortSTESpanMode ++ INTEGER, ++ dot1dSrPortSpecInFrames ++ Counter, ++ dot1dSrPortSpecOutFrames ++ Counter, ++ dot1dSrPortApeInFrames ++ Counter, ++ dot1dSrPortApeOutFrames ++ Counter, ++ dot1dSrPortSteInFrames ++ Counter, ++ dot1dSrPortSteOutFrames ++ Counter, ++ dot1dSrPortSegmentMismatchDiscards ++ Counter, ++ dot1dSrPortDuplicateSegmentDiscards ++ Counter, ++ dot1dSrPortHopCountExceededDiscards ++ Counter, ++ dot1dSrPortDupLanIdOrTreeErrors ++ Counter, ++ dot1dSrPortLanIdMismatches ++ Counter ++ } ++ ++dot1dSrPort OBJECT-TYPE ++ SYNTAX INTEGER (1..65535) ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The port number of the port for which this entry ++ ++ contains Source Route management information." ++ ::= { dot1dSrPortEntry 1 } ++ ++dot1dSrPortHopCount OBJECT-TYPE ++ SYNTAX INTEGER ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "The maximum number of routing descriptors allowed ++ in an All Paths or Spanning Tree Explorer frames." ++ ::= { dot1dSrPortEntry 2 } ++ ++dot1dSrPortLocalSegment OBJECT-TYPE ++ SYNTAX INTEGER ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "The segment number that uniquely identifies the ++ segment to which this port is connected. Current ++ source routing protocols limit this value to the ++ range: 0 through 4095. (The value 0 is used by ++ some management applications for special test ++ cases.) A value of 65535 signifies that no segment ++ number is assigned to this port." ++ ::= { dot1dSrPortEntry 3 } ++ ++dot1dSrPortBridgeNum OBJECT-TYPE ++ SYNTAX INTEGER ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "A bridge number uniquely identifies a bridge when ++ more than one bridge is used to span the same two ++ segments. Current source routing protocols limit ++ this value to the range: 0 through 15. A value of ++ 65535 signifies that no bridge number is assigned ++ to this bridge." ++ ::= { dot1dSrPortEntry 4 } ++ ++dot1dSrPortTargetSegment OBJECT-TYPE ++ SYNTAX INTEGER ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "The segment number that corresponds to the target ++ segment this port is considered to be connected to ++ by the bridge. Current source routing protocols ++ limit this value to the range: 0 through 4095. ++ ++ (The value 0 is used by some management ++ applications for special test cases.) A value of ++ 65535 signifies that no target segment is assigned ++ to this port." ++ ::= { dot1dSrPortEntry 5 } ++ ++-- It would be nice if we could use ifMtu as the size of the ++-- largest frame, but we can't because ifMtu is defined to be ++-- the size that the (inter-)network layer can use which can ++-- differ from the MAC layer (especially if several layers of ++-- encapsulation are used). ++ ++dot1dSrPortLargestFrame OBJECT-TYPE ++ SYNTAX INTEGER ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "The maximum size of the INFO field (LLC and ++ above) that this port can send/receive. It does ++ not include any MAC level (framing) octets. The ++ value of this object is used by this bridge to ++ determine whether a modification of the ++ LargestFrame (LF, see [14]) field of the Routing ++ Control field of the Routing Information Field is ++ necessary. ++ ++ 64 valid values are defined by the IEEE 802.5M SRT ++ Addendum: 516, 635, 754, 873, 993, 1112, 1231, ++ 1350, 1470, 1542, 1615, 1688, 1761, 1833, 1906, ++ 1979, 2052, 2345, 2638, 2932, 3225, 3518, 3812, ++ 4105, 4399, 4865, 5331, 5798, 6264, 6730, 7197, ++ 7663, 8130, 8539, 8949, 9358, 9768, 10178, 10587, ++ 10997, 11407, 12199, 12992, 13785, 14578, 15370, ++ 16163, 16956, 17749, 20730, 23711, 26693, 29674, ++ 32655, 35637, 38618, 41600, 44591, 47583, 50575, ++ 53567, 56559, 59551, and 65535. ++ ++ An illegal value will not be accepted by the ++ bridge." ++ ::= { dot1dSrPortEntry 6 } ++ ++dot1dSrPortSTESpanMode OBJECT-TYPE ++ SYNTAX INTEGER { ++ auto-span(1), ++ disabled(2), ++ forced(3) ++ } ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "Determines how this port behaves when presented ++ with a Spanning Tree Explorer frame. The value ++ 'disabled(2)' indicates that the port will not ++ accept or send Spanning Tree Explorer packets; any ++ STE packets received will be silently discarded. ++ The value 'forced(3)' indicates the port will ++ always accept and propagate Spanning Tree Explorer ++ frames. This allows a manually configured ++ Spanning Tree for this class of packet to be ++ configured. Note that unlike transparent ++ bridging, this is not catastrophic to the network ++ if there are loops. The value 'auto-span(1)' can ++ only be returned by a bridge that both implements ++ the Spanning Tree Protocol and has use of the ++ protocol enabled on this port. The behavior of the ++ port for Spanning Tree Explorer frames is ++ determined by the state of dot1dStpPortState. If ++ the port is in the 'forwarding' state, the frame ++ will be accepted or propagated. Otherwise, it ++ will be silently discarded." ++ ::= { dot1dSrPortEntry 7 } ++ ++dot1dSrPortSpecInFrames OBJECT-TYPE ++ SYNTAX Counter ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The number of Specifically Routed frames, also ++ referred to as Source Routed Frames, that have ++ been received from this port's segment." ++ ::= { dot1dSrPortEntry 8 } ++ ++dot1dSrPortSpecOutFrames OBJECT-TYPE ++ SYNTAX Counter ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The number of Specifically Routed frames, also ++ referred to as Source Routed Frames, that this ++ port has transmitted on its segment." ++ ::= { dot1dSrPortEntry 9 } ++ ++dot1dSrPortApeInFrames OBJECT-TYPE ++ SYNTAX Counter ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The number of All Paths Explorer frames, also ++ referred to as All Routes Explorer frames, that ++ have been received by this port from its segment." ++ ::= { dot1dSrPortEntry 10 } ++ ++dot1dSrPortApeOutFrames OBJECT-TYPE ++ SYNTAX Counter ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The number of all Paths Explorer Frames, also ++ referred to as All Routes Explorer frames, that ++ have been transmitted by this port on its ++ segment." ++ ::= { dot1dSrPortEntry 11 } ++ ++dot1dSrPortSteInFrames OBJECT-TYPE ++ SYNTAX Counter ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The number of spanning tree explorer frames that ++ have been received by this port from its segment." ++ ::= { dot1dSrPortEntry 12 } ++ ++dot1dSrPortSteOutFrames OBJECT-TYPE ++ SYNTAX Counter ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The number of spanning tree explorer frames that ++ have been transmitted by this port on its ++ segment." ++ ::= { dot1dSrPortEntry 13 } ++ ++dot1dSrPortSegmentMismatchDiscards OBJECT-TYPE ++ SYNTAX Counter ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The number of explorer frames that have been ++ discarded by this port because the routing ++ descriptor field contained an invalid adjacent ++ segment value." ++ ::= { dot1dSrPortEntry 14 } ++ ++dot1dSrPortDuplicateSegmentDiscards OBJECT-TYPE ++ SYNTAX Counter ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The number of frames that have been discarded by ++ this port because the routing descriptor field ++ contained a duplicate segment identifier." ++ ::= { dot1dSrPortEntry 15 } ++ ++dot1dSrPortHopCountExceededDiscards OBJECT-TYPE ++ SYNTAX Counter ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The number of explorer frames that have been ++ discarded by this port because the Routing ++ Information Field has exceeded the maximum route ++ descriptor length." ++ ::= { dot1dSrPortEntry 16 } ++ ++dot1dSrPortDupLanIdOrTreeErrors OBJECT-TYPE ++ SYNTAX Counter ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The number of duplicate LAN IDs or Tree errors. ++ This helps in detection of problems in networks ++ containing older IBM Source Routing Bridges." ++ ::= { dot1dSrPortEntry 17 } ++ ++dot1dSrPortLanIdMismatches OBJECT-TYPE ++ SYNTAX Counter ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The number of ARE and STE frames that were ++ discarded because the last LAN ID in the routing ++ information field did not equal the LAN-in ID. ++ This error can occur in implementations which do ++ only a LAN-in ID and Bridge Number check instead ++ of a LAN-in ID, Bridge Number, and LAN-out ID ++ check before they forward broadcast frames." ++ ::= { dot1dSrPortEntry 18 } ++ ++-- scalar object in dot1dSr ++ ++dot1dSrBridgeLfMode OBJECT-TYPE ++ SYNTAX INTEGER { ++ mode3(1), ++ mode6(2) ++ } ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "Indicates whether the bridge operates using older ++ 3 bit length negotiation fields or the newer 6 bit ++ length field in its RIF." ++ ::= { dot1dSr 2 } ++ ++-- The Port-Pair Database ++ ++-- Implementation of this group is optional. ++ ++-- This group is implemented by those bridges that support ++-- the direct multiport model of the source route bridging ++-- mode as defined in the IEEE 802.5 SRT Addendum to ++-- 802.1d. ++ ++-- Bridges implementing this group may report 65535 for ++-- dot1dSrPortBridgeNumber and dot1dSrPortTargetSegment, ++-- indicating that those objects are not applicable. ++ ++dot1dPortPairTableSize OBJECT-TYPE ++ SYNTAX Gauge ++ ACCESS read-only ++ STATUS mandatory ++ DESCRIPTION ++ "The total number of entries in the Bridge Port ++ Pair Database." ++ ::= { dot1dPortPair 1 } ++ ++-- the Bridge Port-Pair table ++ ++-- this table represents port pairs within a bridge forming ++-- a unique bridge path, as defined in the IEEE 802.5M SRT ++-- Addendum. ++ ++dot1dPortPairTable OBJECT-TYPE ++ SYNTAX SEQUENCE OF Dot1dPortPairEntry ++ ACCESS not-accessible ++ STATUS mandatory ++ DESCRIPTION ++ "A table that contains information about every ++ ++ port pair database entity associated with this ++ source routing bridge." ++ ::= { dot1dPortPair 2 } ++ ++dot1dPortPairEntry OBJECT-TYPE ++ SYNTAX Dot1dPortPairEntry ++ ACCESS not-accessible ++ STATUS mandatory ++ DESCRIPTION ++ "A list of information for each port pair entity ++ of a bridge." ++ INDEX { dot1dPortPairLowPort, dot1dPortPairHighPort } ++ ::= { dot1dPortPairTable 1 } ++ ++Dot1dPortPairEntry ::= ++ SEQUENCE { ++ dot1dPortPairLowPort ++ INTEGER, ++ dot1dPortPairHighPort ++ INTEGER, ++ dot1dPortPairBridgeNum ++ INTEGER, ++ dot1dPortPairBridgeState ++ INTEGER ++ } ++ ++dot1dPortPairLowPort OBJECT-TYPE ++ SYNTAX INTEGER (1..65535) ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "The port number of the lower numbered port for ++ which this entry contains port pair database ++ information." ++ ::= { dot1dPortPairEntry 1 } ++ ++dot1dPortPairHighPort OBJECT-TYPE ++ SYNTAX INTEGER (1..65535) ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "The port number of the higher numbered port for ++ which this entry contains port pair database ++ information." ++ ::= { dot1dPortPairEntry 2 } ++ ++dot1dPortPairBridgeNum OBJECT-TYPE ++ SYNTAX INTEGER ++ ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "A bridge number that uniquely identifies the path ++ provided by this source routing bridge between the ++ segments connected to dot1dPortPairLowPort and ++ dot1dPortPairHighPort. The purpose of bridge ++ number is to disambiguate between multiple paths ++ connecting the same two LANs." ++ ::= { dot1dPortPairEntry 3 } ++ ++dot1dPortPairBridgeState OBJECT-TYPE ++ SYNTAX INTEGER { ++ enabled(1), ++ disabled(2), ++ invalid(3) ++ } ++ ACCESS read-write ++ STATUS mandatory ++ DESCRIPTION ++ "The state of dot1dPortPairBridgeNum. Writing ++ 'invalid(3)' to this object removes the ++ corresponding entry." ++ ::= { dot1dPortPairEntry 4 } ++ ++END diff --git a/net/net-snmp/patches/160-no_ldconfig.patch b/net/net-snmp/patches/160-no_ldconfig.patch new file mode 100644 index 0000000..6a28ea0 --- /dev/null +++ b/net/net-snmp/patches/160-no_ldconfig.patch @@ -0,0 +1,11 @@ +--- a/configure ++++ b/configure +@@ -10216,7 +10216,7 @@ linux* | k*bsd*-gnu) + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' +- finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' ++ finish_cmds='' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. diff --git a/net/net-snmp/patches/170-ldflags.patch b/net/net-snmp/patches/170-ldflags.patch new file mode 100644 index 0000000..fa32544 --- /dev/null +++ b/net/net-snmp/patches/170-ldflags.patch @@ -0,0 +1,11 @@ +--- a/Makefile.top ++++ b/Makefile.top +@@ -81,7 +81,7 @@ LIBCURRENT = 16 + LIBAGE = 1 + LIBREVISION = 3 + +-LIB_LD_CMD = $(LIBTOOL) --mode=link $(LINKCC) $(CFLAGS) -rpath $(libdir) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) -o ++LIB_LD_CMD = $(LIBTOOL) --mode=link $(LINKCC) $(CFLAGS) -rpath $(libdir) $(LDFLAGS) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) -o + LIB_EXTENSION = la + LIB_VERSION = + LIB_LDCONFIG_CMD = $(LIBTOOL) --mode=finish $(libdir) diff --git a/net/net-snmp/patches/750-ieee802dot11.patch b/net/net-snmp/patches/750-ieee802dot11.patch new file mode 100644 index 0000000..a3c5c0a --- /dev/null +++ b/net/net-snmp/patches/750-ieee802dot11.patch @@ -0,0 +1,6156 @@ +--- /dev/null ++++ b/agent/mibgroup/ieee802dot11.c +@@ -0,0 +1,4915 @@ ++/**************************************************************************** ++* * ++* File Name: ieee802dot11.c * ++* Used By: * ++* * ++* Operating System: * ++* Purpose: * ++* * ++* Comments: * ++* * ++* Author: Larry Simmons * ++* lsimmons@avantcom.com * ++* www.avantcom.com * ++* * ++* Creation Date: 09/02/03 * ++* * ++* Ver Date Inits Modification * ++* ----- -------- ----- ------------ * ++* 0.0.1 09/02/03 LRS created * ++* 0.0.2 09/24/03 LRS wouldn't build after fresh ./configure * ++****************************************************************************/ ++/**************************************************************************** ++* Includes * ++****************************************************************************/ ++#include ++#include ++#include ++#include "ieee802dot11.h" ++#include "iwlib.h" ++ ++/**************************************************************************** ++* Defines * ++****************************************************************************/ ++#define DISPLAYWIEXT // display wireless ext info ++#define TABLE_SIZE 1 ++//#define MINLOADFREQ 15 // min reload frequency in seconds ++#define MINLOADFREQ 5 // min reload frequency in seconds // for testing ++#define PROC_NET_DEV "/proc/net/dev" ++#define PROC_NET_WIRELESS "/proc/net/wireless" ++ ++#ifndef UCHAR ++ typedef unsigned char UCHAR; ++#endif ++ ++/**************************************************************************** ++* Private Functions * ++****************************************************************************/ ++static void loadTables(); ++static void loadWiExt ( int, char *, struct wireless_info * ); ++static void load80211Structs ( int, char *, struct wireless_info * ); ++static void initStructs(); ++ ++// Wireless Extensions Specific Functions ++static void loadWiExtTo80211Structs ( int, char *, struct wireless_info * ); ++static void displayWiExt ( struct wireless_info ); ++ ++// Linked List Functions ++static void addList ( char *, char *, int ); ++static void initLists(); // initialize all the linked lists ++static void flushLists(); // flush all the linked lists ++static void flushList ( char * ); // flush a single linked list ++ ++// Utility Functions ++static int openSocket ( void ); ++static int mWatt2dbm ( int ); ++static char *htob ( char * ); ++static int hasChanged ( char *, int ); ++ ++/**************************************************************************** ++* Private Variables * ++****************************************************************************/ ++static unsigned long lastLoad = 0; // ET in secs at last table load ++ ++static struct avNode *lastNode, *newNode, *np; ++ ++/**************************************************************************** ++* External Functions * ++****************************************************************************/ ++ ++/**************************************************************************** ++* ieee802dot11_variables_oid: * ++* this is the top level oid that we want to register under. This * ++* is essentially a prefix, with the suffix appearing in the * ++* variable below. * ++****************************************************************************/ ++oid ieee802dot11_variables_oid[] = { 1,2,840,10036 }; ++ ++/**************************************************************************** ++* variable7 ieee802dot11_variables: * ++* this variable defines function callbacks and type return information * ++* for the ieee802dot11 mib section * ++****************************************************************************/ ++struct variable7 ieee802dot11_variables[] = { ++/* magic number , variable type , ro/rw , callback fn , L, oidsuffix */ ++#define DOT11STATIONID 3 ++ { DOT11STATIONID , ASN_OCTET_STR , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,1 } }, ++#define DOT11MEDIUMOCCUPANCYLIMIT 4 ++ { DOT11MEDIUMOCCUPANCYLIMIT, ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,2 } }, ++#define DOT11CFPOLLABLE 5 ++ { DOT11CFPOLLABLE , ASN_INTEGER , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,3 } }, ++#define DOT11CFPPERIOD 6 ++ { DOT11CFPPERIOD , ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,4 } }, ++#define DOT11CFPMAXDURATION 7 ++ { DOT11CFPMAXDURATION , ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,5 } }, ++#define DOT11AUTHENTICATIONRESPONSETIMEOUT 8 ++ { DOT11AUTHENTICATIONRESPONSETIMEOUT, ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,6 } }, ++#define DOT11PRIVACYOPTIONIMPLEMENTED 9 ++ { DOT11PRIVACYOPTIONIMPLEMENTED, ASN_INTEGER , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,7 } }, ++#define DOT11POWERMANAGEMENTMODE 10 ++ { DOT11POWERMANAGEMENTMODE, ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,8 } }, ++#define DOT11DESIREDSSID 11 ++ { DOT11DESIREDSSID , ASN_OCTET_STR , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,9 } }, ++#define DOT11DESIREDBSSTYPE 12 ++ { DOT11DESIREDBSSTYPE , ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,10 } }, ++#define DOT11OPERATIONALRATESET 13 ++ { DOT11OPERATIONALRATESET, ASN_OCTET_STR , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,11 } }, ++#define DOT11BEACONPERIOD 14 ++ { DOT11BEACONPERIOD , ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,12 } }, ++#define DOT11DTIMPERIOD 15 ++ { DOT11DTIMPERIOD , ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,13 } }, ++#define DOT11ASSOCIATIONRESPONSETIMEOUT 16 ++ { DOT11ASSOCIATIONRESPONSETIMEOUT, ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,14 } }, ++#define DOT11DISASSOCIATEREASON 17 ++ { DOT11DISASSOCIATEREASON, ASN_INTEGER , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,15 } }, ++#define DOT11DISASSOCIATESTATION 18 ++ { DOT11DISASSOCIATESTATION, ASN_OCTET_STR , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,16 } }, ++#define DOT11DEAUTHENTICATEREASON 19 ++ { DOT11DEAUTHENTICATEREASON, ASN_INTEGER , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,17 } }, ++#define DOT11DEAUTHENTICATESTATION 20 ++ { DOT11DEAUTHENTICATESTATION, ASN_OCTET_STR , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,18 } }, ++#define DOT11AUTHENTICATEFAILSTATUS 21 ++ { DOT11AUTHENTICATEFAILSTATUS, ASN_INTEGER , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,19 } }, ++#define DOT11AUTHENTICATEFAILSTATION 22 ++ { DOT11AUTHENTICATEFAILSTATION, ASN_OCTET_STR , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,20 } }, ++ ++#define DOT11AUTHENTICATIONALGORITHM 26 ++ { DOT11AUTHENTICATIONALGORITHM, ASN_INTEGER , RONLY , var_dot11AuthenticationAlgorithmsTable, 4, { 1,2,1,2 } }, ++#define DOT11AUTHENTICATIONALGORITHMSENABLE 27 ++ { DOT11AUTHENTICATIONALGORITHMSENABLE, ASN_INTEGER , RWRITE, var_dot11AuthenticationAlgorithmsTable, 4, { 1,2,1,3 } }, ++ ++#define DOT11WEPDEFAULTKEYVALUE 31 ++ { DOT11WEPDEFAULTKEYVALUE, ASN_OCTET_STR , RWRITE, var_dot11WEPDefaultKeysTable, 4, { 1,3,1,2 } }, ++ ++#define DOT11WEPKEYMAPPINGADDRESS 35 ++ { DOT11WEPKEYMAPPINGADDRESS, ASN_OCTET_STR , RWRITE, var_dot11WEPKeyMappingsTable, 4, { 1,4,1,2 } }, ++#define DOT11WEPKEYMAPPINGWEPON 36 ++ { DOT11WEPKEYMAPPINGWEPON, ASN_INTEGER , RWRITE, var_dot11WEPKeyMappingsTable, 4, { 1,4,1,3 } }, ++#define DOT11WEPKEYMAPPINGVALUE 37 ++ { DOT11WEPKEYMAPPINGVALUE, ASN_OCTET_STR , RWRITE, var_dot11WEPKeyMappingsTable, 4, { 1,4,1,4 } }, ++#define DOT11WEPKEYMAPPINGSTATUS 38 ++ { DOT11WEPKEYMAPPINGSTATUS, ASN_INTEGER , RWRITE, var_dot11WEPKeyMappingsTable, 4, { 1,4,1,5 } }, ++ ++#define DOT11PRIVACYINVOKED 41 ++ { DOT11PRIVACYINVOKED , ASN_INTEGER , RWRITE, var_dot11PrivacyTable, 4, { 1,5,1,1 } }, ++#define DOT11WEPDEFAULTKEYID 42 ++ { DOT11WEPDEFAULTKEYID, ASN_INTEGER , RWRITE, var_dot11PrivacyTable, 4, { 1,5,1,2 } }, ++#define DOT11WEPKEYMAPPINGLENGTH 43 ++ { DOT11WEPKEYMAPPINGLENGTH, ASN_INTEGER , RWRITE, var_dot11PrivacyTable, 4, { 1,5,1,3 } }, ++#define DOT11EXCLUDEUNENCRYPTED 44 ++ { DOT11EXCLUDEUNENCRYPTED, ASN_INTEGER , RWRITE, var_dot11PrivacyTable, 4, { 1,5,1,4 } }, ++#define DOT11WEPICVERRORCOUNT 45 ++ { DOT11WEPICVERRORCOUNT, ASN_COUNTER , RONLY , var_dot11PrivacyTable, 4, { 1,5,1,5 } }, ++#define DOT11WEPEXCLUDEDCOUNT 46 ++ { DOT11WEPEXCLUDEDCOUNT, ASN_COUNTER , RONLY , var_dot11PrivacyTable, 4, { 1,5,1,6 } }, ++ ++#define DOT11MACADDRESS 49 ++ { DOT11MACADDRESS , ASN_OCTET_STR , RONLY , var_dot11OperationTable, 4, { 2,1,1,1 } }, ++#define DOT11RTSTHRESHOLD 50 ++ { DOT11RTSTHRESHOLD , ASN_INTEGER , RWRITE, var_dot11OperationTable, 4, { 2,1,1,2 } }, ++#define DOT11SHORTRETRYLIMIT 51 ++ { DOT11SHORTRETRYLIMIT, ASN_INTEGER , RWRITE, var_dot11OperationTable, 4, { 2,1,1,3 } }, ++#define DOT11LONGRETRYLIMIT 52 ++ { DOT11LONGRETRYLIMIT , ASN_INTEGER , RWRITE, var_dot11OperationTable, 4, { 2,1,1,4 } }, ++#define DOT11FRAGMENTATIONTHRESHOLD 53 ++ { DOT11FRAGMENTATIONTHRESHOLD, ASN_INTEGER , RWRITE, var_dot11OperationTable, 4, { 2,1,1,5 } }, ++#define DOT11MAXTRANSMITMSDULIFETIME 54 ++ { DOT11MAXTRANSMITMSDULIFETIME, ASN_INTEGER , RWRITE, var_dot11OperationTable, 4, { 2,1,1,6 } }, ++#define DOT11MAXRECEIVELIFETIME 55 ++ { DOT11MAXRECEIVELIFETIME, ASN_INTEGER , RWRITE, var_dot11OperationTable, 4, { 2,1,1,7 } }, ++#define DOT11MANUFACTURERID 56 ++ { DOT11MANUFACTURERID , ASN_OCTET_STR , RONLY , var_dot11OperationTable, 4, { 2,1,1,8 } }, ++#define DOT11PRODUCTID 57 ++ { DOT11PRODUCTID , ASN_OCTET_STR , RONLY , var_dot11OperationTable, 4, { 2,1,1,9 } }, ++ ++#define DOT11TRANSMITTEDFRAGMENTCOUNT 60 ++ { DOT11TRANSMITTEDFRAGMENTCOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,1 } }, ++#define DOT11MULTICASTTRANSMITTEDFRAMECOUNT 61 ++ { DOT11MULTICASTTRANSMITTEDFRAMECOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,2 } }, ++#define DOT11FAILEDCOUNT 62 ++ { DOT11FAILEDCOUNT , ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,3 } }, ++#define DOT11RETRYCOUNT 63 ++ { DOT11RETRYCOUNT , ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,4 } }, ++#define DOT11MULTIPLERETRYCOUNT 64 ++ { DOT11MULTIPLERETRYCOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,5 } }, ++#define DOT11FRAMEDUPLICATECOUNT 65 ++ { DOT11FRAMEDUPLICATECOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,6 } }, ++#define DOT11RTSSUCCESSCOUNT 66 ++ { DOT11RTSSUCCESSCOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,7 } }, ++#define DOT11RTSFAILURECOUNT 67 ++ { DOT11RTSFAILURECOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,8 } }, ++#define DOT11ACKFAILURECOUNT 68 ++ { DOT11ACKFAILURECOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,9 } }, ++#define DOT11RECEIVEDFRAGMENTCOUNT 69 ++ { DOT11RECEIVEDFRAGMENTCOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,10 } }, ++#define DOT11MULTICASTRECEIVEDFRAMECOUNT 70 ++ { DOT11MULTICASTRECEIVEDFRAMECOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,11 } }, ++#define DOT11FCSERRORCOUNT 71 ++ { DOT11FCSERRORCOUNT , ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,12 } }, ++#define DOT11TRANSMITTEDFRAMECOUNT 72 ++ { DOT11TRANSMITTEDFRAMECOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,13 } }, ++#define DOT11WEPUNDECRYPTABLECOUNT 73 ++ { DOT11WEPUNDECRYPTABLECOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,14 } }, ++ ++#define DOT11ADDRESS 77 ++ { DOT11ADDRESS , ASN_OCTET_STR , RWRITE, var_dot11GroupAddressesTable, 4, { 2,3,1,2 } }, ++#define DOT11GROUPADDRESSESSTATUS 78 ++ { DOT11GROUPADDRESSESSTATUS, ASN_INTEGER , RWRITE, var_dot11GroupAddressesTable, 4, { 2,3,1,3 } }, ++ ++#define DOT11RESOURCETYPEIDNAME 79 ++ { DOT11RESOURCETYPEIDNAME, ASN_OCTET_STR , RONLY , var_ieee802dot11, 3, { 3,1,1 } }, ++#define DOT11MANUFACTUREROUI 82 ++ { DOT11MANUFACTUREROUI, ASN_OCTET_STR , RONLY , var_dot11ResourceInfoTable, 5, { 3,1,2,1,1 } }, ++#define DOT11MANUFACTURERNAME 83 ++ { DOT11MANUFACTURERNAME, ASN_OCTET_STR , RONLY , var_dot11ResourceInfoTable, 5, { 3,1,2,1,2 } }, ++#define DOT11MANUFACTURERPRODUCTNAME 84 ++ { DOT11MANUFACTURERPRODUCTNAME, ASN_OCTET_STR , RONLY , var_dot11ResourceInfoTable, 5, { 3,1,2,1,3 } }, ++#define DOT11MANUFACTURERPRODUCTVERSION 85 ++ { DOT11MANUFACTURERPRODUCTVERSION, ASN_OCTET_STR , RONLY , var_dot11ResourceInfoTable, 5, { 3,1,2,1,4 } }, ++ ++#define DOT11PHYTYPE 88 ++ { DOT11PHYTYPE , ASN_INTEGER , RONLY , var_dot11PhyOperationTable, 4, { 4,1,1,1 } }, ++#define DOT11CURRENTREGDOMAIN 89 ++ { DOT11CURRENTREGDOMAIN, ASN_INTEGER , RWRITE, var_dot11PhyOperationTable, 4, { 4,1,1,2 } }, ++#define DOT11TEMPTYPE 90 ++ { DOT11TEMPTYPE , ASN_INTEGER , RONLY , var_dot11PhyOperationTable, 4, { 4,1,1,3 } }, ++#define DOT11CURRENTTXANTENNA 93 ++ { DOT11CURRENTTXANTENNA, ASN_INTEGER , RWRITE, var_dot11PhyAntennaTable, 4, { 4,2,1,1 } }, ++#define DOT11DIVERSITYSUPPORT 94 ++ { DOT11DIVERSITYSUPPORT, ASN_INTEGER , RONLY , var_dot11PhyAntennaTable, 4, { 4,2,1,2 } }, ++#define DOT11CURRENTRXANTENNA 95 ++ { DOT11CURRENTRXANTENNA, ASN_INTEGER , RWRITE, var_dot11PhyAntennaTable, 4, { 4,2,1,3 } }, ++#define DOT11NUMBERSUPPORTEDPOWERLEVELS 98 ++ { DOT11NUMBERSUPPORTEDPOWERLEVELS, ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,1 } }, ++#define DOT11TXPOWERLEVEL1 99 ++ { DOT11TXPOWERLEVEL1 , ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,2 } }, ++#define DOT11TXPOWERLEVEL2 100 ++ { DOT11TXPOWERLEVEL2 , ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,3 } }, ++#define DOT11TXPOWERLEVEL3 101 ++ { DOT11TXPOWERLEVEL3 , ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,4 } }, ++#define DOT11TXPOWERLEVEL4 102 ++ { DOT11TXPOWERLEVEL4 , ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,5 } }, ++#define DOT11TXPOWERLEVEL5 103 ++ { DOT11TXPOWERLEVEL5 , ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,6 } }, ++#define DOT11TXPOWERLEVEL6 104 ++ { DOT11TXPOWERLEVEL6 , ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,7 } }, ++#define DOT11TXPOWERLEVEL7 105 ++ { DOT11TXPOWERLEVEL7 , ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,8 } }, ++#define DOT11TXPOWERLEVEL8 106 ++ { DOT11TXPOWERLEVEL8 , ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,9 } }, ++#define DOT11CURRENTTXPOWERLEVEL 107 ++ { DOT11CURRENTTXPOWERLEVEL, ASN_INTEGER , RWRITE, var_dot11PhyTxPowerTable, 4, { 4,3,1,10 } }, ++ ++#define DOT11HOPTIME 110 ++ { DOT11HOPTIME , ASN_INTEGER , RONLY , var_dot11PhyFHSSTable, 4, { 4,4,1,1 } }, ++#define DOT11CURRENTCHANNELNUMBER 111 ++ { DOT11CURRENTCHANNELNUMBER, ASN_INTEGER , RWRITE, var_dot11PhyFHSSTable, 4, { 4,4,1,2 } }, ++#define DOT11MAXDWELLTIME 112 ++ { DOT11MAXDWELLTIME , ASN_INTEGER , RONLY , var_dot11PhyFHSSTable, 4, { 4,4,1,3 } }, ++#define DOT11CURRENTDWELLTIME 113 ++ { DOT11CURRENTDWELLTIME, ASN_INTEGER , RWRITE, var_dot11PhyFHSSTable, 4, { 4,4,1,4 } }, ++#define DOT11CURRENTSET 114 ++ { DOT11CURRENTSET , ASN_INTEGER , RWRITE, var_dot11PhyFHSSTable, 4, { 4,4,1,5 } }, ++#define DOT11CURRENTPATTERN 115 ++ { DOT11CURRENTPATTERN , ASN_INTEGER , RWRITE, var_dot11PhyFHSSTable, 4, { 4,4,1,6 } }, ++#define DOT11CURRENTINDEX 116 ++ { DOT11CURRENTINDEX , ASN_INTEGER , RWRITE, var_dot11PhyFHSSTable, 4, { 4,4,1,7 } }, ++ ++#define DOT11CURRENTCHANNEL 119 ++ { DOT11CURRENTCHANNEL , ASN_INTEGER , RWRITE, var_dot11PhyDSSSTable, 4, { 4,5,1,1 } }, ++#define DOT11CCAMODESUPPORTED 120 ++ { DOT11CCAMODESUPPORTED, ASN_INTEGER , RONLY , var_dot11PhyDSSSTable, 4, { 4,5,1,2 } }, ++#define DOT11CURRENTCCAMODE 121 ++ { DOT11CURRENTCCAMODE , ASN_INTEGER , RWRITE, var_dot11PhyDSSSTable, 4, { 4,5,1,3 } }, ++#define DOT11EDTHRESHOLD 122 ++ { DOT11EDTHRESHOLD , ASN_INTEGER , RWRITE, var_dot11PhyDSSSTable, 4, { 4,5,1,4 } }, ++ ++#define DOT11CCAWATCHDOGTIMERMAX 125 ++ { DOT11CCAWATCHDOGTIMERMAX, ASN_INTEGER , RWRITE, var_dot11PhyIRTable, 4, { 4,6,1,1 } }, ++#define DOT11CCAWATCHDOGCOUNTMAX 126 ++ { DOT11CCAWATCHDOGCOUNTMAX, ASN_INTEGER , RWRITE, var_dot11PhyIRTable, 4, { 4,6,1,2 } }, ++#define DOT11CCAWATCHDOGTIMERMIN 127 ++ { DOT11CCAWATCHDOGTIMERMIN, ASN_INTEGER , RWRITE, var_dot11PhyIRTable, 4, { 4,6,1,3 } }, ++#define DOT11CCAWATCHDOGCOUNTMIN 128 ++ { DOT11CCAWATCHDOGCOUNTMIN, ASN_INTEGER , RWRITE, var_dot11PhyIRTable, 4, { 4,6,1,4 } }, ++ ++#define DOT11REGDOMAINSSUPPORTVALUE 132 ++ { DOT11REGDOMAINSSUPPORTVALUE, ASN_INTEGER , RONLY , var_dot11RegDomainsSupportedTable, 4, { 4,7,1,2 } }, ++ ++#define DOT11SUPPORTEDTXANTENNA 136 ++ { DOT11SUPPORTEDTXANTENNA, ASN_INTEGER , RWRITE, var_dot11AntennasListTable, 4, { 4,8,1,2 } }, ++#define DOT11SUPPORTEDRXANTENNA 137 ++ { DOT11SUPPORTEDRXANTENNA, ASN_INTEGER , RWRITE, var_dot11AntennasListTable, 4, { 4,8,1,3 } }, ++#define DOT11DIVERSITYSELECTIONRX 138 ++ { DOT11DIVERSITYSELECTIONRX, ASN_INTEGER , RWRITE, var_dot11AntennasListTable, 4, { 4,8,1,4 } }, ++ ++#define DOT11SUPPORTEDDATARATESTXVALUE 142 ++ { DOT11SUPPORTEDDATARATESTXVALUE, ASN_INTEGER , RONLY , var_dot11SupportedDataRatesTxTable, 4, { 4,9,1,2 } }, ++ ++#define DOT11SUPPORTEDDATARATESRXVALUE 146 ++ { DOT11SUPPORTEDDATARATESRXVALUE, ASN_INTEGER , RONLY , var_dot11SupportedDataRatesRxTable, 4, { 4,10,1,2 } }, ++}; ++// ( L = length of the oidsuffix ) ++ ++/**************************************************************************** ++* * ++* init_ieee802dot11() - perform any required initialization * ++* * ++****************************************************************************/ ++void init_ieee802dot11 ( void ) { ++ ++ /* register ourselves with the agent to handle our mib tree */ ++ REGISTER_MIB("ieee802dot11", ieee802dot11_variables, variable7, ++ ieee802dot11_variables_oid); ++ ++ initLists(); ++} ++ ++/**************************************************************************** ++* * ++* shutdown_ieee802dot11() - perform any required cleanup @ shutdown * ++* * ++****************************************************************************/ ++void shutdown_ieee802dot11 ( void ) ++{ ++ flushLists(); ++} ++ ++/**************************************************************************** ++* * ++* var_ieee802dot11() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_ieee802dot11 ( struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method) ++{ ++ loadTables(); ++ ++ if ( header_generic ( vp, name, length, exact,var_len,write_method ) ++ == MATCH_FAILED ) ++ return NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11RESOURCETYPEIDNAME: ++ if ( !haveResourceTypeIDName ) ++ return NULL; ++ *var_len = strlen ( resourceTypeIDName ); ++ return ( UCHAR * ) resourceTypeIDName; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11StationConfigTable() - return a variable value from the table * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11StationConfigTable ( struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method ) ++{ ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ static char MACWork[17]; ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &scList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ sc = ( struct scTbl_data * ) np->data; ++ rName[vp->namelen] = sc->ifIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) { ++ ++ switch ( vp->magic ) { // found requested OID, now check for requested variable ++ case DOT11STATIONID: ++ if ( sc->haveStationID ) found = TRUE; break; ++ case DOT11MEDIUMOCCUPANCYLIMIT: ++ if ( sc->haveMediumOccupancyLimit ) found = TRUE; break; ++ case DOT11CFPOLLABLE: ++ if ( sc->haveCFPPollable ) found = TRUE; break; ++ case DOT11CFPPERIOD: ++ if ( sc->haveCFPPeriod ) found = TRUE; break; ++ case DOT11CFPMAXDURATION: ++ if ( sc->haveMaxDuration ) found = TRUE; break; ++ case DOT11AUTHENTICATIONRESPONSETIMEOUT: ++ if ( sc->haveAuthenticationResponseTimeOut ) found = TRUE; break; ++ case DOT11PRIVACYOPTIONIMPLEMENTED: ++ if ( sc->havePrivacyOptionImplemented ) found = TRUE; break; ++ case DOT11POWERMANAGEMENTMODE: ++ if ( sc->havePowerManagementMode ) found = TRUE; break; ++ case DOT11DESIREDSSID: ++ if ( sc->haveDesiredSSID ) found = TRUE; break; ++ case DOT11DESIREDBSSTYPE: ++ if ( sc->haveDesiredBSSType ) found = TRUE; break; ++ case DOT11OPERATIONALRATESET: ++ if ( sc->haveOperationalRateSet ) found = TRUE; break; ++ case DOT11BEACONPERIOD: ++ if ( sc->haveBeaconPeriod ) found = TRUE; break; ++ case DOT11DTIMPERIOD: ++ if ( sc->haveDTIMPeriod ) found = TRUE; break; ++ case DOT11ASSOCIATIONRESPONSETIMEOUT: ++ if ( sc->haveAssociationResponseTimeOut ) found = TRUE; break; ++ case DOT11DISASSOCIATEREASON: ++ if ( sc->disAssociationReason ) found = TRUE; break; ++ case DOT11DISASSOCIATESTATION: ++ if ( sc->haveDisAssociationStation ) found = TRUE; break; ++ case DOT11DEAUTHENTICATEREASON: ++ if ( sc->deAuthenticationReason ) found = TRUE; break; ++ case DOT11DEAUTHENTICATESTATION: ++ if ( sc->haveDeAuthenticationStation ) found = TRUE; break; ++ case DOT11AUTHENTICATEFAILSTATUS: ++ if ( sc->authenticateFailStatus ) found = TRUE; break; ++ case DOT11AUTHENTICATEFAILSTATION: ++ if ( sc->haveAuthenticateFailStation ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid )); ++ *length = vp->namelen + 1; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11STATIONID: ++// *write_method = write_dot11StationID; ++ MACWork[ 0] = sc->stationID [ 0]; ++ MACWork[ 1] = sc->stationID [ 1]; ++ MACWork[ 2] = sc->stationID [ 3]; ++ MACWork[ 3] = sc->stationID [ 4]; ++ MACWork[ 4] = sc->stationID [ 6]; ++ MACWork[ 5] = sc->stationID [ 7]; ++ MACWork[ 6] = sc->stationID [ 9]; ++ MACWork[ 7] = sc->stationID [10]; ++ MACWork[ 8] = sc->stationID [12]; ++ MACWork[ 9] = sc->stationID [13]; ++ MACWork[10] = sc->stationID [15]; ++ MACWork[11] = sc->stationID [16]; ++ MACWork[12] = '\0'; ++ *var_len = 6; ++ return ( UCHAR * ) htob ( MACWork ); ++ ++ case DOT11MEDIUMOCCUPANCYLIMIT: ++// *write_method = write_dot11MediumOccupancyLimit; ++ sc->mediumOccupancyLimit = 5; ++ return ( UCHAR * ) &sc->mediumOccupancyLimit; ++ ++ case DOT11CFPOLLABLE: ++ return ( UCHAR * ) &sc->CFPPollable; ++ ++ case DOT11CFPPERIOD: ++// *write_method = write_dot11CFPPeriod; ++ return ( UCHAR * ) &sc->CFPPeriod; ++ ++ case DOT11CFPMAXDURATION: ++// *write_method = write_dot11CFPMaxDuration; ++ return ( UCHAR * ) &sc->maxDuration; ++ ++ case DOT11AUTHENTICATIONRESPONSETIMEOUT: ++// *write_method = write_dot11AuthenticationResponseTimeOut; ++ return ( UCHAR * ) &sc->authenticationResponseTimeOut; ++ ++ case DOT11PRIVACYOPTIONIMPLEMENTED: ++ return ( UCHAR * ) &sc->privacyOptionImplemented; ++ ++ case DOT11POWERMANAGEMENTMODE: ++// *write_method = write_dot11PowerManagementMode; ++ return ( UCHAR * ) &sc->powerManagementMode; ++ ++ case DOT11DESIREDSSID: ++// *write_method = write_dot11DesiredSSID; ++ *var_len = strlen ( sc->desiredSSID ); ++ return ( UCHAR * ) sc->desiredSSID; ++ ++ case DOT11DESIREDBSSTYPE: ++// *write_method = write_dot11DesiredBSSType; ++ return ( UCHAR * ) &sc->desiredBSSType; ++ ++ case DOT11OPERATIONALRATESET: ++// *write_method = write_dot11OperationalRateSet; ++ *var_len = strlen ( sc->operationalRateSet ); ++ return ( UCHAR * ) sc->operationalRateSet; ++ ++ case DOT11BEACONPERIOD: ++// *write_method = write_dot11BeaconPeriod; ++ return ( UCHAR * ) &sc->beaconPeriod; ++ ++ case DOT11DTIMPERIOD: ++// *write_method = write_dot11DTIMPeriod; ++ return ( UCHAR * ) &sc->DTIMPeriod; ++ ++ case DOT11ASSOCIATIONRESPONSETIMEOUT: ++// *write_method = write_dot11AssociationResponseTimeOut; ++ return ( UCHAR * ) &sc->associationResponseTimeOut; ++ ++ case DOT11DISASSOCIATEREASON: ++ return ( UCHAR * ) &sc->disAssociationReason; ++ ++ case DOT11DISASSOCIATESTATION: ++ MACWork[ 0] = sc->disAssociationStation[ 0]; ++ MACWork[ 1] = sc->disAssociationStation[ 1]; ++ MACWork[ 2] = sc->disAssociationStation[ 3]; ++ MACWork[ 3] = sc->disAssociationStation[ 4]; ++ MACWork[ 4] = sc->disAssociationStation[ 6]; ++ MACWork[ 5] = sc->disAssociationStation[ 7]; ++ MACWork[ 6] = sc->disAssociationStation[ 9]; ++ MACWork[ 7] = sc->disAssociationStation[10]; ++ MACWork[ 8] = sc->disAssociationStation[12]; ++ MACWork[ 9] = sc->disAssociationStation[13]; ++ MACWork[10] = sc->disAssociationStation[15]; ++ MACWork[11] = sc->disAssociationStation[16]; ++ MACWork[12] = '\0'; ++ *var_len = 6; ++ return ( UCHAR * ) htob ( MACWork ); ++ ++ case DOT11DEAUTHENTICATEREASON: ++ return ( UCHAR * ) &sc->deAuthenticationReason; ++ ++ case DOT11DEAUTHENTICATESTATION: ++ MACWork[ 0] = sc->deAuthenticationStation[ 0]; ++ MACWork[ 1] = sc->deAuthenticationStation[ 1]; ++ MACWork[ 2] = sc->deAuthenticationStation[ 3]; ++ MACWork[ 3] = sc->deAuthenticationStation[ 4]; ++ MACWork[ 4] = sc->deAuthenticationStation[ 6]; ++ MACWork[ 5] = sc->deAuthenticationStation[ 7]; ++ MACWork[ 6] = sc->deAuthenticationStation[ 9]; ++ MACWork[ 7] = sc->deAuthenticationStation[10]; ++ MACWork[ 8] = sc->deAuthenticationStation[12]; ++ MACWork[ 9] = sc->deAuthenticationStation[13]; ++ MACWork[10] = sc->deAuthenticationStation[15]; ++ MACWork[11] = sc->deAuthenticationStation[16]; ++ MACWork[12] = '\0'; ++ *var_len = 6; ++ return ( UCHAR * ) htob ( MACWork ); ++ ++ case DOT11AUTHENTICATEFAILSTATUS: ++ return ( UCHAR * ) &sc->authenticateFailStatus; ++ ++ case DOT11AUTHENTICATEFAILSTATION: ++ MACWork[ 0] = sc->authenticateFailStation[ 0]; ++ MACWork[ 1] = sc->authenticateFailStation[ 1]; ++ MACWork[ 2] = sc->authenticateFailStation[ 3]; ++ MACWork[ 3] = sc->authenticateFailStation[ 4]; ++ MACWork[ 4] = sc->authenticateFailStation[ 6]; ++ MACWork[ 5] = sc->authenticateFailStation[ 7]; ++ MACWork[ 6] = sc->authenticateFailStation[ 9]; ++ MACWork[ 7] = sc->authenticateFailStation[10]; ++ MACWork[ 8] = sc->authenticateFailStation[12]; ++ MACWork[ 9] = sc->authenticateFailStation[13]; ++ MACWork[10] = sc->authenticateFailStation[15]; ++ MACWork[11] = sc->authenticateFailStation[16]; ++ MACWork[12] = '\0'; ++ *var_len = 6; ++ return ( UCHAR * ) htob ( MACWork ); ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11AuthenticationAlgorithmsTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11AuthenticationAlgorithmsTable ( struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method ) ++{ ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &aaList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ aa = ( struct aaTbl_data * ) np->data; ++ rName[vp->namelen + 0] = aa->ifIndex; ++ rName[vp->namelen + 1] = aa->authenticationAlgorithmsIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) > 0 ))) { ++ switch ( vp->magic ) { ++ case DOT11AUTHENTICATIONALGORITHM: ++ if ( aa->haveAuthenticationAlgorithm ) found = TRUE; break; ++ case DOT11AUTHENTICATIONALGORITHMSENABLE: ++ if ( aa->authenticationAlgorithmsEnable ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid )); ++ *length = vp->namelen + 2; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11AUTHENTICATIONALGORITHM: ++ return ( UCHAR * ) &aa->authenticationAlgorithm; ++ ++ case DOT11AUTHENTICATIONALGORITHMSENABLE: ++// *write_method = write_dot11AuthenticationAlgorithmsEnable; ++ return ( UCHAR * ) &aa->authenticationAlgorithmsEnable; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11WEPDefaultKeysTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11WEPDefaultKeysTable ( struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method ) ++{ ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &dfList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ df = ( struct dfTbl_data * ) np->data; ++ rName[vp->namelen + 0] = df->ifIndex; ++ rName[vp->namelen + 1] = df->WEPDefaultKeyIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) > 0 ))) { ++ switch ( vp->magic ) { ++ case DOT11WEPDEFAULTKEYVALUE: ++ if ( df->haveWEPDefaultKeyValue ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid )); ++ *length = vp->namelen + 2; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11WEPDEFAULTKEYVALUE: ++// *write_method = write_dot11WEPDefaultKeyValue; ++ *var_len = strlen ( df->WEPDefaultKeyValue ); ++ return ( UCHAR * ) df->WEPDefaultKeyValue; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11WEPKeyMappingsTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11WEPKeyMappingsTable ( struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method) ++{ ++ static char MACWork[17]; ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &kmList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ km = ( struct kmTbl_data * ) np->data; ++ rName[vp->namelen + 0] = km->ifIndex; ++ rName[vp->namelen + 1] = km->WEPKeyMappingIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) > 0 ))) { ++ switch ( vp->magic ) { ++ case DOT11WEPKEYMAPPINGADDRESS: ++ if ( km->haveWEPKeyMappingAddress ) found = TRUE; break; ++ case DOT11WEPKEYMAPPINGWEPON: ++ if ( km->haveWEPKeyMappingWEPOn ) found = TRUE; break; ++ case DOT11WEPKEYMAPPINGVALUE: ++ if ( km->haveWEPKeyMappingValue ) found = TRUE; break; ++ case DOT11WEPKEYMAPPINGSTATUS: ++ if ( km->haveWEPKeyMappingStatus ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid )); ++ *length = vp->namelen + 2; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11WEPKEYMAPPINGADDRESS: ++// *write_method = write_dot11WEPKeyMappingAddress; ++ MACWork[ 0] = km->WEPKeyMappingAddress[ 0]; ++ MACWork[ 1] = km->WEPKeyMappingAddress[ 1]; ++ MACWork[ 2] = km->WEPKeyMappingAddress[ 3]; ++ MACWork[ 3] = km->WEPKeyMappingAddress[ 4]; ++ MACWork[ 4] = km->WEPKeyMappingAddress[ 6]; ++ MACWork[ 5] = km->WEPKeyMappingAddress[ 7]; ++ MACWork[ 6] = km->WEPKeyMappingAddress[ 9]; ++ MACWork[ 7] = km->WEPKeyMappingAddress[10]; ++ MACWork[ 8] = km->WEPKeyMappingAddress[12]; ++ MACWork[ 9] = km->WEPKeyMappingAddress[13]; ++ MACWork[10] = km->WEPKeyMappingAddress[15]; ++ MACWork[11] = km->WEPKeyMappingAddress[16]; ++ MACWork[12] = '\0'; ++ *var_len = 6; ++ return ( UCHAR * ) htob ( MACWork ); ++ ++ case DOT11WEPKEYMAPPINGWEPON: ++// *write_method = write_dot11WEPKeyMappingWEPOn; ++ return ( UCHAR * ) &km->WEPKeyMappingWEPOn; ++ ++ case DOT11WEPKEYMAPPINGVALUE: ++// *write_method = write_dot11WEPKeyMappingValue; ++ *var_len = strlen ( km->WEPKeyMappingValue ); ++ return ( UCHAR * ) km->WEPKeyMappingValue; ++ ++ case DOT11WEPKEYMAPPINGSTATUS: ++// *write_method = write_dot11WEPKeyMappingStatus; ++ return ( UCHAR * ) &km->WEPKeyMappingStatus; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11PrivacyTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11PrivacyTable ( struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method ) ++{ ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &prList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ pr = ( struct prTbl_data * ) np->data; ++ rName[vp->namelen] = pr->ifIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) { ++ switch ( vp->magic ) { ++ case DOT11PRIVACYINVOKED: ++ if ( pr->havePrivacyInvoked ) found = TRUE; break; ++ case DOT11WEPDEFAULTKEYID: ++ if ( pr->haveWEPDefaultKeyID ) found = TRUE; break; ++ case DOT11WEPKEYMAPPINGLENGTH: ++ if ( pr->haveWEPKeyMappingLength ) found = TRUE; break; ++ case DOT11EXCLUDEUNENCRYPTED: ++ if ( pr->haveExcludeUnencrypted ) found = TRUE; break; ++ case DOT11WEPICVERRORCOUNT: ++ if ( pr->haveWEPICVErrorCount ) found = TRUE; break; ++ case DOT11WEPEXCLUDEDCOUNT: ++ if ( pr->haveWEPExcludedCount ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid )); ++ *length = vp->namelen + 1; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11PRIVACYINVOKED: ++// *write_method = write_dot11PrivacyInvoked; ++ return ( UCHAR * ) &pr->privacyInvoked; ++ ++ case DOT11WEPDEFAULTKEYID: ++// *write_method = write_dot11WEPDefaultKeyID; ++ return ( UCHAR * ) &pr->WEPDefaultKeyID; ++ ++ case DOT11WEPKEYMAPPINGLENGTH: ++// *write_method = write_dot11WEPKeyMappingLength; ++ return ( UCHAR * ) &pr->WEPKeyMappingLength; ++ ++ case DOT11EXCLUDEUNENCRYPTED: ++// *write_method = write_dot11ExcludeUnencrypted; ++ return ( UCHAR * ) &pr->excludeUnencrypted; ++ ++ case DOT11WEPICVERRORCOUNT: ++ return ( UCHAR * ) &pr->WEPICVErrorCount; ++ ++ case DOT11WEPEXCLUDEDCOUNT: ++ return ( UCHAR * ) &pr->WEPExcludedCount; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11OperationTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11OperationTable ( struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method ) ++{ ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ static char MACWork[17]; ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &opList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ op = ( struct opTbl_data * ) np->data; ++ rName[vp->namelen] = op->ifIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) { ++ ++ switch ( vp->magic ) { // found requested OID, now check for requested variable ++ case DOT11MACADDRESS: ++ if ( op->haveMACAddress ) found = TRUE; break; ++ case DOT11RTSTHRESHOLD: ++ if ( op->haveRTSThreshold ) found = TRUE; break; ++ case DOT11SHORTRETRYLIMIT: ++ if ( op->haveShortRetryLimit ) found = TRUE; break; ++ case DOT11LONGRETRYLIMIT: ++ if ( op->haveLongRetryLimit ) found = TRUE; break; ++ case DOT11FRAGMENTATIONTHRESHOLD: ++ if ( op->haveFragmentationThreshold ) found = TRUE; break; ++ case DOT11MAXTRANSMITMSDULIFETIME: ++ if ( op->haveMaxTransmitMSDULifetime ) found = TRUE; break; ++ case DOT11MAXRECEIVELIFETIME: ++ if ( op->haveMaxReceiveLifetime ) found = TRUE; break; ++ case DOT11MANUFACTURERID: ++ if ( op->haveManufacturerID ) found = TRUE; break; ++ case DOT11PRODUCTID: ++ if ( op->haveProductID ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid )); ++ *length = vp->namelen + 1; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11MACADDRESS: ++ MACWork[ 0] = op->MACAddress[ 0]; ++ MACWork[ 1] = op->MACAddress[ 1]; ++ MACWork[ 2] = op->MACAddress[ 3]; ++ MACWork[ 3] = op->MACAddress[ 4]; ++ MACWork[ 4] = op->MACAddress[ 6]; ++ MACWork[ 5] = op->MACAddress[ 7]; ++ MACWork[ 6] = op->MACAddress[ 9]; ++ MACWork[ 7] = op->MACAddress[10]; ++ MACWork[ 8] = op->MACAddress[12]; ++ MACWork[ 9] = op->MACAddress[13]; ++ MACWork[10] = op->MACAddress[15]; ++ MACWork[11] = op->MACAddress[16]; ++ MACWork[12] = '\0'; ++ *var_len = 6; ++ return ( UCHAR * ) htob ( MACWork ); ++ ++ case DOT11RTSTHRESHOLD: ++// *write_method = write_dot11RTSThreshold; ++ return ( UCHAR * ) &op->RTSThreshold; ++ ++ case DOT11SHORTRETRYLIMIT: ++// *write_method = write_dot11ShortRetryLimit; ++ return ( UCHAR * ) &op->shortRetryLimit; ++ ++ case DOT11LONGRETRYLIMIT: ++// *write_method = write_dot11LongRetryLimit; ++ return ( UCHAR * ) &op->longRetryLimit; ++ ++ case DOT11FRAGMENTATIONTHRESHOLD: ++// *write_method = write_dot11FragmentationThreshold; ++ return ( UCHAR * ) &op->fragmentationThreshold; ++ ++ case DOT11MAXTRANSMITMSDULIFETIME: ++// *write_method = write_dot11MaxTransmitMSDULifetime; ++ return ( UCHAR * ) &op->maxTransmitMSDULifetime; ++ ++ case DOT11MAXRECEIVELIFETIME: ++// *write_method = write_dot11MaxReceiveLifetime; ++ return ( UCHAR * ) &op->maxReceiveLifetime; ++ ++ case DOT11MANUFACTURERID: ++ *var_len = strlen ( op->manufacturerID ); ++ return ( UCHAR * ) op->manufacturerID; ++ ++ case DOT11PRODUCTID: ++ *var_len = strlen ( op->productID ); ++ return ( UCHAR * ) op->productID; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11CountersTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11CountersTable(struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method) ++{ ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &coList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ co = ( struct coTbl_data * ) np->data; ++ rName[vp->namelen] = co->ifIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) { ++ switch ( vp->magic ) { ++ case DOT11TRANSMITTEDFRAGMENTCOUNT: ++ if ( co->haveTransmittedFragmentCount ) found = TRUE; break; ++ case DOT11MULTICASTTRANSMITTEDFRAMECOUNT: ++ if ( co->haveTransmittedFrameCount ) found = TRUE; break; ++ case DOT11FAILEDCOUNT: ++ if ( co->haveFailedCount ) found = TRUE; break; ++ case DOT11RETRYCOUNT: ++ if ( co->haveRetryCount ) found = TRUE; break; ++ case DOT11MULTIPLERETRYCOUNT: ++ if ( co->haveMultipleRetryCount ) found = TRUE; break; ++ case DOT11FRAMEDUPLICATECOUNT: ++ if ( co->haveFrameDuplicateCount ) found = TRUE; break; ++ case DOT11RTSSUCCESSCOUNT: ++ if ( co->haveRTSSuccessCount ) found = TRUE; break; ++ case DOT11RTSFAILURECOUNT: ++ if ( co->haveRTSFailureCount ) found = TRUE; break; ++ case DOT11ACKFAILURECOUNT: ++ if ( co->haveACKFailureCount ) found = TRUE; break; ++ case DOT11RECEIVEDFRAGMENTCOUNT: ++ if ( co->haveReceivedFragmentCount ) found = TRUE; break; ++ case DOT11MULTICASTRECEIVEDFRAMECOUNT: ++ if ( co->haveMulticastReceivedFrameCount ) found = TRUE; break; ++ case DOT11FCSERRORCOUNT: ++ if ( co->haveFCSErrorCount ) found = TRUE; break; ++ case DOT11TRANSMITTEDFRAMECOUNT: ++ if ( co->haveTransmittedFrameCount ) found = TRUE; break; ++ case DOT11WEPUNDECRYPTABLECOUNT: ++ if ( co->haveWEPUndecryptableCount ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid )); ++ *length = vp->namelen + 1; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11TRANSMITTEDFRAGMENTCOUNT: return ( UCHAR * ) &co->transmittedFragmentCount; ++ case DOT11MULTICASTTRANSMITTEDFRAMECOUNT: return ( UCHAR * ) &co->transmittedFrameCount; ++ case DOT11FAILEDCOUNT: return ( UCHAR * ) &co->failedCount; ++ case DOT11RETRYCOUNT: return ( UCHAR * ) &co->retryCount; ++ case DOT11MULTIPLERETRYCOUNT: return ( UCHAR * ) &co->multipleRetryCount; ++ case DOT11FRAMEDUPLICATECOUNT: return ( UCHAR * ) &co->frameDuplicateCount; ++ case DOT11RTSSUCCESSCOUNT: return ( UCHAR * ) &co->RTSSuccessCount; ++ case DOT11RTSFAILURECOUNT: return ( UCHAR * ) &co->RTSFailureCount; ++ case DOT11ACKFAILURECOUNT: return ( UCHAR * ) &co->ACKFailureCount; ++ case DOT11RECEIVEDFRAGMENTCOUNT: return ( UCHAR * ) &co->receivedFragmentCount; ++ case DOT11MULTICASTRECEIVEDFRAMECOUNT: return ( UCHAR * ) &co->multicastReceivedFrameCount; ++ case DOT11FCSERRORCOUNT: return ( UCHAR * ) &co->FCSErrorCount; ++ case DOT11TRANSMITTEDFRAMECOUNT: return ( UCHAR * ) &co->transmittedFrameCount; ++ case DOT11WEPUNDECRYPTABLECOUNT: return ( UCHAR * ) &co->WEPUndecryptableCount; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11GroupAddressesTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11GroupAddressesTable(struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method) ++{ ++ static char MACWork[17]; ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &gaList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ ga = ( struct gaTbl_data * ) np->data; ++ rName[vp->namelen + 0] = ga->ifIndex; ++ rName[vp->namelen + 1] = ga->groupAddressesIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) > 0 ))) { ++ switch ( vp->magic ) { ++ case DOT11ADDRESS: ++ if ( ga->haveAddress ) found = TRUE; break; ++ case DOT11GROUPADDRESSESSTATUS: ++ if ( ga->haveGroupAddressesStatus ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid )); ++ *length = vp->namelen + 2; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11ADDRESS: ++// *write_method = write_dot11Address; ++ MACWork[ 0] = ga->address[ 0]; ++ MACWork[ 1] = ga->address[ 1]; ++ MACWork[ 2] = ga->address[ 3]; ++ MACWork[ 3] = ga->address[ 4]; ++ MACWork[ 4] = ga->address[ 6]; ++ MACWork[ 5] = ga->address[ 7]; ++ MACWork[ 6] = ga->address[ 9]; ++ MACWork[ 7] = ga->address[10]; ++ MACWork[ 8] = ga->address[12]; ++ MACWork[ 9] = ga->address[13]; ++ MACWork[10] = ga->address[15]; ++ MACWork[11] = ga->address[16]; ++ MACWork[12] = '\0'; ++ *var_len = 6; ++ return ( UCHAR * ) htob ( MACWork ); ++ ++ case DOT11GROUPADDRESSESSTATUS: ++// *write_method = write_dot11GroupAddressesStatus; ++ return ( UCHAR * ) &ga->groupAddressesStatus; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11ResourceInfoTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11ResourceInfoTable ( struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method ) ++{ ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &riList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ ri = ( struct riTbl_data * ) np->data; ++ rName[vp->namelen] = ri->ifIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) { ++ switch ( vp->magic ) { ++ case DOT11MANUFACTUREROUI: ++ if ( ri->haveManufacturerOUI ) found = TRUE; break; ++ case DOT11MANUFACTURERNAME: ++ if ( ri->haveManufacturerName ) found = TRUE; break; ++ case DOT11MANUFACTURERPRODUCTNAME: ++ if ( ri->haveManufacturerProductName ) found = TRUE; break; ++ case DOT11MANUFACTURERPRODUCTVERSION: ++ if ( ri->haveManufacturerProductVersion ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid )); ++ *length = vp->namelen + 1; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11MANUFACTUREROUI: ++ *var_len = strlen ( ri->manufacturerOUI ); ++ return ( UCHAR * ) ri->manufacturerOUI; ++ ++ case DOT11MANUFACTURERNAME: ++ *var_len = strlen ( ri->manufacturerName ); ++ return ( UCHAR * ) ri->manufacturerName; ++ ++ case DOT11MANUFACTURERPRODUCTNAME: ++ *var_len = strlen ( ri->manufacturerProductName ); ++ return ( UCHAR * ) ri->manufacturerProductName; ++ ++ case DOT11MANUFACTURERPRODUCTVERSION: ++ *var_len = strlen ( ri->manufacturerProductVersion ); ++ return ( UCHAR * ) ri->manufacturerProductVersion; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11PhyOperationTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11PhyOperationTable ( struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method ) ++{ ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &poList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ po = ( struct poTbl_data * ) np->data; ++ rName[vp->namelen] = po->ifIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) { ++ switch ( vp->magic ) { ++ case DOT11PHYTYPE: ++ if ( po->havePHYType ) found = TRUE; break; ++ case DOT11CURRENTREGDOMAIN: ++ if ( po->haveCurrentRegDomain ) found = TRUE; break; ++ case DOT11TEMPTYPE: ++ if ( po->haveTempType ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid )); ++ *length = vp->namelen + 1; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11PHYTYPE: ++ return ( UCHAR * ) &po->PHYType; ++ ++ case DOT11CURRENTREGDOMAIN: ++// *write_method = write_dot11CurrentRegDomain; ++ return ( UCHAR * ) &po->currentRegDomain; ++ ++ case DOT11TEMPTYPE: ++ return ( UCHAR * ) &po->tempType; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11PhyAntennaTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11PhyAntennaTable ( struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method ) ++{ ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &paList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ pa = ( struct paTbl_data * ) np->data; ++ rName[vp->namelen] = pa->ifIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) { ++ switch ( vp->magic ) { ++ case DOT11CURRENTTXANTENNA: ++ if ( pa->haveCurrentTxAntenna ) found = TRUE; break; ++ case DOT11DIVERSITYSUPPORT: ++ if ( pa->haveDiversitySupport ) found = TRUE; break; ++ case DOT11CURRENTRXANTENNA: ++ if ( pa->haveCurrentRxAntenna ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid )); ++ *length = vp->namelen + 1; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11CURRENTTXANTENNA: ++// *write_method = write_dot11CurrentTxAntenna; ++ return ( UCHAR * ) &pa->currentTxAntenna; ++ ++ case DOT11DIVERSITYSUPPORT: ++ return ( UCHAR * ) &pa->diversitySupport; ++ ++ case DOT11CURRENTRXANTENNA: ++// *write_method = write_dot11CurrentRxAntenna; ++ return ( UCHAR * ) &pa->currentRxAntenna; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11PhyTxPowerTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11PhyTxPowerTable ( struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method ) ++{ ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &ptList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ pt = ( struct ptTbl_data * ) np->data; ++ rName[vp->namelen] = pt->ifIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) { ++ switch ( vp->magic ) { ++ case DOT11NUMBERSUPPORTEDPOWERLEVELS: ++ if ( pt->haveNumberSupportedPowerLevels ) found = TRUE; break; ++ case DOT11TXPOWERLEVEL1: ++ if ( pt->haveTxPowerLevel1 ) found = TRUE; break; ++ case DOT11TXPOWERLEVEL2: ++ if ( pt->haveTxPowerLevel2 ) found = TRUE; break; ++ case DOT11TXPOWERLEVEL3: ++ if ( pt->haveTxPowerLevel3 ) found = TRUE; break; ++ case DOT11TXPOWERLEVEL4: ++ if ( pt->haveTxPowerLevel4 ) found = TRUE; break; ++ case DOT11TXPOWERLEVEL5: ++ if ( pt->haveTxPowerLevel5 ) found = TRUE; break; ++ case DOT11TXPOWERLEVEL6: ++ if ( pt->haveTxPowerLevel6 ) found = TRUE; break; ++ case DOT11TXPOWERLEVEL7: ++ if ( pt->haveTxPowerLevel7 ) found = TRUE; break; ++ case DOT11TXPOWERLEVEL8: ++ if ( pt->haveTxPowerLevel8 ) found = TRUE; break; ++ case DOT11CURRENTTXPOWERLEVEL: ++ if ( pt->currentTxPowerLevel ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid )); ++ *length = vp->namelen + 1; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11NUMBERSUPPORTEDPOWERLEVELS: ++ return ( UCHAR * ) &pt->numberSupportedPowerLevels; ++ ++ case DOT11TXPOWERLEVEL1: return ( UCHAR * ) &pt->TxPowerLevel1; ++ case DOT11TXPOWERLEVEL2: return ( UCHAR * ) &pt->TxPowerLevel2; ++ case DOT11TXPOWERLEVEL3: return ( UCHAR * ) &pt->TxPowerLevel3; ++ case DOT11TXPOWERLEVEL4: return ( UCHAR * ) &pt->TxPowerLevel4; ++ case DOT11TXPOWERLEVEL5: return ( UCHAR * ) &pt->TxPowerLevel5; ++ case DOT11TXPOWERLEVEL6: return ( UCHAR * ) &pt->TxPowerLevel6; ++ case DOT11TXPOWERLEVEL7: return ( UCHAR * ) &pt->TxPowerLevel7; ++ case DOT11TXPOWERLEVEL8: return ( UCHAR * ) &pt->TxPowerLevel8; ++ ++ case DOT11CURRENTTXPOWERLEVEL: ++// *write_method = write_dot11CurrentTxPowerLevel; ++ return ( UCHAR * ) &pt->currentTxPowerLevel; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11PhyFHSSTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11PhyFHSSTable ( struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method ) ++{ ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &pfList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ pf = ( struct pfTbl_data * ) np->data; ++ rName[vp->namelen] = pf->ifIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) { ++ switch ( vp->magic ) { ++ case DOT11HOPTIME: ++ if ( pf->haveHopTime ) found = TRUE; break; ++ case DOT11CURRENTCHANNELNUMBER: ++ if ( pf->haveCurrentChannelNumber ) found = TRUE; break; ++ case DOT11MAXDWELLTIME: ++ if ( pf->haveMaxDwellTime ) found = TRUE; break; ++ case DOT11CURRENTDWELLTIME: ++ if ( pf->haveCurrentDwellTime ) found = TRUE; break; ++ case DOT11CURRENTSET: ++ if ( pf->haveCurrentSet ) found = TRUE; break; ++ case DOT11CURRENTPATTERN: ++ if ( pf->haveCurrentPattern ) found = TRUE; break; ++ case DOT11CURRENTINDEX: ++ if ( pf->haveCurrentIndex ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid )); ++ *length = vp->namelen + 1; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11HOPTIME: ++ return ( UCHAR * ) &pf->hopTime; ++ ++ case DOT11CURRENTCHANNELNUMBER: ++// *write_method = write_dot11CurrentChannelNumber; ++ return ( UCHAR * ) &pf->currentChannelNumber; ++ ++ case DOT11MAXDWELLTIME: ++ return ( UCHAR * ) &pf->maxDwellTime; ++ ++ case DOT11CURRENTDWELLTIME: ++// *write_method = write_dot11CurrentDwellTime; ++ return ( UCHAR * ) &pf->currentDwellTime; ++ ++ case DOT11CURRENTSET: ++// *write_method = write_dot11CurrentSet; ++ return ( UCHAR * ) &pf->currentSet; ++ ++ case DOT11CURRENTPATTERN: ++// *write_method = write_dot11CurrentPattern; ++ return ( UCHAR * ) &pf->currentPattern; ++ ++ case DOT11CURRENTINDEX: ++// *write_method = write_dot11CurrentIndex; ++ return ( UCHAR * ) &pf->currentIndex; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11PhyDSSSTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11PhyDSSSTable ( struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method ) ++{ ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &pdList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ pd = ( struct pdTbl_data * ) np->data; ++ rName[vp->namelen] = pd->ifIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) { ++ switch ( vp->magic ) { ++ case DOT11CURRENTCHANNEL: ++ if ( pd->haveCurrentChannel ) found = TRUE; break; ++ case DOT11CCAMODESUPPORTED: ++ if ( pd->haveCCAModeSupported ) found = TRUE; break; ++ case DOT11CURRENTCCAMODE: ++ if ( pd->haveCurrentCCAMode ) found = TRUE; break; ++ case DOT11EDTHRESHOLD: ++ if ( pd->haveEDThreshold ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid )); ++ *length = vp->namelen + 1; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11CURRENTCHANNEL: ++// *write_method = write_dot11CurrentChannel; ++ return ( UCHAR * ) &pd->currentChannel; ++ ++ case DOT11CCAMODESUPPORTED: ++ return ( UCHAR * ) &pd->CCAModeSupported; ++ ++ case DOT11CURRENTCCAMODE: ++// *write_method = write_dot11CurrentCCAMode; ++ return ( UCHAR * ) &pd->currentCCAMode; ++ ++ case DOT11EDTHRESHOLD: ++// *write_method = write_dot11EDThreshold; ++ return ( UCHAR * ) &pd->EDThreshold; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11PhyIRTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11PhyIRTable ( struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method) ++{ ++ ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &piList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ pi = ( struct piTbl_data * ) np->data; ++ rName[vp->namelen] = pi->ifIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) { ++ switch ( vp->magic ) { ++ case DOT11CCAWATCHDOGTIMERMAX: ++ if ( pi->CCAWatchdogTimerMax ) found = TRUE; break; ++ case DOT11CCAWATCHDOGCOUNTMAX: ++ if ( pi->CCAWatchdogCountMax ) found = TRUE; break; ++ case DOT11CCAWATCHDOGTIMERMIN: ++ if ( pi->CCAWatchdogTimerMin ) found = TRUE; break; ++ case DOT11CCAWATCHDOGCOUNTMIN: ++ if ( pi->CCAWatchdogCountMin ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid )); ++ *length = vp->namelen + 1; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11CCAWATCHDOGTIMERMAX: ++// *write_method = write_dot11CCAWatchdogTimerMax; ++ return ( UCHAR * ) &pi->CCAWatchdogTimerMax; ++ ++ case DOT11CCAWATCHDOGCOUNTMAX: ++// *write_method = write_dot11CCAWatchdogCountMax; ++ return ( UCHAR * ) &pi->CCAWatchdogCountMax; ++ ++ case DOT11CCAWATCHDOGTIMERMIN: ++// *write_method = write_dot11CCAWatchdogTimerMin; ++ return ( UCHAR * ) &pi->CCAWatchdogTimerMin; ++ ++ case DOT11CCAWATCHDOGCOUNTMIN: ++// *write_method = write_dot11CCAWatchdogCountMin; ++ return ( UCHAR * ) &pi->CCAWatchdogCountMin; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11RegDomainsSupportedTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11RegDomainsSupportedTable ( struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method) ++{ ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &rdList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ rd = ( struct rdTbl_data * ) np->data; ++ rName[vp->namelen + 0] = rd->ifIndex; ++ rName[vp->namelen + 1] = rd->regDomainsSupportIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) > 0 ))) { ++ switch ( vp->magic ) { ++ case DOT11REGDOMAINSSUPPORTVALUE: ++ if ( rd->haveRegDomainsSupportValue ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid )); ++ *length = vp->namelen + 2; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11REGDOMAINSSUPPORTVALUE: ++ return ( UCHAR * ) &rd->regDomainsSupportValue; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11AntennasListTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11AntennasListTable(struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method) ++{ ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &alList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ al = ( struct alTbl_data * ) np->data; ++ rName[vp->namelen + 0] = al->ifIndex; ++ rName[vp->namelen + 1] = al->antennaListIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) > 0 ))) { ++ switch ( vp->magic ) { ++ case DOT11SUPPORTEDTXANTENNA: ++ if ( al->haveSupportedTxAntenna ) found = TRUE; break; ++ case DOT11SUPPORTEDRXANTENNA: ++ if ( al->haveSupportedRxAntenna ) found = TRUE; break; ++ case DOT11DIVERSITYSELECTIONRX: ++ if ( al->haveDiversitySelectionRx ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid )); ++ *length = vp->namelen + 2; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11SUPPORTEDTXANTENNA: ++// *write_method = write_dot11SupportedTxAntenna; ++ return ( UCHAR * ) &al->supportedTxAntenna; ++ ++ case DOT11SUPPORTEDRXANTENNA: ++// *write_method = write_dot11SupportedRxAntenna; ++ return ( UCHAR * ) &al->supportedRxAntenna; ++ ++ case DOT11DIVERSITYSELECTIONRX: ++// *write_method = write_dot11DiversitySelectionRx; ++ return ( UCHAR * ) &al->diversitySelectionRx; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11SupportedDataRatesTxTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11SupportedDataRatesTxTable ( struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method ) ++{ ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &rtList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ rt = ( struct rtTbl_data * ) np->data; ++ rName[vp->namelen + 0] = rt->ifIndex; ++ rName[vp->namelen + 1] = rt->supportedDataRatesTxIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) > 0 ))) { ++ switch ( vp->magic ) { ++ case DOT11SUPPORTEDDATARATESTXVALUE: ++ if ( rt->haveSupportedDataRatesTxValue ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid )); ++ *length = vp->namelen + 2; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11SUPPORTEDDATARATESTXVALUE: ++ return ( UCHAR * ) &rt->supportedDataRatesTxValue; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++* var_dot11SupportedDataRatesRxTable() - * ++* * ++****************************************************************************/ ++unsigned char * ++var_dot11SupportedDataRatesRxTable ( struct variable *vp, ++ oid *name, ++ size_t *length, ++ int exact, ++ size_t *var_len, ++ WriteMethod **write_method ) ++{ ++ int found = FALSE; ++ oid rName [ MAX_OID_LEN ]; // OID to be returned ++ ++ loadTables(); ++ memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid )); ++ for ( np = LIST_FIRST ( &rrList ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ rr = ( struct rrTbl_data * ) np->data; ++ rName[vp->namelen + 0] = rr->ifIndex; ++ rName[vp->namelen + 1] = rr->supportedDataRatesRxIndex; ++ if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) || ++ ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) > 0 ))) { ++ switch ( vp->magic ) { ++ case DOT11SUPPORTEDDATARATESRXVALUE: ++ if ( rr->haveSupportedDataRatesRxValue ) found = TRUE; break; ++ } ++ } ++ if ( found ) ++ break; ++ } ++ ++ if ( !found ) ++ return NULL; ++ ++ memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid )); ++ *length = vp->namelen + 2; ++ *var_len = sizeof ( long ); ++ *write_method = NULL; ++ ++ switch ( vp->magic ) { ++ ++ case DOT11SUPPORTEDDATARATESRXVALUE: ++ return ( UCHAR * ) &rr->supportedDataRatesRxValue; ++ ++ default: ++ ERROR_MSG ( "" ); ++ } ++ ++ return NULL; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11StationID(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static unsigned char string[SPRINT_MAX_LEN]; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_OCTET_STR ) { ++ fprintf ( stderr, "write to dot11StationID not ASN_OCTET_STR\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( string )) { ++ fprintf ( stderr,"write to dot11StationID: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11MediumOccupancyLimit(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11MediumOccupancyLimit not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr,"write to dot11MediumOccupancyLimit: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11CFPPeriod(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11CFPPeriod not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11CFPPeriod: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11CFPMaxDuration(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11CFPMaxDuration not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11CFPMaxDuration: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11AuthenticationResponseTimeOut(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11AuthenticationResponseTimeOut not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11AuthenticationResponseTimeOut: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11PowerManagementMode(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11PowerManagementMode not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )) { ++ fprintf ( stderr, "write to dot11PowerManagementMode: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11DesiredSSID(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static unsigned char string[SPRINT_MAX_LEN]; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_OCTET_STR ) { ++ fprintf ( stderr, "write to dot11DesiredSSID not ASN_OCTET_STR\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( string )){ ++ fprintf ( stderr, "write to dot11DesiredSSID: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11DesiredBSSType(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11DesiredBSSType not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11DesiredBSSType: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11OperationalRateSet(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static unsigned char string[SPRINT_MAX_LEN]; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_OCTET_STR ) { ++ fprintf ( stderr, "write to dot11OperationalRateSet not ASN_OCTET_STR\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( string )){ ++ fprintf ( stderr, "write to dot11OperationalRateSet: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11BeaconPeriod(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11BeaconPeriod not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr,"write to dot11BeaconPeriod: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11DTIMPeriod(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11DTIMPeriod not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr,"write to dot11DTIMPeriod: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11AssociationResponseTimeOut(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11AssociationResponseTimeOut not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )) { ++ fprintf ( stderr,"write to dot11AssociationResponseTimeOut: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11AuthenticationAlgorithmsEnable(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11AuthenticationAlgorithmsEnable not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr,"write to dot11AuthenticationAlgorithmsEnable: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11WEPDefaultKeyValue(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static unsigned char string[SPRINT_MAX_LEN]; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_OCTET_STR ) { ++ fprintf ( stderr, "write to dot11WEPDefaultKeyValue not ASN_OCTET_STR\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( string )){ ++ fprintf ( stderr,"write to dot11WEPDefaultKeyValue: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11WEPKeyMappingAddress(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static unsigned char string[SPRINT_MAX_LEN]; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_OCTET_STR ) { ++ fprintf ( stderr, "write to dot11WEPKeyMappingAddress not ASN_OCTET_STR\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( string )) { ++ fprintf ( stderr,"write to dot11WEPKeyMappingAddress: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11WEPKeyMappingWEPOn(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11WEPKeyMappingWEPOn not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11WEPKeyMappingWEPOn: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11WEPKeyMappingValue(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static unsigned char string[SPRINT_MAX_LEN]; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_OCTET_STR ) { ++ fprintf ( stderr, "write to dot11WEPKeyMappingValue not ASN_OCTET_STR\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( string )) { ++ fprintf ( stderr, "write to dot11WEPKeyMappingValue: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11WEPKeyMappingStatus(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11WEPKeyMappingStatus not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11WEPKeyMappingStatus: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11PrivacyInvoked(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11PrivacyInvoked not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11PrivacyInvoked: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11WEPDefaultKeyID(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11WEPDefaultKeyID not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11WEPDefaultKeyID: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11WEPKeyMappingLength(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11WEPKeyMappingLength not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11WEPKeyMappingLength: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11ExcludeUnencrypted(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11ExcludeUnencrypted not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr,"write to dot11ExcludeUnencrypted: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11RTSThreshold(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ){ ++ fprintf ( stderr, "write to dot11RTSThreshold not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11RTSThreshold: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11ShortRetryLimit(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11ShortRetryLimit not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11ShortRetryLimit: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11LongRetryLimit(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11LongRetryLimit not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr,"write to dot11LongRetryLimit: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11FragmentationThreshold(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11FragmentationThreshold not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr,"write to dot11FragmentationThreshold: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11MaxTransmitMSDULifetime(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11MaxTransmitMSDULifetime not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11MaxTransmitMSDULifetime: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11MaxReceiveLifetime(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11MaxReceiveLifetime not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11MaxReceiveLifetime: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11Address(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static unsigned char string[SPRINT_MAX_LEN]; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_OCTET_STR ) { ++ fprintf ( stderr, "write to dot11Address not ASN_OCTET_STR\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( string )){ ++ fprintf ( stderr, "write to dot11Address: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11GroupAddressesStatus(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11GroupAddressesStatus not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr,"write to dot11GroupAddressesStatus: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11CurrentRegDomain(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11CurrentRegDomain not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11CurrentRegDomain: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11CurrentTxAntenna(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11CurrentTxAntenna not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11CurrentTxAntenna: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11CurrentRxAntenna(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11CurrentRxAntenna not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr,"write to dot11CurrentRxAntenna: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11CurrentTxPowerLevel(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11CurrentTxPowerLevel not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11CurrentTxPowerLevel: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11CurrentChannelNumber(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11CurrentChannelNumber not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr,"write to dot11CurrentChannelNumber: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11CurrentDwellTime(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11CurrentDwellTime not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11CurrentDwellTime: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11CurrentSet(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11CurrentSet not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11CurrentSet: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11CurrentPattern(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11CurrentPattern not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11CurrentPattern: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11CurrentIndex(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11CurrentIndex not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11CurrentIndex: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11CurrentChannel(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11CurrentChannel not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11CurrentChannel: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11CurrentCCAMode(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11CurrentCCAMode not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr,"write to dot11CurrentCCAMode: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11EDThreshold(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11EDThreshold not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11EDThreshold: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11CCAWatchdogTimerMax(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11CCAWatchdogTimerMax not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11CCAWatchdogTimerMax: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11CCAWatchdogCountMax(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11CCAWatchdogCountMax not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11CCAWatchdogCountMax: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11CCAWatchdogTimerMin(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11CCAWatchdogTimerMin not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11CCAWatchdogTimerMin: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11CCAWatchdogCountMin(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11CCAWatchdogCountMin not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11CCAWatchdogCountMin: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11SupportedTxAntenna(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11SupportedTxAntenna not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11SupportedTxAntenna: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11SupportedRxAntenna(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11SupportedRxAntenna not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr,"write to dot11SupportedRxAntenna: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++int ++write_dot11DiversitySelectionRx(int action, ++ u_char *var_val, ++ u_char var_val_type, ++ size_t var_val_len, ++ u_char *statP, ++ oid *name, ++ size_t name_len) ++{ ++ static long *long_ret; ++ int size; ++ ++ switch ( action ) { ++ ++ case RESERVE1: ++ if ( var_val_type != ASN_INTEGER ) { ++ fprintf ( stderr, "write to dot11DiversitySelectionRx not ASN_INTEGER\n" ); ++ return SNMP_ERR_WRONGTYPE; ++ } ++ if ( var_val_len > sizeof ( long_ret )){ ++ fprintf ( stderr, "write to dot11DiversitySelectionRx: bad length\n" ); ++ return SNMP_ERR_WRONGLENGTH; ++ } ++ break; ++ ++ case RESERVE2: ++ case FREE: ++ case ACTION: ++ case UNDO: ++ break; ++ ++ case COMMIT: ++ break; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++/**************************************************************************** ++* * ++* loadTables() - Load the Tables * ++* * ++****************************************************************************/ ++static void loadTables() ++{ ++ int skfd; // generic raw socket desc ++ struct iwreq wrq; // ioctl request structure ++ struct ifreq ifr; ++ struct timeval et; // elapsed time ++ struct wireless_info info; // workarea for wireless ioctl information ++ FILE *fp; ++ char bfr[1024], ifName[1024]; ++ char *s, *t; ++ ++ gettimeofday ( &et, ( struct timezone * ) 0 ); // get time-of-day ++ if ( et.tv_sec < lastLoad + MINLOADFREQ ) // only reload so often ++ return; ++ lastLoad = et.tv_sec; ++ ++ skfd = openSocket(); // open socket ++ if ( skfd < 0 ) { ++ syslog ( LOG_ERR, "SNMP ieee802dot11.loadTables() - %s\n", "socket open failure" ); ++ return; ++ } ++ ++ flushLists(); ++ ++ // find interfaces in /proc/net/dev and find the wireless interfaces ++ fp = fopen ( PROC_NET_DEV, "r" ); ++ if ( fp ) { ++ while ( fgets ( bfr, sizeof ( bfr ), fp )) { ++ if ( strstr ( bfr, ":" )) { ++ s = bfr; t = ifName; ++ while ( isspace ( *s )) // discard white space ++ *s++; ++ while ( *s != ':' ) // get interface name ++ *t++ = *s++; ++ *t = '\0'; ++ ++ // verify as a wireless device ++ memset (( char * ) &info, 0, sizeof ( struct wireless_info )); ++ strncpy ( wrq.ifr_name, ifName, IFNAMSIZ ); ++ if ( ioctl ( skfd, SIOCGIWNAME, &wrq ) >= 0 ) { ++ printf ( "%s ifName: %s\n", "loadTables() -", ifName ); ++ initStructs(); ++ loadWiExt( skfd, ifName, &info ); ++ displayWiExt ( info ); ++ load80211Structs ( skfd, ifName, &info ); ++ } ++ } ++ } ++ fclose ( fp ); ++ } ++ ++ close ( skfd ); ++} ++ ++/**************************************************************************** ++* * ++* load80211Structs() - load the 802.11 structures * ++* * ++****************************************************************************/ ++static void ++load80211Structs ( int skfd, char *ifName, struct wireless_info *wi ) ++{ ++ int rc, ifIndex = 0; ++ struct ifreq ifr; ++ char MACAddress [ MACADDR_LEN + 1 ]; ++ ++ strcpy ( ifr.ifr_name, ifName ); ++ rc = ioctl ( skfd, SIOCGIFHWADDR, &ifr ); ++ if ( rc >= 0 ) { ++ ++ sprintf ( MACAddress, "%02X:%02X:%02X:%02X:%02X:%02X\0", ++ ( UCHAR ) ifr.ifr_hwaddr.sa_data[0], ( UCHAR ) ifr.ifr_hwaddr.sa_data[1], ++ ( UCHAR ) ifr.ifr_hwaddr.sa_data[2], ( UCHAR ) ifr.ifr_hwaddr.sa_data[3], ++ ( UCHAR ) ifr.ifr_hwaddr.sa_data[4], ( UCHAR ) ifr.ifr_hwaddr.sa_data[5] ); ++ ++ nSc.haveStationID = TRUE; ++ strcpy ( nSc.stationID, MACAddress ); ++ nOp.haveMACAddress = TRUE; ++ strcpy ( nOp.MACAddress, MACAddress ); ++ nRi.haveManufacturerOUI = TRUE; ++ strncpy ( nRi.manufacturerOUI, MACAddress, MAN_OUI_LEN ); ++ ++ ifIndex = if_nametoindex ( ifName ); ++ if ( !ifIndex ) { ++ syslog ( LOG_ERR, "SNMP %s - %s %s\n", ++ "ieee802dot11.load80211Structs()", ifName, "has no ifIndex" ); ++ return; ++ } ++ ++ loadWiExtTo80211Structs ( ifIndex, ifName, wi ); ++ ++ if ( hasChanged (( char * ) &nSc, sizeof ( nSc ))) { ++ nSc.ifIndex = ifIndex; ++ sprintf ( nSc.UID, "%04d\0", nSc.ifIndex ); ++ strcpy ( nSc.ifName, ifName ); ++ addList (( char * ) &scList, ( char * ) &nSc, sizeof ( nSc )); ++ } ++ ++ if ( hasChanged (( char * ) &nPr, sizeof ( nPr ))) { ++ nPr.ifIndex = ifIndex; ++ sprintf ( nPr.UID, "%04d\0", nPr.ifIndex ); ++ strcpy ( nPr.ifName, ifName ); ++ addList (( char * ) &prList, ( char * ) &nPr, sizeof ( nPr )); ++ } ++ ++ if ( hasChanged (( char * ) &nOp, sizeof ( nOp ))) { ++ nOp.ifIndex = ifIndex; ++ sprintf ( nOp.UID, "%04d\0", nOp.ifIndex ); ++ strcpy ( nOp.ifName, ifName ); ++ addList (( char * ) &opList, ( char * ) &nOp, sizeof ( nOp )); ++ } ++ ++ if ( hasChanged (( char * ) &nCo, sizeof ( nCo ))) { ++ nCo.ifIndex = ifIndex; ++ sprintf ( nCo.UID, "%04d\0", nCo.ifIndex ); ++ strcpy ( nCo.ifName, ifName ); ++ addList (( char * ) &coList, ( char * ) &nCo, sizeof ( nCo )); ++ } ++ ++ if ( hasChanged (( char * ) &nRi, sizeof ( nRi ))) { ++ nRi.ifIndex = ifIndex; ++ sprintf ( nRi.UID, "%04d\0", nRi.ifIndex ); ++ strcpy ( nRi.ifName, ifName ); ++ addList (( char * ) &riList, ( char * ) &nRi, sizeof ( nRi )); ++ } ++ ++ if ( hasChanged (( char * ) &nPo, sizeof ( nPo ))) { ++ nPo.ifIndex = ifIndex; ++ sprintf ( nPo.UID, "%04d\0", nPo.ifIndex ); ++ strcpy ( nPo.ifName, ifName ); ++ addList (( char * ) &poList, ( char * ) &nPo, sizeof ( nPo )); ++ } ++ ++ if ( hasChanged (( char * ) &nPa, sizeof ( nPa ))) { ++ nPa.ifIndex = ifIndex; ++ sprintf ( nPa.UID, "%04d\0", nPa.ifIndex ); ++ strcpy ( nPa.ifName, ifName ); ++ addList (( char * ) &paList, ( char * ) &nPa, sizeof ( nPa )); ++ } ++ ++ if ( hasChanged (( char * ) &nPt, sizeof ( nPt ))) { ++ nPt.ifIndex = ifIndex; ++ sprintf ( nPt.UID, "%04d\0", nPt.ifIndex ); ++ strcpy ( nPt.ifName, ifName ); ++ addList (( char * ) &ptList, ( char * ) &nPt, sizeof ( nPt )); ++ } ++ ++ if ( hasChanged (( char * ) &nPf, sizeof ( nPf ))) { ++ nPf.ifIndex = ifIndex; ++ sprintf ( nPf.UID, "%04d\0", nPf.ifIndex ); ++ strcpy ( nPf.ifName, ifName ); ++ addList (( char * ) &pfList, ( char * ) &nPf, sizeof ( nPf )); ++ } ++ ++ if ( hasChanged (( char * ) &nPd, sizeof ( nPd ))) { ++ nPd.ifIndex = ifIndex; ++ sprintf ( nPd.UID, "%04d\0", nPd.ifIndex ); ++ strcpy ( nPd.ifName, ifName ); ++ addList (( char * ) &pdList, ( char * ) &nPd, sizeof ( nPd )); ++ } ++ ++ if ( hasChanged (( char * ) &nPi, sizeof ( nPi ))) { ++ nPi.ifIndex = ifIndex; ++ sprintf ( nPi.UID, "%04d\0", nPi.ifIndex ); ++ strcpy ( nPi.ifName, ifName ); ++ addList (( char * ) &piList, ( char * ) &nPi, sizeof ( nPi )); ++ } ++ } ++ ++//printf ( "%s - ifIndex: %d ifName: %s UID: %s\n", ++// "load80211Structs() - HASCHANGED", ifIndex, ifName, nSc.UID ); ++} ++ ++/**************************************************************************** ++* * ++* initStructs() - initialize structures * ++* * ++****************************************************************************/ ++static void initStructs() ++{ ++ int i; ++ ++ // 802.11 MIB Stuctures ++ memset (( char * ) &nSc, 0, sizeof ( nSc )); memset (( char * ) &nAa, 0, sizeof ( nAa )); ++ memset (( char * ) &nDf, 0, sizeof ( nDf )); memset (( char * ) &nKm, 0, sizeof ( nKm )); ++ memset (( char * ) &nPr, 0, sizeof ( nPr )); memset (( char * ) &nOp, 0, sizeof ( nOp )); ++ memset (( char * ) &nCo, 0, sizeof ( nCo )); memset (( char * ) &nGa, 0, sizeof ( nGa )); ++ memset (( char * ) &nRi, 0, sizeof ( nRi )); memset (( char * ) &nPo, 0, sizeof ( nPo )); ++ memset (( char * ) &nPa, 0, sizeof ( nPa )); memset (( char * ) &nPt, 0, sizeof ( nPt )); ++ memset (( char * ) &nPf, 0, sizeof ( nPf )); memset (( char * ) &nPd, 0, sizeof ( nPd )); ++ memset (( char * ) &nPi, 0, sizeof ( nPi )); memset (( char * ) &nRd, 0, sizeof ( nRd )); ++ memset (( char * ) &nAl, 0, sizeof ( nAl )); memset (( char * ) &nRt, 0, sizeof ( nRt )); ++ memset (( char * ) &nRr, 0, sizeof ( nRr )); ++ ++ // Wireless Extensions ++ wepCurrentKey = 0; ++ haveWepCurrentKey = FALSE; ++ for ( i = 0; i < MAX_WEP_KEYS; i++ ) { ++ wep[i].len = 0; ++ wep[i].key[0] = '\0'; ++ wep[i].haveKey = FALSE; ++ } ++} ++ ++/**************************************************************************** ++* * ++* Wireless Extensions Specific Functions * ++* * ++****************************************************************************/ ++/**************************************************************************** ++* * ++* loadWiExtTo80211Structs() - load wireless extensions to 802.11 structures * ++* * ++****************************************************************************/ ++static void ++loadWiExtTo80211Structs ( int ifIndex, char *ifName, struct wireless_info *wi ) ++{ ++ int i, j = 0; ++ ++ // dot11Smt Group ++ // dot11StationConfigTable ++ nSc.havePrivacyOptionImplemented = TRUE; ++ nSc.privacyOptionImplemented = 1; // assume we support WEP ++ ++ if ( wi->has_power ) { ++ nSc.havePowerManagementMode = TRUE; ++ nSc.powerManagementMode = 1; // assume power is active ++ if ( !wi->power.disabled && ++ wi->power.flags & IW_POWER_MIN ) ++ nSc.powerManagementMode = 2; // power save mode ++ } ++ ++ if ( wi->has_essid && strlen ( wi->essid )) { ++ nSc.haveDesiredSSID = TRUE; ++ strcpy ( nSc.desiredSSID, wi->essid ); ++ } ++ ++ if ( wi->has_mode ) { ++ nSc.haveDesiredBSSType = TRUE; ++ if ( wi->mode == IW_MODE_ADHOC ) ++ nSc.desiredBSSType = 2; // independent ++ else if ( wi->has_ap_addr ) ++ nSc.desiredBSSType = 1; // infrastructure ++ else ++ nSc.desiredBSSType = 3; // any ++ } ++ ++ if ( wi->has_range ) { ++ for ( i = 0; i < wi->range.num_bitrates && j < 126; i++ ) { ++ nSc.haveOperationalRateSet = TRUE; ++ nSc.operationalRateSet[j++] = ( char ) ( wi->range.bitrate[i] / 500000L ); ++ } ++ } ++ ++ // dot11AuthenticationAlgorithmsTable ++ nAa.haveAuthenticationAlgorithm = TRUE; // it's a rule to always have ++ nAa.haveAuthenticationAlgorithmsEnable = TRUE; // 'open' supported ++ nAa.ifIndex = ifIndex; ++ nAa.authenticationAlgorithmsIndex = 1; // index number one ++ nAa.authenticationAlgorithm = 1; // 1 => open key ++ sprintf ( nAa.UID, "%04d%04d\0", nAa.ifIndex, nAa.authenticationAlgorithmsIndex ); ++ nAa.authenticationAlgorithmsEnable = 1; // enabled by default ++ if ( ( wi->has_key ) && ++ ( wi->key_size != 0 ) && ++ !( wi->key_flags & IW_ENCODE_DISABLED )) ++ nAa.authenticationAlgorithmsEnable = 2; ++ addList (( char * ) &aaList, ( char * ) &nAa, sizeof ( nAa )); ++ ++ nAa.haveAuthenticationAlgorithm = TRUE; // I'm gonna assume we always support WEP ++ nAa.haveAuthenticationAlgorithmsEnable = TRUE; ++ nAa.ifIndex = ifIndex; ++ nAa.authenticationAlgorithmsIndex = 2; // index number 2 ++ nAa.authenticationAlgorithm = 2; // 2 => shared key ++ sprintf ( nAa.UID, "%04d%04d\0", nAa.ifIndex, nAa.authenticationAlgorithmsIndex ); ++ nAa.authenticationAlgorithmsEnable = 2; ++ if ( ( wi->has_key ) && ++ ( wi->key_size != 0 ) && ++ !( wi->key_flags & IW_ENCODE_DISABLED )) ++ nAa.authenticationAlgorithmsEnable = 1; // disabled by default ++ addList (( char * ) &aaList, ( char * ) &nAa, sizeof ( nAa )); ++ ++ //dot11WEPDefaultKeysTable ++ if ( wi->has_range ) { ++ for ( i = 0; i < MAX_WEP_KEYS; i++ ) { ++ nDf.haveWEPDefaultKeyValue = TRUE; ++ nDf.ifIndex = ifIndex; ++ nDf.WEPDefaultKeyIndex = i + 1; // index number ++ sprintf ( nDf.UID, "%04d%04d\0", nDf.ifIndex, nDf.WEPDefaultKeyIndex ); ++ if ( wep[i].haveKey ) ++ strcpy ( nDf.WEPDefaultKeyValue, "*****" ); ++ else ++ nDf.WEPDefaultKeyValue[0] = '\0'; ++ addList (( char * ) &dfList, ( char * ) &nDf, sizeof ( nDf )); ++ } ++ } ++ ++ // dot11PrivacyTable ++ nPr.havePrivacyInvoked = TRUE; ++ nPr.privacyInvoked = 2; // 2 => FALSE ++ nPr.haveWEPDefaultKeyID = TRUE; ++ nPr.WEPDefaultKeyID = 0; ++ nPr.haveExcludeUnencrypted = TRUE; ++ nPr.excludeUnencrypted = 2; // 2 => FALSE ++ if ( wi->has_range ) { ++ if ( ( wi->key_size != 0 ) && ++ !( wi->key_flags & IW_ENCODE_DISABLED )) { ++ nPr.privacyInvoked = 1; ++ if ( wi->key_flags & IW_ENCODE_RESTRICTED ) ++ nPr.excludeUnencrypted = 1; ++ nPr.WEPDefaultKeyID = wepCurrentKey; ++ } ++ } ++ ++ // dot11Mac Group ++ // dot11OperationTable ++ if ( wi->has_range ) { ++ nOp.haveRTSThreshold = TRUE; ++ nOp.RTSThreshold = wi->range.max_rts; ++ } ++ ++ if ( wi->has_frag && wi->frag.value ) { ++ nOp.haveFragmentationThreshold = TRUE; ++ nOp.fragmentationThreshold = wi->frag.value; ++ } ++ ++ // dot11Phy Group ++ // dot11PhyOperationTable ++ if ( strstr ( wi->name, "IEEE 802.11-FS" )) nPo.PHYType = 1; // So what if I ++ if ( strstr ( wi->name, "IEEE 802.11-DS" )) nPo.PHYType = 2; // made up a couple? ++ if ( strstr ( wi->name, "IEEE 802.11-IR" )) nPo.PHYType = 3; ++ if ( strstr ( wi->name, "IEEE 802.11-OFDM" )) nPo.PHYType = 4; // 802.11a ++ if ( strstr ( wi->name, "IEEE 802.11-OFDM/DS" )) nPo.PHYType = 5; // 802.11g ++ if ( strstr ( wi->name, "IEEE 802.11-TURBO" )) nPo.PHYType = 6; // Atheros TURBO mode ++ if ( nPo.PHYType ) nPo.havePHYType = TRUE; ++ ++ // dot11PhyDSSSTable ++ if ( wi->has_range ) { // && wi->freq <= ( double ) 2483000000 ) { // DSSS frequencies only ++ for ( i = 0; i < wi->range.num_frequency; i++ ) { ++ if ((( double ) ( wi->range.freq[i].e * 10 ) * ( double ) wi->range.freq[i].m ) == wi->freq ) { ++ nPd.haveCurrentChannel = TRUE; ++ nPd.currentChannel = wi->range.freq[i].i; ++ } ++ } ++ } ++ ++ // dot11SupportedDataRatesTxTable ++ if ( wi->has_range ) { ++ for ( i = 0; i < wi->range.num_bitrates; i++ ) { ++ nRt.ifIndex = ifIndex; ++ nRt.supportedDataRatesTxIndex = i + 1; ++ nRt.supportedDataRatesTxValue = wi->range.bitrate[i] / 500000L; ++ nRt.haveSupportedDataRatesTxValue = TRUE; ++ sprintf ( nRt.UID, "%04d%04d\0", nRt.ifIndex, nRt.supportedDataRatesTxIndex ); ++ strcpy ( nRt.ifName, ifName ); ++ addList (( char * ) &rtList, ( char * ) &nRt, sizeof ( nRt )); ++ } ++ } ++ ++ // dot11SupportedDataRatesRxTable ++ if ( wi->has_range ) { ++ for ( i = 0; i < wi->range.num_bitrates; i++ ) { ++ nRr.ifIndex = ifIndex; ++ nRr.supportedDataRatesRxIndex = i + 1; ++ nRr.supportedDataRatesRxValue = wi->range.bitrate[i] / 500000L; ++ nRr.haveSupportedDataRatesRxValue = TRUE; ++ sprintf ( nRr.UID, "%04d%04d\0", nRr.ifIndex, nRr.supportedDataRatesRxIndex ); ++ strcpy ( nRr.ifName, ifName ); ++ addList (( char * ) &rrList, ( char * ) &nRr, sizeof ( nRr )); ++ } ++ } ++ ++//printf ( "%s max_encoding_tokens: %d\n", ++// "loadWiExtTo80211Structs() - ", wi->range.max_encoding_tokens ); ++} ++ ++/**************************************************************************** ++* * ++* loadWiExt() - load wireless extensions structures; * ++* use ioctl calls and read /proc/net/wireless * ++* * ++****************************************************************************/ ++static void loadWiExt ( int skfd, char *ifname, struct wireless_info *wi ) ++{ ++ struct iwreq wrq; // ioctl request structure ++ FILE *fp; ++ char bfr[1024]; ++ char buffer[sizeof ( iwrange ) * 2]; /* Large enough */ ++ char *s, *t; ++ int i, j; ++ ++ strncpy ( wrq.ifr_name, ifname, IFNAMSIZ ); ++ ++ /* Get wireless name */ ++ if ( ioctl ( skfd, SIOCGIWNAME, &wrq ) >= 0 ) { ++ strncpy ( wi->name, wrq.u.name, IFNAMSIZ ); ++ wi->name[IFNAMSIZ] = '\0'; ++ } ++ ++ /* Get ranges */ // NOTE: some version checking in iwlib.c ++ memset ( buffer, 0, sizeof ( buffer )); ++ wrq.u.data.pointer = ( caddr_t ) &buffer; ++ wrq.u.data.length = sizeof ( buffer ); ++ wrq.u.data.flags = 0; ++ if ( ioctl ( skfd, SIOCGIWRANGE, &wrq ) >= 0 ) { ++ memcpy (( char * ) &wi->range, buffer, sizeof ( iwrange )); ++ wi->has_range = 1; ++ } ++ ++ /* Get network ID */ ++ if ( ioctl ( skfd, SIOCGIWNWID, &wrq ) >= 0 ) { ++ memcpy ( &wi->nwid, &wrq.u.nwid, sizeof ( iwparam )); ++ wi->has_nwid = 1; ++ } ++ ++ /* Get frequency / channel */ // THIS NUMBER LOOKS FUNNY ++ if ( ioctl ( skfd, SIOCGIWFREQ, &wrq ) >= 0 ) { ++ wi->has_freq = 1; ++ wi->freq = (( double ) wrq.u.freq.m ) * pow ( 10, wrq.u.freq.e ); ++ } ++ ++ /* Get sensitivity */ ++ if ( ioctl ( skfd, SIOCGIWSENS, &wrq ) >= 0 ) { ++ wi->has_sens = 1; ++ memcpy ( &wi->sens, &wrq.u.sens, sizeof ( iwparam )); ++ } ++ ++ /* Get encryption information */ ++ wrq.u.data.pointer = ( caddr_t ) &wi->key; ++ wrq.u.data.length = IW_ENCODING_TOKEN_MAX; ++ wrq.u.data.flags = 0; ++ if ( ioctl ( skfd, SIOCGIWENCODE, &wrq ) >= 0 ) { ++ wi->has_key = 1; ++ wi->key_size = wrq.u.data.length; ++ wi->key_flags = wrq.u.data.flags; ++ wepCurrentKey = wrq.u.data.flags & IW_ENCODE_INDEX; ++ } ++ ++ for ( i = 0; i < wi->range.max_encoding_tokens; i++ ) { ++ wrq.u.data.pointer = ( caddr_t ) &wi->key; ++ wrq.u.data.length = IW_ENCODING_TOKEN_MAX; ++ wrq.u.data.flags = i; ++ if ( ioctl ( skfd, SIOCGIWENCODE, &wrq ) >= 0 ) { ++ if ( ( wrq.u.data.length != 0 ) && ++ !( wrq.u.data.flags & IW_ENCODE_DISABLED )) { ++ wep[i].len = wrq.u.data.length; ++ wep[i].haveKey = TRUE; ++ t = wep[i].key; ++ for ( j = 0; j < wrq.u.data.length; j++ ) { ++ if (( j & 0x1 ) == 0 && j != 0 ) ++ strcpy ( t++, "-"); ++ sprintf ( t, "%.2X", wi->key[j] ); ++ t += 2; ++ } ++ t = '\0'; ++ } ++ } ++ } ++ ++ /* Get ESSID */ ++ wrq.u.essid.pointer = ( caddr_t ) &wi->essid; ++ wrq.u.essid.length = IW_ESSID_MAX_SIZE + 1; ++ wrq.u.essid.flags = 0; ++ if ( ioctl ( skfd, SIOCGIWESSID, &wrq ) >= 0 ) { ++ wi->has_essid = 1; ++ wi->essid_on = wrq.u.data.flags; ++ } ++ ++ /* Get AP address */ ++ if ( ioctl ( skfd, SIOCGIWAP, &wrq ) >= 0 ) { ++ wi->has_ap_addr = 1; ++ memcpy ( &wi->ap_addr, &wrq.u.ap_addr, sizeof ( sockaddr )); ++ } ++ ++ /* Get NickName */ ++ wrq.u.essid.pointer = ( caddr_t ) &wi->nickname; ++ wrq.u.essid.length = IW_ESSID_MAX_SIZE + 1; ++ wrq.u.essid.flags = 0; ++ if ( ioctl ( skfd, SIOCGIWNICKN, &wrq ) >= 0 ) { ++ if ( wrq.u.data.length > 1 ) ++ wi->has_nickname = 1; ++ } ++ ++ /* Get bit rate */ ++ if ( ioctl ( skfd, SIOCGIWRATE, &wrq ) >= 0 ) { ++ wi->has_bitrate = 1; ++ memcpy ( &wi->bitrate, &wrq.u.bitrate, sizeof ( iwparam )); ++ } ++ ++ /* Get RTS threshold */ ++ if ( ioctl ( skfd, SIOCGIWRTS, &wrq ) >= 0 ) { ++ wi->has_rts = 1; ++ memcpy ( &wi->rts, &wrq.u.rts, sizeof ( iwparam )); ++ } ++ ++ /* Get fragmentation threshold */ ++ if ( ioctl ( skfd, SIOCGIWFRAG, &wrq ) >= 0 ) { ++ wi->has_frag = 1; ++ memcpy ( &wi->frag, &wrq.u.frag, sizeof ( iwparam )); ++ } ++ ++ /* Get operation mode */ ++ if ( ioctl ( skfd, SIOCGIWMODE, &wrq ) >= 0 ) { ++ wi->mode = wrq.u.mode; ++ if ( wi->mode < IW_NUM_OPER_MODE && wi->mode >= 0 ) ++ wi->has_mode = 1; ++ } ++ ++ /* Get Power Management settings */ // #if WIRELESS_EXT > 9 ++ wrq.u.power.flags = 0; ++ if ( ioctl ( skfd, SIOCGIWPOWER, &wrq ) >= 0 ) { ++ wi->has_power = 1; ++ memcpy ( &wi->power, &wrq.u.power, sizeof ( iwparam )); ++ } ++ ++ /* Get retry limit/lifetime */ // #if WIRELESS_EXT > 10 ++ if ( ioctl ( skfd, SIOCGIWRETRY, &wrq ) >= 0 ) { ++ wi->has_retry = 1; ++ memcpy ( &wi->retry, &wrq.u.retry, sizeof ( iwparam )); ++ } ++ ++ /* Get stats */ // #if WIRELESS_EXT > 11 ++ wrq.u.data.pointer = ( caddr_t ) &wi->stats; ++ wrq.u.data.length = 0; ++ wrq.u.data.flags = 1; /* Clear updated flag */ ++ if ( ioctl ( skfd, SIOCGIWSTATS, &wrq ) < 0 ) ++ wi->has_stats = 1; ++ ++ if ( !wi->has_stats ) { // no ioctl support, go to file ++ fp = fopen ( PROC_NET_WIRELESS, "r" ); ++ if ( fp ) { ++ while ( fgets ( bfr, sizeof ( bfr ), fp )) { ++ bfr [ sizeof ( bfr ) - 1 ] = '\0'; // no buffer overruns here! ++ strtok (( char * ) &bfr, "\n" ); // '\n' => '\0' ++ if ( strstr ( bfr, ifname ) && strstr ( bfr, ":" )) { ++ wi->has_stats = 1; ++ s = bfr; ++ s = strchr ( s, ':' ); s++; /* Skip ethX: */ ++ s = strtok ( s, " " ); /* ' ' => '\0' */ ++ sscanf ( s, "%X", &wi->stats.status ); // status ++ ++ s = strtok ( NULL, " " ); // link quality ++ if ( strchr ( s, '.' ) != NULL ) ++ wi->stats.qual.updated |= 1; ++ sscanf ( s, "%d", &wi->stats.qual.qual ); ++ ++ s = strtok ( NULL, " " ); // signal level ++ if ( strchr ( s,'.' ) != NULL ) ++ wi->stats.qual.updated |= 2; ++ sscanf ( s, "%d", &wi->stats.qual.level ); ++ ++ s = strtok ( NULL, " " ); // noise level ++ if ( strchr ( s, '.' ) != NULL ) ++ wi->stats.qual.updated += 4; ++ sscanf ( s, "%d", &wi->stats.qual.noise ); ++ ++ s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.nwid ); ++ s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.code ); ++ s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.fragment ); ++ s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.retries ); ++ s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.misc ); ++ s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.miss.beacon ); ++ } ++ } ++ fclose ( fp ); ++ } ++ } ++ ++// printf ( "%s bfr: %s\n", "loadTables()", bfr ); ++} ++ ++/**************************************************************************** ++* * ++* displayWiExt() - show what I got from Wireless Extensions * ++* * ++****************************************************************************/ ++static void displayWiExt ( struct wireless_info info ) ++{ ++#ifdef DISPLAYWIEXT ++ int i; ++ char title[] = "displayWiExt() -"; ++ ++ printf ( "========================================\n" ); ++ printf ( "===> Wireless Extension IOCTL calls <===\n" ); ++ printf ( "========================================\n" ); ++ ++ if ( strlen ( info.name )) ++ printf ( "%s name: %s\n", "SIOCGIWNAME", info.name ); ++ else ++ printf ( "%s\n", "no info.name support" ); ++ ++ if ( info.has_nickname = 1 ) ++ printf ( "%s nickname: %s\n", "SIOCGIWNICKN", info.nickname ); ++ else ++ printf ( "%s %s\n", "SIOCGIWNICKN", " ===> no info.nickname support" ); ++ ++ if ( info.has_essid ) ++ printf ( "%s essid_on: %d essid: %s\n", "SIOCGIWESSID", info.essid_on, info.essid ); ++ else ++ printf ( "%s %s\n", "SIOCGIWESSID", " ===> no info.essid support" ); ++ ++ if ( info.has_range ) { ++ printf ( "%s throughput: %d\n", "SIOCGIWRANGE", info.range.throughput ); ++ printf ( "%s min_nwid: %d\n", "SIOCGIWRANGE", info.range.min_nwid ); ++ printf ( "%s max_nwid: %d\n", "SIOCGIWRANGE", info.range.max_nwid ); ++ printf ( "%s sensitivity: %d\n", "SIOCGIWRANGE", info.range.sensitivity ); ++ printf ( "%s num_bitrates: %d\n", "SIOCGIWRANGE", info.range.num_bitrates ); ++ for ( i = 0; i < info.range.num_bitrates; i++ ) ++ printf ( "%s bitrate[%d]: %d\n", "SIOCGIWRANGE", i, info.range.bitrate[i] ); ++ printf ( "%s min_rts: %d\n", "SIOCGIWRANGE", info.range.min_rts ); ++ printf ( "%s max_rts: %d\n", "SIOCGIWRANGE", info.range.max_rts ); ++ printf ( "%s min_frag: %d\n", "SIOCGIWRANGE", info.range.min_frag ); ++ printf ( "%s max_frag: %d\n", "SIOCGIWRANGE", info.range.max_frag ); ++ printf ( "%s min_pmp: %d\n", "SIOCGIWRANGE", info.range.min_pmp ); ++ printf ( "%s max_pmp: %d\n", "SIOCGIWRANGE", info.range.max_pmp ); ++ printf ( "%s min_pmt: %d\n", "SIOCGIWRANGE", info.range.min_pmt ); ++ printf ( "%s max_pmt: %d\n", "SIOCGIWRANGE", info.range.max_pmt ); ++ printf ( "%s pmp_flags: %d\n", "SIOCGIWRANGE", info.range.pmp_flags ); ++ printf ( "%s pmt_flags: %d\n", "SIOCGIWRANGE", info.range.pmt_flags ); ++ printf ( "%s pm_capa: %d\n", "SIOCGIWRANGE", info.range.pm_capa ); ++ printf ( "%s num_encoding_sizes: %d\n", "SIOCGIWRANGE", info.range.num_encoding_sizes ); ++ for ( i = 0; i < info.range.num_encoding_sizes; i++ ) ++ printf ( "%s encoding_size[%d]: %d\n", "SIOCGIWRANGE", i, info.range.encoding_size[i] ); ++ printf ( "%s max_encoding_tokens: %d\n", "SIOCGIWRANGE", info.range.max_encoding_tokens ); ++// printf ( "%s encoding_login_index: %d\n", "SIOCGIWRANGE", info.range.encoding_login_index ); ++ printf ( "%s txpower_capa: %d\n", "SIOCGIWRANGE", info.range.txpower_capa ); ++ printf ( "%s num_txpower: %d dBm\n", "SIOCGIWRANGE", info.range.num_txpower ); ++ for ( i = 0; i < info.range.num_txpower; i++ ) ++ printf ( "%s txpower[%d]: %d\n", "SIOCGIWRANGE", i, info.range.txpower[i] ); ++ printf ( "%s we_version_compiled: %d\n", "SIOCGIWRANGE", info.range.we_version_compiled ); ++ printf ( "%s we_version_source: %d\n", "SIOCGIWRANGE", info.range.we_version_source ); ++ printf ( "%s retry_capa: %d\n", "SIOCGIWRANGE", info.range.retry_capa ); ++ printf ( "%s retry_flags: %d\n", "SIOCGIWRANGE", info.range.retry_flags ); ++ printf ( "%s r_time_flags: %d\n", "SIOCGIWRANGE", info.range.r_time_flags ); ++ printf ( "%s min_retry: %d\n", "SIOCGIWRANGE", info.range.min_retry ); ++ printf ( "%s max_retry: %d\n", "SIOCGIWRANGE", info.range.max_retry ); ++ printf ( "%s min_r_time: %d\n", "SIOCGIWRANGE", info.range.min_r_time ); ++ printf ( "%s max_r_time: %d\n", "SIOCGIWRANGE", info.range.max_r_time ); ++ printf ( "%s num_channels: %d\n", "SIOCGIWRANGE", info.range.num_channels ); ++ printf ( "%s num_frequency: %d\n", "SIOCGIWRANGE", info.range.num_frequency ); ++ for ( i = 0; i < info.range.num_frequency; i++ ) ++ printf ( "%s freq[%d].i: %d freq[%d].e: %d freq[%d].m: %d\n", "SIOCGIWRANGE", ++ i, info.range.freq[i].i, i, info.range.freq[i].e, i, info.range.freq[i].m ); ++ } ++ else ++ printf ( "%s %s\n", "SIOCGIWRANGE", " ===> no info.range support" ); ++ ++ if ( info.has_nwid ) ++ printf ( "%s nwid - disabled: %d value: %X\n", "SIOCGIWNWID", info.nwid.disabled, info.nwid.value ); ++ else ++ printf ( "%s %s\n", "SIOCGIWNWID", " ===> no info.nwid support" ); ++ ++ if ( info.has_freq ) { ++// printf ( "%s freq: %g\n", "SIOCGIWFREQ", info.freq / GIGA ); ++ printf ( "%s freq: %g\n", "SIOCGIWFREQ", info.freq ); ++ } ++ else ++ printf ( "%s %s\n", "SIOCGIWFREQ", " ===> no info.freq support" ); ++ ++ if ( info.has_sens ) ++ printf ( "%s sens: %d\n", "SIOCGIWSENS", info.sens ); ++ else ++ printf ( "%s %s\n", "SIOCGIWSENS", " ===> no info.sens support" ); ++ ++ if ( info.has_key ) { ++ printf ( "%s key_size: %d key_flags: %d wepCurrentKey: %d\n", ++ "SIOCGIWENCODE", info.key_size, info.key_flags, wepCurrentKey ); ++ printf ( "%s MODE: %d DISABLED: %d INDEX: %d OPEN: %d RESTRICTED: %d NOKEY: %d TEMP: %d\n", ++ "SIOCGIWENCODE", info.key_flags & IW_ENCODE_MODE, ++ info.key_flags & IW_ENCODE_DISABLED ? 1:0, info.key_flags & IW_ENCODE_INDEX, ++ info.key_flags & IW_ENCODE_OPEN ? 1:0, info.key_flags & IW_ENCODE_RESTRICTED ? 1:0, ++ info.key_flags & IW_ENCODE_NOKEY ? 1:0, info.key_flags & IW_ENCODE_TEMP ? 1:0 ); ++ } ++ else ++ printf ( "%s %s\n", "SIOCGIWENCODE", " ===> no info.key support" ); ++ ++ for ( i = 0; i < MAX_WEP_KEYS; i++ ) { ++ if ( wep[i].haveKey ) ++ printf ( "%s wep[%d].len: %d wep[%d].key: %s\n", ++ "SIOCGIWENCODE", i, wep[i].len, i, wep[i].key ); ++ } ++ ++ if ( info.has_ap_addr ) ++ printf ( "%s ap_addr.sa_data: %02X:%02X:%02X:%02X:%02X:%02X ap_addr.sa_family: %d\n", ++ "SIOCGIWAP", ( UCHAR ) info.ap_addr.sa_data[0], ( UCHAR ) info.ap_addr.sa_data[1], ++ ( UCHAR ) info.ap_addr.sa_data[2], ( UCHAR ) info.ap_addr.sa_data[3], ++ ( UCHAR ) info.ap_addr.sa_data[4], ( UCHAR ) info.ap_addr.sa_data[5], ++ info.ap_addr.sa_family ); ++ else ++ printf ( "%s %s\n", "SIOCGIWAP", " ===> no ap_addr information" ); ++ ++ if ( info.has_bitrate ) ++ printf ( "%s bitrate: %d value: %d fixed: %d disabled: %d flags: %d\n", ++ "SIOCGIWRATE", info.bitrate, info.bitrate.value, info.bitrate.fixed, ++ info.bitrate.disabled, info.bitrate.flags ); ++ else ++ printf ( "%s %s\n", "SIOCGIWRATE", " ===> no info.bitrate support" ); ++ ++ if ( info.has_rts ) ++ printf ( "%s rts: %d\n", "SIOCGIWRTS", info.rts ); ++ else ++ printf ( "%s %s\n", "SIOCGIWRTS", " ===> no info.rts support" ); ++ ++ if ( info.has_frag ) ++ printf ( "%s frag: %d\n", "SIOCGIWFRAG", info.frag ); ++ else ++ printf ( "%s %s\n", "SIOCGIWFRAG", " ===> no info.frag support" ); ++ ++ if ( info.has_mode ) ++ printf ( "%s mode: %d\n", "SIOCGIWMODE", info.mode ); ++ else ++ printf ( "%s %s\n", "SIOCGIWMODE", " ===> no info.mode support" ); ++ ++ if ( info.has_power ) { ++ printf ( "%s power: %d\n", "SIOCGIWPOWER", info.power ); ++ printf ( "%s disabled: %d MIN: %d MAX: %d TIMEOUT: %d RELATIVE: %d\n", ++ "SIOCGIWPOWER", ++ info.power.disabled ? 1:0, ++ info.power.flags & IW_POWER_MIN ? 1:0, ++ info.power.flags & IW_POWER_MAX ? 1:0, ++ info.power.flags & IW_POWER_TIMEOUT ? 1:0, ++ info.power.flags & IW_POWER_RELATIVE ? 1:0 ); ++ printf ( "%s UNICAST: %d MULTICAST: %d ALL: %d FORCE: %d REPEATER: %d\n", ++ "SIOCGIWPOWER", ++ info.power.flags & IW_POWER_UNICAST_R ? 1:0, ++ info.power.flags & IW_POWER_MULTICAST_R ? 1:0, ++ info.power.flags & IW_POWER_ALL_R ? 1:0, ++ info.power.flags & IW_POWER_FORCE_S ? 1:0, ++ info.power.flags & IW_POWER_REPEATER ? 1:0 ); ++ } ++ else ++ printf ( "%s %s\n", "SIOCGIWPOWER", " ===> no info.power support" ); ++ ++ if ( info.has_retry ) ++ printf ( "%s retry: %d\n", "SIOCGIWRETRY", info.retry ); ++ else ++ printf ( "%s %s\n", "SIOCGIWRETRY", " ===> no info.retry support" ); ++ ++ if ( info.has_stats ) { ++ printf ( "%s status: %d\n", "SIOCGIWSTATS", info.stats.status ); ++ printf ( "%s qual.level: %d\n", "SIOCGIWSTATS", info.stats.qual.level ); ++ printf ( "%s qual.noise: %d\n", "SIOCGIWSTATS", info.stats.qual.noise ); ++ printf ( "%s qual.qual: %d\n", "SIOCGIWSTATS", info.stats.qual.qual ); ++ printf ( "%s qual.updated: %d\n", "SIOCGIWSTATS", info.stats.qual.updated ); ++ printf ( "%s discard.code: %d\n", "SIOCGIWSTATS", info.stats.discard.code ); ++ printf ( "%s discard.fragment: %d\n", "SIOCGIWSTATS", info.stats.discard.fragment ); ++ printf ( "%s discard.misc: %d\n", "SIOCGIWSTATS", info.stats.discard.misc ); ++ printf ( "%s discard.nwid: %d\n", "SIOCGIWSTATS", info.stats.discard.nwid ); ++ printf ( "%s discard.retries: %d\n", "SIOCGIWSTATS", info.stats.discard.retries ); ++ printf ( "%s miss.beacon: %d\n", "SIOCGIWSTATS", info.stats.miss.beacon ); ++ } ++ else ++ printf ( "%s %s\n", "SIOCGIWSTATS", " ===> no info.stats support" ); ++ ++ if ( info.txpower.flags & IW_TXPOW_MWATT ) ++ printf ( "%s txpower1: %d dBm disabled: %d fixed: %d flags: %d\n", "SIOCGIWRANGE", ++ mWatt2dbm ( info.txpower.value ), info.txpower.disabled, info.txpower.fixed, info.txpower.flags); ++ else ++ printf ( "%s txpower2: %d dBm disabled: %d fixed: %d flags: %d\n", "SIOCGIWRANGE", info.txpower.value, info.txpower.disabled, info.txpower.fixed, info.txpower.flags ); ++ ++ if ( info.has_range ) ++ if ( info.sens.value < 0 ) ++ printf ( "%s sens: %d dBm\n", "SIOCGIWRANGE", info.sens.value ); ++ else ++ printf ( "%s sens: %d/%d\n", "SIOCGIWRANGE", info.sens.value, info.range.sensitivity ); ++ ++ if ( info.has_range && ( info.stats.qual.level != 0 )) ++ if ( info.stats.qual.level > info.range.max_qual.level ) ++ /* Statistics are in dBm (absolute power measurement) */ ++ printf ( "%s Quality: %d/%d Signal level: %d dBm Noise level: %d dBm\n", ++ "SIOCGIWRANGE", ++ info.stats.qual.qual, info.range.max_qual.qual, ++ info.stats.qual.level - 0x100, ++ info.stats.qual.noise - 0x100 ); ++ else ++ printf ( "%s Quality: %d/%d Signal level: %d/%d Noise level: %d/%d", ++ "SIOCGIWRANGE", ++ info.stats.qual.qual, info.range.max_qual.qual, ++ info.stats.qual.level, info.range.max_qual.level, ++ info.stats.qual.noise, info.range.max_qual.noise ); ++ ++#endif // #ifdef DISPLAYWIEXT ++} ++ ++/**************************************************************************** ++* * ++* Linked List Functions * ++* * ++****************************************************************************/ ++/**************************************************************************** ++* * ++* addList() - add an entry to a linked list * ++* * ++****************************************************************************/ ++static void ++addList ( char *l, char *data, int len ) ++{ ++ char uid[256]; ++ LIST_HEAD ( , avNode ) *list; ++ ++ // NOTE: this assumes the UID is at the beginning of the ++ // data structure and that UIDs are strings ++ ++ list = ( LIST_HEAD ( , avNode ) * ) l; // NOTE: don't know how to get ++ strcpy ( uid, data ); // rid of compiler warning on ++ // LISTHEAD typecast ++ // create a new node and the data that goes in it ++ newNode = malloc ( sizeof ( struct avNode )); ++ newNode->data = malloc ( len ); ++ memcpy ( newNode->data, data, len ); ++ ++ // this deals with an empty list ++ if ( LIST_EMPTY ( list )) { ++ LIST_INSERT_HEAD ( list, newNode, nodes ); ++ return; ++ } ++ ++ // this deals with UIDs that match ++ for ( np = LIST_FIRST ( list ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ if ( strncmp ( uid, np->data, strlen ( uid )) == 0 ) { // found matching UID ++ LIST_INSERT_AFTER ( np, newNode, nodes ); ++ if ( np->data ) ++ free ( np->data ); ++ LIST_REMOVE ( np, nodes ); ++ free ( np ); ++ return; ++ } ++ } ++ ++ // this deals with inserting a new UID in the list ++ for ( np = LIST_FIRST ( list ); np != NULL; np = LIST_NEXT ( np, nodes )) { ++ lastNode = np; ++ if ( strncmp ( np->data, uid, strlen ( uid )) > 0 ) { // old ID > new ID AND ++ LIST_INSERT_BEFORE ( np, newNode, nodes ); ++ return; ++ } ++ } ++ ++ // this deals with a UID that needs to go on the end of the list ++ LIST_INSERT_AFTER ( lastNode, newNode, nodes ); ++ ++ return; ++} ++ ++/**************************************************************************** ++* * ++* initLists() - initialize all the linked lists * ++* * ++****************************************************************************/ ++static void initLists() ++{ ++ LIST_INIT ( &scList ); LIST_INIT ( &aaList ); LIST_INIT ( &dfList ); ++ LIST_INIT ( &kmList ); LIST_INIT ( &prList ); ++ LIST_INIT ( &opList ); LIST_INIT ( &coList ); ++ LIST_INIT ( &gaList ); LIST_INIT ( &riList ); LIST_INIT ( &poList ); ++ LIST_INIT ( &paList ); LIST_INIT ( &ptList ); LIST_INIT ( &pfList ); ++ LIST_INIT ( &pdList ); LIST_INIT ( &piList ); LIST_INIT ( &rdList ); ++ LIST_INIT ( &alList ); LIST_INIT ( &rtList ); LIST_INIT ( &rrList ); ++} ++/**************************************************************************** ++* * ++* flushLists() - flush all linked lists * ++* * ++****************************************************************************/ ++static void flushLists() ++{ ++ flushList (( char * ) &scList ); flushList (( char * ) &aaList ); ++ flushList (( char * ) &dfList ); flushList (( char * ) &kmList ); ++ flushList (( char * ) &prList ); ++ flushList (( char * ) &opList ); flushList (( char * ) &coList ); ++ flushList (( char * ) &gaList ); flushList (( char * ) &riList ); ++ flushList (( char * ) &poList ); flushList (( char * ) &paList ); ++ flushList (( char * ) &ptList ); flushList (( char * ) &pfList ); ++ flushList (( char * ) &pdList ); flushList (( char * ) &piList ); ++ flushList (( char * ) &rdList ); flushList (( char * ) &alList ); ++ flushList (( char * ) &rtList ); flushList (( char * ) &rrList ); ++} ++ ++/**************************************************************************** ++* * ++* flushList() - flush a linked list * ++* * ++****************************************************************************/ ++static void flushList ( char *l ) ++{ ++ LIST_HEAD ( , avNode ) *list; ++ ++ list = ( LIST_HEAD ( , avNode ) * ) l; // NOTE: don't know how to get ++ while ( !LIST_EMPTY ( list )) { // rid of compiler warning on ++ np = LIST_FIRST ( list ); // LISTHEAD typecast ++ if ( np->data ) ++ free ( np->data ); ++ LIST_REMOVE ( np, nodes ); ++ free ( np ); ++ } ++} ++ ++/**************************************************************************** ++* * ++* Utility Functions * ++* * ++****************************************************************************/ ++/**************************************************************************** ++* * ++* The following two routines were taken directly from iwlib.c * ++* * ++****************************************************************************/ ++ /* ++ * Open a socket. ++ * Depending on the protocol present, open the right socket. The socket ++ * will allow us to talk to the driver. ++ */ ++static int openSocket ( void ) ++{ ++ static const int families[] = { ++ AF_INET, AF_IPX, AF_AX25, AF_APPLETALK ++ }; ++ unsigned int i; ++ int sock; ++ ++ /* ++ * Now pick any (exisiting) useful socket family for generic queries ++ * Note : don't open all the socket, only returns when one matches, ++ * all protocols might not be valid. ++ * Workaround by Jim Kaba ++ * Note : in 99% of the case, we will just open the inet_sock. ++ * The remaining 1% case are not fully correct... ++ */ ++ ++ /* Try all families we support */ ++ for(i = 0; i < sizeof(families)/sizeof(int); ++i) { ++ /* Try to open the socket, if success returns it */ ++ sock = socket(families[i], SOCK_DGRAM, 0); ++ if(sock >= 0) ++ return sock; ++ } ++ ++ return -1; ++} ++ ++/*------------------------------------------------------------------*/ ++/* ++ * Convert a value in milliWatt to a value in dBm. ++ */ ++static int mWatt2dbm ( int in ) ++{ ++#ifdef WE_NOLIBM ++ /* Version without libm : slower */ ++ double fin = (double) in; ++ int res = 0; ++ ++ /* Split integral and floating part to avoid accumulating rounding errors */ ++ while(fin > 10.0) ++ { ++ res += 10; ++ fin /= 10.0; ++ } ++ while(fin > 1.000001) /* Eliminate rounding errors, take ceil */ ++ { ++ res += 1; ++ fin /= LOG10_MAGIC; ++ } ++ return(res); ++#else /* WE_NOLIBM */ ++ /* Version with libm : faster */ ++ return((int) (ceil(10.0 * log10((double) in)))); ++#endif /* WE_NOLIBM */ ++} ++ ++/**************************************************************************** ++* * ++* htob - converts hex string to binary * ++* * ++****************************************************************************/ ++static char *htob ( char *s ) ++{ ++ char nibl, *byt; ++ static char bin[20]; ++ ++ byt = bin; ++ ++ while ((nibl = *s++) && nibl != ' ') { /* While not end of string. */ ++ nibl -= ( nibl > '9') ? ('A' - 10): '0'; ++ *byt = nibl << 4; /* place high nibble */ ++ if((nibl = *s++) && nibl != ' ') { ++ nibl -= ( nibl > '9') ? ('A' - 10): '0'; ++ *byt |= nibl; /* place low nibble */ ++ } ++ else break; ++ ++byt; ++ } ++ *++byt = '\0'; ++ return ( bin ); ++} ++ ++/**************************************************************************** ++* * ++* hasChanged() - see if area has been changed from NULLs * ++* * ++****************************************************************************/ ++static int hasChanged ( char *loc, int len ) ++{ ++ char *wrk; ++ int changed = TRUE; ++ ++ wrk = malloc ( len ); ++ memset ( wrk, 0, len ); ++ if ( memcmp ( loc, wrk, len ) == 0 ) ++ changed = FALSE; ++ free ( wrk ); ++ ++ return ( changed ); ++} ++ +--- /dev/null ++++ b/agent/mibgroup/ieee802dot11.h +@@ -0,0 +1,730 @@ ++/**************************************************************************** ++* * ++* File Name: ieee802dot11.h * ++* Used By: * ++* * ++* Operating System: * ++* Purpose: * ++* * ++* Comments: * ++* * ++* Author: Larry Simmons * ++* lsimmons@avantcom.com * ++* www.avantcom.com * ++* * ++* Creation Date: 09/02/03 * ++* * ++* Ver Date Inits Modification * ++* ----- -------- ----- ------------ * ++* 0.0.1 09/02/03 LRS created * ++* 0.0.2 09/24/03 LRS wouldn't build after fresh ./configure * ++****************************************************************************/ ++/* This file was generated by mib2c and is intended for use as a mib module ++ for the ucd-snmp snmpd agent. */ ++#ifndef _MIBGROUP_IEEE802DOT11_H ++#define _MIBGROUP_IEEE802DOT11_H ++/* we may use header_generic and header_simple_table from the util_funcs module */ ++ ++/**************************************************************************** ++* Includes * ++****************************************************************************/ ++#include ++ ++/**************************************************************************** ++* Linked List Defines * ++****************************************************************************/ ++// here are some Linked List MACROS I wanted to use, ++// but curiously were not in /usr/includes/sys/queue.h ++ ++#ifndef LIST_EMPTY ++ #define LIST_EMPTY(head) ((head)->lh_first == NULL) ++#endif ++ ++#ifndef LIST_NEXT ++ #define LIST_NEXT(elm, field) ((elm)->field.le_next) ++#endif ++ ++#ifndef LIST_INSERT_BEFORE ++ #define LIST_INSERT_BEFORE(listelm, elm, field) do { \ ++ (elm)->field.le_prev = (listelm)->field.le_prev; \ ++ LIST_NEXT((elm), field) = (listelm); \ ++ *(listelm)->field.le_prev = (elm); \ ++ (listelm)->field.le_prev = &LIST_NEXT((elm), field); \ ++ } while (0) ++#endif ++ ++#ifndef LIST_FIRST ++ #define LIST_FIRST(head) ((head)->lh_first) ++#endif ++ ++/**************************************************************************** ++* 802.11 MIB Defines * ++****************************************************************************/ ++#define SYS_STRING_LEN 256 ++#define MACADDR_LEN ( 6 * 2 ) + 5 ++#define OPER_RATE_SET_LEN 126 ++#define MAN_OUI_LEN ( 3 * 2 ) + 2 ++#define WEP_STR_LEN 64 ++#define SNMP_STR_LEN 128 ++#define TEXT_LEN 80 ++#define IFINDEX_LEN 4 ++#define IFNAME_LEN 16 ++#define MAX_WEP_KEYS 4 ++ ++#define AUTHENICATION_ALGORITHMS_INDEX_LEN 4 ++#define WEP_DEFAULT_KEY_INDEX_LEN 4 ++#define WEP_KEY_MAPPING_INDEX_LEN 4 ++#define GROUP_ADDRESS_INDEX_LEN 4 ++#define REG_DOMAIN_SUPPORT_INDEX_LEN 4 ++#define ANTENNA_LIST_INDEX_LEN 4 ++#define SUPPORTED_DATA_RATES_TX_INDEX_LEN 4 ++#define SUPPORTED_DATA_RATES_RX_INDEX_LEN 4 ++ ++#define SC_UID_LEN IFINDEX_LEN ++#define AA_UID_LEN IFINDEX_LEN + AUTHENICATION_ALGORITHMS_INDEX_LEN ++#define DF_UID_LEN IFINDEX_LEN + WEP_DEFAULT_KEY_INDEX_LEN ++#define KM_UID_LEN IFINDEX_LEN + WEP_KEY_MAPPING_INDEX_LEN ++#define PR_UID_LEN IFINDEX_LEN ++#define OP_UID_LEN IFINDEX_LEN ++#define CO_UID_LEN IFINDEX_LEN ++#define GA_UID_LEN IFINDEX_LEN + GROUP_ADDRESS_INDEX_LEN ++#define RI_UID_LEN IFINDEX_LEN ++#define PO_UID_LEN IFINDEX_LEN ++#define PA_UID_LEN IFINDEX_LEN ++#define PT_UID_LEN IFINDEX_LEN ++#define PF_UID_LEN IFINDEX_LEN ++#define PD_UID_LEN IFINDEX_LEN ++#define PI_UID_LEN IFINDEX_LEN ++#define RD_UID_LEN IFINDEX_LEN + REG_DOMAIN_SUPPORT_INDEX_LEN ++#define AL_UID_LEN IFINDEX_LEN + ANTENNA_LIST_INDEX_LEN ++#define RT_UID_LEN IFINDEX_LEN + SUPPORTED_DATA_RATES_TX_INDEX_LEN ++#define RR_UID_LEN IFINDEX_LEN + SUPPORTED_DATA_RATES_RX_INDEX_LEN ++ ++/**************************************************************************** ++* Linked List Structure * ++****************************************************************************/ ++static struct avNode { ++ LIST_ENTRY ( avNode ) nodes; ++ char *data; // pointer to data ++}; ++ ++typedef LIST_HEAD ( , avNode ) avList_t; ++ ++/**************************************************************************** ++* 802.11 MIB structures * ++****************************************************************************/ ++/**************************************************************************** ++* dot11Smt Group * ++****************************************************************************/ ++/**************************************************************************** ++* dot11StationConfigTable * ++****************************************************************************/ ++static struct scTbl_data { ++ ++ char UID [ SC_UID_LEN + 1 ]; // unique ID ++ char ifName [ IFNAME_LEN + 1 ]; // ifName of card ++ ++ long ifIndex; // ifindex of card ++ ++ char stationID [ MACADDR_LEN + 1 ]; // Default actual MacAddr ++ long mediumOccupancyLimit; ++ long CFPPollable; ++ long CFPPeriod; ++ long maxDuration; ++ long authenticationResponseTimeOut; ++ long privacyOptionImplemented; ++ long powerManagementMode; ++ char desiredSSID [ SNMP_STR_LEN + 1 ]; ++ long desiredBSSType; ++ char operationalRateSet [ OPER_RATE_SET_LEN + 1]; ++ long beaconPeriod; ++ long DTIMPeriod; ++ long associationResponseTimeOut; ++ long disAssociationReason; ++ char disAssociationStation [ MACADDR_LEN + 1 ]; ++ long deAuthenticationReason; ++ char deAuthenticationStation [ MACADDR_LEN + 1 ]; ++ long authenticateFailStatus; ++ char authenticateFailStation [ MACADDR_LEN + 1 ]; ++ ++ long haveStationID; ++ long haveMediumOccupancyLimit; ++ long haveCFPPollable; ++ long haveCFPPeriod; ++ long haveMaxDuration; ++ long haveAuthenticationResponseTimeOut; ++ long havePrivacyOptionImplemented; ++ long havePowerManagementMode; ++ long haveDesiredSSID; ++ long haveDesiredBSSType; ++ long haveOperationalRateSet; ++ long haveBeaconPeriod; ++ long haveDTIMPeriod; ++ long haveAssociationResponseTimeOut; ++ long haveDisAssociationReason; ++ long haveDisAssociationStation; ++ long haveDeAuthenticationReason; ++ long haveDeAuthenticationStation; ++ long haveAuthenticateFailStatus; ++ long haveAuthenticateFailStation; ++ ++} nSc, *sc = &nSc; ++ ++static avList_t scList; ++ ++/**************************************************************************** ++* dot11AuthenticationAlgorithmsTable * ++****************************************************************************/ ++static struct aaTbl_data { ++ ++ char UID [ AA_UID_LEN + 1 ]; ++ char ifName [ IFNAME_LEN + 1 ]; // ifName of card ++ ++ long ifIndex; // ifindex of card ++ long authenticationAlgorithmsIndex; ++ ++ long authenticationAlgorithm; ++ long authenticationAlgorithmsEnable; ++ ++ long haveAuthenticationAlgorithm; ++ long haveAuthenticationAlgorithmsEnable; ++ ++} nAa, *aa = &nAa; ++ ++static avList_t aaList; ++ ++/**************************************************************************** ++* dot11WEPDefaultKeysTable * ++****************************************************************************/ ++static struct dfTbl_data { ++ ++ char UID [ DF_UID_LEN + 1 ]; ++ char ifName [ IFNAME_LEN + 1 ]; ++ ++ long ifIndex; // ifindex of card ++ long WEPDefaultKeyIndex; ++ ++ char WEPDefaultKeyValue [ WEP_STR_LEN + 1 ]; ++ long haveWEPDefaultKeyValue; ++ ++} nDf, *df = &nDf; ++ ++static avList_t dfList; ++ ++/**************************************************************************** ++* dot11WEPKeyMappingsTable * ++****************************************************************************/ ++static struct kmTbl_data { ++ ++ char UID [ KM_UID_LEN + 1 ]; ++ char ifName [ IFNAME_LEN + 1 ]; ++ ++ long ifIndex; ++ long WEPKeyMappingIndex; ++ ++ char WEPKeyMappingAddress [ MACADDR_LEN + 1 ]; ++ long WEPKeyMappingWEPOn; ++ char WEPKeyMappingValue [ WEP_STR_LEN + 1 ]; ++ long WEPKeyMappingStatus; ++ ++ long haveWEPKeyMappingIndex; ++ long haveWEPKeyMappingAddress; ++ long haveWEPKeyMappingWEPOn; ++ long haveWEPKeyMappingValue; ++ long haveWEPKeyMappingStatus; ++ ++} nKm, *km = &nKm; ++ ++static avList_t kmList; ++ ++/**************************************************************************** ++* dot11PrivacyTable * ++****************************************************************************/ ++static struct prTbl_data { ++ ++ char UID [ PR_UID_LEN + 1 ]; ++ char ifName [ IFNAME_LEN + 1 ]; ++ ++ long ifIndex; ++ ++ long privacyInvoked; ++ long WEPDefaultKeyID; ++ long WEPKeyMappingLength; ++ long excludeUnencrypted; ++ unsigned long WEPICVErrorCount; ++ unsigned long WEPExcludedCount; ++ ++ long havePrivacyInvoked; ++ long haveWEPDefaultKeyID; ++ long haveWEPKeyMappingLength; ++ long haveExcludeUnencrypted; ++ long haveWEPICVErrorCount; ++ long haveWEPExcludedCount; ++ ++} nPr, *pr = &nPr; ++ ++static avList_t prList; ++ ++/**************************************************************************** ++* dot11Mac Group * ++****************************************************************************/ ++/**************************************************************************** ++* dot11OperationTable * ++****************************************************************************/ ++static struct opTbl_data { ++ ++ char UID [ OP_UID_LEN + 1 ]; // unique ID ++ char ifName [ IFNAME_LEN + 1 ]; // ifName of card ++ ++ long ifIndex; // ifindex of card ++ ++ char MACAddress [ MACADDR_LEN + 1 ]; ++ long RTSThreshold; ++ long shortRetryLimit; ++ long longRetryLimit; ++ long fragmentationThreshold; ++ long maxTransmitMSDULifetime; ++ long maxReceiveLifetime; ++ char manufacturerID [ SNMP_STR_LEN + 1 ]; ++ char productID [ SNMP_STR_LEN + 1 ]; ++ ++ long haveMACAddress; ++ long haveRTSThreshold; ++ long haveShortRetryLimit; ++ long haveLongRetryLimit; ++ long haveFragmentationThreshold; ++ long haveMaxTransmitMSDULifetime; ++ long haveMaxReceiveLifetime; ++ long haveManufacturerID; ++ long haveProductID; ++ ++} nOp, *op = &nOp; ++ ++static avList_t opList; ++ ++/**************************************************************************** ++* dot11CountersTable * ++****************************************************************************/ ++static struct coTbl_data { ++ ++ char UID [ CO_UID_LEN + 1 ]; // unique ID ++ char ifName [ IFNAME_LEN + 1 ]; // ifName of card ++ ++ long ifIndex; // ifindex of card ++ ++ unsigned long transmittedFragmentCount; ++ unsigned long multicastTransmittedFrameCount; ++ unsigned long failedCount; ++ unsigned long retryCount; ++ unsigned long multipleRetryCount; ++ unsigned long frameDuplicateCount; ++ unsigned long RTSSuccessCount; ++ unsigned long RTSFailureCount; ++ unsigned long ACKFailureCount; ++ unsigned long receivedFragmentCount; ++ unsigned long multicastReceivedFrameCount; ++ unsigned long FCSErrorCount; ++ unsigned long transmittedFrameCount; ++ unsigned long WEPUndecryptableCount; ++ ++ long haveTransmittedFragmentCount; ++ long haveMulticastTransmittedFrameCount; ++ long haveFailedCount; ++ long haveRetryCount; ++ long haveMultipleRetryCount; ++ long haveFrameDuplicateCount; ++ long haveRTSSuccessCount; ++ long haveRTSFailureCount; ++ long haveACKFailureCount; ++ long haveReceivedFragmentCount; ++ long haveMulticastReceivedFrameCount; ++ long haveFCSErrorCount; ++ long haveTransmittedFrameCount; ++ long haveWEPUndecryptableCount; ++ ++} nCo, *co = &nCo; ++ ++static avList_t coList; ++ ++/**************************************************************************** ++* dot11GroupAddressesTable * ++****************************************************************************/ ++static struct gaTbl_data { ++ ++ char UID [ GA_UID_LEN + 1 ]; ++ char ifName [ IFNAME_LEN + 1 ]; ++ ++ long ifIndex; // ifindex of card ++ long groupAddressesIndex; ++ ++ char address [ MACADDR_LEN + 1 ]; ++ long groupAddressesStatus; ++ ++ long haveAddress; ++ long haveGroupAddressesStatus; ++ ++} nGa, *ga = &nGa; ++ ++static avList_t gaList; ++ ++/**************************************************************************** ++* dot11Res Group * ++****************************************************************************/ ++static char resourceTypeIDName[] = "RTID"; ++static long haveResourceTypeIDName = 1; ++ ++/**************************************************************************** ++* dot11ResourceInfoTable * ++****************************************************************************/ ++static struct riTbl_data { ++ ++ char UID [ RI_UID_LEN + 1 ]; // unique ID ++ char ifName [ IFNAME_LEN + 1 ]; // ifName of card ++ ++ long ifIndex; // ifindex of card ++ ++ char manufacturerOUI [ MAN_OUI_LEN + 1 ]; ++ char manufacturerName [ SYS_STRING_LEN + 1 ]; ++ char manufacturerProductName [ SYS_STRING_LEN + 1 ]; ++ char manufacturerProductVersion [ SYS_STRING_LEN + 1 ]; ++ ++ char haveManufacturerOUI; ++ char haveManufacturerName; ++ char haveManufacturerProductName; ++ char haveManufacturerProductVersion; ++ ++} nRi, *ri = &nRi; ++ ++static avList_t riList; ++ ++/**************************************************************************** ++* dot11Phy Group * ++****************************************************************************/ ++/**************************************************************************** ++* dot11PhyOperationTable * ++****************************************************************************/ ++static struct poTbl_data { ++ ++ char UID [ PO_UID_LEN + 1 ]; // unique ID ++ char ifName [ IFNAME_LEN + 1 ]; // ifName of card ++ ++ long ifIndex; // ifindex of card ++ ++ long PHYType; ++ long currentRegDomain; ++ long tempType; ++ ++ long havePHYType; ++ long haveCurrentRegDomain; ++ long haveTempType; ++ ++} nPo, *po = &nPo; ++ ++static avList_t poList; ++ ++/**************************************************************************** ++* dot11PhyAntennaEntry * ++****************************************************************************/ ++static struct paTbl_data { ++ ++ char UID [ PA_UID_LEN + 1 ]; // unique ID ++ char ifName [ IFNAME_LEN + 1 ]; // ifName of card ++ ++ long ifIndex; // ifindex of card ++ ++ long currentTxAntenna; ++ long diversitySupport; ++ long currentRxAntenna; ++ ++ long haveCurrentTxAntenna; ++ long haveDiversitySupport; ++ long haveCurrentRxAntenna; ++ ++} nPa, *pa = &nPa; ++ ++static avList_t paList; ++ ++/**************************************************************************** ++* dot11PhyTxPowerTable * ++****************************************************************************/ ++static struct ptTbl_data { ++ ++ char UID [ PT_UID_LEN + 1 ]; // unique ID ++ char ifName [ IFNAME_LEN + 1 ]; // ifName of card ++ ++ long ifIndex; // ifindex of card ++ ++ long numberSupportedPowerLevels; ++ long TxPowerLevel1; ++ long TxPowerLevel2; ++ long TxPowerLevel3; ++ long TxPowerLevel4; ++ long TxPowerLevel5; ++ long TxPowerLevel6; ++ long TxPowerLevel7; ++ long TxPowerLevel8; ++ long currentTxPowerLevel; ++ ++ long haveNumberSupportedPowerLevels; ++ long haveTxPowerLevel1; ++ long haveTxPowerLevel2; ++ long haveTxPowerLevel3; ++ long haveTxPowerLevel4; ++ long haveTxPowerLevel5; ++ long haveTxPowerLevel6; ++ long haveTxPowerLevel7; ++ long haveTxPowerLevel8; ++ long haveCurrentTxPowerLevel ; ++ ++} nPt, *pt = &nPt; ++ ++static avList_t ptList; ++ ++/**************************************************************************** ++* dot11PhyFHSSTable * ++****************************************************************************/ ++static struct pfTbl_data { ++ ++ char UID [ PF_UID_LEN + 1 ]; // unique ID ++ char ifName [ IFNAME_LEN + 1 ]; // ifName of card ++ ++ long ifIndex; // ifindex of card ++ ++ long hopTime; ++ long currentChannelNumber; ++ long maxDwellTime; ++ long currentDwellTime; ++ long currentSet; ++ long currentPattern; ++ long currentIndex; ++ ++ long haveHopTime; ++ long haveCurrentChannelNumber; ++ long haveMaxDwellTime; ++ long haveCurrentDwellTime; ++ long haveCurrentSet; ++ long haveCurrentPattern; ++ long haveCurrentIndex; ++ ++} nPf, *pf = &nPf; ++ ++static avList_t pfList; ++ ++/**************************************************************************** ++* dot11PhyDSSSTable * ++****************************************************************************/ ++static struct pdTbl_data { ++ ++ char UID [ PD_UID_LEN + 1 ]; // unique ID ++ char ifName [ IFNAME_LEN + 1 ]; // ifName of card ++ ++ long ifIndex; // ifindex of card ++ ++ long currentChannel; ++ long CCAModeSupported; ++ long currentCCAMode; ++ long EDThreshold; ++ ++ long haveCurrentChannel; ++ long haveCCAModeSupported ; ++ long haveCurrentCCAMode; ++ long haveEDThreshold; ++ ++} nPd, *pd = &nPd; ++ ++static avList_t pdList; ++ ++/**************************************************************************** ++* dot11PhyIRTable * ++****************************************************************************/ ++static struct piTbl_data { ++ ++ char UID [ PI_UID_LEN + 1 ]; // unique ID ++ char ifName [ IFNAME_LEN + 1 ]; // ifName of card ++ ++ long ifIndex; // ifindex of card ++ ++ long CCAWatchdogTimerMax; ++ long CCAWatchdogCountMax; ++ long CCAWatchdogTimerMin; ++ long CCAWatchdogCountMin; ++ ++ long haveCCAWatchdogTimerMax; ++ long haveCCAWatchdogCountMax; ++ long haveCCAWatchdogTimerMin; ++ long haveCCAWatchdogCountMin; ++ ++} nPi, *pi = &nPi; ++ ++static avList_t piList; ++ ++/**************************************************************************** ++* dot11RegDomainsSupportedTable * ++****************************************************************************/ ++static struct rdTbl_data { ++ ++ char UID [ RD_UID_LEN + 1 ]; ++ char ifName [ IFNAME_LEN + 1 ]; ++ ++ long ifIndex; // ifindex of card ++ long regDomainsSupportIndex; ++ ++ long regDomainsSupportValue; ++ long haveRegDomainsSupportValue; ++ ++} nRd, *rd = &nRd; ++ ++static avList_t rdList; ++ ++/**************************************************************************** ++* dot11AntennasListTable * ++****************************************************************************/ ++static struct alTbl_data { ++ ++ char UID [ AL_UID_LEN + 1 ]; ++ char ifName [ IFNAME_LEN + 1 ]; ++ ++ long ifIndex; // ifindex of card ++ long antennaListIndex; ++ ++ long supportedTxAntenna; ++ long supportedRxAntenna; ++ long diversitySelectionRx ; ++ ++ long haveSupportedTxAntenna; ++ long haveSupportedRxAntenna; ++ long haveDiversitySelectionRx ; ++ ++} nAl, *al = &nAl; ++ ++static avList_t alList; ++ ++/**************************************************************************** ++* dot11SupportedDataRatesTxTable * ++****************************************************************************/ ++static struct rtTbl_data { ++ ++ char UID [ RT_UID_LEN + 1 ]; ++ char ifName [ IFNAME_LEN + 1 ]; ++ ++ long ifIndex; // ifindex of card ++ long supportedDataRatesTxIndex; ++ ++ long supportedDataRatesTxValue; ++ long haveSupportedDataRatesTxValue; ++ ++} nRt, *rt = &nRt; ++ ++static avList_t rtList; ++ ++/**************************************************************************** ++* dot11SupportedDataRatesRxTable * ++****************************************************************************/ ++static struct rrTbl_data { ++ ++ char UID [ RR_UID_LEN + 1 ]; ++ char ifName [ IFNAME_LEN + 1 ]; ++ ++ long ifIndex; // ifindex of card ++ long supportedDataRatesRxIndex; ++ ++ long supportedDataRatesRxValue; ++ long haveSupportedDataRatesRxValue; ++ ++} nRr, *rr = &nRr; ++ ++static avList_t rrList; ++ ++/**************************************************************************** ++* Wireless Extensions Structures * ++****************************************************************************/ ++static long wepCurrentKey; ++static long haveWepCurrentKey; ++static struct wepTbl_data { ++ ++ long len; ++ char key [ WEP_STR_LEN + 1 ]; ++ long haveKey; ++ ++} wep[4]; ++ ++/**************************************************************************** ++* * ++****************************************************************************/ ++config_require(util_funcs) ++ ++/* function prototypes */ ++ ++void init_ieee802dot11 ( void ); ++FindVarMethod var_ieee802dot11; ++FindVarMethod var_dot11StationConfigTable; ++FindVarMethod var_dot11AuthenticationAlgorithmsTable; ++FindVarMethod var_dot11WEPDefaultKeysTable; ++FindVarMethod var_dot11WEPKeyMappingsTable; ++FindVarMethod var_dot11PrivacyTable; ++FindVarMethod var_dot11OperationTable; ++FindVarMethod var_dot11CountersTable; ++FindVarMethod var_dot11GroupAddressesTable; ++FindVarMethod var_dot11ResourceInfoTable; ++FindVarMethod var_dot11PhyOperationTable; ++FindVarMethod var_dot11PhyAntennaTable; ++FindVarMethod var_dot11PhyTxPowerTable; ++FindVarMethod var_dot11PhyFHSSTable; ++FindVarMethod var_dot11PhyDSSSTable; ++FindVarMethod var_dot11PhyIRTable; ++FindVarMethod var_dot11RegDomainsSupportedTable; ++FindVarMethod var_dot11AntennasListTable; ++FindVarMethod var_dot11SupportedDataRatesTxTable; ++FindVarMethod var_dot11SupportedDataRatesRxTable; ++ ++WriteMethod write_dot11StationID; ++WriteMethod write_dot11MediumOccupancyLimit; ++WriteMethod write_dot11CFPPeriod; ++WriteMethod write_dot11CFPMaxDuration; ++WriteMethod write_dot11AuthenticationResponseTimeOut; ++WriteMethod write_dot11PowerManagementMode; ++WriteMethod write_dot11DesiredSSID; ++WriteMethod write_dot11DesiredBSSType; ++WriteMethod write_dot11OperationalRateSet; ++WriteMethod write_dot11BeaconPeriod; ++WriteMethod write_dot11DTIMPeriod; ++WriteMethod write_dot11AssociationResponseTimeOut; ++WriteMethod write_dot11AuthenticationAlgorithmsEnable; ++WriteMethod write_dot11WEPDefaultKeyValue; ++WriteMethod write_dot11WEPKeyMappingAddress; ++WriteMethod write_dot11WEPKeyMappingWEPOn; ++WriteMethod write_dot11WEPKeyMappingValue; ++WriteMethod write_dot11WEPKeyMappingStatus; ++WriteMethod write_dot11PrivacyInvoked; ++WriteMethod write_dot11WEPDefaultKeyID; ++WriteMethod write_dot11WEPKeyMappingLength; ++WriteMethod write_dot11ExcludeUnencrypted; ++WriteMethod write_dot11RTSThreshold; ++WriteMethod write_dot11ShortRetryLimit; ++WriteMethod write_dot11LongRetryLimit; ++WriteMethod write_dot11FragmentationThreshold; ++WriteMethod write_dot11MaxTransmitMSDULifetime; ++WriteMethod write_dot11MaxReceiveLifetime; ++WriteMethod write_dot11Address; ++WriteMethod write_dot11GroupAddressesStatus; ++WriteMethod write_dot11CurrentRegDomain; ++WriteMethod write_dot11CurrentTxAntenna; ++WriteMethod write_dot11CurrentRxAntenna; ++WriteMethod write_dot11CurrentTxPowerLevel; ++WriteMethod write_dot11CurrentChannelNumber; ++WriteMethod write_dot11CurrentDwellTime; ++WriteMethod write_dot11CurrentSet; ++WriteMethod write_dot11CurrentPattern; ++WriteMethod write_dot11CurrentIndex; ++WriteMethod write_dot11CurrentChannel; ++WriteMethod write_dot11CurrentCCAMode; ++WriteMethod write_dot11EDThreshold; ++WriteMethod write_dot11CCAWatchdogTimerMax; ++WriteMethod write_dot11CCAWatchdogCountMax; ++WriteMethod write_dot11CCAWatchdogTimerMin; ++WriteMethod write_dot11CCAWatchdogCountMin; ++WriteMethod write_dot11SupportedTxAntenna; ++WriteMethod write_dot11SupportedRxAntenna; ++WriteMethod write_dot11DiversitySelectionRx; ++ ++#endif /* _MIBGROUP_IEEE802DOT11_H */ +--- /dev/null ++++ b/agent/mibgroup/iwlib.h +@@ -0,0 +1,502 @@ ++/* ++ * Wireless Tools ++ * ++ * Jean II - HPLB 97->99 - HPL 99->02 ++ * ++ * Common header for the Wireless Extension library... ++ * ++ * This file is released under the GPL license. ++ * Copyright (c) 1997-2002 Jean Tourrilhes ++ */ ++ ++#ifndef IWLIB_H ++#define IWLIB_H ++ ++/*#include "CHANGELOG.h"*/ ++ ++/***************************** INCLUDES *****************************/ ++ ++/* Standard headers */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include /* gethostbyname, getnetbyname */ ++#include /* struct ether_addr */ ++#include /* struct timeval */ ++#include ++ ++/* This is our header selection. Try to hide the mess and the misery :-( ++ * Don't look, you would go blind ;-) */ ++ ++#ifndef LINUX_VERSION_CODE ++#include ++#endif ++ ++/* Kernel headers 2.4.X + Glibc 2.2 - Mandrake 8.0, Debian 2.3, RH 7.1 ++ * Kernel headers 2.2.X + Glibc 2.2 - Slackware 8.0 */ ++#if defined(__GLIBC__) \ ++ && __GLIBC__ == 2 \ ++ && __GLIBC_MINOR__ >= 2 \ ++ && LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) ++//#define GLIBC22_HEADERS ++#define GENERIC_HEADERS ++ ++/* Kernel headers 2.4.X + Glibc 2.1 - Debian 2.2 upgraded, RH 7.0 ++ * Kernel headers 2.2.X + Glibc 2.1 - Debian 2.2, RH 6.1 */ ++#elif defined(__GLIBC__) \ ++ && __GLIBC__ == 2 \ ++ && __GLIBC_MINOR__ == 1 \ ++ && LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) ++//#define GLIBC_HEADERS ++#define GENERIC_HEADERS ++ ++/* Kernel headers 2.2.X + Glibc 2.0 - Debian 2.1 */ ++#elif defined(__GLIBC__) \ ++ && __GLIBC__ == 2 \ ++ && __GLIBC_MINOR__ == 0 \ ++ && LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0) \ ++ && LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0) ++#define GLIBC_HEADERS ++#define KLUDGE_HEADERS ++ ++/* Note : is it really worth supporting kernel 2.0.X, knowing that ++ * we require WE v9, which is only available in 2.2.X and higher ? ++ * I guess one could use 2.0.x with an upgraded wireless.h... */ ++ ++/* Kernel headers 2.0.X + Glibc 2.0 - Debian 2.0, RH 5 */ ++#elif defined(__GLIBC__) \ ++ && __GLIBC__ == 2 \ ++ && __GLIBC_MINOR__ == 0 \ ++ && LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0) \ ++ && LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0) ++#define GLIBC_HEADERS ++ ++/* Kernel headers 2.0.X + libc5 - old systems */ ++#elif defined(_LINUX_C_LIB_VERSION_MAJOR) \ ++ && _LINUX_C_LIB_VERSION_MAJOR == 5 \ ++ && LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0) \ ++ && LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0) ++#define LIBC5_HEADERS ++ ++/* Unsupported combination */ ++#else ++#error "Your kernel/libc combination is not supported" ++#endif ++ ++#ifdef GENERIC_HEADERS ++/* Proposed by Dr. Michael Rietz , 27.3.2 */ ++/* If this works for all, it might be more stable on the long term - Jean II */ ++#include /* For ARPHRD_ETHER */ ++#include /* For AF_INET & struct sockaddr */ ++#include /* For struct sockaddr_in */ ++#include ++#endif /* GENERIC_HEADERS */ ++ ++#ifdef GLIBC22_HEADERS ++/* Added by Ross G. Miller , 3/28/01 */ ++#include /* For ARPHRD_ETHER */ ++#include /* For AF_INET & struct sockaddr */ ++#include ++#endif /* GLIBC22_HEADERS */ ++ ++#ifdef KLUDGE_HEADERS ++#include ++#endif /* KLUDGE_HEADERS */ ++ ++#ifdef GLIBC_HEADERS ++#include /* For ARPHRD_ETHER */ ++#include /* For AF_INET & struct sockaddr */ ++#include /* For struct sockaddr_in */ ++#endif /* KLUDGE_HEADERS || GLIBC_HEADERS */ ++ ++#ifdef LIBC5_HEADERS ++#include /* For AF_INET & struct sockaddr & socket() */ ++#include /* For ARPHRD_ETHER */ ++#include /* For struct sockaddr_in */ ++#endif /* LIBC5_HEADERS */ ++ ++/* Those 3 headers were previously included in wireless.h */ ++#include /* for "caddr_t" et al */ ++#include /* for "struct sockaddr" et al */ ++#include /* for IFNAMSIZ and co... */ ++ ++#ifdef WEXT_HEADER ++/* Private copy of Wireless extensions */ ++#include WEXT_HEADER ++#else /* !WEXT_HEADER */ ++/* System wide Wireless extensions */ ++#include ++#endif /* !WEXT_HEADER */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/****************************** DEBUG ******************************/ ++ ++ ++/************************ CONSTANTS & MACROS ************************/ ++ ++/* Paths */ ++#define PROC_NET_WIRELESS "/proc/net/wireless" ++#define PROC_NET_DEV "/proc/net/dev" ++ ++/* Some useful constants */ ++#define KILO 1e3 ++#define MEGA 1e6 ++#define GIGA 1e9 ++/* For doing log10/exp10 without libm */ ++#define LOG10_MAGIC 1.25892541179 ++ ++/* Backward compatibility for Wireless Extension 9 */ ++#ifndef IW_POWER_MODIFIER ++#define IW_POWER_MODIFIER 0x000F /* Modify a parameter */ ++#define IW_POWER_MIN 0x0001 /* Value is a minimum */ ++#define IW_POWER_MAX 0x0002 /* Value is a maximum */ ++#define IW_POWER_RELATIVE 0x0004 /* Value is not in seconds/ms/us */ ++#endif /* IW_POWER_MODIFIER */ ++ ++#ifndef IW_ENCODE_NOKEY ++#define IW_ENCODE_NOKEY 0x0800 /* Key is write only, so not here */ ++#define IW_ENCODE_MODE 0xF000 /* Modes defined below */ ++#endif /* IW_ENCODE_NOKEY */ ++#ifndef IW_ENCODE_TEMP ++#define IW_ENCODE_TEMP 0x0400 /* Temporary key */ ++#endif /* IW_ENCODE_TEMP */ ++ ++/* More backward compatibility */ ++#ifndef SIOCSIWCOMMIT ++#define SIOCSIWCOMMIT SIOCSIWNAME ++#endif /* SIOCSIWCOMMIT */ ++ ++/****************************** TYPES ******************************/ ++ ++/* Shortcuts */ ++typedef struct iw_statistics iwstats; ++typedef struct iw_range iwrange; ++typedef struct iw_param iwparam; ++typedef struct iw_freq iwfreq; ++typedef struct iw_quality iwqual; ++typedef struct iw_priv_args iwprivargs; ++typedef struct sockaddr sockaddr; ++ ++/* Structure for storing all wireless information for each device ++ * This is pretty exhaustive... */ ++typedef struct wireless_info ++{ ++ char name[IFNAMSIZ + 1]; /* Wireless/protocol name */ ++ int has_nwid; ++ iwparam nwid; /* Network ID */ ++ int has_freq; ++ double freq; /* Frequency/channel */ ++ int has_sens; ++ iwparam sens; /* sensitivity */ ++ int has_key; ++ unsigned char key[IW_ENCODING_TOKEN_MAX]; /* Encoding key used */ ++ int key_size; /* Number of bytes */ ++ int key_flags; /* Various flags */ ++ int has_essid; ++ int essid_on; ++ char essid[IW_ESSID_MAX_SIZE + 1]; /* ESSID (extended network) */ ++ int has_nickname; ++ char nickname[IW_ESSID_MAX_SIZE + 1]; /* NickName */ ++ int has_ap_addr; ++ sockaddr ap_addr; /* Access point address */ ++ int has_bitrate; ++ iwparam bitrate; /* Bit rate in bps */ ++ int has_rts; ++ iwparam rts; /* RTS threshold in bytes */ ++ int has_frag; ++ iwparam frag; /* Fragmentation threshold in bytes */ ++ int has_mode; ++ int mode; /* Operation mode */ ++ int has_power; ++ iwparam power; /* Power management parameters */ ++ int has_txpower; ++ iwparam txpower; /* Transmit Power in dBm */ ++ int has_retry; ++ iwparam retry; /* Retry limit or lifetime */ ++ ++ /* Stats */ ++ iwstats stats; ++ int has_stats; ++ iwrange range; ++ int has_range; ++} wireless_info; ++ ++/* Structure for storing all wireless information for each device ++ * This is a cut down version of the one above, containing only ++ * the things *truly* needed to configure a card. ++ * Don't add other junk, I'll remove it... */ ++typedef struct wireless_config ++{ ++ char name[IFNAMSIZ + 1]; /* Wireless/protocol name */ ++ int has_nwid; ++ iwparam nwid; /* Network ID */ ++ int has_freq; ++ double freq; /* Frequency/channel */ ++ int has_key; ++ unsigned char key[IW_ENCODING_TOKEN_MAX]; /* Encoding key used */ ++ int key_size; /* Number of bytes */ ++ int key_flags; /* Various flags */ ++ int has_essid; ++ int essid_on; ++ char essid[IW_ESSID_MAX_SIZE + 1]; /* ESSID (extended network) */ ++ int has_mode; ++ int mode; /* Operation mode */ ++} wireless_config; ++ ++typedef struct stream_descr ++{ ++ char * end; /* End of the stream */ ++ char * current; /* Current event in stream of events */ ++ char * value; /* Current value in event */ ++} stream_descr; ++ ++/* Prototype for handling display of each single interface on the ++ * system - see iw_enum_devices() */ ++typedef int (*iw_enum_handler)(int skfd, ++ char * ifname, ++ char * args[], ++ int count); ++ ++/**************************** PROTOTYPES ****************************/ ++/* ++ * All the functions in iwcommon.c ++ */ ++ ++/* ---------------------- SOCKET SUBROUTINES -----------------------*/ ++int ++ iw_sockets_open(void); ++void ++ iw_enum_devices(int skfd, ++ iw_enum_handler fn, ++ char * args[], ++ int count); ++/* --------------------- WIRELESS SUBROUTINES ----------------------*/ ++int ++ iw_get_range_info(int skfd, ++ char * ifname, ++ iwrange * range); ++int ++ iw_print_version_info(char * toolname); ++int ++ iw_get_priv_info(int skfd, ++ char * ifname, ++ iwprivargs * priv, ++ int maxpriv); ++int ++ iw_get_basic_config(int skfd, ++ char * ifname, ++ wireless_config * info); ++int ++ iw_set_basic_config(int skfd, ++ char * ifname, ++ wireless_config * info); ++/* --------------------- PROTOCOL SUBROUTINES --------------------- */ ++int ++ iw_protocol_compare(char * protocol1, ++ char * protocol2); ++/* -------------------- FREQUENCY SUBROUTINES --------------------- */ ++void ++ iw_float2freq(double in, ++ iwfreq * out); ++double ++ iw_freq2float(iwfreq * in); ++void ++ iw_print_freq(char * buffer, ++ double freq); ++int ++ iw_freq_to_channel(double freq, ++ struct iw_range * range); ++void ++ iw_print_bitrate(char * buffer, ++ int bitrate); ++/* ---------------------- POWER SUBROUTINES ----------------------- */ ++int ++ iw_dbm2mwatt(int in); ++int ++ iw_mwatt2dbm(int in); ++/* -------------------- STATISTICS SUBROUTINES -------------------- */ ++int ++ iw_get_stats(int skfd, ++ char * ifname, ++ iwstats * stats); ++void ++ iw_print_stats(char * buffer, ++ iwqual * qual, ++ iwrange * range, ++ int has_range); ++/* --------------------- ENCODING SUBROUTINES --------------------- */ ++void ++ iw_print_key(char * buffer, ++ unsigned char * key, ++ int key_size, ++ int key_flags); ++int ++ iw_in_key(char * input, ++ unsigned char * key); ++int ++ iw_in_key_full(int skfd, ++ char * ifname, ++ char * input, ++ unsigned char * key, ++ __u16 * flags); ++/* ----------------- POWER MANAGEMENT SUBROUTINES ----------------- */ ++void ++ iw_print_pm_value(char * buffer, ++ int value, ++ int flags); ++void ++ iw_print_pm_mode(char * buffer, ++ int flags); ++/* --------------- RETRY LIMIT/LIFETIME SUBROUTINES --------------- */ ++#if WIRELESS_EXT > 10 ++void ++ iw_print_retry_value(char * buffer, ++ int value, ++ int flags); ++#endif ++/* ----------------------- TIME SUBROUTINES ----------------------- */ ++void ++ iw_print_timeval(char * buffer, ++ const struct timeval * time); ++/* --------------------- ADDRESS SUBROUTINES ---------------------- */ ++int ++ iw_check_mac_addr_type(int skfd, ++ char * ifname); ++int ++ iw_check_if_addr_type(int skfd, ++ char * ifname); ++#if 0 ++int ++ iw_check_addr_type(int skfd, ++ char * ifname); ++#endif ++void ++ iw_ether_ntop(const struct ether_addr* eth, char* buf); ++char* ++ iw_ether_ntoa(const struct ether_addr* eth); ++int ++ iw_ether_aton(const char* bufp, struct ether_addr* eth); ++int ++ iw_in_inet(char *bufp, struct sockaddr *sap); ++int ++ iw_in_addr(int skfd, ++ char * ifname, ++ char * bufp, ++ struct sockaddr * sap); ++/* ----------------------- MISC SUBROUTINES ------------------------ */ ++int ++ iw_get_priv_size(int args); ++ ++#if WIRELESS_EXT > 13 ++/* ---------------------- EVENT SUBROUTINES ---------------------- */ ++void ++ iw_init_event_stream(struct stream_descr * stream, ++ char * data, ++ int len); ++int ++ iw_extract_event_stream(struct stream_descr * stream, ++ struct iw_event * iwe); ++#endif /* WIRELESS_EXT > 13 */ ++ ++/**************************** VARIABLES ****************************/ ++ ++extern const char * const iw_operation_mode[]; ++#define IW_NUM_OPER_MODE 7 ++ ++/************************* INLINE FUNTIONS *************************/ ++/* ++ * Functions that are so simple that it's more efficient inlining them ++ */ ++ ++/* ++ * Note : I've defined wrapper for the ioctl request so that ++ * it will be easier to migrate to other kernel API if needed ++ */ ++ ++/*------------------------------------------------------------------*/ ++/* ++ * Wrapper to push some Wireless Parameter in the driver ++ */ ++static inline int ++iw_set_ext(int skfd, /* Socket to the kernel */ ++ char * ifname, /* Device name */ ++ int request, /* WE ID */ ++ struct iwreq * pwrq) /* Fixed part of the request */ ++{ ++ /* Set device name */ ++ strncpy(pwrq->ifr_name, ifname, IFNAMSIZ); ++ /* Do the request */ ++ return(ioctl(skfd, request, pwrq)); ++} ++ ++/*------------------------------------------------------------------*/ ++/* ++ * Wrapper to extract some Wireless Parameter out of the driver ++ */ ++static inline int ++iw_get_ext(int skfd, /* Socket to the kernel */ ++ char * ifname, /* Device name */ ++ int request, /* WE ID */ ++ struct iwreq * pwrq) /* Fixed part of the request */ ++{ ++ /* Set device name */ ++ strncpy(pwrq->ifr_name, ifname, IFNAMSIZ); ++ /* Do the request */ ++ return(ioctl(skfd, request, pwrq)); ++} ++ ++/*------------------------------------------------------------------*/ ++/* Backwards compatibility ++ * Actually, those form are much easier to use when dealing with ++ * struct sockaddr... */ ++static inline char* ++iw_pr_ether(char* bufp, const unsigned char* addr) ++{ ++ iw_ether_ntop((const struct ether_addr *) addr, bufp); ++ return bufp; ++} ++/* Backwards compatibility */ ++static inline int ++iw_in_ether(const char *bufp, struct sockaddr *sap) ++{ ++ sap->sa_family = ARPHRD_ETHER; ++ return iw_ether_aton(bufp, (struct ether_addr *) sap->sa_data) ? 0 : -1; ++} ++ ++/*------------------------------------------------------------------*/ ++/* ++ * Create an Ethernet broadcast address ++ */ ++static inline void ++iw_broad_ether(struct sockaddr *sap) ++{ ++ sap->sa_family = ARPHRD_ETHER; ++ memset((char *) sap->sa_data, 0xFF, ETH_ALEN); ++} ++ ++/*------------------------------------------------------------------*/ ++/* ++ * Create an Ethernet NULL address ++ */ ++static inline void ++iw_null_ether(struct sockaddr *sap) ++{ ++ sap->sa_family = ARPHRD_ETHER; ++ memset((char *) sap->sa_data, 0x00, ETH_ALEN); ++} ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* IWLIB_H */ diff --git a/net/net-snmp/patches/800-format-security.patch b/net/net-snmp/patches/800-format-security.patch new file mode 100644 index 0000000..87a3e92 --- /dev/null +++ b/net/net-snmp/patches/800-format-security.patch @@ -0,0 +1,29 @@ +--- a/agent/mibgroup/host/hr_filesys.c ++++ b/agent/mibgroup/host/hr_filesys.c +@@ -322,13 +322,13 @@ var_hrfilesys(struct variable *vp, + long_return = fsys_idx; + return (u_char *) & long_return; + case HRFSYS_MOUNT: +- snprintf(string, sizeof(string), HRFS_entry->HRFS_mount); ++ snprintf(string, sizeof(string), "%s", HRFS_entry->HRFS_mount); + string[ sizeof(string)-1 ] = 0; + *var_len = strlen(string); + return (u_char *) string; + case HRFSYS_RMOUNT: + if (Check_HR_FileSys_NFS()) { +- snprintf(string, sizeof(string), HRFS_entry->HRFS_name); ++ snprintf(string, sizeof(string), "%s", HRFS_entry->HRFS_name); + string[ sizeof(string)-1 ] = 0; + } else + string[0] = '\0'; +--- a/agent/mibgroup/ucd-snmp/extensible.c ++++ b/agent/mibgroup/ucd-snmp/extensible.c +@@ -513,7 +513,7 @@ fixExecError(int action, + } + tmp = *((long *) var_val); + if ((tmp == 1) && (action == COMMIT) && (exten->fixcmd[0] != 0)) { +- sprintf(ex.command, exten->fixcmd); ++ sprintf(ex.command, "%s", exten->fixcmd); + if ((fd = get_exec_output(&ex)) != -1) { + file = fdopen(fd, "r"); + while (fgets(ex.output, sizeof(ex.output), file) != NULL); diff --git a/net/net-snmp/patches/900-musl-compat.patch b/net/net-snmp/patches/900-musl-compat.patch new file mode 100644 index 0000000..fa9a01e --- /dev/null +++ b/net/net-snmp/patches/900-musl-compat.patch @@ -0,0 +1,14 @@ +--- a/agent/mibgroup/iwlib.h ++++ b/agent/mibgroup/iwlib.h +@@ -85,6 +85,11 @@ + && LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0) + #define LIBC5_HEADERS + ++/* Musl */ ++#elif !defined(__GLIBC__) && !defined(__UCLIBC__) \ ++ && LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) ++#define GENERIC_HEADERS ++ + /* Unsupported combination */ + #else + #error "Your kernel/libc combination is not supported" diff --git a/net/netatalk/Makefile b/net/netatalk/Makefile new file mode 100644 index 0000000..ddfedbf --- /dev/null +++ b/net/netatalk/Makefile @@ -0,0 +1,97 @@ +# +# 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:=3.1.10 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=@SF/netatalk +PKG_MD5SUM:=2b40161985bb32cff5660bf689a4704f15c33bb87565efc7805dd5c75ad1fcc7 + +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:=+libattr +libdb47 +libgcrypt +libopenssl $(LIBRPC_DEPENDS) + TITLE:=netatalk + URL:=http://netatalk.sourceforge.net + MAINTAINER:=Daniel Golle +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-kerberos \ + --without-mysql \ + --with-mysql-config=false \ + --without-pam \ + --disable-admin-group \ + --disable-srvloc \ + --disable-zeroconf \ + $(if $(CONFIG_SHADOW_PASSWORDS),--with-shadow,--without-shadow) \ + --without-ldap + +define Package/netatalk/conffiles +/etc/afp.conf +/etc/extmap.conf +/etc/netatalk/ +endef + +define Package/netatalk/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/lib/uams + $(INSTALL_DIR) $(1)/etc/init.d + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libatalk.so* $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/bin/dbd $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/ad $(1)/usr/bin/ + $(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/ + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/afp.conf $(1)/etc/ + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/extmap.conf $(1)/etc/ + $(INSTALL_BIN) ./files/afpd.init $(1)/etc/init.d/afpd +endef + +$(eval $(call BuildPackage,netatalk)) diff --git a/net/netatalk/files/afpd.init b/net/netatalk/files/afpd.init new file mode 100644 index 0000000..8fab349 --- /dev/null +++ b/net/netatalk/files/afpd.init @@ -0,0 +1,23 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2010-2012 OpenWrt.org + +START=80 +STOP=10 + +USE_PROCD=1 + +start_service() { + mkdir -p /var/netatalk/CNID/ + + procd_open_instance + procd_set_param command /usr/sbin/afpd -d -F /etc/afp.conf + procd_set_param file /etc/afp.conf + procd_set_param respawn + procd_close_instance + + procd_open_instance + procd_set_param command /usr/sbin/cnid_metad -d + procd_set_param respawn + procd_close_instance +} + diff --git a/net/netatalk/patches/001-automake-compat.patch b/net/netatalk/patches/001-automake-compat.patch new file mode 100644 index 0000000..28c107a --- /dev/null +++ b/net/netatalk/patches/001-automake-compat.patch @@ -0,0 +1,9 @@ +--- a/macros/iconv.m4 ++++ b/macros/iconv.m4 +@@ -115,6 +115,5 @@ int main() { + + CFLAGS="$savedcflags" + LDFLAGS="$savedldflags" +- CPPFLAGS="$saved_CPPFLAGS" + + ]) diff --git a/net/netatalk/patches/002-ld_library_path.patch b/net/netatalk/patches/002-ld_library_path.patch new file mode 100644 index 0000000..73be55a --- /dev/null +++ b/net/netatalk/patches/002-ld_library_path.patch @@ -0,0 +1,26 @@ +--- a/macros/db3-check.m4 ++++ b/macros/db3-check.m4 +@@ -148,9 +148,9 @@ if test "x$bdb_required" = "xyes"; then + dnl -- LD_LIBRARY_PATH on many platforms. This will be fairly + dnl -- portable hopefully. Reference: + dnl -- http://lists.gnu.org/archive/html/autoconf/2009-03/msg00040.html +- eval export $shlibpath_var=$bdblibdir ++# eval export $shlibpath_var=$bdblibdir + NETATALK_BDB_TRY_LINK +- eval export $shlibpath_var=$saved_shlibpath_var ++# eval export $shlibpath_var=$saved_shlibpath_var + + if test x"${atalk_cv_bdb_version}" = x"yes"; then + BDB_CFLAGS="-I${bdbdir}/include${subdir}" +@@ -177,9 +177,9 @@ if test "x$bdb_required" = "xyes"; then + CPPFLAGS="-I${bdbdir}/include${subdir} $CPPFLAGS" + LDFLAGS="-L$bdblibdir $LDFLAGS" + +- eval export $shlibpath_var=$bdblibdir ++# eval export $shlibpath_var=$bdblibdir + NETATALK_BDB_TRY_LINK +- eval export $shlibpath_var=$saved_shlibpath_var ++# eval export $shlibpath_var=$saved_shlibpath_var + + if test x"${atalk_cv_bdb_version}" = x"yes"; then + BDB_CFLAGS="-I${bdbdir}/include${subdir}" diff --git a/net/netcat/Makefile b/net/netcat/Makefile new file mode 100644 index 0000000..0248f0d --- /dev/null +++ b/net/netcat/Makefile @@ -0,0 +1,65 @@ +# +# Copyright (C) 2015 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:=netcat +PKG_VERSION:=0.7.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=@SF/$(PKG_NAME) +PKG_MD5SUM:=0a29eff1736ddb5effd0b1ec1f6fe0ef +PKG_MAINTAINER:=Adam Gensler +PKG_LICENSE:=GPL-2.0 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/netcat + SECTION:=net + CATEGORY:=Network + TITLE:=A feature-rich network debugging and exploration tool. + URL:=http://netcat.sourceforge.net/ +endef + +define Package/netcat/description + Netcat is a featured networking utility which reads and writes data across network connections, using the TCP/IP protocol. + It is designed to be a reliable "back-end" tool that can be used directly or easily driven by other programs and scripts. At the same time, it is a feature-rich network debugging and exploration tool, since it can create almost any kind of connection you would need and has several interesting built-in capabilities. +endef + +define Build/Configure + $(call Build/Configure/Default, \ + --disable-rpath \ + --with-included-getopt \ + ) +endef + +define Package/netcat/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/netcat \ + $(1)/usr/bin +endef + +define Package/netcat/postinst +#!/bin/sh +if [ -e $${IPKG_INSTROOT}/usr/bin/nc ]; then + rm -rf $${IPKG_INSTROOT}/usr/bin/nc; +fi +ln -s ./netcat $${IPKG_INSTROOT}/usr/bin/nc +endef + +define Package/netcat/postrm +#!/bin/sh +rm $${IPKG_INSTROOT}/usr/bin/nc +ln -s ../../bin/busybox $${IPKG_INSTROOT}/usr/bin/nc +$${IPKG_INSTROOT}/usr/bin/nc 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/usr/bin/nc +exit 0 +endef + + +$(eval $(call BuildPackage,netcat)) diff --git a/net/netcat/patches/001-netcat_flag_count.patch b/net/netcat/patches/001-netcat_flag_count.patch new file mode 100644 index 0000000..44ee9e1 --- /dev/null +++ b/net/netcat/patches/001-netcat_flag_count.patch @@ -0,0 +1,22 @@ +Index: netcat-0.7.1/src/flagset.c +=================================================================== +--- netcat-0.7.1.orig/src/flagset.c 2009-02-06 19:56:01.000000000 +0100 ++++ netcat-0.7.1/src/flagset.c 2009-02-06 19:56:13.000000000 +0100 +@@ -134,7 +134,7 @@ + + int netcat_flag_count(void) + { +- register char c; ++ register unsigned char c; + register int i; + int ret = 0; + +@@ -154,7 +154,7 @@ + Assumed that the bit number 1 is the sign, and that we will shift the + bit 1 (or the bit that takes its place later) until the the most right, + WHY it has to keep the wrong sign? */ +- ret -= (c >> 7); ++ ret += (c >> 7); + c <<= 1; + } + } diff --git a/net/netdiscover/Makefile b/net/netdiscover/Makefile new file mode 100644 index 0000000..8002d84 --- /dev/null +++ b/net/netdiscover/Makefile @@ -0,0 +1,42 @@ +# +# Copyright (C) 2015 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:=netdiscover +PKG_VERSION:=0.3-pre-beta7 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-LINUXONLY.tar.gz +PKG_SOURCE_URL:=@SF/netdiscover +PKG_MD5SUM:=8780e66d00496e933b4064cfe9ae61da +PKG_MAINTAINER:=Mislav Novakovic +PKG_LICENSE:=GPL-2.0 + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/netdiscover + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpcap +libnet-1.2.x +libpthread + TITLE:=An active/passive address reconnaissance tool + URL:=https://sourceforge.net/projects/netdiscover +endef + +CONFIGURE_VARS+= \ + CPPFLAGS="$(TARGET_CPPFLAGS) -I$(STAGING_DIR)/usr/lib/libnet-1.2.x/lib" \ + LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib/libnet-1.2.x/lib" + +define Package/netdiscover/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/netdiscover $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,netdiscover)) diff --git a/net/netperf/Makefile b/net/netperf/Makefile new file mode 100644 index 0000000..f50b7e8 --- /dev/null +++ b/net/netperf/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2006-2011 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:=netperf +PKG_VERSION:=2.7.0 +PKG_RELEASE:=1 +PKG_LICENSE:=Custom + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=ftp://ftp.netperf.org/netperf/ +PKG_MD5SUM:=ad1c5342d61f297c417a93133aeba65a + +include $(INCLUDE_DIR)/package.mk + +define Package/netperf + SECTION:=net + CATEGORY:=Network + TITLE:=Network performance measurement tool + URL:=http://www.netperf.org/ + MAINTAINER:=Toke Høiland-Jørgensen +endef + +TARGET_CFLAGS+=-std=gnu89 + +CONFIGURE_ARGS += --enable-demo + +define Package/netperf/install + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/netserver.init $(1)/etc/init.d/netserver + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/netperf $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/netserver $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/lib/netperf + $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/arr_script $(1)/lib/netperf + $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/packet_byte_script $(1)/lib/netperf + $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/sctp_stream_script $(1)/lib/netperf + $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/snapshot_script $(1)/lib/netperf + $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/tcp_range_script $(1)/lib/netperf + $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/tcp_rr_script $(1)/lib/netperf + $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/tcp_stream_script $(1)/lib/netperf + $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/udp_rr_script $(1)/lib/netperf + $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/udp_stream_script $(1)/lib/netperf +endef + +$(eval $(call BuildPackage,netperf)) diff --git a/net/netperf/files/netserver.init b/net/netperf/files/netserver.init new file mode 100644 index 0000000..42fcf33 --- /dev/null +++ b/net/netperf/files/netserver.init @@ -0,0 +1,12 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=50 + +start() { + service_start /usr/bin/netserver +} + +stop() { + service_stop /usr/bin/netserver +} diff --git a/net/nfs-kernel-server/Makefile b/net/nfs-kernel-server/Makefile new file mode 100644 index 0000000..26ff4bd --- /dev/null +++ b/net/nfs-kernel-server/Makefile @@ -0,0 +1,158 @@ +# Copyright (C) 2009-2016 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:=nfs-kernel-server +PKG_VERSION:=1.3.4 +PKG_RELEASE:=1 +PKG_MD5SUM:=2fabdadb8ff415a1eafcfb12ab1bf781 + +PKG_SOURCE_URL:=@SF/nfs +PKG_SOURCE:=nfs-utils-$(PKG_VERSION).tar.bz2 + +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/nfs-utils-$(PKG_VERSION) +PKG_BUILD_DIR:=$(BUILD_DIR)/nfs-utils-$(PKG_VERSION) +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 +PKG_BUILD_DEPENDS:=$(PKG_NAME)/host + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/package.mk + +define Package/nfs-kernel-server/Default + SECTION:=net + CATEGORY:=Network + SUBMENU:=Filesystem + DEPENDS:=+libwrap +libblkid +libuuid $(LIBRPC_DEPENDS) + URL:=http://nfs.sourceforge.net/ + MAINTAINER:=Peter Wagner +endef + +define Package/nfs-kernel-server + $(call Package/nfs-kernel-server/Default) + TITLE:=Kernel NFS server support + DEPENDS+= +kmod-fs-nfsd +kmod-fs-nfs +portmap +endef + +define Package/nfs-kernel-server/description + Kernel NFS server support +endef + +define Package/nfs-kernel-server-utils + $(call Package/nfs-kernel-server/Default) + TITLE:=NFS server utils + DEPENDS:=nfs-kernel-server +endef + +define Package/nfs-kernel-server-utils/description + NFS server utils +endef + +define Package/nfs-kernel-server/conffiles +/etc/exports +endef + +define Package/nfs-utils + $(call Package/nfs-kernel-server/Default) + SECTION:=utils + CATEGORY:=Utilities + DEPENDS+= +libevent2 +USE_UCLIBC:librpc + TITLE:=updated mount utility (includes nfs4) +endef + +define Package/nfs-utils/description + Updated mount.nfs command - allows mounting nfs4 volumes +endef + +TARGET_CFLAGS += -I$(PKG_BUILD_DIR)/lib -I$(STAGING_DIR)/usr/include/libevent \ + -I$(STAGING_DIR)/usr/include/ -Drpc_uint=uint +TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib $(LIBRPC) \ + -L$(STAGING_DIR)/usr/lib/libevent + +CONFIGURE_ARGS += \ + --disable-gss \ + --disable-nfsv4 \ + --disable-nfsv41 \ + --disable-ipv6 \ + --enable-static \ + --enable-shared \ + --disable-caps \ + --disable-tirpc \ + --disable-nfsdcld + +CONFIGURE_VARS += \ + libblkid_cv_is_recent=yes \ + CONFIG_SQLITE3_TRUE="\#" \ + CONFIG_NFSDCLD_TRUE="\#" + +MAKE_FLAGS += \ + OPT="$(TARGET_CFLAGS)" \ + INSTALLSUID="install -m 4755" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + RPCGEN_PATH=$(STAGING_DIR)/host/bin/rpcgen \ + RPCGEN=$(STAGING_DIR)/host/bin/rpcgen + +HOST_CFLAGS += -Dlinux + +HOST_CONFIGURE_ARGS += \ + --disable-gss \ + --disable-nfsv4 \ + --disable-nfsv41 \ + --disable-ipv6 \ + --disable-tirpc \ + --without-tcp-wrappers + +HOST_CONFIGURE_VARS += \ + ac_cv_lib_event_event_dispatch=yes \ + ac_cv_lib_nfsidmap_nfs4_init_name_mapping=yes \ + ac_cv_lib_blkid_blkid_get_library_version=yes \ + ac_cv_header_event_h=yes \ + ac_cv_header_nfsidmap_h=yes \ + ac_cv_header_blkid_blkid_h=yes \ + GSSGLUE_CFLAGS=" " \ + GSSGLUE_LIBS=" " \ + RPCSECGSS_CFLAGS=" " \ + RPCSECGSS_LIBS=" " \ + CONFIG_SQLITE3_TRUE="\#" \ + CONFIG_NFSDCLD_TRUE="\#" + +define Host/Compile + $(MAKE) -C $(HOST_BUILD_DIR)/tools/rpcgen all +endef + +define Host/Install + $(INSTALL_DIR) $(STAGING_DIR)/host/bin + $(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/rpcgen/rpcgen $(STAGING_DIR)/host/bin/rpcgen +endef + +define Package/nfs-kernel-server/install + $(INSTALL_DIR) $(1)/etc/init.d $(1)/usr/sbin + $(INSTALL_DATA) ./files/nfsd.exports $(1)/etc/exports + $(INSTALL_BIN) ./files/nfsd.init $(1)/etc/init.d/nfsd + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/statd/sm-notify $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/statd/statd $(1)/usr/sbin/rpc.statd + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/nfsd/nfsd $(1)/usr/sbin/rpc.nfsd + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/mountd/mountd $(1)/usr/sbin/rpc.mountd + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/exportfs/exportfs $(1)/usr/sbin/ +endef + +define Package/nfs-kernel-server-utils/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/showmount/showmount $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/nfsstat/nfsstat $(1)/usr/sbin +endef + +define Package/nfs-utils/install + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/mount.nfs $(1)/sbin/ + (cd $(1)/sbin; ln -sf mount.nfs mount.nfs4; ln -sf mount.nfs umount.nfs; ln -sf mount.nfs umount.nfs4) +endef + +$(eval $(call HostBuild)) +$(eval $(call BuildPackage,nfs-kernel-server)) +$(eval $(call BuildPackage,nfs-kernel-server-utils)) +$(eval $(call BuildPackage,nfs-utils)) diff --git a/net/nfs-kernel-server/files/nfsd.exports b/net/nfs-kernel-server/files/nfsd.exports new file mode 100644 index 0000000..0453e04 --- /dev/null +++ b/net/nfs-kernel-server/files/nfsd.exports @@ -0,0 +1 @@ +/mnt *(ro,all_squash,insecure,sync) diff --git a/net/nfs-kernel-server/files/nfsd.init b/net/nfs-kernel-server/files/nfsd.init new file mode 100644 index 0000000..af36c12 --- /dev/null +++ b/net/nfs-kernel-server/files/nfsd.init @@ -0,0 +1,38 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +START=99 +STOP=60 + +USE_PROCD=1 + +NFS_D=/var/lib/nfs +LOCK_D=/var/lib/nfs/sm + +start_service() { + grep -q /proc/fs/nfsd /proc/mounts || \ + mount -t nfsd nfsd /proc/fs/nfsd + mkdir -p $NFS_D + mkdir -p $LOCK_D + touch $NFS_D/rmtab + + sysctl -w fs.nfs.nlm_tcpport=32777 fs.nfs.nlm_udpport=32777 > /dev/null + + procd_open_instance + procd_set_param command /usr/sbin/rpc.statd -p 32778 -o 32779 -F + procd_close_instance + + /usr/sbin/exportfs -r + /usr/sbin/rpc.nfsd + + procd_open_instance + procd_set_param command /usr/sbin/rpc.mountd -p 32780 -F + procd_close_instance +} + +stop_service() { + rpc.nfsd 0 2> /dev/null + /usr/sbin/exportfs -au + grep -q /proc/fs/nfsd /proc/mounts && \ + umount /proc/fs/nfsd +} diff --git a/net/nfs-kernel-server/patches/100-no_malloc_h.patch b/net/nfs-kernel-server/patches/100-no_malloc_h.patch new file mode 100644 index 0000000..afe4c98 --- /dev/null +++ b/net/nfs-kernel-server/patches/100-no_malloc_h.patch @@ -0,0 +1,10 @@ +--- a/tools/rpcgen/rpc_cout.c ++++ b/tools/rpcgen/rpc_cout.c +@@ -36,7 +36,6 @@ static char sccsid[] = "@(#)rpc_cout.c 1 + #include + #include + #include +-#include + #include + #include "rpc_parse.h" + #include "rpc_util.h" diff --git a/net/nfs-kernel-server/patches/101-musl-getservbyport.patch b/net/nfs-kernel-server/patches/101-musl-getservbyport.patch new file mode 100644 index 0000000..efe565c --- /dev/null +++ b/net/nfs-kernel-server/patches/101-musl-getservbyport.patch @@ -0,0 +1,18 @@ +Musl will always return something with getservbyport so we cannot skip +ports that returns non-null. + +diff --git a/utils/statd/rmtcall.c b/utils/statd/rmtcall.c +index fd576d9..d72a0bf 100644 +--- a/utils/statd/rmtcall.c ++++ b/utils/statd/rmtcall.c +@@ -90,8 +90,10 @@ statd_get_socket(void) + __func__); + break; + } ++#if defined(__GLIBC__) || defined(__UCLIBC__) + se = getservbyport(sin.sin_port, "udp"); + if (se == NULL) ++#endif + break; + /* rather not use that port, try again */ + diff --git a/net/nginx/Config.in b/net/nginx/Config.in new file mode 100644 index 0000000..bf6b834 --- /dev/null +++ b/net/nginx/Config.in @@ -0,0 +1,185 @@ +# +# Copyright (C) 2010-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +menu "Configuration" + depends on PACKAGE_nginx + +config NGINX_SSL + bool + prompt "Enable SSL module" + help + Enable HTTPS/SSL support. + default n + +config NGINX_DAV + bool + prompt "Enable WebDAV module" + help + Enable the HTTP and WebDAV methods PUT, DELETE, MKCOL, COPY and MOVE. + default n + +config NGINX_FLV + bool + prompt "Enable FLV module" + help + Provides the ability to seek within FLV (Flash) files using time-based offsets. + default n + +config NGINX_STUB_STATUS + bool + prompt "Enable stub status module" + help + Enable the stub status module which gives some status from the server. + default n + +config NGINX_HTTP_CHARSET + bool + prompt "Enable HTTP charset module" + default y + +config NGINX_HTTP_GZIP + bool + prompt "Enable HTTP gzip module" + default y + +config NGINX_HTTP_SSI + bool + prompt "Enable HTTP ssi module" + default y + +config NGINX_HTTP_USERID + bool + prompt "Enable HTTP userid module" + default y + +config NGINX_HTTP_ACCESS + bool + prompt "Enable HTTP access module" + default y + +config NGINX_HTTP_AUTH_BASIC + bool + prompt "Enable HTTP auth basic" + default y + +config NGINX_HTTP_AUTOINDEX + bool + prompt "Enable HTTP autoindex module" + default y + +config NGINX_HTTP_GEO + bool + prompt "Enable HTTP geo module" + default y + +config NGINX_HTTP_MAP + bool + prompt "Enable HTTP map module" + default y + +config NGINX_HTTP_SPLIT_CLIENTS + bool + prompt "Enable HTTP split clients" + default y + +config NGINX_HTTP_REFERER + bool + prompt "Enable HTTP referer module" + default y + +config NGINX_HTTP_REWRITE + bool + prompt "Enable HTTP rewrite module" + select NGINX_PCRE + default y + +config NGINX_HTTP_PROXY + bool + prompt "Enable HTTP proxy module" + default y + +config NGINX_HTTP_FASTCGI + bool + prompt "Enable HTTP fastcgi module" + default y + +config NGINX_HTTP_UWSGI + bool + prompt "Enable HTTP uwsgi module" + default y + +config NGINX_HTTP_SCGI + bool + prompt "Enable HTTP scgi module" + default y + +config NGINX_HTTP_MEMCACHED + bool + prompt "Enable HTTP memcached module" + default y + +config NGINX_HTTP_LIMIT_CONN + bool + prompt "Enable HTTP limit conn" + default y + +config NGINX_HTTP_LIMIT_REQ + bool + prompt "Enable HTTP limit req" + default y + +config NGINX_HTTP_EMPTY_GIF + bool + prompt "Enable HTTP empty gif" + default y + +config NGINX_HTTP_BROWSER + bool + prompt "Enable HTTP browser module" + default y + +config NGINX_HTTP_UPSTREAM_HASH + bool + prompt "Enable HTTP hash module" + default y + +config NGINX_HTTP_UPSTREAM_IP_HASH + bool + prompt "Enable HTTP IP hash module" + default y + +config NGINX_HTTP_UPSTREAM_LEAST_CONN + bool + prompt "Enable HTTP least conn module" + default y + +config NGINX_HTTP_UPSTREAM_KEEPALIVE + bool + prompt "Enable HTTP keepalive module" + default y + +config NGINX_HTTP_CACHE + bool + prompt "Enable HTTP cache" + default y + +config NGINX_PCRE + bool + prompt "Enable PCRE library usage" + default y + +config NGINX_NAXSI + bool + prompt "Enable NAXSI module" + default y + +config NGINX_LUA + bool + prompt "Enable Lua module" + default n + +endmenu diff --git a/net/nginx/Makefile b/net/nginx/Makefile new file mode 100644 index 0000000..fa1e873 --- /dev/null +++ b/net/nginx/Makefile @@ -0,0 +1,270 @@ +# +# Copyright (C) 2012-2016 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:=nginx +PKG_VERSION:=1.10.1 +PKG_RELEASE:=2 + +PKG_SOURCE:=nginx-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://nginx.org/download/ +PKG_MD5SUM:=088292d9caf6059ef328aa7dda332e44 +PKG_MAINTAINER:=Thomas Heil +PKG_LICENSE:=2-clause BSD-like license + +PKG_BUILD_DIR:=$(BUILD_DIR)/nginx-$(PKG_VERSION) + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +PKG_CONFIG_DEPENDS := \ + CONFIG_NGINX_SSL \ + CONFIG_NGINX_DAV \ + CONFIG_NGINX_FLV \ + CONFIG_NGINX_STUB_STATUS \ + CONFIG_NGINX_HTTP_CHARSET \ + CONFIG_NGINX_HTTP_GZIP \ + CONFIG_NGINX_HTTP_SSI \ + CONFIG_NGINX_HTTP_USERID \ + CONFIG_NGINX_HTTP_ACCESS \ + CONFIG_NGINX_HTTP_AUTH_BASIC \ + CONFIG_NGINX_HTTP_AUTOINDEX \ + CONFIG_NGINX_HTTP_GEO \ + CONFIG_NGINX_HTTP_MAP \ + CONFIG_NGINX_HTTP_SPLIT_CLIENTS \ + CONFIG_NGINX_HTTP_REFERER \ + CONFIG_NGINX_HTTP_REWRITE \ + CONFIG_NGINX_HTTP_PROXY \ + CONFIG_NGINX_HTTP_FASTCGI \ + CONFIG_NGINX_HTTP_UWSGI \ + CONFIG_NGINX_HTTP_SCGI \ + CONFIG_NGINX_HTTP_MEMCACHED \ + CONFIG_NGINX_HTTP_LIMIT_CONN \ + CONFIG_NGINX_HTTP_LIMIT_REQ \ + CONFIG_NGINX_HTTP_EMPTY_GIF \ + CONFIG_NGINX_HTTP_BROWSER \ + CONFIG_NGINX_HTTP_UPSTREAM_HASH \ + CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH \ + CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN \ + CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE \ + CONFIG_NGINX_HTTP_UPSTREAM_ZONE \ + CONFIG_NGINX_HTTP_CACHE \ + CONFIG_NGINX_PCRE \ + CONFIG_NGINX_NAXSI \ + CONFIG_NGINX_LUA + +include $(INCLUDE_DIR)/package.mk + +define Package/nginx + SECTION:=net + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + TITLE:=Nginx web server + URL:=http://nginx.org/ + DEPENDS:=+NGINX_PCRE:libpcre +(NGINX_SSL||NGINX_HTTP_CACHE||NGINX_HTTP_AUTH_BASIC):libopenssl +NGINX_HTTP_GZIP:zlib +NGINX_LUA:liblua +libpthread + MENU:=1 +endef + +define Package/nginx/description + nginx is an HTTP and reverse proxy server, as well as a mail proxy server, + written by Igor Sysoev. +endef + +define Package/nginx/config + source "$(SOURCE)/Config.in" +endef + +config_files=nginx.conf mime.types + +define Package/nginx/conffiles +/etc/nginx/ +endef + +ADDITIONAL_MODULES:= +ifeq ($(CONFIG_NGINX_NAXSI),y) + ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-naxsi/naxsi_src +endif +ifeq ($(CONFIG_NGINX_LUA),y) + ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/lua-nginx +endif +ifeq ($(CONFIG_IPV6),y) + ADDITIONAL_MODULES += --with-ipv6 +endif +ifeq ($(CONFIG_NGINX_STUB_STATUS),y) + ADDITIONAL_MODULES += --with-http_stub_status_module +endif +ifeq ($(CONFIG_NGINX_FLV),y) + ADDITIONAL_MODULES += --with-http_flv_module +endif +ifeq ($(CONFIG_NGINX_SSL),y) + ADDITIONAL_MODULES += --with-http_ssl_module +endif +ifeq ($(CONFIG_NGINX_DAV),y) + ADDITIONAL_MODULES += --with-http_dav_module +endif +ifneq ($(CONFIG_NGINX_HTTP_CACHE),y) + ADDITIONAL_MODULES += --without-http-cache +endif +ifneq ($(CONFIG_NGINX_PCRE),y) + ADDITIONAL_MODULES += --without-pcre +endif +ifneq ($(CONFIG_NGINX_HTTP_CHARSET),y) + ADDITIONAL_MODULES += --without-http_charset_module +else + config_files += koi-utf koi-win win-utf +endif +ifneq ($(CONFIG_NGINX_HTTP_GZIP),y) + ADDITIONAL_MODULES += --without-http_gzip_module +endif +ifneq ($(CONFIG_NGINX_HTTP_SSI),y) + ADDITIONAL_MODULES += --without-http_ssi_module +endif +ifneq ($(CONFIG_NGINX_HTTP_USERID),y) + ADDITIONAL_MODULES += --without-http_userid_module +endif +ifneq ($(CONFIG_NGINX_HTTP_ACCESS),y) + ADDITIONAL_MODULES += --without-http_access_module +endif +ifneq ($(CONFIG_NGINX_HTTP_AUTH_BASIC),y) + ADDITIONAL_MODULES += --without-http_auth_basic_module +endif +ifneq ($(CONFIG_NGINX_HTTP_AUTOINDEX),y) + ADDITIONAL_MODULES += --without-http_autoindex_module +endif +ifneq ($(CONFIG_NGINX_HTTP_GEO),y) + ADDITIONAL_MODULES += --without-http_geo_module +endif +ifneq ($(CONFIG_NGINX_HTTP_MAP),y) + ADDITIONAL_MODULES += --without-http_map_module +endif +ifneq ($(CONFIG_NGINX_HTTP_SPLIT_CLIENTS),y) + ADDITIONAL_MODULES += --without-http_split_clients_module +endif +ifneq ($(CONFIG_NGINX_HTTP_REFERER),y) + ADDITIONAL_MODULES += --without-http_referer_module +endif +ifneq ($(CONFIG_NGINX_HTTP_REWRITE),y) + ADDITIONAL_MODULES += --without-http_rewrite_module +endif +ifneq ($(CONFIG_NGINX_HTTP_PROXY),y) + ADDITIONAL_MODULES += --without-http_proxy_module +endif +ifneq ($(CONFIG_NGINX_HTTP_FASTCGI),y) + ADDITIONAL_MODULES += --without-http_fastcgi_module +else + config_files += fastcgi_params +endif +ifneq ($(CONFIG_NGINX_HTTP_UWSGI),y) + ADDITIONAL_MODULES += --without-http_uwsgi_module +endif +ifneq ($(CONFIG_NGINX_HTTP_SCGI),y) + ADDITIONAL_MODULES += --without-http_scgi_module +endif +ifneq ($(CONFIG_NGINX_HTTP_MEMCACHED),y) + ADDITIONAL_MODULES += --without-http_memcached_module +endif +ifneq ($(CONFIG_NGINX_HTTP_LIMIT_CONN),y) + ADDITIONAL_MODULES += --without-http_limit_conn_module +endif +ifneq ($(CONFIG_NGINX_HTTP_LIMIT_REQ),y) + ADDITIONAL_MODULES += --without-http_limit_req_module +endif +ifneq ($(CONFIG_NGINX_HTTP_EMPTY_GIF),y) + ADDITIONAL_MODULES += --without-http_empty_gif_module +endif +ifneq ($(CONFIG_NGINX_HTTP_BROWSER),y) + ADDITIONAL_MODULES += --without-http_browser_module +endif +ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_HASH),y) + ADDITIONAL_MODULES += --without-http_upstream_hash_module +endif +ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH),y) + ADDITIONAL_MODULES += --without-http_upstream_ip_hash_module +endif +ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN),y) + ADDITIONAL_MODULES += --without-http_upstream_least_conn_module +endif +ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE),y) + ADDITIONAL_MODULES += --without-http_upstream_keepalive_module +endif + +TARGET_CFLAGS += -fvisibility=hidden -ffunction-sections -fdata-sections -DNGX_LUA_NO_BY_LUA_BLOCK +TARGET_LDFLAGS += -Wl,--gc-sections + +define Build/Configure + ( cd $(PKG_BUILD_DIR) ; \ + $(if $(CONFIG_NGINX_LUA),LUA_INC=$(STAGING_DIR)/usr/include LUA_LIB=$(STAGING_DIR)/usr/lib) \ + ./configure \ + --crossbuild=Linux::$(ARCH) \ + --prefix=/usr \ + --conf-path=/etc/nginx/nginx.conf \ + $(ADDITIONAL_MODULES) \ + --error-log-path=/var/log/nginx/error.log \ + --pid-path=/var/run/nginx.pid \ + --lock-path=/var/lock/nginx.lock \ + --http-log-path=/var/log/nginx/access.log \ + --http-client-body-temp-path=/var/lib/nginx/body \ + --http-proxy-temp-path=/var/lib/nginx/proxy \ + --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \ + --with-cc="$(TARGET_CC)" \ + --with-cc-opt="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \ + --with-ld-opt="$(TARGET_LDFLAGS)" \ + --without-http_upstream_zone_module \ + ) +endef + +define Package/nginx/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nginx $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/nginx + $(INSTALL_DATA) $(addprefix $(PKG_INSTALL_DIR)/etc/nginx/,$(config_files)) $(1)/etc/nginx/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/nginx.init $(1)/etc/init.d/nginx +ifeq ($(CONFIG_NGINX_NAXSI),y) + $(INSTALL_DIR) $(1)/etc/nginx + $(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-naxsi/naxsi_config/naxsi_core.rules $(1)/etc/nginx + chmod 0640 $(1)/etc/nginx/naxsi_core.rules +endif + $(if $(CONFIG_NGINX_NAXSI),$($(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-naxsi/naxsi_config/naxsi_core.rules $(1)/etc/nginx)) + $(if $(CONFIG_NGINX_NAXSI),$(chmod 0640 $(1)/etc/nginx/naxsi_core.rules)) +endef + +define Build/Prepare + $(call Build/Prepare/Default) + $(if $(CONFIG_NGINX_NAXSI),$(call Prepare/nginx-naxsi)) + $(if $(CONFIG_NGINX_LUA),$(call Prepare/lua-nginx)) +endef + +define Download/nginx-naxsi + VERSION:=7a6ff365f6be736c826b2d69b967a250ac07197d + SUBDIR:=nginx-naxsi + FILE:=nginx-naxsi-module-$(PKG_VERSION)-$$(VERSION).tar.gz + URL:=https://github.com/nbs-system/naxsi.git + PROTO:=git +endef + +define Prepare/nginx-naxsi + $(eval $(call Download,nginx-naxsi)) + gzip -dc $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS) +endef + +define Download/lua-nginx + VERSION:=1967998b0eedab1ff51bff8fafa5fc3db47976aa + SUBDIR:=lua-nginx + FILE:=lua-nginx-module-$(PKG_VERSION)-$$(VERSION).tar.gz + URL:=https://github.com/openresty/lua-nginx-module.git + PROTO:=git +endef + +define Prepare/lua-nginx + $(eval $(call Download,lua-nginx)) + gzip -dc $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS) + $(call PatchDir,$(PKG_BUILD_DIR),./patches-lua-nginx) +endef + +$(eval $(call BuildPackage,nginx)) diff --git a/net/nginx/files/nginx.init b/net/nginx/files/nginx.init new file mode 100644 index 0000000..40d3897 --- /dev/null +++ b/net/nginx/files/nginx.init @@ -0,0 +1,17 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 OpenWrt.org + +START=80 + +USE_PROCD=1 + +start_service() { + [ -d /var/log/nginx ] || mkdir -p /var/log/nginx + [ -d /var/lib/nginx ] || mkdir -p /var/lib/nginx + + procd_open_instance + procd_set_param command /usr/sbin/nginx -c /etc/nginx/nginx.conf -g 'daemon off;' + procd_set_param file /etc/nginx/nginx.conf + procd_set_param respawn + procd_close_instance +} diff --git a/net/nginx/patches-lua-nginx/100-no_by_lua_block.patch b/net/nginx/patches-lua-nginx/100-no_by_lua_block.patch new file mode 100644 index 0000000..fef983f --- /dev/null +++ b/net/nginx/patches-lua-nginx/100-no_by_lua_block.patch @@ -0,0 +1,195 @@ +--- a/lua-nginx/src/ngx_http_lua_module.c ++++ b/lua-nginx/src/ngx_http_lua_module.c +@@ -157,14 +157,14 @@ static ngx_command_t ngx_http_lua_cmds[] + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_lua_loc_conf_t, log_socket_errors), + NULL }, +- ++#ifndef NGX_LUA_NO_BY_LUA_BLOCK + { ngx_string("init_by_lua_block"), + NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, + ngx_http_lua_init_by_lua_block, + NGX_HTTP_MAIN_CONF_OFFSET, + 0, + (void *) ngx_http_lua_init_by_inline }, +- ++#endif + { ngx_string("init_by_lua"), + NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, + ngx_http_lua_init_by_lua, +@@ -178,14 +178,14 @@ static ngx_command_t ngx_http_lua_cmds[] + NGX_HTTP_MAIN_CONF_OFFSET, + 0, + (void *) ngx_http_lua_init_by_file }, +- ++#ifndef NGX_LUA_NO_BY_LUA_BLOCK + { ngx_string("init_worker_by_lua_block"), + NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, + ngx_http_lua_init_worker_by_lua_block, + NGX_HTTP_MAIN_CONF_OFFSET, + 0, + (void *) ngx_http_lua_init_worker_by_inline }, +- ++#endif + { ngx_string("init_worker_by_lua"), + NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, + ngx_http_lua_init_worker_by_lua, +@@ -201,6 +201,7 @@ static ngx_command_t ngx_http_lua_cmds[] + (void *) ngx_http_lua_init_worker_by_file }, + + #if defined(NDK) && NDK ++#ifndef NGX_LUA_NO_BY_LUA_BLOCK + /* set_by_lua $res { inline Lua code } [$arg1 [$arg2 [...]]] */ + { ngx_string("set_by_lua_block"), + NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF +@@ -209,7 +210,7 @@ static ngx_command_t ngx_http_lua_cmds[] + NGX_HTTP_LOC_CONF_OFFSET, + 0, + (void *) ngx_http_lua_filter_set_by_lua_inline }, +- ++#endif + /* set_by_lua $res [$arg1 [$arg2 [...]]] */ + { ngx_string("set_by_lua"), + NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF +@@ -237,7 +238,7 @@ static ngx_command_t ngx_http_lua_cmds[] + NGX_HTTP_LOC_CONF_OFFSET, + 0, + (void *) ngx_http_lua_rewrite_handler_inline }, +- ++#ifndef NGX_LUA_NO_BY_LUA_BLOCK + /* rewrite_by_lua_block { } */ + { ngx_string("rewrite_by_lua_block"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF +@@ -246,7 +247,7 @@ static ngx_command_t ngx_http_lua_cmds[] + NGX_HTTP_LOC_CONF_OFFSET, + 0, + (void *) ngx_http_lua_rewrite_handler_inline }, +- ++#endif + /* access_by_lua "" */ + { ngx_string("access_by_lua"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF +@@ -255,7 +256,7 @@ static ngx_command_t ngx_http_lua_cmds[] + NGX_HTTP_LOC_CONF_OFFSET, + 0, + (void *) ngx_http_lua_access_handler_inline }, +- ++#ifndef NGX_LUA_NO_BY_LUA_BLOCK + /* access_by_lua_block { } */ + { ngx_string("access_by_lua_block"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF +@@ -264,7 +265,7 @@ static ngx_command_t ngx_http_lua_cmds[] + NGX_HTTP_LOC_CONF_OFFSET, + 0, + (void *) ngx_http_lua_access_handler_inline }, +- ++#endif + /* content_by_lua "" */ + { ngx_string("content_by_lua"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1, +@@ -272,7 +273,7 @@ static ngx_command_t ngx_http_lua_cmds[] + NGX_HTTP_LOC_CONF_OFFSET, + 0, + (void *) ngx_http_lua_content_handler_inline }, +- ++#ifndef NGX_LUA_NO_BY_LUA_BLOCK + /* content_by_lua_block { } */ + { ngx_string("content_by_lua_block"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, +@@ -280,7 +281,7 @@ static ngx_command_t ngx_http_lua_cmds[] + NGX_HTTP_LOC_CONF_OFFSET, + 0, + (void *) ngx_http_lua_content_handler_inline }, +- ++#endif + /* log_by_lua */ + { ngx_string("log_by_lua"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF +@@ -289,7 +290,7 @@ static ngx_command_t ngx_http_lua_cmds[] + NGX_HTTP_LOC_CONF_OFFSET, + 0, + (void *) ngx_http_lua_log_handler_inline }, +- ++#ifndef NGX_LUA_NO_BY_LUA_BLOCK + /* log_by_lua_block { } */ + { ngx_string("log_by_lua_block"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF +@@ -298,7 +299,7 @@ static ngx_command_t ngx_http_lua_cmds[] + NGX_HTTP_LOC_CONF_OFFSET, + 0, + (void *) ngx_http_lua_log_handler_inline }, +- ++#endif + { ngx_string("rewrite_by_lua_file"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF + |NGX_CONF_TAKE1, +@@ -353,7 +354,7 @@ static ngx_command_t ngx_http_lua_cmds[] + NGX_HTTP_LOC_CONF_OFFSET, + 0, + (void *) ngx_http_lua_header_filter_inline }, +- ++#ifndef NGX_LUA_NO_BY_LUA_BLOCK + /* header_filter_by_lua_block { } */ + { ngx_string("header_filter_by_lua_block"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF +@@ -362,7 +363,7 @@ static ngx_command_t ngx_http_lua_cmds[] + NGX_HTTP_LOC_CONF_OFFSET, + 0, + (void *) ngx_http_lua_header_filter_inline }, +- ++#endif + { ngx_string("header_filter_by_lua_file"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF + |NGX_CONF_TAKE1, +@@ -378,7 +379,7 @@ static ngx_command_t ngx_http_lua_cmds[] + NGX_HTTP_LOC_CONF_OFFSET, + 0, + (void *) ngx_http_lua_body_filter_inline }, +- ++#ifndef NGX_LUA_NO_BY_LUA_BLOCK + /* body_filter_by_lua_block { } */ + { ngx_string("body_filter_by_lua_block"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF +@@ -387,7 +388,7 @@ static ngx_command_t ngx_http_lua_cmds[] + NGX_HTTP_LOC_CONF_OFFSET, + 0, + (void *) ngx_http_lua_body_filter_inline }, +- ++#endif + { ngx_string("body_filter_by_lua_file"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF + |NGX_CONF_TAKE1, +@@ -395,14 +396,14 @@ static ngx_command_t ngx_http_lua_cmds[] + NGX_HTTP_LOC_CONF_OFFSET, + 0, + (void *) ngx_http_lua_body_filter_file }, +- ++#ifndef NGX_LUA_NO_BY_LUA_BLOCK + { ngx_string("balancer_by_lua_block"), + NGX_HTTP_UPS_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, + ngx_http_lua_balancer_by_lua_block, + NGX_HTTP_SRV_CONF_OFFSET, + 0, + (void *) ngx_http_lua_balancer_handler_inline }, +- ++#endif + { ngx_string("balancer_by_lua_file"), + NGX_HTTP_UPS_CONF|NGX_CONF_TAKE1, + ngx_http_lua_balancer_by_lua, +@@ -509,14 +510,14 @@ static ngx_command_t ngx_http_lua_cmds[] + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_lua_loc_conf_t, ssl_ciphers), + NULL }, +- ++#ifndef NGX_LUA_NO_BY_LUA_BLOCK + { ngx_string("ssl_certificate_by_lua_block"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, + ngx_http_lua_ssl_cert_by_lua_block, + NGX_HTTP_SRV_CONF_OFFSET, + 0, + (void *) ngx_http_lua_ssl_cert_handler_inline }, +- ++#endif + { ngx_string("ssl_certificate_by_lua_file"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, + ngx_http_lua_ssl_cert_by_lua, diff --git a/net/nginx/patches/101-feature_test_fix.patch b/net/nginx/patches/101-feature_test_fix.patch new file mode 100644 index 0000000..2c692bc --- /dev/null +++ b/net/nginx/patches/101-feature_test_fix.patch @@ -0,0 +1,107 @@ +--- a/auto/cc/name ++++ b/auto/cc/name +@@ -7,7 +7,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then + + ngx_feature="C compiler" + ngx_feature_name= +- ngx_feature_run=yes ++ ngx_feature_run= + ngx_feature_incs= + ngx_feature_path= + ngx_feature_libs= +--- a/auto/cc/conf ++++ b/auto/cc/conf +@@ -200,7 +200,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then + else + ngx_feature="C99 variadic macros" + ngx_feature_name="NGX_HAVE_C99_VARIADIC_MACROS" +- ngx_feature_run=yes ++ ngx_feature_run=no + ngx_feature_incs="#include + #define var(dummy, ...) sprintf(__VA_ARGS__)" + ngx_feature_path= +@@ -214,7 +214,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then + + ngx_feature="gcc variadic macros" + ngx_feature_name="NGX_HAVE_GCC_VARIADIC_MACROS" +- ngx_feature_run=yes ++ ngx_feature_run=no + ngx_feature_incs="#include + #define var(dummy, args...) sprintf(args)" + ngx_feature_path= +--- a/auto/os/linux ++++ b/auto/os/linux +@@ -36,7 +36,7 @@ fi + + ngx_feature="epoll" + ngx_feature_name="NGX_HAVE_EPOLL" +-ngx_feature_run=yes ++ngx_feature_run=no + ngx_feature_incs="#include " + ngx_feature_path= + ngx_feature_libs= +@@ -93,7 +93,7 @@ ngx_feature_test="int fd; struct stat sb + CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE" + ngx_feature="sendfile()" + ngx_feature_name="NGX_HAVE_SENDFILE" +-ngx_feature_run=yes ++ngx_feature_run=no + ngx_feature_incs="#include + #include " + ngx_feature_path= +@@ -114,7 +114,7 @@ fi + CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64" + ngx_feature="sendfile64()" + ngx_feature_name="NGX_HAVE_SENDFILE64" +-ngx_feature_run=yes ++ngx_feature_run=no + ngx_feature_incs="#include + #include " + ngx_feature_path= +@@ -132,7 +132,7 @@ ngx_include="sys/prctl.h"; . auto/includ + + ngx_feature="prctl(PR_SET_DUMPABLE)" + ngx_feature_name="NGX_HAVE_PR_SET_DUMPABLE" +-ngx_feature_run=yes ++ngx_feature_run=no + ngx_feature_incs="#include " + ngx_feature_path= + ngx_feature_libs= +--- a/auto/unix ++++ b/auto/unix +@@ -735,7 +735,7 @@ ngx_feature_test="void *p; p = memalign( + + ngx_feature="mmap(MAP_ANON|MAP_SHARED)" + ngx_feature_name="NGX_HAVE_MAP_ANON" +-ngx_feature_run=yes ++ngx_feature_run=no + ngx_feature_incs="#include " + ngx_feature_path= + ngx_feature_libs= +@@ -748,7 +748,7 @@ ngx_feature_test="void *p; + + ngx_feature='mmap("/dev/zero", MAP_SHARED)' + ngx_feature_name="NGX_HAVE_MAP_DEVZERO" +-ngx_feature_run=yes ++ngx_feature_run=no + ngx_feature_incs="#include + #include + #include " +@@ -763,7 +763,7 @@ ngx_feature_test='void *p; int fd; + + ngx_feature="System V shared memory" + ngx_feature_name="NGX_HAVE_SYSVSHM" +-ngx_feature_run=yes ++ngx_feature_run=no + ngx_feature_incs="#include + #include " + ngx_feature_path= +@@ -777,7 +777,7 @@ ngx_feature_test="int id; + + ngx_feature="POSIX semaphores" + ngx_feature_name="NGX_HAVE_POSIX_SEM" +-ngx_feature_run=yes ++ngx_feature_run=no + ngx_feature_incs="#include " + ngx_feature_path= + ngx_feature_libs= diff --git a/net/nginx/patches/102-sizeof_test_fix.patch b/net/nginx/patches/102-sizeof_test_fix.patch new file mode 100644 index 0000000..36d7aaf --- /dev/null +++ b/net/nginx/patches/102-sizeof_test_fix.patch @@ -0,0 +1,27 @@ +--- a/auto/types/sizeof ++++ b/auto/types/sizeof +@@ -25,8 +25,14 @@ $NGX_INCLUDE_UNISTD_H + $NGX_INCLUDE_INTTYPES_H + $NGX_INCLUDE_AUTO_CONFIG_H + ++char object_code_block[] = { ++ '\n', 'e', '4', 'V', 'A', ++ '0', 'x', ('0' + sizeof($ngx_type)), ++ 'Y', '3', 'p', 'M', '\n' ++}; ++ + int main() { +- printf("%d", (int) sizeof($ngx_type)); ++ printf("dummy use of object_code_block to avoid gc-section: %c", object_code_block[0]); + return 0; + } + +@@ -40,7 +45,7 @@ eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>& + + + if [ -x $NGX_AUTOTEST ]; then +- ngx_size=`$NGX_AUTOTEST` ++ ngx_size=`sed -ne 's/^e4VA0x\(.\)Y3pM$/\1/p' < $NGX_AUTOTEST` + echo " $ngx_size bytes" + fi + diff --git a/net/nginx/patches/103-sys_nerr.patch b/net/nginx/patches/103-sys_nerr.patch new file mode 100644 index 0000000..5f5d106 --- /dev/null +++ b/net/nginx/patches/103-sys_nerr.patch @@ -0,0 +1,12 @@ +--- a/src/os/unix/ngx_errno.c ++++ b/src/os/unix/ngx_errno.c +@@ -8,6 +8,9 @@ + #include + #include + ++#ifndef NGX_SYS_NERR ++#define NGX_SYS_NERR 128 ++#endif + + /* + * The strerror() messages are copied because: diff --git a/net/nginx/patches/200-config.patch b/net/nginx/patches/200-config.patch new file mode 100644 index 0000000..f350095 --- /dev/null +++ b/net/nginx/patches/200-config.patch @@ -0,0 +1,18 @@ +--- a/conf/nginx.conf ++++ b/conf/nginx.conf +@@ -1,5 +1,5 @@ + +-#user nobody; ++user nobody nogroup; + worker_processes 1; + + #error_log logs/error.log; +@@ -16,7 +16,7 @@ events { + + http { + include mime.types; +- default_type application/octet-stream; ++ #default_type application/octet-stream; + + #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + # '$status $body_bytes_sent "$http_referer" ' diff --git a/net/nginx/patches/300-max-processes.patch b/net/nginx/patches/300-max-processes.patch new file mode 100644 index 0000000..f7465d4 --- /dev/null +++ b/net/nginx/patches/300-max-processes.patch @@ -0,0 +1,11 @@ +--- a/src/os/unix/ngx_process.h ++++ b/src/os/unix/ngx_process.h +@@ -44,7 +44,7 @@ typedef struct { + } ngx_exec_ctx_t; + + +-#define NGX_MAX_PROCESSES 1024 ++#define NGX_MAX_PROCESSES 8 + + #define NGX_PROCESS_NORESPAWN -1 + #define NGX_PROCESS_JUST_SPAWN -2 diff --git a/net/ngircd/Makefile b/net/ngircd/Makefile new file mode 100644 index 0000000..3778609 --- /dev/null +++ b/net/ngircd/Makefile @@ -0,0 +1,109 @@ +# +# Copyright (C) 2008-2015 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:=ngircd +PKG_VERSION:=23 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Claudio Leite +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:= \ + http://ngircd.barton.de/pub/ngircd/ \ + ftp://ftp.berlios.de/pub/ngircd/ +PKG_MD5SUM:=a58e0075fea60176fa7df092ca7e2c6a + +PKG_INSTALL:=1 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/ngircd/Default + SECTION:=net + CATEGORY:=Network + SUBMENU:=Instant Messaging + DEPENDS:=+zlib + TITLE:=Next Generation IRC Server + URL:=http://ngircd.barton.de +endef + +define Package/ngircd/Default/description + ngIRCd is an Open Source server for the Internet Relay Chat (IRC), which + is developed and published under the terms of the GNU General Public Licence. + ngIRCd means "next generation IRC daemon", it's written from scratch and + not deduced from the "grandfather of IRC daemons", the daemon of the IRCNet. +endef + +define Package/ngircd + $(call Package/ngircd/Default) + TITLE+= (with OpenSSL support) + DEPENDS+= +libopenssl + VARIANT:=ssl +endef + +define Package/ngircd/conffiles +/etc/ngircd.conf +endef + +define Package/ngircd/description + $(call Package/ngircd/Default/description) + This package is built with OpenSSL support. +endef + +define Package/ngircd-nossl +$(call Package/ngircd/Default) + TITLE+= (without OpenSSL support) + VARIANT:=nossl +endef + +Package/ngircd-nossl/conffiles = $(Package/ngircd/conffiles) + +define Package/ngircd-nossl/description + $(call Package/ngircd/Default/description) + This package is built without OpenSSL support. +endef + +ifeq ($(CONFIG_IPV6),y) + CONFIGURE_ARGS += \ + --enable-ipv6 +endif + +ifeq ($(BUILD_VARIANT),ssl) + CONFIGURE_ARGS += \ + --with-openssl="$(STAGING_DIR)/usr" +endif + +ifeq ($(BUILD_VARIANT),nossl) + CONFIGURE_ARGS += \ + --without-openssl +endif + +# The test for HAVE_WORKING_GETADDRINFO fails +# when cross-compiling. +# +define Build/Configure + $(call Build/Configure/Default) + $(SED) 's/\/\* #undef HAVE_WORKING_GETADDRINFO \*\//#define HAVE_WORKING_GETADDRINFO 1/' $(PKG_BUILD_DIR)/src/config.h +endef + +define Package/ngircd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ngircd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/ngircd.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/ngircd.init $(1)/etc/init.d/ngircd +endef + +Package/ngircd-nossl/install = $(Package/ngircd/install) + +$(eval $(call BuildPackage,ngircd)) +$(eval $(call BuildPackage,ngircd-nossl)) diff --git a/net/ngircd/files/ngircd.init b/net/ngircd/files/ngircd.init new file mode 100644 index 0000000..6a21358 --- /dev/null +++ b/net/ngircd/files/ngircd.init @@ -0,0 +1,11 @@ +#!/bin/sh /etc/rc.common + +START=65 + +start() { + service_start /usr/sbin/ngircd +} + +stop() { + service_stop /usr/sbin/ngircd +} diff --git a/net/nmap/Makefile b/net/nmap/Makefile new file mode 100644 index 0000000..6fa208b --- /dev/null +++ b/net/nmap/Makefile @@ -0,0 +1,145 @@ +# +# Copyright (C) 2006-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. + +#TODO +# +# * uClibcpp not supported, performance +100x slower. libstdcpp is being used. https://bugs.busybox.net/show_bug.cgi?id=2545 +# * liblua is still not recognized/blindly accepted. Impossible to compile with support +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=nmap +PKG_VERSION:=7.31 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Nuno Goncalves + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://nmap.org/dist/ +PKG_MD5SUM:=f2f6660142a777862342a58cc54258ea +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +NMAP_DEPENDS:=+libpcap +libstdcpp +NCAT_DEPENDS:=+libpcap +NPING_DEPENDS:=+libpcap +libpthread +libstdcpp +NDIFF_DEPENDS:=+python + +define Package/nmap/default + SUBMENU:=NMAP Suite + SECTION:=net + CATEGORY:=Network + URL:=http://nmap.org/ +endef + +define Package/nmap +$(call Package/nmap/default) + DEPENDS:=$(NMAP_DEPENDS) + VARIANT:=nossl + TITLE:=Utility for network exploration or security auditing +endef + +define Package/nmap-ssl +$(call Package/nmap/default) + DEPENDS:=$(NMAP_DEPENDS) +libopenssl + VARIANT:=ssl + TITLE:=Nmap (with OpenSSL support) +endef + +define Package/ncat +$(call Package/nmap/default) + DEPENDS:=$(NCAT_DEPENDS) + VARIANT:=nossl + TITLE:=Much-improved reimplementation of Netcat +endef + +define Package/ncat-ssl +$(call Package/nmap/default) + DEPENDS:=$(NCAT_DEPENDS) +libopenssl + VARIANT:=ssl + TITLE:=Ncat (with OpenSSL support) +endef + +define Package/nping +$(call Package/nmap/default) + DEPENDS:=$(NPING_DEPENDS) + VARIANT:=nossl + TITLE:=Network packet generation tool / ping utility +endef + +define Package/ndiff +$(call Package/nmap/default) + DEPENDS:=$(NDIFF_DEPENDS) + VARIANT:=nossl + TITLE:=Utility to compare the results of Nmap scans +endef + +CONFIGURE_ARGS += \ + --with-libdnet=included \ + --with-libpcre=included \ + --with-libpcap="$(STAGING_DIR)/usr" \ + --without-liblua \ + --without-zenmap + +CONFIGURE_VARS += \ + ac_cv_dnet_bsd_bpf=no \ + CXXFLAGS="$$$$CXXFLAGS -fno-builtin" + +ifeq ($(BUILD_VARIANT),ssl) + CONFIGURE_ARGS += --with-openssl="$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS += --without-openssl +endif + +define Package/nmap/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nmap $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/share/nmap + $(CP) $(PKG_INSTALL_DIR)/usr/share/nmap/* $(1)/usr/share/nmap/ +endef + +define Package/nmap-ssl/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nmap $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/share/nmap + $(CP) $(PKG_INSTALL_DIR)/usr/share/nmap/* $(1)/usr/share/nmap/ +endef + +define Package/ncat/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ncat $(1)/usr/bin/ +endef + +define Package/ncat-ssl/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ncat $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/share/ncat + $(CP) $(PKG_INSTALL_DIR)/usr/share/ncat/ca-bundle.crt $(1)/usr/share/ncat/ +endef + +define Package/ndiff/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ndiff $(1)/usr/bin/ +endef + +define Package/nping/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nping $(1)/usr/bin/ +endef + + +$(eval $(call BuildPackage,nmap)) +$(eval $(call BuildPackage,nmap-ssl)) +$(eval $(call BuildPackage,ncat)) +$(eval $(call BuildPackage,ncat-ssl)) +$(eval $(call BuildPackage,nping)) +$(eval $(call BuildPackage,ndiff)) diff --git a/net/nmap/patches/001-fix-missing-includes.patch b/net/nmap/patches/001-fix-missing-includes.patch new file mode 100644 index 0000000..3985bad --- /dev/null +++ b/net/nmap/patches/001-fix-missing-includes.patch @@ -0,0 +1,14 @@ +diff --git a/ncat/ncat_ssl.c b/ncat/ncat_ssl.c +index ee8ca97..9ff495c 100644 +--- a/ncat/ncat_ssl.c ++++ b/ncat/ncat_ssl.c +@@ -128,7 +128,9 @@ + + #include + #include ++#include + #include ++#include + #include + #include + #include diff --git a/net/nsd/Makefile b/net/nsd/Makefile new file mode 100644 index 0000000..b8bd8f9 --- /dev/null +++ b/net/nsd/Makefile @@ -0,0 +1,135 @@ +# +# Copyright (C) 2014-2016 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:=nsd +PKG_VERSION:=4.1.13 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.nlnetlabs.nl/downloads/nsd +PKG_MD5SUM:=a3f2a9885bc8664ba4a25c938d26a587 +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +PKG_LICENSE:=BSD-3c +PKG_LICENSE_FILES:=LICENSE + +PKG_MAINTAINER:=Vasilis Tsiligiannis + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/nsd/default + TITLE:=NSD Name Server Daemon + URL:=http://www.nlnetlabs.nl/projects/nsd/ + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names +endef + +define Package/nsd/default/description + NSD is an authoritative only, high performance, simple and open source name + server. +endef + +define Package/nsd + $(Package/nsd/default) + TITLE += (with SSL support) + DEPENDS += +libopenssl + VARIANT:=ssl +endef + +define Package/nsd/description + $(Package/nsd/default/description) +endef + +define Package/nsd-nossl + $(Package/nsd/default) + TITLE += (without SSL support) + VARIANT:=nossl +endef + +define Package/nsd-nossl/description + $(Package/nsd/default/description) +endef + +define Package/nsd-checkconf/description + $(Package/nsd/default/description) +endef + +define Package/nsd-control + $(Package/nsd/default) + TITLE += remote control utility + DEPENDS += +libopenssl +endef + +define Package/nsd-control/description + $(Package/nsd/default/description) +endef + +define Package/nsd-control-setup + $(Package/nsd/default) + TITLE += SSL keys setup script + DEPENDS += +openssl-util +endef + +define Package/nsd-control-setup/description + $(Package/nsd/default/description) +endef + +CONFIGURE_ARGS+= \ + --disable-checking \ + --with-libevent=no \ + --with-user="network" \ + +CONFIGURE_VARS+= \ + ac_cv_c_va_list_def=no \ + ac_cv_c_strptime_needs_defs=no \ + +ifeq ($(BUILD_VARIANT),ssl) + CONFIGURE_ARGS += \ + --with-ssl="$(STAGING_DIR)/usr" +endif + +ifeq ($(BUILD_VARIANT),nossl) + CONFIGURE_ARGS += \ + --without-ssl +endif + +define Package/nsd/conffiles +/etc/nsd/ +endef + +define Package/nsd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{nsd,nsd-checkconf} $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/nsd + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nsd/nsd.conf.sample $(1)/etc/nsd/nsd.conf + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/nsd.init $(1)/etc/init.d/nsd +endef + +define Package/nsd-control/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nsd-control $(1)/usr/sbin/ +endef + +define Package/nsd-control-setup/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nsd-control-setup $(1)/usr/sbin/ +endef + +Package/nsd-nossl/install = $(Package/nsd/install) +Package/nsd-nossl/conffiles = $(Package/nsd/conffiles) + +$(eval $(call BuildPackage,nsd)) +$(eval $(call BuildPackage,nsd-nossl)) +$(eval $(call BuildPackage,nsd-control)) +$(eval $(call BuildPackage,nsd-control-setup)) diff --git a/net/nsd/files/nsd.init b/net/nsd/files/nsd.init new file mode 100644 index 0000000..8b1cf1d --- /dev/null +++ b/net/nsd/files/nsd.init @@ -0,0 +1,16 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014 OpenWrt.org + +START=60 +USE_PROCD=1 +PROG=/usr/sbin/nsd + +start_service() { + mkdir -p /var/db/nsd + chown network /var/db/nsd + chmod 640 /etc/nsd/*.conf 2>/dev/null + chgrp network /etc/nsd/*.conf 2>/dev/null + procd_open_instance + procd_set_param command "$PROG" -d + procd_close_instance +} diff --git a/net/ntpclient/Makefile b/net/ntpclient/Makefile new file mode 100644 index 0000000..bca4b65 --- /dev/null +++ b/net/ntpclient/Makefile @@ -0,0 +1,57 @@ +# +# 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:=ntpclient +PKG_VERSION:=2010_365 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://doolittle.icarus.com/ntpclient/ +PKG_MD5SUM:=a64689398f2df8933ee0d8da246e9eaa + +PKG_MAINTAINER:=Ted Hess + +PKG_LICENSE:=GPL-2.0 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-2010 + +include $(INCLUDE_DIR)/package.mk + +define Package/ntpclient + SUBMENU:=Time Synchronization + SECTION:=net + CATEGORY:=Network + TITLE:=NTP (Network Time Protocol) client + URL:=http://doolittle.icarus.com/ntpclient/ + DEPENDS:=+librt +endef + +define Package/ntpclient/description + NTP client for setting system time from NTP servers. +endef + +define Package/ntpclient/conffiles +/etc/config/ntpclient +endef + +MAKE_FLAGS += \ + all adjtimex + +define Package/ntpclient/install + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_DATA) ./files/ntpclient.hotplug $(1)/etc/hotplug.d/iface/20-ntpclient + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/ntpclient.config $(1)/etc/config/ntpclient + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpclient $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/adjtimex $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/rate.awk $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,ntpclient)) diff --git a/net/ntpclient/files/ntpclient.config b/net/ntpclient/files/ntpclient.config new file mode 100644 index 0000000..10be886 --- /dev/null +++ b/net/ntpclient/files/ntpclient.config @@ -0,0 +1,23 @@ +config ntpserver + option hostname '0.openwrt.pool.ntp.org' + option port '123' + +config ntpserver + option hostname '1.openwrt.pool.ntp.org' + option port '123' + +config ntpserver + option hostname '2.openwrt.pool.ntp.org' + option port '123' + +config ntpserver + option hostname '3.openwrt.pool.ntp.org' + option port '123' + +config ntpdrift + option freq '0' + +config ntpclient + option interval 600 + #option count 10 + #option interface wan diff --git a/net/ntpclient/files/ntpclient.hotplug b/net/ntpclient/files/ntpclient.hotplug new file mode 100644 index 0000000..cdf18ee --- /dev/null +++ b/net/ntpclient/files/ntpclient.hotplug @@ -0,0 +1,78 @@ +#!/bin/sh +# Copyright (C) 2006-2014 OpenWrt.org + +. /lib/functions.sh + +unset SERVER +unset PORT +unset INTERVAL +unset COUNT +unset INTERFACE_GLOBAL + +NTPC=`which ntpclient` + +check_server() { + local hostname + local port + local interface + [ -n "$SERVER" ] && return + config_get hostname $1 hostname + config_get port $1 port + config_get interface $1 interface + + [ -z "$interface" ] && interface=$INTERFACE_GLOBAL + + [ -n "$interface" ] && { + # $INTERFACE is passed from hotplug event + [ "$interface" = "$INTERFACE" ] || return + } + + [ -z "$hostname" ] && return + $NTPC -c 1 -p ${port:-123} -i 2 -h $hostname > /dev/null && { SERVER=$hostname; PORT=${port:-123}; } +} + +set_drift() { + config_get freq $1 freq + [ -n "$freq" ] && adjtimex -f $freq >/dev/null +} + +start_ntpclient() { + config_foreach set_drift ntpdrift + config_foreach check_server ntpserver + [ -z "$SERVER" ] && exit 0 + logger starting ntpclient + $NTPC ${COUNT:+-c $COUNT} ${INTERVAL:+-i $INTERVAL} -s -l -D -p $PORT -h $SERVER 2> /dev/null +} + +stop_ntpclient() { + logger stopping ntpclient + killall ntpclient +} + +load_settings() { + local interval + local count + local iface + + config_get interval $1 interval + config_get count $1 count + config_get interface $1 interface + + [ -n "$count" ] && COUNT=$count + [ -n "$interval" ] && INTERVAL=$interval + [ -n "$interface" ] && INTERFACE_GLOBAL=$interface +} + +config_load ntpclient +config_foreach load_settings ntpclient + +NTP_RUNNING=`ps | grep $NTPC | grep -v grep` + +case "${ACTION:-ifup}" in + ifup) + [ -z "$NTP_RUNNING" ] && start_ntpclient + ;; + ifdown) + [ -n "$NTP_RUNNING" ] && stop_ntpclient + ;; +esac diff --git a/net/ntpclient/patches/100-daemon.patch b/net/ntpclient/patches/100-daemon.patch new file mode 100644 index 0000000..aa35f96 --- /dev/null +++ b/net/ntpclient/patches/100-daemon.patch @@ -0,0 +1,22 @@ +--- a/ntpclient.c ++++ b/ntpclient.c +@@ -611,7 +611,7 @@ int main(int argc, char *argv[]) { + ntpc.cross_check=1; + + for (;;) { +- c = getopt( argc, argv, "c:" DEBUG_OPTION "f:g:h:i:lp:q:" REPLAY_OPTION "st"); ++ c = getopt( argc, argv, "c:" DEBUG_OPTION "f:g:h:i:lp:q:" REPLAY_OPTION "stD"); + if (c == EOF) break; + switch (c) { + case 'c': +@@ -660,6 +660,10 @@ int main(int argc, char *argv[]) { + (ntpc.cross_check)=0; + break; + ++ case 'D': ++ daemon(0, 0); ++ break; ++ + default: + usage(argv[0]); + exit(1); diff --git a/net/ntpd/Makefile b/net/ntpd/Makefile new file mode 100644 index 0000000..2e97575 --- /dev/null +++ b/net/ntpd/Makefile @@ -0,0 +1,160 @@ +# +# Copyright (C) 2006-2016 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:=ntp +PKG_VERSION:=4.2.8p9 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ +PKG_MD5SUM:=857452b05f5f2e033786f77ade1974ed + +PKG_LICENSE:=Unique +PKG_LICENSE_FILES:=COPYRIGHT html/copyright.html + +PKG_FIXUP:=autoreconf +PKG_LIBTOOL_PATHS:=. sntp +PKG_CHECK_FORMAT_SECURITY:=0 + +include $(INCLUDE_DIR)/package.mk + +define Package/ntpd/Default + SUBMENU:=Time Synchronization + SECTION:=net + CATEGORY:=Network + TITLE:=ISC ntp + MAINTAINER:=Peter Wagner + URL:=http://www.ntp.org/ + DEPENDS:=+libopenssl +libpthread +libcap +endef + +define Package/ntpd/Default/description + The ISC ntp suite is a collection of tools used to synchronize the + system clock with remote NTP time servers and run/monitor local NTP + servers. +endef + +define Package/ntpd +$(call Package/ntpd/Default) + TITLE+= server + USERID:=ntp=123:ntp=123 +endef + +define Package/ntpd/description +$(call Package/ntpd/Default/description) + . + This package contains the ntpd server. +endef + +define Package/ntpdate +$(call Package/ntpd/Default) + TITLE+=date +endef + +define Package/ntpdate/description +$(call Package/ntpd/Default/description) + . + This package contains ntpdate. +endef + +define Package/ntp-utils +$(call Package/ntpd/Default) + TITLE+= utilities +endef + +define Package/ntp-utils/description +$(call Package/ntpd/Default/description) + . + This package contains ntpdc, ntpq and ntptime. +endef + +define Package/ntp-keygen +$(call Package/ntpd/Default) + TITLE+=keygen + DEPENDS+= +libevent2-core +endef + +define Package/ntp-keygen/description +$(call Package/ntpd/Default/description) + . + This package contains the ntp-keygen. +endef + +define Package/ntpd/conffiles +/etc/ntp.conf +endef + +CONFIGURE_VARS += \ + ac_cv_header_md5_h=no \ + ac_cv_lib_rt_sched_setscheduler=no \ + ac_cv_header_dns_sd_h=no \ + hw_cv_func_snprintf_c99=yes \ + hw_cv_func_vsnprintf_c99=yes \ + +CONFIGURE_ARGS += \ + --disable-all-clocks \ + --disable-parse-clocks \ + --without-ntpsnmpd \ + --without-lineeditlibs \ + --enable-NMEA \ + --enable-LOCAL-CLOCK \ + --enable-SHM \ + --enable-ATOM \ + --enable-linuxcaps \ + --with-yielding-select=yes \ + --with-crypto \ + --with-openssl-incdir="$(STAGING_DIR)/usr/include" \ + --with-openssl-libdir="$(STAGING_DIR)/usr/lib" + +define Package/ntpd/install + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpd/ntpd $(1)/sbin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) ./files/ntp.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/ntpd.init $(1)/etc/init.d/ntpd + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) ./files/ntpd.hotplug $(1)/etc/hotplug.d/iface/20-ntpd +endef + +define Package/ntpd/postinst +#!/bin/sh +[ -L "$${IPKG_INSTROOT}/usr/sbin/ntpd" ] && rm -f "$${IPKG_INSTROOT}/usr/sbin/ntpd" +exit 0 +endef + +define Package/ntpd/postrm +#!/bin/sh +/bin/busybox ntpd -h 2>&1 | grep -q BusyBox && ln -sf ../../bin/busybox /usr/sbin/ntpd +exit 0 +endef + +define Package/ntpdate/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpdate/ntpdate $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/ntpdate.init $(1)/etc/init.d/ntpdate +endef + +define Package/ntp-utils/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpdc/ntpdc $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpq/ntpq $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/util/ntptime $(1)/usr/sbin/ +endef + +define Package/ntp-keygen/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/util/ntp-keygen $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,ntpd)) +$(eval $(call BuildPackage,ntpdate)) +$(eval $(call BuildPackage,ntp-utils)) +$(eval $(call BuildPackage,ntp-keygen)) diff --git a/net/ntpd/files/ntp.conf b/net/ntpd/files/ntp.conf new file mode 100644 index 0000000..8bfb8e3 --- /dev/null +++ b/net/ntpd/files/ntp.conf @@ -0,0 +1,26 @@ +# use a random selection of 4 public stratum 2 servers +# see http://twiki.ntp.org/bin/view/Servers/NTPPoolServers + +#restrict default nomodify notrap noquery +#restrict default noquery + +restrict 127.0.0.1 + +driftfile /var/lib/ntp/ntp.drift + +server 0.openwrt.pool.ntp.org iburst +server 1.openwrt.pool.ntp.org iburst +server 2.openwrt.pool.ntp.org iburst +server 3.openwrt.pool.ntp.org iburst + + +# GPS(NMEA)+PPS +#server 127.127.20.0 minpoll 4 prefer +#fudge 127.127.20.0 flag3 1 flag2 0 + +# SMA PPS +#server 127.127.28.0 minpoll 4 prefer +#fudge 127.127.28.0 refid PPS flag3 1 + +#server 192.168.1.253 + diff --git a/net/ntpd/files/ntpd.hotplug b/net/ntpd/files/ntpd.hotplug new file mode 100644 index 0000000..975be75 --- /dev/null +++ b/net/ntpd/files/ntpd.hotplug @@ -0,0 +1,10 @@ +NAME=ntpd +CONFIG=/etc/ntp.conf +COMMAND=/sbin/$NAME + +[ "$ACTION" = "ifup" -a "$INTERFACE" = "wan" ] && { + [ -x $COMMAND ] && [ -r $CONFIG ] && { + killall ntpd + /etc/init.d/ntpd start + } & +} diff --git a/net/ntpd/files/ntpd.init b/net/ntpd/files/ntpd.init new file mode 100644 index 0000000..e626e24 --- /dev/null +++ b/net/ntpd/files/ntpd.init @@ -0,0 +1,18 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=65 +STOP=65 + +USE_PROCD=1 + +start_service() { +# ln -sf /dev/ttyS0 /dev/gps0 +# /usr/sbin/setgarmin -d /dev/gps -c /etc/setgarmin.conf + mkdir -p /var/lib/ntp + chown -R ntp:ntp /var/lib/ntp + + procd_open_instance + procd_set_param command /sbin/ntpd -g -u ntp:ntp -p /var/run/ntpd.pid -n + procd_close_instance +} diff --git a/net/ntpd/files/ntpdate.init b/net/ntpd/files/ntpdate.init new file mode 100644 index 0000000..2f33210 --- /dev/null +++ b/net/ntpd/files/ntpdate.init @@ -0,0 +1,13 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2008 OpenWrt.org + +START=60 + +STEP_SERVERS="0.openwrt.pool.ntp.org 1.openwrt.pool.ntp.org 2.openwrt.pool.ntp.org" +TIMEOUT="2" # in seconds + +start() { + for s in $STEP_SERVERS ; do + /usr/sbin/ntpdate -s -b -u -t "$TIMEOUT" "$s" && break + done +} diff --git a/net/ntripcaster/Makefile b/net/ntripcaster/Makefile new file mode 100644 index 0000000..7828a25 --- /dev/null +++ b/net/ntripcaster/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2011 segal.ubi.pt +# Copyright (C) 2010-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:=ntripcaster +PKG_VERSION:=0.1.5 + +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/nunojpg/ntripcaster.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=03878920195cf854b38a1ea424f1cae57353fa87 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_LICENSE:=GPL-2.0+ + +PKG_MAINTAINER:=Nuno Goncalves + +include $(INCLUDE_DIR)/package.mk + +define Package/ntripcaster + SECTION:=net + CATEGORY:=Network + SUBMENU:=NTRIP + TITLE:=Standard Ntrip Broadcaster + URL:=http://igs.bkg.bund.de/ntrip/download + DEPENDS:=+libpthread +endef + +define Package/ntripcaster/description + BKG Standard Ntrip Broadcaster +endef + +define Package/ntripcaster/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ntripcaster $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/share/ntripcaster/conf + $(INSTALL_DATA) $(PKG_BUILD_DIR)/conf/ntripcaster.conf.dist $(1)/usr/share/ntripcaster/conf/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/conf/sourcetable.dat.dist $(1)/usr/share/ntripcaster/conf/ +endef + +$(eval $(call BuildPackage,ntripcaster)) diff --git a/net/ntripclient/Makefile b/net/ntripclient/Makefile new file mode 100644 index 0000000..f0d92d5 --- /dev/null +++ b/net/ntripclient/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2011 segal.ubi.pt +# Copyright (C) 2010-2015 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:=ntripclient +PKG_VERSION:=1.5.0 + +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/nunojpg/ntripclient.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=dcfb2cb3e6f31b7291a94e7f86379c78ffc0d44e +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_LICENSE:=GPL-2.0+ + +PKG_MAINTAINER:=Nuno Goncalves + +include $(INCLUDE_DIR)/package.mk + +define Package/ntripclient + SECTION:=net + CATEGORY:=Network + SUBMENU:=NTRIP + TITLE:=Ntrip Version 2.0 Command Line Client + URL:=http://igs.bkg.bund.de/ntrip/download +endef + +define Package/ntripclient/description + Ntrip Version 2.0 Command Line Client, reading from Ntrip Version 1.0 or 2.0 Caster +endef + +MAKE_FLAGS += \ + OPTS="$(TARGET_CFLAGS)" + +define Package/ntripclient/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntripclient $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,ntripclient)) diff --git a/net/ntripclient/patches/100-musl-compat.patch b/net/ntripclient/patches/100-musl-compat.patch new file mode 100644 index 0000000..10f690f --- /dev/null +++ b/net/ntripclient/patches/100-musl-compat.patch @@ -0,0 +1,10 @@ +--- a/ntripclient.c ++++ b/ntripclient.c +@@ -44,6 +44,7 @@ + #include + #include + #include ++ #include + #include + #include + #include diff --git a/net/ntripserver/Makefile b/net/ntripserver/Makefile new file mode 100644 index 0000000..a3e3cf9 --- /dev/null +++ b/net/ntripserver/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2011 segal.ubi.pt +# Copyright (C) 2010-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:=ntripserver +PKG_VERSION:=1.5.1 + +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/nunojpg/ntripserver.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=c3034ab575e8442222eb8c2ee9e224cac99cfa6d +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_LICENSE:=GPL-2.0+ + +PKG_MAINTAINER:=Nuno Goncalves + +include $(INCLUDE_DIR)/package.mk + +define Package/ntripserver + SECTION:=net + CATEGORY:=Network + SUBMENU:=NTRIP + TITLE:=Ntrip Version 2.0 Command Line Server + URL:=http://igs.bkg.bund.de/ntrip/download +endef + +define Package/ntripserver/description + Ntrip Version 2.0 Command Line Server, reading from SISNeT Server, TCP/UDP IP + Port, Serial port, or NtripCaster to support an Ntrip Version 1.0 or 2.0 Caster +endef + +MAKE_FLAGS += \ + OPTS="$(TARGET_CFLAGS)" + +define Package/ntripserver/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntripserver $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,ntripserver)) diff --git a/net/nut/Config.in b/net/nut/Config.in new file mode 100644 index 0000000..b48102f --- /dev/null +++ b/net/nut/Config.in @@ -0,0 +1,100 @@ + config NUT_SERVER + depends on PACKAGE_nut + bool "Include server components (upsd)" + help + upsd is responsible for serving the data from the drivers to the + clients. It connects to each driver and maintains a local cache of the + current state. Queries from the clients are served from this cache, so + delays are minimal. This program is essential, and must be running at + all times to actually make any use out of the drivers and clients. + default y + + config NUT_CLIENTS_UPSC + depends on PACKAGE_nut + bool "Include command line client (upsc)" + help + upsc is provided as a quick way to poll the status of a UPS server. It + can be used inside shell scripts and other programs that need UPS data + but don't want to include the full interface. + default y + + config NUT_CLIENTS_UPSLOG + depends on PACKAGE_nut + bool "Include logging client (upslog)" + help + upslog is a daemon that will poll a UPS at periodic intervals, fetch the + variables that interest you, format them, and write them to a file. + default n + + config NUT_CLIENTS_UPSCMD + depends on PACKAGE_nut + bool "Include UPS controller (upscmd)" + help + upscmd allows you to invoke "instant commands" in your UPS hardware. Not + all hardware supports this, so check the list with -l to see if anything + will work on your equipment. On hardware that supports it, you can use + this program to start and stop battery tests, invoke a front panel test + (beep!), turn the load on or off, and more. + default n + + config NUT_CLIENTS_UPSRW + depends on PACKAGE_nut + bool "Include UPS variable editor (upsrw)" + help + upsrw allows you to view and change the read/write variables inside your + UPS. It sends commands via the upsd to your driver, which configures the + hardware for you. The list of variables that allow you to change their + values is based on the capabilities of your UPS equipment. Not all + models support this feature. Typically, cheaper hardware does not + support any of them. + default n + + config NUT_CLIENTS_UPSMON + depends on PACKAGE_nut + bool "Include monitor and shutdown controller (upsmon)" + help + upsmon is the client process that is responsible for the most important + part of UPS monitoring--shutting down the system when the power goes + out. It can call out to other helper programs for notification purposes + during power events. upsmon can monitor multiple systems using a single + process. Every UPS that is defined in the upsmon.conf configuration file + is assigned a power value and a type (slave or master). + default y + + config NUT_CLIENTS_UPSSCHED + depends on NUT_CLIENTS_UPSMON + bool "Include helper for triggering events from upsmon (upssched)" + help + upssched was created to allow users to execute programs at times relative + to events being monitored by upsmon. The original purpose was to allow + for a shutdown to occur after some fixed period on battery, but there are + other uses that are possible. + You can alternatively write your own script and save some space. + default n + + config NUT_SSL + depends on PACKAGE_nut + bool "Build with support for OpenSSL" + help + SSL allows sessions between upsd and clients to be encrypted and can + also be used to authenticate servers. This means that stealing port + 3493 from upsd will no longer net you interesting passwords. SSL is + available via OpenSSL on OpenWRT (NSS doesn't seem to work). If you + are happy with using passwords to authenticate clients, you can save + some space and build NUT without SSL support. + default n + + config NUT_DRIVER_USB + depends on PACKAGE_nut + bool "Build with support for USB drivers" + help + If you have a UPS connected via USB, select this. + default y + + config NUT_DRIVER_SNMP + depends on PACKAGE_nut + bool "Build with support for SNMP drivers" + help + If you have a UPS you can connect to via SNMP, select this. + default n + diff --git a/net/nut/Makefile b/net/nut/Makefile new file mode 100644 index 0000000..a6ed1c6 --- /dev/null +++ b/net/nut/Makefile @@ -0,0 +1,352 @@ +# +# Copyright (C) 2006-2015 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:=nut +PKG_VERSION:=2.7.4 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.networkupstools.org/source/2.7/ +PKG_MD5SUM:=3ba53656933d7471f95140b32a5b8d5c +PKG_MAINTAINER:=Martin Rowe +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=LICENSE-GPL2 + +PKG_BUILD_DIR:=$(BUILD_DIR)/nut-$(PKG_VERSION) +PKG_INSTALL:=1 + +PKG_CONFIG_DEPENDS:= \ + CONFIG_NUT_CLIENTS_UPSC \ + CONFIG_NUT_CLIENTS_UPSCMD \ + CONFIG_NUT_CLIENTS_UPSLOG \ + CONFIG_NUT_CLIENTS_UPSMON \ + CONFIG_NUT_CLIENTS_UPSRW \ + CONFIG_NUT_CLIENTS_UPSSCHED \ + CONFIG_NUT_DRIVER_SNMP \ + CONFIG_NUT_DRIVER_USB \ + CONFIG_NUT_SERVER \ + CONFIG_NUT_SSL + +include $(INCLUDE_DIR)/package.mk + +define Package/nut/Default + SECTION:=net + CATEGORY:=Network + URL:=http://www.networkupstools.org/ + DEPENDS:=nut +endef + +define Package/nut/description +Network UPS Tools (NUT) is a client/server monitoring system that +allows computers to share uninterruptible power supply (UPS) and +power distribution unit (PDU) hardware. Clients access the hardware +through the server, and are notified whenever the power status +changes. +endef + +define Package/nut + $(call Package/nut/Default) + TITLE:=Network UPS Tools + DEPENDS:= \ + +libpthread \ + +NUT_DRIVER_SNMP:libnetsnmp \ + +NUT_DRIVER_USB:libusb-compat \ + +NUT_SSL:libopenssl + MENU:=1 +endef + +define Package/nut/config + source "$(SOURCE)/Config.in" +endef + +define Package/nut/conffiles +/etc/nut/nut.conf +$(if $(CONFIG_NUT_CLIENTS_UPSMON),/etc/nut/upsmon.conf) +$(if $(CONFIG_NUT_CLIENTS_UPSSCHED),/etc/nut/upssched.conf) +$(if $(CONFIG_NUT_SERVER),/etc/nut/ups.conf) +$(if $(CONFIG_NUT_SERVER),/etc/nut/upsd.conf) +$(if $(CONFIG_NUT_SERVER),/etc/nut/upsd.users) +endef + +define Package/nut/install + $(INSTALL_DIR) $(1)/etc/nut + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/nut.conf.sample $(1)/etc/nut/nut.conf + $(if $(or $(CONFIG_NUT_CLIENTS_UPSC),\ + $(CONFIG_NUT_CLIENTS_UPSCMD),\ + $(CONFIG_NUT_CLIENTS_LOG),\ + $(CONFIG_NUT_CLIENTS_UPSRW),\ + $(CONFIG_NUT_CLIENTS_UPSMON),\ + $(CONFIG_NUT_CLIENTS_UPSSCHED)),$(CP) $(PKG_INSTALL_DIR)/usr/lib/libupsclient.so* $(1)/usr/lib/) + $(if $(or $(CONFIG_NUT_SERVER),\ + $(CONFIG_NUT_CLIENTS_UPSMON)),$(INSTALL_DIR) $(1)/etc/init.d) + $(if $(CONFIG_NUT_SERVER),$(INSTALL_DIR) $(1)/lib/nut) + $(if $(CONFIG_NUT_SERVER),$(INSTALL_DIR) $(1)/usr/share/nut) + $(if $(CONFIG_NUT_SERVER),$(CP) ./files/nut-server.init $(1)/etc/init.d/) + $(if $(CONFIG_NUT_SERVER),$(CP) $(PKG_INSTALL_DIR)/usr/sbin/upsd $(1)/usr/sbin) + $(if $(CONFIG_NUT_SERVER),$(CP) $(PKG_INSTALL_DIR)/usr/sbin/upsdrvctl $(1)/usr/sbin) + $(if $(CONFIG_NUT_SERVER),$(CP) $(PKG_INSTALL_DIR)/usr/share/nut/cmdvartab $(1)/usr/share/nut/) + $(if $(CONFIG_NUT_SERVER),$(CP) $(PKG_INSTALL_DIR)/usr/share/nut/driver.list $(1)/usr/share/nut/) + $(if $(CONFIG_NUT_SERVER),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/ups.conf.sample $(1)/etc/nut/ups.conf) + $(if $(CONFIG_NUT_SERVER),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsd.conf.sample $(1)/etc/nut/upsd.conf) + $(if $(CONFIG_NUT_SERVER),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsd.users.sample $(1)/etc/nut/upsd.users) + $(if $(CONFIG_NUT_CLIENTS_UPSC),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upsc $(1)/usr/bin/) + $(if $(CONFIG_NUT_CLIENTS_UPSCMD),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upscmd $(1)/usr/bin/) + $(if $(CONFIG_NUT_CLIENTS_UPSLOG),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upslog $(1)/usr/bin/) + $(if $(CONFIG_NUT_CLIENTS_UPSRW),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upsrw $(1)/usr/bin/) + $(if $(CONFIG_NUT_CLIENTS_UPSMON),$(CP) ./files/nut-monitor.init $(1)/etc/init.d/) + $(if $(CONFIG_NUT_CLIENTS_UPSMON),$(CP) $(PKG_INSTALL_DIR)/usr/sbin/upsmon $(1)/usr/sbin/) + $(if $(CONFIG_NUT_CLIENTS_UPSMON),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsmon.conf.sample $(1)/etc/nut/upsmon.conf) + $(if $(CONFIG_NUT_CLIENTS_UPSSCHED),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upssched-cmd $(1)/usr/bin/) + $(if $(CONFIG_NUT_CLIENTS_UPSSCHED),$(CP) $(PKG_INSTALL_DIR)/usr/sbin/upssched $(1)/usr/sbin/) + $(if $(CONFIG_NUT_CLIENTS_UPSSCHED),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upssched.conf.sample $(1)/etc/nut/upssched.conf) +endef + +define Package/nut-web-cgi + $(call Package/nut/Default) + TITLE+= Web CGI interface + DEPENDS+=+libgd +endef + +define Package/nut-web-cgi/description +The CGI programs are clients that run through your web server. +They allow you to see UPS status and perform certain administrative +commands from any web browser. Javascript and cookies are not required. +endef + +define Package/nut-web-cgi/conffiles +/etc/nut/hosts.conf +/etc/nut/upsset.conf +/etc/nut/upsstats.html +/etc/nut/upsstats-single.html +endef + +define Package/nut-web-cgi/install + $(INSTALL_DIR) $(1)/etc/nut + $(INSTALL_DIR) $(1)/usr/share/www/cgi-bin + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/hosts.conf.sample $(1)/etc/nut/hosts.conf + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsset.conf.sample $(1)/etc/nut/upsset.conf + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsstats.html.sample $(1)/etc/nut/upsstats.html + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsstats-single.html.sample $(1)/etc/nut/upsstats-single.html + $(CP) $(PKG_INSTALL_DIR)/usr/share/www/nut $(1)/usr/share/www/ + $(CP) $(PKG_INSTALL_DIR)/usr/share/www/cgi-bin/nut $(1)/usr/share/www/cgi-bin/ +endef + +define Package/nut-avahi-service + $(call Package/nut/Default) + TITLE+= (Avahi service) + DEPENDS+=+avahi-daemon +endef + +define Package/nut-avahi-service/description +This package contains the service definition for announcing the +attached UPS via mDNS/DNS-SD. +endef + +define Package/nut-avahi-service/conffiles +/etc/avahi/services/nut.service +endef + +define Package/nut-avahi-service/install + $(INSTALL_DIR) $(1)/etc/avahi/services + $(INSTALL_CONF) ./files/nut.service $(1)/etc/avahi/services/ +endef + +# Dealing with all of the drivers is very repetitive, but the previous +# maintainer had a neat solution which just needed some tweaking. +define DriverPackage + define Package/nut-driver-$(2) + $(call Package/nut/Default) + TITLE:=$(2) (NUT $(1) driver) + $(if $(filter $(1),snmp),DEPENDS+= @NUT_DRIVER_SNMP) + $(if $(filter $(1),usb),DEPENDS+= @NUT_DRIVER_USB) + endef + # Deliberately empty description in order to trigger a build failure. + # It should be overridden by the list below, and when updating to a + # new version of nut we will need to provide descriptions for any new + # drivers. + define Package/nut-driver-$(2)/description + + endef + define Package/nut-driver-$(2)/install + $(INSTALL_DIR) $$(1)/lib/nut + $(CP) $$(PKG_INSTALL_DIR)/lib/nut/$(2) $$(1)/lib/nut/ + $(if $(filter $(2),clone),$(CP) $$(PKG_INSTALL_DIR)/lib/nut/$(2)-outlet $$(1)/lib/nut/) + endef +endef +define DriverDescription + define Package/nut-driver-$(2)/description + $(3) + endef +endef +# These lists are lifted *directly* from drivers/Makefile.am in the nut +# source tree. This it to make it simpler to keep in sync when updating +# to a newer version of nut. Do not edit this manually. +# +# DO NOT EDIT (except to update with a fresh cut/paste)! +SERIAL_DRIVERLIST = al175 bcmxcp belkin belkinunv bestfcom \ + bestfortress bestuferrups bestups dummy-ups etapro everups \ + gamatronic genericups isbmex liebert liebert-esp2 masterguard metasys \ + oldmge-shut mge-utalk microdowell mge-shut oneac optiups powercom rhino \ + safenet skel solis tripplite tripplitesu upscode2 victronups powerpanel \ + blazer_ser clone clone-outlet ivtscd apcsmart apcsmart-old apcupsd-ups riello_ser \ + nutdrv_qx +SNMP_DRIVERLIST = snmp-ups +USB_LIBUSB_DRIVERLIST = usbhid-ups bcmxcp_usb tripplite_usb \ + blazer_usb richcomm_usb riello_usb \ + nutdrv_atcl_usb \ + nutdrv_qx +# END: DO NOT EDIT! +SERIAL_DRIVERLIST_IGNORE:=skel clone-outlet nutdrv_qx +# nutdrv_qx can be either USB or serial. Given most routers have USB +# instead of serial ports, and not wanting two identical packages with +# different names that conflict with each other, only the option for the +# driver with USB bindings is provided. If you really want to save that +# tiny bit of space and build it without USB support, remove nutdrv_qx +# from the previous line. + +$(foreach d,$(filter-out $(SERIAL_DRIVERLIST_IGNORE),$(SERIAL_DRIVERLIST)),$(eval $(call DriverPackage,serial,$(d)))) +$(foreach d,$(SNMP_DRIVERLIST),$(eval $(call DriverPackage,snmp,$(d)))) +$(foreach d,$(USB_LIBUSB_DRIVERLIST),$(eval $(call DriverPackage,usb,$(d)))) + +$(eval $(call DriverDescription,serial,al175,\ + Driver for Eltek UPS models with AL175 alarm module)) +$(eval $(call DriverDescription,serial,bcmxcp,\ + Driver for UPSes supporting the serial BCM/XCP protocol)) +$(eval $(call DriverDescription,serial,belkin,\ + Driver for Belkin serial UPS equipment)) +$(eval $(call DriverDescription,serial,belkinunv,\ + Driver for Belkin "Universal UPS" and compatible)) +$(eval $(call DriverDescription,serial,bestfcom,\ + Driver for Best Power Fortress/Ferrups)) +$(eval $(call DriverDescription,serial,bestfortress,\ + Driver for old Best Fortress UPS equipment)) +$(eval $(call DriverDescription,serial,bestuferrups,\ + Driver for Best Power Micro-Ferrups)) +$(eval $(call DriverDescription,serial,bestups,\ + Driver for Best Power / SOLA (Phoenixtec protocol) UPS equipment)) +$(eval $(call DriverDescription,serial,dummy-ups,\ + Driver for multi-purpose UPS emulation)) +$(eval $(call DriverDescription,serial,etapro,\ + Driver for ETA UPS equipment)) +$(eval $(call DriverDescription,serial,everups,\ + Driver for Ever UPS models)) +$(eval $(call DriverDescription,serial,gamatronic,\ + Driver for Gamatronic UPS equipment)) +$(eval $(call DriverDescription,serial,genericups,\ + Driver for contact-closure UPS equipment)) +$(eval $(call DriverDescription,serial,isbmex,\ + Driver for ISBMEX UPS equipment)) +$(eval $(call DriverDescription,serial,liebert,\ + Driver for Liebert contact-closure UPS equipment)) +$(eval $(call DriverDescription,serial,liebert-esp2,\ + Driver for Liebert UPS, using the ESP-II serial protocol)) +$(eval $(call DriverDescription,serial,masterguard,\ + Driver for Masterguard UPS equipment)) +$(eval $(call DriverDescription,serial,metasys,\ + Driver for Meta System UPS equipment)) +$(eval $(call DriverDescription,serial,oldmge-shut,\ + Driver for SHUT Protocol UPS equipment, deprecated, use mge-shut)) +$(eval $(call DriverDescription,serial,mge-utalk,\ + Driver for MGE UPS SYSTEMS UTalk protocol equipment)) +$(eval $(call DriverDescription,serial,microdowell,\ + Driver for Microdowell Enterprise UPS series)) +$(eval $(call DriverDescription,serial,mge-shut,\ + Driver for SHUT Protocol UPS equipment)) +$(eval $(call DriverDescription,serial,oneac,\ + Driver for Oneac UPS equipment)) +$(eval $(call DriverDescription,serial,optiups,\ + Driver for Opti-UPS (Viewsonic) UPS and Zinto D (ONLINE-USV) equipment)) +$(eval $(call DriverDescription,serial,powercom,\ + Driver for serial Powercom/Trust/Advice UPS equipment)) +$(eval $(call DriverDescription,serial,rhino,\ + Driver for Brazilian Microsol RHINO UPS equipment)) +$(eval $(call DriverDescription,serial,safenet,\ + Driver for SafeNet compatible UPS equipment)) +$(eval $(call DriverDescription,serial,solis,\ + Driver for Brazilian Microsol SOLIS UPS equipment)) +$(eval $(call DriverDescription,serial,tripplite,\ + Driver for Tripp-Lite SmartPro UPS equipment)) +$(eval $(call DriverDescription,serial,tripplitesu,\ + Driver for Tripp-Lite SmartOnline (SU) UPS equipment)) +$(eval $(call DriverDescription,serial,upscode2,\ + Driver for UPScode II compatible UPS equipment)) +$(eval $(call DriverDescription,serial,victronups,\ + Driver for IMV/Victron UPS unit Match, Match Lite, NetUps)) +$(eval $(call DriverDescription,serial,powerpanel,\ + Driver for PowerPanel Plus compatible UPS equipment)) +$(eval $(call DriverDescription,serial,blazer_ser,\ + Driver for Megatec/Q1 protocol serial based UPS equipment)) +$(eval $(call DriverDescription,serial,clone,\ + UPS driver clone)) +$(eval $(call DriverDescription,serial,ivtscd,\ + Driver for the IVT Solar Controller Device)) +$(eval $(call DriverDescription,serial,apcsmart,\ + Driver for American Power Conversion Smart Protocol UPS equipment)) +$(eval $(call DriverDescription,serial,apcsmart-old,\ + Driver for American Power Conversion Smart Protocol UPS equipment)) +$(eval $(call DriverDescription,serial,apcupsd-ups,\ + Driver for apcupsd client access)) +$(eval $(call DriverDescription,serial,riello_ser,\ + Driver for Riello UPS Protocol UPS equipment)) +$(eval $(call DriverDescription,snmp,snmp-ups,\ + Multi-MIB Driver for SNMP UPS equipment)) +$(eval $(call DriverDescription,usb,usbhid-ups,\ + Driver for USB/HID UPS equipment)) +$(eval $(call DriverDescription,usb,bcmxcp_usb,\ + Experimental driver for UPSes supporting the BCM/XCP protocol over USB)) +$(eval $(call DriverDescription,usb,tripplite_usb,\ + Driver for older Tripp Lite USB UPSes (not PDC HID))) +$(eval $(call DriverDescription,usb,blazer_usb,\ + Driver for Megatec/Q1 protocol USB based UPS equipment)) +$(eval $(call DriverDescription,usb,richcomm_usb,\ + Driver for UPS equipment using Richcomm dry-contact to USB solution)) +$(eval $(call DriverDescription,usb,riello_usb,\ + Driver for Riello UPS Protocol UPS equipment via USB)) +$(eval $(call DriverDescription,usb,nutdrv_atcl_usb,\ + Driver for ATCL FOR UPS equipment)) +$(eval $(call DriverDescription,usb,nutdrv_qx,\ + Driver for Q* protocol serial and USB based UPS equipment)) + +CONFIGURE_ARGS += \ + --sysconfdir=/etc/nut \ + --datadir=/usr/share/nut \ + --with-dev \ + --$(if $(CONFIG_NUT_DRIVER_USB),with,without)-usb \ + --without-avahi \ + --$(if $(CONFIG_NUT_DRIVER_SNMP),with,without)-snmp \ + --without-neon \ + --without-powerman \ + --without-ipmi \ + --without-freeipmi \ + --$(if $(CONFIG_NUT_SSL),with,without)-ssl $(if $(CONFIG_NUT_SSL),--with-openssl) \ + --without-libltdl \ + --$(if $(CONFIG_PACKAGE_nut-web-cgi),with,without)-cgi \ + --with-statepath=/var/run \ + --with-drvpath=/lib/nut \ + --with-cgipath=/usr/share/www/cgi-bin/nut \ + --with-htmlpath=/usr/share/www/nut \ + --with-user=root \ + --with-group=root + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig/ +endef + +$(eval $(call BuildPackage,nut)) +$(eval $(call BuildPackage,nut-web-cgi)) +$(eval $(call BuildPackage,nut-avahi-service)) +$(foreach d,$(filter-out $(SERIAL_DRIVERLIST_IGNORE),$(SERIAL_DRIVERLIST)),$(eval $(call BuildPackage,nut-driver-$(d)))) +$(foreach d,$(SNMP_DRIVERLIST),$(eval $(call BuildPackage,nut-driver-$(d)))) +$(foreach d,$(USB_LIBUSB_DRIVERLIST),$(eval $(call BuildPackage,nut-driver-$(d)))) diff --git a/net/nut/files/nut-monitor.init b/net/nut/files/nut-monitor.init new file mode 100755 index 0000000..e9fdb33 --- /dev/null +++ b/net/nut/files/nut-monitor.init @@ -0,0 +1,21 @@ +#!/bin/sh /etc/rc.common + +START=60 +USE_PROCD=1 + +restart() { + stop_service + start_service +} + +start_service() { + upsmon -p +} + +stop_service() { + upsmon -c stop +} + +reload_service() { + upsmon -c reload +} diff --git a/net/nut/files/nut-server.init b/net/nut/files/nut-server.init new file mode 100755 index 0000000..f9971be --- /dev/null +++ b/net/nut/files/nut-server.init @@ -0,0 +1,23 @@ +#!/bin/sh /etc/rc.common + +START=50 +USE_PROCD=1 + +restart() { + stop_service + start_service +} + +start_service() { + upsdrvctl start + upsd +} + +stop_service() { + upsd -c stop + upsdrvctl stop +} + +reload_service() { + upsd -c reload +} diff --git a/net/nut/files/nut.service b/net/nut/files/nut.service new file mode 100644 index 0000000..5ad6b31 --- /dev/null +++ b/net/nut/files/nut.service @@ -0,0 +1,34 @@ + + + + + + + + + + %h + + + _nut._tcp + 3493 + + + diff --git a/net/obfsproxy/Makefile b/net/obfsproxy/Makefile new file mode 100644 index 0000000..51facf5 --- /dev/null +++ b/net/obfsproxy/Makefile @@ -0,0 +1,59 @@ +# +# Copyright (C) 2006-2016 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:=obfsproxy +PKG_VERSION:=0.2.13 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://pypi.python.org/packages/source/o/obfsproxy +PKG_MD5SUM:=f596aeeda7bf03cdf0e78e68e6e7ac9f + +PKG_LICENSE:=BSD-3-Clause +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Jeffery To + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/obfsproxy + SECTION:=net + CATEGORY:=Network + TITLE:=A pluggable transport proxy written in Python + URL:=https://www.torproject.org/projects/obfsproxy.html.en + DEPENDS:=+python-light +python-crypto +python-pyptlib +python-setuptools +python-yaml +twisted +endef + +define Package/obfsproxy/description +obfsproxy is a tool that attempts to circumvent censorship, by +transforming the Tor traffic between the client and the bridge. This +way, censors, who usually monitor traffic between the client and the +bridge, will see innocent-looking transformed traffic instead of the +actual Tor traffic. +endef + +define Package/obfsproxy/conffiles +/etc/config/obfsproxy +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix="/usr" --root="$(PKG_INSTALL_DIR)") +endef + +define PyPackage/obfsproxy/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/obfsproxy $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/obfsproxy.conf $(1)/etc/config/obfsproxy + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/obfsproxy.init $(1)/etc/init.d/obfsproxy +endef + +$(eval $(call PyPackage,obfsproxy)) +$(eval $(call BuildPackage,obfsproxy)) diff --git a/net/obfsproxy/files/obfsproxy.conf b/net/obfsproxy/files/obfsproxy.conf new file mode 100644 index 0000000..1eed142 --- /dev/null +++ b/net/obfsproxy/files/obfsproxy.conf @@ -0,0 +1,57 @@ +# To use Obfsproxy with Tor, follow the instructions at: +# +# https://www.torproject.org/projects/obfsproxy-instructions.html.en +# +# instead of setting up a separate instance of Obfsproxy. + +config obfsproxy 'obfsproxy' + # Set to 1 to enable this instance + option enabled 0 + + # One of: managed, dummy, b64, obfs2, obfs3, scramblesuit + option transport 'scramblesuit' + + # Shared secret / password + # For obfs2 (as the shared secret parameter) and scramblesuit only + option password 'EXAMPLEPASSWORDNOTREAL' + + # One of: server, ext_server, client, socks + option mode 'socks' + + # Destination address + # Required for all modes except 'socks' + #option dest_host '0.0.0.0' + #option dest_port '80' + + # Extended ORPort authentication cookie file location + # Required for 'ext_server' mode + #option ext_cookie_file '' + + # Listener address + option listen_host '127.0.0.1' + option listen_port '8080' + + # Set to log to a file instead of syslog + #option log_file '/var/log/obfsproxy.log' + + # Minimum logging severity + # One of: error, warning, info, debug + #option log_min_severity 'info' + + # Set to 1 to disable logging + #option no_log 0 + + # Set to 1 to disable safe (scrubbed address) logging + #option no_safe_logging 0 + + # Run as a different user + #option user 'nobody' + + # Outgoing proxy + # proxy_scheme is one of: socks4a, socks5, http + # txsocksx is required for socks4a or socks5 + #option proxy_scheme '' + #option proxy_username '' + #option proxy_password '' + #option proxy_host '' + #option proxy_port '' diff --git a/net/obfsproxy/files/obfsproxy.init b/net/obfsproxy/files/obfsproxy.init new file mode 100644 index 0000000..4901c07 --- /dev/null +++ b/net/obfsproxy/files/obfsproxy.init @@ -0,0 +1,158 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2016 OpenWrt.org + +START=80 +STOP=20 +USE_PROCD=1 + +PROG=/usr/bin/obfsproxy + +append_arg() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param command "$opt" "${val:-$def}" +} + +append_bool() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get_bool val "$cfg" "$var" "$def" + [ "$val" = 1 ] && procd_append_param command "$opt" +} + +append_plain() { + procd_append_param command "$1" +} + +append_param() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param "$opt" "${val:-$def}" +} + +append_proxy_spec() { + local cfg="$1" + local scheme_var="$2" + local username_var="$3" + local password_var="$4" + local host_var="$5" + local port_var="$6" + local opt="$7" + local def="$8" + local scheme + local username + local password + local host + local port + local login + local val + + config_get scheme "$cfg" "$scheme_var" + config_get username "$cfg" "$username_var" + config_get password "$cfg" "$password_var" + config_get host "$cfg" "$host_var" + config_get port "$cfg" "$port_var" + [ "$username" ] && login="$username${password:+:$password}@" + [ -n "$scheme" -a -n "$host" -a -n "$port" ] && val="$scheme://$login$host:$port" + [ -n "$val" -o -n "$def" ] && procd_append_param command "$opt" "${val:-$def}" +} + +append_host_port() { + local cfg="$1" + local host_var="$2" + local port_var="$3" + local opt="$4" + local def="$5" + local host + local port + local val + + config_get host "$cfg" "$host_var" + config_get port "$cfg" "$port_var" + [ -n "$host" -a -n "$port" ] && val="$host:$port" + [ -n "$val" -o -n "$def" ] && { + [ "$opt" ] && procd_append_param command "$opt" + procd_append_param command "${val:-$def}" + } +} + +start_instance() { + local cfg="$1" + local lib_dir="/var/lib/obfsproxy/$cfg" + local redirect=0 + local enabled + local user + local transport + local password + local log_min_severity + + config_get_bool enabled "$cfg" 'enabled' '0' + [ "$enabled" = 0 ] && return 1 + + config_get user "$cfg" 'user' 'root' + config_get transport "$cfg" 'transport' + [ "$transport" = "scramblesuit" ] && config_get password "$cfg" 'password' + + [ -d "$lib_dir" ] || { + mkdir -m 0755 -p "$lib_dir/data" + chmod -R 0700 "$lib_dir" + } + [ "$password" ] && { + echo "$password" > "$lib_dir/secret" + chmod 0600 "$lib_dir/secret" + } + chown -R "$user:" "$lib_dir" + + config_get log_min_severity "$cfg" 'log_min_severity' + [ "$log_min_severity" = "debug" ] && redirect=1 + + procd_open_instance + + procd_set_param command "$PROG" --data-dir "$lib_dir/data" --syslog "obfsproxy($cfg)" + + append_arg "$cfg" log_file "--log-file" + append_arg "$cfg" log_min_severity "--log-min-severity" + append_bool "$cfg" no_log "--no-log" + append_bool "$cfg" no_safe_logging "--no-safe-logging" + append_proxy_spec "$cfg" proxy_scheme proxy_username proxy_password proxy_host proxy_port "--proxy" + + append_param "$cfg" transport command + [ "$transport" = "obfs2" ] && append_arg "$cfg" password "--shared-secret" + [ "$password" ] && procd_append_param command "--password-file" "$lib_dir/secret" + + append_param "$cfg" mode command + append_host_port "$cfg" dest_host dest_port "--dest" + append_arg "$cfg" ext_cookie_file "--ext-cookie-file" + + append_host_port "$cfg" listen_host listen_port + + procd_set_param respawn + procd_set_param stdout $redirect + procd_set_param stderr $redirect + append_param "$cfg" user user + + procd_close_instance +} + +service_triggers() { + procd_add_reload_trigger obfsproxy +} + +start_service() { + config_load obfsproxy + config_foreach start_instance obfsproxy +} diff --git a/net/obfsproxy/patches/001-exclude-tests.patch b/net/obfsproxy/patches/001-exclude-tests.patch new file mode 100644 index 0000000..445c554 --- /dev/null +++ b/net/obfsproxy/patches/001-exclude-tests.patch @@ -0,0 +1,13 @@ +diff --git a/setup.py b/setup.py +index 2353a29..9d2a9a9 100644 +--- a/setup.py ++++ b/setup.py +@@ -21,7 +21,7 @@ setup( + version=versioneer.get_version(), + cmdclass=versioneer.get_cmdclass(), + +- packages = find_packages(), ++ packages = find_packages(exclude=['*.test', '*.test.*']), + entry_points = { + 'console_scripts': [ + 'obfsproxy = obfsproxy.pyobfsproxy:run' diff --git a/net/obfsproxy/patches/002-fix-python-path.patch b/net/obfsproxy/patches/002-fix-python-path.patch new file mode 100644 index 0000000..4a8f9ac --- /dev/null +++ b/net/obfsproxy/patches/002-fix-python-path.patch @@ -0,0 +1,16 @@ +diff --git a/setup.py b/setup.py +index 2353a29..8d3d56d 100644 +--- a/setup.py ++++ b/setup.py +@@ -27,6 +27,11 @@ setup( + 'obfsproxy = obfsproxy.pyobfsproxy:run' + ] + }, ++ options = { ++ 'build_scripts': { ++ 'executable': '/usr/bin/python' ++ }, ++ }, + + install_requires = [ + 'setuptools', diff --git a/net/obfsproxy/patches/003-remove-argparse-dependency-test.patch b/net/obfsproxy/patches/003-remove-argparse-dependency-test.patch new file mode 100644 index 0000000..20fe481 --- /dev/null +++ b/net/obfsproxy/patches/003-remove-argparse-dependency-test.patch @@ -0,0 +1,12 @@ +diff --git a/setup.py b/setup.py +index 2353a29..e04c5f5 100644 +--- a/setup.py ++++ b/setup.py +@@ -32,7 +32,6 @@ setup( + 'setuptools', + 'PyCrypto', + 'Twisted', +- 'argparse', + 'pyptlib >= 0.0.6', + 'pyyaml' + ], diff --git a/net/obfsproxy/patches/004-add-syslog-support.patch b/net/obfsproxy/patches/004-add-syslog-support.patch new file mode 100644 index 0000000..b7240cb --- /dev/null +++ b/net/obfsproxy/patches/004-add-syslog-support.patch @@ -0,0 +1,51 @@ +diff --git a/obfsproxy/common/log.py b/obfsproxy/common/log.py +index bb30296..79193d2 100644 +--- a/obfsproxy/common/log.py ++++ b/obfsproxy/common/log.py +@@ -1,5 +1,6 @@ + """obfsproxy logging code""" + import logging ++import logging.handlers + import sys + + from twisted.python import log +@@ -50,6 +51,18 @@ class ObfsLogger(object): + + self.obfslogger.addHandler(log_handler) + ++ def set_syslog(self, progname): ++ """Set up our logger so that it starts logging to syslog instead.""" ++ ++ # remove the default handler, and add the SysLogHandler: ++ self.obfslogger.removeHandler(self.default_handler) ++ ++ log_handler = logging.handlers.SysLogHandler(address='/dev/log') ++ formatter = logging.Formatter(progname + "[%(process)d]: %(message)s") ++ log_handler.setFormatter(formatter) ++ ++ self.obfslogger.addHandler(log_handler) ++ + + def set_log_severity(self, sev_string): + """Update our minimum logging severity to 'sev_string'.""" +diff --git a/obfsproxy/pyobfsproxy.py b/obfsproxy/pyobfsproxy.py +index 4a2faf6..eaf8a44 100755 +--- a/obfsproxy/pyobfsproxy.py ++++ b/obfsproxy/pyobfsproxy.py +@@ -42,6 +42,7 @@ def set_up_cli_parsing(): + + parser.add_argument('-v', '--version', action='version', version=__version__) + parser.add_argument('--log-file', help='set logfile') ++ parser.add_argument('--syslog', metavar='PROGNAME', help='use syslog') + parser.add_argument('--log-min-severity', + choices=['error', 'warning', 'info', 'debug'], + help='set minimum logging severity (default: %(default)s)') +@@ -110,6 +111,8 @@ def consider_cli_args(args): + + if args.log_file: + log.set_log_file(args.log_file) ++ elif args.syslog: ++ log.set_syslog(args.syslog) + if args.log_min_severity: + log.set_log_severity(args.log_min_severity) + if args.no_log: diff --git a/net/ocserv/Config.in b/net/ocserv/Config.in new file mode 100644 index 0000000..b6460cd --- /dev/null +++ b/net/ocserv/Config.in @@ -0,0 +1,26 @@ +# ocserv avanced configuration + +menu "Configuration" + depends on PACKAGE_ocserv + +config OCSERV_PAM + bool "enable PAM" + default n + +config OCSERV_SECCOMP + bool "enable seccomp" + default n + +config OCSERV_RADIUS + bool "enable radius authentication" + default n + +config OCSERV_PROTOBUF + bool "use external libprotobuf" + default y + +config OCSERV_HTTP_PARSER + bool "use external libhttp-parser" + default y + +endmenu diff --git a/net/ocserv/Makefile b/net/ocserv/Makefile new file mode 100644 index 0000000..8fe0576 --- /dev/null +++ b/net/ocserv/Makefile @@ -0,0 +1,111 @@ +# +# Copyright (C) 2007-2011 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:=ocserv +PKG_VERSION:=0.11.6 +PKG_RELEASE:=2 +PKG_USE_MIPS16:=0 + +PKG_BUILD_DIR :=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=ftp://ftp.infradead.org/pub/ocserv/ +PKG_MD5SUM:=0e4f82d267d27f2f9d3fcba58ac6cf5a + +PKG_LICENSE:=GPLv2+ +PKG_LICENSE_FILES:=COPYING +PKG_FIXUP:=autoreconf + +PKG_CONFIG_DEPENDS:= \ + CONFIG_OCSERV_PAM \ + CONFIG_OCSERV_SECCOMP \ + CONFIG_OCSERV_PROTOBUF \ + +include $(INCLUDE_DIR)/package.mk + +define Package/ocserv/config + source "$(SOURCE)/Config.in" +endef + +define Package/ocserv + SECTION:=net + CATEGORY:=Network + SUBMENU:=VPN + TITLE:=OpenConnect VPN server + URL:=http://www.infradead.org/ocserv/ + MAINTAINER:=Nikos Mavrogiannopoulos + DEPENDS:= +OCSERV_RADIUS:libradcli +OCSERV_HTTP_PARSER:libhttp-parser +OCSERV_SECCOMP:libseccomp +libgnutls +certtool +libncurses +libreadline +OCSERV_PAM:libpam +OCSERV_PROTOBUF:libprotobuf-c +libev +kmod-tun + USERID:=ocserv=72:ocserv=72 +endef + +define Package/ocserv/description + OpenConnect server (ocserv) is an SSL VPN server. Its purpose is to be + a secure, small, fast and configurable VPN server. It implements the + OpenConnect SSL VPN protocol, and has also (currently experimental) + compatibility with clients using the AnyConnect SSL VPN protocol. The + OpenConnect VPN protocol uses the standard IETF security protocols such + as TLS 1.2, and Datagram TLS to provide the secure VPN service. +endef + +EXTRA_CPPFLAGS+=-I$(STAGING_DIR)/usr/include/readline/ +EXTRA_LDFLAGS+=-lncurses + +CONFIGURE_ARGS+= \ + --with-pager="" \ + --enable-local-libopts \ + --with-libreadline-prefix="$(STAGING_DIR)/" \ + --without-libnl \ + --without-lz4 \ + --without-gssapi \ + --with-libcrypt-prefix="$(STAGING_DIR)/" \ + --with-libev-prefix="$(STAGING_DIR)/" \ + --without-lz4 \ + --with-local-talloc \ + +ifneq ($(CONFIG_OCSERV_PAM),y) +CONFIGURE_ARGS += --without-pam +endif + +ifneq ($(CONFIG_OCSERV_RADIUS),y) +CONFIGURE_ARGS += --without-radius +endif + +ifneq ($(CONFIG_OCSERV_SECCOMP),y) +CONFIGURE_ARGS += --disable-seccomp +endif + +ifneq ($(CONFIG_OCSERV_PROTOBUF),y) +CONFIGURE_ARGS += --without-protobuf +endif + +ifneq ($(CONFIG_OCSERV_HTTP_PARSER),y) +CONFIGURE_ARGS += --without-http-parser +endif + +define Package/ocserv/conffiles +/etc/config/ocserv +endef + +define Package/ocserv/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ocserv $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ocserv-fw $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ocpasswd/ocpasswd $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/occtl/occtl $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/ocserv.init $(1)/etc/init.d/ocserv + $(INSTALL_DIR) $(1)/etc/ocserv + $(INSTALL_CONF) ./files/ocserv.conf.template $(1)/etc/ocserv/ocserv.conf.template + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/config $(1)/etc/config/ocserv + $(INSTALL_DIR) $(1)/lib/upgrade/keep.d + $(INSTALL_DATA) ./files/ocserv.upgrade $(1)/lib/upgrade/keep.d/ocserv +endef + +$(eval $(call BuildPackage,ocserv)) diff --git a/net/ocserv/README b/net/ocserv/README new file mode 100644 index 0000000..a883a07 --- /dev/null +++ b/net/ocserv/README @@ -0,0 +1,198 @@ +Setting up OpenConnect VPN server +================================= + +The openconnect server expects to be configured using the uci interface. + +It is recommended to setup a dynamic DNS address with openwrt prior +to starting the server. That is because during the first startup +a certificate file which will contain the dynamic DNS name will be +created. You can always regenerate the certificate by deleting +/etc/ocserv/server-key.pem. + +There are two approaches to setup the VPN. The proxy-arp approach (1) +which provides clients with addresses of the LAN, and the "forwarding" +approach (2) which provides clients with addresses of a separate private +network. The former is suitable when you have "roadwarrior" type of clients +connecting to the LAN, and the latter when you may need to connect +multiple networks with the LAN. + +If for the client side you use OpenWRT it is recommended to check you +have the latest vpnc-scripts and openconnect packages. + + +1. Proxy-ARP Approach +===================== + +[This option is available since ocserv-0.10.9-2 package] + +To setup a server the provides access to LAN with network address +10.100.2.0/255.255.255.0 add the following to /etc/config/ocserv. +The following setup will assign the upper 62 addresses for VPN use. + +``` +----/etc/config/ocserv------------------------------------------- +config ocserv 'config' + option port '443' + option dpd '120' + option max_clients '8' + option max_same '2' + option netmask '255.255.255.192' + option ipaddr '10.100.2.192' + option auth 'plain' + option default_domain 'lan' + option compression '1' + option proxy_arp '1' + option ping_leases '1' + option enable '1' + +config dns + option ip '10.100.2.1' + +config routes + option ip '10.100.2.0' + option netmask '255.255.255.0' + +config ocservusers + option name 'test' + option password '$5$unl8uKAGNsdTh9zm$PnUHEGhDc5VHbFE2EfWwW38Bub6Y6EZ5hrFwZE1r2F1' + +----------------------------------------------------------------- +``` + +This setup re-utilizes the addresses assigned to LAN for the VPN clients. +To ensure that there are no conflicts with the DHCP server use the following +commands. These will set the maximum address assigned by DHCP to be 10.100.2.191 +which is below the first VPN assigned address (10.100.2.192). + +``` +# uci set dhcp.lan.start=100 +# uci set dhcp.lan.limit=91 +``` + +For simple networks like that you may also leave the 'netmask' and 'ipaddr' +fields empty and ocserv on startup will set the necessary values. + + +2. Forwarding Approach +====================== + +To setup a server the provides access to LAN with network address +10.100.2.0/255.255.255.0 using the VPN address range +10.100.3.0/255.255.255.0 add the following to /etc/config/ocserv: + +``` +----/etc/config/ocserv------------------------------------------- +config ocserv 'config' + option port '443' + option dpd '120' + option max_clients '8' + option max_same '2' + option netmask '255.255.255.0' + option ipaddr '10.100.3.0' + option auth 'plain' + option default_domain 'lan' + option compression '1' + option enable '1' + +config dns + option ip '10.100.2.1' + +config routes + option ip '10.100.2.0' + option netmask '255.255.255.0' + +config ocservusers + option name 'test' + option password '$5$unl8uKAGNsdTh9zm$PnUHEGhDc5VHbFE2EfWwW38Bub6Y6EZ5hrFwZE1r2F1' + +----------------------------------------------------------------- +``` + +Setting up split-dns +==================== + +To allow the clients to resolv with the local domain add the following +to the ocserv configuration file. + +``` +----/etc/config/ocserv------------------------------------------- +config ocserv 'config' + option split_dns '1' + option default_domain 'mydomain' +``` + +The ```default_domain``` is optional and if not set, it will be autodetected +from dnsmasq's configuration. + + +Setting up the firewall +======================= + +Since the connected users will be assigned to other interfaces than the LAN +one, it is required to assign the VPN clients to an interface, and enable +forwarding for them. That is, you should setup an unmanaged interface (e.g., +called vpn), which will have assigned the 'vpns+' interfaces (i.e., all vpns +interfaces). Then a zone called vpn should be setup to handle interactions +with lan. An example, which alls all forwarding between LAN and VPN clients, +follows. + +``` +----/etc/config/network------------------------------------------ +config interface 'vpn' + option proto 'none' + option ifname 'vpns+' +----------------------------------------------------------------- + +----/etc/config/firewall----------------------------------------- +config zone + option input 'ACCEPT' + option forward 'ACCEPT' + option output 'ACCEPT' + option name 'vpn' + option device 'vpns+' + option network 'vpn' + +config forwarding + option dest 'lan' + option src 'vpn' + +config forwarding + option dest 'vpn' + option src 'lan' + +config rule + option target 'ACCEPT' + option src 'wan' + option proto 'tcp' + option dest_port '443' + option name 'vpn' + +config rule + option target 'ACCEPT' + option src 'wan' + option proto 'udp' + option dest_port '443' + option name 'vpn' +----------------------------------------------------------------- +``` + +Note, that the last two rules, enable connections to port 443 from the +Internet. That is the port used by OpenConnect VPN. + + +Starting the server +=================== + +Note that both configurations above add the user "test" with password "test". The +password is specified in the crypt(3) format. + +The server can be enabled and started using: +# /etc/init.d/ocserv enable +# /etc/init.d/ocserv start + +For any custom configuration options of ocserv you may add values in +/etc/ocserv/ocserv.conf.local. + +There is a luci plugin to allow configuring the server from +the web environment; see the package luci-app-ocserv. + diff --git a/net/ocserv/files/config b/net/ocserv/files/config new file mode 100644 index 0000000..4814459 --- /dev/null +++ b/net/ocserv/files/config @@ -0,0 +1,17 @@ + +config ocserv 'config' + option port '4443' + option dpd '180' + option max_clients '8' + option max_same '2' + option enable '0' + option zone 'lan' + +config ocservusers + +config dns + option ip '8.8.8.8' + +config routes + option ip '192.168.1.0' + option netmask '255.255.255.0' diff --git a/net/ocserv/files/ocserv.conf.template b/net/ocserv/files/ocserv.conf.template new file mode 100644 index 0000000..a46c21c --- /dev/null +++ b/net/ocserv/files/ocserv.conf.template @@ -0,0 +1,391 @@ +# User authentication method. Could be set multiple times and in that case +# all should succeed. +# Options: certificate, pam. +#auth = "certificate" +#auth = "pam" + +# The gid-min option is used by auto-select-group option, in order to +# select the minimum group ID. +#auth = "pam[gid-min=1000]" + +# The plain option requires specifying a password file which contains +# entries of the following format. +# "username:groupname:encoded-password" +# One entry must be listed per line, and 'ocpasswd' can be used +# to generate password entries. +auth = "|AUTH|" + +# A banner to be displayed on clients +banner = "Welcome to OpenWRT" + +#isolate-workers = true + +# When the server has a dynamic DNS address (that may change), +# should set that to true to ask the client to resolve again on +# reconnects. +listen-host-is-dyndns = |DYNDNS| + +# Use listen-host to limit to specific IPs or to the IPs of a provided +# hostname. +#listen-host = [IP|HOSTNAME] + +# Limit the number of clients. Unset or set to zero for unlimited. +#max-clients = 1024 +max-clients = |MAX_CLIENTS| + +# Limit the number of client connections to one every X milliseconds +# (X is the provided value). Set to zero for no limit. +rate-limit-ms = 100 + +# Limit the number of identical clients (i.e., users connecting +# multiple times). Unset or set to zero for unlimited. +max-same-clients = |MAX_SAME| + +# TCP and UDP port number +tcp-port = |PORT| +|UDP|udp-port = |PORT| + +# Stats report time. The number of seconds after which each +# worker process will report its usage statistics (number of +# bytes transferred etc). This is useful when accounting like +# radius is in use. +#stats-report-time = 360 + +# Keepalive in seconds +keepalive = 32400 + +# Dead peer detection in seconds. +dpd = |DPD| + +# Dead peer detection for mobile clients. The needs to +# be much higher to prevent such clients being awaken too +# often by the DPD messages, and save battery. +# (clients that send the X-AnyConnect-Identifier-DeviceType) +mobile-dpd = 1800 + +# If using DTLS, and no UDP traffic is received for this +# many seconds, attempt to send future traffic over the TCP +# connection instead, in an attempt to wake up the client +# in the case that there is a NAT and the UDP translation +# was deleted. If this is unset, do not attempt to use this +# recovery mechanism. +switch-to-tcp-timeout = 25 + +# MTU discovery (DPD must be enabled) +try-mtu-discovery = false + +# The key and the certificates of the server +# The key may be a file, or any URL supported by GnuTLS (e.g., +# tpmkey:uuid=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx;storage=user +# or pkcs11:object=my-vpn-key;object-type=private) +# +# There may be multiple certificate and key pairs and each key +# should correspond to the preceding certificate. +server-cert = /etc/ocserv/server-cert.pem +server-key = /etc/ocserv/server-key.pem + +# Diffie-Hellman parameters. Only needed if you require support +# for the DHE ciphersuites (by default this server supports ECDHE). +# Can be generated using: +# certtool --generate-dh-params --outfile /path/to/dh.pem +#dh-params = /path/to/dh.pem + +# If you have a certificate from a CA that provides an OCSP +# service you may provide a fresh OCSP status response within +# the TLS handshake. That will prevent the client from connecting +# independently on the OCSP server. +# You can update this response periodically using: +# ocsptool --ask --load-cert=your_cert --load-issuer=your_ca --outfile response +# Make sure that you replace the following file in an atomic way. +#ocsp-response = /path/to/ocsp.der + +# In case PKCS #11 or TPM keys are used the PINs should be available +# in files. The srk-pin-file is applicable to TPM keys only, and is the +# storage root key. +#pin-file = /path/to/pin.txt +#srk-pin-file = /path/to/srkpin.txt + +# The Certificate Authority that will be used to verify +# client certificates (public keys) if certificate authentication +# is set. +#ca-cert = /etc/ocserv/ca.pem + +# The object identifier that will be used to read the user ID in the client +# certificate. The object identifier should be part of the certificate's DN +# Useful OIDs are: +# CN = 2.5.4.3, UID = 0.9.2342.19200300.100.1.1 +#cert-user-oid = 0.9.2342.19200300.100.1.1 + +# The object identifier that will be used to read the user group in the +# client certificate. The object identifier should be part of the certificate's +# DN. Useful OIDs are: +# OU (organizational unit) = 2.5.4.11 +#cert-group-oid = 2.5.4.11 + +# The revocation list of the certificates issued by the 'ca-cert' above. +#crl = /etc/ocserv/crl.pem + +# Uncomment this to enable compression negotiation (LZS, LZ4). +|COMPRESSION|compression = true + +# GnuTLS priority string +tls-priorities = "NORMAL:%SERVER_PRECEDENCE:%COMPAT:-VERS-SSL3.0" + +# To enforce perfect forward secrecy (PFS) on the main channel. +#tls-priorities = "NORMAL:%SERVER_PRECEDENCE:%COMPAT:-VERS-SSL3.0:-RSA" + +# The time (in seconds) that a client is allowed to stay connected prior +# to authentication +auth-timeout = 40 + +# The time (in seconds) that a client is allowed to stay idle (no traffic) +# before being disconnected. Unset to disable. +#idle-timeout = 1200 + +# The time (in seconds) that a mobile client is allowed to stay idle (no +# traffic) before being disconnected. Unset to disable. +#mobile-idle-timeout = 2400 + +# The time (in seconds) that a client is not allowed to reconnect after +# a failed authentication attempt. +min-reauth-time = 360 + +# Banning clients in ocserv works with a point system. IP addresses +# that get a score over that configured number are banned for +# min-reauth-time seconds. By default a wrong password attempt is 10 points, +# a KKDCP POST is 1 point, and a connection is 1 point. Note that +# due to difference processes being involved the count of points +# will not be real-time precise. +# +# Score banning cannot be reliably used when receiving proxied connections +# locally from an HTTP server (i.e., when listen-clear-file is used). +# +# Set to zero to disable. +max-ban-score = 50 + +# The time (in seconds) that all score kept for a client is reset. +ban-reset-time = 300 + +# In case you'd like to change the default points. +#ban-points-wrong-password = 10 +#ban-points-connection = 1 +#ban-points-kkdcp = 1 + +# Cookie timeout (in seconds) +# which he can reconnect. That cookie will be invalided if not +# used within this timeout value. On a user disconnection, that +# cookie will also be active for this time amount prior to be +# invalid. That should allow a reasonable amount of time for roaming +# between different networks. +cookie-timeout = 300 + +# Whether roaming is allowed, i.e., if true a cookie is +# restricted to a single IP address and cannot be re-used +# from a different IP. +deny-roaming = false + +# ReKey time (in seconds) +# ocserv will ask the client to refresh keys periodically once +# this amount of seconds is elapsed. Set to zero to disable. +rekey-time = 172800 + +# ReKey method +# Valid options: ssl, new-tunnel +# ssl: Will perform an efficient rehandshake on the channel allowing +# a seamless connection during rekey. +# new-tunnel: Will instruct the client to discard and re-establish the channel. +# Use this option only if the connecting clients have issues with the ssl +# option. +rekey-method = ssl + +# Script to call when a client connects and obtains an IP +# Parameters are passed on the environment. +# REASON, USERNAME, GROUPNAME, HOSTNAME (the hostname selected by client), +# DEVICE, IP_REAL (the real IP of the client), IP_LOCAL (the local IP +# in the P-t-P connection), IP_REMOTE (the VPN IP of the client), +# ID (a unique numeric ID); REASON may be "connect" or "disconnect". + +# These scripts are not needed if you have setup an interface for all vpns+ +# devices. +#connect-script = /usr/bin/ocserv-script +#disconnect-script = /usr/bin/ocserv-script + +# UTMP +use-utmp = false + +# Whether to enable support for the occtl tool (i.e., either through D-BUS, +# or via a unix socket). +use-occtl = true + +# socket file used for IPC with occtl. You only need to set that, +# if you use more than a single servers. +occtl-socket-file = /var/run/occtl.socket + +# PID file. It can be overriden in the command line. +pid-file = /var/run/ocserv.pid + +# The default server directory. Does not require any devices present. +chroot-dir = /var/lib/ocserv + +# socket file used for IPC, will be appended with .PID +# It must be accessible within the chroot environment (if any) +#socket-file = /var/run/ocserv-socket +socket-file = ocserv-socket + +# The user the worker processes will be run as. It should be +# unique (no other services run as this user). +run-as-user = ocserv +run-as-group = ocserv + +# Set the protocol-defined priority (SO_PRIORITY) for packets to +# be sent. That is a number from 0 to 6 with 0 being the lowest +# priority. Alternatively this can be used to set the IP Type- +# Of-Service, by setting it to a hexadecimal number (e.g., 0x20). +# This can be set per user/group or globally. +#net-priority = 3 + +# Set the VPN worker process into a specific cgroup. This is Linux +# specific and can be set per user/group or globally. +#cgroup = "cpuset,cpu:test" + +# +# Network settings +# + +# The name of the tun device +device = vpns + +# Whether the generated IPs will be predictable, i.e., IP stays the +# same for the same user when possible. +predictable-ips = |PREDICTABLE_IPS| + +# The default domain to be advertised +|ENABLE_DEFAULT_DOMAIN|default-domain = |DEFAULT_DOMAIN| + +# The pool of addresses that leases will be given from. +ipv4-network = |IPV4ADDR| +ipv4-netmask = |NETMASK| + +# The advertized DNS server. Use multiple lines for +# multiple servers. +# dns = fc00::4be0 +#dns = 192.168.1.2 + +# The NBNS server (if any) +#nbns = 192.168.1.3 + +# The IPv6 subnet that leases will be given from. +|ENABLE_IPV6|ipv6-network = |IPV6ADDR| + +# The domains over which the provided DNS should be used. Use +# multiple lines for multiple domains. +|ENABLE_SPLIT_DNS|split-dns = |DEFAULT_DOMAIN| + +# Prior to leasing any IP from the pool ping it to verify that +# it is not in use by another (unrelated to this server) host. +ping-leases = |PING_LEASES| + +# Unset to assign the default MTU of the device +# mtu = + +# Unset to enable bandwidth restrictions (in bytes/sec). The +# setting here is global, but can also be set per user or per group. +#rx-data-per-sec = 40000 +#tx-data-per-sec = 40000 + +# The number of packets (of MTU size) that are available in +# the output buffer. The default is low to improve latency. +# Setting it higher will improve throughput. +#output-buffer = 10 + +# Routes to be forwarded to the client. If you need the +# client to forward routes to the server, you may use the +# config-per-user/group or even connect and disconnect scripts. +# +# To set the server as the default gateway for the client just +# comment out all routes from the server. +#route = 192.168.1.0/255.255.255.0 +#route = 192.168.5.0/255.255.255.0 +#route = fef4:db8:1000:1001::/64 + +# Configuration files that will be applied per user connection or +# per group. Each file name on these directories must match the username +# or the groupname. +# The options allowed in the configuration files are dns, nbns, +# ipv?-network, ipv4-netmask, ipv6-prefix, rx/tx-per-sec, iroute, route, +# net-priority and cgroup. +# +# Note that the 'iroute' option allows to add routes on the server +# based on a user or group. The syntax depends on the input accepted +# by the commands route-add-cmd and route-del-cmd (see below). + +config-per-user = /etc/ocserv/config-per-user/ +config-per-group = /etc/ocserv/config-per-group/ + +# When config-per-xxx is specified and there is no group or user that +# matches, then utilize the following configuration. + +#default-user-config = /etc/ocserv/defaults/user.conf +#default-group-config = /etc/ocserv/defaults/group.conf + +# Groups that a client is allowed to select from. +# A client may belong in multiple groups, and in certain use-cases +# it is needed to switch between them. For these cases the client can +# select prior to authentication. Add multiple entries for multiple groups. +#select-group = group1 +#select-group = group2[My group 2] +#select-group = tost[The tost group] + +# The name of the group that if selected it would allow to use +# the assigned by default group. +#default-select-group = DEFAULT + +# Instead of specifying manually all the allowed groups, you may instruct +# ocserv to scan all available groups and include the full list. That +# option is only functional on plain authentication. +#auto-select-group = true + +# The system command to use to setup a route. %{R} will be replaced with the +# route/mask and %{D} with the (tun) device. +# +# The following example is from linux systems. %{R} should be something +# like 192.168.2.0/24 + +#route-add-cmd = "/usr/sbin/ip route add %{R} dev %{D}" +#route-del-cmd = "/usr/sbin/ip route delete %{R} dev %{D}" + +route-add-cmd = "/sbin/route add -net %{RI} dev %{D}" +route-del-cmd = "/sbin/route del -net %{RI} dev %{D}" + +# This option allows to forward a proxy. The special strings '%{U}' +# and '%{G}', if present will be replaced by the username and group name. +#proxy-url = http://example.com/ +#proxy-url = http://example.com/%{U}/%{G}/hello + +# +# The following options are for (experimental) AnyConnect client +# compatibility. + +# Client profile xml. A sample file exists in doc/profile.xml. +# This file must be accessible from inside the worker's chroot. +# It is not used by the openconnect client. +#user-profile = profile.xml + +# Binary files that may be downloaded by the CISCO client. Must +# be within any chroot environment. +#binary-files = /path/to/binaries + +# Unless set to false it is required for clients to present their +# certificate even if they are authenticating via a previously granted +# cookie and complete their authentication in the same TCP connection. +# Legacy CISCO clients do not do that, and thus this option should be +# set for them. +cisco-client-compat = |CISCO_COMPAT| + +#Advanced options + +# Option to allow sending arbitrary custom headers to the client after +# authentication and prior to VPN tunnel establishment. +#custom-header = "X-My-Header: hi there" + +expose-iroutes = true diff --git a/net/ocserv/files/ocserv.init b/net/ocserv/files/ocserv.init new file mode 100644 index 0000000..bce9339 --- /dev/null +++ b/net/ocserv/files/ocserv.init @@ -0,0 +1,212 @@ +#!/bin/sh /etc/rc.common + +START=50 +USE_PROCD=1 + +setup_config() { + config_get port $1 port "4443" + config_get max_clients $1 max_clients "8" + config_get max_same $1 max_same "2" + config_get dpd $1 dpd "120" + config_get predictable_ips $1 predictable_ips "1" + config_get compression $1 compression "0" + config_get udp $1 udp "1" + config_get auth $1 auth "plain" + config_get cisco_compat $1 cisco_compat "1" + config_get ipaddr $1 ipaddr "" + config_get netmask $1 netmask "" + config_get ip6addr $1 ip6addr "" + config_get proxy_arp $1 proxy_arp "0" + config_get ping_leases $1 ping_leases "0" + config_get split_dns $1 split_dns "0" + config_get default_domain $1 default_domain "" + + # Enable proxy arp, and make sure that ping leases is set to true in that case, + # to prevent conflicts. + if test "$proxy_arp" = 1;then + local ip + # IP address is empty. Auto-configure LAN + VPN. + if test -z "$ipaddr";then + local mask + mask=$(uci get network.lan.netmask) + if test "$mask" = "255.255.255.0";then + uci set dhcp.lan.start=100 + uci set dhcp.lan.limit=91 + fi + ip=$(uci get network.lan.ipaddr) + ipaddr="$(echo $ip|cut -d . -f1,2,3).192" + netmask="255.255.255.192" + uci set ocserv.config.ipaddr="$ipaddr" + uci set ocserv.config.netmask="$netmask" + uci commit + fi + + if test -z "$ip6addr";then + ip6addr=$(uci get network.lan.ip6addr 2>/dev/null) + test -n "$ip6addr" && uci set ocserv.config.ip6addr="$ip6addr" + uci commit + fi + + ping_leases=1 + test -n "$ipaddr" && sysctl -w "net.ipv4.conf.$(uci get network.lan.ifname).proxy_arp"=1 >/dev/null + test -n "$ip6addr" && sysctl -w "net.ipv6.conf.$(uci get network.lan.ifname).proxy_ndp"=1 >/dev/null + else + test "$ipaddr" = "" && ipaddr="192.168.100.0" + test "$netmask" = "" && ipaddr="255.255.255.0" + fi + + enable_default_domain="#" + enable_udp="#" + enable_compression="#" + enable_split_dns="#" + test $predictable_ips = "0" && predictable_ips="false" + test $predictable_ips = "1" && predictable_ips="true" + test $cisco_compat = "0" && cisco_compat="false" + test $cisco_compat = "1" && cisco_compat="true" + test $ping_leases = "0" && ping_leases="false" + test $ping_leases = "1" && ping_leases="true" + test $udp = "1" && enable_udp="" + test $split_dns = "1" && enable_split_dns="" + test $compression = "1" && enable_compression="" + + test -z $default_domain && default_domain=$(uci get dhcp.@dnsmasq[0].domain) + test -n $default_domain && enable_default_domain="" + test -z $ip6addr && enable_ipv6="#" + + test $auth = "plain" && authsuffix="\[passwd=/var/etc/ocpasswd\]" + + dyndns="false" + hostname=`uci show ddns 2>/dev/null|grep domain|head -1|cut -d '=' -f 2` + [ -n "$hostname" ] && dyndns="true" + + mkdir -p /var/etc + sed -e "s/|PORT|/$port/g" \ + -e "s/|MAX_CLIENTS|/$max_clients/g" \ + -e "s/|MAX_SAME|/$max_same/g" \ + -e "s/|DPD|/$dpd/g" \ + -e "s#|AUTH|#$auth$authsuffix#g" \ + -e "s#|DYNDNS|#$dyndns#g" \ + -e "s/|PREDICTABLE_IPS|/$predictable_ips/g" \ + -e "s/|DEFAULT_DOMAIN|/$default_domain/g" \ + -e "s/|ENABLE_DEFAULT_DOMAIN|/$enable_default_domain/g" \ + -e "s/|ENABLE_SPLIT_DNS|/$enable_split_dns/g" \ + -e "s/|CISCO_COMPAT|/$cisco_compat/g" \ + -e "s/|PING_LEASES|/$ping_leases/g" \ + -e "s/|UDP|/$enable_udp/g" \ + -e "s/|COMPRESSION|/$enable_compression/g" \ + -e "s/|IPV4ADDR|/$ipaddr/g" \ + -e "s/|NETMASK|/$netmask/g" \ + -e "s#|IPV6ADDR|#$ip6addr#g" \ + -e "s/|ENABLE_IPV6|/$enable_ipv6/g" \ + /etc/ocserv/ocserv.conf.template > /var/etc/ocserv.conf + + test -f /etc/ocserv/ocserv.conf.local && cat /etc/ocserv/ocserv.conf.local >> /var/etc/ocserv.conf +} + +setup_users() { + local name + local group + local password + + config_get name $1 name + config_get group $1 group '*' + config_get password $1 password + + [ -z "$name" -o -z "$password" ] && return + + echo "$name:$group:$password" >> /var/etc/ocpasswd +} + +setup_routes() { + local routes + + config_get ip $1 ip + config_get netmask $1 netmask + + [ -z "$ip" -o -z "$netmask" ] && return + + echo "route = $ip/$netmask" >> /var/etc/ocserv.conf +} + +setup_dns() { + local routes + + config_get ip $1 ip + + [ -z "$ip" ] && return + + echo "dns = $ip" >> /var/etc/ocserv.conf +} + +start_service() { + local hostname iface + + hostname=`uci show ddns 2>/dev/null|grep domain|head -1|cut -d '=' -f 2` + [ -z "$hostname" ] && hostname=`uci get system.@system[0].hostname 2>/dev/null` + + [ -f /etc/config/ocserv-dir/ca-key.pem ] && mv /etc/config/ocserv-dir/ca-key.pem /etc/ocserv/ca-key.pem + [ -f /etc/config/ocserv-dir/ca.pem ] && mv /etc/config/ocserv-dir/ca.pem /etc/ocserv/ca.pem + [ -f /etc/config/ocserv-dir/server-key.pem ] && mv /etc/config/ocserv-dir/server-key.pem /etc/ocserv/server-key.pem + [ -f /etc/config/ocserv-dir/server-cert.pem ] && mv /etc/config/ocserv-dir/server-cert.pem /etc/ocserv/server-cert.pem + [ -d /etc/config/ocserv-dir ] && rmdir /etc/config/ocserv-dir + + [ ! -f /etc/ocserv/ca-key.pem ] && [ -x /usr/bin/certtool ] && { + logger -t ocserv "Generating CA certificate..." + mkdir -p /etc/ocserv/pki/ + certtool --bits 2048 --generate-privkey --outfile /etc/ocserv/ca-key.pem >/dev/null 2>&1 + echo "cn=$hostname CA" >/etc/ocserv/pki/ca.tmpl + echo "expiration_days=-1" >>/etc/ocserv/pki/ca.tmpl + echo "serial=1" >>/etc/ocserv/pki/ca.tmpl + echo "ca" >>/etc/ocserv/pki/ca.tmpl + echo "cert_signing_key" >>/etc/ocserv/pki/ca.tmpl + + certtool --template /etc/ocserv/pki/ca.tmpl \ + --generate-self-signed --load-privkey /etc/ocserv/ca-key.pem \ + --outfile /etc/ocserv/ca.pem >/dev/null 2>&1 + } + + #generate server certificate/key + [ ! -f /etc/ocserv/server-key.pem ] && [ -x /usr/bin/certtool ] && { + logger -t ocserv "Generating server certificate..." + mkdir -p /etc/ocserv/pki/ + certtool --bits 2048 --generate-privkey --outfile /etc/ocserv/server-key.pem >/dev/null 2>&1 + echo "cn=$hostname" >/etc/ocserv/pki/server.tmpl + echo "serial=2" >>/etc/ocserv/pki/server.tmpl + echo "expiration_days=-1" >>/etc/ocserv/pki/server.tmpl + echo "signing_key" >>/etc/ocserv/pki/server.tmpl + echo "encryption_key" >>/etc/ocserv/pki/server.tmpl + certtool --template /etc/ocserv/pki/server.tmpl \ + --generate-certificate --load-privkey /etc/ocserv/server-key.pem \ + --load-ca-certificate /etc/ocserv/ca.pem --load-ca-privkey \ + /etc/ocserv/ca-key.pem --outfile /etc/ocserv/server-cert.pem >/dev/null 2>&1 + } + + [ -f /var/run/ocserv.pid ] || { + touch /var/run/ocserv.pid + chown ocserv:ocserv /var/run/ocserv.pid + } + [ -d /var/lib/ocserv ] || { + mkdir -m 0755 -p /var/lib/ocserv + chmod 0700 /var/lib/ocserv + chown ocserv:ocserv /var/lib/ocserv + } + + config_load "ocserv" + + rm -f /var/etc/ocserv.conf + touch /var/etc/ocserv.conf + setup_config config + config_foreach setup_routes routes + config_foreach setup_dns dns + + rm -f /var/etc/ocpasswd + touch /var/etc/ocpasswd + chmod 600 /var/etc/ocpasswd + config_foreach setup_users ocservusers + + procd_open_instance + procd_set_param command /usr/sbin/ocserv -f -c /var/etc/ocserv.conf + procd_set_param respawn + procd_close_instance +} + diff --git a/net/ocserv/files/ocserv.upgrade b/net/ocserv/files/ocserv.upgrade new file mode 100644 index 0000000..fdffcb2 --- /dev/null +++ b/net/ocserv/files/ocserv.upgrade @@ -0,0 +1,8 @@ +/etc/ocserv/ca-key.pem +/etc/ocserv/ca.pem +/etc/ocserv/server-key.pem +/etc/ocserv/server-cert.pem +/etc/ocserv/ocserv.conf.local +/etc/ocserv/config-per-user/* +/etc/ocserv/config-per-group/* +/etc/ocserv/crl.pem diff --git a/net/ocserv/patches/001-makefile-fix.patch b/net/ocserv/patches/001-makefile-fix.patch new file mode 100644 index 0000000..0d48282 --- /dev/null +++ b/net/ocserv/patches/001-makefile-fix.patch @@ -0,0 +1,47 @@ +diff --git a/src/Makefile.am b/src/Makefile.am +index 5943a50..4b2c77c 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -23,18 +23,7 @@ noinst_LIBRARIES = libcmd-ocserv.a libipc.a + libcmd_ocserv_a_SOURCES = ocserv-args.def ocserv-args.c ocserv-args.h + + ocserv-args.c: $(srcdir)/ocserv-args.def $(builddir)/version.inc +- if test "$(AUTOGEN)" = ":";then \ +- rm -f $(builddir)/ocserv-args.c; \ +- rm -f $(builddir)/ocserv-args.h; \ +- cp $(srcdir)/autogen/ocserv-args.c $(builddir)/; \ +- cp $(srcdir)/autogen/ocserv-args.h $(builddir)/; \ +- else \ +- $(AUTOGEN) $<; \ +- if test -d $(srcdir)/autogen;then \ +- cp $(builddir)/ocserv-args.c $(srcdir)/autogen; \ +- cp $(builddir)/ocserv-args.h $(srcdir)/autogen; \ +- fi; \ +- fi ++ $(AUTOGEN) $< + ocserv-args.h: ocserv-args.c + + # Authentication module sources +diff --git a/src/ocpasswd/Makefile.am b/src/ocpasswd/Makefile.am +index 97e2491..6304607 100644 +--- a/src/ocpasswd/Makefile.am ++++ b/src/ocpasswd/Makefile.am +@@ -21,17 +21,6 @@ ocpasswd_LDADD += $(LIBGNUTLS_LIBS) $(LIBCRYPT) $(CODE_COVERAGE_LDFLAGS) \ + $(LIBNETTLE_LIBS) + + args.c: $(srcdir)/args.def $(builddir)/../version.inc +- if test "$(AUTOGEN)" = ":";then \ +- rm -f $(builddir)/args.c; \ +- rm -f $(builddir)/args.h; \ +- cp $(srcdir)/../autogen/ocpasswd-args.c $(builddir)/args.c; \ +- cp $(srcdir)/../autogen/ocpasswd-args.h $(builddir)/args.h; \ +- else \ +- $(AUTOGEN) $<; \ +- if test -d $(srcdir)/autogen;then \ +- cp $(builddir)/args.c $(srcdir)/../autogen/ocpasswd-args.c; \ +- cp $(builddir)/args.h $(srcdir)/../autogen/ocpasswd-args.h; \ +- fi; \ +- fi ++ $(AUTOGEN) $< + args.h: args.c + diff --git a/net/opennhrp/Makefile b/net/opennhrp/Makefile new file mode 100644 index 0000000..4c2b9e8 --- /dev/null +++ b/net/opennhrp/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2009-2015 OpenWrt.org +# Copyright (C) 2009 Jakob Pfeiffer +# Copyright (C) 2014 Artem Makhutov +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=opennhrp +PKG_VERSION:=0.14.1 +PKG_RELEASE:=2 +PKG_MAINTAINER:=Artem Makhutov +PKG_LICENSE:=MIT License + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=@SF/opennhrp +PKG_MD5SUM:=eb42ddb13e07ceb415b9ebb8eaca28ee + +PKG_FIXUP:=autoreconf +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/opennhrp + SECTION:=net + CATEGORY:=Network + SUBMENU:=VPN + DEPENDS:=+libcares +ipsec-tools +ip +kmod-gre + KCONFIG:=CONFIG_ARPD=y + TITLE:=NBMA Next Hop Resolution Protocol + URL:=http://opennhrp.sourceforge.net/ +endef + +define Package/opennhrp/description + OpenNHRP implements NBMA Next Hop Resolution Protocol (as defined in RFC 2332). + It makes it possible to create dynamic multipoint VPN Linux router using NHRP, + GRE and IPsec. It aims to be Cisco DMVPN compatible. +endef + +define Package/opennhrp/conffiles +/etc/opennhrp/opennhrp.conf +endef + +define Package/opennhrp/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/opennhrp{,ctl} $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/opennhrp + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/opennhrp/opennhrp.conf $(1)/etc/opennhrp/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/opennhrp/opennhrp-script $(1)/etc/opennhrp/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/opennhrp/racoon-ph1down.sh $(1)/etc/opennhrp/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/opennhrp/racoon-ph1dead.sh $(1)/etc/opennhrp/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/opennhrp.init $(1)/etc/init.d/opennhrp +endef + +$(eval $(call BuildPackage,opennhrp)) diff --git a/net/opennhrp/files/opennhrp.init b/net/opennhrp/files/opennhrp.init new file mode 100644 index 0000000..8831287 --- /dev/null +++ b/net/opennhrp/files/opennhrp.init @@ -0,0 +1,15 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2009-2011 OpenWrt.org +# Copyright (C) 2009 Jakob Pfeiffer + +START=50 + +SERVICE_USE_PID=1 + +start() { + service_start /usr/sbin/opennhrp -d +} + +stop() { + service_stop /usr/sbin/opennhrp +} diff --git a/net/opennhrp/patches/100-musl-compat.patch b/net/opennhrp/patches/100-musl-compat.patch new file mode 100644 index 0000000..8be0f71 --- /dev/null +++ b/net/opennhrp/patches/100-musl-compat.patch @@ -0,0 +1,20 @@ +--- a/nhrp/opennhrp.c ++++ b/nhrp/opennhrp.c +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + #include + #include + #include +--- a/nhrp/nhrp_common.h ++++ b/nhrp/nhrp_common.h +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + #include + + struct nhrp_interface; diff --git a/net/openssh/Makefile b/net/openssh/Makefile new file mode 100644 index 0000000..73e7e67 --- /dev/null +++ b/net/openssh/Makefile @@ -0,0 +1,291 @@ +# +# 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:=openssh +PKG_VERSION:=7.3p1 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/ \ + http://ftp.belnet.be/pub/OpenBSD/OpenSSH/portable/ +PKG_MD5SUM:=dfadd9f035d38ce5d58a3bf130b86d08 + +PKG_LICENSE:=BSD ISC +PKG_LICENSE_FILES:=LICENCE + + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +PKG_BUILD_DEPENDS:=libopenssl + +include $(INCLUDE_DIR)/package.mk + +define Package/openssh/Default + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libopenssl +zlib + TITLE:=OpenSSH + MAINTAINER:=Peter Wagner + URL:=http://www.openssh.com/ + SUBMENU:=SSH + VARIANT:=without-pam +endef + +define Package/openssh-moduli + $(call Package/openssh/Default) + DEPENDS+= +openssh-keygen + TITLE+= moduli file +endef + +define Package/openssh-moduli/description +OpenSSH server moduli file. +endef + +define Package/openssh-client + $(call Package/openssh/Default) + TITLE+= client +endef + +define Package/openssh-client/description +OpenSSH client. +endef + +define Package/openssh-client/conffiles +/etc/ssh/ssh_config +endef + +define Package/openssh-client-utils + $(call Package/openssh/Default) + DEPENDS+= +openssh-client +openssh-keygen + TITLE+= client utilities +endef + +define Package/openssh-client-utils/description +OpenSSH client utilities. +endef + +define Package/openssh-keygen + $(call Package/openssh/Default) + TITLE+= keygen +endef + +define Package/openssh-keygen/description +OpenSSH keygen. +endef + +define Package/openssh-server + $(call Package/openssh/Default) + DEPENDS+= +openssh-keygen + TITLE+= server + USERID:=sshd=22:sshd=22 +endef + +define Package/openssh-server/description +OpenSSH server. +endef + +define Package/openssh-server/conffiles +/etc/ssh/sshd_config +endef + +define Package/openssh-server-pam + $(call Package/openssh/Default) + DEPENDS+= +libpthread +openssh-keygen +libpam + TITLE+= server (with PAM support) + VARIANT:=with-pam + USERID:=sshd=22:sshd=22 +endef + +define Package/openssh-server-pam/description +OpenSSH server (with PAM support). +endef + +define Package/openssh-server-pam/conffiles +/etc/pam.d/sshd +/etc/security/access-sshd-local.conf +/etc/ssh/sshd_config +endef + +define Package/openssh-sftp-client + $(call Package/openssh/Default) + TITLE+= SFTP client +endef + +define Package/openssh-sftp-client/description +OpenSSH SFTP client. +endef + +define Package/openssh-sftp-server + $(call Package/openssh/Default) + TITLE+= SFTP server + # Strip dependencies to avoid pulling in OpenSSL etc. + DEPENDS:= +endef + +define Package/openssh-sftp-server/description +OpenSSH SFTP server. +endef + +define Package/openssh-sftp-avahi-service + $(call Package/openssh/Default) + TITLE+= (SFTP Avahi service) + DEPENDS:=+openssh-sftp-server +avahi-daemon +endef + +define Package/openssh-sftp-avahi-service/description + This package contains the service definition for announcing + SFTP support via mDNS/DNS-SD. +endef + +define Package/openssh-sftp-avahi-service/conffiles +/etc/avahi/services/sftp-ssh.service +endef + +CONFIGURE_ARGS+= \ + $(DISABLE_NLS) \ + --sysconfdir=/etc/ssh \ + --with-privsep-user=sshd \ + --with-privsep-path=/var/empty \ + --enable-shared \ + --disable-static \ + --disable-debug \ + --disable-strip \ + --disable-etc-default-login \ + --disable-lastlog \ + --disable-utmp \ + --disable-utmpx \ + --disable-wtmp \ + --disable-wtmpx \ + --without-bsd-auth \ + --without-kerberos5 \ + --without-x + +ifeq ($(BUILD_VARIANT),with-pam) +CONFIGURE_ARGS += \ + --with-pam +else +CONFIGURE_ARGS += \ + --without-pam +endif + +ifeq ($(CONFIG_OPENSSL_ENGINE),y) +CONFIGURE_ARGS+= \ + --with-ssl-engine +endif + +ifneq ($(CONFIG_SSP_SUPPORT),y) +CONFIGURE_ARGS += \ + --without-stackprotect +endif + +CONFIGURE_VARS += LD="$(TARGET_CC)" + +ifeq ($(BUILD_VARIANT),with-pam) +TARGET_LDFLAGS += -lpthread +endif + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + LIBS="" \ + sftp-server + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + STRIP_OPT="" \ + all install +endef + +define Package/openssh-client/preinst +#!/bin/sh +if [ -L $${IPKG_INSTROOT}/usr/bin/ssh ] && [ -L $${IPKG_INSTROOT}/usr/bin/scp ]; then + rm -f $${IPKG_INSTROOT}/usr/bin/ssh $${IPKG_INSTROOT}/usr/bin/scp; +fi +exit 0 +endef + +define Package/openssh-client/postrm +#!/bin/sh +rm -f $${IPKG_INSTROOT}/usr/bin/ssh $${IPKG_INSTROOT}/usr/bin/scp; +if [ -x $${IPKG_INSTROOT}/usr/sbin/dropbear ] ; then + ln -s /usr/sbin/dropbear $${IPKG_INSTROOT}/usr/bin/ssh; + ln -s /usr/sbin/dropbear $${IPKG_INSTROOT}/usr/bin/scp; +fi +exit 0 +endef + +define Package/openssh-moduli/install + $(INSTALL_DIR) $(1)/etc/ssh + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/moduli $(1)/etc/ssh/ +endef + +define Package/openssh-client/install + $(INSTALL_DIR) $(1)/etc/ssh + chmod 0700 $(1)/etc/ssh + $(CP) $(PKG_INSTALL_DIR)/etc/ssh/ssh_config $(1)/etc/ssh/ + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scp $(1)/usr/bin/ +endef + +define Package/openssh-client-utils/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(foreach bin,add agent keyscan keysign,$(PKG_BUILD_DIR)/ssh-$(bin)) $(1)/usr/bin/ +endef + +define Package/openssh-keygen/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(1)/usr/bin/ +endef + +define Package/openssh-server/install + $(INSTALL_DIR) $(1)/etc/ssh + chmod 0700 $(1)/etc/ssh + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/ +endef + +define Package/openssh-server-pam/install + $(call Package/openssh-server/install,$(1)) + sed -i 's,#PasswordAuthentication yes,PasswordAuthentication no,g' $(1)/etc/ssh/sshd_config + sed -i 's,#UsePAM no,UsePAM yes,g' $(1)/etc/ssh/sshd_config + $(INSTALL_DIR) $(1)/etc/pam.d + $(INSTALL_DATA) ./files/sshd.pam $(1)/etc/pam.d/sshd + $(INSTALL_DIR) $(1)/etc/security + $(INSTALL_DATA) ./files/sshd.pam-access $(1)/etc/security/access-sshd-local.conf +endef + +define Package/openssh-sftp-client/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/ +endef + +define Package/openssh-sftp-server/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/libexec + ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server +endef + +define Package/openssh-sftp-avahi-service/install + $(INSTALL_DIR) $(1)/etc/avahi/services + $(INSTALL_DATA) ./files/sftp-ssh.service $(1)/etc/avahi/services/ +endef + +$(eval $(call BuildPackage,openssh-client)) +$(eval $(call BuildPackage,openssh-moduli)) +$(eval $(call BuildPackage,openssh-client-utils)) +$(eval $(call BuildPackage,openssh-keygen)) +$(eval $(call BuildPackage,openssh-server)) +$(eval $(call BuildPackage,openssh-server-pam)) +$(eval $(call BuildPackage,openssh-sftp-client)) +$(eval $(call BuildPackage,openssh-sftp-server)) +$(eval $(call BuildPackage,openssh-sftp-avahi-service)) diff --git a/net/openssh/files/sftp-ssh.service b/net/openssh/files/sftp-ssh.service new file mode 100644 index 0000000..17e0927 --- /dev/null +++ b/net/openssh/files/sftp-ssh.service @@ -0,0 +1,9 @@ + + + + %h + + _sftp-ssh._tcp + 22 + + diff --git a/net/openssh/files/sshd.init b/net/openssh/files/sshd.init new file mode 100644 index 0000000..c4354bb --- /dev/null +++ b/net/openssh/files/sshd.init @@ -0,0 +1,42 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=50 +STOP=50 + +USE_PROCD=1 +PROG=/usr/sbin/sshd + +start_service() { + for type in rsa ecdsa ed25519; do { + # check for keys + key=/etc/ssh/ssh_host_${type}_key + [ ! -f $key ] && { + # generate missing keys + [ -x /usr/bin/ssh-keygen ] && { + /usr/bin/ssh-keygen -N '' -t $type -f $key 2>&- >&- + } + } + }; done + mkdir -m 0700 -p /var/empty + + procd_open_instance + procd_set_param command $PROG -D + procd_close_instance +} + +shutdown() { + local pid + local pids + local pid_mine + + stop + + # kill active clients + pid_mine="$$" + pids="$(pidof sshd)" + for pid in $pids; do + [ "$pid" = "$pid_mine" ] && continue + [ -e "/proc/$pid/stat" ] && kill $pid + done +} diff --git a/net/openssh/files/sshd.pam b/net/openssh/files/sshd.pam new file mode 100644 index 0000000..387ff2e --- /dev/null +++ b/net/openssh/files/sshd.pam @@ -0,0 +1,41 @@ +# PAM configuration for the Secure Shell service + +# Read environment variables from /etc/environment and +# /etc/security/pam_env.conf. +auth required pam_env.so + +# Skip Google Authenticator if logging in from the local network. +# auth [success=1 default=ignore] pam_access.so accessfile=/etc/security/access-sshd-local.conf +# Google Authenticator 2-step verification. +# auth requisite pam_google_authenticator.so + +# Standard Un*x authentication. +auth include common-auth + +# Disallow non-root logins when /etc/nologin exists. +account required pam_nologin.so + +# Uncomment and edit /etc/security/access.conf if you need to set complex +# access limits that are hard to express in sshd_config. +# account required pam_access.so + +# Standard Un*x authorization. +account include common-account + +# Standard Un*x session setup and teardown. +session include common-session + +# Print the message of the day upon successful login. +session optional pam_motd.so + +# Print the status of the user's mailbox upon successful login. +session optional pam_mail.so standard noenv + +# Set up user limits from /etc/security/limits.conf. +session required pam_limits.so + +# Set up SELinux capabilities (need modified pam) +# session required pam_selinux.so multiple + +# Standard Un*x password updating. +password include common-password diff --git a/net/openssh/files/sshd.pam-access b/net/openssh/files/sshd.pam-access new file mode 100644 index 0000000..425ff11 --- /dev/null +++ b/net/openssh/files/sshd.pam-access @@ -0,0 +1,4 @@ +# Skip Google Authenticator for local network +#+ : ALL : 192.168.1.0/24 ++ : ALL : LOCAL +- : ALL : ALL diff --git a/net/openssh/patches/100-openssh-7.3_p1-NEWKEYS_null_deref.patch b/net/openssh/patches/100-openssh-7.3_p1-NEWKEYS_null_deref.patch new file mode 100644 index 0000000..27e99b2 --- /dev/null +++ b/net/openssh/patches/100-openssh-7.3_p1-NEWKEYS_null_deref.patch @@ -0,0 +1,27 @@ +Backport of +https://anongit.mindrot.org/openssh.git/patch/?id=28652bca29046f62c7045e933e6b931de1d16737 + +--- openssh-7.3p1/kex.c ++++ openssh-7.3p1/kex.c +@@ -419,6 +419,8 @@ + ssh_dispatch_set(ssh, SSH2_MSG_NEWKEYS, &kex_protocol_error); + if ((r = sshpkt_get_end(ssh)) != 0) + return r; ++ if ((r = ssh_set_newkeys(ssh, MODE_IN)) != 0) ++ return r; + kex->done = 1; + sshbuf_reset(kex->peer); + /* sshbuf_reset(kex->my); */ +--- openssh-7.3p1/packet.c ++++ openssh-7.3p1/packet.c +@@ -1919,9 +1919,7 @@ + return r; + return SSH_ERR_PROTOCOL_ERROR; + } +- if (*typep == SSH2_MSG_NEWKEYS) +- r = ssh_set_newkeys(ssh, MODE_IN); +- else if (*typep == SSH2_MSG_USERAUTH_SUCCESS && !state->server_side) ++ if (*typep == SSH2_MSG_USERAUTH_SUCCESS && !state->server_side) + r = ssh_packet_enable_delayed_compress(ssh); + else + r = 0; diff --git a/net/openssh/patches/101-Unregister-the-KEXINIT-handler-after-receive.patch b/net/openssh/patches/101-Unregister-the-KEXINIT-handler-after-receive.patch new file mode 100644 index 0000000..f7b41dc --- /dev/null +++ b/net/openssh/patches/101-Unregister-the-KEXINIT-handler-after-receive.patch @@ -0,0 +1,18 @@ +diff --git a/kex.c b/kex.c +index 50c7a0f..d09c27b 100644 +--- a/kex.c ++++ b/kex.c +@@ -1,4 +1,4 @@ +-/* $OpenBSD: kex.c,v 1.118 2016/05/02 10:26:04 djm Exp $ */ ++/* $OpenBSD: kex.c,v 1.127 2016/10/10 19:28:48 markus Exp $ */ + /* + * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. + * +@@ -472,6 +472,7 @@ kex_input_kexinit(int type, u_int32_t seq, void *ctxt) + if (kex == NULL) + return SSH_ERR_INVALID_ARGUMENT; + ++ ssh_dispatch_set(ssh, SSH2_MSG_KEXINIT, NULL); + ptr = sshpkt_ptr(ssh, &dlen); + if ((r = sshbuf_put(kex->peer, ptr, dlen)) != 0) + return r; diff --git a/net/openssh/patches/130-implicit_memset_decl_fix.patch b/net/openssh/patches/130-implicit_memset_decl_fix.patch new file mode 100644 index 0000000..7d46d20 --- /dev/null +++ b/net/openssh/patches/130-implicit_memset_decl_fix.patch @@ -0,0 +1,12 @@ +--- a/includes.h ++++ b/includes.h +@@ -60,6 +60,9 @@ + /* + *-*-nto-qnx needs these headers for strcasecmp and LASTLOG_FILE respectively + */ ++#ifdef HAVE_STRING_H ++# include ++#endif + #ifdef HAVE_STRINGS_H + # include + #endif diff --git a/net/openssh/patches/140-pam_uclibc_pthreads_fix.patch b/net/openssh/patches/140-pam_uclibc_pthreads_fix.patch new file mode 100644 index 0000000..1319b52 --- /dev/null +++ b/net/openssh/patches/140-pam_uclibc_pthreads_fix.patch @@ -0,0 +1,84 @@ +--- a/auth-pam.c ++++ b/auth-pam.c +@@ -159,7 +159,7 @@ sshpam_sigchld_handler(int sig) + } + if (WIFSIGNALED(sshpam_thread_status) && + WTERMSIG(sshpam_thread_status) == SIGTERM) +- return; /* terminated by pthread_cancel */ ++ return; /* terminated by pthread2_cancel */ + if (!WIFEXITED(sshpam_thread_status)) + sigdie("PAM: authentication thread exited unexpectedly"); + if (WEXITSTATUS(sshpam_thread_status) != 0) +@@ -168,14 +168,14 @@ sshpam_sigchld_handler(int sig) + + /* ARGSUSED */ + static void +-pthread_exit(void *value) ++pthread2_exit(void *value) + { + _exit(0); + } + + /* ARGSUSED */ + static int +-pthread_create(sp_pthread_t *thread, const void *attr, ++pthread2_create(sp_pthread_t *thread, const void *attr, + void *(*thread_start)(void *), void *arg) + { + pid_t pid; +@@ -201,7 +201,7 @@ pthread_create(sp_pthread_t *thread, con + } + + static int +-pthread_cancel(sp_pthread_t thread) ++pthread2_cancel(sp_pthread_t thread) + { + signal(SIGCHLD, sshpam_oldsig); + return (kill(thread, SIGTERM)); +@@ -209,7 +209,7 @@ pthread_cancel(sp_pthread_t thread) + + /* ARGSUSED */ + static int +-pthread_join(sp_pthread_t thread, void **value) ++pthread2_join(sp_pthread_t thread, void **value) + { + int status; + +@@ -510,7 +510,7 @@ sshpam_thread(void *ctxtp) + /* XXX - can't do much about an error here */ + ssh_msg_send(ctxt->pam_csock, sshpam_err, &buffer); + buffer_free(&buffer); +- pthread_exit(NULL); ++ pthread2_exit(NULL); + + auth_fail: + buffer_put_cstring(&buffer, +@@ -521,7 +521,7 @@ sshpam_thread(void *ctxtp) + else + ssh_msg_send(ctxt->pam_csock, PAM_AUTH_ERR, &buffer); + buffer_free(&buffer); +- pthread_exit(NULL); ++ pthread2_exit(NULL); + + return (NULL); /* Avoid warning for non-pthread case */ + } +@@ -533,8 +533,8 @@ sshpam_thread_cleanup(void) + + debug3("PAM: %s entering", __func__); + if (ctxt != NULL && ctxt->pam_thread != 0) { +- pthread_cancel(ctxt->pam_thread); +- pthread_join(ctxt->pam_thread, NULL); ++ pthread2_cancel(ctxt->pam_thread); ++ pthread2_join(ctxt->pam_thread, NULL); + close(ctxt->pam_psock); + close(ctxt->pam_csock); + memset(ctxt, 0, sizeof(*ctxt)); +@@ -698,7 +698,7 @@ sshpam_init_ctx(Authctxt *authctxt) + } + ctxt->pam_psock = socks[0]; + ctxt->pam_csock = socks[1]; +- if (pthread_create(&ctxt->pam_thread, NULL, sshpam_thread, ctxt) == -1) { ++ if (pthread2_create(&ctxt->pam_thread, NULL, sshpam_thread, ctxt) == -1) { + error("PAM: failed to start authentication thread: %s", + strerror(errno)); + close(socks[0]); diff --git a/net/openssh/patches/200-dscp-qos.patch b/net/openssh/patches/200-dscp-qos.patch new file mode 100644 index 0000000..827a668 --- /dev/null +++ b/net/openssh/patches/200-dscp-qos.patch @@ -0,0 +1,21 @@ +--- a/ssh_config ++++ b/ssh_config +@@ -46,3 +46,6 @@ + # VisualHostKey no + # ProxyCommand ssh -q -W %h:%p gateway.example.com + # RekeyLimit 1G 1h ++ ++# enable DSCP QoS values (per RFC-4594) ++#IPQoS AF21 AF11 +--- a/sshd_config ++++ b/sshd_config +@@ -122,6 +122,9 @@ UsePrivilegeSeparation sandbox # Defaul + # no default banner path + #Banner none + ++# enable DSCP QoS values (per RFC-4594) ++#IPQoS AF21 AF11 ++ + # override default of no subsystems + Subsystem sftp /usr/libexec/sftp-server + diff --git a/net/opentracker/Makefile b/net/opentracker/Makefile new file mode 100644 index 0000000..e476332 --- /dev/null +++ b/net/opentracker/Makefile @@ -0,0 +1,106 @@ +# +# 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:=opentracker +PKG_VERSION:=20151211 +PKG_RELEASE:=2 +PKG_REV:=ba25d2b2a84a31eac2956b71cb12b4b0748b35f5 +PKG_MAINTAINER:=Daniel Golle +PKG_LICENSE:=Beerware + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=git://erdgeist.org/opentracker +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=$(PKG_REV) +PKG_SOURCE_PROTO:=git +PKG_BUILD_DEPENDS:=libowfat +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/opentracker/Default + SUBMENU:=BitTorrent + SECTION:=net + CATEGORY:=Network + TITLE:=opentracker + URL:=http://erdgeist.org/arts/software/opentracker/ + DEPENDS:=+zlib +libpthread +endef + +define Package/opentracker +$(call Package/opentracker/Default) + VARIANT:=ipv4 +endef + +define Package/opentracker6 +$(call Package/opentracker/Default) + TITLE+= (IPv6 build) + VARIANT:=ipv6 +endef + + +define Package/opentracker-default/description + opentracker - An open and free bittorrent tracker + + opentracker is an open and free bittorrent tracker project. + It aims for minimal resource usage and is intended to run at your wlan router. + Currently it is deployed as an open and free tracker instance. + Read our free and open tracker blog and announce your torrents there + (but do not hesitate to setup your own free trackers!). +endef + +define Package/opentracker/description + $(call Package/opentracker-default/description) + + This package contains the IPv4-build of opentracker. + +endef + +define Package/opentracker6/description + $(call Package/opentracker-default/description) + + This package contains the IPv6-build of opentracker. + +endef + + +MAKE_FLAGS += PREFIX="$(STAGING_DIR)/usr" + +ifeq ($(BUILD_VARIANT),ipv6) + MAKE_FLAGS += FEATURES="-DWANT_V6" +endif + +define Package/opentracker/conffiles +/etc/opentracker.conf +endef + +define Package/opentracker6/conffiles +/etc/opentracker6.conf +endef + +define Package/opentracker/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/opentracker $(1)/usr/bin + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_BUILD_DIR)/opentracker.conf.sample $(1)/etc/opentracker.conf + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/opentracker.init $(1)/etc/init.d/opentracker +endef + +define Package/opentracker6/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/opentracker $(1)/usr/bin/opentracker6 + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_BUILD_DIR)/opentracker.conf.sample $(1)/etc/opentracker6.conf + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/opentracker6.init $(1)/etc/init.d/opentracker6 +endef + +$(eval $(call BuildPackage,opentracker)) +$(eval $(call BuildPackage,opentracker6)) diff --git a/net/opentracker/files/opentracker.init b/net/opentracker/files/opentracker.init new file mode 100755 index 0000000..91fb386 --- /dev/null +++ b/net/opentracker/files/opentracker.init @@ -0,0 +1,16 @@ +#!/bin/sh /etc/rc.common + +START=10 +STOP=15 + +NAME="opentracker" +PROG="/usr/bin/opentracker" +OPTIONS="-f /etc/opentracker.conf" +USE_PROCD=1 + +start_service() +{ + procd_open_instance + procd_set_param command $PROG $OPTIONS + procd_close_instance +} diff --git a/net/opentracker/files/opentracker6.init b/net/opentracker/files/opentracker6.init new file mode 100755 index 0000000..02417f3 --- /dev/null +++ b/net/opentracker/files/opentracker6.init @@ -0,0 +1,16 @@ +#!/bin/sh /etc/rc.common + +START=10 +STOP=15 + +NAME="opentracker6" +PROG="/usr/bin/opentracker6" +OPTIONS="-f /etc/opentracker6.conf" +USE_PROCD=1 + +start_service() +{ + procd_open_instance + procd_set_param command $PROG $OPTIONS + procd_close_instance +} diff --git a/net/opentracker/patches/100-makefile.patch b/net/opentracker/patches/100-makefile.patch new file mode 100644 index 0000000..bbaf8d9 --- /dev/null +++ b/net/opentracker/patches/100-makefile.patch @@ -0,0 +1,30 @@ +--- a/Makefile ++++ b/Makefile +@@ -9,13 +9,13 @@ CC?=gcc + + # BSD flavour + # PREFIX?=/usr/local +-# LIBOWFAT_HEADERS=$(PREFIX)/include/libowfat +-# LIBOWFAT_LIBRARY=$(PREFIX)/lib ++LIBOWFAT_HEADERS=$(PREFIX)/include/libowfat ++LIBOWFAT_LIBRARY=$(PREFIX)/lib + + # Debug flavour +-PREFIX?=.. +-LIBOWFAT_HEADERS=$(PREFIX)/libowfat +-LIBOWFAT_LIBRARY=$(PREFIX)/libowfat ++# PREFIX?=.. ++# LIBOWFAT_HEADERS=$(PREFIX)/libowfat ++# LIBOWFAT_LIBRARY=$(PREFIX)/libowfat + + BINDIR?=$(PREFIX)/bin + +@@ -66,7 +66,7 @@ CFLAGS_debug = $(CFLAGS) $(OPTS_debug) $ + + $(BINARY): $(OBJECTS) $(HEADERS) + $(CC) -o $@ $(OBJECTS) $(LDFLAGS) +- strip $@ ++ $(STRIP) $@ + $(BINARY).debug: $(OBJECTS_debug) $(HEADERS) + $(CC) -o $@ $(OBJECTS_debug) $(LDFLAGS) + proxy: $(OBJECTS_proxy) $(HEADERS) diff --git a/net/openvswitch/Makefile b/net/openvswitch/Makefile new file mode 100644 index 0000000..cb7170f --- /dev/null +++ b/net/openvswitch/Makefile @@ -0,0 +1,214 @@ +# +# Copyright (C) 2013 Julius Schulz-Zander +# Copyright (C) 2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id: Makefile $ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=openvswitch + +PKG_RELEASE:=7 +PKG_VERSION:=2.5.0 +PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_LICENSE:=Apache-2.0 +PKG_LICENSE_FILES:=COPYING +PKG_USE_MIPS16:=0 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/openvswitch/ovs +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=22d4614ddf83988a3771fb379ea029e663b4455a +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_BUILD_PARALLEL:=1 +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +# Upstream package supports kernels between 2.6.32 and 4.3 +# see https://github.com/openvswitch/ovs/blob/master/FAQ.md +# This list is pruned to only those kernels used in OpenWRT +# Support for kernel 4.4 is backported +SUPPORTED_KERNELS:=LINUX_3_18||LINUX_4_1||LINUX_4_3||LINUX_4_4 + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/openvswitch/Default + SECTION:=net + SUBMENU:=Open vSwitch + CATEGORY:=Network + URL:=http://openvswitch.org/ + MAINTAINER:=Alexandru Ardelean +endef + +define Package/openvswitch/Default/description + Open vSwitch is a production quality, multilayer, software-based, Ethernet + virtual switch. It is designed to enable massive network automation through + programmatic extension, while still supporting standard management interfaces + and protocols (e.g. NetFlow, sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag). In + addition, it is designed to support distribution across multiple physical + servers similar to VMware's vNetwork distributed vswitch or Cisco's Nexus + 1000V. +endef + +define Package/openvswitch-base + $(call Package/openvswitch/Default) + TITLE:=Open vSwitch Userspace Package (base) + DEPENDS:=+libpcap +libopenssl +librt +kmod-openvswitch @($(SUPPORTED_KERNELS)) +endef + +define Package/openvswitch-base/description + Provides the main userspace components required for Open vSwitch to function. + The main OVS tools (ovs-vsctl, ovs-ofctl, etc) are packaged separately + to conserve some room and allow more configurability. +endef + +define Package/openvswitch-python + $(call Package/openvswitch/Default) + TITLE:=Open vSwitch Python Support + DEPENDS:=+openvswitch +python +endef + +define Package/openvswitch-python/description + Provides bindings and libraries for using Python to manipulate/work with Open vSwitch. +endef + +define Package/openvswitch-ipsec + $(call Package/openvswitch/Default) + TITLE:=Open vSwitch GRE through IPsec tool + DEPENDS:=+openvswitch-python +endef + +define Package/openvswitch-ipsec/description + The ovs-monitor-ipsec script provides support for encrypting GRE tunnels with + IPsec. +endef + +define Package/openvswitch-benchmark + $(call Package/openvswitch/Default) + TITLE:=Open vSwitch flow setup benchmark utility + DEPENDS:=+openvswitch +endef + +define Package/openvswitch-benchmark/description + Utility for running OpenVSwitch benchmarking +endef + +OVS_BIN_TOOLS:=ovs-appctl ovs-ofctl ovs-dpctl ovs-vsctl ovsdb-client +define Package/openvswitch + $(call Package/openvswitch/Default) + TITLE:=Open vSwitch Userspace Package + DEPENDS:=+openvswitch-base $(foreach t,$(OVS_BIN_TOOLS),+openvswitch-$(t)) +endef + +define Package/openvswitch/description + Provides the main userspace components required for Open vSwitch to function. + Includes also the main OVS utilities (ovs-appctl, ovs-vsctl, etc). +endef + +define KernelPackage/openvswitch + SECTION:=kernel + CATEGORY:=Kernel modules + SUBMENU:=Network Support + TITLE:=Open vSwitch Kernel Package + KCONFIG:=CONFIG_BRIDGE + DEPENDS:=+kmod-stp @IPV6 +kmod-gre +kmod-lib-crc32c +kmod-vxlan +kmod-nf-conntrack +kmod-nf-conntrack6 @($(SUPPORTED_KERNELS)) + FILES:= \ + $(PKG_BUILD_DIR)/datapath/linux/openvswitch.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,21,openvswitch) +endef + +define KernelPackage/openvswitch/description + This package contains the Open vSwitch kernel moodule and bridge compat + module. Furthermore, it supports OpenFlow. +endef + +CONFIGURE_ARGS += --with-linux=$(LINUX_DIR) --with-rundir=/var/run +CONFIGURE_ARGS += --enable-ndebug +CONFIGURE_ARGS += --disable-ssl +CONFIGURE_ARGS += --enable-shared + +TARGET_CFLAGS += -flto -std=gnu99 + +CONFIGURE_VARS += KARCH=$(LINUX_KARCH) +MAKE_FLAGS += ARCH="$(LINUX_KARCH)" + +define OvsBinUtility + define Package/openvswitch-$(1) + $(call Package/openvswitch/Default) + TITLE:=$(2) + DEPENDS:=+openvswitch-base + endef + + define Package/openvswitch-$(1)/description + $(2) + endef + + define Package/openvswitch-$(1)/install + $(INSTALL_DIR) $$(1)/usr/bin/ ;\ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin/ + endef +endef + +define Package/openvswitch-base/install + $(INSTALL_DIR) $(1)/etc/openvswitch + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/etc/init.d/openvswitch.init $(1)/etc/init.d/openvswitch + + $(INSTALL_DIR) $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libofproto.so* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopenvswitch.so* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libovsdb.so* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsflow.so* $(1)/usr/lib/ + + $(INSTALL_DIR) $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovsdb-tool $(1)/usr/bin/ + + $(INSTALL_DIR) $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovs-vswitchd $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovsdb-server $(1)/usr/sbin/ + + $(INSTALL_DIR) $(1)/usr/share/openvswitch/ + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/vswitch.ovsschema $(1)/usr/share/openvswitch/ +endef + +define Package/openvswitch-python/install + $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/ovs + $(CP) $(PKG_INSTALL_DIR)/usr/share/openvswitch/python/ovs/* $(1)/usr/lib/python$(PYTHON_VERSION)/ovs +endef + +define Package/openvswitch-ipsec/install + $(INSTALL_DIR) $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/debian/ovs-monitor-ipsec $(1)/usr/sbin/ +endef + +define Package/openvswitch-benchmark/install + $(INSTALL_DIR) $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovs-benchmark $(1)/usr/bin/ +endef + +define Package/openvswitch/install + : +endef + +$(eval $(call OvsBinUtility,ovs-appctl,Open vSwitch app control utility)) +$(eval $(call OvsBinUtility,ovs-ofctl,Open vSwitch OpenFlow control utility)) +$(eval $(call OvsBinUtility,ovs-dpctl,Open vSwitch datapath management utility)) +$(eval $(call OvsBinUtility,ovs-vsctl,Open vSwitch ovs-vswitchd management utility)) +$(eval $(call OvsBinUtility,ovsdb-client,Open vSwitch database JSON-RPC client)) + +$(foreach t,$(OVS_BIN_TOOLS),$(eval $(call BuildPackage,openvswitch-$(t)))) + +$(eval $(call BuildPackage,openvswitch-base)) +$(eval $(call BuildPackage,openvswitch-python)) +$(eval $(call BuildPackage,openvswitch-ipsec)) +$(eval $(call BuildPackage,openvswitch-benchmark)) +$(eval $(call BuildPackage,openvswitch)) +$(eval $(call KernelPackage,openvswitch)) + diff --git a/net/openvswitch/files/etc/init.d/openvswitch.init b/net/openvswitch/files/etc/init.d/openvswitch.init new file mode 100644 index 0000000..ffe879a --- /dev/null +++ b/net/openvswitch/files/etc/init.d/openvswitch.init @@ -0,0 +1,41 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2013 Julius Schulz-Zander +# Copyright (C) 2014 OpenWrt.org + +START=15 +USE_PROCD=1 + +start_service() { + [ -x /var/run/openvswitch ] || mkdir -p /var/run/openvswitch + [ -e /etc/openvswitch/conf.db ] || { + /usr/bin/ovsdb-tool create /etc/openvswitch/conf.db /usr/share/openvswitch/vswitch.ovsschema + } + + # ovsdb-server + procd_open_instance + procd_set_param command /usr/sbin/ovsdb-server + procd_append_param command --remote=punix:/var/run/db.sock + procd_append_param command --remote=db:Open_vSwitch,Open_vSwitch,manager_options + procd_append_param command --pidfile=/var/run/ovsdb-server.pid + procd_set_param respawn + procd_append_param respawn 3600 + procd_append_param respawn 5 + procd_append_param respawn -1 + procd_set_param nice + procd_append_param nice -10 + procd_close_instance + + # ovs-vswitchd + procd_open_instance + procd_set_param command /usr/sbin/ovs-vswitchd + procd_append_param command --pidfile=/var/run/ovs-vswitchd.pid + procd_set_param respawn + procd_append_param respawn 3600 + procd_append_param respawn 5 + procd_append_param respawn -1 + procd_set_param nice + procd_append_param nice -10 + procd_close_instance + +} + diff --git a/net/openvswitch/patches/0001-netdev-linux-Use-unsigned-int-for-ifi_flags.patch b/net/openvswitch/patches/0001-netdev-linux-Use-unsigned-int-for-ifi_flags.patch new file mode 100644 index 0000000..ed537d1 --- /dev/null +++ b/net/openvswitch/patches/0001-netdev-linux-Use-unsigned-int-for-ifi_flags.patch @@ -0,0 +1,28 @@ +From 12edcd800d924f69630768eeece842373dee5bb0 Mon Sep 17 00:00:00 2001 +From: Helmut Schaa +Date: Wed, 8 Jan 2014 13:48:33 +0100 +Subject: [PATCH 1/2] netdev-linux: Use unsigned int for ifi_flags + +ifi_flags is unsigned, the local equivalents should do the same. + +Signed-off-by: Helmut Schaa +--- + lib/netdev-linux.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c +index 9bdbbdf..9eaac33 100644 +--- a/lib/netdev-linux.c ++++ b/lib/netdev-linux.c +@@ -2709,7 +2709,7 @@ update_flags(struct netdev_linux *netdev, enum netdev_flags off, + enum netdev_flags on, enum netdev_flags *old_flagsp) + OVS_REQUIRES(netdev->mutex) + { +- int old_flags, new_flags; ++ unsigned int old_flags, new_flags; + int error = 0; + + old_flags = netdev->ifi_flags; +-- +1.8.1.4 + diff --git a/net/openvswitch/patches/0002-netdev-linux-Let-interface-flag-survive-internal-por.patch b/net/openvswitch/patches/0002-netdev-linux-Let-interface-flag-survive-internal-por.patch new file mode 100644 index 0000000..b31816a --- /dev/null +++ b/net/openvswitch/patches/0002-netdev-linux-Let-interface-flag-survive-internal-por.patch @@ -0,0 +1,41 @@ +From b9284f535e93c337ab21f330753e60e1038f9a27 Mon Sep 17 00:00:00 2001 +From: Helmut Schaa +Date: Wed, 8 Jan 2014 13:48:49 +0100 +Subject: [PATCH 2/2] netdev-linux: Let interface flag survive internal port + setup + +Due to a race condition when bringing up an internal port on Linux +some interface flags (e.g. IFF_MULTICAST) are falsely reset. This +happens because netlink events may be processed after the according +netdev has been brought up (which sets interface flags). + +Fix this by reading the interface flags just before updating them +if they have not been updated by from the kernel yet. + +Signed-off-by: Helmut Schaa +--- + lib/netdev-linux.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c +index 9eaac33..423e72e 100644 +--- a/lib/netdev-linux.c ++++ b/lib/netdev-linux.c +@@ -2712,7 +2712,13 @@ update_flags(struct netdev_linux *netdev, enum netdev_flags off, + unsigned int old_flags, new_flags; + int error = 0; + +- old_flags = netdev->ifi_flags; ++ if (!(netdev->cache_valid & VALID_DRVINFO)) { ++ /* Most likely the debvice flags are not in sync yet, fetch them now */ ++ get_flags(&netdev->up, &old_flags); ++ } else { ++ old_flags = netdev->ifi_flags; ++ } ++ + *old_flagsp = iff_to_nd_flags(old_flags); + new_flags = (old_flags & ~nd_to_iff_flags(off)) | nd_to_iff_flags(on); + if (new_flags != old_flags) { +-- +1.8.1.4 + diff --git a/net/openvswitch/patches/0004-musl-compatibility.patch b/net/openvswitch/patches/0004-musl-compatibility.patch new file mode 100644 index 0000000..ddcc5fc --- /dev/null +++ b/net/openvswitch/patches/0004-musl-compatibility.patch @@ -0,0 +1,39 @@ +diff --git a/configure.ac b/configure.ac +index e6a23a6..8a7c6d6 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -118,7 +118,6 @@ OVS_CHECK_XENSERVER_VERSION + OVS_CHECK_GROFF + OVS_CHECK_GNU_MAKE + OVS_CHECK_TLS +-OVS_CHECK_ATOMIC_LIBS + OVS_CHECK_GCC4_ATOMICS + OVS_CHECK_ATOMIC_ALWAYS_LOCK_FREE(1) + OVS_CHECK_ATOMIC_ALWAYS_LOCK_FREE(2) +diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c +index 712cb5a..e840f10 100644 +--- a/lib/netdev-linux.c ++++ b/lib/netdev-linux.c +@@ -40,7 +40,9 @@ + #include + #include + #include ++#if defined(__UCLIBC__) || defined(__GLIBC__) + #include ++#endif + #include + #include + #include +diff --git a/lib/ovs-atomic.h b/lib/ovs-atomic.h +index 9ead907..0a131d7 100644 +--- a/lib/ovs-atomic.h ++++ b/lib/ovs-atomic.h +@@ -318,7 +318,7 @@ + #include "util.h" + + #define IN_OVS_ATOMIC_H +- #if __CHECKER__ ++ #if 1 + /* sparse doesn't understand some GCC extensions we use. */ + #include "ovs-atomic-pthreads.h" + #elif __has_extension(c_atomic) diff --git a/net/openvswitch/patches/0008-add-back-old-gfp-this-node-define.patch b/net/openvswitch/patches/0008-add-back-old-gfp-this-node-define.patch new file mode 100644 index 0000000..ec7d325 --- /dev/null +++ b/net/openvswitch/patches/0008-add-back-old-gfp-this-node-define.patch @@ -0,0 +1,19 @@ +diff --git a/datapath/flow.c b/datapath/flow.c +index a7a2063..8db8041 100644 +--- a/datapath/flow.c ++++ b/datapath/flow.c +@@ -51,6 +51,14 @@ + + #include "vlan.h" + ++#ifndef GFP_THISNODE ++#ifdef CONFIG_NUMA ++#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) ++#else ++#define GFP_THISNODE ((__force gfp_t)0) ++#endif ++#endif ++ + u64 ovs_flow_used_time(unsigned long flow_jiffies) + { + struct timespec cur_ts; diff --git a/net/openvswitch/patches/0009-fix-test-ovn.patch b/net/openvswitch/patches/0009-fix-test-ovn.patch new file mode 100644 index 0000000..10bd37a --- /dev/null +++ b/net/openvswitch/patches/0009-fix-test-ovn.patch @@ -0,0 +1,11 @@ +--- a/tests/test-ovn.c ++++ b/tests/test-ovn.c +@@ -1043,7 +1043,7 @@ wait_pid(pid_t *pids, int *n) + int status; + pid_t pid; + +- pid = waitpid(WAIT_ANY, &status, 0); ++ pid = waitpid(-1, &status, 0); + if (pid < 0) { + ovs_fatal(errno, "waitpid failed"); + } else if (WIFEXITED(status)) { diff --git a/net/openvswitch/patches/0010-lib-ovs-thread-Ensure-that-thread-stacks-are-always-.patch b/net/openvswitch/patches/0010-lib-ovs-thread-Ensure-that-thread-stacks-are-always-.patch new file mode 100644 index 0000000..88f5d26 --- /dev/null +++ b/net/openvswitch/patches/0010-lib-ovs-thread-Ensure-that-thread-stacks-are-always-.patch @@ -0,0 +1,75 @@ +From 8147cec9ee8feea9440cf79365709ddc32ff57d5 Mon Sep 17 00:00:00 2001 +From: Alexandru Ardelean +Date: Thu, 4 Feb 2016 09:20:34 +0200 +Subject: [PATCH] lib/ovs-thread: Ensure that thread stacks are always at least + 512 kB. + +This makes a difference for libc implementations (such as musl libc) that +have a really small default pthread stack size. + +Will reference this discussion: +http://patchwork.ozlabs.org/patch/572340/ + +Reported-by: Robert McKay +Signed-off-by: Alexandru Ardelean +[blp@ovn.org made style changes] +Signed-off-by: Ben Pfaff +--- + lib/ovs-thread.c | 29 +++++++++++++++++++++++++++++ + 1 file changed, 29 insertions(+) + +diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c +index 6ebda07..b0e10ee 100644 +--- a/lib/ovs-thread.c ++++ b/lib/ovs-thread.c +@@ -340,6 +340,25 @@ ovsthread_wrapper(void *aux_) + return aux.start(aux.arg); + } + ++static void ++set_min_stack_size(pthread_attr_t *attr, size_t min_stacksize) ++{ ++ size_t stacksize; ++ int error; ++ ++ error = pthread_attr_getstacksize(attr, &stacksize); ++ if (error) { ++ ovs_abort(error, "pthread_attr_getstacksize failed"); ++ } ++ ++ if (stacksize < min_stacksize) { ++ error = pthread_attr_setstacksize(attr, min_stacksize); ++ if (error) { ++ ovs_abort(error, "pthread_attr_setstacksize failed"); ++ } ++ } ++} ++ + /* Starts a thread that calls 'start(arg)'. Sets the thread's name to 'name' + * (suffixed by its ovsthread_id()). Returns the new thread's pthread_t. */ + pthread_t +@@ -358,10 +377,20 @@ ovs_thread_create(const char *name, void *(*start)(void *), void *arg) + aux->arg = arg; + ovs_strlcpy(aux->name, name, sizeof aux->name); + +- error = pthread_create(&thread, NULL, ovsthread_wrapper, aux); ++ /* Some small systems use a default stack size as small as 80 kB, but OVS ++ * requires approximately 384 kB according to the following analysis: ++ * http://openvswitch.org/pipermail/dev/2016-January/065049.html ++ * ++ * We use 512 kB to give us some margin of error. */ ++ pthread_attr_t attr; ++ pthread_attr_init(&attr); ++ set_min_stack_size(&attr, 512 * 1024); ++ ++ error = pthread_create(&thread, &attr, ovsthread_wrapper, aux); + if (error) { + ovs_abort(error, "pthread_create failed"); + } ++ pthread_attr_destroy(&attr); + return thread; + } + +-- +2.1.4 + diff --git a/net/openvswitch/patches/0011-kernel-4-4-support.patch b/net/openvswitch/patches/0011-kernel-4-4-support.patch new file mode 100644 index 0000000..1a492e4 --- /dev/null +++ b/net/openvswitch/patches/0011-kernel-4-4-support.patch @@ -0,0 +1,279 @@ +diff --git a/acinclude.m4 b/acinclude.m4 +index 11c7787..07dd647 100644 +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -134,10 +134,10 @@ AC_DEFUN([OVS_CHECK_LINUX], [ + AC_MSG_RESULT([$kversion]) + + if test "$version" -ge 4; then +- if test "$version" = 4 && test "$patchlevel" -le 3; then ++ if test "$version" = 4 && test "$patchlevel" -le 4; then + : # Linux 4.x + else +- AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 4.3.x is not supported (please refer to the FAQ for advice)]) ++ AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 4.4.x is not supported (please refer to the FAQ for advice)]) + fi + elif test "$version" = 3; then + : # Linux 3.x +diff --git a/datapath/actions.c b/datapath/actions.c +index 20413c9..719c43d 100644 +--- a/datapath/actions.c ++++ b/datapath/actions.c +@@ -706,7 +706,8 @@ static void ovs_fragment(struct vport *vport, struct sk_buff *skb, u16 mru, + skb_dst_set_noref(skb, &ovs_dst); + IPCB(skb)->frag_max_size = mru; + +- ip_do_fragment(skb->sk, skb, ovs_vport_output); ++ ip_do_fragment(NET_ARG(dev_net(ovs_dst.dev)) ++ skb->sk, skb, ovs_vport_output); + refdst_drop(orig_dst); + } else if (ethertype == htons(ETH_P_IPV6)) { + const struct nf_ipv6_ops *v6ops = nf_get_ipv6_ops(); +@@ -727,7 +728,8 @@ static void ovs_fragment(struct vport *vport, struct sk_buff *skb, u16 mru, + skb_dst_set_noref(skb, &ovs_rt.dst); + IP6CB(skb)->frag_max_size = mru; + +- v6ops->fragment(skb->sk, skb, ovs_vport_output); ++ v6ops->fragment(NET_ARG(dev_net(ovs_rt.dst.dev)) ++ skb->sk, skb, ovs_vport_output); + refdst_drop(orig_dst); + } else { + WARN_ONCE(1, "Failed fragment ->%s: eth=%04x, MRU=%d, MTU=%d.", +diff --git a/datapath/conntrack.c b/datapath/conntrack.c +index 795ed91..3b9bfba 100644 +--- a/datapath/conntrack.c ++++ b/datapath/conntrack.c +@@ -323,7 +323,7 @@ static int handle_fragments(struct net *net, struct sw_flow_key *key, + int err; + + memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); +- err = ip_defrag(skb, user); ++ err = ip_defrag(NET_ARG(net) skb, user); + if (err) + return err; + +@@ -374,7 +374,7 @@ ovs_ct_expect_find(struct net *net, const struct nf_conntrack_zone *zone, + { + struct nf_conntrack_tuple tuple; + +- if (!nf_ct_get_tuplepr(skb, skb_network_offset(skb), proto, &tuple)) ++ if (!nf_ct_get_tuplepr(skb, skb_network_offset(skb), proto, NET_ARG(net) &tuple)) + return NULL; + return __nf_ct_expect_find(net, zone, &tuple); + } +diff --git a/datapath/datapath.c b/datapath/datapath.c +index e3d3c8c..a4157f4 100644 +--- a/datapath/datapath.c ++++ b/datapath/datapath.c +@@ -96,8 +96,12 @@ static bool ovs_must_notify(struct genl_family *family, struct genl_info *info, + static void ovs_notify(struct genl_family *family, struct genl_multicast_group *grp, + struct sk_buff *skb, struct genl_info *info) + { +- genl_notify(family, skb, genl_info_net(info), ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0) ++ genl_notify(family, skb, info, GROUP_ID(grp), GFP_KERNEL); ++#else ++ genl_notify(family, skb, genl_info_net(info), + info->snd_portid, GROUP_ID(grp), info->nlhdr, GFP_KERNEL); ++#endif + } + + /** +diff --git a/datapath/linux/compat/include/linux/netfilter_ipv6.h b/datapath/linux/compat/include/linux/netfilter_ipv6.h +index 3939e14..b724623 100644 +--- a/datapath/linux/compat/include/linux/netfilter_ipv6.h ++++ b/datapath/linux/compat/include/linux/netfilter_ipv6.h +@@ -13,7 +13,7 @@ + * the callback parameter needs to be in the form that older kernels accept. + * We don't backport the other ipv6_ops as they're currently unused by OVS. */ + struct ovs_nf_ipv6_ops { +- int (*fragment)(struct sock *sk, struct sk_buff *skb, ++ int (*fragment)(NET_ARG(net) struct sock *sk, struct sk_buff *skb, + int (*output)(OVS_VPORT_OUTPUT_PARAMS)); + }; + #define nf_ipv6_ops ovs_nf_ipv6_ops +diff --git a/datapath/linux/compat/include/net/ip.h b/datapath/linux/compat/include/net/ip.h +index cd87bcc..b749301 100644 +--- a/datapath/linux/compat/include/net/ip.h ++++ b/datapath/linux/compat/include/net/ip.h +@@ -66,8 +66,20 @@ static inline unsigned int rpl_ip_skb_dst_mtu(const struct sk_buff *skb) + #define ip_skb_dst_mtu rpl_ip_skb_dst_mtu + #endif /* HAVE_IP_SKB_DST_MTU */ + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0) ++#define NET_PARAM(x) struct net *x, ++#define NET_ARG(x) x, ++#define NET_DEV_NET(x) dev_net(x) ++#define NET_DECLARE_INIT(x,y) ++#else ++#define NET_PARAM(x) ++#define NET_ARG(x) ++#define NET_DEV_NET(x) ++#define NET_DECLARE_INIT(x,y) struct net *x = y; ++#endif ++ + #ifdef HAVE_IP_FRAGMENT_TAKES_SOCK +-#define OVS_VPORT_OUTPUT_PARAMS struct sock *sock, struct sk_buff *skb ++#define OVS_VPORT_OUTPUT_PARAMS NET_PARAM(net) struct sock *sock, struct sk_buff *skb + #else + #define OVS_VPORT_OUTPUT_PARAMS struct sk_buff *skb + #endif +@@ -89,12 +101,13 @@ static inline bool ip_defrag_user_in_between(u32 user, + #endif /* < v4.2 */ + + #ifndef HAVE_IP_DO_FRAGMENT +-static inline int rpl_ip_do_fragment(struct sock *sk, struct sk_buff *skb, ++static inline int rpl_ip_do_fragment(NET_PARAM(net) struct sock *sk, struct sk_buff *skb, + int (*output)(OVS_VPORT_OUTPUT_PARAMS)) + { + unsigned int mtu = ip_skb_dst_mtu(skb); + struct iphdr *iph = ip_hdr(skb); + struct rtable *rt = skb_rtable(skb); + struct net_device *dev = rt->dst.dev; ++ NET_DECLARE_INIT(net, dev_net(dev)); + + if (unlikely(((iph->frag_off & htons(IP_DF)) && !skb->ignore_df) || +@@ -102,7 +115,7 @@ static inline int rpl_ip_do_fragment(struct sock *sk, struct sk_buff *skb, + IPCB(skb)->frag_max_size > mtu))) { + + pr_warn("Dropping packet in ip_do_fragment()\n"); +- IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS); ++ IP_INC_STATS(net, IPSTATS_MIB_FRAGFAILS); + kfree_skb(skb); + return -EMSGSIZE; + } +@@ -116,8 +129,7 @@ static inline int rpl_ip_do_fragment(struct sock *sk, struct sk_buff *skb, + #define ip_do_fragment rpl_ip_do_fragment + #endif /* IP_DO_FRAGMENT */ + +-int rpl_ip_defrag(struct sk_buff *skb, u32 user); +-#define ip_defrag rpl_ip_defrag ++int rpl_ip_defrag(NET_PARAM(net) struct sk_buff *skb, u32 user); + + int __init rpl_ipfrag_init(void); + void rpl_ipfrag_fini(void); +@@ -127,14 +139,15 @@ void rpl_ipfrag_fini(void); + * ("inet: frag: Always orphan skbs inside ip_defrag()"), but it should be + * always included in kernels 4.5+. */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) +-static inline int rpl_ip_defrag(struct sk_buff *skb, u32 user) ++static inline int rpl_ip_defrag(NET_PARAM(net) struct sk_buff *skb, u32 user) + { + skb_orphan(skb); +- return ip_defrag(skb, user); ++ return ip_defrag(NET_ARG(net) skb, user); + } +-#define ip_defrag rpl_ip_defrag + #endif + ++#define ip_defrag rpl_ip_defrag ++ + static inline int rpl_ipfrag_init(void) { return 0; } + static inline void rpl_ipfrag_fini(void) { } + #endif /* HAVE_CORRECT_MRU_HANDLING && OVS_FRAGMENT_BACKPORT */ +diff --git a/datapath/linux/compat/include/net/ip6_tunnel.h b/datapath/linux/compat/include/net/ip6_tunnel.h +index ce65087..eacf9ca 100644 +--- a/datapath/linux/compat/include/net/ip6_tunnel.h ++++ b/datapath/linux/compat/include/net/ip6_tunnel.h +@@ -17,11 +17,15 @@ static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb, + + pkt_len = skb->len - skb_inner_network_offset(skb); + /* TODO: Fix GSO for ipv6 */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0) ++ err = ip6_local_out(dev_net(dev), sk, skb); ++#else + #ifdef HAVE_IP6_LOCAL_OUT_SK + err = ip6_local_out_sk(sk, skb); + #else + err = ip6_local_out(skb); + #endif ++#endif /* >= kernel 4.4 */ + if (net_xmit_eval(err) != 0) + pkt_len = net_xmit_eval(err); + else +diff --git a/datapath/linux/compat/include/net/vxlan.h b/datapath/linux/compat/include/net/vxlan.h +index b50cd17..230f3ad 100644 +--- a/datapath/linux/compat/include/net/vxlan.h ++++ b/datapath/linux/compat/include/net/vxlan.h +@@ -218,10 +218,20 @@ struct vxlan_dev { + struct net_device *rpl_vxlan_dev_create(struct net *net, const char *name, + u8 name_assign_type, struct vxlan_config *conf); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0) ++static inline __be16 vxlan_dev_dst_port(struct vxlan_dev *vxlan, ++ unsigned short family) ++{ ++ if (family == AF_INET6) ++ return inet_sk(vxlan->vn6_sock->sock->sk)->inet_sport; ++ return inet_sk(vxlan->vn4_sock->sock->sk)->inet_sport; ++} ++#else + static inline __be16 vxlan_dev_dst_port(struct vxlan_dev *vxlan) + { + return inet_sport(vxlan->vn_sock->sock->sk); + } ++#endif + + static inline netdev_features_t vxlan_features_check(struct sk_buff *skb, + netdev_features_t features) +diff --git a/datapath/linux/compat/ip_fragment.c b/datapath/linux/compat/ip_fragment.c +index cf2daaa..e168196 100644 +--- a/datapath/linux/compat/ip_fragment.c ++++ b/datapath/linux/compat/ip_fragment.c +@@ -674,11 +674,11 @@ out_fail: + } + + /* Process an incoming IP datagram fragment. */ +-int rpl_ip_defrag(struct sk_buff *skb, u32 user) ++int rpl_ip_defrag(NET_ARG(net) struct sk_buff *skb, u32 user) + { + struct net_device *dev = skb->dev ? : skb_dst(skb)->dev; + int vif = vrf_master_ifindex_rcu(dev); +- struct net *net = dev_net(dev); ++ NET_DECLARE_INIT(net, dev_net(dev)); + struct ipq *qp; + + IP_INC_STATS_BH(net, IPSTATS_MIB_REASMREQDS); +diff --git a/datapath/linux/compat/stt.c b/datapath/linux/compat/stt.c +index eb397e8..5ea3c52 100644 +--- a/datapath/linux/compat/stt.c ++++ b/datapath/linux/compat/stt.c +@@ -1450,7 +1450,11 @@ static void clean_percpu(struct work_struct *work) + } + + #ifdef HAVE_NF_HOOKFN_ARG_OPS ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0) ++#define FIRST_PARAM void *priv ++#else + #define FIRST_PARAM const struct nf_hook_ops *ops ++#endif /* >= kernel 4.4 */ + #else + #define FIRST_PARAM unsigned int hooknum + #endif +@@ -1498,7 +1502,9 @@ static unsigned int nf_ip_hook(FIRST_PARAM, struct sk_buff *skb, LAST_PARAM) + + static struct nf_hook_ops nf_hook_ops __read_mostly = { + .hook = nf_ip_hook, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) + .owner = THIS_MODULE, ++#endif + .pf = NFPROTO_IPV4, + .hooknum = NF_INET_LOCAL_IN, + .priority = INT_MAX, +diff --git a/datapath/vport-vxlan.c b/datapath/vport-vxlan.c +index c05f5d4..3cbb568 100644 +--- a/datapath/vport-vxlan.c ++++ b/datapath/vport-vxlan.c +@@ -153,7 +153,12 @@ static int vxlan_get_egress_tun_info(struct vport *vport, struct sk_buff *skb, + { + struct vxlan_dev *vxlan = netdev_priv(vport->dev); + struct net *net = ovs_dp_get_net(vport->dp); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0) ++ unsigned short family = ip_tunnel_info_af(upcall->egress_tun_info); ++ __be16 dst_port = vxlan_dev_dst_port(vxlan, family); ++#else + __be16 dst_port = vxlan_dev_dst_port(vxlan); ++#endif + __be16 src_port; + int port_min; + int port_max; diff --git a/net/p910nd/Makefile b/net/p910nd/Makefile new file mode 100644 index 0000000..2cdaaa9 --- /dev/null +++ b/net/p910nd/Makefile @@ -0,0 +1,59 @@ +# +# 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:=p910nd +PKG_VERSION:=0.97 +PKG_RELEASE:=5 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=@SF/p910nd +PKG_LICENSE:=GPLv2 +PKG_LICENSE_FILES:=COPYING +PKG_MD5SUM:=69461a6c54dca0b13ecad5b83864b43e +PKG_MAINTAINER:=Philipp Kerling + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/p910nd + SECTION:=net + CATEGORY:=Network + SUBMENU:=Printing + TITLE:=A small non-spooling printer server + URL:=http://p910nd.sourceforge.net +endef + +define Package/p910nd/conffiles +/etc/config/p910nd +endef + +define Package/p910nd/description + p910nd is a small daemon that copies any data received on + the port it is listening on to the corresponding printer + port. It is primarily intended for diskless Linux hosts + running as printer drivers but there is no reason why it + could not be used on diskful hosts. Port 9100 is copied + to /dev/lp0, 9101 to /dev/lp1 and 9102 to /dev/lp2. The + default is port 9100 to /dev/lp0. +endef + +MAKE_FLAGS += \ + CFLAGS="$(TARGET_CFLAGS) -DLOCKFILE_DIR=\"\\\"/tmp\"\\\"" + +define Package/p910nd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/p910nd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/p910nd.config $(1)/etc/config/p910nd + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/p910nd.init $(1)/etc/init.d/p910nd +endef + +$(eval $(call BuildPackage,p910nd)) diff --git a/net/p910nd/files/p910nd.config b/net/p910nd/files/p910nd.config new file mode 100644 index 0000000..d509035 --- /dev/null +++ b/net/p910nd/files/p910nd.config @@ -0,0 +1,5 @@ +config p910nd + option device /dev/usb/lp0 + option port 0 + option bidirectional 1 + option enabled 0 diff --git a/net/p910nd/files/p910nd.init b/net/p910nd/files/p910nd.init new file mode 100644 index 0000000..f028903 --- /dev/null +++ b/net/p910nd/files/p910nd.init @@ -0,0 +1,45 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2007 OpenWrt.org +START=50 +USE_PROCD=1 + +append_bool() { + local section="$1" + local option="$2" + local value="$3" + local _val + config_get_bool _val "$section" "$option" '0' + [ "$_val" -gt 0 ] && append args "$3" +} + +append_string() { + local section="$1" + local option="$2" + local value="$3" + local _val + config_get _val "$section" "$option" + [ -n "$_val" ] && append args "$3$_val" +} + +start_service() { + config_load "p910nd" + config_foreach start_p910nd p910nd +} + + +start_p910nd() { + local section="$1" + config_get_bool "enabled" "$section" "enabled" '1' + if [ "$enabled" -gt 0 ]; then + args="-d " + config_get port "$section" port + name=p910${port}d + append_bool "$section" bidirectional "-b" + append_string "$section" device "-f " + append_string "$section" bind "-i " + append_string "$section" port "" + procd_open_instance $name + procd_set_param command /usr/sbin/p910nd $args + procd_close_instance + fi +} diff --git a/net/pingcheck/Makefile b/net/pingcheck/Makefile new file mode 100644 index 0000000..f6e152d --- /dev/null +++ b/net/pingcheck/Makefile @@ -0,0 +1,55 @@ +# +# Copyright (C) 2015 Bruno Randolf (br1@einfach.org) +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=pingcheck +PKG_VERSION:=0.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=https://github.com/br101/pingcheck.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=0f099998782f550e2abebdc65bcc3e969b798769 + +PKG_MAINTAINER:=Bruno Randolf +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/pingcheck + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libubus +libuci + MAINTAINER:=Bruno Randolf + TITLE:=Check Internet and interface connectivity +endef + +define Package/pingcheck/description +Checks by using "ping" (ICMP echo) wether a configured host (normally on the +internet) can be reached via a specific interface. Then makes this information +available via ubus and triggers "online" and "offline" scripts. +endef + +define Package/pingcheck/conffiles +/etc/config/pingcheck +endef + +define Package/pingcheck/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/pingcheck $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./pingcheck.init $(1)/etc/init.d/pingcheck + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) $(PKG_BUILD_DIR)/pingcheck.config $(1)/etc/config/pingcheck +endef + +$(eval $(call BuildPackage,pingcheck)) diff --git a/net/pingcheck/pingcheck.init b/net/pingcheck/pingcheck.init new file mode 100755 index 0000000..edb04b1 --- /dev/null +++ b/net/pingcheck/pingcheck.init @@ -0,0 +1,15 @@ +#!/bin/sh /etc/rc.common + +START=99 + +USE_PROCD=1 +PROG=/usr/sbin/pingcheck +CONFFILE=/etc/config/pingcheck + +start_service() { + procd_open_instance + procd_set_param command $PROG + procd_set_param file $CONFFILE + procd_set_param respawn + procd_close_instance +} diff --git a/net/polipo/Makefile b/net/polipo/Makefile new file mode 100644 index 0000000..48c24a1 --- /dev/null +++ b/net/polipo/Makefile @@ -0,0 +1,59 @@ +# +# Copyright (C) 2007-2011 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:=polipo +PKG_VERSION:=1.1.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.pps.jussieu.fr/~jch/software/files/$(PKG_NAME)/ +PKG_MD5SUM:=86939e331e656f638271f578b6e3f893 + +include $(INCLUDE_DIR)/package.mk + +define Package/polipo + SUBMENU:=Web Servers/Proxies + SECTION:=net + CATEGORY:=Network + TITLE:=A caching web proxy + URL:=http://www.pps.univ-paris-diderot.fr/~jch/software/polipo/ + MAINTAINER:=Gabriel Kerneis +endef + +define Package/polipo/description + Polipo is a small and fast caching web proxy (a web cache, an HTTP proxy, + a proxy server). While Polipo was designed to be used by one person or a + small group of people, there is nothing that prevents it from being used + by a larger group. +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + CC="$(TARGET_CC)" \ + CFLAGS="$(TARGET_CFLAGS)" \ + polipo +endef + +define Package/polipo/conffiles +/etc/config/polipo +/etc/polipo/config +endef + +define Package/polipo/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/polipo $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/polipo + $(INSTALL_CONF) $(PKG_BUILD_DIR)/config.sample $(1)/etc/polipo/config + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/polipo.config $(1)/etc/config/polipo + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/polipo.init $(1)/etc/init.d/polipo +endef + +$(eval $(call BuildPackage,polipo)) diff --git a/net/polipo/files/polipo.config b/net/polipo/files/polipo.config new file mode 100644 index 0000000..47f4a57 --- /dev/null +++ b/net/polipo/files/polipo.config @@ -0,0 +1,42 @@ +# polipo daemon configuration +config 'polipo' 'daemon' + # daemonise polipo (fork in background) + option 'daemonise' '1' + # where polipo will store its process pid + option 'pidFile' '/var/run/polipo.pid' + +config 'polipo' 'general' + option 'enabled' '1' + # address on which polipo will listen, 0.0.0.0 means all addresses + option 'proxyAddress' '0.0.0.0' + # port on which polipo will listen, default is 8123 + #option 'proxyPort' '8123' + # list of allowed clients to connect + list 'allowedClients' '192.168.1.0/24' + #list 'allowedClients' '127.0.0.1' + #list 'allowedClients' '192.168.2.1' + # how much RAM memory should Polipo use (in bytes). + option 'chunkHighMark' '1048576' + # enable disk cache index and serverlist of integrated polipo web interface + #option 'disableIndexing' '0' + #option 'disableServersList' '0' + # disable loging to syslog + option 'logSyslog' '0' + # set log file location (disabled when not set) + #option 'logFile' '/mnt/usbdrive/polipo/log' + +config 'polipo' 'cache' + # disk cache location, you should always use external storage device + # (disabled when not set) + #option 'diskCacheRoot' '/mnt/usbdrive-p2/polipo/cache' + # disk cache cleanup settings + #option 'diskCacheUnlinkTime' '20d' + #option 'diskCacheTruncateTime' '5d' + #option 'diskCacheTruncateSize' '3145728' + # set to 1 if proxy is used by multiple users + #option 'cacheIsShared' '1' + +config 'polipo' 'pmm' + # poor man's multiplexing semgnet size to fetch + #option 'pmmSize' '8192' + diff --git a/net/polipo/files/polipo.init b/net/polipo/files/polipo.init new file mode 100644 index 0000000..3cd73d4 --- /dev/null +++ b/net/polipo/files/polipo.init @@ -0,0 +1,150 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008-2011 OpenWrt.org + +START=99 + +CFGFILE=/var/etc/polipo.conf + +start() { + config_load 'polipo' + + config_get_bool enabled "general" 'enabled' '0' + [ $enabled -gt 0 ] || return 1 + + mkdir -m 0755 -p /var/etc/ + echo '### AUTOGENERATED CONFIGURATION' > $CFGFILE + echo '### DO NOT EDIT' >> $CFGFILE + echo '### SEE /etc/config/polipo INSTEAD' >> $CFGFILE + echo '' >> $CFGFILE + + config_foreach polipo_config 'polipo' + + # handle values that are disabled when not defined or empty + echo "### VALUES THAT ARE DISABLED WHEN EMPTY" >> $CFGFILE + polipo_atom "cache" "diskCacheRoot" '"' "1" >> $CFGFILE + polipo_atom "general" "logFile" '"' "1" >> $CFGFILE + polipo_atom "general" "localDocumentRoot" '"' "1" >> $CFGFILE + + service_start /usr/sbin/polipo -c "$CFGFILE" +} + +stop() { + service_stop /usr/sbin/polipo -c "$CFGFILE" +} + +polipo_config() { + echo "### SECTION $1" >> $CFGFILE + + string_options='authCredentials authRealm dnsNameServer forbiddenFile + forbiddenUrl logFacility pidFile parentAuthCredentials parentProxy + proxyAddress proxyName redirector socksParentProxy socksProxyType + socksUserName uncachableFile' + + number_options='bigBufferSize chunkCriticalMark chunkHighMark chunkLowMark + diskCacheDirectoryPermissions diskCacheFilePermissions + diskCacheTruncateSize diskCacheWriteoutOnClose forbiddenRedirectCode + logFilePermissions logLevel maxDiskCacheEntrySize maxDiskEntries + maxObjectsWhenIdle maxPipelineTrain maxSideBuffering maxWriteoutWhenIdle + objectHashTableSize objectHighMark pmmFirstSize pmmSize proxyPort + publicObjectLowMark redirectorRedirectCode replyUnpipelineSize + serverMaxSlots serverSlots serverSlots1 maxAgeFraction' + + time_options='clientTimeout diskCacheTruncateTime diskCacheUnlinkTime + dnsGethostbynameTtl dnsMaxTimeout dnsNegativeTtl idleTime maxAge + maxConnectionAge maxConnectionRequests maxExpiresAge maxNoModifiedAge + replyUnpipelineTime serverExpireTime serverIdleTimeout serverTimeout + smallRequestTime' + + multistate_options='censorReferer dnsQueryIPv6 dnsUseGethostbyname + dontTrustVaryETag expectContinue pipelineAdditionalRequests + useTemporarySourceAddress relaxTransparency' + + boolean_options='cacheIsShared daemonise disableConfiguration disableIndexing + disableLocalInterface disableProxy disableServersList disableVia + dontCacheCookies dontCacheRedirects logSyslog mindlesslyCacheVary + preciseExpiry proxyOffline scrubLogs laxHttpParser' + + string_list_options='allowedClients censoredHeaders' + + number_list_options='allowedPorts tunnelAllowedPorts' + + for option in $string_options; do + polipo_atom "$1" "$option" '"' >> $CFGFILE + done + + for option in $number_options; do + polipo_atom "$1" "$option" >> $CFGFILE + done + + for option in $time_options; do + polipo_atom "$1" "$option" >> $CFGFILE + done + + for option in $multistate_options; do + polipo_atom "$1" "$option" >> $CFGFILE + done + + for option in $boolean_options; do + polipo_boolean "$1" "$option" >> $CFGFILE + done + + for option in $string_list_options; do + polipo_list "$1" "$option" '"' >> $CFGFILE + done + + for option in $number_list_options; do + polipo_list "$1" "$option" >> $CFGFILE + done +} + +polipo_atom() { + local SECTION=$1 + local OPTION=$2 + local QUOTE=$3 + local EMPTY_DISABLED=${4:-0} + + config_get _value "$SECTION" "$OPTION" + [ -n "$_value" -o "$EMPTY_DISABLED" -eq "1" ] && { + echo "$OPTION = ${QUOTE}${_value}${QUOTE}" + } +} + +polipo_boolean() { + local SECTION=$1 + local OPTION=$2 + + config_get_bool _value "$SECTION" "$OPTION" + [ -n "$_value" ] && { + [ "$_value" -eq "1" ] && _value="true" || _value="false" + echo "$OPTION = $_value" + } +} + +polipo_list() { + local SECTION=$1 + local OPTION=$2 + local QUOTE=$3 + + config_get _value "$SECTION" "$OPTION" + + [ "$SECTION" = general ] && [ "$OPTION" = allowedClients ] && { + case "$_value" in + *127.0.0.1*) : ;; + *) _value="127.0.0.1 $_value" ;; + esac + } + + [ -n "$_value" ] && { + echo -n "$OPTION = " + + local FIRST=1 + for entry in $_value; do + [ "$FIRST" -ne "1" ] && echo -n ", " || FIRST=0 + + echo -n "${QUOTE}${entry}${QUOTE}" + done + + echo '' + } +} + diff --git a/net/port-mirroring/Makefile b/net/port-mirroring/Makefile new file mode 100644 index 0000000..fdc4b39 --- /dev/null +++ b/net/port-mirroring/Makefile @@ -0,0 +1,44 @@ +# +# Copyright (c) 2015 OpenWrt.org +# +# This is free software, licensed under the BSD 2-Clause License. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=port-mirroring +PKG_VERSION:=1.4.2 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Mike Maraya +PKG_LICENSE:=BSD-2-Clause +PKG_LICENSE_FILES:=LICENSE +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=git://github.com/mmaraya/port-mirroring.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=f6ead68b7760fa86e8da73ac1e062349f243ac93 +PKG_FIXUP:=autoreconf +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/port-mirroring + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpcap +libpthread + TITLE:=Copy network packets with optional support for TaZmen Sniffer Protocol (TZSP) + URL:=https://github.com/mmaraya/port-mirroring + MENU:=1 +endef + +define Package/port-mirroring/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/port-mirroring $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) $(PKG_BUILD_DIR)/port-mirroring.conf $(1)/etc/config/port-mirroring + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) $(PKG_BUILD_DIR)/port-mirroringd $(1)/etc/init.d/port_mirroring +endef + +$(eval $(call BuildPackage,port-mirroring)) + diff --git a/net/portmap/Makefile b/net/portmap/Makefile new file mode 100644 index 0000000..03969f7 --- /dev/null +++ b/net/portmap/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2006-2011 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:=portmap +PKG_VERSION:=6.0 +PKG_RELEASE:=4 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://neil.brown.name/portmap/ +PKG_MD5SUM:=ac108ab68bf0f34477f8317791aaf1ff + +PKG_LICENSE:=BSD-4c +PKG_LICENSE_FILES:=portmap.man + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)_$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/portmap + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libwrap $(LIBRPC_DEPENDS) + TITLE:=The RPC Portmapper + URL:=http://neil.brown.name/portmap/ + MAINTAINER:=Peter Wagner + USERID:=rpc=65533:rpc=65533 +endef + +define Package/portmap/description + Portmap is a server that converts RPC (Remote Procedure Call) program + numbers into DARPA protocol port numbers. +endef + +MAKE_FLAGS += \ + CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -DHOSTS_ACCESS -DFACILITY=LOG_DAEMON -DIGNORE_SIGCHLD" \ + RPCUSER="rpc" \ + LDLIBS="$(TARGET_LDFLAGS) -lwrap $(LIBRPC)" \ + all + +define Package/portmap/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/portmap $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/portmap.init $(1)/etc/init.d/portmap +endef + +$(eval $(call BuildPackage,portmap)) diff --git a/net/portmap/files/portmap.init b/net/portmap/files/portmap.init new file mode 100644 index 0000000..621c313 --- /dev/null +++ b/net/portmap/files/portmap.init @@ -0,0 +1,13 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=19 +STOP=19 + +USE_PROCD=1 + +start_service() { + procd_open_instance + procd_set_param command /usr/sbin/portmap -f + procd_close_instance +} diff --git a/net/portmap/patches/101-no_pie.patch b/net/portmap/patches/101-no_pie.patch new file mode 100644 index 0000000..6cbdece --- /dev/null +++ b/net/portmap/patches/101-no_pie.patch @@ -0,0 +1,12 @@ +diff -ur portmap_6.0.org/Makefile portmap_6.0/Makefile +--- portmap_6.0.org/Makefile 2008-04-19 22:44:35.000000000 +0200 ++++ portmap_6.0/Makefile 2008-04-19 00:02:01.000000000 +0200 +@@ -127,7 +127,7 @@ + CPPFLAGS += $(HOSTS_ACCESS) + portmap: CFLAGS += -fpie + portmap: LDLIBS += $(WRAP_LIB) +-portmap: LDFLAGS += -pie ++#portmap: LDFLAGS += -pie + portmap: portmap.o pmap_check.o from_local.o + + from_local: CPPFLAGS += -DTEST diff --git a/net/pppossh/Makefile b/net/pppossh/Makefile new file mode 100644 index 0000000..a4a048f --- /dev/null +++ b/net/pppossh/Makefile @@ -0,0 +1,37 @@ +# +# Copyright (C) 2015 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:=pppossh +PKG_RELEASE:=2 +PKG_MAINTAINER:=Yousong Zhou +PKG_LICENSE:=GPLv2 + +include $(INCLUDE_DIR)/package.mk + +define Package/pppossh + SECTION:=net + CATEGORY:=Network + TITLE:=PPPoSSH (Point-to-Point Protocol over SSH) + DEPENDS:=+ppp +resolveip @(PACKAGE_dropbear||PACKAGE_openssh-client) +endef + +define Package/pppossh/description +This package adds protocol support for PPP over SSH. The protocol name is +'pppossh' as in netifd interface config option 'proto'. +endef + +define Build/Compile +endef + +define Package/pppossh/install + $(INSTALL_DIR) $(1)/lib/netifd/proto + $(INSTALL_BIN) ./files/pppossh.sh $(1)/lib/netifd/proto +endef + +$(eval $(call BuildPackage,pppossh)) diff --git a/net/pppossh/README.md b/net/pppossh/README.md new file mode 100644 index 0000000..4902ba6 --- /dev/null +++ b/net/pppossh/README.md @@ -0,0 +1,68 @@ +This package will add the so-called `pppossh` protocol support to OpenWrt. The idea is mainly from [`pvpn` project](https://github.com/halhen/pvpn) (poor man's VPN over SSH). + +PPPoSSH is generally not considered a network setup for production use mainly due to the TCP-over-TCP styles of traffic transport, but it can be quite handy for personal use. And with what's already in OpenWrt, it is really easy and takes little extra space to configure it up running. + +## Prerequisites and dependency. + +`pppossh` depends on either `dropbear` or `openssh-client`; `dropbear` is normally enabled in OpenWrt by default. + +The following requirements need to be fulfilled for it to work. + +- A SSH account on the remote machine with `CAP_NET_ADMIN` capability is required. +- Public key authentication must be enabled and setup properly. + + Public key of the one generated automatially by dropbear can be induced by the following command. But you can always use your own (dropbear can work with OpenSSH public key). + + dropbearkey -y -f /etc/dropbear/dropbear_rsa_host_key + +- SSH server's fingerprint has to be present in `~/.ssh/known_hosts` for the authentication to proceed in an unattended way. + + Manually logging in at least once to the remote server from OpenWrt should do this for you. + +## How to use it. + +The protocol name to use in `/etc/config/network` is `pppossh`. Options are as described below. + +- `server`, SSH server name +- `port`, SSH server port (defaults to `22`). +- `sshuser`, SSH login username +- `identity`, list of client private key files. `~/.ssh/id_{rsa,dsa}` will + be used if no identity file was specified and at least one of them must be + valid for the public key authentication to proceed. +- `ipaddr`, local ip address to be assigned. +- `peeraddr`, peer ip address to be assigned. +- `ssh_options`, extra options for the ssh client. +- `use_hostdep`, set it to `0` to disable the use of `proto_add_host_dependency`. This is mainly for the case that the appropriate route to `server` is not registered to `netifd` and thus causing a incorrect route being setup. + +## Tips + +An `uci batch` command template for your reference. Modify it to suite your situation. + + uci batch <&2 + exit 1 +} + +. /lib/functions.sh +. ../netifd-proto.sh +init_proto "$@" + +INCLUDE_ONLY=1 + +. ./ppp.sh + +proto_pppossh_init_config() { + ppp_generic_init_config + config_add_string server sshuser ipaddr peeraddr ssh_options + config_add_array 'identity:list(string)' + config_add_int port use_hostdep + available=1 + no_device=1 +} + +proto_pppossh_setup() { + local config="$1" + local iface="$2" + local user="$(id -nu)" + local home=$(sh -c "echo ~$user") + local server port sshuser ipaddr peeraddr ssh_options identity use_hostdep + local ip fn errmsg opts pty + + json_get_vars port sshuser ipaddr peeraddr ssh_options use_hostdep + json_get_var server server && { + [ -z "$use_hostdep" ] && use_hostdep=1 + for ip in $(resolveip -t 5 "$server"); do + if [ "$use_hostdep" -gt 0 ]; then + ( proto_add_host_dependency "$config" "$ip" ) + else + break + fi + done + } + [ -n "$ip" ] || errmsg="${errmsg}Could not resolve $server\n" + [ -n "$sshuser" ] || errmsg="${errmsg}Missing sshuser option\n" + + json_get_values identity identity + [ -z "$identity" ] && identity="$home/.ssh/id_rsa $home/.ssh/id_dsa" + for fn in $identity; do + [ -f "$fn" ] && opts="$opts -i $fn" + done + [ -n "$opts" ] || errmsg="${errmsg}Cannot find valid identity file\n" + + [ -n "$errmsg" ] && { + echo -ne "$errmsg" >&2 + proto_setup_failed "$config" + exit 1 + } + opts="$opts ${port:+-p $port}" + opts="$opts ${ssh_options}" + opts="$opts $sshuser@$server" + pty="exec env 'HOME=$home' $SSH $opts pppd nodetach notty noauth" + + ppp_generic_setup "$config" noauth pty "$pty" "$ipaddr:$peeraddr" +} + +proto_pppossh_teardown() { + ppp_generic_teardown "$@" +} + +add_protocol pppossh diff --git a/net/pptpd/Makefile b/net/pptpd/Makefile new file mode 100644 index 0000000..f188cc0 --- /dev/null +++ b/net/pptpd/Makefile @@ -0,0 +1,69 @@ +# +# Copyright (C) 2006-2015 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:=pptpd +PKG_VERSION:=1.4.0 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/poptop +PKG_MD5SUM:=36f9f45c6ffa92bc3b6e24ae2d053505 + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +PKG_MAINTAINER:=Luka Perkov + +include $(INCLUDE_DIR)/package.mk + +define Package/pptpd + SECTION:=net + CATEGORY:=Network + DEPENDS:=+kmod-ppp +kmod-gre +kmod-mppe +ppp + TITLE:=PopTop pptp server + URL:=http://poptop.sourceforge.net/ + SUBMENU:=VPN +endef + +CONFIGURE_ARGS += \ + --enable-bcrelay \ + +CONFIGURE_VARS += \ + ac_cv_header_libintl_h=no \ + +MAKE_FLAGS += \ + COPTS="$(TARGET_CFLAGS)" \ + INSTALL="install" \ + +define Package/pptpd/conffiles +/etc/pptpd.conf +/etc/ppp/options.pptpd +/etc/config/pptpd +endef + +define Package/pptpd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) \ + $(PKG_INSTALL_DIR)/usr/sbin/bcrelay \ + $(PKG_INSTALL_DIR)/usr/sbin/pptpctrl \ + $(PKG_INSTALL_DIR)/usr/sbin/pptpd \ + $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/usr/lib/pptpd + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pptpd/* $(1)/usr/lib/pptpd/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) ./files/pptpd.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/pptpd.init $(1)/etc/init.d/pptpd + $(INSTALL_DIR) $(1)/etc/ppp + $(INSTALL_DATA) ./files/options.pptpd $(1)/etc/ppp/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/pptpd.config $(1)/etc/config/pptpd +endef + +$(eval $(call BuildPackage,pptpd)) diff --git a/net/pptpd/files/options.pptpd b/net/pptpd/files/options.pptpd new file mode 100644 index 0000000..7f82594 --- /dev/null +++ b/net/pptpd/files/options.pptpd @@ -0,0 +1,21 @@ +#debug +#logfile /tmp/pptp-server.log +auth +name "pptp-server" +lcp-echo-failure 3 +lcp-echo-interval 60 +default-asyncmap +mtu 1482 +mru 1482 +nobsdcomp +nodeflate +#noproxyarp +#nomppc +require-mschap-v2 +refuse-chap +refuse-mschap +refuse-eap +refuse-pap +#ms-dns 172.16.1.1 +#plugin radius.so +#radius-config-file /etc/radius.conf diff --git a/net/pptpd/files/pptpd.conf b/net/pptpd/files/pptpd.conf new file mode 100644 index 0000000..398ae9d --- /dev/null +++ b/net/pptpd/files/pptpd.conf @@ -0,0 +1,4 @@ +#debug +speed 115200 +stimeout 10 +#localip & remoteip are not needed, ip management is done by pppd diff --git a/net/pptpd/files/pptpd.config b/net/pptpd/files/pptpd.config new file mode 100644 index 0000000..b2d5df5 --- /dev/null +++ b/net/pptpd/files/pptpd.config @@ -0,0 +1,8 @@ +config service 'pptpd' + option 'enabled' '0' + option 'localip' '192.168.0.1' + option 'remoteip' '192.168.0.20-30' + +config 'login' + option 'username' 'youruser' + option 'password' 'yourpass' diff --git a/net/pptpd/files/pptpd.init b/net/pptpd/files/pptpd.init new file mode 100644 index 0000000..0d18aa1 --- /dev/null +++ b/net/pptpd/files/pptpd.init @@ -0,0 +1,72 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 OpenWrt.org + +START=60 +USE_PROCD=1 + +BIN=/usr/sbin/pptpd +CONFIG=/var/etc/pptpd.conf +CHAP_SECRETS=/var/etc/chap-secrets +OPTIONS_PPTP=/var/etc/options.pptpd + +validate_login_section() { + uci_validate_section pptpd login "${1}" \ + 'username:string' \ + 'password:string' +} + +validate_pptpd_section() { + uci_validate_section pptpd service "${1}" \ + 'enabled:uinteger' \ + 'localip:string' \ + 'remoteip:string' \ + 'mppe:list(string):required no40 no56 stateless' \ + 'logwtmp:uinteger' +} + +setup_login() { + validate_login_section "${1}" || { + echo "validation failed" + return 1 + } + + [ -n "${username}" ] || return 0 + [ -n "${password}" ] || return 0 + + echo "${username} pptp-server ${password} *" >> $CHAP_SECRETS +} + +setup_config() { + local enabled localip remoteip mppe + + validate_pptpd_section "${1}" || { + echo "validation failed" + return 1 + } + + [ "$enabled" -eq 0 ] && return 1 + + mkdir -p /var/etc + cp /etc/pptpd.conf $CONFIG + cp /etc/ppp/options.pptpd $OPTIONS_PPTP + + [ -n "$localip" ] && echo "localip $localip" >> $CONFIG + [ -n "$remoteip" ] && echo "remoteip $remoteip" >> $CONFIG + [ "$logwtmp" -eq 1 ] && echo "logwtmp" >> $CONFIG + + echo "mppe $(echo $mppe | sed -e 's/\s/,/g')" >> $OPTIONS_PPTP + + return 0 +} + +start_service() { + config_load pptpd + setup_config pptpd || return + config_foreach setup_login login + + ln -sfn $CHAP_SECRETS /etc/ppp/chap-secrets + + procd_open_instance + procd_set_param command $BIN -c $CONFIG -o $OPTIONS_PPTP + procd_close_instance +} diff --git a/net/pptpd/patches/001-bad_pqueue_debug.patch b/net/pptpd/patches/001-bad_pqueue_debug.patch new file mode 100644 index 0000000..50d5252 --- /dev/null +++ b/net/pptpd/patches/001-bad_pqueue_debug.patch @@ -0,0 +1,18 @@ +--- a/pqueue.c ++++ b/pqueue.c +@@ -7,13 +7,11 @@ + #include "pqueue.h" + + #ifdef DEBUG_PQUEUE +-#define DEBUG_ON 1 ++#define DEBUG_CMD(_a) { _a } + #else +-#define DEBUG_ON 0 ++#define DEBUG_CMD(_a) + #endif + +-#define DEBUG_CMD(_a) if (DEBUG_ON) { _a } +- + #define MIN_CAPACITY 128 /* min allocated buffer for a packet */ + + static int pqueue_alloc (int seq, unsigned char *packet, int packlen, pqueue_t **new); diff --git a/net/pptpd/patches/002-makefile_fix.patch b/net/pptpd/patches/002-makefile_fix.patch new file mode 100644 index 0000000..74e3335 --- /dev/null +++ b/net/pptpd/patches/002-makefile_fix.patch @@ -0,0 +1,11 @@ +--- a/plugins/Makefile ++++ b/plugins/Makefile +@@ -18,7 +18,7 @@ all: $(PLUGINS) + %.so: %.c + $(CC) -o $@ $(LDFLAGS) $(CFLAGS) $^ $(LDADD) + +-LIBDIR ?= $(DESTDIR)$(prefix)/lib/pptpd ++LIBDIR = $(DESTDIR)$(prefix)/lib/pptpd + + install: $(PLUGINS) + $(INSTALL) -d $(LIBDIR) diff --git a/net/pptpd/patches/003-opt_flags.patch b/net/pptpd/patches/003-opt_flags.patch new file mode 100644 index 0000000..cc136c5 --- /dev/null +++ b/net/pptpd/patches/003-opt_flags.patch @@ -0,0 +1,11 @@ +--- a/Makefile.in ++++ b/Makefile.in +@@ -153,7 +153,7 @@ AUTOMAKE = @AUTOMAKE@ + AWK = @AWK@ + CC = @CC@ + CCDEPMODE = @CCDEPMODE@ +-CFLAGS = -O2 -fno-builtin -Wall -DSBINDIR='"$(sbindir)"' ++CFLAGS = $(COPTS) -fno-builtin -Wall -DSBINDIR='"$(sbindir)"' + CPP = @CPP@ + CPPFLAGS = @CPPFLAGS@ + CYGPATH_W = @CYGPATH_W@ diff --git a/net/pptpd/patches/100-musl-compat.patch b/net/pptpd/patches/100-musl-compat.patch new file mode 100644 index 0000000..6ce625a --- /dev/null +++ b/net/pptpd/patches/100-musl-compat.patch @@ -0,0 +1,38 @@ +--- a/bcrelay.c ++++ b/bcrelay.c +@@ -667,7 +667,7 @@ static void mainloop(int argc, char **ar + * there is no need to concern about the physical/link layer header because it is + * filled in automatically (based on the contents of sa). + */ +- if ((nrsent = sendto(cur_ifsnr[j].sock_nr, ipp_p, rlen, MSG_DONTWAIT|MSG_TRYHARD, (struct sockaddr *)&sa, salen)) < 0) ++ if ((nrsent = sendto(cur_ifsnr[j].sock_nr, ipp_p, rlen, MSG_DONTWAIT|MSG_DONTROUTE, (struct sockaddr *)&sa, salen)) < 0) + { + if (errno == ENETDOWN) { + syslog(LOG_NOTICE, "ignored ENETDOWN from sendto(), a network interface was going down?"); +--- a/compat.c ++++ b/compat.c +@@ -11,10 +11,10 @@ + #include "compat.h" + #include "our_syslog.h" + +-#ifndef HAVE_STRLCPY + #include + #include + ++#ifndef HAVE_STRLCPY + void strlcpy(char *dst, const char *src, size_t size) + { + strncpy(dst, src, size - 1); +--- /dev/null ++++ b/net/ppp_defs.h +@@ -0,0 +1,10 @@ ++#ifndef _NET_PPP_DEFS_H ++#define _NET_PPP_DEFS_H 1 ++ ++#define __need_time_t ++#include ++ ++#include ++#include ++ ++#endif /* net/ppp_defs.h */ diff --git a/net/privoxy/Config.in b/net/privoxy/Config.in new file mode 100644 index 0000000..b4a629d --- /dev/null +++ b/net/privoxy/Config.in @@ -0,0 +1,115 @@ +if PACKAGE_privoxy + + comment "Shared libraries settings" + + config PRIVOXY_disable-pthread + bool "Don't use POSIX libpthread (-5489b)" + default n + + config PRIVOXY_disable-dynamic-pcre + bool "Use the built-in, static pcre, even if libpcre is available (+25669b)" + default n + + config PRIVOXY_disable-zlib + bool "Don't use zlib to decompress data before filtering. (-1336b)" + default n + + comment "Config options. Overwrites/ignore configuration file settings" + + config PRIVOXY_disable-toggle + bool "Don't support temporary disable (+2797b)" + default n + + config PRIVOXY_disable-force + bool "Don't allow single-page disable (-434b)" + default n + + config PRIVOXY_disable-fast-redirects + bool "Don't support fast redirects (-1393b)" + default n + + config PRIVOXY_disable-stats + bool "Don't keep statistics (+2870b)" + default n + + config PRIVOXY_enable-ie-images + bool "Enable MS IE image handling. !Read help! (+2694b)" + help + Enable a quick but not always reliable auto-detect whether + requests from MS Internet Explorer are for an image or not. + default n + + config PRIVOXY_disable-image-blocking + bool "Don't check for image request - assume HTML (-655b)" + help + Don't try to figure out whether a request is + for an image or HTML - assume HTML. + default n + + config PRIVOXY_disable-acl-support + bool "Disable ACL access control (-3496b)" + help + Prevents the use of ACLs to control access to Privoxy by IP address. + default n + + config PRIVOXY_disable-trust-files + bool "Prevents the use of trust files. (-1302b)" + default n + + config PRIVOXY_disable-editor + bool "Disable web-based editor. !Read help! (-44979b)" + help + Prevents the use of the web-based actions file + editor and web-based temporary disable setting. + default n + + config PRIVOXY_enable-no-gifs + bool "Use politically correct PNG format. !Read help! (+112b)" + help + Use politically correct PNG format instead of GIF + for built-in images. May not work with all browsers. + default n + + config PRIVOXY_enable-graceful-termination + bool "Allow to shutdown Privoxy through the webinterface. (+1685b)" + default n + + config PRIVOXY_enable-extended-host-patterns + bool "Enable and require PCRE syntax in host patterns. !Read help! (-1329b)" + help + Enable and require PCRE syntax in host patterns. This feature hasn't + been announced yet and it's not clear if it's a good idea. It's expected + to work, but undocumented. You should only enable it if you know what + PCRE is and are sure that you need it for your host patterns. You can + use tools/url-pattern-translator.pl to convert existing action files to + use PCRE host patterns. Please don't enable this option when creating + packages for others that may not be expecting it. + default n + + config PRIVOXY_enable-external-filters + bool "Allow to filter content with scripts and programs. Experimental. (+4821b)" + default n + + config PRIVOXY_enable-accept-filter + bool "Try to use accf_http(9) if supported. (+-0b)" + default n + + config PRIVOXY_enable-strptime-sanity-checks + bool "Only trust strptime() results if ... !Read help! (+407b)" + help + Only trust strptime() results if an additional strftime()/strptime() + conversion doesn't change the result. Can be useful if strptime() is + known or suspected to be broken. + default n + + config PRIVOXY_enable-compression + bool "Allow Privoxy to compress buffered content. (+1275b)" + help + Allow Privoxy to compress buffered content + if the client supports it. Requires zlib support. + depends on !PRIVOXY_no_zlib + default n + + +endif + \ No newline at end of file diff --git a/net/privoxy/Makefile b/net/privoxy/Makefile new file mode 100644 index 0000000..8d48208 --- /dev/null +++ b/net/privoxy/Makefile @@ -0,0 +1,164 @@ +# +# Copyright (C) 2006-2016 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:=privoxy +PKG_VERSION:=3.0.26 +PKG_RELEASE:=2 + +PKG_SOURCE:=privoxy-$(PKG_VERSION)-stable-src.tar.gz +PKG_SOURCE_URL:=@SF/ijbswa +PKG_MD5SUM:=8a1c842112ccea68c19b7ceb4a0e999f +PKG_BUILD_DIR:=$(BUILD_DIR)/privoxy-$(PKG_VERSION)-stable +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=LICENSE + +PKG_MAINTAINER:=Christian Schoenebeck + +PKG_CONFIG_DEPENDS:= \ + CONFIG_IPV6 \ + \ + CONFIG_PRIVOXY_disable-pthread \ + CONFIG_PRIVOXY_disable-dynamic-pcre \ + CONFIG_PRIVOXY_disable-zlib \ + \ + CONFIG_PRIVOXY_disable-toggle \ + CONFIG_PRIVOXY_disable-force \ + CONFIG_PRIVOXY_disable-fast-redirects \ + CONFIG_PRIVOXY_disable-stats \ + CONFIG_PRIVOXY_enable-ie-images \ + CONFIG_PRIVOXY_disable-image-blocking \ + CONFIG_PRIVOXY_disable-acl-support \ + CONFIG_PRIVOXY_disable-trust-files \ + CONFIG_PRIVOXY_disable-editor \ + CONFIG_PRIVOXY_enable-no-gifs \ + CONFIG_PRIVOXY_enable-graceful-termination \ + CONFIG_PRIVOXY_enable-extended-host-patterns \ + CONFIG_PRIVOXY_enable-external-filters \ + CONFIG_PRIVOXY_enable-accept-filter \ + CONFIG_PRIVOXY_enable-strptime-sanity-checks \ + CONFIG_PRIVOXY_enable-compression + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SECTION:=net + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + TITLE:=Privoxy WEB Proxy + URL:=http://www.privoxy.org/ + USERID:=privoxy=8118:privoxy=8118 + MENU:=1 + DEPENDS:=+!PRIVOXY_no_pcre:libpcre +!PRIVOXY_no_pthread:libpthread +!PRIVOXY_no_zlib:zlib +endef + +# shown in LuCI package description +define Package/$(PKG_NAME)/description +$(TITLE) - Homepage: www.privoxy.org +endef + +# shown in make menuconfig +define Package/$(PKG_NAME)/config + help + Privoxy is a web proxy with advanced filtering capabilities for protecting + privacy, modifying web page content, managing cookies, controlling access, + and removing ads, banners, pop-ups and other obnoxious Internet junk. + Privoxy has a very flexible configuration and can be customized to suit + individual needs and tastes. + Privoxy has application for both stand-alone systems and multi-user networks. + Run as : $(USERID) + Version: $(PKG_VERSION)-$(PKG_RELEASE) + Home : $(URL) + $(PKG_MAINTAINER) + + source "$(SOURCE)/Config.in" +endef + +CONFIGURE_ARGS += \ + --sysconfdir=/etc/privoxy \ + $(if $(CONFIG_IPV6),,--disable-ipv6-support) \ + \ + $(if $(CONFIG_PRIVOXY_disable-pthread),--disable-pthread) \ + $(if $(CONFIG_PRIVOXY_disable-dynamic-pcre),--disable-dynamic-pcre) \ + $(if $(CONFIG_PRIVOXY_disable-zlib),--disable-zlib) \ + \ + $(if $(CONFIG_PRIVOXY_disable-toggle),--disable-toggle) \ + $(if $(CONFIG_PRIVOXY_disable-force),--disable-force) \ + $(if $(CONFIG_PRIVOXY_disable-fast-redirects),--disable-fast-redirects) \ + $(if $(CONFIG_PRIVOXY_disable-stats),--disable-stats) \ + $(if $(CONFIG_PRIVOXY_enable-ie-images),--enable-ie-images) \ + $(if $(CONFIG_PRIVOXY_disable-image-blocking),--disable-image-blocking) \ + $(if $(CONFIG_PRIVOXY_disable-acl-support),--disable-acl-support) \ + $(if $(CONFIG_PRIVOXY_disable-trust-files),--disable-trust-files) \ + $(if $(CONFIG_PRIVOXY_disable-editor),--disable-editor) \ + $(if $(CONFIG_PRIVOXY_enable-no-gifs),--enable-no-gifs) \ + $(if $(CONFIG_PRIVOXY_enable-graceful-termination),--enable-graceful-termination) \ + $(if $(CONFIG_PRIVOXY_enable-extended-host-patterns),--enable-extended-host-patterns) \ + $(if $(CONFIG_PRIVOXY_enable-external-filters),--enable-external-filters) \ + $(if $(CONFIG_PRIVOXY_enable-accept-filter),--enable-accept-filter) \ + $(if $(CONFIG_PRIVOXY_enable-strptime-sanity-checks),--enable-strptime-sanity-checks) \ + $(if $(CONFIG_PRIVOXY_enable-compression),--enable-compression) + +# needed otherwise errors during compile +MAKE_FLAGS:= + +define Package/$(PKG_NAME)/conffiles +/etc/config/privoxy +/etc/privoxy/user.action +/etc/privoxy/user.filter +/etc/privoxy/user.trust +endef + +define Package/$(PKG_NAME)/preinst + #!/bin/sh + [ -n "$${IPKG_INSTROOT}" ] && exit 0 # if run within buildroot exit + + # stop service if PKG_UPGRADE + [ "$${PKG_UPGRADE}" = "1" ] && /etc/init.d/privoxy stop >/dev/null 2>&1 + + exit 0 # suppress errors from stop command +endef + +define Package/$(PKG_NAME)/install + if [ -f $(PKG_INSTALL_DIR)/etc/privoxy/trust ]; then \ + mv -f $(PKG_INSTALL_DIR)/etc/privoxy/trust $(PKG_INSTALL_DIR)/etc/privoxy/user.trust; \ + fi + if [ -f $(PKG_INSTALL_DIR)/etc/privoxy/config ]; then \ + rm -f $(PKG_INSTALL_DIR)/etc/privoxy/config; \ + fi + + $(INSTALL_DIR) \ + $(1)/usr/sbin\ + $(1)/etc/privoxy/templates + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/privoxy $(1)/usr/sbin/ + find $(PKG_INSTALL_DIR)/etc/privoxy/templates -maxdepth 1 -type f \ + -exec $(INSTALL_DATA) -t $(1)/etc/privoxy/templates {} \; + find $(PKG_INSTALL_DIR)/etc/privoxy -maxdepth 1 -type f \ + -exec install -m0664 -t $(1)/etc/privoxy {} \; + + $(INSTALL_DIR) \ + $(1)/lib/upgrade/keep.d \ + $(1)/etc/init.d \ + $(1)/etc/hotplug.d/iface \ + $(1)/etc/config + $(INSTALL_DATA) ./files/privoxy.upgrade $(1)/lib/upgrade/keep.d/privoxy + $(INSTALL_BIN) ./files/privoxy.init $(1)/etc/init.d/privoxy + $(INSTALL_BIN) ./files/privoxy.hotplug $(1)/etc/hotplug.d/iface/95-privoxy + $(INSTALL_CONF) ./files/privoxy.config $(1)/etc/config/privoxy +endef + +define Package/$(PKG_NAME)/postinst + #!/bin/sh + grep -i privoxy $${IPKG_INSTROOT}/etc/services >/dev/null 2>&1 || \ + echo -e "privoxy\t8118" >> $${IPKG_INSTROOT}/etc/services +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/net/privoxy/files/privoxy.config b/net/privoxy/files/privoxy.config new file mode 100644 index 0000000..95b6cf1 --- /dev/null +++ b/net/privoxy/files/privoxy.config @@ -0,0 +1,44 @@ +# this file support all available configuration options of Privoxy web-proxy +# the scripts move all options to the final privoxy readable configuration file +# +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# !!! privoxy uses "-" in option names but uci only support "_" !!! +# !!! privoxy "listen-address" must be uci "listen_address" !!! +# !!! !!! +# !!! if you add entries please use !!! +# !!! option for options with one parameter (option confdir) !!! +# !!! list for options with multiple parameters (list listen_address) !!! +# !!! !!! +# !!! special handling for debug option !!! +# !!! privoxy option "debug 1024" must be uci option debug_1024 '1' !!! +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# +config privoxy 'privoxy' + option confdir '/etc/privoxy' + option logdir '/var/log' + option logfile 'privoxy.log' + list filterfile 'default.filter' +# list filterfile 'user.filter' + list actionsfile 'match-all.action' + list actionsfile 'default.action' +# list actionsfile 'user.action' +# list listen_address '127.0.0.1:8118' + list listen_address '192.168.1.1:8118' + option toggle '1' + option enable_remote_toggle '1' + option enable_remote_http_toggle '0' + option enable_edit_actions '1' + option enforce_blocks '0' + option buffer_limit '4096' + option forwarded_connect_retries '0' + option accept_intercepted_requests '0' + option allow_cgi_request_crunching '0' + option split_large_forms '0' + option keep_alive_timeout '300' + option socket_timeout '300' + list permit_access '192.168.1.0/24' + option debug_1 '0' + option debug_512 '1' + option debug_1024 '0' + option debug_4096 '1' + option debug_8192 '1' diff --git a/net/privoxy/files/privoxy.hotplug b/net/privoxy/files/privoxy.hotplug new file mode 100644 index 0000000..2673b20 --- /dev/null +++ b/net/privoxy/files/privoxy.hotplug @@ -0,0 +1,20 @@ +#!/bin/sh + +# only (re-)start on ifup +[ "$ACTION" = "ifup" ] || exit 0 +# only start if boot_delay is done +[ -f /tmp/privoxy.hotplug ] || exit 0 + +PIDFILE=/var/run/privoxy.pid + +_PID=$(cat $PIDFILE 2>/dev/null) +kill -1 $_PID 2>/dev/null +if [ $? -eq 0 ]; then + # only restart if already running + logger -p daemon.info -t "privoxy[$_PID]" \ + "Restart request due to '$ACTION' of interface '$INTERFACE'" + /etc/init.d/privoxy restart +else + # only start if enabled + /etc/init.d/privoxy enabled && /etc/init.d/privoxy start +fi diff --git a/net/privoxy/files/privoxy.init b/net/privoxy/files/privoxy.init new file mode 100644 index 0000000..b2592b3 --- /dev/null +++ b/net/privoxy/files/privoxy.init @@ -0,0 +1,175 @@ +#!/bin/sh /etc/rc.common + +START=95 +STOP=10 + +PIDFILE=/var/run/privoxy.pid +CFGFILE=/var/etc/privoxy.conf +CFGTEMP=/var/etc/privoxy.conf.tmp + +_uci2conf() { + # redefined callback for options when calling config_load + config_cb() { + if [ ."$2" != ."privoxy" ]; then + option_cb() { return 0; } + else + option_cb() + { + # $1 name of variable + # $2 value + local __OPT="$1" + local __VAL="$2" + case $__OPT in + confdir|templdir|temporary_directory|logdir|logfile) + # needs to be handled separately because we need to set permissions + # AND needs to be defined first because of a BUG inside privoxy + # require directories to be defined first inside config + ;; + debug_*) + [ $__VAL -eq 0 ] && return # not set ignore + echo -e "debug\t$(echo $__OPT | sed -e 's#debug_##g')" >> $CFGTEMP ;; + *) + # detect list options (LENGTH) and ignore + echo $__OPT | grep -i "_LENGTH" >/dev/null 2>&1 && return + # detect list options (ITEM) and ignore + echo $__OPT | grep -i "_ITEM" >/dev/null 2>&1 && __OPT=$(echo $__OPT | sed -e "s#_ITEM.*##g") + # uci only accept "_" but we need "-" + local __OPT=$(echo $__OPT | sed -e "s#_#-#g") + # write to config + echo -e "$__OPT\t$__VAL" >> $CFGTEMP + ;; + esac + } + fi + } + + # temporary config file + # privoxy need read access + mkdir -m0755 -p /var/etc + echo "" > $CFGTEMP + chmod 644 $CFGTEMP + chgrp privoxy $CFGTEMP + + echo '### AUTO-GENERATED CONFIGURATION' >> $CFGTEMP + echo '### USED BY PRIVOXY' >> $CFGTEMP + echo '### DO NOT EDIT' >> $CFGTEMP + echo '### SEE /etc/config/privoxy INSTEAD' >> $CFGTEMP + echo '' >> $CFGTEMP + + # logdir and logfile + # privoxy needs read/write access + _LOGDIR=$(uci -q get privoxy.privoxy.logdir) || _LOGDIR="/var/log" + _LOGFILE=$(uci -q get privoxy.privoxy.logfile) || _LOGFILE="privoxy.log" + mkdir -m0755 -p $_LOGDIR + touch $_LOGDIR/$_LOGFILE + chmod 664 $_LOGDIR/$_LOGFILE + chown privoxy:privoxy $_LOGDIR/$_LOGFILE + echo -e "logdir\t$_LOGDIR" >> $CFGTEMP + echo -e "logfile\t$_LOGFILE" >> $CFGTEMP + + # confdir + # privoxy needs read access (possibly write access) + _CONFDIR=$(uci -q get privoxy.privoxy.confdir) || _CONFDIR="/etc/privoxy" + chmod 755 $_CONFDIR + chmod 664 $_CONFDIR/* + chgrp privoxy $_CONFDIR $_CONFDIR/* + echo -e "confdir\t$_CONFDIR" >> $CFGTEMP + + # templdir + # privoxy need read access + _TEMPLDIR=$(uci -q get privoxy.privoxy.templdir) # no default needed + if [ -z "$_TEMPLDIR" ]; then + chmod 755 $_CONFDIR/templates + chmod 644 $_CONFDIR/templates/* + chgrp privoxy $_CONFDIR/templates $_CONFDIR/templates/* + else + chmod 755 $_TEMPLDIR + chmod 644 $_TEMPLDIR/* + chgrp privoxy $_TEMPLDIR $_TEMPLDIR/* + echo -e "templdir\t$_TEMPLDIR" >> $CFGTEMP + fi + + # temporary-directory + # privoxy needs read/write access + _TMP_DIR=$(uci -q get privoxy.privoxy.temporary_directory) # no default needed + if [ -n "$_TMP_DIR" ]; then + mkdir -m0750 -p $_TMP_DIR + chown privoxy:privoxy $_TMP_DIR + echo -e "temporary-directory\t$_TMP_DIR" >> $CFGTEMP + fi + + config_load "privoxy" # calling above option_cb() and write the rest into $CFGTEMP + + # move temp to final privoxy readable configuration + mv -f $CFGTEMP $CFGFILE + return 0 +} + +boot() { + # wait a given time (default 10 seconds) before startup + # to wait for interfaces to come up / not using hotplug events during boot + _start() { + [ $1 -gt 0 ] && { + logger -p daemon.info -t "privoxy[]" "Scheduled startup in $1 seconds" + sleep $1 + } + start + } + + local _DELAY + _DELAY=$(uci_get "privoxy" "system" "boot_delay" "10") + _start $_DELAY & + return 0 +} + +shutdown() { + rm -f /tmp/privoxy.hotplug + stop +} + +start() { + # if already running do nothing + local _PID=$(cat $PIDFILE 2>/dev/null) + kill -1 $_PID 2>/dev/null && return 0 + + _uci2conf + /usr/sbin/privoxy --pidfile $PIDFILE --user privoxy.privoxy $CFGFILE + touch /tmp/privoxy.hotplug + + # verify startup + _PID=$(cat $PIDFILE 2>/dev/null) + kill -1 $_PID 2>/dev/null + local _ERR=$? + [ $_ERR -eq 0 ] \ + && logger -p daemon.notice -t "privoxy[$_PID]" "Started successfully"\ + || logger -p daemon.warn -t "privoxy[]" "Failed to start" + return $_ERR +} + +reload() { + # reload is also used by luci-app-privoxy + local _PID=$(cat $PIDFILE 2>/dev/null) + kill -1 $_PID 2>/dev/null + if [ $? -eq 0 ]; then + # only restart if already running + restart + else + # only start if enabled + enabled && start + fi + return 0 +} + +stop() { + local _PID=$(cat $PIDFILE 2>/dev/null) + kill -15 $_PID 2>/dev/null + sleep 1 # give time to shutdown + local _tmp=$(pgrep privoxy | tr "\n" " ") + if [ -z "$_tmp" ]; then + logger -p daemon.notice -t "privoxy[$_PID]" "Shutdown successfully" + else + kill -9 $_tmp # Normally never come here + logger -p daemon.warn -t "privoxy[$_tmp]" "Shutdown forced by KILL" + fi + return 0 +} diff --git a/net/privoxy/files/privoxy.upgrade b/net/privoxy/files/privoxy.upgrade new file mode 100644 index 0000000..ef198a2 --- /dev/null +++ b/net/privoxy/files/privoxy.upgrade @@ -0,0 +1,4 @@ +/etc/config/privoxy +/etc/privoxy/user.action +/etc/privoxy/user.filter +/etc/privoxy/user.trust diff --git a/net/prosody/Makefile b/net/prosody/Makefile new file mode 100644 index 0000000..0942a62 --- /dev/null +++ b/net/prosody/Makefile @@ -0,0 +1,124 @@ +# +# Copyright (C) 2009-2011 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:=prosody +PKG_VERSION:=0.9.10 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://prosody.im/downloads/source +PKG_MD5SUM:=ef6d4a9e6dcae577eb52f7277d7beac5 +PKG_MAINTAINER:=Thomas Heil +PKG_LICENSE:=MIT/X11 + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/prosody + SECTION:=net + CATEGORY:=Network + SUBMENU:=Instant Messaging + DEPENDS:=+luafilesystem +libidn +luaexpat +luasec +libopenssl +libidn +liblua + TITLE:=XMPP server + URL:=http://prosody.im/ + USERID:=prosody=54:prosody=54 +endef + +define Package/prosody/description + Prosody is an exciting new server for Jabber/XMPP + written in Lua. It aims to be easy to use, and light + on resources +endef + +define Package/prosody/conffiles +/etc/prosody/prosody.cfg.lua +endef + +TARGET_CFLAGS += $(FPIC) + +TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib + + +define Build/Configure + # this is *NOT* GNU autoconf stuff + (cd $(PKG_BUILD_DIR); ./configure \ + --prefix=/usr \ + --with-lua="$(STAGING_DIR)/host/bin" \ + --with-lua-include="$(STAGING_DIR)/usr/include" \ + --with-lua-lib="$(STAGING_DIR)/usr/lib" \ + --cflags="$(TARGET_CFLAGS)" \ + --ldflags="$(TARGET_LDFLAGS) -llua -lm -ldl -shared" \ + --c-compiler="$(CC)" \ + --linker="$(LD)" \ + --datadir="/etc/prosody/data" \ + ) +endef +# LDFLAGS="$(TARGET_LDFLAGS) -llua -lm -ldl" \ + +MAKE_FLAGS += \ + CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -std=gnu99" \ + PREFIX="/usr" \ + +define Package/prosody/install + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/prosody.init $(1)/etc/init.d/prosody + $(INSTALL_DIR) $(1)/etc/prosody + #$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/prosody/prosody.cfg.lua $(1)/etc/prosody/ + $(INSTALL_CONF) ./files/prosody.cfg.lua $(1)/etc/prosody/ + $(INSTALL_DIR) $(1)/etc/prosody/certs + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/prosody/certs/localhost.{crt,key} $(1)/etc/prosody/certs/ + $(INSTALL_DIR) $(1)/etc/prosody/data + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/prosody{,ctl} $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib/prosody + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/prosody/prosody.version $(1)/usr/lib/prosody/ + $(INSTALL_DIR) $(1)/usr/lib/prosody/core + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/core/*.lua $(1)/usr/lib/prosody/core/ + $(INSTALL_DIR) $(1)/usr/lib/prosody/fallbacks + #$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/fallbacks/*.lua $(1)/usr/lib/prosody/fallbacks/ + $(INSTALL_DIR) $(1)/usr/lib/prosody/modules + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/modules/*.lua $(1)/usr/lib/prosody/modules/ + $(INSTALL_DIR) $(1)/usr/lib/prosody/modules/adhoc + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/modules/adhoc/*.lua $(1)/usr/lib/prosody/modules/adhoc/ + $(INSTALL_DIR) $(1)/usr/lib/prosody/modules/mod_s2s + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/modules/mod_s2s/*.lua $(1)/usr/lib/prosody/modules/mod_s2s/ + $(INSTALL_DIR) $(1)/usr/lib/prosody/modules/muc + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/modules/muc/*.lua $(1)/usr/lib/prosody/modules/muc/ + $(INSTALL_DIR) $(1)/usr/lib/prosody/modules/storage + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/modules/storage/*.lua $(1)/usr/lib/prosody/modules/storage/ + $(INSTALL_DIR) $(1)/usr/lib/prosody/net + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/net/*.lua $(1)/usr/lib/prosody/net/ + $(INSTALL_DIR) $(1)/usr/lib/prosody/net/http + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/net/http/*.lua $(1)/usr/lib/prosody/net/http/ + $(INSTALL_DIR) $(1)/usr/lib/prosody/util + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/util/*.lua $(1)/usr/lib/prosody/util/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/prosody/util/*.so $(1)/usr/lib/prosody/util/ + $(INSTALL_DIR) $(1)/usr/lib/prosody/util/sasl + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/util/sasl/*.lua $(1)/usr/lib/prosody/util/sasl/ + #$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/prosody/util/sasl/*.so $(1)/usr/lib/prosody/util/sasl/ +endef + +define Package/prosody/postinst +#!/bin/sh +[ -n "$${IPKG_INSTROOT}" ] || { + echo "Fixing lua with paxctl if needed!!!" + [ -f /sbin/paxctl ] && { + paxctl -v /usr/bin/ > /dev/null 2>&1 + [ $$? -ne 0 ] && { + cp /usr/bin/lua /tmp + paxctl -c -m /tmp/lua > /dev/null 2>&1 + cp -f /tmp/lua /usr/bin/lua + } + } + exit 0 +} +endef + +$(eval $(call BuildPackage,prosody)) diff --git a/net/prosody/files/prosody.cfg.lua b/net/prosody/files/prosody.cfg.lua new file mode 100644 index 0000000..0fe4216 --- /dev/null +++ b/net/prosody/files/prosody.cfg.lua @@ -0,0 +1,170 @@ +-- Prosody Example Configuration File +-- +-- Information on configuring Prosody can be found on our +-- website at http://prosody.im/doc/configure +-- +-- Tip: You can check that the syntax of this file is correct +-- when you have finished by running: luac -p prosody.cfg.lua +-- If there are any errors, it will let you know what and where +-- they are, otherwise it will keep quiet. +-- +-- The only thing left to do is rename this file to remove the .dist ending, and fill in the +-- blanks. Good luck, and happy Jabbering! + + +---------- Server-wide settings ---------- +-- Settings in this section apply to the whole server and are the default settings +-- for any virtual hosts + +-- This is a (by default, empty) list of accounts that are admins +-- for the server. Note that you must create the accounts separately +-- (see http://prosody.im/doc/creating_accounts for info) +-- Example: admins = { "user1@example.com", "user2@example.net" } +admins = { } + +-- Enable use of libevent for better performance under high load +-- For more information see: http://prosody.im/doc/libevent +--use_libevent = true; + +-- This is the list of modules Prosody will load on startup. +-- It looks for mod_modulename.lua in the plugins folder, so make sure that exists too. +-- Documentation on modules can be found at: http://prosody.im/doc/modules +modules_enabled = { + + -- Generally required + "roster"; -- Allow users to have a roster. Recommended ;) + "saslauth"; -- Authentication for clients and servers. Recommended if you want to log in. + "tls"; -- Add support for secure TLS on c2s/s2s connections + "dialback"; -- s2s dialback support + "disco"; -- Service discovery + + -- Not essential, but recommended + "private"; -- Private XML storage (for room bookmarks, etc.) + "vcard"; -- Allow users to set vCards + --"privacy"; -- Support privacy lists + --"compression"; -- Stream compression + + -- Nice to have + "legacyauth"; -- Legacy authentication. Only used by some old clients and bots. + "version"; -- Replies to server version requests + "uptime"; -- Report how long server has been running + "time"; -- Let others know the time here on this server + "ping"; -- Replies to XMPP pings with pongs + "pep"; -- Enables users to publish their mood, activity, playing music and more + "register"; -- Allow users to register on this server using a client and change passwords + "adhoc"; -- Support for "ad-hoc commands" that can be executed with an XMPP client + + -- Admin interfaces + "admin_adhoc"; -- Allows administration via an XMPP client that supports ad-hoc commands + --"admin_telnet"; -- Opens telnet console interface on localhost port 5582 + + -- Other specific functionality + "posix"; -- POSIX functionality, sends server to background, enables syslog, etc. + --"bosh"; -- Enable BOSH clients, aka "Jabber over HTTP" + --"httpserver"; -- Serve static files from a directory over HTTP + --"groups"; -- Shared roster support + --"announce"; -- Send announcement to all online users + --"welcome"; -- Welcome users who register accounts + --"watchregistrations"; -- Alert admins of registrations + --"motd"; -- Send a message to users when they log in +}; + +-- These modules are auto-loaded, should you +-- (for some mad reason) want to disable +-- them then uncomment them below +modules_disabled = { + -- "presence"; -- Route user/contact status information + -- "message"; -- Route messages + -- "iq"; -- Route info queries + -- "offline"; -- Store offline messages +}; + +-- Disable account creation by default, for security +-- For more information see http://prosody.im/doc/creating_accounts +allow_registration = false; + +-- Only allow encrypted streams? Encryption is already used when +-- available. These options will cause Prosody to deny connections that +-- are not encrypted. Note that some servers do not support s2s +-- encryption or have it disabled, including gmail.com and Google Apps +-- domains. + +--c2s_require_encryption = false +--s2s_require_encryption = false + +-- Select the authentication backend to use. The 'internal' providers +-- use Prosody's configured data storage to store the authentication data. +-- To allow Prosody to offer secure authentication mechanisms to clients, the +-- default provider stores passwords in plaintext. If you do not trust your +-- server please see http://prosody.im/doc/modules/mod_auth_internal_hashed +-- for information about using the hashed backend. +-- See http://prosody.im/doc/authentication for other possibilities including +-- Cyrus SASL. + +authentication = "internal_plain" + +-- Select the storage backend to use. By default Prosody uses flat files +-- in its configured data directory, but it also supports more backends +-- through modules. An "sql" backend is included by default, but requires +-- additional dependencies. See http://prosody.im/doc/storage for more info. + +--storage = "sql" -- Default is "internal" + +-- For the "sql" backend, you can uncomment *one* of the below to configure: +--sql = { driver = "SQLite3", database = "prosody.sqlite" } -- Default. 'database' is the filename. +--sql = { driver = "MySQL", database = "prosody", username = "prosody", password = "secret", host = "localhost" } +--sql = { driver = "PostgreSQL", database = "prosody", username = "prosody", password = "secret", host = "localhost" } + +-- Logging configuration +-- For advanced logging see http://prosody.im/doc/logging +log = { + info = "/var/log/prosody/prosody.log"; -- Change 'info' to 'debug' for verbose logging + error = "/var/log/prosody/prosody.err"; + -- "*syslog"; -- Uncomment this for logging to syslog; needs mod_posix + -- "*console"; -- Log to the console, useful for debugging with daemonize=false +} + +-- Pidfile, used by prosodyctl and the init.d script +pidfile = "/var/run/prosody/prosody.pid" + +-- User and group, used for daemon +prosody_user = "prosody" +prosody_group = "prosody" + +----------- Virtual hosts ----------- +-- You need to add a VirtualHost entry for each domain you wish Prosody to serve. +-- Settings under each VirtualHost entry apply *only* to that host. + +VirtualHost "localhost" + +VirtualHost "example.com" + enabled = false -- Remove this line to enable this host + + -- Assign this host a certificate for TLS, otherwise it would use the one + -- set in the global section (if any). + -- Note that old-style SSL on port 5223 only supports one certificate, and will always + -- use the global one. + ssl = { + key = "/etc/prosody/certs/example.com.key"; + certificate = "/etc/prosody/certs/example.com.crt"; + } + +------ Components ------ +-- You can specify components to add hosts that provide special services, +-- like multi-user conferences, and transports. +-- For more information on components, see http://prosody.im/doc/components + +---Set up a MUC (multi-user chat) room server on conference.example.com: +--Component "conference.example.com" "muc" + +-- Set up a SOCKS5 bytestream proxy for server-proxied file transfers: +--Component "proxy.example.com" "proxy65" + +---Set up an external component (default component port is 5347) +-- +-- External components allow adding various services, such as gateways/ +-- transports to other networks like ICQ, MSN and Yahoo. For more info +-- see: http://prosody.im/doc/components#adding_an_external_component +-- +--Component "gateway.example.com" +-- component_secret = "password" diff --git a/net/prosody/files/prosody.init b/net/prosody/files/prosody.init new file mode 100644 index 0000000..322c3d2 --- /dev/null +++ b/net/prosody/files/prosody.init @@ -0,0 +1,46 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2011-2016 OpenWrt.org + +START=99 + +USE_PROCD=1 + +BIN=/usr/bin/prosodyctl +LOG_D=/var/log/prosody +RUN_D=/var/run/prosody +PID_F=$RUN_D/prosody.pid +RUN_USER=prosody +RUN_GROUP=prosody + +start_service() { + [ -d /var/run/prosody ] || { + mkdir -m 0755 -p /var/run/prosody + chown prosody:prosody /var/run/prosody + } + [ -d /var/log/prosody ] || { + mkdir -m 0755 -p /var/log/prosody + chown prosody:prosody /var/log/prosody + } + + [ -d /var/log/prosody ] && { + chown -R prosody:prosody /etc/prosody + } + + [ -f /sbin/paxctl ] && { + paxctl -v /usr/bin/ > /dev/null 2>&1 + [ $? -ne 0 ] && { + cp /usr/bin/lua /tmp + paxctl -c -m /tmp/lua + cp -f /tmp/lua /usr/bin/lua + } + } + + procd_open_instance + procd_set_param command "$BIN" start + procd_set_param file /etc/prosody/prosody.cfg.lua + procd_close_instance +} + +stop_service() { + ${BIN} stop +} diff --git a/net/quassel-irssi/Makefile b/net/quassel-irssi/Makefile new file mode 100644 index 0000000..09e5937 --- /dev/null +++ b/net/quassel-irssi/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2016 Ben Rosser +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=quassel-irssi + +# quassel-irssi upstream doesn't release versions (at least, at the moment), +# so use commit date for PKG_VERSION and embed commit hash into PKG_RELEASE. +PKG_VERSION:=2016-09-11 +PKG_SOURCE_VERSION:=cbd9bd7f4ac44260d9fcafb809fdf153cde193e5 +PKG_RELEASE:=1.$(PKG_SOURCE_VERSION) + +PKG_LICENSE:=GPL-3.0+ + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/phhusson/quassel-irssi +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.bz2 + +PKG_MAINTAINER:=Ben Rosser + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +MAKE_PATH := core +MAKE_VARS += SYSTEM_QUASSELC=1 IRSSI_CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" IRSSI_INCLUDE=$(STAGING_DIR)/usr/include/irssi + +define Package/quassel-irssi + SECTION:=net + CATEGORY:=Network + DEPENDS:=+irssi +quasselc + SUBMENU:=Instant Messaging + URL:=https://github.com/phhusson/quassel-irssi + TITLE:=An irssi plugin to connect to quassel core +endef + +define Package/quassel-irssi/description + An irssi plugin that supports connecting to a quassel core. +endef + +define Package/quassel-irssi/install + $(INSTALL_DIR) $(1)/usr/lib/irssi/modules/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/irssi/modules/libquassel_core.so* $(1)/usr/lib/irssi/modules/ +endef + +$(eval $(call BuildPackage,quassel-irssi)) diff --git a/net/quassel-irssi/patches/001-respect-cflags.patch b/net/quassel-irssi/patches/001-respect-cflags.patch new file mode 100644 index 0000000..b945915 --- /dev/null +++ b/net/quassel-irssi/patches/001-respect-cflags.patch @@ -0,0 +1,22 @@ +diff --git a/core/Makefile b/core/Makefile +index 6133087..389855c 100644 +--- a/core/Makefile ++++ b/core/Makefile +@@ -3,7 +3,7 @@ DESTDIR ?= + LIBDIR ?= /usr/lib + + #IRSSI_INCLUDE:=/home/phh/irssi-0.8.16-rc1.phh/ +-IRSSI_INCLUDE:=/usr/include/irssi/ ++IRSSI_INCLUDE?=/usr/include/irssi/ + IRSSI_LIB?=$(DESTDIR)/$(LIBDIR)/irssi + IRSSI_CFLAGS+=-I$(IRSSI_INCLUDE)/src/ + IRSSI_CFLAGS+=-I$(IRSSI_INCLUDE)/src/core/ +@@ -26,7 +26,7 @@ else + LDFLAGS += -lquasselc + endif + +-CFLAGS=-std=gnu11 -Wall -Wextra -Werror -g -O2 $(IRSSI_CFLAGS) $(QUASSELC_FLAGS) -Wmissing-prototypes -Wmissing-declarations ++CFLAGS+=-std=gnu11 -Wall -Wextra -Werror -g $(IRSSI_CFLAGS) $(QUASSELC_FLAGS) -Wmissing-prototypes -Wmissing-declarations + + TARGET=libquassel_core.so + diff --git a/net/quassel-irssi/patches/002-use-cc-var.patch b/net/quassel-irssi/patches/002-use-cc-var.patch new file mode 100644 index 0000000..6acb434 --- /dev/null +++ b/net/quassel-irssi/patches/002-use-cc-var.patch @@ -0,0 +1,13 @@ +diff --git a/core/Makefile b/core/Makefile +index 389855c..2f81417 100644 +--- a/core/Makefile ++++ b/core/Makefile +@@ -44,7 +44,7 @@ irssi/network-openssl.o: CFLAGS:=$(IRSSI_CFLAGS) + quasselc-connector.o: CFLAGS:=$(CFLAGS) + + $(TARGET): $(OBJECTS) +- gcc -shared $^ -o $@ -lz $(LDFLAGS) ++ $(CC) -shared $^ -o $@ -lz $(LDFLAGS) + + install: $(TARGET) + $(INSTALL) -d $(IRSSI_LIB)/modules diff --git a/net/quassel-irssi/patches/003-use-pkgconfig-ldflags-quasselc.patch b/net/quassel-irssi/patches/003-use-pkgconfig-ldflags-quasselc.patch new file mode 100644 index 0000000..3aef014 --- /dev/null +++ b/net/quassel-irssi/patches/003-use-pkgconfig-ldflags-quasselc.patch @@ -0,0 +1,13 @@ +diff --git a/core/Makefile b/core/Makefile +index 2f81417..aa62201 100644 +--- a/core/Makefile ++++ b/core/Makefile +@@ -23,7 +23,7 @@ ifndef SYSTEM_QUASSELC + QUASSELC_FLAGS:=-Ilib + else + QUASSELC_FLAGS:=$(shell pkg-config --cflags quasselc) +- LDFLAGS += -lquasselc ++ LDFLAGS += $(shell pkg-config --libs quasselc) + endif + + CFLAGS+=-std=gnu11 -Wall -Wextra -Werror -g -O2 $(IRSSI_CFLAGS) $(QUASSELC_FLAGS) -Wmissing-prototypes -Wmissing-declarations diff --git a/net/radicale/Makefile b/net/radicale/Makefile new file mode 100644 index 0000000..26cacd7 --- /dev/null +++ b/net/radicale/Makefile @@ -0,0 +1,146 @@ +# +# Copyright (C) 2008-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=radicale +PKG_VERSION:=1.1.1 +PKG_RELEASE:=2 +PKG_MAINTAINER:=Christian Schoenebeck + +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=COPYING + +PKG_SOURCE:=Radicale-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://pypi.python.org/packages/source/R/Radicale/ +PKG_MD5SUM:=a29dd538377ea24cec83237a636122ae + +# needed for "r"adicale <-> "R"adicale +PKG_BUILD_DIR:=$(BUILD_DIR)/Radicale-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) +$(call include_mk, python3-package.mk) + +# no default dependencies +PKG_DEFAULT_DEPENDS:= + +define Package/$(PKG_NAME)/Default + SECTION:=net + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + URL:=http://radicale.org/ + TITLE:=Radicale CalDAV/CardDAV server + PKGARCH:=all + USERID:=radicale=5232:radicale=5232 +endef +define Package/$(PKG_NAME)-py2 + $(call Package/$(PKG_NAME)/Default) + TITLE+= (Python 2) + VARIANT:=2 + DEPENDS:=+python-logging +python-openssl +python-xml +python-codecs +endef +define Package/$(PKG_NAME)-py3 + $(call Package/$(PKG_NAME)/Default) + TITLE+= (Python 3) + VARIANT:=3 + DEPENDS:=+python3-logging +python3-openssl +python3-xml +python3-codecs +python3-email +endef + +# shown in LuCI package description +define Package/$(PKG_NAME)-py2/description +Radicale CalDAV/CardDAV server (Python 2) - Homepage: http://radicale.org/ +endef +define Package/$(PKG_NAME)-py3/description +Radicale CalDAV/CardDAV server (Python 3) - Homepage: http://radicale.org/ +endef + +# shown in make menuconfig +define Package/$(PKG_NAME)-py2/config + help + The Radicale Project is a CalDAV (calendar) and CardDAV (contact) server. + It aims to be a light solution, easy to use, easy to install, easy to configure. + As a consequence, it requires few software dependances and is pre-configured to work out-of-the-box. + !!! Will install and use Python $(VARIANT) !!! + . + Version : $(PKG_VERSION) + Homepage: http://radicale.org/ +endef +Package/$(PKG_NAME)-py3/config = $(Package/$(PKG_NAME)-py2/config) + +define Package/$(PKG_NAME)-py2/conffiles +/etc/config/radicale +/etc/radicale/users +/etc/radicale/rights +endef +Package/$(PKG_NAME)-py3/conffiles = $(Package/$(PKG_NAME)-py2/conffiles) + +define Build/Configure + # nothing to configure +endef +define Build/Compile + # nothing to compile +endef + +define Package/$(PKG_NAME)-py2/preinst + #!/bin/sh + [ -n "$${IPKG_INSTROOT}" ] && exit 0 # if run within buildroot exit + + # stop service if PKG_UPGRADE + [ "$${PKG_UPGRADE}" = "1" ] && /etc/init.d/radicale stop >/dev/null 2>&1 + + exit 0 # suppress errors from stop command +endef +define Package/$(PKG_NAME)-py3/preinst +$(call Package/$(PKG_NAME)-py2/preinst) +endef + +define Package/$(PKG_NAME)/inst_all + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/radicale.init $(1)/etc/init.d/radicale + + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) ./files/radicale.hotplug $(1)/etc/hotplug.d/iface/80-radicale + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/radicale.config $(1)/etc/config/radicale + + $(INSTALL_DIR) $(1)/lib/upgrade/keep.d + $(INSTALL_DATA) ./files/radicale.upgrade $(1)/lib/upgrade/keep.d/radicale + + $(INSTALL_DIR) $(1)/etc/radicale/ssl + $(INSTALL_DATA) ./files/config.template $(1)/etc/radicale/config.template + $(INSTALL_DATA) ./files/logging.template $(1)/etc/radicale/logging.template + $(INSTALL_DATA) ./files/radicale.users $(1)/etc/radicale/users + $(INSTALL_DATA) ./files/radicale.rights $(1)/etc/radicale/rights + + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/radicale $(1)/usr/bin/ +endef +define Package/$(PKG_NAME)-py2/install + $(call Package/$(PKG_NAME)/inst_all, $(1)) + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/radicale + $(CP) $(PKG_BUILD_DIR)/radicale/* $(1)$(PYTHON_PKG_DIR)/radicale +endef +define Package/$(PKG_NAME)-py3/install + $(call Package/$(PKG_NAME)/inst_all, $(1)) + $(INSTALL_DIR) $(1)$(PYTHON3_PKG_DIR)/radicale + $(CP) $(PKG_BUILD_DIR)/radicale/* $(1)$(PYTHON3_PKG_DIR)/radicale +endef + +define Package/$(PKG_NAME)-py2/postinst + #!/bin/sh + # patch /usr/bin/radicale force run using python2 + /bin/sed -i 's/python/python2/' $${IPKG_INSTROOT}/usr/bin/radicale +endef +define Package/$(PKG_NAME)-py3/postinst + #!/bin/sh + # patch /usr/bin/radicale force run using python3 + /bin/sed -i 's/python/python3/' $${IPKG_INSTROOT}/usr/bin/radicale +endef + +$(eval $(call BuildPackage,$(PKG_NAME)-py2)) +$(eval $(call BuildPackage,$(PKG_NAME)-py3)) diff --git a/net/radicale/files/config.template b/net/radicale/files/config.template new file mode 100644 index 0000000..1b8fcf2 --- /dev/null +++ b/net/radicale/files/config.template @@ -0,0 +1,30 @@ +# -*- mode: conf -*- +# vim:ft=cfg + +### AUTO-GENERATED CONFIGURATION +### USED BY RADICALE +### DO NOT EDIT +### SEE /etc/config/radicale INSTEAD + +[server] +# daemon # handled by /etc/init.d/radicale +# pid # handled by /etc/init.d/radicale + +[encoding] + +[well-known] + +[auth] +# htpasswd_filename # hard-coded /etc/radicale/users + +[git] + +[rights] +# file # hard-coded /etc/radicale/rights + +[storage] + +[logging] +# config # hard-coded /var/etc/radicale/logging + +[headers] diff --git a/net/radicale/files/logging.template b/net/radicale/files/logging.template new file mode 100644 index 0000000..a730ca0 --- /dev/null +++ b/net/radicale/files/logging.template @@ -0,0 +1,47 @@ +# -*- mode: conf -*- +# vim:ft=cfg + +### AUTO-GENERATED CONFIGURATION +### USED BY RADICALE +### DO NOT EDIT +### SEE /etc/config/radicale INSTEAD + +[loggers] +keys = root + +[handlers] +keys = console,file,syslog + +[formatters] +keys = simple,full,syslog + +[logger_root] +level = DEBUG +handlers = console,file,syslog + +[handler_console] +class = StreamHandler +args = (sys.stdout,) +formatter = simple +# level = WARNING # set via /etc/config/radicale + +[handler_file] +class = handlers.RotatingFileHandler +formatter = full +# level = INFO # set via /etc/config/radicale +# args = ('[filename]','a',[maxbytes],[backupcount]) # set via /etc/config/radicale + +[handler_syslog] +class = handlers.SysLogHandler +args = ('/dev/log', handlers.SysLogHandler.LOG_DAEMON) +formatter = syslog +# level = WARNING # set via /etc/config/radicale + +[formatter_simple] +format = %(message)s + +[formatter_full] +format = %(asctime)s - %(levelname)s: %(message)s + +[formatter_syslog] +format = radicale [%(process)d]: %(message)s diff --git a/net/radicale/files/radicale.config b/net/radicale/files/radicale.config new file mode 100644 index 0000000..149ce2b --- /dev/null +++ b/net/radicale/files/radicale.config @@ -0,0 +1,200 @@ +# +# You find additional information on Radicale Homepage +# http://radicale.org +# +# OpenWrt's wiki needs to be setup/updated ;-) +# +# if setting additional options please remember that UCI does not support +# section names and option names with "-" (Dash) inside their name +# to use them anyway replace "-" with "_" (Underscore) +# Each Radicale's config [section] is setup as UCI config setting 'section' +# + +#################################################### +# OpenWrt specific settings +# not part of radicale package +# +config system 'radicale' + # delayed startup at boot (default 10 seconds) + # to wait for netifd to bring up interfaces + # during this time iface hotplug events are ignored +# option boot_delay '10' + +#################################################### +# Server options +# +config setting 'server' + + # hostname:port + # IPv4 syntax: address:port + # IPv6 syntax: [address]:port + # ATTENTION: + # only use ports > 1024 (non-privileged Ports) + # because this implementation is running as non-root user + # Default: 0.0.0.0:5232 +# list hosts '0.0.0.0:5232' +# list hosts 'localhost:5232' + + # SSL flag, enable HTTPS protocol + # Default: 0 (disabled) +# option ssl '1' + + # SSL Protocol used. See python's ssl module for available values + # Default: PROTOCOL_SSLv23 +# option protocol 'PROTOCOL_SSLv23' + + # Ciphers available. See python's ssl module for available ciphers +# option ciphers '' + + # SSL certificate path and file +# option certificate '/etc/radicale/ssl/server.crt' + + # SSL private key path and file +# option key '/etc/radicale/ssl/server.key' + + # Reverse DNS to resolve client address in logs + # Default: 0 (disabled) +# option dns_lookup '1' + + # Message displayed in the client when a password is needed +# option realm 'Radicale - Password Required' + + +#################################################### +# Encoding options +# +config setting 'encoding' + + # Encoding for responding requests +# option request 'utf-8' + + # Encoding for storing local collections +# option stock 'utf-8' + + +#################################################### +# Authentication options +# +config setting 'auth' + + # Authentication method + # Value: None | htpasswd | IMAP | LDAP | PAM | courier | http | remote_user | custom + # Default: None + # if setting 'htpasswd' the file /etc/radicale/users is used (hardcoded) + + # Htpasswd encryption method + # Value: plain | sha1 | ssha | crypt +# option htpasswd_encryption 'crypt' + + # for other authenication methods consult Radicale documentation + # and set options here + + +#################################################### +# Git default options +# +config setting 'git' + + # Git default options +# option committer 'Radicale ' + + +#################################################### +# Rights backend +# +config setting 'rights' + + # Value: None | authenticated | owner_only | owner_write | from_file | custom + # Default: None + # if setting 'from_file' the file /etc/radicale/rights is used (hardcoded) + + # Custom rights handler +# option custom_handler '' + + +#################################################### +# Storage backend +# ------- +# WARNING: ONLY "filesystem" IS DOCUMENTED AND TESTED, +# OTHER BACKENDS ARE NOT READY FOR PRODUCTION. +# ------- +# +config setting 'storage' + # Value: filesystem | multifilesystem | database | custom + option type 'filesystem' + option filesystem_folder '/srv/radicale' + + +#################################################### +# Additional HTTP headers +# +config setting 'headers' + # enable all if using CardDavMATE-, CalDavZAP- or InfCloud- WEBclient +# list Access_Control_Allow_Origin '*' +# list Access_Control_Allow_Methods 'GET' +# list Access_Control_Allow_Methods 'POST' +# list Access_Control_Allow_Methods 'OPTIONS' +# list Access_Control_Allow_Methods 'PROPFIND' +# list Access_Control_Allow_Methods 'PROPPATCH' +# list Access_Control_Allow_Methods 'REPORT' +# list Access_Control_Allow_Methods 'PUT' +# list Access_Control_Allow_Methods 'MOVE' +# list Access_Control_Allow_Methods 'DELETE' +# list Access_Control_Allow_Methods 'LOCK' +# list Access_Control_Allow_Methods 'UNLOCK' +# list Access_Control_Allow_Headers 'User-Agent' +# list Access_Control_Allow_Headers 'Authorization' +# list Access_Control_Allow_Headers 'Content-type' +# list Access_Control_Allow_Headers 'Depth' +# list Access_Control_Allow_Headers 'If-match' +# list Access_Control_Allow_Headers 'If-None-Match' +# list Access_Control_Allow_Headers 'Lock-Token' +# list Access_Control_Allow_Headers 'Timeout' +# list Access_Control_Allow_Headers 'Destination' +# list Access_Control_Allow_Headers 'Overwrite' +# list Access_Control_Allow_Headers 'X-client' +# list Access_Control_Allow_Headers 'X-Requested-With' +# list Access_Control_Expose_Headers 'Etag' + + +#################################################### +# Global logging options +# +config setting 'logging' + + # Set the default logging level to debug for all outputs (ignore output level settings) + # Default: 0 (disabled) +# option debug '1' + # Log all environment variables (including those set in the shell) when starting + # Default: 0 (disabled) +# option full_environment '1' + + +#################################################### +# Spezial logging options +# !!! not documented in Radicale documentation +# !!! special settings for this implementation +# +config logging 'logger' + + # Level: DEBUG | INFO | WARNING | ERROR | CRITICAL + # To nearly disable logging set level to critical + + # log level on console +# option console_level 'ERROR' + + # Here we use Rotating Logfiles in this implementation + # !!! if maxbytes and/or backupcount is set to 0 !!! + # !!! file rotation is disabled and logfile grows endless !!! + # log level +# option file_level 'INFO' + # directory where log files are written +# option file_path '/var/log/radicale' + # max size of each logfile (see warning above) +# option file_maxbytes '8196' + # number of backup files to create (see warning above) +# option file_backupcount '1' + + # log level for syslog logging +# option syslog_level 'WARNING' + diff --git a/net/radicale/files/radicale.hotplug b/net/radicale/files/radicale.hotplug new file mode 100644 index 0000000..aeb7c41 --- /dev/null +++ b/net/radicale/files/radicale.hotplug @@ -0,0 +1,18 @@ +#!/bin/sh + +# only (re-)start on ifup +[ "$ACTION" = "ifup" ] || exit 0 +# only start if boot_delay is done +[ -f /tmp/radicale.hotplug ] || exit 0 + +_PID=$(ps | grep '[p]ython.*[r]adicale' 2>/dev/null | awk '{print $1}') +kill -1 $_PID 2>/dev/null +if [ $? -eq 0 ]; then + # only restart if already running + logger -p user.info -t "radicale[$_PID]" \ + "Restart request due to '$ACTION' of interface '$INTERFACE'" + /etc/init.d/radicale restart +else + # only start if enabled + /etc/init.d/radicale enabled && /etc/init.d/radicale start +fi diff --git a/net/radicale/files/radicale.init b/net/radicale/files/radicale.init new file mode 100755 index 0000000..4fb9bbb --- /dev/null +++ b/net/radicale/files/radicale.init @@ -0,0 +1,236 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2016 OpenWrt.org + +START=80 +STOP=10 + +CFGDIR=/var/etc/radicale +SYSCFG=$CFGDIR/config +LOGCFG=$CFGDIR/logging + +DATADIR="/srv/radicale" +LOGDIR="" + +PGREP="ps | grep '[p]ython.*[r]adicale' 2>/dev/null | awk '{print \$1}' " + +# we could start with empty configuration file using defaults +[ -f /etc/config/radicale ] || touch /etc/config/radicale + +_uci2radicale() { + local _SYSTMP="$SYSCFG.tmp" + local _LOGTMP="$LOGCFG.tmp" + local _LOPT # list option name + local _LVAL # list option value + local _STYPE # section type + local _SNAME # section name + local _console_level="ERROR" # logging console level + local _file_level="INFO" # logging file level + local _file_path="/var/log/radicale" # logging file path + local _file_maxbytes="8196" # logging file maxBytes + local _file_backupcount="1" # logging file backupCount + local _syslog_level="WARNING" # logging syslog level + + # write list values to config + _write_list() { + _write_value "$_LOPT" "$_LVAL" # there might be spaces in _LVAL + _LOPT="" + _LVAL="" + } + + _write_value() { + # $1 option + # $2 value + local __OPT=$1 + local __VAL=$2 + # section "server" ignore option "daemon" and "pid" + [ "$_SNAME" = "server" -a "$__OPT" = "daemon" ] && return 0 + [ "$_SNAME" = "server" -a "$__OPT" = "pid" ] && return 0 + # section "logging" ignore option "config" (logging config file) + [ "$_SNAME" = "logging" -a "$__OPT" = "config" ] && return 0 + # section "auth" ignore option "htpasswd_filename" (htpasswd file) + [ "$_SNAME" = "auth" -a "$__OPT" = "htpasswd_filename" ] && return 0 + # section "rights" ignore option "file" (reg-based rights file) + [ "$_SNAME" = "rights" -a "$__OPT" = "file" ] && return 0 + # section "headers" replace "_" with "-" in option (UCI problem) + [ "$_SNAME" = "headers" ] && __OPT=$(echo "$__OPT" | sed -e "s#_#-#g") + # save data driectory + [ "$_SNAME" = "storage" -a "$__OPT" = "filesystem_folder" ] && DATADIR="$__VAL" + # special handling for well-known, value needs single quotes + [ "$_SNAME" = "well-known" -a "${__VAL#*\%\(}" != "$__VAL" ] && __VAL="'$__VAL'" + # handling of log settings + if [ "$_STYPE" = "logging" -a "$_SNAME" = "logger" ]; then + eval "_$__OPT='$__VAL'" # set to environment for later use + else + # handle bool + [ "$__VAL" = "0" ] && __VAL="False" + [ "$__VAL" = "1" ] && __VAL="True" + # append data to the corresponding section + sed -i "/\[$_SNAME\]/a $__OPT = $__VAL" $_SYSTMP + fi + } + + # redefined callback for sections when calling config_load + config_cb() { + # $1 "Type" + # $2 "Name" + # write out last list option + [ -n "$_LOPT" ] && _write_list + # mark invalid + _STYPE="" + _SNAME="" + # check section type + [ "$1" = "setting" -o "$1" = "logging" ] && { + _STYPE="$1" + _SNAME="$2" + } + # translate section name + [ "$2" = "well_known" ] && _SNAME="well-known" + return 0 + } + + # redefined callback for lists when calling config_load + list_cb() { + # $1 name of variable + # $2 value + # invalid section type then ignore + [ -z "$_STYPE" -o -z "$_SNAME" ] && return 0 + # write out last list option if new list starts + [ -n "$_LOPT" -a "$_LOPT" != "$1" ] && _write_list + # new list option + if [ -z "$_LOPT" ]; then + _LOPT="$1" + _LVAL="$2" + else + _LVAL="$_LVAL, $2" + fi + return 0 + } + + # redefined callback for options when calling config_load + option_cb() { + # $1 name of variable + # $2 value + local __OPT="$1" + local __VAL="$2" + # invalid section type then ignore + [ -z "$_STYPE" -o -z "$_SNAME" ] && return 0 + # ignore list entrys will be handled by list_cb() + [ "${__OPT#*_ITEM}" != "$__OPT" ] && return 0 # ignore lists *_ITEM* + [ "${__OPT#*_LENGTH}" != "$__OPT" ] && return 0 # ignore lists *_LENGTH + # write out last list option and clear + [ -n "$_LOPT" ] && _write_list + # write to file + _write_value "$__OPT" "$__VAL" # there might be spaces in __VAL + return 0 + } + + # temporary config file + # radicale need read access + mkdir -m0755 -p $CFGDIR + + cp /etc/radicale/config.template $_SYSTMP + config_load radicale # calling above config_cb()/option_cb()/list_cb() and write into $_SYSTMP + sed -i "/\[logging\]/a config = /var/etc/radicale/logging" $_SYSTMP # hard-code logging config + sed -i "/\[auth\]/a htpasswd_filename = /etc/radicale/users" $_SYSTMP # hard-code htpasswd + sed -i "/\[rights\]/a file = /etc/radicale/rights" $_SYSTMP # hard-code regexp-based rights + + # temporary logging config file + cp /etc/radicale/logging.template $_LOGTMP + LOGDIR="$_file_path" + sed -i "/\[handler_console\]/a level = $_console_level" $_LOGTMP + sed -i "/\[handler_file\]/a level = $_file_level" $_LOGTMP + sed -i "/\[handler_file\]/a args = ('$_file_path/radicale','a',$_file_maxbytes,$_file_backupcount)" $_LOGTMP + sed -i "/\[handler_syslog\]/a level = $_syslog_level" $_LOGTMP + + # move tmp to final + mv -f $_SYSTMP $SYSCFG + mv -f $_LOGTMP $LOGCFG +} + +_set_permission() { + # config file permissions (read access for group) + chmod 644 $SYSCFG $LOGCFG + chgrp -R radicale $CFGDIR + # log directory (full access and owner) + [ -d $LOGDIR ] || mkdir -m0755 -p $LOGDIR + chown -R radicale:radicale $LOGDIR + # data directory does not exist + [ -d $DATADIR ] || { + logger -p user.error -t "radicale[----]" "Data directory '$DATADIR' does not exists. Startup failed !!!" + exit 1 + } + chgrp -R radicale $DATADIR +} + +boot() { + # wait a given time (default 10 seconds) before startup + # to wait for interfaces to come up / not using hotplug events during boot + _start() { + [ $1 -gt 0 ] && sleep $1 + start + } + + local _DELAY + _DELAY=$(uci_get "radicale" "system" "boot_delay" "10") + _start $_DELAY & + return 0 +} + +shutdown() { + rm -f /tmp/radicale.hotplug + stop +} + +start() { + _running() { + sleep 2 # give radicale time to completely come up + local _PID=$(eval "$PGREP") + kill -1 $_PID 2>/dev/null + [ $? -eq 0 ] \ + && logger -p user.notice -t "radicale[$_PID]" "Service started successfully"\ + || logger -p user.warn -t "radicale[----]" "Service failed to start" + } + + # if already running do nothing + local _PID=$(eval "$PGREP") + kill -1 $_PID 2>/dev/null && return 0 + + _uci2radicale + _set_permission + + radicale --daemon --config=$SYSCFG + touch /tmp/radicale.hotplug + + _running & # check if running and syslog + + return 0 +} + +reload() { + # reload is also used by luci + local _PID=$(eval "$PGREP") + kill -1 $_PID 2>/dev/null + if [ $? -eq 0 ]; then + # only restart if already running + restart + else + # only start if enabled + enabled && start + fi + return 0 +} + +stop() { + local _PID=$(eval "$PGREP") + [ -z "$_PID" ] && return 0 # not running + kill -15 $_PID 2>/dev/null + sleep 3 # give time to shutdown + local _tmp=$(eval "$PGREP") + if [ -z "$_tmp" ]; then + logger -p user.notice -t "radicale[$_PID]" "Service shutdown successfully" + else + kill -9 $_tmp # Normally never come here + logger -p user.warn -t "radicale[----]" "Service shutdown FORCED" + fi + return 0 +} diff --git a/net/radicale/files/radicale.rights b/net/radicale/files/radicale.rights new file mode 100644 index 0000000..3de3955 --- /dev/null +++ b/net/radicale/files/radicale.rights @@ -0,0 +1,49 @@ +# +# Authentication login is matched against the "user" key, and collection's path is matched against the "collection" key. +# You can use Python's ConfigParser interpolation values %(login)s and %(path)s. +# You can also get groups from the user regex in the collection with {0}, {1}, etc. +# +# For example, for the "user" key, ".+" means "authenticated user" and ".*" means "anybody" (including anonymous users). +# +# Section names are only used for naming the rule. +# Leading or ending slashes are trimmed from collection's path. +# + +# This means all users starting with "admin" may read any collection +[admin] +user: ^admin.*$ +collection: .* +permission: r + +# This means all users may read and write any collection starting with public. +# We do so by just not testing against the user string. +[public] +user: .* +collection: ^public(/.+)?$ +permission: rw + +# A little more complex: give read access to users from a domain for all +# collections of all the users (ie. user@domain.tld can read domain/\*). +[domain-wide-access] +user: ^.+@(.+)\..+$ +collection: ^{0}/.+$ +permission: r + +# Allow authenticated user to read all collections +[allow-everyone-read] +user: .+ +collection: .* +permission: r + +# Give write access to owners +[owner-write] +user: .+ +collection: ^%(login)s(/.+)?$ +permission: rw + +# Allow CardDavMATE-, CalDavZAP- or InfCloud- WEBclient to work +# anonymous users have read access to "/" but no files or subdir +[infcloud] +user: .* +collection: / +permission: r diff --git a/net/radicale/files/radicale.upgrade b/net/radicale/files/radicale.upgrade new file mode 100644 index 0000000..760782f --- /dev/null +++ b/net/radicale/files/radicale.upgrade @@ -0,0 +1,4 @@ +/etc/config/radicale +/etc/radicale/users +/etc/radicale/rights + diff --git a/net/radicale/files/radicale.users b/net/radicale/files/radicale.users new file mode 100644 index 0000000..7722176 --- /dev/null +++ b/net/radicale/files/radicale.users @@ -0,0 +1,6 @@ +# +# Sample File +# + +user1:password1 +user2:password2 \ No newline at end of file diff --git a/net/radicale/patches/010-Run-as-user-group-radicale-radicale.patch b/net/radicale/patches/010-Run-as-user-group-radicale-radicale.patch new file mode 100644 index 0000000..e1f1c21 --- /dev/null +++ b/net/radicale/patches/010-Run-as-user-group-radicale-radicale.patch @@ -0,0 +1,30 @@ +Subject: [PATCH] Run as user radicale and group radicale + +Patch to run Radicale service as radicale:radicale non root user + +Signed-off-by: Christian Schoenebeck +--- + bin/radicale | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/bin/radicale b/bin/radicale +index 619aca5..7466020 100755 +--- a/bin/radicale ++++ b/bin/radicale +@@ -26,6 +26,13 @@ Launch the server according to configuration and command-line options. + + """ + ++# inserted to run as user radicale ++import pwd, grp, os ++uid = pwd.getpwnam('radicale').pw_uid ++gid = grp.getgrnam('radicale').gr_gid ++os.setegid(gid) ++os.seteuid(uid) ++ + import radicale.__main__ + + +-- +2.1.0 + diff --git a/net/radsecproxy/Makefile b/net/radsecproxy/Makefile new file mode 100644 index 0000000..7387e03 --- /dev/null +++ b/net/radsecproxy/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2008-2016 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:=radsecproxy +PKG_VERSION:=1.6.8 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://software.uninett.no/radsecproxy/ +PKG_MD5SUM:=b868f7faf4887a10376d1bd96ef75368 + +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=LICENSE + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/radsecproxy + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libopenssl +libpthread + TITLE:=radsecproxy + URL:=http://software.uninett.no/radsecproxy + MAINTAINER:=Toke Høiland-Jørgensen +endef + +define Package/radsecproxy/description + A generic radius proxy for UDP/TLS (RadSec) +endef + +CONFIGURE_ARGS+= \ + --with-ssl="$(STAGING_DIR)/usr" + +#TARGET_CFLAGS += -ansi +#TARGET_CFLAGS += -std=c99 +TARGET_CFLAGS += -Wno-long-long + + +define Package/radsecproxy/install + $(INSTALL_DIR) $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/radsecproxy $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/config/ + $(INSTALL_DATA) ./files/radsecproxy.conf $(1)/etc/config/radsecproxy + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) ./files/radsecproxy.init $(1)/etc/init.d/radsecproxy +endef + +define Package/radsecproxy/conffiles +/etc/config/radsecproxy +endef + +$(eval $(call BuildPackage,radsecproxy)) + diff --git a/net/radsecproxy/files/radsecproxy.conf b/net/radsecproxy/files/radsecproxy.conf new file mode 100644 index 0000000..33e7e27 --- /dev/null +++ b/net/radsecproxy/files/radsecproxy.conf @@ -0,0 +1,43 @@ +# Sample radsecproxy configuration + +#Basic options +config options + option include '/etc/radsecproxy.conf' + #option LogLevel '3' + #option LogDestination 'x-syslog:///' + #list ListenUDP '127.0.0.1:1812' + #list ListenTLS '0.0.0.0:2083' + #list ListenTLS '[::]:2083' + +#config tls +# option name 'default' +# option CACertificatePath '/etc/ssl/certs' +# option certificateFile '/etc/ssl/certs/host.example.com.pem' +# option certificateKeyFile '/etc/ssl/private/host.example.com.key.pem' + +#config client +# option name 'localhost' +# option type 'udp' +# option secret 'mysecret' + +#config server +# option name '[2001:db8::1]' +# option type 'tls' +# option secret 'radsec' +# option statusServer '1' + +# Please note that ordering of realm blocks is important + +#config realm +# option name '/myabc\.com$' +# option replyMessage 'Misconfigured client: default realm of Intel PRO/Wireless supplicant!' +# + +#config realm +# option name '/^$/' +# option replyMessage 'Misconfigured client: empty realm!' +# + +#config realm +# option name '*' +# list server '[2001:db8::1]' diff --git a/net/radsecproxy/files/radsecproxy.init b/net/radsecproxy/files/radsecproxy.init new file mode 100644 index 0000000..7b22396 --- /dev/null +++ b/net/radsecproxy/files/radsecproxy.init @@ -0,0 +1,142 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=70 + +USE_PROCD=1 +PROG=/usr/sbin/radsecproxy +CONFFILE=/var/etc/radsecproxy.conf +LIST_SEP=" +" +append_params() { + local param + local value + local section="$1" + shift + for param in $*; do + config_get value "$section" "$param" + [ -z "$value" ] && { + param=$(echo $param | tr [A-Z] [a-z]) + config_get value "$section" "$param" + } + IFS="$LIST_SEP" + for value in $value; do + [ -n "$value" ] && echo " $param '$value'" >> "$CONFFILE" + done + unset IFS + done +} + +append_bools() { + local param + local value + local section="$1" + shift + for param in $*; do + config_get_bool value "$section" "$param" + [ -z "$value" ] && { + param=$(echo $param | tr [A-Z] [a-z]) + config_get_bool value "$section" "$param" + } + [ -n "$value" ] && { + [ "$value" -eq 0 ] && echo " $param off" >> "$CONFFILE" + [ "$value" -eq 1 ] && echo " $param on" >> "$CONFFILE" + } + done +} + +radsecproxy_options() { + local cfg="$1" + append_params "$cfg" \ + Include PidFile LogLevel LogDestination FTicksReporting FTicksMAC FTicksKey \ + FTicksSyslogFacility ListenUDP ListenTCP ListenTLS ListenDTLS SourceUDP \ + SourceTCP SourceTLS SourceDTLS TTLAttribute AddTTL + append_bools "$cfg" \ + LoopPrevention IPv4Only IPv6Only +} + +tls_block() { + local cfg="$1" + local name + config_get name "$cfg" name + echo "tls '$name' {" >> "$CONFFILE" + append_params "$cfg" \ + Include CACertificateFile CACertificatePath certificateFile certificateKeyFile \ + certificateKeyPassword cacheExpiry policyOID + append_bools "$cfg" \ + CRLCheck + echo "}" >> "$CONFFILE" +} + +rewrite_block() { + local cfg="$1" + local name + config_get name "$cfg" name + echo "rewrite '$name' {" >> "$CONFFILE" + append_params "$cfg" \ + Include addAttribute addVendorAttribute removeAttribute removeVendorAttribute \ + modifyAttribute + echo "}" >> "$CONFFILE" +} + +client_block() { + local cfg="$1" + local name + config_get name "$cfg" name + echo "client '$name' {" >> "$CONFFILE" + append_params "$cfg" \ + Include host type secret tls matchCertificateAttribute duplicateInterval \ + AddTTL fticksVISCOUNTRY fticksVISINST rewrite rewriteIn rewriteOut \ + rewriteAttribute + append_bools "$cfg" \ + IPv4Only IPv6Only certificateNameCheck + echo "}" >> "$CONFFILE" +} + +server_block() { + local cfg="$1" + local name + config_get name "$cfg" name + echo "server '$name' {" >> "$CONFFILE" + append_params "$cfg" \ + Include host port type secret tls matchCertificateAttribute \ + AddTTL rewrite rewriteIn rewriteOut retryCount dynamicLookupCommand \ + retryInterval + append_bools "$cfg" \ + IPv4Only IPv6Only certificateNameCheck statusServer LoopPrevention + echo "}" >> "$CONFFILE" +} + +realm_block() { + local cfg="$1" + local name + config_get name "$cfg" name + echo "realm '$name' {" >> "$CONFFILE" + append_params "$cfg" \ + Include server accountingServer replyMessage + append_bools "$cfg" \ + accountingResponse + echo "}" >> "$CONFFILE" +} + +start_service() { + mkdir -p $(dirname $CONFFILE) + echo "# auto-generated config file from /etc/config/radsecproxy" > $CONFFILE + config_load 'radsecproxy' + config_foreach radsecproxy_options options + config_foreach tls_block tls + config_foreach rewrite_block rewrite + config_foreach client_block client + config_foreach server_block server + config_foreach realm_block realm + + procd_open_instance + procd_set_param command $PROG -f -c $CONFFILE + procd_set_param file $CONFFILE + procd_set_param respawn + procd_close_instance +} + +service_triggers() { + procd_add_reload_trigger 'radsecproxy' +} diff --git a/net/radsecproxy/patches/100-missing-return.patch b/net/radsecproxy/patches/100-missing-return.patch new file mode 100644 index 0000000..871fc6e --- /dev/null +++ b/net/radsecproxy/patches/100-missing-return.patch @@ -0,0 +1,58 @@ +--- a/dtls.c ++++ b/dtls.c +@@ -523,6 +523,7 @@ void *udpdtlsserverrd(void *arg) { + free(params); + cacheexpire(sessioncache, &lastexpiry); + } ++ return NULL; + } + + int dtlsconnect(struct server *server, struct timeval *when, int timeout, char *text) { +@@ -642,6 +643,7 @@ void *udpdtlsclientrd(void *arg) { + if (udp2bio(s, conf->servers->rbios, cnt)) + debug(DBG_DBG, "radudpget: got DTLS in UDP from %s", addr2string((struct sockaddr *)&from)); + } ++ return NULL; + } + + void *dtlsclientrd(void *arg) { +--- a/radsecproxy.c ++++ b/radsecproxy.c +@@ -3203,6 +3203,8 @@ void *sighandler(void *arg) { + debug(DBG_WARN, "sighandler: ignoring signal %d", sig); + } + } ++ ++ return NULL; + } + + int createpidfile(const char *pidfile) { +@@ -3289,6 +3291,8 @@ int radsecproxy_main(int argc, char **ar + /* just hang around doing nothing, anything to do here? */ + for (;;) + sleep(1000); ++ ++ return 0; + } + + /* Local Variables: */ +--- a/udp.c ++++ b/udp.c +@@ -266,6 +266,8 @@ void *udpclientrd(void *arg) { + buf = radudpget(*s, NULL, &server, NULL); + replyh(server, buf); + } ++ ++ return NULL; + } + + void *udpserverrd(void *arg) { +@@ -310,6 +312,8 @@ void *udpserverwr(void *arg) { + debug(DBG_DBG, "udpserverwr: refcount %d", reply->refcount); + freerq(reply); + } ++ ++ return NULL; + } + + void addclientudp(struct client *client) { diff --git a/net/radsecproxy/patches/200-logdest-on-foreground.patch b/net/radsecproxy/patches/200-logdest-on-foreground.patch new file mode 100644 index 0000000..6678448 --- /dev/null +++ b/net/radsecproxy/patches/200-logdest-on-foreground.patch @@ -0,0 +1,31 @@ +diff --git a/radsecproxy.c b/radsecproxy.c +index 563c4a8..9fa076d 100644 +--- a/radsecproxy.c ++++ b/radsecproxy.c +@@ -3382,18 +3382,16 @@ int radsecproxy_main(int argc, char **argv) { + options.loglevel = loglevel; + else if (options.loglevel) + debug_set_level(options.loglevel); +- if (!foreground) { +- debug_set_destination(options.logdestination +- ? options.logdestination +- : "x-syslog:///", LOG_TYPE_DEBUG); ++ debug_set_destination(options.logdestination ++ ? options.logdestination ++ : "x-syslog:///", LOG_TYPE_DEBUG); + #if defined(WANT_FTICKS) +- if (options.ftickssyslogfacility) { +- debug_set_destination(options.ftickssyslogfacility, +- LOG_TYPE_FTICKS); +- free(options.ftickssyslogfacility); +- } +-#endif ++ if (options.ftickssyslogfacility) { ++ debug_set_destination(options.ftickssyslogfacility, ++ LOG_TYPE_FTICKS); ++ free(options.ftickssyslogfacility); + } ++#endif + free(options.logdestination); + + if (!list_first(clconfs)) diff --git a/net/reaver/Makefile b/net/reaver/Makefile new file mode 100644 index 0000000..1a499de --- /dev/null +++ b/net/reaver/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2012-2015 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:=reaver +PKG_VERSION:=1.4 +PKG_RELEASE:=2 +PKG_MAINTAINER:=Yousong Zhou + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/reaver-wps +PKG_MD5SUM:=05441dda7bacfcbe1e831c85d1ea3bc9 +PKG_LICENSE:=GPL-2.0 + +PKG_USE_MIPS16:=0 +PKG_AUTOMAKE_PATHS:=src +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +CONFIGURE_PATH:=src +MAKE_PATH:=src + +define Package/reaver + SECTION:=net + CATEGORY:=Network + SUBMENU:=wireless + TITLE:=Efficient brute force attack against Wifi Protected Setup + URL:=https://code.google.com/p/reaver-wps/ + DEPENDS:=+libpcap +libsqlite3 +endef + +define Package/reaver/description + Reaver targets the external registrar functionality mandated by the WiFi + Protected Setup specification. + Access points will provide authenticated registrars with their current + wireless configuration (including the WPA PSK), and also accept a new + configuration from the registrar. +endef + +define Package/reaver/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/{reaver,wash} $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/reaver + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/reaver.db $(1)/etc/reaver/ +endef + +$(eval $(call BuildPackage,reaver)) diff --git a/net/reaver/patches/0001-wpscrack-big-endian-fixes.patch b/net/reaver/patches/0001-wpscrack-big-endian-fixes.patch new file mode 100644 index 0000000..da76c2e --- /dev/null +++ b/net/reaver/patches/0001-wpscrack-big-endian-fixes.patch @@ -0,0 +1,565 @@ +From 4e7af9f022996cb0a03b30f6af265b757807dfa2 Mon Sep 17 00:00:00 2001 +From: Paul Fertser +Date: Wed, 27 Jun 2012 17:44:55 +0400 +Subject: [PATCH 1/3] wpscrack: big-endian fixes + +This should fix access to the radiotap, 802.11, LLC/SNAP and WFA +headers' fields. Run-time tested on an ar71xx BE system. + +Signed-off-by: Paul Fertser +--- + src/80211.c | 65 +++++++++++++++++++------------ + src/builder.c | 23 +++++------ + src/defs.h | 116 +++++++++++++++++++++++++++++++++++++++----------------- + src/exchange.c | 23 ++++++----- + src/wpsmon.c | 13 ++++-- + 5 files changed, 151 insertions(+), 89 deletions(-) + +diff --git a/src/80211.c b/src/80211.c +index c2aff59..19f1e92 100644 +--- a/src/80211.c ++++ b/src/80211.c +@@ -90,17 +90,19 @@ void read_ap_beacon() + if(header.len >= MIN_BEACON_SIZE) + { + rt_header = (struct radio_tap_header *) radio_header(packet, header.len); +- frame_header = (struct dot11_frame_header *) (packet + rt_header->len); +- ++ size_t rt_header_len = __le16_to_cpu(rt_header->len); ++ frame_header = (struct dot11_frame_header *) (packet + rt_header_len); ++ + if(is_target(frame_header)) + { +- if(frame_header->fc.type == MANAGEMENT_FRAME && frame_header->fc.sub_type == SUBTYPE_BEACON) ++ if((frame_header->fc & __cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == ++ __cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON)) + { +- beacon = (struct beacon_management_frame *) (packet + rt_header->len + sizeof(struct dot11_frame_header)); ++ beacon = (struct beacon_management_frame *) (packet + rt_header_len + sizeof(struct dot11_frame_header)); + set_ap_capability(beacon->capability); + + /* Obtain the SSID and channel number from the beacon packet */ +- tag_offset = rt_header->len + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame); ++ tag_offset = rt_header_len + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame); + channel = parse_beacon_tags(packet, header.len); + + /* If no channel was manually specified, switch to the AP's current channel */ +@@ -135,29 +137,31 @@ int8_t signal_strength(const u_char *packet, size_t len) + { + header = (struct radio_tap_header *) packet; + +- if((header->flags & SSI_FLAG) == SSI_FLAG) ++ uint32_t flags = __le32_to_cpu(header->flags); ++ ++ if((flags & SSI_FLAG) == SSI_FLAG) + { +- if((header->flags & TSFT_FLAG) == TSFT_FLAG) ++ if((flags & TSFT_FLAG) == TSFT_FLAG) + { + offset += TSFT_SIZE; + } + +- if((header->flags & FLAGS_FLAG) == FLAGS_FLAG) ++ if((flags & FLAGS_FLAG) == FLAGS_FLAG) + { + offset += FLAGS_SIZE; + } + +- if((header->flags & RATE_FLAG) == RATE_FLAG) ++ if((flags & RATE_FLAG) == RATE_FLAG) + { + offset += RATE_SIZE; + } + +- if((header->flags & CHANNEL_FLAG) == CHANNEL_FLAG) ++ if((flags & CHANNEL_FLAG) == CHANNEL_FLAG) + { + offset += CHANNEL_SIZE; + } + +- if((header->flags & FHSS_FLAG) == FHSS_FLAG) ++ if((flags & FHSS_FLAG) == FHSS_FLAG) + { + offset += FHSS_FLAG; + } +@@ -196,11 +200,13 @@ int is_wps_locked() + if(header.len >= MIN_BEACON_SIZE) + { + rt_header = (struct radio_tap_header *) radio_header(packet, header.len); +- frame_header = (struct dot11_frame_header *) (packet + rt_header->len); ++ size_t rt_header_len = __le16_to_cpu(rt_header->len); ++ frame_header = (struct dot11_frame_header *) (packet + rt_header_len); + + if(memcmp(frame_header->addr3, get_bssid(), MAC_ADDR_LEN) == 0) + { +- if(frame_header->fc.type == MANAGEMENT_FRAME && frame_header->fc.sub_type == SUBTYPE_BEACON) ++ if((frame_header->fc & __cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == ++ __cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON)) + { + if(parse_wps_parameters(packet, header.len, &wps)) + { +@@ -411,24 +417,30 @@ int associate_recv_loop() + if(header.len >= MIN_AUTH_SIZE) + { + rt_header = (struct radio_tap_header *) radio_header(packet, header.len); +- dot11_frame = (struct dot11_frame_header *) (packet + rt_header->len); ++ size_t rt_header_len = __le16_to_cpu(rt_header->len); ++ dot11_frame = (struct dot11_frame_header *) (packet + rt_header_len); + + if((memcmp(dot11_frame->addr3, get_bssid(), MAC_ADDR_LEN) == 0) && + (memcmp(dot11_frame->addr1, get_mac(), MAC_ADDR_LEN) == 0)) + { +- if(dot11_frame->fc.type == MANAGEMENT_FRAME) ++ if((dot11_frame->fc & __cpu_to_le16(IEEE80211_FCTL_FTYPE)) == ++ __cpu_to_le16(IEEE80211_FTYPE_MGMT)) + { +- auth_frame = (struct authentication_management_frame *) (packet + sizeof(struct dot11_frame_header) + rt_header->len); +- assoc_frame = (struct association_response_management_frame *) (packet + sizeof(struct dot11_frame_header) + rt_header->len); ++ auth_frame = (struct authentication_management_frame *) (packet + sizeof(struct dot11_frame_header) + rt_header_len); ++ assoc_frame = (struct association_response_management_frame *) (packet + sizeof(struct dot11_frame_header) + rt_header_len); + + /* Did we get an authentication packet with a successful status? */ +- if((dot11_frame->fc.sub_type == SUBTYPE_AUTHENTICATION) && (auth_frame->status == AUTHENTICATION_SUCCESS)) ++ if((dot11_frame->fc & __cpu_to_le16(IEEE80211_FCTL_STYPE)) == ++ __cpu_to_le16(IEEE80211_STYPE_AUTH) ++ && (auth_frame->status == __cpu_to_le16(AUTHENTICATION_SUCCESS))) + { + ret_val = AUTH_OK; + break; + } + /* Did we get an association packet with a successful status? */ +- else if((dot11_frame->fc.sub_type == SUBTYPE_ASSOCIATION) && (assoc_frame->status == ASSOCIATION_SUCCESS)) ++ else if((dot11_frame->fc & __cpu_to_le16(IEEE80211_FCTL_STYPE)) == ++ __cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP) ++ && (assoc_frame->status == __cpu_to_le16(ASSOCIATION_SUCCESS))) + { + ret_val = ASSOCIATE_OK; + break; +@@ -455,13 +467,14 @@ enum encryption_type supported_encryption(const u_char *packet, size_t len) + if(len > MIN_BEACON_SIZE) + { + rt_header = (struct radio_tap_header *) radio_header(packet, len); +- beacon = (struct beacon_management_frame *) (packet + rt_header->len + sizeof(struct dot11_frame_header)); +- offset = tag_offset = rt_header->len + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame); ++ size_t rt_header_len = __le16_to_cpu(rt_header->len); ++ beacon = (struct beacon_management_frame *) (packet + rt_header_len + sizeof(struct dot11_frame_header)); ++ offset = tag_offset = rt_header_len + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame); + + tag_len = len - tag_offset; + tag_data = (const u_char *) (packet + tag_offset); + +- if((beacon->capability & CAPABILITY_WEP) == CAPABILITY_WEP) ++ if((__le16_to_cpu(beacon->capability) & CAPABILITY_WEP) == CAPABILITY_WEP) + { + enc = WEP; + +@@ -509,7 +522,7 @@ int parse_beacon_tags(const u_char *packet, size_t len) + struct radio_tap_header *rt_header = NULL; + + rt_header = (struct radio_tap_header *) radio_header(packet, len); +- tag_offset = rt_header->len + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame); ++ tag_offset = __le16_to_cpu(rt_header->len) + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame); + + if(tag_offset < len) + { +@@ -548,7 +561,7 @@ int parse_beacon_tags(const u_char *packet, size_t len) + { + if(ie_len == 1) + { +- memcpy((int *) &channel, channel_data, ie_len); ++ channel = *(uint8_t*)channel_data; + } + free(channel_data); + } +@@ -603,13 +616,13 @@ int check_fcs(const u_char *packet, size_t len) + if(len > 4) + { + /* Get the packet's reported FCS (last 4 bytes of the packet) */ +- memcpy((uint32_t *) &fcs, (packet + (len-4)), 4); ++ fcs = __le32_to_cpu(*(uint32_t*)(packet + (len-4))); + + /* FCS is not calculated over the radio tap header */ + if(has_rt_header()) + { + rt_header = (struct radio_tap_header *) packet; +- offset += rt_header->len; ++ offset += __le16_to_cpu(rt_header->len); + } + + if(len > offset) +diff --git a/src/builder.c b/src/builder.c +index 37f2de7..6bf89e7 100644 +--- a/src/builder.c ++++ b/src/builder.c +@@ -44,9 +44,8 @@ const void *build_radio_tap_header(size_t *len) + memset((void *) buf, 0, sizeof(struct radio_tap_header)); + rt_header = (struct radio_tap_header *) buf; + +- rt_header->len = sizeof(struct radio_tap_header); +- +- *len = rt_header->len; ++ *len = sizeof(struct radio_tap_header); ++ rt_header->len = __cpu_to_le16(*len); + } + + return buf; +@@ -67,9 +66,9 @@ const void *build_dot11_frame_header(uint16_t fc, size_t *len) + + frag_seq += SEQ_MASK; + +- header->duration = DEFAULT_DURATION; +- memcpy((void *) &header->fc, (void *) &fc, sizeof(struct frame_control)); +- header->frag_seq = frag_seq; ++ header->duration = __cpu_to_le16(DEFAULT_DURATION); ++ header->fc = __cpu_to_le16(fc); ++ header->frag_seq = __cpu_to_le16(frag_seq); + + memcpy((void *) header->addr1, get_bssid(), MAC_ADDR_LEN); + memcpy((void *) header->addr2, get_mac(), MAC_ADDR_LEN); +@@ -91,8 +90,8 @@ const void *build_authentication_management_frame(size_t *len) + memset((void *) buf, 0, *len); + frame = (struct authentication_management_frame *) buf; + +- frame->algorithm = OPEN_SYSTEM; +- frame->sequence = 1; ++ frame->algorithm = __cpu_to_le16(OPEN_SYSTEM); ++ frame->sequence = __cpu_to_le16(1); + frame->status = 0; + } + +@@ -111,8 +110,8 @@ const void *build_association_management_frame(size_t *len) + memset((void *) buf, 0, *len); + frame = (struct association_request_management_frame *) buf; + +- frame->capability = get_ap_capability(); +- frame->listen_interval = LISTEN_INTERVAL; ++ frame->capability = __cpu_to_le16(get_ap_capability()); ++ frame->listen_interval = __cpu_to_le16(LISTEN_INTERVAL); + } + + return buf; +@@ -133,7 +132,7 @@ const void *build_llc_header(size_t *len) + header->dsap = LLC_SNAP; + header->ssap = LLC_SNAP; + header->control_field = UNNUMBERED_FRAME; +- header->type = DOT1X_AUTHENTICATION; ++ header->type = __cpu_to_be16(DOT1X_AUTHENTICATION); + + } + +@@ -279,7 +278,7 @@ const void *build_wfa_header(uint8_t op_code, size_t *len) + header = (struct wfa_expanded_header *) buf; + + memcpy(header->id, WFA_VENDOR_ID, sizeof(header->id)); +- header->type = SIMPLE_CONFIG; ++ header->type = __cpu_to_be32(SIMPLE_CONFIG); + header->opcode = op_code; + } + +diff --git a/src/defs.h b/src/defs.h +index b2f45ea..0c628e7 100644 +--- a/src/defs.h ++++ b/src/defs.h +@@ -41,6 +41,7 @@ + #include + #include + #include ++#include + + #include "wps.h" + +@@ -65,10 +66,10 @@ + #define MANAGEMENT_FRAME 0x00 + #define SUBTYPE_BEACON 0x08 + +-#define DOT1X_AUTHENTICATION 0x8E88 ++#define DOT1X_AUTHENTICATION 0x888E + #define DOT1X_EAP_PACKET 0x00 + +-#define SIMPLE_CONFIG 0x01000000 ++#define SIMPLE_CONFIG 0x00000001 + + #define P1_SIZE 10000 + #define P2_SIZE 1000 +@@ -282,66 +283,111 @@ enum wfa_elements + WEP_TRANSMIT_KEY = 0x10064 + }; + ++#define IEEE80211_FCTL_VERS 0x0003 ++#define IEEE80211_FCTL_FTYPE 0x000c ++#define IEEE80211_FCTL_STYPE 0x00f0 ++#define IEEE80211_FCTL_TODS 0x0100 ++#define IEEE80211_FCTL_FROMDS 0x0200 ++#define IEEE80211_FCTL_MOREFRAGS 0x0400 ++#define IEEE80211_FCTL_RETRY 0x0800 ++#define IEEE80211_FCTL_PM 0x1000 ++#define IEEE80211_FCTL_MOREDATA 0x2000 ++#define IEEE80211_FCTL_PROTECTED 0x4000 ++#define IEEE80211_FCTL_ORDER 0x8000 ++ ++#define IEEE80211_SCTL_FRAG 0x000F ++#define IEEE80211_SCTL_SEQ 0xFFF0 ++ ++#define IEEE80211_FTYPE_MGMT 0x0000 ++#define IEEE80211_FTYPE_CTL 0x0004 ++#define IEEE80211_FTYPE_DATA 0x0008 ++ ++/* management */ ++#define IEEE80211_STYPE_ASSOC_REQ 0x0000 ++#define IEEE80211_STYPE_ASSOC_RESP 0x0010 ++#define IEEE80211_STYPE_REASSOC_REQ 0x0020 ++#define IEEE80211_STYPE_REASSOC_RESP 0x0030 ++#define IEEE80211_STYPE_PROBE_REQ 0x0040 ++#define IEEE80211_STYPE_PROBE_RESP 0x0050 ++#define IEEE80211_STYPE_BEACON 0x0080 ++#define IEEE80211_STYPE_ATIM 0x0090 ++#define IEEE80211_STYPE_DISASSOC 0x00A0 ++#define IEEE80211_STYPE_AUTH 0x00B0 ++#define IEEE80211_STYPE_DEAUTH 0x00C0 ++#define IEEE80211_STYPE_ACTION 0x00D0 ++ ++/* control */ ++#define IEEE80211_STYPE_BACK_REQ 0x0080 ++#define IEEE80211_STYPE_BACK 0x0090 ++#define IEEE80211_STYPE_PSPOLL 0x00A0 ++#define IEEE80211_STYPE_RTS 0x00B0 ++#define IEEE80211_STYPE_CTS 0x00C0 ++#define IEEE80211_STYPE_ACK 0x00D0 ++#define IEEE80211_STYPE_CFEND 0x00E0 ++#define IEEE80211_STYPE_CFENDACK 0x00F0 ++ ++/* data */ ++#define IEEE80211_STYPE_DATA 0x0000 ++#define IEEE80211_STYPE_DATA_CFACK 0x0010 ++#define IEEE80211_STYPE_DATA_CFPOLL 0x0020 ++#define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030 ++#define IEEE80211_STYPE_NULLFUNC 0x0040 ++#define IEEE80211_STYPE_CFACK 0x0050 ++#define IEEE80211_STYPE_CFPOLL 0x0060 ++#define IEEE80211_STYPE_CFACKPOLL 0x0070 ++#define IEEE80211_STYPE_QOS_DATA 0x0080 ++#define IEEE80211_STYPE_QOS_DATA_CFACK 0x0090 ++#define IEEE80211_STYPE_QOS_DATA_CFPOLL 0x00A0 ++#define IEEE80211_STYPE_QOS_DATA_CFACKPOLL 0x00B0 ++#define IEEE80211_STYPE_QOS_NULLFUNC 0x00C0 ++#define IEEE80211_STYPE_QOS_CFACK 0x00D0 ++#define IEEE80211_STYPE_QOS_CFPOLL 0x00E0 ++#define IEEE80211_STYPE_QOS_CFACKPOLL 0x00F0 ++ + #pragma pack(1) + struct radio_tap_header + { + uint8_t revision; + uint8_t pad; +- uint16_t len; +- uint32_t flags; +-}; +- +-struct frame_control +-{ +- unsigned version : 2; +- unsigned type : 2; +- unsigned sub_type : 4; +- +- unsigned to_ds : 1; +- unsigned from_ds : 1; +- unsigned more_frag : 1; +- unsigned retry : 1; +- unsigned pwr_mgt : 1; +- unsigned more_data : 1; +- unsigned protected_frame : 1; +- unsigned order : 1; ++ __le16 len; ++ __le32 flags; + }; + + struct dot11_frame_header + { +- struct frame_control fc; +- uint16_t duration; ++ __le16 fc; ++ __le16 duration; + unsigned char addr1[MAC_ADDR_LEN]; + unsigned char addr2[MAC_ADDR_LEN]; + unsigned char addr3[MAC_ADDR_LEN]; +- uint16_t frag_seq; ++ __le16 frag_seq; + }; + + struct authentication_management_frame + { +- uint16_t algorithm; +- uint16_t sequence; +- uint16_t status; ++ __le16 algorithm; ++ __le16 sequence; ++ __le16 status; + }; + + struct association_request_management_frame + { +- uint16_t capability; +- uint16_t listen_interval; ++ __le16 capability; ++ __le16 listen_interval; + }; + + struct association_response_management_frame + { +- uint16_t capability; +- uint16_t status; +- uint16_t id; ++ __le16 capability; ++ __le16 status; ++ __le16 id; + }; + + struct beacon_management_frame + { + unsigned char timestamp[TIMESTAMP_LEN]; +- uint16_t beacon_interval; +- uint16_t capability; ++ __le16 beacon_interval; ++ __le16 capability; + }; + + struct llc_header +@@ -350,7 +396,7 @@ struct llc_header + uint8_t ssap; + uint8_t control_field; + unsigned char org_code[3]; +- uint16_t type; ++ __be16 type; + }; + + struct dot1X_header +@@ -371,7 +417,7 @@ struct eap_header + struct wfa_expanded_header + { + unsigned char id[3]; +- uint32_t type; ++ __be32 type; + uint8_t opcode; + uint8_t flags; + }; +diff --git a/src/exchange.c b/src/exchange.c +index 23c87e9..4f9a82b 100644 +--- a/src/exchange.c ++++ b/src/exchange.c +@@ -306,26 +306,27 @@ enum wps_type process_packet(const u_char *packet, struct pcap_pkthdr *header) + + /* Cast the radio tap and 802.11 frame headers and parse out the Frame Control field */ + rt_header = (struct radio_tap_header *) packet; +- frame_header = (struct dot11_frame_header *) (packet+rt_header->len); ++ size_t rt_header_len = __le16_to_cpu(rt_header->len); ++ frame_header = (struct dot11_frame_header *) (packet+rt_header_len); + + /* Does the BSSID/source address match our target BSSID? */ + if(memcmp(frame_header->addr3, get_bssid(), MAC_ADDR_LEN) == 0) + { + /* Is this a data packet sent to our MAC address? */ +- if(frame_header->fc.type == DATA_FRAME && +- frame_header->fc.sub_type == SUBTYPE_DATA && +- (memcmp(frame_header->addr1, get_mac(), MAC_ADDR_LEN) == 0)) ++ if (((frame_header->fc & __cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == ++ __cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA)) && ++ (memcmp(frame_header->addr1, get_mac(), MAC_ADDR_LEN) == 0)) + { + llc = (struct llc_header *) (packet + +- rt_header->len + ++ rt_header_len + + sizeof(struct dot11_frame_header) + ); + + /* All packets in our exchanges will be 802.1x */ +- if(llc->type == DOT1X_AUTHENTICATION) ++ if(llc->type == __cpu_to_be16(DOT1X_AUTHENTICATION)) + { + dot1x = (struct dot1X_header *) (packet + +- rt_header->len + ++ rt_header_len + + sizeof(struct dot11_frame_header) + + sizeof(struct llc_header) + ); +@@ -334,7 +335,7 @@ enum wps_type process_packet(const u_char *packet, struct pcap_pkthdr *header) + if(dot1x->type == DOT1X_EAP_PACKET && (header->len >= EAP_PACKET_SIZE)) + { + eap = (struct eap_header *) (packet + +- rt_header->len + ++ rt_header_len + + sizeof(struct dot11_frame_header) + + sizeof(struct llc_header) + + sizeof(struct dot1X_header) +@@ -366,7 +367,7 @@ enum wps_type process_packet(const u_char *packet, struct pcap_pkthdr *header) + else if((eap->type == EAP_EXPANDED) && (header->len > WFA_PACKET_SIZE)) + { + wfa = (struct wfa_expanded_header *) (packet + +- rt_header->len + ++ rt_header_len + + sizeof(struct dot11_frame_header) + + sizeof(struct llc_header) + + sizeof(struct dot1X_header) + +@@ -374,14 +375,14 @@ enum wps_type process_packet(const u_char *packet, struct pcap_pkthdr *header) + ); + + /* Verify that this is a WPS message */ +- if(wfa->type == SIMPLE_CONFIG) ++ if(wfa->type == __cpu_to_be32(SIMPLE_CONFIG)) + { + wps_msg_len = (size_t) ntohs(eap->len) - + sizeof(struct eap_header) - + sizeof(struct wfa_expanded_header); + + wps_msg = (const void *) (packet + +- rt_header->len + ++ rt_header_len + + sizeof(struct dot11_frame_header) + + sizeof(struct llc_header) + + sizeof(struct dot1X_header) + +diff --git a/src/wpsmon.c b/src/wpsmon.c +index d976924..22a394f 100644 +--- a/src/wpsmon.c ++++ b/src/wpsmon.c +@@ -295,7 +295,8 @@ void parse_wps_settings(const u_char *packet, struct pcap_pkthdr *header, char * + } + + rt_header = (struct radio_tap_header *) radio_header(packet, header->len); +- frame_header = (struct dot11_frame_header *) (packet + rt_header->len); ++ size_t rt_header_len = __le16_to_cpu(rt_header->len); ++ frame_header = (struct dot11_frame_header *) (packet + rt_header_len); + + /* If a specific BSSID was specified, only parse packets from that BSSID */ + if(!is_target(frame_header)) +@@ -323,15 +324,17 @@ void parse_wps_settings(const u_char *packet, struct pcap_pkthdr *header, char * + channel_changed = 1; + } + +- if(frame_header->fc.sub_type == PROBE_RESPONSE || +- frame_header->fc.sub_type == SUBTYPE_BEACON) ++ unsigned fsub_type = frame_header->fc & __cpu_to_le16(IEEE80211_FCTL_STYPE); ++ ++ if(fsub_type == __cpu_to_le16(IEEE80211_STYPE_PROBE_RESP) || ++ fsub_type == __cpu_to_le16(IEEE80211_STYPE_BEACON)) + { + wps_parsed = parse_wps_parameters(packet, header->len, wps); + } + + if(!is_done(bssid) && (get_channel() == channel || source == PCAP_FILE)) + { +- if(frame_header->fc.sub_type == SUBTYPE_BEACON && ++ if(fsub_type == __cpu_to_le16(IEEE80211_STYPE_BEACON) && + mode == SCAN && + !passive && + should_probe(bssid)) +@@ -369,7 +372,7 @@ void parse_wps_settings(const u_char *packet, struct pcap_pkthdr *header, char * + * If there was no WPS information, then the AP does not support WPS and we should ignore it from here on. + * If this was a probe response, then we've gotten all WPS info we can get from this AP and should ignore it from here on. + */ +- if(!wps_parsed || frame_header->fc.sub_type == PROBE_RESPONSE) ++ if(!wps_parsed || fsub_type == __cpu_to_le16(IEEE80211_STYPE_PROBE_RESP)) + { + mark_ap_complete(bssid); + } +-- +1.7.7 + diff --git a/net/reaver/patches/0002-Use-the-current-directory-for-storing-and-loading-se.patch b/net/reaver/patches/0002-Use-the-current-directory-for-storing-and-loading-se.patch new file mode 100644 index 0000000..dd1bb42 --- /dev/null +++ b/net/reaver/patches/0002-Use-the-current-directory-for-storing-and-loading-se.patch @@ -0,0 +1,53 @@ +From cd444949f3176790101b8bdc9656831a03d8c01d Mon Sep 17 00:00:00 2001 +From: Paul Fertser +Date: Tue, 10 Jul 2012 11:13:29 +0400 +Subject: [PATCH 2/3] Use the current directory for storing and loading + sessions + +This allows the user to always explicitely choose (by changing the +current directory before launching the program) where the session +files should go. Useful e.g. to avoid hogging the precious space on +embedded devices, just cd /tmp before starting the app. + +Signed-off-by: Paul Fertser +--- + src/session.c | 16 +++------------- + 1 files changed, 3 insertions(+), 13 deletions(-) + +diff --git a/src/session.c b/src/session.c +index d3af0c3..308f213 100644 +--- a/src/session.c ++++ b/src/session.c +@@ -62,7 +62,7 @@ int restore_session() + memset(file, 0, FILENAME_MAX); + + bssid = mac2str(get_bssid(), '\0'); +- snprintf(file, FILENAME_MAX, "%s/%s.%s", CONF_DIR, bssid, CONF_EXT); ++ snprintf(file, FILENAME_MAX, "%s.%s", bssid, CONF_EXT); + free(bssid); + } + +@@ -199,18 +199,8 @@ int save_session() + } + else + { +- /* +- * If the configuration directory exists, save the session file there; else, save it to the +- * current working directory. +- */ +- if(configuration_directory_exists()) +- { +- snprintf((char *) &file_name, FILENAME_MAX, "%s/%s.%s", CONF_DIR, bssid, CONF_EXT); +- } +- else +- { +- snprintf((char *) &file_name, FILENAME_MAX, "%s.%s", bssid, CONF_EXT); +- } ++ /* save session to the current directory */ ++ snprintf((char *) &file_name, FILENAME_MAX, "%s.%s", bssid, CONF_EXT); + } + + /* Don't bother saving anything if nothing has been done */ +-- +1.7.7 + diff --git a/net/reaver/patches/0003-wash-wpsmon-use-less-useless-spaces-in-output-to-fit.patch b/net/reaver/patches/0003-wash-wpsmon-use-less-useless-spaces-in-output-to-fit.patch new file mode 100644 index 0000000..64b290b --- /dev/null +++ b/net/reaver/patches/0003-wash-wpsmon-use-less-useless-spaces-in-output-to-fit.patch @@ -0,0 +1,38 @@ +From 638bb8d70d6c7e5dc99975e0bf57d8ce0455e2cc Mon Sep 17 00:00:00 2001 +From: Paul Fertser +Date: Tue, 10 Jul 2012 11:25:00 +0400 +Subject: [PATCH 3/3] wash/wpsmon: use less useless spaces in output to fit + narrow terminals + +Signed-off-by: Paul Fertser +--- + src/wpsmon.c | 6 +++--- + 1 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/wpsmon.c b/src/wpsmon.c +index 22a394f..e0948b3 100644 +--- a/src/wpsmon.c ++++ b/src/wpsmon.c +@@ -262,8 +262,8 @@ void monitor(char *bssid, int passive, int source, int channel, int mode) + + if(!header_printed) + { +- cprintf(INFO, "BSSID Channel RSSI WPS Version WPS Locked ESSID\n"); +- cprintf(INFO, "---------------------------------------------------------------------------------------------------------------\n"); ++ cprintf(INFO, "BSSID Channel RSSI WPS Version WPS Locked ESSID\n"); ++ cprintf(INFO, "--------------------------------------------------------------------------------------\n"); + header_printed = 1; + } + +@@ -360,7 +360,7 @@ void parse_wps_settings(const u_char *packet, struct pcap_pkthdr *header, char * + break; + } + +- cprintf(INFO, "%17s %2d %.2d %d.%d %s %s\n", bssid, channel, rssi, (wps->version >> 4), (wps->version & 0x0F), lock_display, ssid); ++ cprintf(INFO, "%17s %2d %.2d %d.%d %s %s\n", bssid, channel, rssi, (wps->version >> 4), (wps->version & 0x0F), lock_display, ssid); + } + + if(probe_sent) +-- +1.7.7 + diff --git a/net/reaver/patches/0004-Fixed-probe-request-bug-in-wash.patch b/net/reaver/patches/0004-Fixed-probe-request-bug-in-wash.patch new file mode 100644 index 0000000..9b51d06 --- /dev/null +++ b/net/reaver/patches/0004-Fixed-probe-request-bug-in-wash.patch @@ -0,0 +1,46 @@ +From a8edcc1ce2a55e0e02ee13c46c6a5f22dd7920e9 Mon Sep 17 00:00:00 2001 +From: "cheffner@tacnetsol.com" + +Date: Tue, 27 Mar 2012 16:25:10 +0000 +Subject: [PATCH] Fixed probe request bug in wash. + +git-svn-id: http://reaver-wps.googlecode.com/svn/trunk@113 027a3e96-2d37-f1c0-85d6-5ce5a08386c2 +--- + src/wpsmon.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/wpsmon.c b/src/wpsmon.c +index da688b9..d976924 100644 +--- a/src/wpsmon.c ++++ b/src/wpsmon.c +@@ -132,6 +132,11 @@ int main(int argc, char *argv[]) + usage(argv[0]); + goto end; + } ++ else if(get_iface()) ++ { ++ /* Get the MAC address of the specified interface */ ++ read_iface_mac(); ++ } + + if(get_iface() && source == PCAP_FILE) + { +@@ -300,6 +305,7 @@ void parse_wps_settings(const u_char *packet, struct pcap_pkthdr *header, char * + + set_ssid(NULL); + bssid = (char *) mac2str(frame_header->addr3, ':'); ++ set_bssid((unsigned char *) frame_header->addr3); + + if(bssid) + { +@@ -383,6 +389,7 @@ void parse_wps_settings(const u_char *packet, struct pcap_pkthdr *header, char * + + end: + if(wps) free(wps); ++ set_bssid((unsigned char *) NULL_MAC); + + return; + } +-- +2.6.4 + diff --git a/net/reaver/patches/0100-Include-sys-types.h-for-definition-of-u_char.patch b/net/reaver/patches/0100-Include-sys-types.h-for-definition-of-u_char.patch new file mode 100644 index 0000000..541968a --- /dev/null +++ b/net/reaver/patches/0100-Include-sys-types.h-for-definition-of-u_char.patch @@ -0,0 +1,27 @@ +From 811f5c0b0a226edfbf5aa2f316e083f30ec3cd8d Mon Sep 17 00:00:00 2001 +From: Yousong Zhou +Date: Tue, 18 Aug 2015 14:34:26 +0800 +Subject: [PATCH] Include for definition of u_char. + +Fixes build with musl-libc. + +Signed-off-by: Yousong Zhou +--- + src/libwps/libwps.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/libwps/libwps.h b/src/libwps/libwps.h +index b04dd8b..bdd7b9a 100755 +--- a/src/libwps/libwps.h ++++ b/src/libwps/libwps.h +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + + #define LIBWPS_MAX_STR_LEN 256 + +-- +1.7.10.4 + diff --git a/net/reaver/patches/0101-pcap-use-65536-as-snaplen.patch b/net/reaver/patches/0101-pcap-use-65536-as-snaplen.patch new file mode 100644 index 0000000..03f4318 --- /dev/null +++ b/net/reaver/patches/0101-pcap-use-65536-as-snaplen.patch @@ -0,0 +1,11 @@ +--- a/src/init.c.orig 2016-12-08 13:23:17.386891467 +0800 ++++ b/src/init.c 2016-12-08 13:23:20.850892551 +0800 +@@ -121,7 +121,7 @@ pcap_t *capture_init(char *capture_sourc + pcap_t *handle = NULL; + char errbuf[PCAP_ERRBUF_SIZE] = { 0 }; + +- handle = pcap_open_live(capture_source, BUFSIZ, 1, 0, errbuf); ++ handle = pcap_open_live(capture_source, 65536, 1, 0, errbuf); + if(!handle) + { + handle = pcap_open_offline(capture_source, errbuf); diff --git a/net/redsocks/Makefile b/net/redsocks/Makefile new file mode 100644 index 0000000..4f5f563 --- /dev/null +++ b/net/redsocks/Makefile @@ -0,0 +1,58 @@ +# +# Copyright (C) 2014-2015 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:=redsocks +PKG_VERSION:=0.4-20150907 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=https://github.com/darkk/redsocks.git +PKG_SOURCE_VERSION:=2118c616b4970a0436eceaa57a6e3451ec98ad2b + +PKG_MAINTAINER:=Johannes Morgenroth +PKG_LICENSE:=Apache-2.0 + +include $(INCLUDE_DIR)/package.mk + +define Package/redsocks + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libevent2 + TITLE:=Redirect any TCP connection to a SOCKS or HTTPS proxy server +endef + +define Package/redsocks/conffiles +/etc/redsocks.conf +endef + +define Package/redsocks/description + Redsocks is a daemon running on the local system, that will transparently + tunnel any TCP connection via a remote SOCKS4, SOCKS5 or HTTP proxy server. It + uses the system firewall's redirection facility to intercept TCP connections, + thus the redirection is system-wide, with fine-grained control, and does + not depend on LD_PRELOAD libraries. + + Redsocks supports tunneling TCP connections and UDP packets. It has + authentication support for both, SOCKS and HTTP proxies. + + Also included is a small DNS server returning answers with the "truncated" flag + set for any UDP query, forcing the resolver to use TCP. +endef + +define Package/redsocks/install + $(INSTALL_DIR) $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/redsocks $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) files/redsocks.init $(1)/etc/init.d/redsocks + $(INSTALL_CONF) files/redsocks.conf $(1)/etc/ +endef + +$(eval $(call BuildPackage,redsocks)) diff --git a/net/redsocks/files/redsocks.conf b/net/redsocks/files/redsocks.conf new file mode 100644 index 0000000..64307c7 --- /dev/null +++ b/net/redsocks/files/redsocks.conf @@ -0,0 +1,108 @@ +base { + // debug: connection progress & client list on SIGUSR1 + log_debug = off; + + // info: start and end of client session + log_info = on; + + /* possible `log' values are: + * stderr + * "file:/path/to/file" + * syslog:FACILITY facility is any of "daemon", "local0"..."local7" + */ + // log = stderr; + // log = "file:/path/to/file"; + log = "syslog:local7"; + + // detach from console + daemon = on; + + /* Change uid, gid and root directory, these options require root + * privilegies on startup. + * Note, your chroot may requre /etc/localtime if you write log to syslog. + * Log is opened before chroot & uid changing. + */ + // user = nobody; + // group = nobody; + // chroot = "/var/chroot"; + + /* possible `redirector' values are: + * iptables - for Linux + * ipf - for FreeBSD + * pf - for OpenBSD + * generic - some generic redirector that MAY work + */ + redirector = iptables; +} + +redsocks { + /* `local_ip' defaults to 127.0.0.1 for security reasons, + * use 0.0.0.0 if you want to listen on every interface. + * `local_*' are used as port to redirect to. + */ + local_ip = 127.0.0.1; + local_port = 12345; + + // listen() queue length. Default value is SOMAXCONN and it should be + // good enough for most of us. + // listenq = 128; // SOMAXCONN equals 128 on my Linux box. + + // `max_accept_backoff` is a delay to retry `accept()` after accept + // failure (e.g. due to lack of file descriptors). It's measured in + // milliseconds and maximal value is 65535. `min_accept_backoff` is + // used as initial backoff value and as a damper for `accept() after + // close()` logic. + // min_accept_backoff = 100; + // max_accept_backoff = 60000; + + // `ip' and `port' are IP and tcp-port of proxy-server + // You can also use hostname instead of IP, only one (random) + // address of multihomed host will be used. + ip = example.org; + port = 1080; + + + // known types: socks4, socks5, http-connect, http-relay + type = socks5; + + // login = "foobar"; + // password = "baz"; +} + +redudp { + // `local_ip' should not be 0.0.0.0 as it's also used for outgoing + // packets that are sent as replies - and it should be fixed + // if we want NAT to work properly. + local_ip = 127.0.0.1; + local_port = 10053; + + // `ip' and `port' of socks5 proxy server. + ip = 10.0.0.1; + port = 1080; + login = username; + password = pazzw0rd; + + // redsocks knows about two options while redirecting UDP packets at + // linux: TPROXY and REDIRECT. TPROXY requires more complex routing + // configuration and fresh kernel (>= 2.6.37 according to squid + // developers[1]) but has hack-free way to get original destination + // address, REDIRECT is easier to configure, but requires `dest_ip` and + // `dest_port` to be set, limiting packet redirection to single + // destination. + // [1] http://wiki.squid-cache.org/Features/Tproxy4 + dest_ip = 8.8.8.8; + dest_port = 53; + + udp_timeout = 30; + udp_timeout_stream = 180; +} + +dnstc { + // fake and really dumb DNS server that returns "truncated answer" to + // every query via UDP, RFC-compliant resolver should repeat same query + // via TCP in this case. + local_ip = 127.0.0.1; + local_port = 5300; +} + +// you can add more `redsocks' and `redudp' sections if you need. diff --git a/net/redsocks/files/redsocks.init b/net/redsocks/files/redsocks.init new file mode 100644 index 0000000..56c9de3 --- /dev/null +++ b/net/redsocks/files/redsocks.init @@ -0,0 +1,36 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2007 OpenWrt.org + +START=90 + +# check if configuration exists +[ -e "/etc/redsocks.conf" ] || exit 0 + +start() { + if [ -e "/var/run/redsocks.pid" ]; then + echo "redsocks is already running" + exit 0 + fi + + /bin/echo -n "running redsocks ..." + + # startup the safety-wrapper for the daemon + /usr/sbin/redsocks -p /var/run/redsocks.pid + + /bin/echo " done" +} + +stop() { + if [ ! -e "/var/run/redsocks.pid" ]; then + echo "redsocks is not running" + exit 0 + fi + + /bin/echo -n "stopping redsocks ..." + + # kill the process + /bin/kill $(cat /var/run/redsocks.pid) + rm /var/run/redsocks.pid + + echo " done" +} diff --git a/net/redsocks/patches/0006-fix_default_config_location.patch b/net/redsocks/patches/0006-fix_default_config_location.patch new file mode 100644 index 0000000..987085f --- /dev/null +++ b/net/redsocks/patches/0006-fix_default_config_location.patch @@ -0,0 +1,17 @@ +Description: change the default config file location + redsocks by default looks for ./redsocks.conf. Change this to + /etc/redsocks.conf for a more deterministic behaviour. +Author: Apollon Oikonomopoulos +Forwared: no +Last-Update: 2013-04-23 +--- a/main.c ++++ b/main.c +@@ -39,7 +39,7 @@ app_subsys *subsystems[] = { + &dnstc_subsys, + }; + +-static const char *confname = "redsocks.conf"; ++static const char *confname = "/etc/redsocks.conf"; + static const char *pidfile = NULL; + + static void terminate(int sig, short what, void *_arg) diff --git a/net/remserial/Makefile b/net/remserial/Makefile new file mode 100644 index 0000000..4fe476d --- /dev/null +++ b/net/remserial/Makefile @@ -0,0 +1,34 @@ +# +# 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:=remserial +PKG_VERSION:=1.4 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-2.0+ + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://lpccomp.bc.ca/remserial/ +PKG_MD5SUM:=b19b57fd118329c5ea3aaf9887f946a6 + +PKG_MAINTAINER:=Nuno Goncalves + +include $(INCLUDE_DIR)/package.mk + +define Package/remserial + SECTION:=net + CATEGORY:=Network + TITLE:=Bridge TCP/IP port with a device + URL:=http://lpccomp.bc.ca/remserial/ +endef + +define Package/remserial/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/remserial $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,remserial)) diff --git a/net/rp-pppoe/Makefile b/net/rp-pppoe/Makefile new file mode 100644 index 0000000..c35bafb --- /dev/null +++ b/net/rp-pppoe/Makefile @@ -0,0 +1,147 @@ +# +# Copyright (C) 2006-2016 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:=rp-pppoe +PKG_VERSION:=3.12 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Daniel Dickinson +PKG_LICENSE:=LGPL-2.0+ + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://roaringpenguin.com/files/download +PKG_MD5SUM:=00794e04031546b0e9b8cf286f2a6d1ccfc4a621b2a3abb2d7ef2a7ab7cc86c2 + +PKG_BUILD_DEPENDS:=ppp + +include $(INCLUDE_DIR)/package.mk + +define Package/rp-pppoe/Default + SECTION:=net + CATEGORY:=Network + TITLE:=PPPoE (PPP over Ethernet) + URL:=http://roaringpenguin.com/products/pppoe + SUBMENU:=dial-in/up +endef + +define Package/rp-pppoe/Default/description + Dubbed RP-PPPoE, this open-source product is ideal for Linux users with + a DSL "modem" whose Internet service provider uses PPPoE. +endef + +define Package/rp-pppoe-common + $(call Package/rp-pppoe/Default) + TITLE+= common + DEPENDS:=+ppp +endef + +define Package/rp-pppoe-common/description +$(call Package/rp-pppoe/Default/description) + + This package contains files common to server and relay. +endef + +define Package/rp-pppoe-common/conffiles +/etc/config/pppoe +endef + +define Package/rp-pppoe-relay + $(call Package/rp-pppoe/Default) + DEPENDS:=+rp-pppoe-common + TITLE+= relay + DEFAULT:=n +endef + +define Package/rp-pppoe-relay/description +$(call Package/rp-pppoe/Default/description) + + This package contains pppoe-relay. +endef + +define Package/rp-pppoe-relay/conffiles +/etc/default/pppoe-relay +endef + +define Package/rp-pppoe-server + $(call Package/rp-pppoe/Default) + DEPENDS:=+rp-pppoe-common + TITLE+= server +endef + +define Package/rp-pppoe-server/conffiles +/etc/ppp/pppoe-server-options +/etc/ppp/options +/etc/ppp/pap-secrets +/etc/ppp/chap-secrets +/etc/default/pppoe-server +endef + +define Package/rp-pppoe-server/description +$(call Package/rp-pppoe/Default/description) + + This package contains pppoe-server. +endef + +define Package/rp-pppoe-sniff + $(call Package/rp-pppoe/Default) + DEPENDS:=+ppp @BROKEN + TITLE+= sniffer +endef + +define Package/rp-pppoe-sniff/description +$(call Package/rp-pppoe/Default/description) + + This package contains pppoe-sniff. +endef + +TARGET_CFLAGS += -I$(PKG_BUILD_DIR)/src/libevent -isystem $(PKG_BUILD_DIR)/missing-headers +CONFIGURE_PATH := ./src +CONFIGURE_ARGS += ac_cv_path_PPPD=/usr/sbin/pppd --enable-plugin=$(STAGING_DIR)/usr/include/ +MAKE_FLAGS := DESTDIR="$(PKG_INSTALL_DIR)" install +MAKE_PATH := ./src + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR)/missing-headers/net + $(CP) ./files/ppp_defs.h $(PKG_BUILD_DIR)/missing-headers/net/ + $(call Build/Prepare/Default,$(1),$(2),$(3)) +endef + +define Package/rp-pppoe-common/install + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/pppoe.config $(1)/etc/config/pppoe +endef + +define Package/rp-pppoe-relay/install + $(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/uci-defaults + $(INSTALL_BIN) ./files/pppoe-relay.init $(1)/etc/init.d/pppoe-relay + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/pppoe-relay $(1)/usr/sbin/ + $(INSTALL_DATA) ./files/pppoe-relay.default $(1)/etc/uci-defaults/ +endef + +define Package/rp-pppoe-server/install + $(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/uci-defaults + $(INSTALL_BIN) ./files/pppoe-server.init $(1)/etc/init.d/pppoe-server + $(INSTALL_DIR) $(1)/etc/ppp + $(INSTALL_CONF) ./files/ppp/{options,pap-secrets,pppoe-server-options} $(1)/etc/ppp/ + $(INSTALL_DIR) $(1)/etc/ppp/plugins + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/pppoe-server $(1)/usr/sbin/ + $(CP) $(PKG_INSTALL_DIR)/etc/ppp/plugins/rp-pppoe.so $(1)/etc/ppp/plugins/ + $(INSTALL_DATA) ./files/pppoe-server.default $(1)/etc/uci-defaults/ +endef + +define Package/rp-pppoe-sniff/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/pppoe-sniff $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,rp-pppoe-common)) +$(eval $(call BuildPackage,rp-pppoe-relay)) +$(eval $(call BuildPackage,rp-pppoe-server)) +$(eval $(call BuildPackage,rp-pppoe-sniff)) diff --git a/net/rp-pppoe/files/ppp/options b/net/rp-pppoe/files/ppp/options new file mode 100644 index 0000000..6b93f7b --- /dev/null +++ b/net/rp-pppoe/files/ppp/options @@ -0,0 +1,10 @@ +#debug +logfile /dev/null +noipdefault +noaccomp +nopcomp +nocrtscts +lock +maxfail 0 +lcp-echo-failure 5 +lcp-echo-interval 1 diff --git a/net/rp-pppoe/files/ppp/pap-secrets b/net/rp-pppoe/files/ppp/pap-secrets new file mode 100644 index 0000000..14b11d1 --- /dev/null +++ b/net/rp-pppoe/files/ppp/pap-secrets @@ -0,0 +1,2 @@ +# client server secret IP addresses +* * * * diff --git a/net/rp-pppoe/files/ppp/pppoe-server-options b/net/rp-pppoe/files/ppp/pppoe-server-options new file mode 100644 index 0000000..a4b1da4 --- /dev/null +++ b/net/rp-pppoe/files/ppp/pppoe-server-options @@ -0,0 +1,9 @@ +# PPP options for the PPPoE server +# LIC: GPL +require-pap +login +lcp-echo-interval 10 +lcp-echo-failure 2 +mru 1492 +mtu 1492 + diff --git a/net/rp-pppoe/files/ppp_defs.h b/net/rp-pppoe/files/ppp_defs.h new file mode 100644 index 0000000..3a1e758 --- /dev/null +++ b/net/rp-pppoe/files/ppp_defs.h @@ -0,0 +1,11 @@ +#ifndef _NET_PPP_DEFS_H +#define _NET_PPP_DEFS_H + +#define __need_time_t +#include + +#include +#include + +#endif + diff --git a/net/rp-pppoe/files/pppoe-relay.default b/net/rp-pppoe/files/pppoe-relay.default new file mode 100644 index 0000000..c7a286a --- /dev/null +++ b/net/rp-pppoe/files/pppoe-relay.default @@ -0,0 +1,10 @@ +#!/bin/sh + +if [ -e /etc/default/pppoe-relay ]; then + if [ -z "$(uci get pppoe.@pppoe_relay[-1] 2>/dev/null)" ]; then + uci add pppoe pppoe_relay + fi + uci set pppoe.@pppoe-relay[-1].use_non_uci_config=1 + uci commit pppoe +fi + diff --git a/net/rp-pppoe/files/pppoe-relay.init b/net/rp-pppoe/files/pppoe-relay.init new file mode 100755 index 0000000..4aeeee8 --- /dev/null +++ b/net/rp-pppoe/files/pppoe-relay.init @@ -0,0 +1,72 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=50 +USE_PROCD=1 + +pppoe_triggers() { + local cfg="$1" + local interface server_interfaces client_interfaces both_interfaces + config_get server_interfaces "$cfg" server_interface + config_get client_interfaces "$cfg" client_interface + config_get both_interfaces "$cfg" both_interfaces + for interface in $server_interfaces; do + append interfaces "$interface" "|" + done + for interface in $client_interfaces; do + append interfaces "$interface" "|" + done + for interface in $both_interfaces; do + append interfaces "$interface" "|" + done +} + +pppoe_relay_instance() { + local cfg="$1" + local interface server_interfaces client_interfaces both_interfaces maxsessions timeout OPTIONS + config_get server_interfaces "$cfg" server_interface + config_get client_interfaces "$cfg" client_interface + config_get both_interfaces "$cfg" both_interfaces + config_get maxsessions "$cfg" maxsesssions + config_get timeout "$cfg" timeout + config_get_bool use_non_uci_config "$cfg" use_non_uci_config 0 + + if [ "$use_non_uci_config" -gt 0 ]; then + . /etc/default/pppoe-relay + else + [ -z "${server_interfaces}${client_interfaces}${both_interfaces}" ] && return 1 + for interface in $server_interfaces; do + append OPTIONS "-S $interface" + done + for interface in $client_interfaces; do + append OPTIONS "-C $interface" + done + for interface in $both_interfaces; do + append OPTIONS "-B $interface" + done + [ -n "$maxsesssions" ] && append OPTIONS "-n $maxsesssions" + [ -n "$timeout" ] && append OPTIONS "-i $timeout" + fi + + procd_open_instance + procd_set_param command /usr/sbin/pppoe-relay -F + procd_append_param command $OPTIONS + procd_close_instance +} + +start_service() { + local use_non_uci_config + + config_load pppoe + config_foreach pppoe_relay_instance pppoe_relay +} + +reload_triggers() { + local interfaces + + config_load pppoe + config_foreach pppoe_triggers pppoe_relay + + procd_add_reload_trigger "pppoe" + procd_add_interface_trigger "$interfaces" +} diff --git a/net/rp-pppoe/files/pppoe-server.default b/net/rp-pppoe/files/pppoe-server.default new file mode 100644 index 0000000..36c9b5a --- /dev/null +++ b/net/rp-pppoe/files/pppoe-server.default @@ -0,0 +1,10 @@ +#!/bin/sh + +if [ -e /etc/default/pppoe-server ]; then + if [ -z "$(uci get pppoe.@pppoe_server[-1] 2>/dev/null)" ]; then + uci add pppoe pppoe_server_ + fi + uci set pppoe.@pppoe-server[-1].use_non_uci_config=1 + uci commit pppoe +fi + diff --git a/net/rp-pppoe/files/pppoe-server.init b/net/rp-pppoe/files/pppoe-server.init new file mode 100755 index 0000000..dd2568e --- /dev/null +++ b/net/rp-pppoe/files/pppoe-server.init @@ -0,0 +1,74 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=50 +USE_PROCD=1 + +pppoe_triggers() { + local cfg="$1" + local interface + config_get interface "$cfg" interface +} + +pppoe_instance() { + local cfg="$1" + local interface ac_name service_names service_name maxsessionsperpeer localip firstremoteip maxsessions optionsfiles randomsession unit offset timeout mss sync OPTIONS + config_get interface "$cfg" interface + config_get ac_name "$cfg" ac_name + config_get service_names "$cfg" service_name + config_get maxsessionsperpeer "$cfg" maxsesssionsperpeer + config_get localip "$cfg" localip + config_get firstremoteip "$cfg" firstremoteip + config_get maxsessions "$cfg" maxsessions + config_get optionsfile "$cfg" optionsfile + config_get_bool randomsession "$cfg" randomsession 1 + config_get_bool unit "$cfg" unit 0 + config_get offset "$cfg" offset + config_get timeout "$cfg" timeout + config_get mss "$cfg" mss + config_get_bool sync "$cfg" sync 0 + config_get use_non_uci_config "$cfg" use_non_uci_config 0 + + if [ "$use_non_uci_config" -gt 0 ]; then + . /etc/default/pppoe-server + else + [ -z "$interface" ] && return 1 + [ -n "$ac_name" ] && append OPTIONS "-C $ac_name" + for service_name in $service_names; do + append OPTIONS "-S $service_name" + done + append OPTIONS "-I $interface" + [ -n "$maxsesssionsperpeer" ] && append OPTIONS "-x $maxsesssionsperpeer" + [ -n "$localip" ] && append OPTIONS "-L $localip" + [ -n "$firstremoteip" ] && append OPTIONS "-R $firstremoteip" + [ -n "maxsessions" ] && append OPTIONS "-N $maxsessions" + [ -n "optionsfile" ] && append OPTIONS "-O $optionsfile" + [ "$randomsession" = "1" ] && append OPTIONS "-r" + [ "$unit" = "1" ] && append OPTIONS "-u" + [ -n "$offset" ] && append OPTIONS "-o $offset" + [ -n "$timeout" ] && append OPTIONS "-T $timeout" + [ -n "$mss" ] && append OPTIONS "-m $mss" + [ "$sync" = "1" ] && append OPTIONS "-s" + fi + + procd_open_instance + procd_set_param command /usr/sbin/pppoe-server -F + procd_append_param command $OPTIONS + procd_set_param file /etc/ppp/options + procd_append_param file /etc/ppp/pppoe-server-options + procd_close_instance +} + +start_service() { + config_load pppoe + config_foreach pppoe_instance pppoe_server +} + +service_triggers() { + local interface + config_load pppoe + config_foreach pppoe_triggers pppoe_server + + procd_add_reload_trigger "pppoe" + procd_add_interface_trigger "$interface" +} diff --git a/net/rp-pppoe/files/pppoe.config b/net/rp-pppoe/files/pppoe.config new file mode 100644 index 0000000..e5d1a38 --- /dev/null +++ b/net/rp-pppoe/files/pppoe.config @@ -0,0 +1,23 @@ +#config pppoe_server +# option interface eth1 +# option ac_name access-concentrator-name +# list service_name service-name1 +# list service_name service-name2 +# option maxsessionsperpeer 0 +# option localip 192.168.2.1 +# option firsremoteip 192.168.2.2 +# option maxsessions 64 +# option optionsfile /etc/ppp/pppoe-server-options +# option randomsessions 1 +# option unit 0 +# option offset 0 +# option timeout 60 +# option mss 1468 +# option sync 0 + +#config pppoe_relay +# list server_interface eth1 +# list client_interface eth0 +# list both_interface eth2 +# option maxsessions 64 +# option timeout 60 diff --git a/net/rp-pppoe/patches/100-configure.patch b/net/rp-pppoe/patches/100-configure.patch new file mode 100644 index 0000000..d45593a --- /dev/null +++ b/net/rp-pppoe/patches/100-configure.patch @@ -0,0 +1,36 @@ +--- a/src/configure ++++ b/src/configure +@@ -3661,7 +3661,7 @@ done + + for ac_header in linux/if.h + do : +- ac_fn_c_check_header_compile "$LINENO" "linux/if.h" "ac_cv_header_linux_if_h" "#include ++ ac_fn_c_check_header_compile "$LINENO" "linux/if.h" "ac_cv_header_linux_if_h" "#include + " + if test "x$ac_cv_header_linux_if_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +@@ -3675,10 +3675,11 @@ done + for ac_header in linux/if_pppox.h + do : + ac_fn_c_check_header_compile "$LINENO" "linux/if_pppox.h" "ac_cv_header_linux_if_pppox_h" " +-#include +-#include +-#include +-#include ++#include ++#include ++#include ++#include ++#include + + " + if test "x$ac_cv_header_linux_if_pppox_h" = x""yes; then : +@@ -4611,7 +4612,7 @@ esac + $as_echo_n "checking packing order of bit fields... " >&6; } + if test "${rpppoe_cv_pack_bitfields+set}" != set ; then + if test "$cross_compiling" = yes; then : +- $ECHO "no defaults for cross-compiling"; exit 0 ++ rpppoe_cv_pack_bitfields="$ac_cv_pack_bitfields" + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ diff --git a/net/rp-pppoe/patches/110-Makefile.patch b/net/rp-pppoe/patches/110-Makefile.patch new file mode 100644 index 0000000..9dc1c72 --- /dev/null +++ b/net/rp-pppoe/patches/110-Makefile.patch @@ -0,0 +1,11 @@ +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -71,7 +71,7 @@ pppoe-sniff: pppoe-sniff.o if.o common.o + @CC@ -o $@ $^ $(LDFLAGS) + + pppoe-server: pppoe-server.o if.o debug.o common.o md5.o libevent/libevent.a @PPPOE_SERVER_DEPS@ +- @CC@ -o $@ @RDYNAMIC@ $^ $(LDFLAGS) $(PPPOE_SERVER_LIBS) -Llibevent -levent ++ @CC@ -o $@ @RDYNAMIC@ $^ $(LDFLAGS) $(PPPOE_SERVER_LIBS) + + pppoe: pppoe.o if.o debug.o common.o ppp.o discovery.o + @CC@ -o $@ $^ $(LDFLAGS) diff --git a/net/rp-pppoe/patches/120-use-linux-ether-not-netinet.patch b/net/rp-pppoe/patches/120-use-linux-ether-not-netinet.patch new file mode 100644 index 0000000..c9a5f69 --- /dev/null +++ b/net/rp-pppoe/patches/120-use-linux-ether-not-netinet.patch @@ -0,0 +1,40 @@ +Index: rp-pppoe-3.11/src/configure +=================================================================== +--- rp-pppoe-3.11.orig/src/configure 2016-05-21 23:42:58.142423086 -0400 ++++ rp-pppoe-3.11/src/configure 2016-05-21 23:42:58.178423086 -0400 +@@ -3646,7 +3646,7 @@ + done + + +-for ac_header in fcntl.h sys/dlpi.h sys/ioctl.h sys/time.h syslog.h unistd.h net/if_arp.h netinet/if_ether.h getopt.h sys/uio.h sys/param.h fcntl.h net/bpf.h netpacket/packet.h net/ethernet.h asm/types.h linux/if_packet.h linux/if_ether.h sys/socket.h sys/cdefs.h net/if.h net/if_dl.h net/if_ether.h net/if_types.h netinet/if_ether.h net/if_types.h net/if_dl.h ++for ac_header in fcntl.h sys/dlpi.h sys/ioctl.h sys/time.h syslog.h unistd.h net/if_arp.h getopt.h sys/uio.h sys/param.h fcntl.h net/bpf.h netpacket/packet.h asm/types.h linux/if_packet.h linux/if_ether.h sys/socket.h sys/cdefs.h net/if.h net/if_dl.h net/if_types.h net/if_types.h net/if_dl.h + do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` + ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +Index: rp-pppoe-3.11/src/if.c +=================================================================== +--- rp-pppoe-3.11.orig/src/if.c 2012-08-17 14:31:25.000000000 -0400 ++++ rp-pppoe-3.11/src/if.c 2016-05-21 23:45:13.546423086 -0400 +@@ -30,10 +30,6 @@ + #include + #endif + +-#ifdef HAVE_NET_ETHERNET_H +-#include +-#endif +- + #ifdef HAVE_ASM_TYPES_H + #include + #endif +Index: rp-pppoe-3.11/src/plugin.c +=================================================================== +--- rp-pppoe-3.11.orig/src/plugin.c 2012-08-17 14:31:25.000000000 -0400 ++++ rp-pppoe-3.11/src/plugin.c 2016-05-21 23:43:55.314423086 -0400 +@@ -49,7 +49,6 @@ + #include + #include + #include +-#include + #include + #include + #include diff --git a/net/rsync/Config.in b/net/rsync/Config.in new file mode 100644 index 0000000..dfbfdf1 --- /dev/null +++ b/net/rsync/Config.in @@ -0,0 +1,25 @@ +if PACKAGE_rsync + + config RSYNC_xattr + bool + prompt "Enable xattr support" + default n + + config RSYNC_acl + bool + prompt "Enable ACL support" + default n + + config RSYNC_zlib + bool + prompt "Enable system zlib" + help + Use the system's zlib library instead of rsync's internal copy. Enabling + this may create compatibility errors when using compression with older + clients, or those using the current default of the bundled zlib. + + rsync's upstream default is to use their bundled zlib. OpenWrt uses the + system zlib for space reasons. The system zlib will eventually become + default for upstream as well. + default y +endif diff --git a/net/rsync/Makefile b/net/rsync/Makefile new file mode 100644 index 0000000..f9fa047 --- /dev/null +++ b/net/rsync/Makefile @@ -0,0 +1,104 @@ +# +# Copyright (C) 2007-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:=rsync +PKG_VERSION:=3.1.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://rsync.samba.org/ftp/rsync/src +PKG_MD5SUM:=0f758d7e000c0f7f7d3792610fad70cb +PKG_MAINTAINER:=Maxim Storchak +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/rsync + SECTION:=net + CATEGORY:=Network + SUBMENU:=File Transfer + TITLE:=Fast remote file copy program (like rcp) + DEPENDS:=+libpopt +RSYNC_xattr:libattr +RSYNC_acl:libacl +RSYNC_zlib:zlib + URL:=http://rsync.samba.org/ + MENU:=1 +endef + +define Package/rsync/config + source "$(SOURCE)/Config.in" +endef + +CONFIGURE_ARGS += \ + --with-included-popt=no \ + --disable-debug \ + --disable-locale \ + +ifeq ($(CONFIG_RSYNC_xattr),y) + CONFIGURE_ARGS+= --enable-xattr-support +else + CONFIGURE_ARGS+= --disable-xattr-support +endif + +ifeq ($(CONFIG_RSYNC_acl),y) + CONFIGURE_ARGS+= --enable-acl-support +else + CONFIGURE_ARGS+= --disable-acl-support +endif + +ifeq ($(CONFIG_RSYNC_zlib),y) + CONFIGURE_ARGS+= --with-included-zlib=no +else + CONFIGURE_ARGS+= --with-included-zlib=yes +endif + +define Package/rsyncd + SECTION:=net + CATEGORY:=Network + SUBMENU:=File Transfer + TITLE:=Rsync daemon + DEPENDS:=+rsync + URL:=http://rsync.samba.org/ +endef + +define Package/rsync/description + rsync is a program that allows files to be copied to and from remote machines + in much the same way as rcp. It has many more options than rcp, and uses the + rsync remote-update protocol to greatly speed up file transfers when the + destination file already exists. + + The rsync remote-update protocol allows rsync to transfer just the differences + between two sets of files across the network link. +endef + +define Package/rsync/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/ +endef + +define Package/rsyncd/description + rsyncd is a configuration file and initscript to utilize rsync as a daemon. It + uses the same binary as rsync. +endef + +define Package/rsyncd/conffiles +/etc/rsyncd.conf +endef + +define Package/rsyncd/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) ./files/rsyncd.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/rsyncd.init $(1)/etc/init.d/rsyncd +endef + +$(eval $(call BuildPackage,rsync)) +$(eval $(call BuildPackage,rsyncd)) diff --git a/net/rsync/files/rsyncd.conf b/net/rsync/files/rsyncd.conf new file mode 100644 index 0000000..2f4cd9e --- /dev/null +++ b/net/rsync/files/rsyncd.conf @@ -0,0 +1,16 @@ +# /etc/rsyncd.conf +# Minimal configuration for rsync daemon + +# Next line required for init script +pid file = /var/run/rsyncd.pid +log file = /var/log/rsyncd.log +use chroot = yes +uid = nobody +gid = nogroup +read only = yes + +# Simple example to configure server +#[openwrt-etc] +#path = /etc +#comment = OpenWrt Configuration Files +#exclude = /init.d diff --git a/net/rsync/files/rsyncd.init b/net/rsync/files/rsyncd.init new file mode 100644 index 0000000..d226d0f --- /dev/null +++ b/net/rsync/files/rsyncd.init @@ -0,0 +1,14 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2011-2014 OpenWrt.org + +START=90 +STOP=10 + +USE_PROCD=1 +PROG=/usr/bin/rsync + +start_service() { + procd_open_instance + procd_set_param command "$PROG" --daemon --no-detach + procd_close_instance +} diff --git a/net/rsyslog/Makefile b/net/rsyslog/Makefile new file mode 100644 index 0000000..1e33215 --- /dev/null +++ b/net/rsyslog/Makefile @@ -0,0 +1,57 @@ +# +# 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:=rsyslog +PKG_VERSION:=8.18.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.rsyslog.com/files/download/rsyslog/ +PKG_MD5SUM:=750d552bdcbf255c85f464ffbe21168a + +PKG_MAINTAINER:=Dov Murik +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/rsyslog + SECTION:=net + CATEGORY:=Network + TITLE:=Enhanced system logging and kernel message trapping daemons + URL:=http://www.rsyslog.com/ + DEPENDS:=+libestr +libfastjson +libuuid +zlib +USE_UCLIBC:libpthread +USE_UCLIBC:librt +endef + +define Package/rsyslog/conffiles +/etc/rsyslog.conf +endef + +CONFIGURE_ARGS+= \ + --disable-libgcrypt \ + --disable-liblogging-stdlog + +TARGET_CFLAGS += \ + -std=c99 + +define Package/rsyslog/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/rsyslogd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/usr/lib/rsyslog + $(CP) $(PKG_INSTALL_DIR)/usr/lib/rsyslog/* $(1)/usr/lib/rsyslog/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) ./files/rsyslog.conf $(1)/etc + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/rsyslog.init $(1)/etc/init.d/rsyslog +endef + +$(eval $(call BuildPackage,rsyslog)) diff --git a/net/rsyslog/files/rsyslog.conf b/net/rsyslog/files/rsyslog.conf new file mode 100644 index 0000000..5aaed41 --- /dev/null +++ b/net/rsyslog/files/rsyslog.conf @@ -0,0 +1,18 @@ +module(load="imuxsock") +module(load="imklog") +module(load="imudp") +input(type="imudp" port="514") +#module(load="imtcp") +#input(type="imtcp" port="514") + +$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +*.info;mail.none;authpriv.none;cron.none /var/log/messages + +authpriv.* /var/log/secure + +mail.* /var/log/maillog + +cron.* /var/log/cron + +local7.* /var/log/boot.log diff --git a/net/rsyslog/files/rsyslog.init b/net/rsyslog/files/rsyslog.init new file mode 100644 index 0000000..20eb2a4 --- /dev/null +++ b/net/rsyslog/files/rsyslog.init @@ -0,0 +1,12 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014 OpenWrt.org + +START=20 + +USE_PROCD=1 + +start_service() { + procd_open_instance + procd_set_param command /usr/sbin/rsyslogd -n + procd_close_instance +} diff --git a/net/rtorrent/Makefile b/net/rtorrent/Makefile new file mode 100644 index 0000000..596854e --- /dev/null +++ b/net/rtorrent/Makefile @@ -0,0 +1,92 @@ +# +# Copyright (C) 2007-2015 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:=rtorrent +PKG_VERSION:=0.9.6-git-1 +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/rakshasa/rtorrent.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=62cb5a4605c0664bc522e0e0da9c72f09cf643a9 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_FIXUP:=autoreconf +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/rtorrent/Default + SUBMENU:=BitTorrent + SECTION:=net + CATEGORY:=Network + TITLE:=BitTorrent client for ncurses + URL:=http://libtorrent.rakshasa.no/ + DEPENDS:=+libcurl +libtorrent +libncursesw +libsigcxx +libpthread + MAINTAINER:=Peter Wagner +endef + +define Package/rtorrent/Default/description + rTorrent is a BitTorrent client for ncurses, using the libtorrent library. + The client and library is written in C++ with emphasis on speed and + efficiency, while delivering equivalent features to those found in GUI based + clients in an ncurses client. +endef + +define Package/rtorrent +$(call Package/rtorrent/Default) + VARIANT:=norpc +endef + +define Package/rtorrent/description +$(call Package/rtorrent/Default/description) + This package is built without xmlrpc support +endef + +define Package/rtorrent-rpc +$(call Package/rtorrent/Default) + VARIANT:=rpc + DEPENDS+=+xmlrpc-c-server + TITLE+=(with rpc support) +endef + +define Package/rtorrent-rpc/description +$(call Package/rtorrent/Default/description) + This package is built with xmlrpc support +endef + +TARGET_LDFLAGS += -lz -lpthread -Wl,-rpath-link=$(STAGING_DIR)/usr/lib + +CONFIGURE_ARGS+= \ + --enable-shared \ + --disable-static \ + --disable-debug \ + --disable-ipv6 + +ifeq ($(BUILD_VARIANT),rpc) + CONFIGURE_ARGS += \ + --with-xmlrpc-c +endif + + +define Package/rtorrent/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rtorrent $(1)/usr/bin/ +endef + +Package/rtorrent-rpc/install = $(Package/rtorrent/install) + +$(eval $(call BuildPackage,rtorrent)) +$(eval $(call BuildPackage,rtorrent-rpc)) diff --git a/net/rtorrent/patches/100-fix-cross_compile.patch b/net/rtorrent/patches/100-fix-cross_compile.patch new file mode 100644 index 0000000..82dcc76 --- /dev/null +++ b/net/rtorrent/patches/100-fix-cross_compile.patch @@ -0,0 +1,30 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -4,7 +4,6 @@ AC_DEFINE(API_VERSION, 9, api version) + + AM_INIT_AUTOMAKE + AC_CONFIG_HEADERS(config.h) +-AM_PATH_CPPUNIT(1.9.6) + + AC_PROG_CXX + AC_PROG_LIBTOOL +--- a/scripts/common.m4 ++++ b/scripts/common.m4 +@@ -153,7 +153,7 @@ dnl Need to fix this so that it uses t + AC_DEFUN([TORRENT_CHECK_EXECINFO], [ + AC_MSG_CHECKING(for execinfo.h) + +- AC_RUN_IFELSE([AC_LANG_SOURCE([ ++ AC_LINK_IFELSE([AC_LANG_SOURCE([ + #include + int main() { backtrace((void**)0, 0); backtrace_symbols((char**)0, 0); return 0;} + ])], +@@ -168,7 +168,7 @@ AC_DEFUN([TORRENT_CHECK_EXECINFO], [ + AC_DEFUN([TORRENT_CHECK_ALIGNED], [ + AC_MSG_CHECKING(the byte alignment) + +- AC_RUN_IFELSE([AC_LANG_SOURCE([ ++ AC_LINK_IFELSE([AC_LANG_SOURCE([ + #include + int main() { + char buf@<:@8@:>@ = { 0, 0, 0, 0, 1, 0, 0, 0 }; diff --git a/net/rtorrent/patches/120-fix-ncurses.patch b/net/rtorrent/patches/120-fix-ncurses.patch new file mode 100644 index 0000000..f491de3 --- /dev/null +++ b/net/rtorrent/patches/120-fix-ncurses.patch @@ -0,0 +1,11 @@ +--- a/src/display/canvas.h ++++ b/src/display/canvas.h +@@ -48,7 +48,7 @@ class Canvas { + public: + typedef std::vector attributes_list; + +- Canvas(int x = 0, int y = 0, int width = 0, int height = 0); ++ Canvas(int x = 0, int y = 0, int width = 1, int height = 1); + ~Canvas() { delwin(m_window); } + + void refresh() { wnoutrefresh(m_window); } diff --git a/net/scapy/Makefile b/net/scapy/Makefile new file mode 100644 index 0000000..4771e8d --- /dev/null +++ b/net/scapy/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2006-2015 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:=scapy +PKG_VERSION:=2.3.1 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=PKG-INFO + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip +PKG_SOURCE_URL:=https://bitbucket.org/secdev/scapy/downloads/ +PKG_MD5SUM:=a30d828e59801d1d092219b349f1da9e + +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/scapy + SECTION:=net + CATEGORY:=Network + TITLE:=Interactive packet manipulation tool and network scanner + MAINTAINER:=W. Michael Petullo + URL:=http://www.secdev.org/projects/scapy/ + DEPENDS:=+python +endef + +define Package/scapy/description + Scapy is a powerful interactive packet manipulation program built on top + of the Python interpreter. It can be used to forge or decode packets of + a wide number of protocols, send them over the wire, capture them, match + requests and replies, and much more. +endef + +define Build/Compile + $(call Build/Compile/PyMod,., \ + install --prefix="/usr" --root="$(PKG_INSTALL_DIR)", \ + ) +endef + +define Package/scapy/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(INSTALL_DIR) $(1)/usr/bin + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR)/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin +endef + +$(eval $(call BuildPackage,scapy)) diff --git a/net/seafile-ccnet/Makefile b/net/seafile-ccnet/Makefile new file mode 100644 index 0000000..384fe46 --- /dev/null +++ b/net/seafile-ccnet/Makefile @@ -0,0 +1,75 @@ +# +# Copyright (C) 2007-2016 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:=seafile-ccnet +PKG_VERSION:=5.1.4 +PKG_RELEASE=$(PKG_SOURCE_VERSION)-1 +PKG_LICENSE:=GPL-3.0 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/haiwen/ccnet.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=44f74fdc5160c1bf16a92e71d79b856763ddbc15 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk +$(call include_mk, python-package.mk) + +define Package/seafile-ccnet + SECTION:=net + CATEGORY:=Network + TITLE:=Seafile server - ccnet component + MAINTAINER:=Gergely Kiss + URL:=http://seafile.com/ + DEPENDS:=+libsearpc +libevent2 +libopenssl \ + +glib2 +python +libzdb +libuuid \ + +libpthread +libsqlite3 +jansson $(ICONV_DEPENDS) + EXTRA_DEPENDS:=libsearpc (=5.1.4-8998e7b2c5587f0b94c48db24e2952d08def5add-1) +endef + +define Package/seafile-ccnet/description + Ccnet is a framework for writing networked applications in C. +endef + +CONFIGURE_ARGS += --disable-client \ + --enable-server \ + --disable-ldap \ + --disable-cluster \ + --enable-python \ + --disable-server-pkg \ + --disable-static-build \ + --disable-compile-demo \ + --disable-console + +PKG_BUILD_DEPENDS:=vala/host + +TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \ + -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz + +define Package/seafile-ccnet/install + $(INSTALL_DIR) $(1)/usr/{bin,lib} + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) $(PKG_INSTALL_DIR)/usr/bin/ccnet* $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/ccnet $(1)$(PYTHON_PKG_DIR) + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libccnet.so* $(1)/usr/lib/ + find $(1) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/include/ccnet* $(1)/usr/include/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libccnet.pc $(1)/usr/lib/pkgconfig/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libccnet.so* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,seafile-ccnet)) diff --git a/net/seafile-ccnet/patches/010-Makefile.patch b/net/seafile-ccnet/patches/010-Makefile.patch new file mode 100644 index 0000000..d8b1ae8 --- /dev/null +++ b/net/seafile-ccnet/patches/010-Makefile.patch @@ -0,0 +1,31 @@ +diff -rupN seafile-ccnet-5.1.1.orig/lib/Makefile.am seafile-ccnet-5.1.1/lib/Makefile.am +--- seafile-ccnet-5.1.1.orig/lib/Makefile.am 2016-04-21 11:04:46.000000000 +0200 ++++ seafile-ccnet-5.1.1/lib/Makefile.am 2016-04-22 10:02:52.583732050 +0200 +@@ -1,3 +1,4 @@ ++include $(TOPDIR)/rules.mk + + AM_CPPFLAGS = @GLIB2_CFLAGS@ -I$(top_srcdir)/include \ + -I$(top_srcdir)/include/ccnet \ +@@ -72,11 +73,11 @@ ccnet-client.c: ccnet-object.h + + ccnet-object.h: ${ccnet_object_define} + rm -f $@ +- valac --pkg posix ${ccnet_object_define} -C -H ccnet-object.h ++ "$(STAGING_DIR)/host/bin/valac" --pkg posix ${ccnet_object_define} -C -H ccnet-object.h + + ccnetobj.c: ${ccnet_object_define} + rm -f $@ +- valac -C --pkg posix ${ccnet_object_define} ++ "$(STAGING_DIR)/host/bin/valac" -C --pkg posix ${ccnet_object_define} + + searpc_gen = searpc-signature.h searpc-marshal.h + +@@ -86,7 +87,7 @@ rpc_table.stamp: ${top_srcdir}/lib/rpc_t + @rm -f rpc_table.tmp + @touch rpc_table.tmp + @echo "[libsearpc]: generating rpc header files" +- @PYTHON@ `which searpc-codegen.py` ${top_srcdir}/lib/rpc_table.py ++ @PYTHON@ "$(STAGING_DIR)/usr/bin/searpc-codegen.py" ${top_srcdir}/lib/rpc_table.py + @echo "[libsearpc]: done" + @mv -f rpc_table.tmp $@ + diff --git a/net/seafile-seahub/Makefile b/net/seafile-seahub/Makefile new file mode 100644 index 0000000..09458b6 --- /dev/null +++ b/net/seafile-seahub/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2007-2016 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:=seafile-seahub +PKG_VERSION:=5.1.4 +PKG_RELEASE=$(PKG_SOURCE_VERSION)-1 +PKG_LICENSE:=Apache-2.0 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/haiwen/seahub.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=1e1c02aa4f2a0256ffa29a28224aad2d678f43a0 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/seafile-seahub + SECTION:=net + CATEGORY:=Network + TITLE:=Seafile server - seahub component + MAINTAINER:=Gergely Kiss + URL:=http://seafile.com/ + DEPENDS:=+simplejson +python +pillow +chardet +django +django-appconf \ + +django-compressor +django-constance +django-jsonfield +django-picklefield \ + +django-postoffice +django-restframework +django-statici18n +et_xmlfile \ + +flup +gunicorn +jdcal +openpyxl +python-dateutil +python-mysql +pytz +rcssmin +endef + +define Build/Configure +endef + +define Build/Compile + $(call Build/Compile/Default,locale) +endef + +define Package/seafile-seahub/description + The web end of seafile server. + + NOTE: in order to have better performance, localization support is turned off by default. + Please set 'USE_I18N = True' in seahub_settings.py if you intend to use languages other than English. +endef + +define Package/seafile-seahub/install + $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server/seahub + $(CP) $(PKG_BUILD_DIR)/{locale,media,fabfile,seahub,sql,tests,thirdpart,tools} $(1)/usr/share/seafile/seafile-server/seahub/ + $(CP) $(PKG_BUILD_DIR)/*.{sh,template,py,txt} $(1)/usr/share/seafile/seafile-server/seahub/ + $(CP) $(PKG_BUILD_DIR)/{CONTRIBUTORS,HACKING,README.markdown} $(1)/usr/share/seafile/seafile-server/seahub/ + $(CP) $(PKG_BUILD_DIR)/pylintrc* $(1)/usr/share/seafile/seafile-server/seahub/ + find $(1) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f + $(SED) "s/\(SEAFILE_VERSION\s*=\s*\)'\([0-9]\.[0-9]\.[0-9]\)'/\1'$(PKG_VERSION)'/g" $(1)/usr/share/seafile/seafile-server/seahub/seahub/settings.py +endef + +$(eval $(call BuildPackage,seafile-seahub)) diff --git a/net/seafile-seahub/patches/010-default-config.patch b/net/seafile-seahub/patches/010-default-config.patch new file mode 100644 index 0000000..4168dc1 --- /dev/null +++ b/net/seafile-seahub/patches/010-default-config.patch @@ -0,0 +1,30 @@ +diff -rupN seahub-3.1.7-server.orig/seahub/settings.py seahub-3.1.7-server/seahub/settings.py +--- seahub-3.1.7-server.orig/seahub/settings.py 2014-10-20 09:32:35.000000000 +0200 ++++ seahub-3.1.7-server/seahub/settings.py 2014-12-10 15:47:21.625104606 +0100 +@@ -46,7 +46,7 @@ SITE_ID = 1 + + # If you set this to False, Django will make some optimizations so as not + # to load the internationalization machinery. +-USE_I18N = True ++USE_I18N = False + + # If you set this to False, Django will not format dates, numbers and + # calendars according to the current locale. +@@ -209,7 +209,7 @@ SHOW_REPO_DOWNLOAD_BUTTON = False + REPO_PASSWORD_MIN_LENGTH = 8 + + # mininum length for user's password +-USER_PASSWORD_MIN_LENGTH = 6 ++USER_PASSWORD_MIN_LENGTH = 8 + + # LEVEL based on four types of input: + # num, upper letter, lower letter, other symbols +@@ -218,7 +218,7 @@ USER_PASSWORD_STRENGTH_LEVEL = 3 + + # default False, only check USER_PASSWORD_MIN_LENGTH + # when True, check password strength level, STRONG(or above) is allowed +-USER_STRONG_PASSWORD_REQUIRED = False ++USER_STRONG_PASSWORD_REQUIRED = True + + # Using server side crypto by default, otherwise, let user choose crypto method. + FORCE_SERVER_CRYPTO = True diff --git a/net/seafile-seahub/patches/020-Makefile-fixes.patch b/net/seafile-seahub/patches/020-Makefile-fixes.patch new file mode 100644 index 0000000..49b67f8 --- /dev/null +++ b/net/seafile-seahub/patches/020-Makefile-fixes.patch @@ -0,0 +1,28 @@ +diff -rupN seafile-seahub-5.1.1.orig/Makefile seafile-seahub-5.1.1/Makefile +--- seafile-seahub-5.1.1.orig/Makefile 2016-04-26 23:59:48.000000000 +0200 ++++ seafile-seahub-5.1.1/Makefile 2016-04-28 09:03:35.507105416 +0200 +@@ -1,3 +1,6 @@ ++include $(TOPDIR)/rules.mk ++$(call include_mk, python-package.mk) ++ + PROJECT=seahub + + develop: setup-git +@@ -9,7 +12,7 @@ dist: locale uglify statici18n collectst + + locale: + @echo "--> Compile locales" +- django-admin.py compilemessages ++ $(call HostPython,,$(STAGING_DIR)/usr/bin/django-admin.py compilemessages) + @echo "" + + uglify: +@@ -19,7 +22,7 @@ uglify: + + statici18n: + @echo "--> Generate JS locale files in static/scripts/i18n" +- python manage.py compilejsi18n ++ $(call HostPython,,manage.py compilejsi18n) + + collectstatic: + @echo "--> Collect django static files to media/assets" diff --git a/net/seafile-server/Config.in b/net/seafile-server/Config.in new file mode 100644 index 0000000..d83f795 --- /dev/null +++ b/net/seafile-server/Config.in @@ -0,0 +1,16 @@ +menu "Configuration" + depends on PACKAGE_seafile-server + +config SEAFILE_FUSE_SUPPORT + bool "Enable FUSE support" + select PACKAGE_libfuse + default n + +config SEAFILE_CONSOLE_SUPPORT + bool "Enable seafile server console" + default n + +config SEAFILE_RIAK_SUPPORT + bool "Enable support for riak backend" + default n +endmenu diff --git a/net/seafile-server/Makefile b/net/seafile-server/Makefile new file mode 100644 index 0000000..3855221 --- /dev/null +++ b/net/seafile-server/Makefile @@ -0,0 +1,150 @@ +# +# Copyright (C) 2007-2016 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:=seafile-server +PKG_VERSION:=5.1.4 +PKG_RELEASE=$(PKG_SOURCE_VERSION)-1 +PKG_LICENSE:=GPL-3.0 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/haiwen/seafile.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=b9dc96ee845bb0148d9075aec597e6e07652cbdc +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk +$(call include_mk, python-package.mk) + +define Package/seafile-server + SECTION:=net + CATEGORY:=Network + TITLE:=Seafile server + MAINTAINER:=Gergely Kiss + URL:=http://seafile.com/ + DEPENDS:=+libarchive +libopenssl +glib2 +libsearpc +seafile-ccnet +seafile-seahub +sqlite3-cli +python-mysql +python-urllib3 \ + +jansson +libevent2 +libevent2-openssl +zlib +libzdb +libsqlite3 +libmysqlclient \ + +libpthread +libuuid +bash +procps-ng +procps-ng-pkill +SEAFILE_FUSE_SUPPORT:libfuse $(ICONV_DEPENDS) + EXTRA_DEPENDS:=seafile-ccnet (=5.1.4-44f74fdc5160c1bf16a92e71d79b856763ddbc15-1), seafile-seahub (=5.1.4-1e1c02aa4f2a0256ffa29a28224aad2d678f43a0-1) + MENU:=1 +endef + +define Package/seafile-server/config + source "$(SOURCE)/Config.in" +endef + +define Package/seafile-server/description + Open source cloud storage with advanced features on privacy protection and teamwork. +endef + +CONFIGURE_ARGS += --disable-client \ + --enable-server \ + --enable-python \ + --disable-static-build \ + --disable-server-pkg + +ifeq ($(CONFIG_SEAFILE_FUSE_SUPPORT),y) + CONFIGURE_ARGS += --enable-fuse + TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/fuse +else + CONFIGURE_ARGS += --disable-fuse +endif + +ifeq ($(CONFIG_SEAFILE_CONSOLE_SUPPORT),y) + CONFIGURE_ARGS += --enable-console +else + CONFIGURE_ARGS += --disable-console +endif + +ifeq ($(CONFIG_SEAFILE_RIAK_SUPPORT),y) + CONFIGURE_ARGS += --enable-riak +else + CONFIGURE_ARGS += --disable-riak +endif + +PKG_BUILD_DEPENDS:=vala/host libevhtp + +# This is required as python-package.mk overrides the default setting of having interlinking enabled +ifdef CONFIG_USE_MIPS16 + TARGET_CFLAGS += -minterlink-mips16 +endif +TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \ + -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz -levent_openssl -levent + +define Package/seafile-server/conffiles +/etc/config/seafile +endef + +define Package/seafile-server/install + $(INSTALL_DIR) $(1)/usr/{bin,lib} + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server + $(INSTALL_DIR) $(1)/usr/share/seafile/conf + $(INSTALL_DIR) $(1)/etc/{config,init.d} + $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seafile/ $(1)$(PYTHON_PKG_DIR)/ + $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seaserv/ $(1)$(PYTHON_PKG_DIR)/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/ + $(CP) $(PKG_BUILD_DIR)/scripts/seaf-gc.sh $(1)/usr/share/seafile/seafile-server/ + $(CP) $(PKG_BUILD_DIR)/scripts/seaf-fsck.sh $(1)/usr/share/seafile/seafile-server/ +ifeq ($(CONFIG_SEAFILE_FUSE_SUPPORT),y) + $(CP) $(PKG_BUILD_DIR)/scripts/seaf-fuse.sh $(1)/usr/share/seafile/seafile-server/ +endif + $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.py $(1)/usr/share/seafile/seafile-server/ + $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.sh $(1)/usr/share/seafile/seafile-server/ + $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.py $(1)/usr/share/seafile/seafile-server/ + $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.sh $(1)/usr/share/seafile/seafile-server/ + $(CP) $(PKG_BUILD_DIR)/scripts/check_init_admin.py $(1)/usr/share/seafile/seafile-server/ + $(CP) $(PKG_BUILD_DIR)/scripts/upgrade/ $(1)/usr/share/seafile/seafile-server/ + $(CP) ./files/seafile.conf $(1)/etc/config/seafile + $(INSTALL_BIN) ./files/seafile.init $(1)/etc/init.d/seafile + $(INSTALL_BIN) ./files/seahub.init $(1)/etc/init.d/seahub + find $(1) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) $(PKG_INSTALL_DIR)/usr/include/seafile/ $(1)/usr/include/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libseafile.pc $(1)/usr/lib/pkgconfig/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seafile/ $(1)$(PYTHON_PKG_DIR)/ + $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seaserv/ $(1)$(PYTHON_PKG_DIR)/ +endef + +define Package/seafile-server/postinst +#!/bin/sh +[ ! -f /etc/init.d/seafile ] && exit 0 + +if [ ! -d /usr/share/seafile/seafile-data ] +then + echo "*** Installation completed, running configuration script..." + /etc/init.d/seafile setup + + if [ $$? -ne 0 ] + then + echo + echo "*** ERROR: Configuration failed. Please fix the issues if any and re-run the script using the command below:" + echo "*** \"/etc/init.d/seafile setup\"" + fi +else + echo "*** seafile-data directory already exists." + echo + echo "*** In case you are upgrading seafile, please run the appropriate upgrade script" + echo "*** manually before using the new version." + echo "*** Upgrade scripts are located at \"/usr/share/seafile/seafile-server/upgrade\"" + echo + echo "*** For more information, please read http://manual.seafile.com/deploy/upgrade.html" +fi +endef + +$(eval $(call BuildPackage,seafile-server)) diff --git a/net/seafile-server/files/seafile.conf b/net/seafile-server/files/seafile.conf new file mode 100644 index 0000000..f4c0ea9 --- /dev/null +++ b/net/seafile-server/files/seafile.conf @@ -0,0 +1,12 @@ +# Start Seahub in fastcgi mode - 1 = enable, 0 = disable +SEAHUB_FASTCGI=0 +# Listen on the port specified below (defaults to 8000) +SEAHUB_PORT=8000 +# Method of serving requests (fastcgi mode only) - threaded or prefork +# Using threaded mode is recommended as it consumes less resources +SEAHUB_METHOD=threaded +# The maximum number of worker processes/threads (fastcgi mode only) +# General formula: (2 x $num_cores) + 1 +# To set the number of workers in WSGI mode (which is the default) +# please edit /usr/share/seafile/seafile-server/runtime/seahub.conf +SEAHUB_WORKERS=3 diff --git a/net/seafile-server/files/seafile.init b/net/seafile-server/files/seafile.init new file mode 100755 index 0000000..1c6553a --- /dev/null +++ b/net/seafile-server/files/seafile.init @@ -0,0 +1,157 @@ +#!/bin/bash /etc/rc.common + +START=98 +APP=seafile +EXTRA_HELP=" setup Runs the setup script + create_admin Creates the administrative login + reset_admin Alias to create_admin" +EXTRA_COMMANDS="setup create_admin reset_admin" + +TOPDIR=/usr/share/seafile +default_ccnet_conf_dir=${TOPDIR}/ccnet +central_config_dir=${TOPDIR}/conf +seaf_controller=/usr/bin/seafile-controller + +function validate_ccnet_conf_dir () { + if [[ ! -d ${default_ccnet_conf_dir} ]]; then + echo "Error: there is no ccnet config directory." + echo "Have you run \"/etc/init.d/seafile setup\"?" + echo "" + exit 1 + fi +} + +function validate_central_conf_dir () { + if [[ ! -d ${central_config_dir} ]]; then + echo "Error: there is no conf/ directory." + echo "Have you run \"/etc/init.d/seafile setup\"?" + echo "" + exit 1 + fi +} + +function read_seafile_data_dir () { + seafile_ini=${default_ccnet_conf_dir}/seafile.ini + if [[ ! -f ${seafile_ini} ]]; then + echo "Error: ${seafile_ini} not found." + exit 1 + fi + seafile_data_dir=$(cat "${seafile_ini}") + if [[ ! -d ${seafile_data_dir} ]]; then + echo "Your seafile server data directory \"${seafile_data_dir}\" is invalid or doesn't exits." + echo "Please check it first, or create this directory yourself." + echo "" + exit 1 + fi +} + +function test_config() { + if ! ${seaf_controller} --test \ + -c "${default_ccnet_conf_dir}" \ + -d "${seafile_data_dir}" \ + -F "${central_config_dir}" ; then + exit 1 + fi +} + +function check_component_running() { + name=$1 + cmd=$2 + if pid=$(pgrep -f "$cmd" 2>/dev/null); then + return 1 + fi +} + +function validate_already_running () { + check_component_running "seafile-controller" "seafile-controller -F ${central_config_dir}" || return 1 + check_component_running "ccnet-server" "ccnet-server -F ${central_config_dir}" || return 1 + check_component_running "seaf-server" "seaf-server -F ${central_config_dir}" || return 1 + check_component_running "fileserver" "fileserver -F ${central_config_dir}" || return 1 + check_component_running "seafdav" "wsgidav.server.run_server" || return 1 +} + +function start_seafile_server () { + if ! validate_already_running; then + if [[ "$name" == "seafile-controller" ]]; then + echo "Seafile already running." + else + echo "Error: component [$name] is already running. Please try stopping it manually by running \"kill $pid\"." + echo "To force killing the process, use \"kill -9 $pid\"." + fi + exit 1 + fi + validate_central_conf_dir + validate_ccnet_conf_dir + read_seafile_data_dir + test_config + + echo "Starting seafile server, please wait ..." + + ${seaf_controller} \ + -F "${central_config_dir}" \ + -c "${default_ccnet_conf_dir}" \ + -d "${seafile_data_dir}" + + sleep 3 + + # check if seafile server started successfully + if ! pgrep -f "seafile-controller -F ${central_config_dir}" 2>/dev/null 1>&2; then + echo "Failed to start seafile server" + exit 1 + fi + + echo "Seafile server started" + echo +} + +function stop_seafile_server () { + if ! pgrep -f "seafile-controller -F ${central_config_dir}" 2>/dev/null 1>&2; then + echo "Seafile server not running" + else + echo "Stopping seafile server ..." + pkill -SIGTERM -f "seafile-controller -F ${central_config_dir}" + pkill -f "ccnet-server -F ${central_config_dir}" + pkill -f "seaf-server -F ${central_config_dir}" + pkill -f "fileserver -F ${central_config_dir}" + pkill -f "soffice.*--invisible --nocrashreport" + pkill -f "wsgidav.server.run_server" + retry=1 + while ! validate_already_running && [ $retry -lt 60 ]; do sleep 1; ((retry++)); done + if ! validate_already_running; then + echo "Error: [$name] component is still running. Please try stopping it manually by running \"kill $pid\"." + echo "To force killing the process, use \"kill -9 $pid\"." + fi + + fi +} + +function restart_seafile_server () { + stop_seafile_server + start_seafile_server +} + +function start() { + start_seafile_server +} + +function stop() { + stop_seafile_server +} + +function restart() { + restart_seafile_server +} + +function setup() { + cd "$TOPDIR" && \ + /usr/bin/seafile-admin setup +} + +function create_admin() { + cd "$TOPDIR" && \ + /usr/bin/seafile-admin create-admin +} + +function reset_admin() { + create_admin +} diff --git a/net/seafile-server/files/seahub.init b/net/seafile-server/files/seahub.init new file mode 100755 index 0000000..da3a1d1 --- /dev/null +++ b/net/seafile-server/files/seahub.init @@ -0,0 +1,226 @@ +#!/bin/bash /etc/rc.common + +START=99 +APP=seahub +EXTRA_HELP=" clearsessions Clears expired sessions from database" +EXTRA_COMMANDS="clearsessions" + +SEAHUB_FASTCGI=0 +SEAHUB_PORT=8000 +SEAHUB_METHOD=threaded +SEAHUB_WORKERS=3 + +[ -f /etc/config/seafile ] && \ + . /etc/config/seafile + +INSTALLPATH=/usr/share/seafile/seafile-server +TOPDIR=$(dirname "${INSTALLPATH}") +default_ccnet_conf_dir=${TOPDIR}/ccnet +central_config_dir=${TOPDIR}/conf + +manage_py=${INSTALLPATH}/seahub/manage.py +gunicorn_conf=${INSTALLPATH}/runtime/seahub.conf +pidfile=/var/run/seafile/seahub.pid +errorlog=${INSTALLPATH}/runtime/error.log +accesslog=${INSTALLPATH}/runtime/access.log +gunicorn_exe=/usr/bin/gunicorn + +function check_python_executable() { + if [[ "$PYTHON" != "" && -x $PYTHON ]]; then + return 0 + fi + + if which python2.7 2>/dev/null 1>&2; then + PYTHON=python2.7 + elif which python27 2>/dev/null 1>&2; then + PYTHON=python27 + else + echo + echo "Can't find a python executable of version 2.7 or above in PATH" + echo "Install python 2.7+ before continue." + echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment varirable to it" + echo + exit 1 + fi +} + +function validate_ccnet_conf_dir() { + if [[ ! -d ${default_ccnet_conf_dir} ]]; then + echo "Error: there is no ccnet config directory." + echo "Have you run '/etc/init.d/seafile setup'?" + echo "" + exit 1 + fi +} + +function read_seafile_data_dir() { + seafile_ini=${default_ccnet_conf_dir}/seafile.ini + if [[ ! -f ${seafile_ini} ]]; then + echo "Error: ${seafile_ini} not found." + exit 1 + fi + seafile_data_dir=$(cat "${seafile_ini}") + if [[ ! -d ${seafile_data_dir} ]]; then + echo "Your seafile server data directory \"${seafile_data_dir}\" is invalid or doesn't exits." + echo "Please check it first, or create this directory yourself." + echo "" + exit 1 + fi +} + +function validate_seahub_running() { + if pid=$(pgrep -f "${manage_py}" 2>/dev/null); then + return 1 + elif pid=$(pgrep -f "seahub.wsgi:application" 2>/dev/null); then + return 1 + fi +} + +function validate_port() { + if ! [[ ${SEAHUB_PORT} =~ ^[1-9][0-9]{1,4}$ ]] ; then + printf "\033[033m${SEAHUB_PORT}\033[m is not a valid port number\n" + exit 1 + fi +} + +function warning_if_seafile_not_running() { + if ! pgrep -f "seafile-controller -F ${central_config_dir}" 2>/dev/null 1>&2; then + echo + echo "Error: seafile-controller not running. Have you run \"/etc/init.d/seafile start\"?" + echo + exit 1 + fi +} + +function prepare_seahub_log_dir() { + logdir="${TOPDIR}/logs" + if ! [[ -d "${logsdir}" ]]; then + if ! mkdir -p "${logdir}"; then + echo "Error: failed to create log dir \"${logdir}\"" + exit 1 + fi + fi + export SEAHUB_LOG_DIR="${logdir}" +} + +function before_start() { + prepare_env + warning_if_seafile_not_running + if ! validate_seahub_running; then + echo "Seahub is already running." + exit 1 + fi + prepare_seahub_log_dir + validate_port +} + +function start_seahub() { + before_start + echo "Starting seahub at port ${SEAHUB_PORT} ..." + check_init_admin + $PYTHON $gunicorn_exe seahub.wsgi:application -c "${gunicorn_conf}" -b "0.0.0.0:${SEAHUB_PORT}" --preload + + # Ensure seahub is started successfully + retry=1 + while ! validate_seahub_running && [[ ! -f "${pidfile}" ]] && [[ $retry -lt 120 ]]; do sleep 1; ((retry++)); done + if ! validate_seahub_running && [[ -f "${pidfile}" ]]; then + echo + echo "Seahub is started" + echo + else + printf "\033[33mError: Seahub failed to start.\033[m\n" + exit 1 + fi +} + +function start_seahub_fastcgi() { + before_start + + # Returns 127.0.0.1 if SEAFILE_FASTCGI_HOST is unset or hasn't got any value, + # otherwise returns value of SEAFILE_FASTCGI_HOST environment variable + address=`(test -z "$SEAFILE_FASTCGI_HOST" && echo "127.0.0.1") || echo $SEAFILE_FASTCGI_HOST` + + echo "Starting seahub (fastcgi) at ${address}:${SEAHUB_PORT} ..." + check_init_admin + $PYTHON "${manage_py}" runfcgi host=${address} port=${SEAHUB_PORT} pidfile=${pidfile} \ + outlog=${accesslog} errlog=${errorlog} maxchildren=${SEAHUB_WORKERS} method=${SEAHUB_METHOD} + + # Ensure seahub is started successfully + retry=1 + while ! validate_seahub_running && [[ ! -f "${pidfile}" ]] && [[ $retry -lt 120 ]]; do sleep 1; ((retry++)); done + if ! validate_seahub_running && [[ -f "${pidfile}" ]]; then + echo + echo "Seahub is started" + echo + else + printf "\033[33mError: Seahub failed to start.\033[m\n" + exit 1 + fi +} + +function prepare_env() { + check_python_executable + validate_ccnet_conf_dir + read_seafile_data_dir + + export CCNET_CONF_DIR=${default_ccnet_conf_dir} + export SEAFILE_CONF_DIR=${seafile_data_dir} + export SEAFILE_CENTRAL_CONF_DIR=${central_config_dir} + export PYTHONPATH="${INSTALLPATH}/seahub:${INSTALLPATH}/seahub/thirdpart:${PYTHONPATH}" +} + +function clear_sessions() { + prepare_env + + echo "Start clear expired session records ..." + $PYTHON "${manage_py}" clearsessions + + echo + echo "Done" + echo +} + +function stop_seahub() { + if [[ -f ${pidfile} ]]; then + pid=$(cat "${pidfile}") + echo "Stopping seahub ..." + kill ${pid} + rm -f ${pidfile} + retry=1 + while ! validate_seahub_running && [ $retry -lt 60 ]; do sleep 1; ((retry++)); done + if ! validate_seahub_running; then + echo "Error: seahub cannot be stopped. Please try stopping it manually by running \"kill $(echo "$pid" | tr '\n' ' ')\"." + echo "To force killing the processes, use \"kill -9 $(echo "$pid" | tr '\n' ' ')\"." + fi + else + echo "Seahub is not running" + fi +} + +function check_init_admin() { + check_init_admin_script=${INSTALLPATH}/check_init_admin.py + if ! $PYTHON $check_init_admin_script; then + exit 1 + fi +} + +function start() { + if [ "$SEAHUB_FASTCGI" == "1" ]; then + start_seahub_fastcgi + else + start_seahub + fi +} + +function stop() { + stop_seahub +} + +function restart() { + stop + start +} + +function clearsessions() { + clear_sessions +} diff --git a/net/seafile-server/patches/020-script-patches.patch b/net/seafile-server/patches/020-script-patches.patch new file mode 100644 index 0000000..585784d --- /dev/null +++ b/net/seafile-server/patches/020-script-patches.patch @@ -0,0 +1,77 @@ +diff -rupN seafile-server-5.1.1.orig/scripts/seaf-fsck.sh seafile-server-5.1.1/scripts/seaf-fsck.sh +--- seafile-server-5.1.1.orig/scripts/seaf-fsck.sh 2016-04-21 11:05:26.000000000 +0200 ++++ seafile-server-5.1.1/scripts/seaf-fsck.sh 2016-04-22 09:10:13.075581325 +0200 +@@ -7,7 +7,7 @@ INSTALLPATH=$(dirname "${SCRIPT}") + TOPDIR=$(dirname "${INSTALLPATH}") + default_ccnet_conf_dir=${TOPDIR}/ccnet + default_conf_dir=${TOPDIR}/conf +-seaf_fsck=${INSTALLPATH}/seafile/bin/seaf-fsck ++seaf_fsck=/usr/bin/seaf-fsck + + export PATH=${INSTALLPATH}/seafile/bin:$PATH + export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH} +diff -rupN seafile-server-5.1.1.orig/scripts/seaf-gc.sh seafile-server-5.1.1/scripts/seaf-gc.sh +--- seafile-server-5.1.1.orig/scripts/seaf-gc.sh 2016-04-21 11:05:26.000000000 +0200 ++++ seafile-server-5.1.1/scripts/seaf-gc.sh 2016-04-22 09:10:27.211581999 +0200 +@@ -7,7 +7,7 @@ INSTALLPATH=$(dirname "${SCRIPT}") + TOPDIR=$(dirname "${INSTALLPATH}") + default_ccnet_conf_dir=${TOPDIR}/ccnet + default_conf_dir=${TOPDIR}/conf +-seaf_gc=${INSTALLPATH}/seafile/bin/seafserv-gc ++seaf_gc=/usr/bin/seafserv-gc + seaf_gc_opts="" + + export PATH=${INSTALLPATH}/seafile/bin:$PATH +diff -rupN seafile-server-5.1.1.orig/scripts/setup-seafile-mysql.sh seafile-server-5.1.1/scripts/setup-seafile-mysql.sh +--- seafile-server-5.1.1.orig/scripts/setup-seafile-mysql.sh 2016-04-21 11:05:26.000000000 +0200 ++++ seafile-server-5.1.1/scripts/setup-seafile-mysql.sh 2016-04-22 09:11:50.083585953 +0200 +@@ -40,15 +40,10 @@ function check_python_executable() { + function check_python_module () { + module=$1 + name=$2 +- hint=$3 + printf " Checking python module: ${name} ... " + if ! $PYTHON -c "import ${module}" 2>/dev/null 1>&2; then + echo + printf "\033[33m ${name} \033[m is not installed, Please install it first.\n" +- if [[ "${hint}" != "" ]]; then +- printf "${hint}" +- echo +- fi + err_and_quit; + fi + echo -e "Done." +@@ -70,14 +65,10 @@ function check_python () { + if [[ $PYTHON == "python2.6" ]]; then + py26="2.6" + fi +- hint="\nOn Debian/Ubntu: apt-get install python-setuptools\nOn CentOS/RHEL: yum install python${py26}-distribute" +- check_python_module pkg_resources setuptools "${hint}" +- +- hint="\nOn Debian/Ubntu: apt-get install python-imaging\nOn CentOS/RHEL: yum install python${py26}-imaging" +- check_python_module PIL python-imaging "${hint}" + +- hint='\nOn Debian/Ubuntu:\n\nsudo apt-get install python-mysqldb\n\nOn CentOS/RHEL:\n\nsudo yum install MySQL-python' +- check_python_module MySQLdb python-mysqldb "${hint}" ++ check_python_module pkg_resources setuptools ++ check_python_module PIL python-imaging ++ check_python_module MySQLdb python-mysqldb + fi + echo + } +@@ -85,5 +76,6 @@ function check_python () { + check_python; + + export PYTHON=$PYTHON ++export PYTHONPATH="/usr/share/seafile/seafile-server/seahub/thirdpart:$PYTHONPATH" + + exec $PYTHON "$python_script" +diff -rupN seafile-server-5.1.1.orig/scripts/sqlite2mysql.sh seafile-server-5.1.1/scripts/sqlite2mysql.sh +--- seafile-server-5.1.1.orig/scripts/sqlite2mysql.sh 2016-04-21 11:05:26.000000000 +0200 ++++ seafile-server-5.1.1/scripts/sqlite2mysql.sh 2016-04-22 09:02:22.047558854 +0200 +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!/bin/bash + # + # This shell script and corresponding sqlite2mysql.py are used to + # migrate Seafile data from SQLite to MySQL. diff --git a/net/seafile-server/patches/030-pidfiles-in-same-directory.patch b/net/seafile-server/patches/030-pidfiles-in-same-directory.patch new file mode 100644 index 0000000..bb3f86c --- /dev/null +++ b/net/seafile-server/patches/030-pidfiles-in-same-directory.patch @@ -0,0 +1,24 @@ +diff -rupN seafile-server-5.1.1.orig/controller/seafile-controller.c seafile-server-5.1.1/controller/seafile-controller.c +--- seafile-server-5.1.1.orig/controller/seafile-controller.c 2016-04-19 15:44:32.000000000 +0200 ++++ seafile-server-5.1.1/controller/seafile-controller.c 2016-04-19 16:23:05.785000218 +0200 +@@ -21,7 +21,7 @@ + + SeafileController *ctl; + +-static char *controller_pidfile = NULL; ++static char *controller_pidfile = "/var/run/seafile/seafile-controller.pid"; + + char *bin_dir = NULL; + char *installpath = NULL; +@@ -575,9 +575,9 @@ stop_ccnet_server () + static void + init_pidfile_path (SeafileController *ctl) + { +- char *pid_dir = g_build_filename (topdir, "pids", NULL); ++ char *pid_dir = g_path_get_dirname (controller_pidfile); + if (!g_file_test(pid_dir, G_FILE_TEST_EXISTS)) { +- if (g_mkdir(pid_dir, 0777) < 0) { ++ if (g_mkdir(pid_dir, 0755) < 0) { + seaf_warning("failed to create pid dir %s: %s", pid_dir, strerror(errno)); + controller_exit(1); + } diff --git a/net/seafile-server/patches/040-seafile-admin.patch b/net/seafile-server/patches/040-seafile-admin.patch new file mode 100644 index 0000000..667cdad --- /dev/null +++ b/net/seafile-server/patches/040-seafile-admin.patch @@ -0,0 +1,61 @@ +diff -rupN seafile-server-5.1.1.orig/tools/seafile-admin seafile-server-5.1.1/tools/seafile-admin +--- seafile-server-5.1.1.orig/tools/seafile-admin 2016-04-19 15:44:33.000000000 +0200 ++++ seafile-server-5.1.1/tools/seafile-admin 2016-04-26 10:55:11.826798430 +0200 +@@ -449,9 +449,12 @@ workers = 3 + + # Logging + runtime_dir = os.path.dirname(__file__) +-pidfile = os.path.join(runtime_dir, 'seahub.pid') ++pidfile = '/var/run/seafile/seahub.pid' + errorlog = os.path.join(runtime_dir, 'error.log') + accesslog = os.path.join(runtime_dir, 'access.log') ++ ++# for file upload, we need a longer timeout value (default is only 30s, too short) ++timeout = 1200 + ''' + + try: +@@ -526,6 +529,7 @@ def check_django_version(): + + + def check_python_module(import_name, package_name=None, silent=False): ++ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "seahub.settings") + package_name = package_name or import_name + if not silent: + info('checking %s' % package_name) +@@ -785,7 +789,7 @@ def check_layout(args): + conf[CONF_SEAFILE_DIR] = seafile_data_dir + conf[CONF_SEAHUB_DIR] = seahub_dir + conf[CONF_SEAHUB_CONF] = seahub_conf +- conf[CONF_SEAHUB_PIDFILE] = os.path.join(runtime_dir, 'seahub.pid') ++ conf[CONF_SEAHUB_PIDFILE] = '/var/run/seafile/seahub.pid' + conf[CONF_SEAHUB_OUTLOG] = os.path.join(runtime_dir, 'access.log') + conf[CONF_SEAHUB_ERRLOG] = os.path.join(runtime_dir, 'error.log') + +@@ -836,10 +840,13 @@ def setup_seafile(args): + print '-----------------------------------------------------------------' + print '-----------------------------------------------------------------' + print +- print 'To start/stop seafile server:' ++ print 'To start, stop or restart seafile:' ++ print ++ print highlight(' # /etc/init.d/seafile { start | stop | restart }') + print +- print highlight(' $ cd %s' % cwd) +- print highlight(' $ %s { start | stop }' % SCRIPT_NAME) ++ print 'To start, stop or restart seahub:' ++ print ++ print highlight(' # /etc/init.d/seahub { start | stop | restart }') + print + print 'If you have any problem, refer to\n' + print +@@ -903,8 +910,7 @@ def start_seafile(args): + def stop_seafile(dummy): + info('Stopping seafile server') + pkill('seafile-controller') +- runtime_dir = os.path.join(cwd, 'seafile-server', 'runtime') +- pidfile = os.path.join(runtime_dir, 'seahub.pid') ++ pidfile = '/var/run/seafile/seahub.pid' + try: + with open(pidfile, 'r') as fp: + pid = fp.read().strip('\n ') diff --git a/net/seafile-server/patches/050-libseafile-makefile-fixes.patch b/net/seafile-server/patches/050-libseafile-makefile-fixes.patch new file mode 100644 index 0000000..d83a097 --- /dev/null +++ b/net/seafile-server/patches/050-libseafile-makefile-fixes.patch @@ -0,0 +1,43 @@ +diff -rupN seafile-server-5.1.1.orig/lib/Makefile.am seafile-server-5.1.1/lib/Makefile.am +--- seafile-server-5.1.1.orig/lib/Makefile.am 2016-04-21 11:05:26.000000000 +0200 ++++ seafile-server-5.1.1/lib/Makefile.am 2016-04-22 10:09:41.567751561 +0200 +@@ -1,3 +1,5 @@ ++include $(TOPDIR)/rules.mk ++ + pcfiles = libseafile.pc + pkgconfig_DATA = $(pcfiles) + pkgconfigdir = $(libdir)/pkgconfig +@@ -35,7 +37,7 @@ seafile-rpc-wrapper.c: seafile-object.h + + seafile-object.h: ${seafile_object_define} + rm -f $@ +- valac --pkg posix ${seafile_object_define} -C -H seafile-object.h ++ "$(STAGING_DIR)/host/bin/valac" --pkg posix ${seafile_object_define} -C -H seafile-object.h + + DISTCLEANFILES = ${searpc_gen} + +@@ -64,7 +66,7 @@ rpc_table.stamp: ${top_srcdir}/lib/rpc_t + @rm -f rpc_table.tmp + @touch rpc_table.tmp + @echo "[libsearpc]: generating rpc header files" +- @PYTHON@ `which searpc-codegen.py` ${top_srcdir}/lib/rpc_table.py ++ @PYTHON@ "$(STAGING_DIR)/usr/bin/searpc-codegen.py" ${top_srcdir}/lib/rpc_table.py + @echo "[libsearpc]: done" + @mv -f rpc_table.tmp $@ + +@@ -74,7 +76,7 @@ vala.stamp: ${seafile_object_define} + rm -f ${seafile_object_gen} + @rm -f vala.tmp + @touch vala.tmp +- valac -C --pkg posix $^ ++ "$(STAGING_DIR)/host/bin/valac" -C --pkg posix $^ + @mv -f vala.tmp $@ + + ${seafile_object_gen}: vala.stamp +@@ -90,5 +92,5 @@ install-data-local: + if MACOS + sed -i '' -e "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles) + else +- ${SED} -i "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles) ++ ${SED} "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles) + endif diff --git a/net/seafile-server/patches/060-timestamps-as-int64.patch b/net/seafile-server/patches/060-timestamps-as-int64.patch new file mode 100644 index 0000000..5e655d8 --- /dev/null +++ b/net/seafile-server/patches/060-timestamps-as-int64.patch @@ -0,0 +1,39 @@ +diff -rupN seafile-server-5.1.1.orig/lib/repo.vala seafile-server-5.1.1/lib/repo.vala +--- seafile-server-5.1.1.orig/lib/repo.vala 2016-04-19 15:44:32.000000000 +0200 ++++ seafile-server-5.1.1/lib/repo.vala 2016-04-25 21:29:33.327962235 +0200 +@@ -30,7 +30,7 @@ public class Repo : Object { + // data format version + public int version { get; set; } + +- public int last_modify { get; set; } ++ public int64 last_modify { get; set; } + public int64 size { get; set; } + public int64 file_count { get; set; } + public string head_cmmt_id { get; set; } +@@ -40,7 +40,7 @@ public class Repo : Object { + public string repo_id { get; set; } + public string repo_name { get; set; } + public string repo_desc { get; set; } +- public int last_modified { get; set; } ++ public int64 last_modified { get; set; } + + // Section 2: Encryption related + // Members in this section should be set for every Repo object +@@ -63,7 +63,7 @@ public class Repo : Object { + get { return _relay_id; } + set { _relay_id = value; } + } +- public int last_sync_time { get; set; } ++ public int64 last_sync_time { get; set; } + public bool auto_sync { get; set; } + public bool worktree_invalid { get; set; } + +@@ -155,7 +155,7 @@ public class DeletedEntry : Object { + public string obj_name { get; set; } + public string basedir { get; set; } + public int mode { get; set; } +- public int delete_time { get; set; } ++ public int64 delete_time { get; set; } + public int64 file_size { get; set; } + public string scan_stat { get; set; } + } diff --git a/net/seafile-server/patches/070-fuse-mount.patch b/net/seafile-server/patches/070-fuse-mount.patch new file mode 100644 index 0000000..827e7f3 --- /dev/null +++ b/net/seafile-server/patches/070-fuse-mount.patch @@ -0,0 +1,21 @@ +diff -rupN seafile-server-5.1.1.orig/scripts/seaf-fuse.sh seafile-server-5.1.1/scripts/seaf-fuse.sh +--- seafile-server-5.1.1.orig/scripts/seaf-fuse.sh 2016-05-29 08:43:19.000000000 +0200 ++++ seafile-server-5.1.1/scripts/seaf-fuse.sh 2016-05-29 09:13:06.286680653 +0200 +@@ -7,7 +7,7 @@ INSTALLPATH=$(dirname "${SCRIPT}") + TOPDIR=$(dirname "${INSTALLPATH}") + default_ccnet_conf_dir=${TOPDIR}/ccnet + default_conf_dir=${TOPDIR}/conf +-seaf_fuse=${INSTALLPATH}/seafile/bin/seaf-fuse ++seaf_fuse=/usr/bin/seaf-fuse + + export PATH=${INSTALLPATH}/seafile/bin:$PATH + export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH} +@@ -68,7 +68,7 @@ function validate_already_running () { + } + + function warning_if_seafile_not_running () { +- if ! pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null 1>&2; then ++ if ! pgrep -f "seafile-controller -F ${default_conf_dir}" 2>/dev/null 1>&2; then + echo + echo "Warning: seafile-controller not running. Have you run \"./seafile.sh start\" ?" + echo diff --git a/net/ser2net/Makefile b/net/ser2net/Makefile new file mode 100644 index 0000000..7436bbb --- /dev/null +++ b/net/ser2net/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2006-2016 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:=ser2net +PKG_VERSION:=3.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/ser2net +PKG_MD5SUM:=85adca01e963ec80ec96f1dfd23aeaec + +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Michael Heimpold + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/ser2net + SECTION:=net + CATEGORY:=Network + TITLE:=Serial to Network Proxy + URL:=http://sourceforge.net/projects/ser2net/ + DEPENDS:=+USE_UCLIBC:libpthread +USE_UCLIBC:librt +endef + +define Package/ser2net/description + This project provides a proxy that allows telnet/tcp connections to be made to + serial ports on a machine. +endef + +define Package/ser2net/conffiles +/etc/ser2net.conf +endef + +define Package/ser2net/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ser2net $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_BUILD_DIR)/ser2net.conf $(1)/etc/ +endef + +$(eval $(call BuildPackage,ser2net)) diff --git a/net/shadowsocks-client/Makefile b/net/shadowsocks-client/Makefile new file mode 100644 index 0000000..3e8c9be --- /dev/null +++ b/net/shadowsocks-client/Makefile @@ -0,0 +1,39 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=shadowsocks-client +PKG_VERSION:=0.6 +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/zhao-gang/shadowsocks-tiny.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=b59d754f838213d60b908aed0b7d4d5a81f273e2 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz +PKG_MAINTAINER:=Zhao, Gang + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=COPYING + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/shadowsocks-client + SECTION:=net + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + TITLE:=shadowsocks client for router + URL:=https://github.com/zhao-gang/shadowsocks-tiny + DEPENDS:=+libopenssl +endef + +define Package/shadowsocks-client/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/sslocal $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/sslocal.config $(1)/etc/config/sslocal + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/sslocal.init $(1)/etc/init.d/sslocal +endef + +$(eval $(call BuildPackage,shadowsocks-client)) diff --git a/net/shadowsocks-client/files/sslocal.config b/net/shadowsocks-client/files/sslocal.config new file mode 100644 index 0000000..28dc261 --- /dev/null +++ b/net/shadowsocks-client/files/sslocal.config @@ -0,0 +1,7 @@ +config sslocal + option server_addr '' + option server_port '' + option local_addr '' + option local_port '' + option password '' + option method '' diff --git a/net/shadowsocks-client/files/sslocal.init b/net/shadowsocks-client/files/sslocal.init new file mode 100755 index 0000000..ac845e5 --- /dev/null +++ b/net/shadowsocks-client/files/sslocal.init @@ -0,0 +1,52 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2012 OpenWrt.org +# Copyright (C) 2014 Zhao, Gang + +START=99 + +USE_PROCD=1 +PROG=/usr/bin/sslocal + +validate_section_sslocal() { + uci_validate_section sslocal sslocal "${1}" \ + 'server_addr:host' \ + 'server_port:port' \ + 'local_addr:host' \ + 'local_port:port' \ + 'password:string' \ + 'method:string' \ + 'log_level:range(0,7):5' + + return $? +} + +sslocal_instance() { + local server_addr server_port local_addr local_port + local password method log_level + + validate_section_sslocal "${1}" || { + echo "validation failed" + return 1 + } + + procd_open_instance + procd_set_param command "$PROG" + procd_append_param command -s "${server_addr}" -p "${server_port}" + procd_append_param command -u "${local_addr}" -b "${local_port}" + procd_append_param command -k "${password}" -m "${method}" + procd_append_param command -l "${log_level}" + procd_set_param respawn + procd_close_instance +} + +start_service() { + config_load sslocal + + config_foreach sslocal_instance sslocal +} + +service_triggers() +{ + procd_add_reload_trigger "sslocal" + procd_add_validation validate_section_sslocal +} diff --git a/net/shadowsocks-libev/Makefile b/net/shadowsocks-libev/Makefile new file mode 100644 index 0000000..415c2df --- /dev/null +++ b/net/shadowsocks-libev/Makefile @@ -0,0 +1,91 @@ +# +# Copyright (C) 2015 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:=shadowsocks-libev +PKG_VERSION:=2.2.3 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/shadowsocks/shadowsocks-libev.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE) +PKG_SOURCE_VERSION:=2b1eef11973de3f7380401fd20f937e84bc2b756 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz +PKG_MAINTAINER:=Jian Chang + +PKG_LICENSE:=GPLv2 +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE) + +PKG_INSTALL:=1 +PKG_FIXUP:=autoreconf +PKG_USE_MIPS16:=0 +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/shadowsocks-libev/Default + SECTION:=net + CATEGORY:=Network + TITLE:=Lightweight Secured Socks5 Proxy $(2) + URL:=https://github.com/shadowsocks/shadowsocks-libev + VARIANT:=$(1) + DEPENDS:=$(3) +libpthread +ipset +ip +iptables-mod-tproxy +endef + +Package/shadowsocks-libev = $(call Package/shadowsocks-libev/Default,openssl,(OpenSSL),+libopenssl) +Package/shadowsocks-libev-polarssl = $(call Package/shadowsocks-libev/Default,polarssl,(PolarSSL),+libpolarssl) + +define Package/shadowsocks-libev/description +Shadowsocks-libev is a lightweight secured socks5 proxy for embedded devices and low end boxes. +endef + +Package/shadowsocks-libev-polarssl/description = $(Package/shadowsocks-libev/description) + +define Package/shadowsocks-libev/conffiles +/etc/config/shadowsocks-libev +endef + +Package/shadowsocks-libev-polarssl/conffiles = $(Package/shadowsocks-libev/conffiles) + +define Package/shadowsocks-libev/postinst +#!/bin/sh +uci -q batch <<-EOF >/dev/null + delete firewall.shadowsocks_libev + set firewall.shadowsocks_libev=include + set firewall.shadowsocks_libev.type=script + set firewall.shadowsocks_libev.path=/usr/share/shadowsocks-libev/firewall.include + set firewall.shadowsocks_libev.reload=1 + commit firewall +EOF +exit 0 +endef + +Package/shadowsocks-libev-polarssl/postinst = $(Package/shadowsocks-libev/postinst) + +ifeq ($(BUILD_VARIANT),polarssl) + CONFIGURE_ARGS += --with-crypto-library=polarssl +endif + +define Package/shadowsocks-libev/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ss-{redir,tunnel} $(1)/usr/bin + $(INSTALL_BIN) ./files/ss-rules $(1)/usr/bin + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/shadowsocks-libev.config $(1)/etc/config/shadowsocks-libev + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/shadowsocks-libev.init $(1)/etc/init.d/shadowsocks-libev + $(INSTALL_DIR) $(1)/usr/share/shadowsocks-libev + $(INSTALL_DATA) ./files/firewall.include $(1)/usr/share/shadowsocks-libev/firewall.include +endef + +Package/shadowsocks-libev-polarssl/install = $(Package/shadowsocks-libev/install) + +$(eval $(call BuildPackage,shadowsocks-libev)) +$(eval $(call BuildPackage,shadowsocks-libev-polarssl)) diff --git a/net/shadowsocks-libev/files/firewall.include b/net/shadowsocks-libev/files/firewall.include new file mode 100644 index 0000000..3a00e80 --- /dev/null +++ b/net/shadowsocks-libev/files/firewall.include @@ -0,0 +1,6 @@ +#!/bin/sh + +if pidof ss-redir>/dev/null; then + /etc/init.d/shadowsocks-libev rules + logger -t ShadowSocks-libev "Reloading ShadowSocks-libev due to restart of firewall" +fi diff --git a/net/shadowsocks-libev/files/shadowsocks-libev.config b/net/shadowsocks-libev/files/shadowsocks-libev.config new file mode 100644 index 0000000..95aec7b --- /dev/null +++ b/net/shadowsocks-libev/files/shadowsocks-libev.config @@ -0,0 +1,15 @@ + +config shadowsocks-libev + option enable '1' + option server '127.0.0.1' + option server_port '8388' + option local_port '1080' + option password 'barfoo!' + option timeout '60' + option encrypt_method 'rc4-md5' + option ignore_list '/dev/null' + option udp_mode '0' + option tunnel_enable '1' + option tunnel_port '5300' + option tunnel_forward '8.8.4.4:53' + option lan_ac_mode '0' diff --git a/net/shadowsocks-libev/files/shadowsocks-libev.init b/net/shadowsocks-libev/files/shadowsocks-libev.init new file mode 100644 index 0000000..9a64038 --- /dev/null +++ b/net/shadowsocks-libev/files/shadowsocks-libev.init @@ -0,0 +1,156 @@ +#!/bin/sh /etc/rc.common + +START=90 +STOP=15 + +SERVICE_USE_PID=1 +SERVICE_WRITE_PID=1 +SERVICE_DAEMONIZE=1 +EXTRA_COMMANDS="rules" +CONFIG_FILE=/var/etc/shadowsocks-libev.json + +get_config() { + config_get_bool enable $1 enable + config_get server $1 server + config_get server_port $1 server_port + config_get local_port $1 local_port + config_get timeout $1 timeout + config_get password $1 password + config_get encrypt_method $1 encrypt_method + config_get ignore_list $1 ignore_list + config_get udp_mode $1 udp_mode + config_get udp_server $1 udp_server + config_get udp_server_port $1 udp_server_port + config_get udp_local_port $1 udp_local_port + config_get udp_timeout $1 udp_timeout + config_get udp_password $1 udp_password + config_get udp_encrypt_method $1 udp_encrypt_method + config_get_bool tunnel_enable $1 tunnel_enable + config_get tunnel_port $1 tunnel_port + config_get tunnel_forward $1 tunnel_forward + config_get lan_ac_mode $1 lan_ac_mode + config_get lan_ac_ip $1 lan_ac_ip + config_get wan_bp_ip $1 wan_bp_ip + config_get wan_fw_ip $1 wan_fw_ip + config_get ipt_ext $1 ipt_ext + : ${timeout:=60} + : ${udp_timeout:=60} + : ${tunnel_port:=5300} + : ${tunnel_forward:=8.8.4.4:53} +} + +start_rules() { + local ac_args + + if [ -n "$lan_ac_ip" ]; then + case $lan_ac_mode in + 1) ac_args="w$lan_ac_ip" + ;; + 2) ac_args="b$lan_ac_ip" + ;; + esac + fi + /usr/bin/ss-rules \ + -s "$server" \ + -l "$local_port" \ + -S "$udp_server" \ + -L "$udp_local_port" \ + -i "$ignore_list" \ + -a "$ac_args" \ + -b "$wan_bp_ip" \ + -w "$wan_fw_ip" \ + -e "$ipt_ext" \ + -o $udp + return $? +} + +start_redir() { + cat <<-EOF >$CONFIG_FILE + { + "server": "$server", + "server_port": $server_port, + "local_address": "0.0.0.0", + "local_port": $local_port, + "password": "$password", + "timeout": $timeout, + "method": "$encrypt_method" + } +EOF + if [ "$udp_mode" = 2 ]; then + /usr/bin/ss-redir \ + -c $CONFIG_FILE \ + -f /var/run/ss-redir_t.pid + cat <<-EOF >$CONFIG_FILE + { + "server": "$udp_server", + "server_port": $udp_server_port, + "local_address": "0.0.0.0", + "local_port": $udp_local_port, + "password": "$udp_password", + "timeout": $udp_timeout, + "method": "$udp_encrypt_method" + } +EOF + fi + /usr/bin/ss-redir \ + -c $CONFIG_FILE \ + -f /var/run/ss-redir.pid \ + $udp + return $? +} + +start_tunnel() { + : ${udp:="-u"} + /usr/bin/ss-tunnel \ + -c $CONFIG_FILE \ + -l $tunnel_port \ + -L $tunnel_forward \ + -f /var/run/ss-tunnel.pid \ + $udp + return $? +} + +rules() { + config_load shadowsocks-libev + config_foreach get_config shadowsocks-libev + [ "$enable" = 1 ] || exit 0 + mkdir -p /var/run /var/etc + + : ${server:?} + : ${server_port:?} + : ${local_port:?} + : ${password:?} + : ${encrypt_method:?} + case $udp_mode in + 1) udp="-u" + ;; + 2) + udp="-U" + : ${udp_server:?} + : ${udp_server_port:?} + : ${udp_local_port:?} + : ${udp_password:?} + : ${udp_encrypt_method:?} + ;; + esac + + start_rules +} + +boot() { + until iptables-save -t nat | grep -q "^:zone_lan_prerouting"; do + sleep 1 + done + start +} + +start() { + rules && start_redir + [ "$tunnel_enable" = 1 ] && start_tunnel +} + +stop() { + /usr/bin/ss-rules -f + killall -q -9 ss-redir + killall -q -9 ss-tunnel +} diff --git a/net/shadowsocks-libev/files/ss-rules b/net/shadowsocks-libev/files/ss-rules new file mode 100644 index 0000000..8ce1000 --- /dev/null +++ b/net/shadowsocks-libev/files/ss-rules @@ -0,0 +1,219 @@ +#!/bin/sh + +usage() { + cat <<-EOF + Usage: ss-rules [options] + + Valid options are: + + -s hostname or ip of shadowsocks remote server + -l port number of shadowsocks local server + -i a file content is bypassed ip list + -a lan ip of access control, need a prefix to + define access control mode + -b wan ip of will be bypassed + -w wan ip of will be forwarded + -e extra options for iptables + -o apply the rules to the OUTPUT chain + -u enable udprelay mode, TPROXY is required + -U enable udprelay mode, using different IP + and ports for TCP and UDP + -f flush the rules +EOF +} + +loger() { + # 1.alert 2.crit 3.err 4.warn 5.notice 6.info 7.debug + logger -st ss-rules[$$] -p$1 $2 +} + +ipt_n="iptables -t nat" +ipt_m="iptables -t mangle" + +flush_r() { + local IPT + + IPT=$(iptables-save -t nat) + eval $(echo "$IPT" | grep "_SS_SPEC_RULE_" | \ + sed -e 's/^-A/$ipt_n -D/' -e 's/$/;/') + + for chain in $(echo "$IPT" | awk '/^:SS_SPEC/{print $1}'); do + $ipt_n -F ${chain:1} 2>/dev/null && $ipt_n -X ${chain:1} + done + + IPT=$(iptables-save -t mangle) + eval $(echo "$IPT" | grep "_SS_SPEC_RULE_" | \ + sed -e 's/^-A/$ipt_m -D/' -e 's/$/;/') + + for chain in $(echo "$IPT" | awk '/^:SS_SPEC/{print $1}'); do + $ipt_m -F ${chain:1} 2>/dev/null && $ipt_m -X ${chain:1} + done + + ip rule del fwmark 0x01/0x01 table 100 2>/dev/null + ip route del local 0.0.0.0/0 dev lo table 100 2>/dev/null + ipset -X ss_spec_lan_ac 2>/dev/null + ipset -X ss_spec_wan_ac 2>/dev/null + return 0 +} + +ipset_r() { + ipset -! -R <<-EOF || return 1 + create ss_spec_wan_ac hash:net + $(echo -e "$IPLIST" | sed -e "s/^/add ss_spec_wan_ac /") + $(for ip in $WAN_FW_IP; do echo "add ss_spec_wan_ac $ip nomatch"; done) +EOF + $ipt_n -N SS_SPEC_WAN_AC && \ + $ipt_n -A SS_SPEC_WAN_AC -m set --match-set ss_spec_wan_ac dst -j RETURN && \ + $ipt_n -A SS_SPEC_WAN_AC -j SS_SPEC_WAN_FW + return $? +} + +fw_rule() { + $ipt_n -N SS_SPEC_WAN_FW && \ + $ipt_n -A SS_SPEC_WAN_FW -p tcp \ + -j REDIRECT --to-ports $local_port 2>/dev/null || { + loger 3 "Can't redirect, please check the iptables." + exit 1 + } + return $? +} + +ac_rule() { + local TAG ROUTECHAIN + + if [ -n "$LAN_AC_IP" ]; then + if [ "${LAN_AC_IP:0:1}" = "w" ]; then + TAG="nomatch" + else + if [ "${LAN_AC_IP:0:1}" != "b" ]; then + loger 3 "Bad argument \`-a $LAN_AC_IP\`." + return 2 + fi + fi + fi + + ROUTECHAIN=PREROUTING + if iptables-save -t nat | grep -q "^:zone_lan_prerouting"; then + ROUTECHAIN=zone_lan_prerouting + fi + + ipset -! -R <<-EOF || return 1 + create ss_spec_lan_ac hash:net + $(for ip in ${LAN_AC_IP:1}; do echo "add ss_spec_lan_ac $ip $TAG"; done) +EOF + $ipt_n -A $ROUTECHAIN -p tcp $EXT_ARGS \ + -m set ! --match-set ss_spec_lan_ac src \ + -m comment --comment "_SS_SPEC_RULE_" -j SS_SPEC_WAN_AC + + if [ "$OUTPUT" = 1 ]; then + $ipt_n -A OUTPUT -p tcp $EXT_ARGS \ + -m comment --comment "_SS_SPEC_RULE_" -j SS_SPEC_WAN_AC + fi + return $? +} + +tp_rule() { + [ -n "$TPROXY" ] || return 0 + ip rule add fwmark 0x01/0x01 table 100 + ip route add local 0.0.0.0/0 dev lo table 100 + $ipt_m -N SS_SPEC_TPROXY + $ipt_m -A SS_SPEC_TPROXY -p udp -m set ! --match-set ss_spec_wan_ac dst \ + -j TPROXY --on-port $LOCAL_PORT --tproxy-mark 0x01/0x01 + $ipt_m -A PREROUTING -p udp $EXT_ARGS \ + -m set ! --match-set ss_spec_lan_ac src \ + -m comment --comment "_SS_SPEC_RULE_" -j SS_SPEC_TPROXY + return $? +} + +while getopts ":s:l:S:L:i:e:a:b:w:ouUf" arg; do + case $arg in + s) + server=$OPTARG + ;; + l) + local_port=$OPTARG + ;; + S) + SERVER=$OPTARG + ;; + L) + LOCAL_PORT=$OPTARG + ;; + i) + IGNORE=$OPTARG + ;; + e) + EXT_ARGS=$OPTARG + ;; + a) + LAN_AC_IP=$OPTARG + ;; + b) + WAN_BP_IP=$(for ip in $OPTARG; do echo $ip; done) + ;; + w) + WAN_FW_IP=$OPTARG + ;; + o) + OUTPUT=1 + ;; + u) + TPROXY=1 + ;; + U) + TPROXY=2 + ;; + f) + flush_r + exit 0 + ;; + esac +done + +if [ -z "$server" -o -z "$local_port" ]; then + usage + exit 2 +fi + +if [ "$TPROXY" = 1 ]; then + SERVER=$server + LOCAL_PORT=$local_port +fi + +if [ "$TPROXY" = 2 ]; then + if [ -z "$SERVER" -o -z "$LOCAL_PORT" ]; then + loger 3 "Please use -S and -L specifies IP and port for UDP." + fi +fi + +if [ -f "$IGNORE" ]; then + IGNORE_IP=$(cat $IGNORE 2>/dev/null) +fi + +IPLIST=$(cat <<-EOF | grep -E "^([0-9]{1,3}\.){3}[0-9]{1,3}" + $server + $SERVER + 0.0.0.0/8 + 10.0.0.0/8 + 100.64.0.0/10 + 127.0.0.0/8 + 169.254.0.0/16 + 172.16.0.0/12 + 192.0.0.0/24 + 192.0.2.0/24 + 192.88.99.0/24 + 192.168.0.0/16 + 198.18.0.0/15 + 198.51.100.0/24 + 203.0.113.0/24 + 224.0.0.0/4 + 240.0.0.0/4 + 255.255.255.255 + $WAN_BP_IP + $IGNORE_IP +EOF +) + +flush_r && fw_rule && ipset_r && ac_rule && tp_rule + +exit $? diff --git a/net/siit/Makefile b/net/siit/Makefile new file mode 100644 index 0000000..a2a4c50 --- /dev/null +++ b/net/siit/Makefile @@ -0,0 +1,42 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=siit +PKG_VERSION:=1.2 +PKG_RELEASE:=1 +PKG_LICENSE:=GPLv2+ + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/siit + SUBMENU:=Network Devices + TITLE:=Stateless IP ICMP Translation Algorithm + DEPENDS:= @(!(TARGET_ps3||TARGET_pxcab)) + FILES:=$(PKG_BUILD_DIR)/siit.ko + AUTOLOAD:=$(call AutoLoad,50,siit) + MAINTAINER:=Vladimir Ulrich +endef + +include $(INCLUDE_DIR)/kernel-defaults.mk + +define KernelPackage/siit/description + Stateless IP ICMP Translation Algorithm +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) + cp src/Makefile src/siit.h src/siit.c $(PKG_BUILD_DIR)/ +endef + +define Build/Compile + $(MAKE) $(KERNEL_MAKEOPTS) SUBDIRS="$(PKG_BUILD_DIR)" modules +endef + +$(eval $(call KernelPackage,siit)) diff --git a/net/siit/src/Makefile b/net/siit/src/Makefile new file mode 100644 index 0000000..06c36f1 --- /dev/null +++ b/net/siit/src/Makefile @@ -0,0 +1,5 @@ +obj-m := siit.o +ifeq ($(MAKING_MODULES),1) +-include $(TOPDIR)/Rules.make +endif + diff --git a/net/siit/src/siit.c b/net/siit/src/siit.c new file mode 100644 index 0000000..ea68b74 --- /dev/null +++ b/net/siit/src/siit.c @@ -0,0 +1,1429 @@ +/* + * siit.c: the Stateless IP/ICMP Translator (SIIT) module for Linux. + * + * + */ + +#include +#include +#include +#include /* printk() */ +#include + +#include /* error codes */ +#include /* size_t */ +#include /* mark_bh */ +#include +#include +#include /* struct device, and other headers */ +#include /* eth_type_trans */ +#include /* struct iphdr */ +#include /* struct icmphdr */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "siit.h" + +MODULE_AUTHOR("Dmitriy Moscalev, Grigory Klyuchnikov, Felix Fietkau"); + +/* + * If tos_ignore_flag != 0, we don't copy TOS and Traffic Class + * from origin paket and set it to 0 + */ +int tos_ignore_flag = 0; + +#define siit_stats(_dev) (&(_dev)->stats) + +/* + * The Utility stuff + */ + +#ifdef SIIT_DEBUG +/* print dump bytes (data point data area sizeof len and message + * before dump. + */ +static int siit_print_dump(char *data, int len, char *message) +{ + int i; + int j = 0, k = 1; + + len = len > BUFF_SIZE ? BUFF_SIZE : len; + printk("%s:\n", message); + for (i=0; i < len; i++, k++) { + if( i == len-1 || k == 16) { + printk("%02x\n", (~(~0 << 8) & *(data+i))); + j = 0; + k = 0; + } + else if (j) { + printk("%02x ", (~(~0 << 8) & *(data+i))); + j--; + } + else { + printk("%02x", (~(~0 << 8) & *(data+i))); + j++; + } + } + return 0; +} +#endif + +/* + * Open and close + */ +static int siit_open(struct net_device *dev) +{ + netif_start_queue(dev); + return 0; +} + + +static int siit_release(struct net_device *dev) +{ + netif_stop_queue(dev); /* can't transmit any more */ + return 0; +} + +/* + * Translation IPv4 to IPv6 stuff + * + * ip4_ip6 (src, len, dst, include_flag) + * + * where + * src - buffer with original IPv4 packet, + * len - size of original packet, + * dst - new buffer for IPv6 packet, + * include_flag - if = 1, dst point to IPv4 packet that is ICMP error + * included IP packet, else = 0 + */ + +static int ip4_ip6(char *src, int len, char *dst, int include_flag) +{ + struct iphdr *ih4 = (struct iphdr *) src; /* point to current IPv4 header struct */ + struct icmphdr *icmp_hdr; /* point to current ICMPv4 header struct */ + struct udphdr *udp_hdr; /* point to current IPv4 UDP header struct */ + + struct ipv6hdr *ih6 = (struct ipv6hdr *) dst; /* point to current IPv6 header struct */ + struct frag_hdr *ih6_frag = (struct frag_hdr *)(dst+sizeof(struct ipv6hdr)); + /* point to current IPv6 fragment header struct */ + struct icmp6hdr *icmp6_hdr; /* point to current ICMPv6 header */ + + int hdr_len = (int)(ih4->ihl * 4); /* IPv4 header length */ + int icmp_len; /* ICMPv4 packet length */ + int plen; /* payload length */ + + unsigned int csum; /* need to calculate ICMPv6 and UDP checksum */ + int fl_csum = 0; /* flag to calculate UDP checksum */ + int icmperr = 1; /* flag to indicate ICMP error message and to need + translate ICMP included IP packet */ + int fr_flag = 0; /* fragment flag, if = 0 - don't add + fragment header */ + __u16 new_tot_len; /* need to calculate IPv6 total length */ + __u8 new_nexthdr; /* next header code */ + __u16 icmp_ptr = 0; /* Pointer field in ICMP_PARAMETERPROB */ + +#ifdef SIIT_DEBUG /* print IPv4 header dump */ + siit_print_dump(src, hdr_len, "siit: ip4_ip6() (in) ip4 header dump"); +#endif + + /* If DF == 1 && MF == 0 && Fragment Offset == 0 + * or this packet is ICMP included IP packet + * we don't need fragment header */ + if (ntohs(ih4->frag_off) == IP_DF || include_flag ) { + /* not fragment and we need not to add Fragment + * Header to IPv6 packet. */ + /* total length = total length from IPv4 packet */ + new_tot_len = ntohs(ih4->tot_len); + + if (ih4->protocol == IPPROTO_ICMP) + new_nexthdr = NEXTHDR_ICMP; + else + new_nexthdr = ih4->protocol; + } + else { + /* need to add Fragment Header */ + fr_flag = 1; + /* total length = total length from IPv4 packet + + length of Fragment Header */ + new_tot_len = ntohs(ih4->tot_len) + sizeof(struct frag_hdr); + /* IPv6 Header NextHeader = NEXTHDR_FRAGMENT */ + new_nexthdr = NEXTHDR_FRAGMENT; + /* Fragment Header NextHeader copy from IPv4 packet */ + if (ih4->protocol == IPPROTO_ICMP) + ih6_frag->nexthdr = NEXTHDR_ICMP; + else + ih6_frag->nexthdr = ih4->protocol; + + /* copy frag offset from IPv4 packet */ + ih6_frag->frag_off = htons((ntohs(ih4->frag_off) & IP_OFFSET) << 3); + /* copy MF flag from IPv4 packet */ + ih6_frag->frag_off = htons((ntohs(ih6_frag->frag_off) | + ((ntohs(ih4->frag_off) & IP_MF) >> 13))); + /* copy Identification field from IPv4 packet */ + ih6_frag->identification = htonl(ntohs(ih4->id)); + /* reserved field initialized to zero */ + ih6_frag->reserved = 0; + } + + /* Form rest IPv6 fields */ + + /* + * At this point we need to add checking of unxpired source + * route optin and if it is, send ICMPv4 "destination + * unreacheble/source route failes" Type 3/Code 5 and + * drop packet. (NOT RELEASED YET) + */ + + /* IP version = 6 */ + ih6->version = 6; + + if (tos_ignore_flag) { + ih6->priority = 0; + ih6->flow_lbl[0] = 0; + } else { + ih6->priority = (ih4->tos & 0xf0) >> 4; + ih6->flow_lbl[0] = (ih4->tos & 0x0f) << 4; + } + ih6->flow_lbl[1] = 0; + ih6->flow_lbl[2] = 0; + + /* Hop Limit = IPv4 TTL */ + ih6->hop_limit = ih4->ttl; + + /* Translate source destination addresses, + for IPv6 host it's IPv4-translated IPv6 address, + for IPv4 host it's IPv4-mapped IPv6 address + + !!WARNING!! Instead IPv4-mapped IPv6 addresses we use addreesses + with unused prefix ::ffff:ffff:0:0/96, because KAME implementation + doesn't support IPv4-mapped addresses in IPv6 packets and discard them. + + */ + + if (include_flag) { + /* + It's ICMP included IP packet and there is a diffirence + in src/dst addresses then src/dst in normal direction + */ + + /* + Source address + is IPv4-translated IPv6 address because packet traveled + from IPv6 to IPv4 area + */ + ih6->saddr.in6_u.u6_addr32[0] = 0; + ih6->saddr.in6_u.u6_addr32[1] = 0; + ih6->saddr.in6_u.u6_addr32[2] = htonl(TRANSLATED_PREFIX); /* to network order bytes */ + ih6->saddr.in6_u.u6_addr32[3] = ih4->saddr; + + /* + Destination address + is IPv4-mapped address (but it's not IPv4- mapped, we use + prefix ::ffff:ffff:0:0/96 + */ + ih6->daddr.in6_u.u6_addr32[0] = 0; + ih6->daddr.in6_u.u6_addr32[1] = 0; + ih6->daddr.in6_u.u6_addr32[2] = htonl(MAPPED_PREFIX); /* to network order bytes */ + ih6->daddr.in6_u.u6_addr32[3] = ih4->daddr; + } + else { + + /* + This is normal case (packet isn't included IP packet) + + Source address + is IPv4-mapped address (but it's not IPv4- mapped, we use + prefix ::ffff:ffff:0:0/96) + */ + ih6->saddr.in6_u.u6_addr32[0] = 0; + ih6->saddr.in6_u.u6_addr32[1] = 0; + ih6->saddr.in6_u.u6_addr32[2] = htonl(MAPPED_PREFIX); /* to network order bytes */ + ih6->saddr.in6_u.u6_addr32[3] = ih4->saddr; + + /* Destination address + is is IPv4-translated IPv6 address + */ + ih6->daddr.in6_u.u6_addr32[0] = 0; + ih6->daddr.in6_u.u6_addr32[1] = 0; + ih6->daddr.in6_u.u6_addr32[2] = htonl(TRANSLATED_PREFIX); /* to network order bytes */ + ih6->daddr.in6_u.u6_addr32[3] = ih4->daddr; + } + + /* Payload Length */ + plen = new_tot_len - hdr_len; /* Payload length = IPv4 total len - IPv4 header len */ + ih6->payload_len = htons(plen); + + /* Next Header */ + ih6->nexthdr = new_nexthdr; /* Next Header */ + + /* Process ICMP protocols data */ + + switch (ih4->protocol) { + case IPPROTO_ICMP: + if ( (ntohs(ih4->frag_off) & IP_OFFSET) != 0 || (ntohs(ih4->frag_off) & IP_MF) != 0 ) { + PDEBUG("ip4_ip6(): don't translate ICMPv4 fragments - packet dropped.\n"); + return -1; + } + + icmp_hdr = (struct icmphdr *) (src+hdr_len); /* point to ICMPv4 header */ + csum = 0; + icmp_len = ntohs(ih4->tot_len) - hdr_len; /* ICMPv4 packet length */ + icmp6_hdr = (struct icmp6hdr *)(dst+sizeof(struct ipv6hdr) + +fr_flag*sizeof(struct frag_hdr)); /* point to ICMPv6 header */ + + if (include_flag) { + /* ICMPv4 packet cannot be included in ICMPv4 Error message */ + /* !!! May be it's WRONG !!! ICMPv4 QUERY packet can be included + in ICMPv4 Error message */ + PDEBUG("ip4_ip6(): It's included ICMPv4 in ICMPv4 Error message - packet dropped.\n"); + return -1; + } + + /* Check ICMPv4 Type field */ + switch (icmp_hdr->type) { + /* ICMP Error messages */ + /* Destination Unreachable (Type 3) */ + case ICMP_DEST_UNREACH: + icmp6_hdr->icmp6_type = ICMPV6_DEST_UNREACH; /* to Type 1 */ + icmp6_hdr->icmp6_unused = 0; + switch (icmp_hdr->code) + { + case ICMP_NET_UNREACH: /* Code 0 */ + case ICMP_HOST_UNREACH: /* Code 1 */ + case ICMP_SR_FAILED: /* Code 5 */ + case ICMP_NET_UNKNOWN: /* Code 6 */ + case ICMP_HOST_UNKNOWN: /* Code 7 */ + case ICMP_HOST_ISOLATED: /* Code 8 */ + case ICMP_NET_UNR_TOS: /* Code 11 */ + case ICMP_HOST_UNR_TOS: /* Code 12 */ + icmp6_hdr->icmp6_code = ICMPV6_NOROUTE; /* to Code 0 */ + break; + case ICMP_PROT_UNREACH: /* Code 2 */ + icmp6_hdr->icmp6_type = ICMPV6_PARAMPROB; /* to Type 4 */ + icmp6_hdr->icmp6_code = ICMPV6_UNK_NEXTHDR; /* to Code 1 */ + /* Set pointer filed to 6, it's octet offset IPv6 Next Header field */ + icmp6_hdr->icmp6_pointer = htonl(6); + break; + case ICMP_PORT_UNREACH: /* Code 3 */ + icmp6_hdr->icmp6_code = ICMPV6_PORT_UNREACH; /* to Code 4 */ + break; + case ICMP_FRAG_NEEDED: /* Code 4 */ + icmp6_hdr->icmp6_type = ICMPV6_PKT_TOOBIG; /* to Type 2 */ + icmp6_hdr->icmp6_code = 0; + /* Correct MTU */ + if (icmp_hdr->un.frag.mtu == 0) + /* we use minimum MTU for IPv4 PMTUv4 RFC1191, section 5; + IPv6 implementation wouldn't accept Path MTU < 1280, + but it records info correctly to always include + a fragment header */ + icmp6_hdr->icmp6_mtu = htonl(576); + else + /* needs to adjusted for difference between IPv4/IPv6 headers + * SIIT RFC2765, section 3.3, + * we assume that difference is 20 bytes */ + icmp6_hdr->icmp6_mtu = htonl(ntohs(icmp_hdr->un.frag.mtu)+IP4_IP6_HDR_DIFF); + + break; + case ICMP_NET_ANO: /* Code 9 */ + case ICMP_HOST_ANO: /* Code 10 */ + icmp6_hdr->icmp6_code = ICMPV6_ADM_PROHIBITED; /* to Code 1 */ + break; + default: /* discard any other Code */ + PDEBUG("ip4_ip6(): Unknown ICMPv4 Type %d Code %d - packet dropped.\n", + ICMP_DEST_UNREACH, icmp_hdr->code); + return -1; + } + break; + /* Time Exceeded (Type 11) */ + case ICMP_TIME_EXCEEDED: + icmp6_hdr->icmp6_type = ICMPV6_TIME_EXCEED; + icmp6_hdr->icmp6_code = icmp_hdr->code; + break; + /* Parameter Problem (Type 12) */ + case ICMP_PARAMETERPROB: + icmp6_hdr->icmp6_type = ICMPV6_PARAMPROB; + icmp6_hdr->icmp6_code = icmp_hdr->code; + + icmp_ptr = ntohs(icmp_hdr->un.echo.id) >> 8; + switch (icmp_ptr) { + case 0: + icmp6_hdr->icmp6_pointer = 0; /* IPv4 Version -> IPv6 Version */ + break; + case 2: + icmp6_hdr->icmp6_pointer = __constant_htonl(4); /* IPv4 length -> IPv6 Payload Length */ + break; + case 8: + icmp6_hdr->icmp6_pointer = __constant_htonl(7); /* IPv4 TTL -> IPv6 Hop Limit */ + break; + case 9: + icmp6_hdr->icmp6_pointer = __constant_htonl(6); /* IPv4 Protocol -> IPv6 Next Header */ + break; + case 12: + icmp6_hdr->icmp6_pointer = __constant_htonl(8); /* IPv4 Src Addr -> IPv6 Src Addr */ + break; + case 16: + icmp6_hdr->icmp6_pointer = __constant_htonl(24); /* IPv4 Dst Addr -> IPv6 Dst Addr */ + break; + default: + icmp6_hdr->icmp6_pointer = 0xffffffff; /* set to all ones in any other cases */ + break; + } + break; + case ICMP_ECHO: + icmperr = 0; + icmp6_hdr->icmp6_type = ICMPV6_ECHO_REQUEST; + icmp6_hdr->icmp6_code = 0; + /* Copy rest ICMP data to new IPv6 packet without changing */ + memcpy(((char *)icmp6_hdr)+4, ((char *)icmp_hdr)+4, len - hdr_len - 4); + break; + + case ICMP_ECHOREPLY: + icmperr = 0; + icmp6_hdr->icmp6_type = ICMPV6_ECHO_REPLY; + icmp6_hdr->icmp6_code = 0; + /* Copy rest ICMP data to new IPv6 packet without changing */ + memcpy(((char *)icmp6_hdr)+4, ((char *)icmp_hdr)+4, len - hdr_len - 4); + break; + + /* Discard any other ICMP messages */ + default: + PDEBUG("ip4_ip6(): Unknown ICMPv4 packet Type %x - packet dropped.\n", icmp_hdr->type); + return -1; + } + + /* Now if it's ICMPv4 Error message we must translate included IP packet */ + + if (icmperr) { + /* Call our ip4_ip6() to translate included IP packet */ + if (ip4_ip6(src+hdr_len+sizeof(struct icmphdr), len - hdr_len - sizeof(struct icmphdr), + dst+sizeof(struct ipv6hdr)+fr_flag*sizeof(struct frag_hdr) + +sizeof(struct icmp6hdr), 1) == -1) { + PDEBUG("ip4_ip6(): Uncorrect translation of ICMPv4 Error message - packet dropped.\n"); + return -1; + } + /* correct ICMPv6 packet length for diffirence between IPv4 and IPv6 headers + in included IP packet + */ + icmp_len += 20; + /* and correct Payload length for diffirence between IPv4 and IPv6 headers */ + plen += 20; + ih6->payload_len = htons(plen); + } + + /* Calculate ICMPv6 checksum */ + + icmp6_hdr->icmp6_cksum = 0; + csum = 0; + + csum = csum_partial((u_char *)icmp6_hdr, icmp_len, csum); + icmp6_hdr->icmp6_cksum = csum_ipv6_magic(&ih6->saddr, &ih6->daddr, icmp_len, + IPPROTO_ICMPV6, csum); + break; + + /* Process TCP protocols data */ + case IPPROTO_TCP: + /* Copy TCP data to new IPv6 packet without changing */ + memcpy(dst+sizeof(struct ipv6hdr)+fr_flag*sizeof(struct frag_hdr), + src+hdr_len, len - hdr_len); + break; + + /* Process UDP protocols data */ + case IPPROTO_UDP: + udp_hdr = (struct udphdr *)(src+hdr_len); + if ((ntohs(ih4->frag_off) & IP_OFFSET) == 0) { + if ((ntohs(ih4->frag_off) & IP_MF) != 0) { + /* It's a first fragment */ + if (udp_hdr->check == 0) { + /* System management event */ + printk("siit: First fragment of UDP with zero checksum - packet droped\n"); + printk("siit: addr: %x src port: %d dst port: %d\n", + htonl(ih4->saddr), htons(udp_hdr->source), htons(udp_hdr->dest)); + return -1; + } + } + else if (udp_hdr->check == 0) + fl_csum = 1; + } + + /* Copy UDP data to new IPv6 packet */ + udp_hdr = (struct udphdr *)(dst+sizeof(struct ipv6hdr) + + fr_flag*sizeof(struct frag_hdr)); + memcpy((char *)udp_hdr, src+hdr_len, len - hdr_len); + + /* Calculate UDP checksum if UDP checksum in IPv4 packet was ZERO + and if it isn't included IP packet + */ + if (fl_csum && (!include_flag)) { + udp_hdr->check = 0; + csum = 0; + csum = csum_partial((unsigned char *)udp_hdr, plen - fr_flag*sizeof(struct frag_hdr), csum); + udp_hdr->check = csum_ipv6_magic(&ih6->saddr, &ih6->daddr, plen - + fr_flag*sizeof(struct frag_hdr), IPPROTO_UDP, csum); + } + break; + + /* Discard packets with any other protocol */ + default: + PDEBUG("ip4_ip6(): Unknown upper protocol - packet dropped.\n"); + return -1; + } + +#ifdef SIIT_DEBUG + siit_print_dump(dst, sizeof(struct ipv6hdr), "siit: ip4_ip6(): (out) ipv6 header dump"); +#endif + + return 0; +} + +/* + * Translation IPv6 to IPv4 stuff + * + * ip6_ip4(src, len, dst, include_flag) + * + * where + * src - buffer with original IPv6 packet, + * len - size of original packet, + * dst - new buffer for IPv4 packet, + * include_flag - if = 1, dst point to IPv6 packet that is ICMP error + * included IP packet, else = 0 + * + */ + +static int ip6_ip4(char *src, int len, char *dst, int include_flag) +{ + struct ipv6hdr *ip6_hdr; /* point to current IPv6 header struct */ + struct iphdr *ip_hdr; /* point to current IPv4 header struct */ + int opts_len = 0; /* to sum Option Headers length */ + int icmperr = 1; /* if = 1, indicate that packet is ICMP Error message, else = 0 */ + int ntot_len = 0; /* to calculate IPv6 Total Length field */ + int real_len; + int len_delta; + int ip6_payload_len; + int inc_opts_len = 0; /* to sum Option Headers length in ICMP included IP packet */ + __u8 next_hdr; /* Next Header */ + +#ifdef SIIT_DEBUG + siit_print_dump(src, sizeof(struct ipv6hdr), "siit: ip6_ip4(): (in) ipv6 header dump"); +#endif + + if ( (len_delta = len - sizeof(struct ipv6hdr)) >= 0) + { + ip6_hdr = (struct ipv6hdr *)src; + ip_hdr = (struct iphdr *)dst; + + real_len = sizeof(struct iphdr); + + /* Check validation of Saddr & Daddr? is a packet to fall under our translation? */ + if (include_flag) { /* It's ICMP included IP packet, + about process include_flag see comment in ip4_ip6() */ + if (ip6_hdr->saddr.s6_addr32[2] != htonl(MAPPED_PREFIX)) { + PDEBUG("ip6_ip4(): Included IP packet Src addr isn't mapped addr: %x%x%x%x, packet dropped.\n", + ip6_hdr->saddr.s6_addr32[0], ip6_hdr->saddr.s6_addr32[1], + ip6_hdr->saddr.s6_addr32[2], ip6_hdr->saddr.s6_addr32[3]); + return -1; + } + if ( ip6_hdr->daddr.s6_addr32[2] != htonl(TRANSLATED_PREFIX)) { + PDEBUG("ip6_ip4(): Included IP packet Dst addr isn't translated addr: %x%x%x%x, packet dropped.\n", + ip6_hdr->daddr.s6_addr32[0], ip6_hdr->daddr.s6_addr32[1], + ip6_hdr->daddr.s6_addr32[2], ip6_hdr->daddr.s6_addr32[3]); + return -1; + } + } + else { /* It's normal IP packet (not included in ICMP) */ + if (ip6_hdr->saddr.s6_addr32[2] != htonl(TRANSLATED_PREFIX)) { + PDEBUG("ip6_ip4(): Src addr isn't translated addr: %x%x%x%x, packet dropped.\n", + ip6_hdr->saddr.s6_addr32[0], ip6_hdr->saddr.s6_addr32[1], + ip6_hdr->saddr.s6_addr32[2], ip6_hdr->saddr.s6_addr32[3]); + return -1; + } + if ( ip6_hdr->daddr.s6_addr32[2] != htonl(MAPPED_PREFIX)) { + PDEBUG("ip6_ip4(): Dst addr isn't mapped addr: %x%x%x%x, packet dropped.\n", + ip6_hdr->daddr.s6_addr32[0], ip6_hdr->daddr.s6_addr32[1], + ip6_hdr->daddr.s6_addr32[2], ip6_hdr->daddr.s6_addr32[3]); + return -1; + } + } + + /* Set IPv4 Fragment Offset and ID to 0 + before process any Option Headers */ + ip_hdr->frag_off = 0; + ip_hdr->id = 0; + + /* + * We process only Fragment Header. Any other options headers + * are ignored, i.e. there is no attempt to translate them. + * However, the Total Length field and the Protocol field would + * have to be adjusted to "skip" these extension headers. + */ + + next_hdr = ip6_hdr->nexthdr; + + /* Hop_by_Hop options header (ip6_hdr->nexthdr = 0). It must + * appear only in IPv6 header's Next Header field. + */ + if (next_hdr == NEXTHDR_HOP) { + if ( (len_delta - sizeof(struct ipv6_opt_hdr)) >= 0) + { + struct ipv6_opt_hdr *ip6h = + (struct ipv6_opt_hdr *)(src+sizeof(struct ipv6hdr) + opts_len); + if ( (len_delta -= ip6h->hdrlen*8 + 8) >= 0) + { + opts_len += ip6h->hdrlen*8 + 8; /* See RFC 2460 page 11: + Hdr Ext Len 8-bit unsigned integer. Length of the Hop-by- + Hop Options header in 8-octet units, not + including the first 8 octets. + */ + next_hdr = ip6h->nexthdr; + } + else + { + PDEBUG("ip6_ip4(): hop_by_hop header error, packet droped"); + /* Generate ICMP Parameter Problem */ + return -1; + } + } + } + + if (len_delta > 0) + { + while(next_hdr != NEXTHDR_ICMP && next_hdr != NEXTHDR_TCP + && next_hdr != NEXTHDR_UDP) + { + /* Destination options header */ + if (next_hdr == NEXTHDR_DEST) + { + if ( (len_delta - sizeof(struct ipv6_opt_hdr)) >= 0) + { + struct ipv6_opt_hdr *ip6d = + (struct ipv6_opt_hdr *)(src + sizeof(struct ipv6hdr) + opts_len); + if ( (len_delta -= ip6d->hdrlen*8 + 8) >= 0) + { + opts_len += ip6d->hdrlen*8 + 8; + next_hdr = ip6d->nexthdr; + } + } + else + { + PDEBUG("ip6_ip4(): destination header error, packet droped"); + /* Generate ICMP Parameter Problem */ + return -1; + } + } + /* Routing options header */ + else if (next_hdr == NEXTHDR_ROUTING) + { + if ( (len_delta - sizeof(struct ipv6_rt_hdr)) >= 0) + { + struct ipv6_rt_hdr *ip6rt = + (struct ipv6_rt_hdr *)(src+sizeof(struct ipv6hdr) + opts_len); + /* RFC 2765 SIIT, 4.1: + If a routing header with a non-zero Segments Left field is present + then the packet MUST NOT be translated, and an ICMPv6 "parameter + problem/ erroneous header field encountered" (Type 4/Code 0) error + message, with the Pointer field indicating the first byte of the + Segments Left field, SHOULD be returned to the sender. + */ + if (ip6rt->segments_left != 0) { + /* Build ICMPv6 "Parameter Problem/Erroneous Header + Field Encountered" & drop the packet */ + /* !!! We don't send ICMPv6 "Parameter Problem" !!! */ + PDEBUG("ip6_ip4(): routing header type != 0\n"); + return -1; + } + if ( (len_delta -= ip6rt->hdrlen*8 + 8) >= 0) + { + opts_len += ip6rt->hdrlen*8 + 8; + next_hdr = ip6rt->nexthdr; + } + else + { + PDEBUG("ip6_ip4(): routing header error, packet droped"); + /* Generate ICMP Parameter Problem */ + return -1; + } + } + } + /* Fragment options header */ + else if (next_hdr == NEXTHDR_FRAGMENT) + { + if ( (len_delta -= sizeof(struct frag_hdr)) >= 0) + { + struct frag_hdr *ip6f = + (struct frag_hdr *)(src+sizeof(struct ipv6hdr)+opts_len); + + opts_len += sizeof(struct frag_hdr); /* Frag Header Length = 8 */ + ip_hdr->id = htons(ntohl(ip6f->identification)); /* ID field */ + ip_hdr->frag_off = htons((ntohs(ip6f->frag_off) & IP6F_OFF_MASK) >> 3); + /* fragment offset */ + ip_hdr->frag_off = htons(ntohs(ip_hdr->frag_off) | + ((ntohs(ip6f->frag_off) & IP6F_MORE_FRAG) << 13)); + /* more fragments flag */ + next_hdr = ip6f->nexthdr; + } + else + { + PDEBUG("ip6_ip4(): fragment header error, packet droped"); + /* Generate ICMP Parameter Problem */ + return -1; + } + } + /* No Next Header */ + else if (next_hdr == NEXTHDR_NONE) + { + /* RFC 2460 IPv6 Specification, 4.7 + 4.7 No Next Header + + The value 59 in the Next Header field of an IPv6 header or any + extension header indicates that there is nothing following that + header. If the Payload Length field of the IPv6 header indicates the + presence of octets past the end of a header whose Next Header field + contains 59, those octets must be ignored, and passed on unchanged if + the packet is forwarded. + */ + break; + } + else if (next_hdr == NEXTHDR_ESP || next_hdr == NEXTHDR_AUTH) + { + PDEBUG("ip6_ip4(): cannot translate AUTH or ESP extension header, packet dropped\n"); + return -1; + } + else if (next_hdr == NEXTHDR_IPV6) + { + PDEBUG("ip6_ip4(): cannot translate IPv6-IPv6 packet, packet dropped\n"); + return -1; + } + else if (next_hdr == 0) + { + /* As say RFC 2460 (IPv6 Spec) we should discard the packet and send an + ICMP Parameter Problem message to the source of the packet, with an + ICMP Code value of 1 ("unrecognized Next Header type encountered") + and the ICMP Pointer field containing the offset of the unrecognized + value within the original packet + */ + /* NOT IMPLEMENTED */ + PDEBUG("ip6_ip4(): NEXTHDR in extension header = 0, packet dropped\n"); + return -1; + } + else + { + PDEBUG("ip6_ip4(): cannot translate extension header = %d, packet dropped\n", next_hdr); + return -1; + } + } + } + } + else + { + PDEBUG("ip6_ip4(): error packet len, packet dropped.\n"); + return -1; + } + + /* Building ipv4 packet */ + + ip_hdr->version = IPVERSION; + ip_hdr->ihl = 5; + + /* TOS see comment about TOS in ip4_ip6() */ + if (tos_ignore_flag) + ip_hdr->tos = 0; + else { + ip_hdr->tos = ip6_hdr->priority << 4; + ip_hdr->tos = ip_hdr->tos | (ip6_hdr->flow_lbl[0] >> 4); + } + + /* IPv4 Total Len = IPv6 Payload Len + + IPv4 Header Len (without options) - Options Headers Len */ + ip6_payload_len = ntohs(ip6_hdr->payload_len); + + if (ip6_payload_len == 0) + ntot_len = 0; + else + ntot_len = ip6_payload_len + IP4_IP6_HDR_DIFF - opts_len; + + ip_hdr->tot_len = htons(ntot_len); + + /* IPv4 TTL = IPv6 Hop Limit */ + ip_hdr->ttl = ip6_hdr->hop_limit; + + /* IPv4 Protocol = Next Header that will point to upper layer protocol */ + ip_hdr->protocol = next_hdr; + + /* IPv4 Src addr = last 4 bytes from IPv6 Src addr */ + ip_hdr->saddr = ip6_hdr->saddr.s6_addr32[3]; + /* IPv4 Dst addr = last 4 bytes from IPv6 Dst addr */ + ip_hdr->daddr = ip6_hdr->daddr.s6_addr32[3]; + + /* Calculate IPv4 header checksum */ + ip_hdr->check = 0; + ip_hdr->check = ip_fast_csum((unsigned char *)ip_hdr, ip_hdr->ihl); + + if (len_delta > 0) + { + /* PROCESS ICMP */ + + if (next_hdr == NEXTHDR_ICMP) + { + struct icmp6hdr *icmp6_hdr; + struct icmphdr *icmp_hdr; + + if ((len_delta -= sizeof(struct icmp6hdr)) >= 0) + { + icmp6_hdr = (struct icmp6hdr *)(src + sizeof(struct ipv6hdr) + opts_len); + icmp_hdr = (struct icmphdr *)(dst + sizeof(struct iphdr)); + + real_len += len_delta + sizeof(struct icmphdr); + + /* There is diffirent between ICMPv4/ICMPv6 protocol codes + IPPROTO_ICMP = 1 + IPPROTO_ICMPV6 = 58 */ + ip_hdr->protocol = IPPROTO_ICMP; + + if (include_flag) { + /* !!! Warnig !!! We discard ICMP packets with any ICMP as included + in ICMP Error. But ICMP Error messages can include ICMP Query message + */ + if (icmp6_hdr->icmp6_type != ICMPV6_ECHO_REQUEST) + { + PDEBUG("ip6_ip4(): included ICMPv6 in ICMPv6 Error message, packet dropped\n"); + return -1; + } + } + + /* Translate ICMPv6 to ICMPv4 */ + switch (icmp6_hdr->icmp6_type) + { +/* ICMP Error messages */ + /* Destination Unreachable (Type 1) */ + case ICMPV6_DEST_UNREACH: /* Type 1 */ + icmp_hdr->type = ICMP_DEST_UNREACH; /* to Type 3 */ + icmp_hdr->un.echo.id = 0; + icmp_hdr->un.echo.sequence = 0; + switch (icmp6_hdr->icmp6_code) + { + case ICMPV6_NOROUTE: /* Code 0 */ + case ICMPV6_NOT_NEIGHBOUR: /* Code 2 */ + case ICMPV6_ADDR_UNREACH: /* Code 3 */ + icmp_hdr->code = ICMP_HOST_UNREACH; /* To Code 1 */ + break; + case ICMPV6_ADM_PROHIBITED: /* Code 1 */ + icmp_hdr->code = ICMP_HOST_ANO; /* To Code 10 */ + break; + case ICMPV6_PORT_UNREACH: /* Code 4 */ + icmp_hdr->code = ICMP_PORT_UNREACH; /* To Code 3 */ + + break; + default: /* discard any other codes */ + PDEBUG("ip6_ip4(): Unknown ICMPv6 Type %d Code %d - packet dropped.\n", + ICMPV6_DEST_UNREACH, icmp6_hdr->icmp6_code); + return -1; + } + break; + /* Packet Too Big (Type 2) */ + case ICMPV6_PKT_TOOBIG: /* Type 2 */ + icmp_hdr->type = ICMP_DEST_UNREACH; /* to Type 3 */ + icmp_hdr->code = ICMP_FRAG_NEEDED; /* to Code 4 */ + /* Change MTU, RFC 2765 (SIIT), 4.2: + The MTU field needs to be adjusted for the difference between + the IPv4 and IPv6 header sizes taking into account whether or + not the packet in error includes a Fragment header. + */ + /* !!! Don't implement !!! */ + icmp_hdr->un.frag.mtu = (__u16) icmp6_hdr->icmp6_mtu; + break; + /* Time Exceeded (Type 3) */ + case ICMPV6_TIME_EXCEED: + icmp_hdr->type = ICMP_TIME_EXCEEDED; /* to Type 11 */ + icmp_hdr->code = icmp6_hdr->icmp6_code; /* Code unchanged */ + break; + /* Parameter Problem (Type 4) */ + case ICMPV6_PARAMPROB: + switch (icmp6_hdr->icmp6_code) { + case ICMPV6_UNK_NEXTHDR: /* Code 1 */ + icmp_hdr->type = ICMP_DEST_UNREACH; /* to Type 3 */ + icmp_hdr->code = ICMP_PROT_UNREACH; /* to Code 2 */ + break; + default: /* if Code != 1 */ + icmp_hdr->type = ICMP_PARAMETERPROB; /* to Type 12 */ + icmp_hdr->code = 0; /* to Code 0 */ + /* Update Pointer field + RFC 2765 (SIIT), 4.2: + The Pointer needs to be updated to point to the corresponding + field in the translated include IP header. + */ + switch (ntohl(icmp6_hdr->icmp6_pointer)) + { + case 0: /* IPv6 Version -> IPv4 Version */ + icmp_hdr->un.echo.id = 0; + break; + case 4: /* IPv6 PayloadLength -> IPv4 Total Length */ + icmp_hdr->un.echo.id = 0x0002; /* 2 */ + break; + case 6: /* IPv6 Next Header-> IPv4 Protocol */ + icmp_hdr->un.echo.id = 0x0009; /* 9 */ + break; + case 7: /* IPv6 Hop Limit -> IPv4 TTL */ + icmp_hdr->un.echo.id = 0x0008; /* 8 */ + break; + case 8: /* IPv6 Src addr -> IPv4 Src addr */ + icmp_hdr->un.echo.id = 0x000c; /* 12 */ + break; + case 24: /* IPv6 Dst addr -> IPv4 Dst addr*/ + icmp_hdr->un.echo.id = 0x0010; /* 16 */ + break; + default: /* set all ones in other cases */ + icmp_hdr->un.echo.id = 0xff; + break; + } + break; + } + break; + +/* End of ICMP Error messages */ + + /* Echo Request and Echo Reply (Type 128 and 129) */ + case ICMPV6_ECHO_REQUEST: + icmperr = 0; /* not error ICMP message */ + icmp_hdr->type = ICMP_ECHO; /* to Type 8 */ + icmp_hdr->code = 0; /* to Code 0 */ + icmp_hdr->un.echo.id = icmp6_hdr->icmp6_identifier; + icmp_hdr->un.echo.sequence = icmp6_hdr->icmp6_sequence; + /* copy rest of ICMP data to result packet */ + if (len_delta > 0) + memcpy(((char *)icmp_hdr) + sizeof(struct icmphdr), + ((char *)icmp6_hdr) + sizeof(struct icmp6hdr), len_delta); + break; + case ICMPV6_ECHO_REPLY: + icmperr = 0; /* not error ICMP message */ + icmp_hdr->type = ICMP_ECHOREPLY; /* to Type 0 */ + icmp_hdr->code = 0; /* to Code 0 */ + icmp_hdr->un.echo.id = icmp6_hdr->icmp6_identifier; + icmp_hdr->un.echo.sequence = icmp6_hdr->icmp6_sequence; + /* copy rest of ICMP data */ + if (len_delta > 0) + memcpy(((char *)icmp_hdr) + sizeof(struct icmphdr), + ((char *)icmp6_hdr) + sizeof(struct icmp6hdr), len_delta); + break; + default: + /* Unknown error messages. Silently drop. */ + PDEBUG("ip6_ip4(): unknown ICMPv6 Type %d, packet dropped.\n", icmp6_hdr->icmp6_type); + return -1; + } + + if (icmperr) + { + /* If ICMP Error message, we translate IP included packet*/ + if (len_delta >= sizeof(struct ipv6hdr)) + { + if((inc_opts_len = ip6_ip4((char *)icmp6_hdr + sizeof(struct icmp6hdr), len_delta, + (char *)icmp_hdr + sizeof(struct icmphdr), 1)) == -1) { + PDEBUG("ip6_ip4(): incorrect translation of ICMPv6 Error message, packet dropped\n"); + return -1; + } + /* correct IPv4 Total Len that = old Total Len + - Options Headers Len in included IP packet + - diffirence between IPv6 Header Len and IPv4 Header Len + */ + if (ntot_len != 0) + ip_hdr->tot_len = htons(ntot_len - inc_opts_len - IP4_IP6_HDR_DIFF); + real_len = real_len - inc_opts_len - IP4_IP6_HDR_DIFF; + } + else if (len_delta > 0) + { + /* May be it need set 0x0 to rest area in result IPv4 packet, + * but we copy rest data unchanged + */ + memcpy(((char *)icmp_hdr) + sizeof(struct icmphdr), + ((char *)icmp6_hdr) + sizeof(struct icmp6hdr), len_delta); + } + } + + /* Calculate IPv4 Header checksum */ + ip_hdr->check = 0; + ip_hdr->check = ip_fast_csum((unsigned char *)ip_hdr, ip_hdr->ihl); + + /* Calculate ICMPv4 checksum */ + if (ntot_len != 0) + { + icmp_hdr->checksum = 0; + icmp_hdr->checksum = ip_compute_csum((unsigned char *)icmp_hdr, ntohs(ip_hdr->tot_len) + - sizeof(struct iphdr)); + } + } + else + { + PDEBUG("ip6_ip4(): error length ICMP packet, packet dropped.\n"); + return -1; + } + + } + /* PROCESS TCP and UDP (and rest data) */ + + else { + real_len += len_delta; + /* we copy rest data to IPv4 packet without changing */ + memcpy(dst+sizeof(struct iphdr), src + sizeof(struct ipv6hdr) + opts_len, len_delta); + } + } + + if (include_flag) /* if it's included IP packet */ + return opts_len; /* return options headers length */ + else + return real_len; /* result packet len */ +} + +/* + * ip4_fragment(skb, len, hdr_len, dev, eth_h) + * to fragment original IPv4 packet if result IPv6 packet will be > 1280 + */ + +static int ip4_fragment(struct sk_buff *skb, int len, int hdr_len, struct net_device *dev, struct ethhdr *eth_h) +{ + struct sk_buff *skb2 = NULL; /* pointer to new struct sk_buff for transleded packet */ + char buff[FRAG_BUFF_SIZE+hdr_len]; /* buffer to form new fragment packet */ + char *cur_ptr = skb->data+hdr_len; /* pointter to current packet data with len = frag_len */ + struct iphdr *ih4 = (struct iphdr *) skb->data; + struct iphdr *new_ih4 = (struct iphdr *) buff; /* point to new IPv4 hdr */ + struct ethhdr *new_eth_h; /* point to ether hdr, need to set hard header data in fragment */ + int data_len = len - hdr_len; /* origin packet data len */ + int rest_len = data_len; /* rest data to fragment */ + int frag_len = 0; /* current fragment len */ + int last_frag = 0; /* last fragment flag, if = 1, it's last fragment */ + int flag_last_mf = 0; + __u16 new_id = 0; /* to generate identification field */ + __u16 frag_offset = 0; /* fragment offset */ + unsigned int csum; + unsigned short udp_len; + +#ifdef SIIT_DEBUG + printk("siit: it's DF == 0 and result IPv6 packet will be > 1280\n"); + siit_print_dump(skb->data, hdr_len, "siit: (orig) ipv4_hdr dump"); +#endif + + if ((ntohs(ih4->frag_off) & IP_MF) == 0 ) + /* it's a case we'll clear MF flag in our last packet */ + flag_last_mf = 1; + + if (ih4->protocol == IPPROTO_UDP) { + if ( (ntohs(ih4->frag_off) & IP_OFFSET) == 0) { + struct udphdr *udp_hdr = (struct udphdr *)((char *)ih4 + hdr_len); + if (!flag_last_mf) { + if (udp_hdr->check == 0) { + /* it's a first fragment with ZERO checksum and we drop packet */ + printk("siit: First fragment of UDP with zero checksum - packet droped\n"); + printk("siit: addr: %x src port: %d dst port: %d\n", + htonl(ih4->saddr), htons(udp_hdr->source), htons(udp_hdr->dest)); + return -1; + } + } + else if (udp_hdr->check == 0) { + /* Calculate UDP checksum only if it's not fragment */ + udp_len = ntohs(udp_hdr->len); + csum = 0; + csum = csum_partial((unsigned char *)udp_hdr, udp_len, csum); + udp_hdr->check = csum_tcpudp_magic(ih4->saddr, ih4->daddr, udp_len, IPPROTO_UDP, csum); + } + } + } + + frag_offset = ntohs(ih4->frag_off) & IP_OFFSET; + + new_id = ih4->id; + + while(1) { + if (rest_len <= FRAG_BUFF_SIZE) { + /* it's last fragmen */ + frag_len = rest_len; /* rest data */ + last_frag = 1; + } + else + frag_len = FRAG_BUFF_SIZE; + + /* copy IP header to buffer */ + memcpy(buff, skb->data, hdr_len); + /* copy data to buffer with len = frag_len */ + memcpy(buff + hdr_len, cur_ptr, frag_len); + + /* set id field in new IPv4 header*/ + new_ih4->id = new_id; + + /* is it last fragmet */ + if(last_frag && flag_last_mf) + /* clear MF flag */ + new_ih4->frag_off = htons(frag_offset & (~IP_MF)); + else + /* set MF flag */ + new_ih4->frag_off = htons(frag_offset | IP_MF); + + /* change packet total length */ + new_ih4->tot_len = htons(frag_len+hdr_len); + + /* rebuild the header checksum (IP needs it) */ + new_ih4->check = 0; + new_ih4->check = ip_fast_csum((unsigned char *)new_ih4,new_ih4->ihl); + + /* Allocate new sk_buff to compose translated packet */ + skb2 = dev_alloc_skb(frag_len+hdr_len+dev->hard_header_len+IP4_IP6_HDR_DIFF+IP6_FRAGMENT_SIZE); + if (!skb2) { + printk(KERN_DEBUG "%s: alloc_skb failure - packet dropped.\n", dev->name); + dev_kfree_skb(skb2); + return -1; + } + /* allocate skb->data portion for IP header len, fragment data len and ether header len + * and copy to head ether header from origin skb + */ + memcpy(skb_put(skb2, frag_len+hdr_len+dev->hard_header_len+IP4_IP6_HDR_DIFF+IP6_FRAGMENT_SIZE), (char *) eth_h, + dev->hard_header_len); + /* correct ether header data, ether protocol field to ETH_P_IPV6 */ + new_eth_h = (struct ethhdr *)skb2->data; + new_eth_h->h_proto = htons(ETH_P_IPV6); + + /* reset the mac header */ + skb_reset_mac_header(skb2); + + /* pull ether header from new skb->data */ + skb_pull(skb2, dev->hard_header_len); + /* set skb protocol to IPV6 */ + skb2->protocol = htons(ETH_P_IPV6); + + /* call translation function */ + if ( ip4_ip6(buff, frag_len+hdr_len, skb2->data, 0) == -1) { + dev_kfree_skb(skb2); + return -1; + } + + /* + * Set needed fields in new sk_buff + */ + skb2->dev = dev; + skb2->ip_summed = CHECKSUM_UNNECESSARY; + skb2->pkt_type = PACKET_HOST; + + /* Add transmit statistic */ + siit_stats(dev)->tx_packets++; + siit_stats(dev)->tx_bytes += skb2->len; + + /* send packet to upper layer */ + netif_rx(skb2); + + /* exit if it was last fragment */ + if (last_frag) + break; + + /* correct current data pointer */ + cur_ptr += frag_len; + /* rest data len */ + rest_len -= frag_len; + /* current fragment offset */ + frag_offset = (frag_offset*8 + frag_len)/8; + } + + return 0; +} +/* + * Transmit a packet (called by the kernel) + * + * siit_xmit(skb, dev) + * + * where + * skb - pointer to struct sk_buff with incomed packet + * dev - pointer to struct device on which packet revieved + * + * Statistic: + * for all incoming packes: + * stats.rx_bytes+=skb->len + * stats.rx_packets++ + * for packets we can't transle: + * stats.tx_errors++ + * device busy: + * stats.tx_errors++ + * for packets we can't allocate sk_buff: + * stats.tx_dropped++ + * for outgoing packes: + * stats.tx_packets++ + * stats.tx_bytes+=skb2->len !!! But we don't set skb2->len !!! + */ + +static int siit_xmit(struct sk_buff *skb, struct net_device *dev) +{ + struct sk_buff *skb2 = NULL;/* pointer to new struct sk_buff for transleded packet */ + struct ethhdr *eth_h; /* pointer to incoming Ether header */ + int len; /* original packets length */ + int new_packet_len; + int skb_delta = 0; /* delta size for allocate new skb */ + char new_packet_buff[2048]; + + /* Check pointer to sk_buff and device structs */ + if (skb == NULL || dev == NULL) + return -EINVAL; + + /* Add receive statistic */ + siit_stats(dev)->rx_bytes += skb->len; + siit_stats(dev)->rx_packets++; + + dev->trans_start = jiffies; + + /* Upper layer (IP) protocol forms sk_buff for outgoing packet + * and sets IP header + Ether header too. IP layer sets outgoing + * device in sk_buff->dev. + * In function (from linux/net/core/dev.c) ther is a call to + * device transmit function (dev->hard_start_xmit): + * + * dev_queue_xmit(struct sk_buff *skb) + * { + * ... + * device *dev = skb->dev; + * ... + * dev->hard_start_xmit(skb, dev); + * ... + * } + * We save pointer to ether header in eth_h and skb_pull ether header + * from data field of skb_buff + */ + + eth_h = (struct ethhdr *)skb->data; /* point to incoming packet Ether Header */ + +#ifdef SIIT_DEBUG + siit_print_dump(skb->data, ETH_HLEN, "siit: eth_hdr dump"); +#endif + + /* Remove hardware header from origin sk_buff */ + skb_pull(skb,dev->hard_header_len); + + /* + * Process IPv4 paket + */ + if (ntohs(skb->protocol) == ETH_P_IP) { + int hdr_len; /* IPv4 header length */ + int data_len; /* IPv4 data length */ + struct iphdr *ih4; /* pointer to IPv4 header */ + struct icmphdr *icmp_hdr; /* point to current ICMPv4 header struct */ + + ih4 = (struct iphdr *)skb->data; /* point to incoming packet's IPv4 header */ + + /* Check IPv4 Total Length */ + if (skb->len != ntohs(ih4->tot_len)) { + PDEBUG("siit_xmit(): Different skb_len %x and ip4 tot_len %x - packet dropped.\n", + skb->len, ih4->tot_len); + siit_stats(dev)->tx_errors++; + dev_kfree_skb(skb); + return 0; + } + + len = skb->len; /* packet's total len */ + hdr_len = (int)(ih4->ihl * 4); /* packet's header len */ + data_len = len - hdr_len; /* packet's data len */ + + /* If DF == 0 */ + if ( (ntohs(ih4->frag_off) & IP_DF) == 0 ) { + /* If result IPv6 packet will be > 1280 + we need to fragment original IPv4 packet + */ + if ( data_len > FRAG_BUFF_SIZE ) { + /* call function that fragment packet and translate to IPv6 each fragment + * and send to upper layer + */ + if ( ip4_fragment(skb, len, hdr_len, dev, eth_h) == -1) { + siit_stats(dev)->tx_errors++; + } + /* Free incoming skb */ + dev_kfree_skb(skb); + /* Device can accept a new packet */ + + return 0; + + } + } + /* If DF == 1 && MF == 0 && Fragment Offset == 0 + * we don't include fragment header + */ + if ( ntohs(ih4->frag_off) == IP_DF ) + skb_delta = IP4_IP6_HDR_DIFF; /* delta is +20 */ + else + skb_delta = IP4_IP6_HDR_DIFF + IP6_FRAGMENT_SIZE; /* delta is +20 and +8 */ + + /* If it's ICMP, check is it included IP packet in it */ + if ( ih4->protocol == IPPROTO_ICMP) { + icmp_hdr = (struct icmphdr *) (skb->data+hdr_len); /* point to ICMPv4 header */ + if ( icmp_hdr->type != ICMP_ECHO && icmp_hdr->type != ICMP_ECHOREPLY) { + /* + * It's ICMP Error that has included IP packet + * we'll add only +20 because we don't include Fragment Header + * into translated included IP packet + */ + skb_delta += IP4_IP6_HDR_DIFF; + } + } + + /* Allocate new sk_buff to compose translated packet */ + skb2 = dev_alloc_skb(len+dev->hard_header_len+skb_delta); + if (!skb2) { + printk(KERN_DEBUG "%s: alloc_skb failure - packet dropped.\n", dev->name); + dev_kfree_skb(skb); + siit_stats(dev)->rx_dropped++; + + return 0; + } + /* allocate skb->data portion = IPv4 packet len + ether header len + * + skb_delta (max = two times (diffirence between IPv4 header and + * IPv6 header + Frag Header), second for included packet, + * and copy to head of skb->data ether header from origin skb + */ + memcpy(skb_put(skb2, len+dev->hard_header_len+skb_delta), (char *)eth_h, dev->hard_header_len); + /* correct ether header data, ether protocol field to ETH_P_IPV6 */ + eth_h = (struct ethhdr *)skb2->data; + eth_h->h_proto = htons(ETH_P_IPV6); + skb_reset_mac_header(skb2); + /* remove ether header from new skb->data, + * NOTE! data will rest, pointer to data and data len will change + */ + skb_pull(skb2,dev->hard_header_len); + /* set skb protocol to IPV6 */ + skb2->protocol = htons(ETH_P_IPV6); + + /* call translation function */ + if (ip4_ip6(skb->data, len, skb2->data, 0) == -1 ) { + dev_kfree_skb(skb); + dev_kfree_skb(skb2); + siit_stats(dev)->rx_errors++; + + return 0; + } + } + /* + * IPv6 paket + */ + else if (ntohs(skb->protocol) == ETH_P_IPV6) { + +#ifdef SIIT_DEBUG + siit_print_dump(skb->data, sizeof(struct ipv6hdr), "siit: (in) ip6_hdr dump"); +#endif + /* packet len = skb->data len*/ + len = skb->len; + + /* call translation function */ + if ((new_packet_len = ip6_ip4(skb->data, len, new_packet_buff, 0)) == -1 ) + { + PDEBUG("siit_xmit(): error translation ipv6->ipv4, packet dropped.\n"); + siit_stats(dev)->rx_dropped++; + goto end; + } + + /* Allocate new sk_buff to compose translated packet */ + skb2 = dev_alloc_skb(new_packet_len + dev->hard_header_len); + if (!skb2) { + printk(KERN_DEBUG "%s: alloc_skb failure, packet dropped.\n", dev->name); + siit_stats(dev)->rx_dropped++; + goto end; + } + memcpy(skb_put(skb2, new_packet_len + dev->hard_header_len), (char *)eth_h, dev->hard_header_len); + eth_h = (struct ethhdr *)skb2->data; + eth_h->h_proto = htons(ETH_P_IP); + skb_reset_mac_header(skb2); + skb_pull(skb2, dev->hard_header_len); + memcpy(skb2->data, new_packet_buff, new_packet_len); + skb2->protocol = htons(ETH_P_IP); + } + else { + PDEBUG("siit_xmit(): unsupported protocol family %x, packet dropped.\n", skb->protocol); + goto end; + } + + /* + * Set needed fields in new sk_buff + */ + skb2->pkt_type = PACKET_HOST; + skb2->dev = dev; + skb2->ip_summed = CHECKSUM_UNNECESSARY; + + /* Add transmit statistic */ + siit_stats(dev)->tx_packets++; + siit_stats(dev)->tx_bytes += skb2->len; + + /* Send packet to upper layer protocol */ + netif_rx(skb2); + +end: + dev_kfree_skb(skb); + + return 0; +} + +static bool header_ops_init = false; +static struct header_ops siit_header_ops ____cacheline_aligned; + +static const struct net_device_ops siit_netdev_ops = { + .ndo_open = siit_open, + .ndo_stop = siit_release, + .ndo_start_xmit = siit_xmit, +}; + +/* + * The init function initialize of the SIIT device.. + * It is invoked by register_netdev() + */ + +static void +siit_init(struct net_device *dev) +{ + ether_setup(dev); /* assign some of the fields */ + random_ether_addr(dev->dev_addr); + + /* + * Assign device function. + */ + dev->netdev_ops = &siit_netdev_ops; + dev->flags |= IFF_NOARP; /* ARP not used */ + dev->tx_queue_len = 10; + + if (!header_ops_init) { + memcpy(&siit_header_ops, dev->header_ops, sizeof(struct header_ops)); + siit_header_ops.cache = NULL; + } + dev->header_ops = &siit_header_ops; +} + +/* + * Finally, the module stuff + */ +static struct net_device *siit_dev = NULL; + +int init_module(void) +{ + int res = -ENOMEM; + int priv_size; + + priv_size = sizeof(struct header_ops); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) + siit_dev = alloc_netdev(priv_size, "siit%d", NET_NAME_UNKNOWN, siit_init); +#else + siit_dev = alloc_netdev(priv_size, "siit%d", siit_init); +#endif + if (!siit_dev) + goto err_alloc; + + res = register_netdev(siit_dev); + if (res) + goto err_register; + + return 0; + +err_register: + free_netdev(siit_dev); +err_alloc: + printk(KERN_ERR "Error creating siit device: %d\n", res); + return res; +} + +void cleanup_module(void) +{ + unregister_netdev(siit_dev); + free_netdev(siit_dev); +} + +MODULE_LICENSE("GPL"); diff --git a/net/siit/src/siit.h b/net/siit/src/siit.h new file mode 100644 index 0000000..47cf776 --- /dev/null +++ b/net/siit/src/siit.h @@ -0,0 +1,61 @@ +/* + * siit.h -- definitions for the SIIT module + * + * + */ + +/* + * Constants + */ + +/* SIIT_ETH control the name of SIIT interface: + * 0 - interface name is siit0, + * 1 - interface name is ethX. + */ +#define SIIT_ETH 0 + +#define BUFF_SIZE 4096 +#define FRAG_BUFF_SIZE 1232 /* IPv6 max fragment size without IPv6 header + * to fragmanet IPv4 if result IPv6 packet will be > 1280 + */ + +#define TRANSLATED_PREFIX 0x0000ffff /* third byte in IPv4-translated addr prefix */ +#define MAPPED_PREFIX 0x0000ffff /* third byte in IPv4-mapped addr prefix */ + +#define IP4_IP6_HDR_DIFF 20 /* diffirence between IPv4 and IPv6 headers */ +#define IP6_FRAGMENT_SIZE 8 /* size of Fragment Header */ + +/* IPv6 header fields masks */ +#define IP6F_OFF_MASK 0xfff8 /* mask out offset from frag_off */ +#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in frag_off */ +#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */ + + + +/* + * Macros to help debugging + */ + +#undef PDEBUG /* undef it, just in case */ +#ifdef SIIT_DEBUG +# ifdef __KERNEL__ + /* This one if debugging is on, and kernel space */ +# define PDEBUG(fmt, args...) printk(KERN_DEBUG "siit: " fmt, ## args) +# else + /* This one for user space */ +# define PDEBUG(fmt, args...) fprintf(stderr, fmt, ## args) +# endif +#else +# define PDEBUG(fmt, args...) /* not debugging: nothing */ +#endif + +#undef PDEBUGG +#define PDEBUGG(fmt, args...) + + + + + + + + diff --git a/net/sipgrep/Makefile b/net/sipgrep/Makefile new file mode 100644 index 0000000..272eefe --- /dev/null +++ b/net/sipgrep/Makefile @@ -0,0 +1,47 @@ +# +# Copyright (C) 2016 Daniel Engberg +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=sipgrep +PKG_VERSION:=20160914-devel +PKG_RELEASE:=1 +PKG_MAINTAINER:=Daniel Engberg +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=COPYING + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL=https://github.com/sipcapture/sipgrep +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=df8a95b066569be92aa38cad01086ea595b36863 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/sipgrep + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpcap +libpcre +libncursesw + TITLE:=Display and Troubleshoot SIP signaling in CLI + URL:=https://github.com/sipcapture/sipgrep +endef + +define Package/sipgrep/description + SipGrep is a utility for displaying and troubleshooting SIP signaling. +endef + +CONFIGURE_ARGS += \ + --enable-ncurses + +define Package/sipgrep/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/sipgrep $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,sipgrep)) diff --git a/net/smartsnmpd/Makefile b/net/smartsnmpd/Makefile new file mode 100644 index 0000000..9be39cb --- /dev/null +++ b/net/smartsnmpd/Makefile @@ -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:=smartsnmpd +PKG_VERSION:=2014-08-13 +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/credosemi/smartsnmp.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=fb93473d895f058b2d8975d3cfa280ae2a8ae98d +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz +PKG_MIRROR_MD5SUM:= + + +PKG_MAINTAINER:=Xiongfei Guo +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=LICENSE + + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/scons.mk + +define Package/smartsnmpd + SECTION:=net + CATEGORY:=Network + DEPENDS+=+lua +liblua +libubox +libuci-lua +libubus-lua + TITLE:=Smart-SNMP (Agent) + URL:=https://github.com/credosemi/smartsnmp +endef + +define Package/smartsnmpd/description +smartsnmpd is an implementation of SNMP Agent. Its goal is "Easily +writing boring SNMP MIB with Lua". This package add native support +for OpenWrt. Include using ubus and uci to get system info/status. +And, it use libubox/uloop as low level event-driven library. +endef + +SCONS_OPTIONS += --transport=uloop + +define Build/Configure + (cd $(PKG_BUILD_DIR); \ + $(SCONS_VARS) \ + scons \ + prefix=/usr \ + $(SCONS_OPTIONS) \ + ) +endef + +define Package/smartsnmpd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/smartsnmpd $(1)/usr/sbin/smartsnmpd + + $(INSTALL_DIR) $(1)/usr/lib/lua/smartsnmp + $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/smartsnmp/core.so $(1)/usr/lib/lua/smartsnmp/core.so + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lualib/smartsnmp/*.lua $(1)/usr/lib/lua/smartsnmp/ + + $(INSTALL_DIR) $(1)/usr/lib/lua/smartsnmp/mibs + $(INSTALL_BIN) ./files/mibs/*.lua $(1)/usr/lib/lua/smartsnmp/mibs/ + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/smartsnmpd.conf $(1)/etc/config/smartsnmpd + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/smartsnmpd.init $(1)/etc/init.d/smartsnmpd +endef + +$(eval $(call BuildPackage,smartsnmpd)) + diff --git a/net/smartsnmpd/files/mibs/dummy.lua b/net/smartsnmpd/files/mibs/dummy.lua new file mode 100644 index 0000000..e49ca68 --- /dev/null +++ b/net/smartsnmpd/files/mibs/dummy.lua @@ -0,0 +1,24 @@ +-- +-- This file is part of SmartSNMP +-- Copyright (C) 2014, Credo Semiconductor Inc. +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along +-- with this program; if not, write to the Free Software Foundation, Inc., +-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +-- + +local mib = require "smartsnmp" + +local dummy = {} + +return dummy diff --git a/net/smartsnmpd/files/mibs/interfaces.lua b/net/smartsnmpd/files/mibs/interfaces.lua new file mode 100644 index 0000000..01cea6a --- /dev/null +++ b/net/smartsnmpd/files/mibs/interfaces.lua @@ -0,0 +1,125 @@ +-- +-- This file is part of SmartSNMP +-- Copyright (C) 2014, Credo Semiconductor Inc. +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along +-- with this program; if not, write to the Free Software Foundation, Inc., +-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +-- + +local mib = require "smartsnmp" +require "ubus" +require "uloop" + +uloop.init() + +local conn = ubus.connect() +if not conn then + error("Failed to connect to ubusd") +end + +local if_cache = {} +local if_status_cache = {} +local if_index_cache = {} + +local last_load_time = os.time() +local function need_to_reload() + if os.time() - last_load_time >= 3 then + last_load_time = os.time() + return true + else + return false + end +end + +local function load_config() + if need_to_reload() == true then + if_cache = {} + if_status_cache = {} + if_index_cache = {} + + -- if description + for k, v in pairs(conn:call("network.device", "status", {})) do + if_status_cache[k] = {} + end + + for name_ in pairs(if_status_cache) do + for k, v in pairs(conn:call("network.device", "status", { name = name_ })) do + if k == 'mtu' then + if_status_cache[name_].mtu = v + elseif k == 'macaddr' then + if_status_cache[name_].macaddr = v + elseif k == 'up' then + if v == true then + if_status_cache[name_].up = 1 + else + if_status_cache[name_].up = 2 + end + elseif k == 'statistics' then + for item, stat in pairs(v) do + if item == 'rx_bytes' then + if_status_cache[name_].in_octet = stat + elseif item == 'tx_bytes' then + if_status_cache[name_].out_octet = stat + elseif item == 'rx_errors' then + if_status_cache[name_].in_errors = stat + elseif item == 'tx_errors' then + if_status_cache[name_].out_errors = stat + elseif item == 'rx_dropped' then + if_status_cache[name_].in_discards = stat + elseif item == 'tx_dropped' then + if_status_cache[name_].out_discards = stat + end + end + end + end + end + + if_cache['desc'] = {} + for name, status in pairs(if_status_cache) do + table.insert(if_cache['desc'], name) + for k, v in pairs(status) do + if if_cache[k] == nil then if_cache[k] = {} end + table.insert(if_cache[k], v) + end + end + + -- if index + for i in ipairs(if_cache['desc']) do + table.insert(if_index_cache, i) + end + end +end + +mib.module_methods.or_table_reg("1.3.6.1.2.1.2", "The MIB module for managing Interfaces implementations") + +local ifGroup = { + [1] = mib.ConstInt(function () load_config() return #if_index_cache end), + [2] = { + [1] = { + [1] = mib.ConstIndex(function () load_config() return if_index_cache end), + [2] = mib.ConstString(function (i) load_config() return if_cache['desc'][i] end), + [4] = mib.ConstInt(function (i) load_config() return if_cache['mtu'][i] end), + [6] = mib.ConstString(function (i) load_config() return if_cache['macaddr'][i] end), + [8] = mib.ConstInt(function (i) load_config() return if_cache['up'][i] end), + [10] = mib.ConstCount(function (i) load_config() return if_cache['in_octet'][i] end), + [13] = mib.ConstCount(function (i) load_config() return if_cache['in_discards'][i] end), + [14] = mib.ConstCount(function (i) load_config() return if_cache['in_errors'][i] end), + [16] = mib.ConstCount(function (i) load_config() return if_cache['out_octet'][i] end), + [19] = mib.ConstCount(function (i) load_config() return if_cache['out_discards'][i] end), + [20] = mib.ConstCount(function (i) load_config() return if_cache['out_errors'][i] end), + } + } +} + +return ifGroup diff --git a/net/smartsnmpd/files/mibs/system.lua b/net/smartsnmpd/files/mibs/system.lua new file mode 100644 index 0000000..5b0a4af --- /dev/null +++ b/net/smartsnmpd/files/mibs/system.lua @@ -0,0 +1,176 @@ +-- +-- This file is part of SmartSNMP +-- Copyright (C) 2014, Credo Semiconductor Inc. +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along +-- with this program; if not, write to the Free Software Foundation, Inc., +-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +-- + +local mib = require "smartsnmp" +local uci = require "uci" + +-- System config +local context = uci.cursor("/etc/config", "/tmp/.uci") + +-- scalar index +local sysDesc = 1 +local sysObjectID = 2 +local sysUpTime = 3 +local sysContact = 4 +local sysName = 5 +local sysLocation = 6 +local sysServices = 7 +local sysORLastChange = 8 + +-- table index +local sysORTable = 9 + +-- entry index +local sysOREntry = 1 + +-- list index +local sysORIndex = 1 +local sysORID = 2 +local sysORDesc = 3 +local sysORUpTime = 4 + +local startup_time = 0 +local or_last_changed_time = 0 + +local function mib_system_startup(time) + startup_time = time + or_last_changed_time = time +end + +mib_system_startup(os.time()) + +local sysGroup = {} +local or_oid_cache = {} +local or_index_cache = {} +local or_table_cache = {} + +local or_table_reg = function (oid, desc) + local row = {} + row['oid'] = {} + for i in string.gmatch(oid, "%d") do + table.insert(row['oid'], tonumber(i)) + end + row['desc'] = desc + row['uptime'] = os.time() + table.insert(or_table_cache, row) + + or_last_changed_time = os.time() + + or_oid_cache[oid] = #or_table_cache + + or_index_cache = {} + for i in ipairs(or_table_cache) do + table.insert(or_index_cache, i) + end +end + +local or_table_unreg = function (oid) + local or_idx = or_oid_cache[oid] + + if or_table_cache[or_idx] ~= nil then + table.remove(or_table_cache, or_idx) + or_last_changed_time = os.time() + + or_index_cache = {} + for i in ipairs(or_table_cache) do + table.insert(or_index_cache, i) + end + end +end + +local last_load_time = os.time() +local function need_to_reload() + if os.difftime(os.time(), last_load_time) < 3 then + return false + else + last_load_time = os.time() + return true + end +end + +local function load_config() + if need_to_reload() == true then + context:load("smartsnmpd") + end +end + +context:load("smartsnmpd") + +local sysMethods = { + ["or_table_reg"] = or_table_reg, + ["or_table_unreg"] = or_table_unreg +} +mib.module_method_register(sysMethods) + +sysGroup = { + rocommunity = 'public', + [sysDesc] = mib.ConstString(function () load_config() return mib.sh_call("uname -a") end), + [sysObjectID] = mib.ConstOid(function () + load_config() + local oid + local objectid + context:foreach("smartsnmpd", "smartsnmpd", function (s) + objectid = s.objectid + end) + if objectid ~= nil then + oid = {} + for i in string.gmatch(objectid, "%d+") do + table.insert(oid, tonumber(i)) + end + end + return oid + end), + [sysUpTime] = mib.ConstTimeticks(function () load_config() return os.difftime(os.time(), startup_time) * 100 end), + [sysContact] = mib.ConstString(function () + load_config() + local contact + context:foreach("smartsnmpd", "smartsnmpd", function (s) + contact = s.contact + end) + return contact + end), + [sysName] = mib.ConstString(function () load_config() return mib.sh_call("uname -n") end), + [sysLocation] = mib.ConstString(function () + load_config() + local location + context:foreach("smartsnmpd", "smartsnmpd", function (s) + location = s.location + end) + return location + end), + [sysServices] = mib.ConstInt(function () + load_config() + local services + context:foreach("smartsnmpd", "smartsnmpd", function (s) + services = tonumber(s.services) + end) + return services + end), + [sysORLastChange] = mib.ConstTimeticks(function () load_config() return os.difftime(os.time(), or_last_changed_time) * 100 end), + [sysORTable] = { + [sysOREntry] = { + [sysORIndex] = mib.UnaIndex(function () load_config() return or_index_cache end), + [sysORID] = mib.ConstOid(function (i) load_config() return or_table_cache[i].oid end), + [sysORDesc] = mib.ConstString(function (i) load_config() return or_table_cache[i].desc end), + [sysORUpTime] = mib.ConstTimeticks(function (i) load_config() return os.difftime(os.time(), or_table_cache[i].uptime) * 100 end), + } + } +} + +return sysGroup diff --git a/net/smartsnmpd/files/smartsnmpd.conf b/net/smartsnmpd/files/smartsnmpd.conf new file mode 100644 index 0000000..aace5a6 --- /dev/null +++ b/net/smartsnmpd/files/smartsnmpd.conf @@ -0,0 +1,21 @@ +config smartsnmpd + option port '161' + option ro_community 'public' + option rw_community 'private' + option mib_module_path 'mibs' + option objectid '1.2.3.4' + option contact 'Me ' + option location 'Shanghai' + option services '72' + +config smartsnmpd_module + option oid "1.3.6.1.2.1.1" + option module 'system' + +config smartsnmpd_module + option oid "1.3.6.1.2.1.2" + option module 'interfaces' + +config smartsnmpd_module + option oid "1.3.6.1.1" + option module 'dummy' diff --git a/net/smartsnmpd/files/smartsnmpd.init b/net/smartsnmpd/files/smartsnmpd.init new file mode 100755 index 0000000..dbe3af8 --- /dev/null +++ b/net/smartsnmpd/files/smartsnmpd.init @@ -0,0 +1,47 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014 OpenWrt.org + +START=97 + +USE_PROCD=1 +PROG=/usr/sbin/smartsnmpd +CONFIGFILE=/etc/smartsnmpd.conf + +smartsnmpd_mib_module() { + local cfg="$1" + config_get OID "$cfg" oid + config_get MODULE "$cfg" module + echo " ['$OID'] = '$MODULE'," >> $CONFIGFILE +} + +start_service() { + include /lib/functions + + config_load smartsnmpd + + procd_open_instance + procd_set_param command $PROG -c $CONFIGFILE + procd_set_param file $CONFIGFILE + procd_set_param respawn + procd_close_instance + + # before we can call xappend + mkdir -p $(dirname $CONFIGFILE) + + echo "-- auto-generated config file from /etc/config/smartsnmpd" > $CONFIGFILE + + config_get PORT smartsnmpd port 161 + echo "port = $PORT" >> $CONFIGFILE + + config_get RO_COMMUNITY smartsnmpd ro_community 'public' + config_get RW_COMMUNITY smartsnmpd rw_community 'private' + echo "ro_community = '$RO_COMMUNITY'" >> $CONFIGFILE + echo "rw_community = '$RW_COMMUNITY'" >> $CONFIGFILE + + config_get MIB_MODULE_PATH smartsnmpd mib_module_path '/usr/lib/lua/smartsnmp/mibs/' + echo "mib_module_path = '$MIB_MODULE_PATH'" >> $CONFIGFILE + + echo "mib_modules = {" >> $CONFIGFILE + config_foreach smartsnmpd_mib_module smartsnmpd_module + echo "}" >> $CONFIGFILE +} diff --git a/net/sngrep/Makefile b/net/sngrep/Makefile new file mode 100644 index 0000000..06a6834 --- /dev/null +++ b/net/sngrep/Makefile @@ -0,0 +1,50 @@ +# +# Copyright (C) 2016 Daniel Engberg +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=sngrep +PKG_VERSION=1.4.1 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Daniel Engberg +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=COPYING + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL=https://github.com/irontec/sngrep +PKG_SOURCE_SUBDIR=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=57baa4b16d0021cf0a70889c15aee708db378fed +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_MIRROR_MD5SUM:=5b2cb01d34fcc6d631f8f6efe01ec556fe1325aa300590bec5aa6a078486f9c3 + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/sngrep + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpcap +libpthread +libpcre +libncursesw + TITLE:=Display SIP calls message flows + URL:=https://github.com/irontec/sngrep +endef + +define Package/sngrep/description + sngrep is a tool for displaying SIP calls message flows from terminal. + It supports live capture to display realtime SIP packets and can also be used as PCAP viewer. +endef + +CONFIGURE_ARGS += \ + --with-pcre \ + --enable-unicode \ + +define Package/sngrep/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/sngrep $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,sngrep)) diff --git a/net/snort/Config.in b/net/snort/Config.in new file mode 100644 index 0000000..a79e51d --- /dev/null +++ b/net/snort/Config.in @@ -0,0 +1,11 @@ +menu "Configuration" + depends on PACKAGE_snort + +config SNORT_LZMA + bool "Enable LZMA support" + default n + help + This option enables LZMA decompression. + Disabled by default. + +endmenu diff --git a/net/snort/Makefile b/net/snort/Makefile new file mode 100644 index 0000000..d37829e --- /dev/null +++ b/net/snort/Makefile @@ -0,0 +1,156 @@ +# +# Copyright (C) 2006-2015 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:=snort +PKG_VERSION:=2.9.7.2 +PKG_RELEASE:=4 + +PKG_LICENSE:=GPL-2.0 +PKG_MAINTAINER:=Luka Perkov + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://www.snort.org/downloads/snort/ \ + @SF/$(PKG_NAME) +PKG_MD5SUM:=b01e9964827394c39194a0147bc15705 + +PKG_BUILD_DEPENDS:=librpc +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION) +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/snort + SUBMENU:=Firewall + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libdaq +libdnet +libopenssl +libpcap +libpcre +libpthread +libuuid +zlib +SNORT_LZMA:liblzma + TITLE:=Lightweight Network Intrusion Detection System + URL:=http://www.snort.org/ + MENU:=1 +endef + +define Package/snort/description + Snort is an open source network intrusion detection and prevention system. + It is capable of performing real-time traffic analysis, alerting, blocking + and packet logging on IP networks. It utilizes a combination of protocol + analysis and pattern matching in order to detect anomalies, misuse and + attacks. +endef + +define Package/snort/config + source "$(SOURCE)/Config.in" +endef + +CONFIGURE_ARGS += \ + --prefix="/usr" \ + --enable-flexresp \ + --with-dnet-includes="$(STAGING_DIR)/usr/include" \ + --with-dnet-libraries="$(STAGING_DIR)/usr/lib" \ + --with-libpcap-includes="$(STAGING_DIR)/usr/include" \ + --with-libpcap-libraries="$(STAGING_DIR)/usr/lib" \ + --with-libpcre-includes="$(STAGING_DIR)/usr/include" \ + --with-libpcre-libraries="$(STAGING_DIR)/usr/lib" \ + --with-daq-includes="$(STAGING_DIR)/usr/include" \ + --with-daq-libraries="$(STAGING_DIR)/usr/lib" \ + --disable-static-daq + +ifeq ($(CONFIG_SNORT_LZMA),) +CONFIGURE_ARGS += \ + --disable-lzma +endif + +CONFIGURE_VARS += \ + PATH="$(STAGING_DIR)/usr/lib/libnet-1.0.x/bin:$$$$PATH" + +MAKE_FLAGS += \ + extra_incl="" + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR)/usr/include/snort/dynamic_preproc + $(CP) \ + $(PKG_INSTALL_DIR)/usr/include/snort/dynamic_preproc/* \ + $(STAGING_DIR)/usr/include/snort/dynamic_preproc/ + $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort/dynamic_preproc + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/snort/dynamic_preproc/* \ + $(STAGING_DIR)/usr/lib/snort/dynamic_preproc/ + $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort_dynamicengine + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicengine/* \ + $(STAGING_DIR)/usr/lib/snort_dynamicengine/ + $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort_dynamicpreprocessor + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicpreprocessor/* \ + $(STAGING_DIR)/usr/lib/snort_dynamicpreprocessor/ +endef + +define Package/snort/conffiles +/etc/config/snort +/etc/snort/snort.conf +endef + +define Package/snort/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/snort \ + $(1)/usr/bin/snort + + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/u2{boat,spewfoo} \ + $(1)/usr/bin + + $(INSTALL_DIR) $(1)/usr/lib/snort_dynamicengine + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicengine/libsf_engine.so* \ + $(1)/usr/lib/snort_dynamicengine/ + + $(INSTALL_DIR) $(1)/usr/lib/snort_dynamicpreprocessor + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicpreprocessor/libsf*.so* \ + $(1)/usr/lib/snort_dynamicpreprocessor/ + + $(INSTALL_DIR) $(1)/etc/snort + $(INSTALL_CONF) \ + $(PKG_BUILD_DIR)/etc/snort.conf \ + $(1)/etc/snort/ + $(INSTALL_CONF) \ + $(PKG_BUILD_DIR)/etc/attribute_table.dtd \ + $(1)/etc/snort/ + $(INSTALL_CONF) \ + $(PKG_BUILD_DIR)/etc/classification.config \ + $(1)/etc/snort/ + $(INSTALL_CONF) \ + $(PKG_BUILD_DIR)/etc/gen-msg.map \ + $(1)/etc/snort/ + $(INSTALL_CONF) \ + $(PKG_BUILD_DIR)/etc/reference.config \ + $(1)/etc/snort/ + $(INSTALL_CONF) \ + $(PKG_BUILD_DIR)/etc/unicode.map \ + $(1)/etc/snort/ + + $(INSTALL_DIR) $(1)/etc/snort/preproc_rules + $(INSTALL_CONF) \ + $(PKG_BUILD_DIR)/preproc_rules/*.rules \ + $(1)/etc/snort/preproc_rules/ + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) \ + ./files/snort.init \ + $(1)/etc/init.d/snort + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) \ + ./files/snort.config \ + $(1)/etc/config/snort +endef + +$(eval $(call BuildPackage,snort)) + diff --git a/net/snort/files/snort.config b/net/snort/files/snort.config new file mode 100644 index 0000000..cda7441 --- /dev/null +++ b/net/snort/files/snort.config @@ -0,0 +1,3 @@ +config snort 'snort' + option config_file '/etc/snort/snort.conf' + option interface 'lo' diff --git a/net/snort/files/snort.init b/net/snort/files/snort.init new file mode 100644 index 0000000..fcdb090 --- /dev/null +++ b/net/snort/files/snort.init @@ -0,0 +1,40 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 OpenWrt.org + +START=90 +STOP=10 + +USE_PROCD=1 +PROG=/usr/bin/snort + +validate_snort_section() { + uci_validate_section snort snort "${1}" \ + 'config_file:string' \ + 'interface:string' +} + +start_service() { + local config_file interface + + validate_snort_section snort || { + echo "validation failed" + return 1 + } + + procd_open_instance + procd_set_param command $PROG "-q" "--daq-dir" "/usr/lib/daq/" "-i" "$interface" "-s" "-N" + procd_set_param file $CONFIGFILE + procd_set_param respawn + procd_close_instance +} + +stop_service() +{ + service_stop ${PROG} +} + +service_triggers() +{ + procd_add_reload_trigger "snort" + procd_add_validation validate_snort_section +} diff --git a/net/snort/patches/001-compile.patch b/net/snort/patches/001-compile.patch new file mode 100644 index 0000000..06d283a --- /dev/null +++ b/net/snort/patches/001-compile.patch @@ -0,0 +1,105 @@ +--- /dev/null ++++ b/acinclude.m4 +@@ -0,0 +1 @@ ++sinclude(m4/libprelude.m4) +--- a/configure.in ++++ b/configure.in +@@ -285,21 +285,7 @@ AC_CHECK_TYPES([int8_t,int16_t,int32_t,i + AC_CHECK_TYPES([boolean]) + + # In case INADDR_NONE is not defined (like on Solaris) +-have_inaddr_none="no" +-AC_MSG_CHECKING([for INADDR_NONE]) +-AC_RUN_IFELSE( +-[AC_LANG_PROGRAM( +-[[ +-#include +-#include +-#include +-]], +-[[ +- if (inet_addr("10,5,2") == INADDR_NONE); +- return 0; +-]])], +-[have_inaddr_none="yes"], +-[have_inaddr_none="no"]) ++have_inaddr_none="yes" + AC_MSG_RESULT($have_inaddr_none) + if test "x$have_inaddr_none" = "xno"; then + AC_DEFINE([INADDR_NONE],[-1],[For INADDR_NONE definition]) +@@ -433,16 +419,7 @@ if test "x$LPCAP" = "xno"; then + fi + + AC_MSG_CHECKING([for pcap_lex_destroy]) +-AC_RUN_IFELSE( +-[AC_LANG_PROGRAM( +-[[ +-#include +-]], +-[[ +- pcap_lex_destroy(); +-]])], +-[have_pcap_lex_destroy="yes"], +-[have_pcap_lex_destroy="no"]) ++have_pcap_lex_destroy="yes" + AC_MSG_RESULT($have_pcap_lex_destroy) + if test "x$have_pcap_lex_destroy" = "xyes"; then + AC_DEFINE([HAVE_PCAP_LEX_DESTROY],[1],[Can cleanup lex buffer stack created by pcap bpf filter]) +@@ -727,54 +704,21 @@ if test "x$ac_cv_func_daq_dp_add_dc" = " + + fi + +-AC_MSG_CHECKING([for daq address space ID]) +-AC_RUN_IFELSE( +-[AC_LANG_PROGRAM( +-[[ +-#include +-]], +-[[ +- DAQ_PktHdr_t hdr; +- hdr.address_space_id = 0; +-]])], +-[have_daq_address_space_id="yes"], +-[have_daq_address_space_id="no"]) ++have_daq_address_space_id="yes" + AC_MSG_RESULT($have_daq_address_space_id) + if test "x$have_daq_address_space_id" = "xyes"; then + AC_DEFINE([HAVE_DAQ_ADDRESS_SPACE_ID],[1], + [DAQ version supports address space ID in header.]) + fi + +-AC_MSG_CHECKING([for daq flow ID]) +-AC_RUN_IFELSE( +-[AC_LANG_PROGRAM( +-[[ +-#include +-]], +-[[ +- DAQ_PktHdr_t hdr; +- hdr.flow_id = 0; +-]])], +-[have_daq_flow_id="yes"], +-[have_daq_flow_id="no"]) ++have_daq_flow_id="yes" + AC_MSG_RESULT($have_daq_flow_id) + if test "x$have_daq_flow_id" = "xyes"; then + AC_DEFINE([HAVE_DAQ_FLOW_ID],[1], + [DAQ version supports flow ID in header.]) + fi + +-AC_MSG_CHECKING([for DAQ_VERDICT_RETRY]) +-AC_RUN_IFELSE( +-[AC_LANG_PROGRAM( +-[[ +-#include +-]], +-[[ +- DAQ_Verdict verdict; +- verdict = DAQ_VERDICT_RETRY; +-]])], +-[have_daq_verdict_retry="yes"], +-[have_daq_verdict_retry="no"]) ++have_daq_verdict_retry="yes" + AC_MSG_RESULT($have_daq_verdict_retry) + if test "x$have_daq_verdict_retry" = "xyes"; then + AC_DEFINE([HAVE_DAQ_VERDICT_RETRY],[1], diff --git a/net/snort/patches/100-autoconf-fixes.patch b/net/snort/patches/100-autoconf-fixes.patch new file mode 100644 index 0000000..414c0c1 --- /dev/null +++ b/net/snort/patches/100-autoconf-fixes.patch @@ -0,0 +1,17 @@ +--- a/configure.in ++++ b/configure.in +@@ -11,14 +11,6 @@ AM_INIT_AUTOMAKE(snort,2.9.7.2) + NO_OPTIMIZE="no" + ADD_WERROR="no" + +-# Test for -Werror and sed it out for now since some of the auto tests, +-# for example AC_CHECK_LIB, will fail because of +-# warning: conflicting types for built-in function +-if eval "echo $CFLAGS | grep -e -Werror"; then +- CFLAGS=`echo $CFLAGS | sed -e "s/-Werror//g"` +- ADD_WERROR="yes" +-fi +- + # Disable annoying practice of recursively re-running the autotools + AM_MAINTAINER_MODE + AC_PROG_CC_STDC diff --git a/net/socat/Makefile b/net/socat/Makefile new file mode 100644 index 0000000..b89ffca --- /dev/null +++ b/net/socat/Makefile @@ -0,0 +1,81 @@ +# +# Copyright (C) 2006-2015 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:=socat +PKG_VERSION:=1.7.3.0 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://www.dest-unreach.org/socat/download +PKG_MD5SUM:=b607edb65bc6c57f4a43f06247504274 + +PKG_MAINTAINER:= Ted Hess + +PKG_LICENSE:=GPL-2.0 OpenSSL +PKG_LICENSE_FILES:=COPYING COPYING.OpenSSL + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/socat + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpthread +librt +SOCAT_SSL:libopenssl + TITLE:=A multipurpose relay (SOcket CAT) + URL:=http://www.dest-unreach.org/socat/ +endef + +define Package/socat/description + SoCat (for SOcket CAT) establishes two bidirectional byte streams and + transfers data between them. + Data channels may be files, pipes, devices (terminal or modem, etc.), or + sockets (Unix, IPv4, IPv6, raw, UDP, TCP, SSL). It provides forking, + logging and tracing, different modes for interprocess communication and + many more options. +endef + +define Package/socat/config +config SOCAT_SSL + bool "SSL support" + depends on PACKAGE_socat + default n + help + Implements SSL support in socat (using libopenssl). +endef + +define Package/socat/conffiles +/etc/config/socat +endef + +CONFIGURE_ARGS += \ + --disable-libwrap \ + --disable-readline \ + --enable-termios + +ifneq ($(CONFIG_SOCAT_SSL),y) + CONFIGURE_ARGS+= --disable-openssl +endif + +CONFIGURE_VARS += \ + sc_cv_termios_ispeed="no" \ + sc_cv_sys_crdly_shift=9 \ + sc_cv_sys_tabdly_shift=11 \ + sc_cv_sys_csize_shift=4 + +define Package/socat/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/socat $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/socat.config $(1)/etc/config/socat + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/socat.init $(1)/etc/init.d/socat +endef + +$(eval $(call BuildPackage,socat)) diff --git a/net/socat/files/socat.config b/net/socat/files/socat.config new file mode 100644 index 0000000..7df6358 --- /dev/null +++ b/net/socat/files/socat.config @@ -0,0 +1,5 @@ +# forward port 8000 on IPv6 to IPv4 host port 80 +# change enable to '1' to use this example +config socat 'http' + option enable '0' + option SocatOptions '-d -d TCP6-LISTEN:8000,fork TCP4:192.168.1.20:80' diff --git a/net/socat/files/socat.init b/net/socat/files/socat.init new file mode 100644 index 0000000..379dc07 --- /dev/null +++ b/net/socat/files/socat.init @@ -0,0 +1,39 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008-2014 OpenWrt.org + +START=99 +STOP=99 + +USE_PROCD=1 +PROG=/usr/bin/socat +NAME=socat + +validate_section_socat() +{ + uci_validate_section socat socat "${1}" \ + 'enable:bool:1' \ + 'SocatOptions:string' + return $? +} + +socat_instance() +{ + local SocatOptions enable + + validate_section_socat "${1}" || { + echo "validation failed" + return 1 + } + + [ "${enable}" = "0" ] && return 1 + + procd_open_instance + procd_set_param command "$PROG" + procd_append_param command ${SocatOptions} + procd_close_instance +} + +start_service () { + config_load "${NAME}" + config_foreach socat_instance socat +} diff --git a/net/socat/patches/100-musl-compat.patch b/net/socat/patches/100-musl-compat.patch new file mode 100644 index 0000000..ae5c8d0 --- /dev/null +++ b/net/socat/patches/100-musl-compat.patch @@ -0,0 +1,23 @@ +--- a/sysincludes.h ++++ b/sysincludes.h +@@ -79,6 +79,9 @@ + #endif + #if HAVE_NETDB_H && (_WITH_IP4 || _WITH_IP6) + #include /* struct hostent, gethostbyname() */ ++#if !(__UCLIBC__ || __GLIBC__) ++#define NETDB_INTERNAL -1 ++#endif + #endif + #if HAVE_SYS_UN_H && WITH_UNIX + #include /* struct sockaddr_un, unix domain sockets */ +@@ -139,8 +142,10 @@ + #include + #endif + #if HAVE_NETINET_IF_ETHER_H ++#if defined(__UCLIBC__) || defined(__GLIBC__) + #include + #endif ++#endif + #if HAVE_LINUX_IF_TUN_H + #include + #endif diff --git a/net/softflowd/Makefile b/net/softflowd/Makefile new file mode 100644 index 0000000..aa45787 --- /dev/null +++ b/net/softflowd/Makefile @@ -0,0 +1,54 @@ +# +# Copyright (C) 2007-2011 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:=softflowd +PKG_VERSION:=0.9.9 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://softflowd.googlecode.com/files/ +PKG_MD5SUM:=ba83e2715e6250e6645ebcaa9ae1009d +PKG_MAINTAINER:=Ross Vandegrift +PKG_LICENSE:=BSD-3-Clause + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/softflowd + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpcap + TITLE:=softflowd + URL:=http://code.google.com/p/softflowd/ +endef + +define Package/softflowd/description + Software netflow exporter +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" softflowd softflowctl +endef + +define Package/softflowd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/softflowd $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/softflowctl $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME) + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME) +endef + +define Package/softflowd/conffiles +/etc/config/softflowd +endef + +$(eval $(call BuildPackage,softflowd)) diff --git a/net/softflowd/files/softflowd.config b/net/softflowd/files/softflowd.config new file mode 100644 index 0000000..61a2ee4 --- /dev/null +++ b/net/softflowd/files/softflowd.config @@ -0,0 +1,14 @@ +config softflowd + option enabled '0' + option interface 'br-lan' + option pcap_file '' + option timeout '' + option max_flows '8192' + option host_port '' + option pid_file '/var/run/softflowd.pid' + option control_socket '/var/run/softflowd.ctl' + option export_version '5' + option hoplimit '' + option tracking_level 'full' + option track_ipv6 '0' + option sampling_rate '100' diff --git a/net/softflowd/files/softflowd.init b/net/softflowd/files/softflowd.init new file mode 100755 index 0000000..98b4e34 --- /dev/null +++ b/net/softflowd/files/softflowd.init @@ -0,0 +1,58 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2007-2011 OpenWrt.org + +USE_PROCD=1 +START=50 + +append_bool() { + local section="$1" + local option="$2" + local value="$3" + local _val + config_get_bool _val "$section" "$option" '0' + [ "$_val" -gt 0 ] && append args "$3" +} + +append_string() { + local section="$1" + local option="$2" + local value="$3" + local _val + config_get _val "$section" "$option" + [ -n "$_val" ] && append args "$3 $_val" +} + +start_instance() { + local section="$1" + + config_get_bool enabled "$section" 'enabled' '0' + [ $enabled -gt 0 ] || return 1 + + config_get pid_file "$section" 'pid_file' + + args="" + append_string "$section" 'interface' '-i' + append_string "$section" 'pcap_file' '-r' + append_string "$section" 'timeout' '-t' + append_string "$section" 'max_flows' '-m' + append_string "$section" 'host_port' '-n' + append_string "$section" 'pid_file' '-p' + append_string "$section" 'control_socket' '-c' + append_string "$section" 'export_version' '-v' + append_string "$section" 'hoplimit' '-L' + append_string "$section" 'tracking_level' '-T' + append_string "$section" 'sampling_rate' '-s' + append_bool "$section" track_ipv6 '-6' + + procd_open_instance + procd_set_param command /usr/sbin/softflowd -d $args${pid_file:+ -p $pid_file} + procd_set_param respawn + procd_close_instance +} + +start_service() { + mkdir -m 0755 -p /var/empty + + config_load 'softflowd' + config_foreach start_instance 'softflowd' +} diff --git a/net/spawn-fcgi/Makefile b/net/spawn-fcgi/Makefile new file mode 100644 index 0000000..54c9ab7 --- /dev/null +++ b/net/spawn-fcgi/Makefile @@ -0,0 +1,42 @@ +# +# Copyright (C) 2006-2015 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:=spawn-fcgi +PKG_VERSION:=1.6.4 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=http://download.lighttpd.net/spawn-fcgi/releases-1.6.x/ +PKG_MD5SUM:=a67c098a50cd625fd12adf61b5dd4c32 + +PKG_LICENSE:=BSD-3c +PKG_LICENSE_FILES:=COPYING + +PKG_MAINTAINER:=Daniel Golle + +include $(INCLUDE_DIR)/package.mk + +define Package/spawn-fcgi + SUBMENU:=Web Servers/Proxies + SECTION:=net + CATEGORY:=Network + TITLE:=Tool to spawn fastcgi applications + URL:=http://redmine.lighttpd.net/projects/spawn-fcgi +endef + +define Package/spawn-fcgi/description + spawn-fcgi is used to spawn fastcgi applications +endef + +define Package/spawn-fcgi/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/spawn-fcgi $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,spawn-fcgi)) diff --git a/net/sqm-scripts-extra/Makefile b/net/sqm-scripts-extra/Makefile new file mode 100644 index 0000000..28e6ccb --- /dev/null +++ b/net/sqm-scripts-extra/Makefile @@ -0,0 +1,47 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=sqm-scripts-extra +PKG_VERSION:=2016-06-08 +PKG_RELEASE:=1 +PKG_LICENSE:=GPLv2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE).tar.xz +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE) + +include $(INCLUDE_DIR)/package.mk + +define Package/sqm-scripts-extra + SECTION:=net + CATEGORY:=Base system + DEPENDS:=+sqm-scripts + TITLE:=SQM Scripts - additional experimental scripts for testing + PKGARCH:=all + MAINTAINER:=Kevin Darbyshire-Bryant , \ + Sebastian Moeller +endef + +define Package/sqm-scripts-extra/description + A set of experimental scripts for sqm-scripts QoS package. The contents of this package may + change as new qdiscs like 'cake' are developed and tested. +endef + +define Package/sqm-scripts-extra/download +endef + +define Build/Prepare +endef + +define Build/Compile +endef + +define Package/sqm-scripts-extra/install + $(INSTALL_DIR) $(1)/usr/lib/sqm + $(INSTALL_DATA) ./src/* $(1)/usr/lib/sqm/ +endef + +$(eval $(call BuildPackage,sqm-scripts-extra)) + diff --git a/net/sqm-scripts-extra/src/test_LAN_dual-isolate__piece_of_cake.qos b/net/sqm-scripts-extra/src/test_LAN_dual-isolate__piece_of_cake.qos new file mode 100644 index 0000000..4f1380d --- /dev/null +++ b/net/sqm-scripts-extra/src/test_LAN_dual-isolate__piece_of_cake.qos @@ -0,0 +1,102 @@ +#!/bin/sh +################################################################################ +# test_LAN_triple-isolate__piece_of_cake.qos (Cero3 Shaper) +# +# Abstract: +# This is a one band cake and ipv6 enabled shaping script for Ethernet +# gateways. This exists for the purpose of testing cake's different isolation +# options, specifically the non-directional triple-isolate feature that promises +# to finally tackle the bit-torrent hole in simple.qos. +# This specific version is supposed to be used on LAN interfaces: +# the script's ingress direction equals the internet/WAN upload direction +# the script's egress direction equals the internet/WAN download direction +# +# NOTE: Shaping on a LAN interface only affects machines connected via that +# LAN interface, so typically WIFI/WLAN traffic will not be shaped! +# +################################################################################ +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# Copyright (C) 2012-2016 +# Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller +# +################################################################################ + +. ${SQM_LIB_DIR}/defaults.sh + +################################################################################ + + +# this will only work with cake as qdisc... +QDISC=cake + + +# to keep this as simple as possible we ignore the *_CAKE_OPTS from defaults.sh +INGRESS_CAKE_OPTS="besteffort dual-srchost" +EGRESS_CAKE_OPTS="besteffort dual-dsthost" + + +egress() { + sqm_debug "egress" + $TC qdisc del dev $IFACE root 2>/dev/null + $TC qdisc add dev $IFACE root $( get_stab_string ) cake bandwidth ${UPLINK}kbit $( get_cake_lla_string ) ${EGRESS_CAKE_OPTS} ${EQDISC_OPTS} +} + + +ingress() { + sqm_debug "ingress" + $TC qdisc del dev $IFACE handle ffff: ingress 2>/dev/null + $TC qdisc add dev $IFACE handle ffff: ingress + $TC qdisc del dev $DEV root 2>/dev/null + $TC qdisc add dev $DEV root $( get_stab_string ) cake bandwidth ${DOWNLINK}kbit $( get_cake_lla_string ) ${INGRESS_CAKE_OPTS} ${IQDISC_OPTS} + + $IP link set dev $DEV up + + # redirect all IP packets arriving in $IFACE to ifb0 + + $TC filter add dev $IFACE parent ffff: protocol all prio 10 u32 \ + match u32 0 0 flowid 1:1 action mirred egress redirect dev $DEV +} + +sqm_start() { + + #sm: flip upload and download bandwith so that the GUI values reflect directionality in regard to the ISP + #sm: NOTE this is ugly and should be performed in defaults.sh or functions.sh if at all + #sm: but for quick and dirty testing this should do + local ORIG_UPLINK=${UPLINK} + local ORIG_DOWNLINK=${DOWNLINK} + UPLINK=${ORIG_DOWNLINK} + DOWNLINK=${ORIG_UPLINK} + + + [ -n "$IFACE" ] || return 1 + do_modules + verify_qdisc $QDISC "cake" || return 1 + sqm_debug "Starting ${SCRIPT}" + + [ -z "$DEV" ] && DEV=$( get_ifb_for_if ${IFACE} ) + + + if [ "${UPLINK}" -ne 0 ]; + then + egress + sqm_debug "egress shaping activated" + else + sqm_debug "egress shaping deactivated" + $TC qdisc del dev ${IFACE} root 2> /dev/null + fi + if [ "${DOWNLINK}" -ne 0 ]; + then + verify_qdisc ingress "ingress" || return 1 + ingress + sqm_debug "ingress shaping activated" + else + sqm_debug "ingress shaping deactivated" + $TC qdisc del dev ${DEV} root 2> /dev/null + $TC qdisc del dev ${IFACE} ingress 2> /dev/null + fi + return 0 +} diff --git a/net/sqm-scripts-extra/src/test_LAN_dual-isolate__piece_of_cake.qos.help b/net/sqm-scripts-extra/src/test_LAN_dual-isolate__piece_of_cake.qos.help new file mode 100644 index 0000000..616b5e4 --- /dev/null +++ b/net/sqm-scripts-extra/src/test_LAN_dual-isolate__piece_of_cake.qos.help @@ -0,0 +1,12 @@ +test_LAN_dual-isolate__piece_of_cake.qos (Cero3 Shaper) + +Abstract: +This is a one band cake and ipv6 enabled shaping script for Ethernet gateways. +This exists for the purpose of testing cake's different isolation options, +specifically the non-directional dual-[src|dst]host feature that promises to finally +tackle the bit-torrent hole in simple.qos. +This specific version is supposed to be used on LAN interfaces: + the script's ingress direction equals the internet/WAN upload direction + the script's egress direction equals the internet/WAN download direction +NOTE: Shaping on a LAN interface only affects machines connected via that +LAN interface, so typically WIFI/WLAN traffic will not be shaped! diff --git a/net/sqm-scripts-extra/src/test_LAN_triple-isolate__piece_of_cake.qos b/net/sqm-scripts-extra/src/test_LAN_triple-isolate__piece_of_cake.qos new file mode 100644 index 0000000..761b27d --- /dev/null +++ b/net/sqm-scripts-extra/src/test_LAN_triple-isolate__piece_of_cake.qos @@ -0,0 +1,102 @@ +#!/bin/sh +################################################################################ +# test_LAN_triple-isolate__piece_of_cake.qos (Cero3 Shaper) +# +# Abstract: +# This is a one band cake and ipv6 enabled shaping script for Ethernet +# gateways. This exists for the purpose of testing cake's different isolation +# options, specifically the non-directional triple-isolate feature that promises +# to finally tackle the bit-torrent hole in simple.qos. +# This specific version is supposed to be used on LAN interfaces: +# the script's ingress direction equals the internet/WAN upload direction +# the script's egress direction equals the internet/WAN download direction +# +# NOTE: Shaping on a LAN interface only affects machines connected via that +# LAN interface, so typically WIFI/WLAN traffic will not be shaped! +# +################################################################################ +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# Copyright (C) 2012-2016 +# Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller +# +################################################################################ + +. ${SQM_LIB_DIR}/defaults.sh + +################################################################################ + + +# this will only work with cake as qdisc... +QDISC=cake + + +# to keep this as simple as possible we ignore the *_CAKE_OPTS from defaults.sh +INGRESS_CAKE_OPTS="besteffort triple-isolate" +EGRESS_CAKE_OPTS="besteffort triple-isolate" + + +egress() { + sqm_debug "egress" + $TC qdisc del dev $IFACE root 2>/dev/null + $TC qdisc add dev $IFACE root $( get_stab_string ) cake bandwidth ${UPLINK}kbit $( get_cake_lla_string ) ${EGRESS_CAKE_OPTS} ${EQDISC_OPTS} +} + + +ingress() { + sqm_debug "ingress" + $TC qdisc del dev $IFACE handle ffff: ingress 2>/dev/null + $TC qdisc add dev $IFACE handle ffff: ingress + $TC qdisc del dev $DEV root 2>/dev/null + $TC qdisc add dev $DEV root $( get_stab_string ) cake bandwidth ${DOWNLINK}kbit $( get_cake_lla_string ) ${INGRESS_CAKE_OPTS} ${IQDISC_OPTS} + + $IP link set dev $DEV up + + # redirect all IP packets arriving in $IFACE to ifb0 + + $TC filter add dev $IFACE parent ffff: protocol all prio 10 u32 \ + match u32 0 0 flowid 1:1 action mirred egress redirect dev $DEV +} + +sqm_start() { + + #sm: flip upload and download bandwith so that the GUI values reflect directionality in regard to the ISP + #sm: NOTE this is ugly and should be performed in defaults.sh or functions.sh if at all + #sm: but for quick and dirty testing this should do + local ORIG_UPLINK=${UPLINK} + local ORIG_DOWNLINK=${DOWNLINK} + UPLINK=${ORIG_DOWNLINK} + DOWNLINK=${ORIG_UPLINK} + + + [ -n "$IFACE" ] || return 1 + do_modules + verify_qdisc $QDISC "cake" || return 1 + sqm_debug "Starting ${SCRIPT}" + + [ -z "$DEV" ] && DEV=$( get_ifb_for_if ${IFACE} ) + + + if [ "${UPLINK}" -ne 0 ]; + then + egress + sqm_debug "egress shaping activated" + else + sqm_debug "egress shaping deactivated" + $TC qdisc del dev ${IFACE} root 2> /dev/null + fi + if [ "${DOWNLINK}" -ne 0 ]; + then + verify_qdisc ingress "ingress" || return 1 + ingress + sqm_debug "ingress shaping activated" + else + sqm_debug "ingress shaping deactivated" + $TC qdisc del dev ${DEV} root 2> /dev/null + $TC qdisc del dev ${IFACE} ingress 2> /dev/null + fi + return 0 +} diff --git a/net/sqm-scripts-extra/src/test_LAN_triple-isolate__piece_of_cake.qos.help b/net/sqm-scripts-extra/src/test_LAN_triple-isolate__piece_of_cake.qos.help new file mode 100644 index 0000000..a3501dc --- /dev/null +++ b/net/sqm-scripts-extra/src/test_LAN_triple-isolate__piece_of_cake.qos.help @@ -0,0 +1,12 @@ +test_LAN_triple-isolate__piece_of_cake.qos (Cero3 Shaper) + +Abstract: +This is a one band cake and ipv6 enabled shaping script for Ethernet gateways. +This exists for the purpose of testing cake's different isolation options, +specifically the non-directional triple-isolate feature that promises to finally +tackle the bit-torrent hole in simple.qos. +This specific version is supposed to be used on LAN interfaces: + the script's ingress direction equals the internet/WAN upload direction + the script's egress direction equals the internet/WAN download direction +NOTE: Shaping on a LAN interface only affects machines connected via that +LAN interface, so typically WIFI/WLAN traffic will not be shaped! diff --git a/net/sqm-scripts-extra/src/test_WAN_dual-isolate__piece_of_cake.qos b/net/sqm-scripts-extra/src/test_WAN_dual-isolate__piece_of_cake.qos new file mode 100644 index 0000000..87eaebf --- /dev/null +++ b/net/sqm-scripts-extra/src/test_WAN_dual-isolate__piece_of_cake.qos @@ -0,0 +1,89 @@ +#!/bin/sh +################################################################################ +# test_WAN_dual-isolate__piece_of_cake.qos (Cero3 Shaper) +# +# Abstract: +# This is a one band cake and ipv6 enabled shaping script for Ethernet +# gateways. This exists for the purpose of testing cake's different isolation +# options, specifically the directional dual-[src|dst]host feature that promises +# to finally tackle the bit-torrent hole in simple.qos. +# This specific version is supposed to be used on WAN interfaces: +# the script's ingress direction equals the internet/WAN download direction +# the script's egress direction equals the internet/WAN upload direction +# +################################################################################ +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# Copyright (C) 2012-2016 +# Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller +# +################################################################################ + +. ${SQM_LIB_DIR}/defaults.sh + +################################################################################ + + +# this will only work with cake as qdisc... +QDISC=cake + + +# to keep this as simple as possible we ignore the *_CAKE_OPTS from defaults.sh +INGRESS_CAKE_OPTS="besteffort dual-dsthost" +EGRESS_CAKE_OPTS="besteffort dual-srchost" + + +egress() { + sqm_debug "egress" + $TC qdisc del dev $IFACE root 2>/dev/null + $TC qdisc add dev $IFACE root $( get_stab_string ) cake bandwidth ${UPLINK}kbit $( get_cake_lla_string ) ${EGRESS_CAKE_OPTS} ${EQDISC_OPTS} +} + + +ingress() { + sqm_debug "ingress" + $TC qdisc del dev $IFACE handle ffff: ingress 2>/dev/null + $TC qdisc add dev $IFACE handle ffff: ingress + $TC qdisc del dev $DEV root 2>/dev/null + $TC qdisc add dev $DEV root $( get_stab_string ) cake bandwidth ${DOWNLINK}kbit $( get_cake_lla_string ) ${INGRESS_CAKE_OPTS} ${IQDISC_OPTS} + + $IP link set dev $DEV up + + # redirect all IP packets arriving in $IFACE to ifb0 + + $TC filter add dev $IFACE parent ffff: protocol all prio 10 u32 \ + match u32 0 0 flowid 1:1 action mirred egress redirect dev $DEV +} + +sqm_start() { + [ -n "$IFACE" ] || return 1 + do_modules + verify_qdisc $QDISC "cake" || return 1 + sqm_debug "Starting ${SCRIPT}" + + [ -z "$DEV" ] && DEV=$( get_ifb_for_if ${IFACE} ) + + + if [ "${UPLINK}" -ne 0 ]; + then + egress + sqm_debug "egress shaping activated" + else + sqm_debug "egress shaping deactivated" + $TC qdisc del dev ${IFACE} root 2> /dev/null + fi + if [ "${DOWNLINK}" -ne 0 ]; + then + verify_qdisc ingress "ingress" || return 1 + ingress + sqm_debug "ingress shaping activated" + else + sqm_debug "ingress shaping deactivated" + $TC qdisc del dev ${DEV} root 2> /dev/null + $TC qdisc del dev ${IFACE} ingress 2> /dev/null + fi + return 0 +} diff --git a/net/sqm-scripts-extra/src/test_WAN_dual-isolate__piece_of_cake.qos.help b/net/sqm-scripts-extra/src/test_WAN_dual-isolate__piece_of_cake.qos.help new file mode 100644 index 0000000..c239917 --- /dev/null +++ b/net/sqm-scripts-extra/src/test_WAN_dual-isolate__piece_of_cake.qos.help @@ -0,0 +1,10 @@ +test_WAN_dual-isolate__piece_of_cake.qos (Cero3 Shaper) + +Abstract: +This is a one band cake and ipv6 enabled shaping script for Ethernet gateways. +This exists for the purpose of testing cake's different isolation options, +specifically the directional dual-[src|dst]host feature that promises to finally +tackle the bit-torrent hole in simple.qos. +This specific version is supposed to be used on WAN interfaces: + the script's ingress direction equals the internet/WAN download direction + the script's egress direction equals the internet/WAN upload direction diff --git a/net/sqm-scripts-extra/src/test_WAN_triple-isolate__piece_of_cake.qos b/net/sqm-scripts-extra/src/test_WAN_triple-isolate__piece_of_cake.qos new file mode 100644 index 0000000..5f0d7d7 --- /dev/null +++ b/net/sqm-scripts-extra/src/test_WAN_triple-isolate__piece_of_cake.qos @@ -0,0 +1,89 @@ +#!/bin/sh +################################################################################ +# test_WAN_triple-isolate__piece_of_cake.qos (Cero3 Shaper) +# +# Abstract: +# This is a one band cake and ipv6 enabled shaping script for Ethernet +# gateways. This exists for the purpose of testing cake's different isolation +# options, specifically the non-directional triple-isolate feature that promises +# to finally tackle the bit-torrent hole in simple.qos. +# This specific version is supposed to be used on WAN interfaces: +# the script's ingress direction equals the internet/WAN download direction +# the script's egress direction equals the internet/WAN upload direction +# +################################################################################ +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# Copyright (C) 2012-2016 +# Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller +# +################################################################################ + +. ${SQM_LIB_DIR}/defaults.sh + +################################################################################ + + +# this will only work with cake as qdisc... +QDISC=cake + + +# to keep this as simple as possible we ignore the *_CAKE_OPTS from defaults.sh +INGRESS_CAKE_OPTS="besteffort triple-isolate" +EGRESS_CAKE_OPTS="besteffort triple-isolate" + + +egress() { + sqm_debug "egress" + $TC qdisc del dev $IFACE root 2>/dev/null + $TC qdisc add dev $IFACE root $( get_stab_string ) cake bandwidth ${UPLINK}kbit $( get_cake_lla_string ) ${EGRESS_CAKE_OPTS} ${EQDISC_OPTS} +} + + +ingress() { + sqm_debug "ingress" + $TC qdisc del dev $IFACE handle ffff: ingress 2>/dev/null + $TC qdisc add dev $IFACE handle ffff: ingress + $TC qdisc del dev $DEV root 2>/dev/null + $TC qdisc add dev $DEV root $( get_stab_string ) cake bandwidth ${DOWNLINK}kbit $( get_cake_lla_string ) ${INGRESS_CAKE_OPTS} ${IQDISC_OPTS} + + $IP link set dev $DEV up + + # redirect all IP packets arriving in $IFACE to ifb0 + + $TC filter add dev $IFACE parent ffff: protocol all prio 10 u32 \ + match u32 0 0 flowid 1:1 action mirred egress redirect dev $DEV +} + +sqm_start() { + [ -n "$IFACE" ] || return 1 + do_modules + verify_qdisc $QDISC "cake" || return 1 + sqm_debug "Starting ${SCRIPT}" + + [ -z "$DEV" ] && DEV=$( get_ifb_for_if ${IFACE} ) + + + if [ "${UPLINK}" -ne 0 ]; + then + egress + sqm_debug "egress shaping activated" + else + sqm_debug "egress shaping deactivated" + $TC qdisc del dev ${IFACE} root 2> /dev/null + fi + if [ "${DOWNLINK}" -ne 0 ]; + then + verify_qdisc ingress "ingress" || return 1 + ingress + sqm_debug "ingress shaping activated" + else + sqm_debug "ingress shaping deactivated" + $TC qdisc del dev ${DEV} root 2> /dev/null + $TC qdisc del dev ${IFACE} ingress 2> /dev/null + fi + return 0 +} diff --git a/net/sqm-scripts-extra/src/test_WAN_triple-isolate__piece_of_cake.qos.help b/net/sqm-scripts-extra/src/test_WAN_triple-isolate__piece_of_cake.qos.help new file mode 100644 index 0000000..72df509 --- /dev/null +++ b/net/sqm-scripts-extra/src/test_WAN_triple-isolate__piece_of_cake.qos.help @@ -0,0 +1,10 @@ +test_WAN_triple-isolate__piece_of_cake.qos (Cero3 Shaper) + +Abstract: +This is a one band cake and ipv6 enabled shaping script for Ethernet gateways. +This exists for the purpose of testing cake's different isolation options, +specifically the non-directional triple-isolate feature that promises to finally +tackle the bit-torrent hole in simple.qos. +This specific version is supposed to be used on WAN interfaces: + the script's ingress direction equals the internet/WAN download direction + the script's egress direction equals the internet/WAN upload direction diff --git a/net/sqm-scripts-extra/src/test_triple_isolated_llt_cake.qos b/net/sqm-scripts-extra/src/test_triple_isolated_llt_cake.qos new file mode 100644 index 0000000..df17b39 --- /dev/null +++ b/net/sqm-scripts-extra/src/test_triple_isolated_llt_cake.qos @@ -0,0 +1,82 @@ +#!/bin/sh +################################################################################ +# test_triple_isolated_llt_cake.qos +# One bin cake shaper for ethernet gateways +# using cake qdisc with triple-isolate and diffserv-llt (Latency-Loss-Tradeoff) +# +################################################################################ +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# Copyright (C) 2012-2016 +# Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller +# +################################################################################ + +. ${SQM_LIB_DIR}/defaults.sh + +################################################################################ + + +# this will only work with cake as qdisc... +QDISC=cake + + +# to keep this as simple as possible we ignore the *_CAKE_OPTS from defaults.sh +INGRESS_CAKE_OPTS="diffserv-llt triple-isolate" +EGRESS_CAKE_OPTS="diffserv-llt triple-isolate" + + +egress() { + sqm_debug "egress" + $TC qdisc del dev $IFACE root 2>/dev/null + $TC qdisc add dev $IFACE root $( get_stab_string ) cake bandwidth ${UPLINK}kbit $( get_cake_lla_string ) ${EGRESS_CAKE_OPTS} ${EQDISC_OPTS} +} + + +ingress() { + sqm_debug "ingress" + $TC qdisc del dev $IFACE handle ffff: ingress 2>/dev/null + $TC qdisc add dev $IFACE handle ffff: ingress + $TC qdisc del dev $DEV root 2>/dev/null + $TC qdisc add dev $DEV root $( get_stab_string ) cake bandwidth ${DOWNLINK}kbit $( get_cake_lla_string ) ${INGRESS_CAKE_OPTS} ${IQDISC_OPTS} + + $IP link set dev $DEV up + + # redirect all IP packets arriving in $IFACE to ifb0 + + $TC filter add dev $IFACE parent ffff: protocol all prio 10 u32 \ + match u32 0 0 flowid 1:1 action mirred egress redirect dev $DEV +} + +sqm_start() { + [ -n "$IFACE" ] || return 1 + do_modules + verify_qdisc $QDISC "cake" || return 1 + sqm_debug "Starting ${SCRIPT}" + + [ -z "$DEV" ] && DEV=$( get_ifb_for_if ${IFACE} ) + + + if [ "${UPLINK}" -ne 0 ]; + then + egress + sqm_debug "egress shaping activated" + else + sqm_debug "egress shaping deactivated" + $TC qdisc del dev ${IFACE} root 2> /dev/null + fi + if [ "${DOWNLINK}" -ne 0 ]; + then + verify_qdisc ingress "ingress" || return 1 + ingress + sqm_debug "ingress shaping activated" + else + sqm_debug "ingress shaping deactivated" + $TC qdisc del dev ${DEV} root 2> /dev/null + $TC qdisc del dev ${IFACE} ingress 2> /dev/null + fi + return 0 +} diff --git a/net/sqm-scripts-extra/src/test_triple_isolated_llt_cake.qos.help b/net/sqm-scripts-extra/src/test_triple_isolated_llt_cake.qos.help new file mode 100644 index 0000000..06ffdad --- /dev/null +++ b/net/sqm-scripts-extra/src/test_triple_isolated_llt_cake.qos.help @@ -0,0 +1,3 @@ +Cake qdisc with triple-isolate and diffserv-llt (Latency-Loss-Tradeoff) +options as the shaper and fq_codel as leaf qdisc. This script requires +that cake is selected as qdisc. diff --git a/net/sqm-scripts/Makefile b/net/sqm-scripts/Makefile new file mode 100644 index 0000000..ce0e957 --- /dev/null +++ b/net/sqm-scripts/Makefile @@ -0,0 +1,87 @@ +# +# 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:=sqm-scripts +PKG_SOURCE_VERSION:=951118f79a3fea7081f89fee49c77895624c59a1 +PKG_VERSION:=1.0.9 +PKG_RELEASE:=1 +PKG_LICENSE:=GPLv2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE).tar.xz +PKG_SOURCE_URL:=git://github.com/tohojo/sqm-scripts.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE) +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE) + +include $(INCLUDE_DIR)/package.mk + +define Package/sqm-scripts + SECTION:=net + CATEGORY:=Base system + DEPENDS:=+tc +kmod-sched +kmod-ifb +iptables \ + +iptables-mod-ipopt +iptables-mod-conntrack-extra + TITLE:=SQM Scripts (QoS) + PKGARCH:=all + MAINTAINER:=Toke Høiland-Jørgensen +endef + +define Package/sqm-scripts/description + A set of scripts that does simple SQM configuration. +endef + +define Package/sqm-scripts/conffiles +/etc/config/sqm +/etc/sqm/sqm.conf +endef + +define Package/sqm-scripts/install + make -C $(PKG_BUILD_DIR) DESTDIR=$(1) PLATFORM=openwrt install +endef + +define Package/luci-app-sqm + SECTION:=luci + CATEGORY:=LuCI + TITLE:=SQM Scripts - LuCI interface + MAINTAINER:=Toke Høiland-Jørgensen + PKGARCH:=all + DEPENDS:= lua luci-base +sqm-scripts + SUBMENU:=3. Applications +endef + +define Package/luci-app-sqm/description + Control the simple_qos SQM script +endef + +define Package/luci-app-sqm/install + make -C $(PKG_BUILD_DIR) DESTDIR=$(1) PLATFORM=openwrt install-luci +endef + +define Package/luci-app-sqm/postinst +#!/bin/sh +which uci > /dev/null || exit 0 +uci -q get ucitrack.@sqm[0] > /dev/null || { + uci add ucitrack sqm > /dev/null + uci set ucitrack.@sqm[0].init=sqm + uci add_list ucitrack.@firewall[0].affects=sqm + uci commit +} +endef + +define Package/luci-app-sqm/postrm +#!/bin/sh +which uci > /dev/null || exit 0 +uci -q get ucitrack.@sqm[0] > /dev/null && { + uci delete ucitrack.@sqm[0] + uci del_list ucitrack.@firewall[0].affects=sqm + uci commit +} +endef + +$(eval $(call BuildPackage,sqm-scripts)) +$(eval $(call BuildPackage,luci-app-sqm)) diff --git a/net/squid/Makefile b/net/squid/Makefile new file mode 100644 index 0000000..dcf138a --- /dev/null +++ b/net/squid/Makefile @@ -0,0 +1,134 @@ +# +# Copyright (C) 2006-2015 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:=squid +PKG_VERSION:=3.5.12 +PKG_RELEASE:=1 + +PKG_LICENSE:=GPL-2.0 +PKG_MAINTAINER:=Luka Perkov + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=http://www.squid-cache.org/Versions/v3/3.5/ +PKG_MD5SUM:=50016bf6e2d3a3a186a6c7236d251f63 + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/squid/Default + SECTION:=net + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + URL:=http://www.squid-cache.org/ +endef + +define Package/squid + $(call Package/squid/Default) + MENU:=1 + DEPENDS:=+libopenssl +libpthread +librt +libltdl +libstdcpp + TITLE:=full-featured Web proxy cache +endef + +define Package/squid/description + Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. + It reduces bandwidth and improves response times by caching and reusing + frequently-requested web pages. +endef + +define Package/squid-mod-cachemgr + $(call Package/squid/Default) + DEPENDS:=squid + TITLE:=Web based proxy manager and reporting tool +endef + +CONFIGURE_ARGS += \ + --config-cache \ + --datadir=/usr/share/squid \ + --libexecdir=/usr/lib/squid \ + --sysconfdir=/etc/squid \ + --enable-shared \ + --disable-static \ + --enable-icmp \ + --enable-delay-pools \ + --enable-icap-client \ + --enable-kill-parent-hack \ + --disable-snmp \ + --enable-ssl \ + --enable-ssl-crtd \ + --enable-cache-digests \ + --enable-linux-netfilter \ + --disable-unlinkd \ + --enable-x-accelerator-vary \ + --disable-translation \ + --disable-auto-locale \ + --with-dl \ + --with-pthreads \ + --without-expat \ + --without-libxml2 \ + --without-gnutls \ + --without-nettle \ + --with-openssl=$(STAGING_DIR)/usr \ + --enable-epoll \ + --with-maxfd=4096 \ + --disable-external-acl-helpers \ + --disable-auth-negotiate \ + --disable-auth-ntlm \ + --disable-auth-digest \ + --disable-auth-basic \ + --disable-arch-native \ + --with-krb5-config=no \ + --without-mit-krb5 \ + --without-libcap \ + --without-netfilter-conntrack + +CONFIGURE_VARS += \ + ac_cv_header_linux_netfilter_ipv4_h=yes \ + ac_cv_epoll_works=yes \ + squid_cv_gnu_atomics=no + +define Build/Compile + +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/lib all + +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + install +endef + +define Package/squid/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/squid $(1)/usr/sbin/ + + $(INSTALL_DIR) $(1)/usr/lib/squid + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/squid/ssl_crtd $(1)/usr/lib/squid + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/squid.config $(1)/etc/config/squid + + $(INSTALL_DIR) $(1)/etc/squid + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/squid/mime.conf $(1)/etc/squid/ + $(INSTALL_CONF) ./files/squid.conf $(1)/etc/squid/ + + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) ./files/squid.init $(1)/etc/init.d/squid + + $(INSTALL_DIR) $(1)/usr/share/squid/icons/ + $(CP) $(PKG_INSTALL_DIR)/usr/share/squid/icons/* $(1)/usr/share/squid/icons/ + + $(INSTALL_DIR) $(1)/usr/share/squid/errors/templates/ + $(CP) $(PKG_INSTALL_DIR)/usr/share/squid/errors/templates/* $(1)/usr/share/squid/errors/templates/ +endef + +define Package/squid-mod-cachemgr/install + $(INSTALL_DIR) $(1)/www/cgi-bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/squid/cachemgr.cgi $(1)/www/cgi-bin/ +endef + +$(eval $(call BuildPackage,squid)) +$(eval $(call BuildPackage,squid-mod-cachemgr)) diff --git a/net/squid/files/squid.conf b/net/squid/files/squid.conf new file mode 100644 index 0000000..9535c1d --- /dev/null +++ b/net/squid/files/squid.conf @@ -0,0 +1,44 @@ +acl localnet src 10.0.0.0/8 +acl localnet src 172.16.0.0/12 +acl localnet src 192.168.0.0/16 +acl localnet src fc00::/7 +acl localnet src fe80::/10 + +acl ssl_ports port 443 + +acl safe_ports port 80 +acl safe_ports port 21 +acl safe_ports port 443 +acl safe_ports port 70 +acl safe_ports port 210 +acl safe_ports port 1025-65535 +acl safe_ports port 280 +acl safe_ports port 488 +acl safe_ports port 591 +acl safe_ports port 777 +acl connect method connect + +http_access deny !safe_ports +http_access deny connect !ssl_ports + +http_access allow localhost manager +http_access deny manager + +http_access deny to_localhost + +http_access allow localnet +http_access allow localhost + +http_access deny all + +refresh_pattern ^ftp: 1440 20% 10080 +refresh_pattern ^gopher: 1440 0% 1440 +refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 +refresh_pattern . 0 20% 4320 + +access_log none +cache_log /dev/null +cache_store_log stdio:/dev/null +logfile_rotate 0 + +logfile_daemon /dev/null diff --git a/net/squid/files/squid.config b/net/squid/files/squid.config new file mode 100644 index 0000000..e781860 --- /dev/null +++ b/net/squid/files/squid.config @@ -0,0 +1,8 @@ +config squid 'squid' + option config_file '/etc/squid/squid.conf' + option http_port '3128' + option coredump_dir '/tmp/squid' + option visible_hostname 'OpenWrt' + #option http_port_options 'intercept' + #option ssldb '/tmp/squid/ssldb' + #option ssldb_options '-M 4MB' diff --git a/net/squid/files/squid.init b/net/squid/files/squid.init new file mode 100644 index 0000000..76ec756 --- /dev/null +++ b/net/squid/files/squid.init @@ -0,0 +1,60 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 OpenWrt.org + +START=90 +STOP=10 + +USE_PROCD=1 +PROG=/usr/sbin/squid +CONFIGFILE="/tmp/squid/squid.conf" + +validate_squid_section() { + uci_validate_section squid squid "${1}" \ + 'config_file:string' \ + 'http_port:port:3128' \ + 'http_port_options:string' \ + 'ssldb:string' \ + 'ssldb_options:string' \ + 'coredump_dir:string' \ + 'visible_hostname:string:OpenWrt' \ + 'pinger_enable:string:off' +} + +start_service() { + local config_file http_port http_port_options ssldb ssldb_options coredump_dir visible_hostname pinger_enable + + validate_squid_section squid || { + echo "validation failed" + return 1 + } + + config_dir=$(dirname $CONFIGFILE) + [ -d $config_dir ] || mkdir -p $config_dir && chown nobody:nogroup $config_dir + [ -d $coredump_dir ] || mkdir -p $coredump_dir && chown nobody:nogroup $coredump_dir + [ "$ssldb" ] && ( [ -f "$ssldb"/size ] || /usr/lib/squid/ssl_crtd -c -s $ssldb && chown -R nobody:nogroup $ssldb ) + + cat $config_file > $CONFIGFILE + echo http_port $http_port $http_port_options >> $CONFIGFILE + echo coredump_dir $coredump_dir >> $CONFIGFILE + echo visible_hostname $visible_hostname >> $CONFIGFILE + echo pinger_enable $pinger_enable >> $CONFIGFILE + [ "$ssldb" ] && echo sslcrtd_program /usr/lib/squid/ssl_crtd -s $ssldb $ssldb_options >> $CONFIGFILE + $PROG -s -f $CONFIGFILE -N -z 2>/dev/null + + procd_open_instance + procd_set_param command $PROG -s -f $CONFIGFILE -N + procd_set_param file $CONFIGFILE + procd_set_param respawn + procd_close_instance +} + +stop_service() +{ + ${PROG} -f $CONFIGFILE -N -k shutdown 2>/dev/null +} + +service_triggers() +{ + procd_add_reload_trigger "squid" + procd_add_validation validate_squid_section +} diff --git a/net/squid/patches/001-cross_compile.patch b/net/squid/patches/001-cross_compile.patch new file mode 100644 index 0000000..c7493bb --- /dev/null +++ b/net/squid/patches/001-cross_compile.patch @@ -0,0 +1,24 @@ +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -7761,3 +7761,3 @@ cache_cf.o: cf_parser.cci + cf_gen$(EXEEXT): $(cf_gen_SOURCES) $(cf_gen_DEPENDENCIES) cf_gen_defines.cci +- $(BUILDCXX) $(BUILDCXXFLAGS) -o $@ $(srcdir)/cf_gen.cc -I$(srcdir) -I$(top_builddir)/include/ -I$(top_builddir)/src ++ g++ -o $@ $(srcdir)/cf_gen.cc -I$(srcdir) -I$(top_builddir)/include/ -I$(top_builddir)/src + +--- a/configure ++++ b/configure +@@ -20133,3 +20133,3 @@ if test "$cross_compiling" = yes; then : + $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +-as_fn_error $? "cannot run test program while cross compiling ++_as_fn_error $? "cannot run test program while cross compiling + See \`config.log' for more details" "$LINENO" 5; } +@@ -28289,3 +28289,3 @@ else + $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +-as_fn_error $? "cannot run test program while cross compiling ++_as_fn_error $? "cannot run test program while cross compiling + See \`config.log' for more details" "$LINENO" 5; } +@@ -28314,3 +28314,3 @@ else + $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +-as_fn_error $? "cannot run test program while cross compiling ++_as_fn_error $? "cannot run test program while cross compiling + See \`config.log' for more details" "$LINENO" 5; } diff --git a/net/squid/patches/100-mime.patch b/net/squid/patches/100-mime.patch new file mode 100644 index 0000000..1138a41 --- /dev/null +++ b/net/squid/patches/100-mime.patch @@ -0,0 +1,30 @@ +--- a/src/mime.conf.default ++++ b/src/mime.conf.default +@@ -1,20 +1,3 @@ +-## Copyright (C) 1996-2015 The Squid Software Foundation and contributors +-## +-## Squid software is distributed under GPLv2+ license and includes +-## contributions from numerous individuals and organizations. +-## Please see the COPYING and CONTRIBUTORS files for details. +-## +-# +-# This file associates URL patterns for servers or services +-# that don't automatically include Content-Type (like ftp) with a mime type +-# and a graphical icon. +-# +-# Content-Encodings are taken from section 3.1 of RFC2068 (HTTP/1.1) +-# +-# This file has the format : +-# +-# regexp content-type icon encoding mode actions +-#-------------------------------------------------------------------------------------------------------- + \.gif$ image/gif silk/image.png - image +download + \.mime$ www/mime silk/page_white_text.png - ascii +download + ^internal-dirup$ - silk/arrow_up.png - - +@@ -191,6 +174,4 @@ README text/plain silk/information.pn + \.xml$ text/xml silk/page_world.png - ascii +download + \.xsl$ text/xml silk/layout.png - ascii +download + \.xyz$ chemical/x-xyz silk/chart_line.png - image +download +-# +-# the default + . text/plain silk/bullet_red.png - image +download +view diff --git a/net/sshfs/Makefile b/net/sshfs/Makefile new file mode 100644 index 0000000..4403847 --- /dev/null +++ b/net/sshfs/Makefile @@ -0,0 +1,62 @@ +# +# Copyright (C) 2015 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:=sshfs +PKG_VERSION:=2.8 +PKG_RELEASE:=1 + +PKG_LICENSE:=GPL-2.0 +PKG_MAINTAINER:=Zoltan HERPAI + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/libfuse/sshfs/releases/download/$(PKG_NAME)_$(PKG_VERSION) +PKG_MD5SUM:=0ba25e848ee59e2595d6576c8f6284b6 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/sshfs + TITLE:=SSHFS + DEPENDS:=+libfuse +fuse-utils +glib2 +libpthread + SECTION:=net + CATEGORY:=Network + SUBMENU:=Filesystem + URL:=http://fuse.sourceforge.net/ +endef + +define Package/sshfs/description + Mount remote system over sftp. +endef + +CONFIGURE_VARS += \ + SSHFS_CFLAGS=" \ + -D_FILE_OFFSET_BITS=64 \ + -I$(STAGING_DIR)/usr/include/glib-2.0 \ + -I$(STAGING_DIR)/usr/lib/glib-2.0/include \ + -I$(STAGING_DIR)/usr/include/fuse" \ + SSHFS_LIBS=" \ + -lglib-2.0 -liconv $(if $(INTL_FULL),-lintl) -lfuse -pthread -lgthread-2.0 \ + -L$(STAGING_DIR)/usr/lib" + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install +endef + +define Package/sshfs/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sshfs $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,sshfs)) diff --git a/net/sshtunnel/Makefile b/net/sshtunnel/Makefile new file mode 100644 index 0000000..b277e22 --- /dev/null +++ b/net/sshtunnel/Makefile @@ -0,0 +1,45 @@ +# +# Copyright (C) 2010-2015 OpenWrt.org +# Copyright (C) 2010 segal.di.ubi.pt +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. + +include $(TOPDIR)/rules.mk + +PKG_NAME:=sshtunnel +PKG_VERSION:=4 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-2.0+ + +PKG_MAINTAINER:=Nuno Goncalves + +include $(INCLUDE_DIR)/package.mk + +define Package/sshtunnel + SECTION:=net + CATEGORY:=Network + SUBMENU:=SSH + TITLE:=Manages Local and Remote openssh ssh(1) tunnels + DEPENDS:=+openssh-client +endef + +define Package/sshtunnel/description +Creates openssh ssh(1) Local and Remote tunnels configured in UCI file. Can be used to allow remote connections, possibly over NATed connections or without public IP/DNS +endef + +define Package/sshtunnel/conffiles +/etc/config/sshtunnel +endef + +define Build/Compile +endef + +define Package/sshtunnel/install + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/sshtunnel.init $(1)/etc/init.d/sshtunnel + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/uci_sshtunnel $(1)/etc/config/sshtunnel +endef + +$(eval $(call BuildPackage,sshtunnel)) diff --git a/net/sshtunnel/files/sshtunnel.init b/net/sshtunnel/files/sshtunnel.init new file mode 100644 index 0000000..a6d9aa7 --- /dev/null +++ b/net/sshtunnel/files/sshtunnel.init @@ -0,0 +1,213 @@ +#!/bin/sh /etc/rc.common +# +# Copyright (C) 2010-2015 OpenWrt.org +# Copyright (C) 2010 segal.di.ubi.pt +# + +START=99 +STOP=01 +USE_PROCD=1 + +PROG=/usr/bin/ssh + +_log() { + logger -p daemon.info -t sshtunnel "$@" +} + +_err() { + logger -p daemon.err -t sshtunnel "$@" +} + +append_params() { + local p v args + for p in $*; do + eval "v=\$$p" + [ -n "$v" ] && args="$args -o $p=$v" + done + + ARGS_options="${args# *}" +} + +append_string() { + local varname="$1"; local add="$2"; local separator="${3:- }"; local actual + eval "actual=\$$varname" + + new="${actual:+$actual$separator}$add" + eval "$varname=\$new" +} + +validate_server_section() { + uci_validate_section sshtunnel server "$1" \ + 'user:string(1)' \ + 'hostname:host' \ + 'port:port' \ + 'retrydelay:min(1):60' \ + 'PKCS11Provider:file' \ + 'CheckHostIP:or("yes", "no")' \ + 'Compression:or("yes", "no")' \ + 'CompressionLevel:range(1,9)' \ + 'IdentityFile:file' \ + 'LogLevel:or("QUIET", "FATAL", "ERROR", "INFO", "VERBOSE", "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3"):INFO' \ + 'ServerAliveCountMax:min(1)' \ + 'ServerAliveInterval:min(1)' \ + 'StrictHostKeyChecking:or("yes", "no")' \ + 'TCPKeepAlive:or("yes", "no")' \ + 'VerifyHostKeyDNS:or("yes", "no")' +} + +validate_tunnelR_section() { + uci_validate_section sshtunnel tunnelR "$1" \ + 'remoteaddress:or(host, "*"):*' \ + 'remoteport:port' \ + 'localaddress:host' \ + 'localport:port' +} + +validate_tunnelL_section() { + uci_validate_section sshtunnel tunnelL "$1" \ + 'remoteaddress:host' \ + 'remoteport:port' \ + 'localaddress:or(host, "*"):*' \ + 'localport:port' +} + +validate_tunnelD_section() { + uci_validate_section sshtunnel tunnelD "$1" \ + 'localaddress:or(host, "*"):*' \ + 'localport:port' +} + +validate_tunnelW_section() { + uci_validate_section sshtunnel tunnelW "$1" \ + 'vpntype:or("ethernet", "point-to-point"):point-to-point' \ + 'localdev:or("any", min(1))' \ + 'remotedev:or("any", min(1))' +} + +load_tunnelR() { + config_get section_server "$1" "server" + + # continue to read next section if this is not for the current server + [ "$server" = "$section_server" ] || return 0 + + # validate and load this remote tunnel config + local remoteaddress remoteport localaddress localport + validate_tunnelR_section "$1" || { _err "tunnelR ${1}: validation failed"; return 1; } + + [ -n "$remoteport" -a -n "$localport" -a -n "$remoteaddress" ] || { _err "tunnelR ${1}: missing required options"; return 1; } + + # count nr of valid sections to make sure there are at least one + let count++ + + _log "tunnelR at ${server}: -R $remoteaddress:$remoteport:$localaddress:$localport" + append_string "ARGS_tunnels" "-R $remoteaddress:$remoteport:$localaddress:$localport" +} + +load_tunnelL() { + config_get section_server "$1" "server" + + # continue to read next section if this is not for the current server + [ "$server" = "$section_server" ] || return 0 + + # validate and load this remote tunnel config + local remoteaddress remoteport localaddress localport + validate_tunnelL_section "$1" || { _err "tunnelL ${1}: validation failed"; return 1; } + + [ -n "$remoteport" -a -n "$localport" -a -n "$remoteaddress" ] || { _err "tunnelL ${1}: missing required options"; return 1; } + + # count nr of valid sections to make sure there are at least one + let count++ + + _log "tunnelL at ${server}: -L $localaddress:$localport:$remoteaddress:$remoteport" + append_string "ARGS_tunnels" "-L $localaddress:$localport:$remoteaddress:$remoteport" +} + +load_tunnelD() { + config_get section_server "$1" "server" + + # continue to read next section if this is not for the current server + [ "$server" = "$section_server" ] || return 0 + + # validate and load this remote tunnel config + local localaddress localport + validate_tunnelD_section "$1" || { _err "tunnelD ${1}: validation failed"; return 1; } + + [ -n "$localport" ] || { _err "tunnelD ${1}: missing localport"; return 1; } + + # count nr of valid sections to make sure there are at least one + let count++ + + _log "proxy via ${server}: -D $localaddress:$localport" + append_string "ARGS_tunnels" "-D $localaddress:$localport" +} + +load_tunnelW() { + config_get section_server "$1" "server" + + # continue to read next section if this is not for the current server + [ "$server" = "$section_server" ] || return 0 + + # validate and load this remote tunnel config + local localdev remotedev vpntype + validate_tunnelW_section "$1" || { _err "tunnelW ${1}: validation failed"; return 1; } + + [ -n "$vpntype" -a -n "$localdev" -a -n "$remotedev" ] || { _err "tunnelW $1: missing or bad options"; return 1; } + + [ "$user" == "root" ] || { _err "tunnelW ${1}: root is required for tun"; return 1; } + + # count nr of valid sections to make sure there are at least one + let count++ + + _log "tunnelW to ${server}: -w $localdev:$remotedev -o Tunnel=$vpntype" + append_string "ARGS_tunnels" "-w $localdev:$remotedev -o Tunnel=$vpntype" +} + +load_server() { + server="$1" + local user hostname port retrydelay PKCS11Provider CheckHostIP Compression \ + CompressionLevel IdentityFile LogLevel ServerAliveCountMax \ + ServerAliveInterval StrictHostKeyChecking TCPKeepAlive VerifyHostKeyDNS + + validate_server_section "$server" || { _err "server ${server}: validation failed"; return 1; } + + ARGS="" + ARGS_options="" + ARGS_tunnels="" + count=0 + + config_foreach load_tunnelR "tunnelR" + config_foreach load_tunnelL "tunnelL" + config_foreach load_tunnelD "tunnelD" + config_foreach load_tunnelW "tunnelW" + [ "$count" -eq 0 ] && { _err "tunnels to ${server} not started - no tunnels defined"; return 1; } + + append_params CheckHostIP Compression CompressionLevel IdentityFile \ + LogLevel PKCS11Provider ServerAliveCountMax ServerAliveInterval \ + StrictHostKeyChecking TCPKeepAlive VerifyHostKeyDNS + + ARGS="$ARGS_options -o ExitOnForwardFailure=yes -o BatchMode=yes -nN $ARGS_tunnels -p $port $user@$hostname" + + procd_open_instance "$server" + procd_set_param command "$PROG" $ARGS + procd_set_param stdout 1 + procd_set_param stderr 1 + procd_set_param respawn 0 "$retrydelay" 1 + procd_close_instance +} + +start_service() { + config_load "sshtunnel" + config_foreach load_server "server" +} + +service_triggers() { + procd_add_reload_trigger "sshtunnel" + + procd_open_validate + validate_server_section + validate_tunnelR_section + validate_tunnelL_section + validate_tunnelD_section + validate_tunnelW_section + procd_close_validate +} diff --git a/net/sshtunnel/files/uci_sshtunnel b/net/sshtunnel/files/uci_sshtunnel new file mode 100644 index 0000000..52e6881 --- /dev/null +++ b/net/sshtunnel/files/uci_sshtunnel @@ -0,0 +1,63 @@ +# +# password authentication is not possible, public key authentication must be used. +# set "option IdentityFile" to he file from which the identity (private key) for RSA or DSA authentication is read. +# The default is ~/.ssh/identity for protocol version 1, and ~/.ssh/id_rsa and ~/.ssh/id_dsa for protocol version 2. +# ssh will also try to load certificate information from the filename obtained by appending -cert.pub to identity filenames. +# + +#config server disney +# option user mourinho +# option hostname server.disney.com +# option port 22 +# option retrydelay 1 +# option CheckHostIP yes +# option Compression no +# option CompressionLevel 6 +# option IdentityFile ~/.ssh/id_rsa +# option LogLevel INFO +# option PKCS11Provider /lib/pteidpkcs11.so +# option ServerAliveCountMax 3 +# option ServerAliveInterval 0 +# option StrictHostKeyChecking ask +# option TCPKeepAlive yes +# option VerifyHostKeyDNS yes + +# tunnelR(emote) - when the connection will be initiated to the R(emote) endpoint at +# remoteaddress:remoteport and then forwarded to localaddress:localport +# +#config tunnelR http +# option server disney +# option remoteaddress * +# option remoteport 9009 +# option localaddress 192.168.1.13 +# option localport 80 + +# tunnelL(ocal) - when the connection will be initiated to the L(ocal) endpoint at +# localaddress:localport and then forwarded to remoteaddress:remoteport +# +#config tunnelL test +# option server disney +# option localaddress * +# option localport 1022 +# option remoteaddress secretserver.disney.com +# option remoteport 22 + +# tunnelD(ynamic) - when the connection will be initiated with the SOCKS4 or SOCKS5 protocol +# to the local endpoint at localaddress:localport and then forwarded over the remote host +# +#config tunnelD proxy +# option server disney +# option localaddress * +# option localport 4055 + +# tunnelW - creates TUN/TAP devices on client and server to establish a VPN tunnel between them +# vpntypes: +# point-to-point = TUN +# ethernet = TAP +# +#config tunnelW proxy +# option server disney +# option vpntype point-to-point|ethernet +# option localdev any|0|1|2|... +# option remotedev any|0|1|2|... + diff --git a/net/sslh/Makefile b/net/sslh/Makefile new file mode 100644 index 0000000..d7edfee --- /dev/null +++ b/net/sslh/Makefile @@ -0,0 +1,55 @@ +# +# 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:=sslh +PKG_VERSION:=v1.17 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://rutschle.net/tech/ +PKG_MD5SUM:=1fc3ada4bafaca5a9786cc1431f48ed4 +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=COPYING + +include $(INCLUDE_DIR)/package.mk + +define Package/sslh + SECTION:=net + CATEGORY:=Network + SUBMENU:=Routing and Redirection + TITLE:=SSL/SSH multiplexer + URL:=http://rutschle.net/tech/sslh.shtml + PKG_MAINTAINER:=Jonathan McCrohan +endef + +define Package/sslh/conffiles +/etc/config/sslh +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + CC="$(TARGET_CC)" \ + CFLAGS="$(TARGET_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + USELIBCONFIG= \ + USELIBWRAP= \ + USELIBPCRE= \ + all +endef + +define Package/sslh/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/sslh-fork $(1)/usr/sbin/sslh + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME) + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME) +endef + +$(eval $(call BuildPackage,sslh)) diff --git a/net/sslh/files/sslh.config b/net/sslh/files/sslh.config new file mode 100644 index 0000000..07ed02b --- /dev/null +++ b/net/sslh/files/sslh.config @@ -0,0 +1,30 @@ +package 'sslh' + +config 'sslh' 'default' + # disable or enable + option 'enable' '1' + # listen defaults to '0.0.0.0:443' (all interfaces) + # multiple -p arguments may be supplied using a uci list + # -p : + option 'listen' '' + # ssh defaults to 'localhost:22' + # --ssh : + option 'ssh' '' + # ssl defaults to 'localhost:443' + # --ssl : + option 'ssl' '' + # openvpn defaults to 'localhost:1194' + # --openvpn : + option 'openvpn' '' + # tinc defaults to 'localhost:655' + # --tinc : + option 'tinc' '' + # xmpp defaults to 'localhost:5222' + # --xmpp : + option 'xmpp' '' + # timeout (for ssh, then ssl is assumed) defaults to 2 + # -t + option 'timeout' '' + # verbose defaults to off + # -v + option 'verbose' '0' diff --git a/net/sslh/files/sslh.init b/net/sslh/files/sslh.init new file mode 100644 index 0000000..f7fc647 --- /dev/null +++ b/net/sslh/files/sslh.init @@ -0,0 +1,62 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2009-2012 OpenWrt.org + +START=95 + +# XXX: pid-files are useless because sslh forks after creating them +SERVICE_USE_PID= + +start_instance() { + local section="$1" + + # check if section is enabled (default) + local enable + config_get_bool enable "${section}" 'enable' '0' + [ ${enable} -gt 0 ] || return 1 + + local args="" + local val + # A) listen parameter + config_get vals "${section}" listen + [ -n "${vals}" ] && for val in $vals; do append args "-p${val}"; done + # B) ssh parameter + config_get val "${section}" ssh + [ -n "${val}" ] && append args "--ssh ${val}" + # C) ssl parameter + config_get val "${section}" ssl + [ -n "${val}" ] && append args "--ssl ${val}" + # D) openvpn parameter + config_get val "${section}" openvpn + [ -n "${val}" ] && append args "--openvpn ${val}" + # E) tinc parameter + config_get val "${section}" tinc + [ -n "${val}" ] && append args "--tinc ${val}" + # F) xmpp parameter + config_get val "${section}" xmpp + [ -n "${val}" ] && append args "--xmpp ${val}" + # G) timeout (before a connection is considered to be SSH) + config_get val "${section}" timeout + [ -n "${val}" ] && append args "-t ${val}" + # H) verbose parameter + local verbosed + config_get_bool verbosed "${section}" verbose 0 + [ "${verbosed}" -ne 0 ] && append args "-v" + + # Defaults were removed for --user and --pidfile options + # in sslh 1.11; Define them here instead. + append args "--user nobody" + append args "--pidfile /var/run/sslh.pid" + + # XXX: allow more that one instance to run simultaneously + SERVICE_MATCH_NAME=1 SERVICE_NAME="sslh-dummy-$$" \ + service_start /usr/sbin/sslh ${args} +} + +start() { + config_load 'sslh' + config_foreach start_instance 'sslh' +} + +stop() { + service_stop /usr/sbin/sslh +} diff --git a/net/sslh/patches/001-no_sslh_select.patch b/net/sslh/patches/001-no_sslh_select.patch new file mode 100644 index 0000000..2b461f6 --- /dev/null +++ b/net/sslh/patches/001-no_sslh_select.patch @@ -0,0 +1,29 @@ +--- a/Makefile ++++ b/Makefile +@@ -45,16 +45,12 @@ all: sslh $(MAN) echosrv + version.h: + ./genver.sh >version.h + +-sslh: sslh-fork sslh-select ++sslh: sslh-fork + + sslh-fork: version.h $(OBJS) sslh-fork.o Makefile common.h + $(CC) $(CFLAGS) $(LDFLAGS) -o sslh-fork sslh-fork.o $(OBJS) $(LIBS) + #strip sslh-fork + +-sslh-select: version.h $(OBJS) sslh-select.o Makefile common.h +- $(CC) $(CFLAGS) $(LDFLAGS) -o sslh-select sslh-select.o $(OBJS) $(LIBS) +- #strip sslh-select +- + echosrv: $(OBJS) echosrv.o + $(CC) $(CFLAGS) $(LDFLAGS) -o echosrv echosrv.o probe.o common.o $(LIBS) + +@@ -85,7 +81,7 @@ distclean: clean + rm -f tags cscope.* + + clean: +- rm -f sslh-fork sslh-select echosrv version.h $(MAN) *.o *.gcov *.gcno *.gcda *.png *.html *.css *.info ++ rm -f sslh-fork echosrv version.h $(MAN) *.o *.gcov *.gcno *.gcda *.png *.html *.css *.info + + tags: + ctags --globals -T *.[ch] diff --git a/net/sslh/patches/002-no_regex_probes.patch b/net/sslh/patches/002-no_regex_probes.patch new file mode 100644 index 0000000..130c311 --- /dev/null +++ b/net/sslh/patches/002-no_regex_probes.patch @@ -0,0 +1,90 @@ +From 3aefaf300478cd6fbc4892d5baaf70521ed323af Mon Sep 17 00:00:00 2001 +From: Yves Rutschle +Date: Thu, 9 Jul 2015 15:31:42 +0200 +Subject: [PATCH] Added Makefile option to build without libpcre + +--- +--- a/Makefile ++++ b/Makefile +@@ -2,6 +2,7 @@ + + VERSION=$(shell ./genver.sh -r) + USELIBCONFIG=1 # Use libconfig? (necessary to use configuration files) ++USELIBPCRE=1 # Use libpcre? (necessary to use regex probe) + USELIBWRAP?= # Use libwrap? + USELIBCAP= # Use libcap? + COV_TEST= # Perform test coverage? +@@ -27,6 +28,10 @@ ifneq ($(strip $(USELIBWRAP)),) + CPPFLAGS+=-DLIBWRAP + endif + ++ifneq ($(strip $(USELIBPCRE)),) ++ CPPFLAGS+=-DLIBPCRE ++endif ++ + ifneq ($(strip $(USELIBCONFIG)),) + LIBS:=$(LIBS) -lconfig + CPPFLAGS+=-DLIBCONFIG +--- a/probe.c ++++ b/probe.c +@@ -21,7 +21,9 @@ + + #define _GNU_SOURCE + #include ++#ifdef LIBPCRE + #include ++#endif + #include + #include "probe.h" + +@@ -226,6 +228,7 @@ static int is_tls_protocol(const char *p + + static int regex_probe(const char *p, int len, struct proto *proto) + { ++#ifdef LIBPCRE + regex_t **probe = proto->data; + regmatch_t pos = { 0, len }; + +@@ -233,6 +236,11 @@ static int regex_probe(const char *p, in + /* try them all */; + + return (*probe != NULL); ++#else ++ /* Should never happen as we check when loading config file */ ++ fprintf(stderr, "FATAL: regex probe called but not built in\n"); ++ exit(5); ++#endif + } + + /* +--- a/sslh-main.c ++++ b/sslh-main.c +@@ -25,7 +25,9 @@ + #ifdef LIBCONFIG + #include + #endif ++#ifdef LIBPCRE + #include ++#endif + + #include "common.h" + #include "probe.h" +@@ -174,6 +176,7 @@ static int config_listen(config_t *confi + #ifdef LIBCONFIG + static void setup_regex_probe(struct proto *p, config_setting_t* probes) + { ++#ifdef LIBPCRE + int num_probes, errsize, i, res; + char *err; + const char * expr; +@@ -201,6 +204,10 @@ static void setup_regex_probe(struct pro + exit(1); + } + } ++#else ++ fprintf(stderr, "line %d: regex probe specified but not compiled in\n", config_setting_source_line(probes)); ++ exit(5); ++#endif + } + #endif + diff --git a/net/sstp-client/Makefile b/net/sstp-client/Makefile new file mode 100644 index 0000000..32791dc --- /dev/null +++ b/net/sstp-client/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2006-2016 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:=sstp-client +PKG_VERSION:=1.0.10 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/sstp-client/$(PKG_VERSION) +PKG_MD5SUM:=5f290355187e5ce0423fb7e388e65b9d +PKG_LICENSE=GPLv2 + +include $(INCLUDE_DIR)/package.mk + +TARGET_CPPFLAGS += -I$(PKG_BUILD_DIR)/include + +define Package/sstp-client + SECTION:=net + CATEGORY:=Network + DEPENDS=+libevent2 +libopenssl +ppp + TITLE:=SSTP is Microsofts Remote Access Solution for PPP over SSL + URL:=http://sstp-client.sourceforge.net/ + MAINTAINER:=Federico Di Marco +endef + +define Package/sstp-client/description + It can be used instead of PPTP or L2TP, and is only available with Windows Vista/7 connecting to a Windows 2008 Server. The advantage of SSTP compared to PPTP and L2TP is that it cannot be easily blocked by firewalls since the traffic is transmitted over HTTPS on port 443. + Windows Vista/7 uses SSTP whenever PPTP or L2TP cannot be established. For further information on SSTP check out wikipedia's article on Secure Socket Tunneling Protocol. +endef + +define Package/sstp-client/conffiles +/etc/ppp/chap-secrets +/etc/ppp/peers/peer-sstp-example-nopty.txt +/etc/ppp/peers/peer-sstp-example.txt +endef + +define Package/sstp-client/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/.libs/sstpc $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/src/libsstp-api/.libs/*.so* $(1)/usr/lib/ + $(CP) $(PKG_BUILD_DIR)/src/pppd-plugin/.libs/*.so* $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/etc/ppp + $(INSTALL_DIR) $(1)/etc/peers +endef + +$(eval $(call BuildPackage,sstp-client)) diff --git a/net/sstp-client/files/etc/ppp/chap-secrets b/net/sstp-client/files/etc/ppp/chap-secrets new file mode 100644 index 0000000..3b93768 --- /dev/null +++ b/net/sstp-client/files/etc/ppp/chap-secrets @@ -0,0 +1,4 @@ +# Secrets for authentication using CHAP +# client (domain\\username) server secret (password) acceptable local IP addresses +# SSTP-TEST\\JonDoe sstp-test 'testme1234!' * + diff --git a/net/sstp-client/files/etc/ppp/peers/peer-sstp-example-nopty.txt b/net/sstp-client/files/etc/ppp/peers/peer-sstp-example-nopty.txt new file mode 100644 index 0000000..0149220 --- /dev/null +++ b/net/sstp-client/files/etc/ppp/peers/peer-sstp-example-nopty.txt @@ -0,0 +1,14 @@ +remotename sstp-test +linkname sstp-test +ipparam sstp-test +name SSTP-TEST\\jdoe +plugin sstp-pppd-plugin.so +sstp-sock /tmp/sstp-uds-sock +usepeerdns +require-mppe +noauth +refuse-eap +debug + +# adopt defaults from the pptp-linux package +file /etc/ppp/options.pptp diff --git a/net/sstp-client/files/etc/ppp/peers/peer-sstp-example.txt b/net/sstp-client/files/etc/ppp/peers/peer-sstp-example.txt new file mode 100644 index 0000000..e96e188 --- /dev/null +++ b/net/sstp-client/files/etc/ppp/peers/peer-sstp-example.txt @@ -0,0 +1,15 @@ +remotename sstp-test +linkname sstp-test +ipparam sstp-test +pty "sstpc --server n3zz-dc1.sstp-test.net --nolaunchpppd " +name SSTP-TEST\\jdoe +plugin sstp-pppd-plugin.so +sstp-sock /tmp/sstpc-uds-sock +usepeerdns +require-mppe +refuse-eap +noauth +debug + +# adopt defaults from the pptp-linux package +file /etc/ppp/options.pptp diff --git a/net/sstp-client/patches/100-musl-compat.patch b/net/sstp-client/patches/100-musl-compat.patch new file mode 100644 index 0000000..d19b2fa --- /dev/null +++ b/net/sstp-client/patches/100-musl-compat.patch @@ -0,0 +1,33 @@ +--- /dev/null ++++ b/include/net/ppp_defs.h +@@ -0,0 +1,10 @@ ++#ifndef _NET_PPP_DEFS_H ++#define _NET_PPP_DEFS_H 1 ++ ++#define __need_time_t ++#include ++ ++#include ++#include ++ ++#endif /* net/ppp_defs.h */ +--- a/src/libsstp-log/sstp-log-syslog.c ++++ b/src/libsstp-log/sstp-log-syslog.c +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + #include + + #include +--- a/src/libsstp-log/sstp-log-std.c ++++ b/src/libsstp-log/sstp-log-std.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + #include + #include + diff --git a/net/strongswan/Config.in b/net/strongswan/Config.in new file mode 100644 index 0000000..5bb78ae --- /dev/null +++ b/net/strongswan/Config.in @@ -0,0 +1,16 @@ +menu "Configuration" + depends on PACKAGE_strongswan + +# --with-routing-table +config STRONGSWAN_ROUTING_TABLE + string + prompt "Set the IPsec routing table ID" + default "220" + +# --with-routing-table-prio +config STRONGSWAN_ROUTING_TABLE_PRIO + string + prompt "Set the IPsec routing table priority" + default "220" + +endmenu diff --git a/net/strongswan/Makefile b/net/strongswan/Makefile new file mode 100644 index 0000000..029b8bf --- /dev/null +++ b/net/strongswan/Makefile @@ -0,0 +1,576 @@ +# +# Copyright (C) 2012-2015 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:=strongswan +PKG_VERSION:=5.5.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://download.strongswan.org/ http://download2.strongswan.org/ +PKG_MD5SUM:=4eba9474f7dc6c8c8d7037261358e68d +PKG_LICENSE:=GPL-2.0+ +PKG_MAINTAINER:=Stijn Tintel + +PKG_MOD_AVAILABLE:= \ + addrblock \ + aes \ + af-alg \ + agent \ + attr \ + attr-sql \ + blowfish \ + ccm \ + cmac \ + constraints \ + connmark \ + coupling \ + ctr \ + curl \ + des \ + dhcp \ + dnskey \ + duplicheck \ + eap-identity \ + eap-md5 \ + eap-mschapv2 \ + eap-radius \ + eap-tls \ + farp \ + fips-prf \ + forecast \ + gcm \ + gcrypt \ + gmp \ + gmpdh \ + ha \ + hmac \ + kernel-libipsec \ + kernel-netlink \ + ldap \ + led \ + load-tester \ + nonce \ + md4 \ + md5 \ + mysql \ + openssl \ + pem \ + pgp \ + pkcs1 \ + pkcs7 \ + pkcs8 \ + pkcs11 \ + pkcs12 \ + pubkey \ + random \ + rc2 \ + resolve \ + revocation \ + sha1 \ + sha2 \ + smp \ + socket-default \ + socket-dynamic \ + sql \ + sqlite \ + sshkey \ + stroke \ + test-vectors \ + unity \ + uci \ + updown \ + whitelist \ + x509 \ + xauth-eap \ + xauth-generic \ + xcbc + +PKG_CONFIG_DEPENDS:= \ + CONFIG_STRONGSWAN_ROUTING_TABLE \ + CONFIG_STRONGSWAN_ROUTING_TABLE_PRIO \ + $(patsubst %,CONFIG_PACKAGE_strongswan-mod-%,$(PKG_MOD_AVAILABLE)) \ + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/strongswan/Default + SUBMENU:=VPN + SECTION:=net + CATEGORY:=Network + TITLE:=StrongSwan + URL:=http://www.strongswan.org/ +endef + +define Package/strongswan/description/Default + StrongSwan is an OpenSource IPsec implementation for the Linux operating system. +endef + +define Package/strongswan +$(call Package/strongswan/Default) + DEPENDS:= +libpthread +ip \ + +kmod-crypto-authenc \ + +kmod-ipsec +kmod-ipsec4 +IPV6:kmod-ipsec6 \ + +kmod-ipt-ipsec +iptables-mod-ipsec +endef + +define Package/strongswan/config + source "$(SOURCE)/Config.in" +endef + +define Package/strongswan/description +$(call Package/strongswan/description/Default) + This package contains shared libraries and scripts. +endef + +define Package/strongswan-full +$(call Package/strongswan/Default) + TITLE+= (full) + DEPENDS:= +strongswan \ + +strongswan-charon \ + +strongswan-mod-addrblock \ + +strongswan-mod-aes \ + +strongswan-mod-af-alg \ + +strongswan-mod-agent \ + +strongswan-mod-attr \ + +strongswan-mod-attr-sql \ + +strongswan-mod-blowfish \ + +strongswan-mod-ccm \ + +strongswan-mod-cmac \ + +strongswan-mod-constraints \ + +strongswan-mod-connmark \ + +strongswan-mod-coupling \ + +strongswan-mod-ctr \ + +strongswan-mod-curl \ + +strongswan-mod-des \ + +strongswan-mod-dhcp \ + +strongswan-mod-dnskey \ + +strongswan-mod-duplicheck \ + +strongswan-mod-eap-identity \ + +strongswan-mod-eap-md5 \ + +strongswan-mod-eap-mschapv2 \ + +strongswan-mod-eap-radius \ + +strongswan-mod-eap-tls \ + +strongswan-mod-farp \ + +strongswan-mod-fips-prf \ + +strongswan-mod-forecast \ + +strongswan-mod-gcm \ + +strongswan-mod-gcrypt \ + +strongswan-mod-gmp \ + +strongswan-mod-ha \ + +strongswan-mod-hmac \ + +strongswan-mod-kernel-netlink \ + +strongswan-mod-ldap \ + +strongswan-mod-led \ + +strongswan-mod-load-tester \ + +strongswan-mod-nonce \ + +strongswan-mod-md4 \ + +strongswan-mod-md5 \ + +strongswan-mod-mysql \ + +strongswan-mod-openssl \ + +strongswan-mod-pem \ + +strongswan-mod-pgp \ + +strongswan-mod-pkcs1 \ + +strongswan-mod-pkcs7 \ + +strongswan-mod-pkcs8 \ + +strongswan-mod-pkcs11 \ + +strongswan-mod-pkcs12 \ + +strongswan-mod-pubkey \ + +strongswan-mod-random \ + +strongswan-mod-rc2 \ + +strongswan-mod-resolve \ + +strongswan-mod-revocation \ + +strongswan-mod-sha1 \ + +strongswan-mod-sha2 \ + +strongswan-mod-smp \ + +strongswan-mod-socket-default \ + +strongswan-mod-sql \ + +strongswan-mod-sqlite \ + +strongswan-mod-sshkey \ + +strongswan-mod-stroke \ + +strongswan-mod-test-vectors \ + +strongswan-mod-uci \ + +strongswan-mod-unity \ + +strongswan-mod-updown \ + +strongswan-mod-whitelist \ + +strongswan-mod-x509 \ + +strongswan-mod-xauth-eap \ + +strongswan-mod-xauth-generic \ + +strongswan-mod-xcbc \ + +strongswan-utils \ + @DEVEL +endef + +define Package/strongswan-full/description +$(call Package/strongswan/description/Default) + This meta-package contains dependencies for all of the strongswan plugins + except kernel-libipsec, + socket-dynamic and which are omitted in favor of the kernel-netlink and + socket-default plugins. +endef + + +define Package/strongswan-default +$(call Package/strongswan/Default) + TITLE+= (default) + DEPENDS:= +strongswan \ + +strongswan-charon \ + +strongswan-mod-aes \ + +strongswan-mod-attr \ + +strongswan-mod-connmark \ + +strongswan-mod-constraints \ + +strongswan-mod-des \ + +strongswan-mod-dnskey \ + +strongswan-mod-fips-prf \ + +strongswan-mod-gmp \ + +strongswan-mod-hmac \ + +strongswan-mod-kernel-netlink \ + +strongswan-mod-md5 \ + +strongswan-mod-nonce \ + +strongswan-mod-pem \ + +strongswan-mod-pgp \ + +strongswan-mod-pkcs1 \ + +strongswan-mod-pubkey \ + +strongswan-mod-random \ + +strongswan-mod-rc2 \ + +strongswan-mod-resolve \ + +strongswan-mod-revocation \ + +strongswan-mod-sha1 \ + +strongswan-mod-sha2 \ + +strongswan-mod-socket-default \ + +strongswan-mod-sshkey \ + +strongswan-mod-stroke \ + +strongswan-mod-updown \ + +strongswan-mod-x509 \ + +strongswan-mod-xauth-generic \ + +strongswan-mod-xcbc \ + +strongswan-utils +endef + +define Package/strongswan-default/description +$(call Package/strongswan/description/Default) + This meta-package contains only dependencies to match upstream defaults. +endef + + +define Package/strongswan-isakmp +$(call Package/strongswan/Default) + TITLE+= (isakmp) + DEPENDS:= +strongswan \ + +strongswan-charon \ + +strongswan-mod-aes \ + +strongswan-mod-des \ + +strongswan-mod-gmpdh \ + +strongswan-mod-hmac \ + +strongswan-mod-kernel-netlink \ + +strongswan-mod-md5 \ + +strongswan-mod-nonce \ + +strongswan-mod-pubkey \ + +strongswan-mod-random \ + +strongswan-mod-sha1 \ + +strongswan-mod-socket-default \ + +strongswan-mod-stroke \ + +strongswan-mod-uci \ + +strongswan-mod-updown \ + +strongswan-utils +endef + +define Package/strongswan-isakmp/description +$(call Package/strongswan/description/Default) + This meta-package contains only dependencies to establish ISAKMP / + IKE PSK connections, dropping other capabilities in favor of small size + Can fit most routers even with 4Mb flash (after removing IPv6 support). +endef + + +define Package/strongswan-minimal +$(call Package/strongswan/Default) + TITLE+= (minimal) + DEPENDS:= +strongswan \ + +strongswan-charon \ + +strongswan-mod-aes \ + +strongswan-mod-gmp \ + +strongswan-mod-hmac \ + +strongswan-mod-kernel-netlink \ + +strongswan-mod-nonce \ + +strongswan-mod-pubkey \ + +strongswan-mod-random \ + +strongswan-mod-sha1 \ + +strongswan-mod-socket-default \ + +strongswan-mod-stroke \ + +strongswan-mod-updown \ + +strongswan-mod-x509 \ + +strongswan-mod-xcbc +endef + +define Package/strongswan-minimal/description +$(call Package/strongswan/description/Default) + This meta-package contains only dependencies for a minimal IKEv2 setup. +endef + +define Package/strongswan-charon +$(call Package/strongswan/Default) + TITLE+= IKEv1/IKEv2 keying daemon + DEPENDS:= +strongswan +endef + +define Package/strongswan-charon/description +$(call Package/strongswan/description/Default) + This package contains charon, an IKEv2 keying daemon. +endef + +define Package/strongswan-utils +$(call Package/strongswan/Default) + TITLE+= utilities + DEPENDS:= +strongswan +endef + +define Package/strongswan-utils/description +$(call Package/strongswan/description/Default) + This package contains the pki & scepclient utilities. +endef + +define Package/strongswan-libtls +$(call Package/strongswan/Default) + TITLE+= libtls + DEPENDS:= +strongswan +endef + +define Package/strongswan-libtls/description +$(call Package/strongswan/description/Default) + This package contains libtls for strongSwan plugins eap-tls, eap-ttls, + eap-peap, tnc-tnccs +endef + +define BuildPlugin + define Package/strongswan-mod-$(1) + $$(call Package/strongswan/Default) + TITLE:= StrongSwan $(2) plugin + DEPENDS:= +strongswan $(3) + endef + + define Package/strongswan-mod-$(1)/install + $(INSTALL_DIR) $$(1)/etc/strongswan.d/charon + if [ -f $(PKG_INSTALL_DIR)/etc/strongswan.d/charon/$(1).conf ]; then \ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/strongswan.d/charon/$(1).conf $$(1)/etc/strongswan.d/charon/; fi + $(INSTALL_DIR) $$(1)/usr/lib/ipsec/plugins + $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-$(1).so \ + $$(1)/usr/lib/ipsec/plugins/ + $(call Plugin/$(1)/install,$$(1)) + endef + + $$(eval $$(call BuildPackage,strongswan-mod-$(1))) +endef + +CONFIGURE_ARGS+= \ + --disable-scripts \ + --disable-static \ + --disable-fast \ + --with-systemdsystemunitdir=no \ + $(if $(CONFIG_PACKAGE_strongswan-utils),--enable-pki --enable-scepclient,--disable-pki --disable-scepclient) \ + --with-random-device=/dev/random \ + --with-urandom-device=/dev/urandom \ + --with-routing-table="$(call qstrip,$(CONFIG_STRONGSWAN_ROUTING_TABLE))" \ + --with-routing-table-prio="$(call qstrip,$(CONFIG_STRONGSWAN_ROUTING_TABLE_PRIO))" \ + $(foreach m,$(PKG_MOD_AVAILABLE), \ + $(if $(CONFIG_PACKAGE_strongswan-mod-$(m)),--enable-$(m),--disable-$(m)) \ + ) \ + ac_cv_search___atomic_load=no + +EXTRA_LDFLAGS+= -Wl,-rpath-link,$(STAGING_DIR)/usr/lib + +define Package/strongswan/conffiles +/etc/ipsec.d/ +/etc/ipsec.conf +/etc/ipsec.secrets +/etc/ipsec.user +/etc/strongswan.conf +/etc/strongswan.d/ +endef + +define Package/strongswan/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/ipsec.conf $(1)/etc/ + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/strongswan.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/usr/lib/ipsec + $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/libstrongswan.so.* $(1)/usr/lib/ipsec/ + $(INSTALL_CONF) ./files/ipsec.secrets $(1)/etc/ + $(INSTALL_CONF) ./files/ipsec.user $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/ipsec.init $(1)/etc/init.d/ipsec +endef + +define Package/strongswan-default/install + true +endef + +define Package/strongswan-full/install + true +endef + +define Package/strongswan-isakmp/install + true +endef + +define Package/strongswan-minimal/install + true +endef + +define Package/strongswan-charon/install + $(INSTALL_DIR) $(1)/usr/lib/ipsec + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ipsec/charon $(1)/usr/lib/ipsec/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/libcharon.so.* $(1)/usr/lib/ipsec/ +endef + +define Package/strongswan-utils/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ipsec $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pki $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib/ipsec + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ipsec/scepclient $(1)/usr/lib/ipsec/ +endef + +define Package/strongswan-libtls/install + $(INSTALL_DIR) $(1)/usr/lib/ipsec + $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/libtls.so.* $(1)/usr/lib/ipsec/ +endef + +define Plugin/duplicheck/install + $(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins + $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/duplicheck $(1)/usr/lib/ipsec/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-duplicheck.so $(1)/usr/lib/ipsec/plugins/ +endef + +define Plugin/eap-radius/install + $(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins + $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/libradius.so.* $(1)/usr/lib/ipsec/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-eap-radius.so $(1)/usr/lib/ipsec/plugins/ +endef + +define Plugin/attr-sql/install + $(INSTALL_DIR) $(1)/usr/lib/ipsec + $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/pool $(1)/usr/lib/ipsec/ +endef + +define Plugin/stroke/install + $(INSTALL_DIR) $(1)/etc/ipsec.d/aacerts + $(INSTALL_DIR) $(1)/etc/ipsec.d/acerts + $(INSTALL_DIR) $(1)/etc/ipsec.d/cacerts + $(INSTALL_DIR) $(1)/etc/ipsec.d/certs + $(INSTALL_DIR) $(1)/etc/ipsec.d/crls + $(INSTALL_DIR) $(1)/etc/ipsec.d/ocspcerts + $(INSTALL_DIR) $(1)/etc/ipsec.d/private + $(INSTALL_DIR) $(1)/etc/ipsec.d/reqs + + $(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ipsec/{starter,stroke} $(1)/usr/lib/ipsec/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-stroke.so $(1)/usr/lib/ipsec/plugins/ +endef + +define Plugin/updown/install + $(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins + $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/_updown $(1)/usr/lib/ipsec/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-updown.so $(1)/usr/lib/ipsec/plugins/ + $(INSTALL_DIR) $(1)/etc +endef + +define Plugin/whitelist/install + $(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins + $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/whitelist $(1)/usr/lib/ipsec/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-whitelist.so $(1)/usr/lib/ipsec/plugins/ +endef + +define Plugin/kernel-libipsec/install + $(INSTALL_DIR) $(1)/usr/lib/ipsec + $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/libipsec.so.* $(1)/usr/lib/ipsec/ +endef + +$(eval $(call BuildPackage,strongswan)) +$(eval $(call BuildPackage,strongswan-default)) +$(eval $(call BuildPackage,strongswan-full)) +$(eval $(call BuildPackage,strongswan-minimal)) +$(eval $(call BuildPackage,strongswan-isakmp)) +$(eval $(call BuildPackage,strongswan-charon)) +$(eval $(call BuildPackage,strongswan-utils)) +$(eval $(call BuildPackage,strongswan-libtls)) +$(eval $(call BuildPlugin,addrblock,RFC 3779 address block constraint support,)) +$(eval $(call BuildPlugin,aes,AES crypto,)) +$(eval $(call BuildPlugin,af-alg,AF_ALG crypto interface to Linux Crypto API,+kmod-crypto-user)) +$(eval $(call BuildPlugin,agent,SSH agent signing,)) +$(eval $(call BuildPlugin,attr,file based config,)) +$(eval $(call BuildPlugin,attr-sql,SQL based config,+strongswan-charon)) +$(eval $(call BuildPlugin,blowfish,Blowfish crypto,)) +$(eval $(call BuildPlugin,ccm,CCM AEAD wrapper crypto,)) +$(eval $(call BuildPlugin,cmac,CMAC crypto,)) +$(eval $(call BuildPlugin,connmark,netfilter connection marking,)) +$(eval $(call BuildPlugin,constraints,advanced X509 constraint checking,)) +$(eval $(call BuildPlugin,coupling,IKEv2 plugin to couple peer certificates permanently to authentication,)) +$(eval $(call BuildPlugin,ctr,Counter Mode wrapper crypto,)) +$(eval $(call BuildPlugin,curl,cURL fetcher plugin,+PACKAGE_strongswan-mod-curl:libcurl)) +$(eval $(call BuildPlugin,des,DES crypto,)) +$(eval $(call BuildPlugin,dhcp,DHCP based attribute provider,)) +$(eval $(call BuildPlugin,dnskey,DNS RR key decoding,)) +$(eval $(call BuildPlugin,duplicheck,advanced duplicate checking,)) +$(eval $(call BuildPlugin,eap-identity,EAP identity helper,)) +$(eval $(call BuildPlugin,eap-md5,EAP MD5 (CHAP) EAP auth,)) +$(eval $(call BuildPlugin,eap-mschapv2,EAP MS-CHAPv2 EAP auth,+strongswan-mod-md4 +strongswan-mod-des)) +$(eval $(call BuildPlugin,eap-radius,EAP RADIUS auth,)) +$(eval $(call BuildPlugin,eap-tls,EAP TLS auth,+strongswan-libtls)) +$(eval $(call BuildPlugin,farp,fake arp respsonses,)) +$(eval $(call BuildPlugin,fips-prf,FIPS PRF crypto,+strongswan-mod-sha1)) +$(eval $(call BuildPlugin,forecast,forward multi/broadcast traffic,+kmod-ipt-conntrack-extra)) +$(eval $(call BuildPlugin,gcm,GCM AEAD wrapper crypto,)) +$(eval $(call BuildPlugin,gcrypt,libgcrypt,+PACKAGE_strongswan-mod-gcrypt:libgcrypt)) +$(eval $(call BuildPlugin,gmp,libgmp,+PACKAGE_strongswan-mod-gmp:libgmp)) +$(eval $(call BuildPlugin,gmpdh,DH-Groups; no libgmp dep,)) +$(eval $(call BuildPlugin,ha,high availability cluster,)) +$(eval $(call BuildPlugin,hmac,HMAC crypto,)) +$(eval $(call BuildPlugin,kernel-libipsec,libipsec kernel interface,)) +$(eval $(call BuildPlugin,kernel-netlink,netlink kernel interface,)) +$(eval $(call BuildPlugin,ldap,LDAP,+PACKAGE_strongswan-mod-ldap:libopenldap)) +$(eval $(call BuildPlugin,led,LED blink on IKE activity,)) +$(eval $(call BuildPlugin,load-tester,load testing,)) +$(eval $(call BuildPlugin,nonce,nonce genereation,)) +$(eval $(call BuildPlugin,md4,MD4 crypto,)) +$(eval $(call BuildPlugin,md5,MD5 crypto,)) +$(eval $(call BuildPlugin,mysql,MySQL database interface,+strongswan-mod-sql +PACKAGE_strongswan-mod-mysql:libmysqlclient-r)) +$(eval $(call BuildPlugin,openssl,OpenSSL crypto,+PACKAGE_strongswan-mod-openssl:libopenssl)) +$(eval $(call BuildPlugin,pem,PEM decoding,)) +$(eval $(call BuildPlugin,pgp,PGP key decoding,)) +$(eval $(call BuildPlugin,pkcs1,PKCS1 key decoding,)) +$(eval $(call BuildPlugin,pkcs7,PKCS7 key decoding,)) +$(eval $(call BuildPlugin,pkcs8,PKCS8 key decoding,)) +$(eval $(call BuildPlugin,pkcs11,PKCS11 key decoding,)) +$(eval $(call BuildPlugin,pkcs12,PKCS12 key decoding,)) +$(eval $(call BuildPlugin,pubkey,raw public key,)) +$(eval $(call BuildPlugin,random,RNG,)) +$(eval $(call BuildPlugin,rc2,RC2 crypto,)) +$(eval $(call BuildPlugin,resolve,DNS resolver,)) +$(eval $(call BuildPlugin,revocation,X509 CRL/OCSP revocation,)) +$(eval $(call BuildPlugin,sha1,SHA1 crypto,)) +$(eval $(call BuildPlugin,sha2,SHA2 crypto,)) +$(eval $(call BuildPlugin,smp,SMP configuration and control interface,+PACKAGE_strongswan-mod-smp:libxml2)) +$(eval $(call BuildPlugin,socket-default,default socket implementation for charon,)) +$(eval $(call BuildPlugin,socket-dynamic,dynamic socket implementation for charon,)) +$(eval $(call BuildPlugin,sql,SQL database interface,)) +$(eval $(call BuildPlugin,sqlite,SQLite database interface,+strongswan-mod-sql +PACKAGE_strongswan-mod-sqlite:libsqlite3)) +$(eval $(call BuildPlugin,sshkey,SSH key decoding,)) +$(eval $(call BuildPlugin,stroke,Stroke,+strongswan-charon +strongswan-utils)) +$(eval $(call BuildPlugin,test-vectors,crypto test vectors,)) +$(eval $(call BuildPlugin,uci,UCI config interface,+PACKAGE_strongswan-mod-uci:libuci)) +$(eval $(call BuildPlugin,unity,Cisco Unity extension,)) +$(eval $(call BuildPlugin,updown,updown firewall,)) +$(eval $(call BuildPlugin,whitelist,peer identity whitelisting,)) +$(eval $(call BuildPlugin,x509,x509 certificate,)) +$(eval $(call BuildPlugin,xauth-eap,EAP XAuth backend,)) +$(eval $(call BuildPlugin,xauth-generic,generic XAuth backend,)) +$(eval $(call BuildPlugin,xcbc,xcbc crypto,)) diff --git a/net/strongswan/files/ipsec.init b/net/strongswan/files/ipsec.init new file mode 100644 index 0000000..391a2ae --- /dev/null +++ b/net/strongswan/files/ipsec.init @@ -0,0 +1,20 @@ +#!/bin/sh /etc/rc.common + +START=90 +STOP=10 + +start() { + ipsec start +} + +stop() { + ipsec stop +} + +restart() { + ipsec restart +} + +reload() { + ipsec update +} diff --git a/net/strongswan/files/ipsec.secrets b/net/strongswan/files/ipsec.secrets new file mode 100644 index 0000000..ddd4956 --- /dev/null +++ b/net/strongswan/files/ipsec.secrets @@ -0,0 +1 @@ +# /etc/ipsec.secrets - strongSwan IPsec secrets file diff --git a/net/strongswan/files/ipsec.user b/net/strongswan/files/ipsec.user new file mode 100644 index 0000000..4351ace --- /dev/null +++ b/net/strongswan/files/ipsec.user @@ -0,0 +1,6 @@ +# This file is interpreted as shell script. +# Put your custom ip rules here, they will +# be executed with each call to the script +# /usr/lib/ipsec/_updown which by default +# strongswan executes. + diff --git a/net/strongswan/patches/101-musl-fixes.patch b/net/strongswan/patches/101-musl-fixes.patch new file mode 100644 index 0000000..e48d22b --- /dev/null +++ b/net/strongswan/patches/101-musl-fixes.patch @@ -0,0 +1,83 @@ +--- a/src/libstrongswan/library.h ++++ b/src/libstrongswan/library.h +@@ -118,6 +118,7 @@ + #include "utils/leak_detective.h" + #include "plugins/plugin_loader.h" + #include "settings/settings.h" ++#include "musl.h" + + typedef struct library_t library_t; + +--- /dev/null ++++ b/src/libstrongswan/musl.h +@@ -0,0 +1,38 @@ ++#include ++ ++#define crypt x_crypt ++#define encrypt x_encrypt ++#include ++ ++#define fd_set x_fd_set ++#define ino_t x_ino_t ++#define off_t x_off_t ++#define loff_t x_loff_t ++#define dev_t x_dev_t ++#define mode_t x_mode_t ++#define uid_t x_uid_t ++#define gid_t x_gid_t ++#define uint64_t x_uint64_t ++#define u_int64_t x_u_int64_t ++#define int64_t x_int64_t ++#define nlink_t x_nlink_t ++#define timer_t x_timer_t ++#define blkcnt_t x_blkcnt_t ++ ++#include ++ ++#undef fd_set ++#undef ino_t ++#undef off_t ++#undef dev_t ++#undef mode_t ++#undef uid_t ++#undef gid_t ++#undef uint64_t ++#undef u_int64_t ++#undef int64_t ++#undef nlink_t ++#undef timer_t ++#undef blkcnt_t ++#undef crypt ++#undef encrypt +--- a/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c ++++ b/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c +@@ -19,6 +19,7 @@ + */ + + #define _GNU_SOURCE ++#include + #include + #include + #include +--- a/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c ++++ b/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c +@@ -37,6 +37,8 @@ + * THE SOFTWARE. + */ + ++#include "musl.h" ++ + #include + #include + #include +--- a/src/libcharon/plugins/kernel_netlink/kernel_netlink_shared.c ++++ b/src/libcharon/plugins/kernel_netlink/kernel_netlink_shared.c +@@ -15,6 +15,8 @@ + * for more details. + */ + ++#include "musl.h" ++ + #include + #include + #include diff --git a/net/strongswan/patches/201-kmodloader.patch b/net/strongswan/patches/201-kmodloader.patch new file mode 100644 index 0000000..cd74f27 --- /dev/null +++ b/net/strongswan/patches/201-kmodloader.patch @@ -0,0 +1,28 @@ +--- a/src/starter/netkey.c ++++ b/src/starter/netkey.c +@@ -30,7 +30,7 @@ bool starter_netkey_init(void) + /* af_key module makes the netkey proc interface visible */ + if (stat(PROC_MODULES, &stb) == 0) + { +- ignore_result(system("modprobe -qv af_key")); ++ ignore_result(system("modprobe af_key 2>&1 >/dev/null")); + } + + /* now test again */ +@@ -44,11 +44,11 @@ bool starter_netkey_init(void) + /* make sure that all required IPsec modules are loaded */ + if (stat(PROC_MODULES, &stb) == 0) + { +- ignore_result(system("modprobe -qv ah4")); +- ignore_result(system("modprobe -qv esp4")); +- ignore_result(system("modprobe -qv ipcomp")); +- ignore_result(system("modprobe -qv xfrm4_tunnel")); +- ignore_result(system("modprobe -qv xfrm_user")); ++ ignore_result(system("modprobe ah4 2>&1 >/dev/null")); ++ ignore_result(system("modprobe esp4 2>&1 >/dev/null")); ++ ignore_result(system("modprobe ipcomp 2>&1 >/dev/null")); ++ ignore_result(system("modprobe xfrm4_tunnel 2>&1 >/dev/null")); ++ ignore_result(system("modprobe xfrm_user 2>&1 >/dev/null")); + } + + DBG2(DBG_APP, "found netkey IPsec stack"); diff --git a/net/strongswan/patches/203-uci.patch b/net/strongswan/patches/203-uci.patch new file mode 100644 index 0000000..274ea86 --- /dev/null +++ b/net/strongswan/patches/203-uci.patch @@ -0,0 +1,20 @@ +--- a/src/libcharon/plugins/uci/uci_parser.c ++++ b/src/libcharon/plugins/uci/uci_parser.c +@@ -78,7 +78,7 @@ METHOD(enumerator_t, section_enumerator_ + if (uci_lookup(this->ctx, &element, this->package, + this->current->name, "name") == UCI_OK) + { /* use "name" attribute as config name if available ... */ +- *value = uci_to_option(element)->value; ++ *value = uci_to_option(element)->v.string; + } + else + { /* ... or the section name becomes config name */ +@@ -93,7 +93,7 @@ METHOD(enumerator_t, section_enumerator_ + if (value && uci_lookup(this->ctx, &element, this->package, + this->current->name, this->keywords[i]) == UCI_OK) + { +- *value = uci_to_option(element)->value; ++ *value = uci_to_option(element)->v.string; + } + } + va_end(args); diff --git a/net/strongswan/patches/210-sleep.patch b/net/strongswan/patches/210-sleep.patch new file mode 100644 index 0000000..d8adec3 --- /dev/null +++ b/net/strongswan/patches/210-sleep.patch @@ -0,0 +1,11 @@ +--- a/src/ipsec/_ipsec.in ++++ b/src/ipsec/_ipsec.in +@@ -259,7 +259,7 @@ stop) + loop=110 + while [ $loop -gt 0 ] ; do + kill -0 $spid 2>/dev/null || break +- sleep 0.1 2>/dev/null ++ sleep 1 2>/dev/null + if [ $? -ne 0 ] + then + sleep 1 diff --git a/net/strongswan/patches/300-include-ipsec-user-script.patch b/net/strongswan/patches/300-include-ipsec-user-script.patch new file mode 100644 index 0000000..6835e02 --- /dev/null +++ b/net/strongswan/patches/300-include-ipsec-user-script.patch @@ -0,0 +1,17 @@ +--- a/src/_updown/_updown.in ++++ b/src/_updown/_updown.in +@@ -16,11 +16,9 @@ + # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + # for more details. + +-# CAUTION: Installing a new version of strongSwan will install a new +-# copy of this script, wiping out any custom changes you make. If +-# you need changes, make a copy of this under another name, and customize +-# that, and use the (left/right)updown parameters in ipsec.conf to make +-# strongSwan use yours instead of this default one. ++# Add your custom ip rules to the /etc/ipsec.user file if you need that functionality. ++ ++[ -e /etc/ipsec.user ] && . /etc/ipsec.user "$1" + + # PLUTO_VERSION + # indicates what version of this interface is being diff --git a/net/strongswan/patches/305-minimal_dh_plugin.patch b/net/strongswan/patches/305-minimal_dh_plugin.patch new file mode 100644 index 0000000..597510f --- /dev/null +++ b/net/strongswan/patches/305-minimal_dh_plugin.patch @@ -0,0 +1,221 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -133,6 +133,7 @@ ARG_DISBL_SET([fips-prf], [disable + ARG_ENABL_SET([gcm], [enables the GCM AEAD wrapper crypto plugin.]) + ARG_ENABL_SET([gcrypt], [enables the libgcrypt plugin.]) + ARG_DISBL_SET([gmp], [disable GNU MP (libgmp) based crypto implementation plugin.]) ++ARG_DISBL_SET([gmpdh], [disable GNU MP (libgmp) based static-linked crypto DH minimal implementation plugin.]) + ARG_DISBL_SET([hmac], [disable HMAC crypto implementation plugin.]) + ARG_ENABL_SET([md4], [enable MD4 software implementation plugin.]) + ARG_DISBL_SET([md5], [disable MD5 software implementation plugin.]) +@@ -1347,6 +1348,7 @@ ADD_PLUGIN([gcrypt], [s ch + ADD_PLUGIN([af-alg], [s charon scepclient pki scripts medsrv attest nm cmd aikgen]) + ADD_PLUGIN([fips-prf], [s charon nm cmd]) + ADD_PLUGIN([gmp], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen]) ++ADD_PLUGIN([gmpdh], [s charon scepclient pki scripts manager medsrv attest nm cmd aikgen]) + ADD_PLUGIN([agent], [s charon nm cmd]) + ADD_PLUGIN([keychain], [s charon cmd]) + ADD_PLUGIN([chapoly], [s charon scripts nm cmd]) +@@ -1480,6 +1482,7 @@ AM_CONDITIONAL(USE_SHA2, test x$sha2 = x + AM_CONDITIONAL(USE_SHA3, test x$sha3 = xtrue) + AM_CONDITIONAL(USE_FIPS_PRF, test x$fips_prf = xtrue) + AM_CONDITIONAL(USE_GMP, test x$gmp = xtrue) ++AM_CONDITIONAL(USE_GMPDH, test x$gmpdh = xtrue) + AM_CONDITIONAL(USE_RDRAND, test x$rdrand = xtrue) + AM_CONDITIONAL(USE_AESNI, test x$aesni = xtrue) + AM_CONDITIONAL(USE_RANDOM, test x$random = xtrue) +@@ -1733,6 +1736,7 @@ AC_CONFIG_FILES([ + src/libstrongswan/plugins/sha3/Makefile + src/libstrongswan/plugins/fips_prf/Makefile + src/libstrongswan/plugins/gmp/Makefile ++ src/libstrongswan/plugins/gmpdh/Makefile + src/libstrongswan/plugins/rdrand/Makefile + src/libstrongswan/plugins/aesni/Makefile + src/libstrongswan/plugins/random/Makefile +--- a/src/libstrongswan/Makefile.am ++++ b/src/libstrongswan/Makefile.am +@@ -307,6 +307,13 @@ if MONOLITHIC + endif + endif + ++if USE_GMPDH ++ SUBDIRS += plugins/gmpdh ++if MONOLITHIC ++ libstrongswan_la_LIBADD += plugins/gmpdh/libstrongswan-gmpdh.la ++endif ++endif ++ + if USE_RDRAND + SUBDIRS += plugins/rdrand + if MONOLITHIC +--- /dev/null ++++ b/src/libstrongswan/plugins/gmpdh/Makefile.am +@@ -0,0 +1,19 @@ ++AM_CPPFLAGS = \ ++ -I$(top_srcdir)/src/libstrongswan ++ ++AM_CFLAGS = \ ++ $(PLUGIN_CFLAGS) ++ ++if MONOLITHIC ++noinst_LTLIBRARIES = libstrongswan-gmpdh.la ++else ++plugin_LTLIBRARIES = libstrongswan-gmpdh.la ++endif ++ ++libstrongswan_gmpdh_la_SOURCES = \ ++ gmpdh_plugin.h gmpdh_plugin.c \ ++ ../gmp/gmp_diffie_hellman.c ../gmp/gmp_diffie_hellman.h ++ ++ ++libstrongswan_gmpdh_la_LDFLAGS = -module -avoid-version -Wl,-Bstatic -Wl,-lgmp -Wl,-Bdynamic -Wl,--as-needed ++libstrongswan_gmpdh_la_LIBADD = +--- /dev/null ++++ b/src/libstrongswan/plugins/gmpdh/gmpdh_plugin.c +@@ -0,0 +1,101 @@ ++/* ++ * Copyright (C) 2008-2009 Martin Willi ++ * Hochschule fuer Technik Rapperswil ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. See . ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * for more details. ++ */ ++ ++#include "gmpdh_plugin.h" ++ ++#include ++#include "../gmp/gmp_diffie_hellman.h" ++ ++typedef struct private_gmpdh_plugin_t private_gmpdh_plugin_t; ++ ++/** ++ * private data of gmp_plugin ++ */ ++struct private_gmpdh_plugin_t { ++ ++ /** ++ * public functions ++ */ ++ gmpdh_plugin_t public; ++}; ++ ++METHOD(plugin_t, get_name, char*, ++ private_gmpdh_plugin_t *this) ++{ ++ return "gmpdh"; ++} ++ ++METHOD(plugin_t, get_features, int, ++ private_gmpdh_plugin_t *this, plugin_feature_t *features[]) ++{ ++ static plugin_feature_t f[] = { ++ /* DH groups */ ++ PLUGIN_REGISTER(DH, gmp_diffie_hellman_create), ++ PLUGIN_PROVIDE(DH, MODP_2048_BIT), ++ PLUGIN_DEPENDS(RNG, RNG_STRONG), ++ PLUGIN_PROVIDE(DH, MODP_2048_224), ++ PLUGIN_DEPENDS(RNG, RNG_STRONG), ++ PLUGIN_PROVIDE(DH, MODP_2048_256), ++ PLUGIN_DEPENDS(RNG, RNG_STRONG), ++ PLUGIN_PROVIDE(DH, MODP_1536_BIT), ++ PLUGIN_DEPENDS(RNG, RNG_STRONG), ++ PLUGIN_PROVIDE(DH, MODP_3072_BIT), ++ PLUGIN_DEPENDS(RNG, RNG_STRONG), ++ PLUGIN_PROVIDE(DH, MODP_4096_BIT), ++ PLUGIN_DEPENDS(RNG, RNG_STRONG), ++ PLUGIN_PROVIDE(DH, MODP_6144_BIT), ++ PLUGIN_DEPENDS(RNG, RNG_STRONG), ++ PLUGIN_PROVIDE(DH, MODP_8192_BIT), ++ PLUGIN_DEPENDS(RNG, RNG_STRONG), ++ PLUGIN_PROVIDE(DH, MODP_1024_BIT), ++ PLUGIN_DEPENDS(RNG, RNG_STRONG), ++ PLUGIN_PROVIDE(DH, MODP_1024_160), ++ PLUGIN_DEPENDS(RNG, RNG_STRONG), ++ PLUGIN_PROVIDE(DH, MODP_768_BIT), ++ PLUGIN_DEPENDS(RNG, RNG_STRONG), ++ PLUGIN_REGISTER(DH, gmp_diffie_hellman_create_custom), ++ PLUGIN_PROVIDE(DH, MODP_CUSTOM), ++ PLUGIN_DEPENDS(RNG, RNG_STRONG), ++ }; ++ *features = f; ++ return countof(f); ++} ++ ++METHOD(plugin_t, destroy, void, ++ private_gmpdh_plugin_t *this) ++{ ++ free(this); ++} ++ ++/* ++ * see header file ++ */ ++plugin_t *gmpdh_plugin_create() ++{ ++ private_gmpdh_plugin_t *this; ++ ++ INIT(this, ++ .public = { ++ .plugin = { ++ .get_name = _get_name, ++ .get_features = _get_features, ++ .destroy = _destroy, ++ }, ++ }, ++ ); ++ ++ return &this->public.plugin; ++} ++ +--- /dev/null ++++ b/src/libstrongswan/plugins/gmpdh/gmpdh_plugin.h +@@ -0,0 +1,42 @@ ++/* ++ * Copyright (C) 2008 Martin Willi ++ * Hochschule fuer Technik Rapperswil ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. See . ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * for more details. ++ */ ++ ++/** ++ * @defgroup gmpdh_p gmpdh ++ * @ingroup plugins ++ * ++ * @defgroup gmpdh_plugin gmpdh_plugin ++ * @{ @ingroup gmpdh_p ++ */ ++ ++#ifndef GMPDH_PLUGIN_H_ ++#define GMPDH_PLUGIN_H_ ++ ++#include ++ ++typedef struct gmpdh_plugin_t gmpdh_plugin_t; ++ ++/** ++ * Plugin implementing asymmetric crypto algorithms using the GNU MP library. ++ */ ++struct gmpdh_plugin_t { ++ ++ /** ++ * implements plugin interface ++ */ ++ plugin_t plugin; ++}; ++ ++#endif /** GMPDH_PLUGIN_H_ @}*/ diff --git a/net/stunnel/Makefile b/net/stunnel/Makefile new file mode 100644 index 0000000..30bb958 --- /dev/null +++ b/net/stunnel/Makefile @@ -0,0 +1,79 @@ +# +# 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:=stunnel +PKG_VERSION:=5.38 +PKG_RELEASE:=1 + +PKG_LICENSE:=GPL-2.0+ +PKG_MAINTAINER:=Daniel Engberg +PKG_LICENSE_FILES:=COPYING COPYRIGHT.GPL + +PKG_SOURCE_URL:= \ + http://ftp.nluug.nl/pub/networking/stunnel/ \ + http://www.usenix.org.uk/mirrors/stunnel/ +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=09ada29ba1683ab1fd1f31d7bed8305127a0876537e836a40cb83851da034fd5 + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/stunnel + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libopenssl +zlib +libpthread + TITLE:=SSL TCP Wrapper + URL:=http://www.stunnel.org/ +endef + +define Package/stunnel/description + Stunnel is a program that allows you to encrypt arbitrary TCP + connections inside SSL (Secure Sockets Layer) available on both Unix + and Windows. Stunnel can allow you to secure non-SSL aware daemons and + protocols (like POP, IMAP, LDAP, etc) by having Stunnel provide the + encryption, requiring no changes to the daemon's code. +endef + +define Package/stunnel/conffiles +/etc/stunnel/stunnel.conf +endef + + +CONFIGURE_ARGS+= \ + --with-random=/dev/urandom \ + --with-threads=pthread \ + --with-ssl=$(STAGING_DIR)/usr \ + --disable-libwrap \ + --disable-systemd + +ifeq ($(CONFIG_IPV6),n) +CONFIGURE_ARGS+= \ + --disable-ipv6 +endif + +define Build/Compile + mkdir -p $(PKG_INSTALL_DIR)/etc/stunnel + echo '#dummy' > $(PKG_INSTALL_DIR)/etc/stunnel/stunnel.pem + $(call Build/Compile/Default) +endef + +define Package/stunnel/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/stunnel $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib/stunnel + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/stunnel/libstunnel.so $(1)/usr/lib/stunnel/ + $(INSTALL_DIR) $(1)/etc/stunnel + $(INSTALL_CONF) ./files/stunnel.conf $(1)/etc/stunnel/stunnel.conf + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/stunnel.init $(1)/etc/init.d/stunnel +endef + +$(eval $(call BuildPackage,stunnel)) diff --git a/net/stunnel/files/stunnel.conf b/net/stunnel/files/stunnel.conf new file mode 100644 index 0000000..2f10800 --- /dev/null +++ b/net/stunnel/files/stunnel.conf @@ -0,0 +1,45 @@ +; Drop privileges +setuid = nobody +setgid = nogroup + +; When running under procd, stay in foreground +foreground = yes + +; Don't log to stderr, use syslog +syslog = yes + +; 1-7. Use 7 for greatest verbosity +;debug = 5 + +; Starting here, enter your services or uncomment the examples + +; Example: +; If your local httpd does not support HTTPS, use stunnel in remote +; mode to forward TLS connections coming in on port 443 to non-TLS +; on port 80. +; Make sure that the cert is available. +;[httpd] +;accept = 443 +;connect = 127.0.0.1:80 +;cert = /etc/stunnel/stunnel.pem + +; Example: +; If your local email client does not support TLS, +; use stunnel in client mode to forward non-TLS connections on +; port 143 to TLS-enabled servername:993. +;[imap] +;client = yes +;accept = 143 +;connect = servername:993 +; Disable peer verification - be sure to understand the limitations of peer +; verification in stunnel when enabling. +;verify = 0 + +; Default client section: +; stunnel requires at least one section to start successfully. +; You can safely remove this section once you have configured +; your own. We use client mode here as server requires a certificate. +[dummy] +client = yes +accept = localhost:6000 +connect = localhost:6001 diff --git a/net/stunnel/files/stunnel.init b/net/stunnel/files/stunnel.init new file mode 100644 index 0000000..e622205 --- /dev/null +++ b/net/stunnel/files/stunnel.init @@ -0,0 +1,12 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2008 OpenWrt.org + +START=90 +USE_PROCD=1 + +start_service() { + procd_open_instance + procd_set_param command /usr/bin/stunnel /etc/stunnel/stunnel.conf + procd_set_param respawn # respawn automatically if something died + procd_close_instance +} diff --git a/net/subversion/Makefile b/net/subversion/Makefile new file mode 100644 index 0000000..4fd168c --- /dev/null +++ b/net/subversion/Makefile @@ -0,0 +1,141 @@ +# +# Copyright (C) 2007-2016 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:=subversion +PKG_RELEASE:=1 +PKG_VERSION:=1.9.5 +PKG_SOURCE_URL:=@APACHE/subversion +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_MD5SUM:=9fcbae352a5efe73d46a88c97c6bba14 +PKG_LICENSE:=Apache-2.0 +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Val Kulkov + +PKG_FIXUP:=autoreconf +PKG_MACRO_PATHS:=build/ac-macros + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + + +define Package/subversion/Default + SECTION:=net + CATEGORY:=Network + SUBMENU:=Version Control Systems + TITLE:=A compelling replacement for CVS + DEPENDS:=+zlib +libsqlite3 +libapr +libaprutil +libmagic \ + $(ICONV_DEPENDS) $(INTL_DEPENDS) + URL:=http://subversion.apache.org/ +endef + +define Package/subversion/Default/description + Subversion is a free/open-source version control system. That is, + Subversion manages files and directories, and the changes made to them, + over time. This allows you to recover older versions of your data, or + examine the history of how your data changed. In this regard, many + people think of a version control system as a sort of time machine. +endef + +define Package/subversion-libs + $(call Package/subversion/Default) + TITLE:=subversion libs +endef + +define Package/subversion-libs/description + $(call Package/subversion/Default/description) + This package contains the Subversion libraries. +endef + +define Package/subversion-client + $(call Package/subversion/Default) + DEPENDS:=+subversion-libs + TITLE:=subversion client tools +endef + +define Package/subversion-client/description + $(call Package/subversion/Default/description) + This package contains the Subversion client tools. +endef + +define Package/subversion-server + $(call Package/subversion/Default) + DEPENDS:=+subversion-libs + TITLE:=subversion server +endef + +define Package/subversion-server/description + $(call Package/subversion/Default/description) + This package contains the Subversion server. +endef + +define Package/subversion-server/conffiles +/etc/config/subversion +endef + +TARGET_CFLAGS += $(FPIC) +TARGET_CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE + +CONFIGURE_ARGS += \ + --with-apr="$(STAGING_DIR)/usr/bin/apr-1-config" \ + --with-apr-util="$(STAGING_DIR)/usr/bin/apu-1-config" \ + --with-libmagic="$(STAGING_DIR)/usr" \ + --disable-mod-activation \ + --without-ruby-sitedir \ + --without-swig \ + --without-jikes \ + --without-junit \ + --without-berkeley-db \ + --without-apxs \ + --without-sasl + +ifdef $(INTL_FULL) + CONFIGURE_ARGS += --enable-nls +else + CONFIGURE_ARGS += --disable-nls +endif + +CONFIGURE_VARS += \ + LDFLAGS="$(TARGET_LDFLAGS) -lcrypt -lm \ + -lz -lpthread $(if $(INTL_FULL),-lintl)" + CPPFLAGS="$(TARGET_CPPFLAGS)" + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all local-install +endef + +define Package/subversion-libs/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsvn_*.so.* $(1)/usr/lib/ +endef + +define Package/subversion-client/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{svn,svnversion,svnsync} $(1)/usr/bin/ +endef + +define Package/subversion-server/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/svn{look,admin,dumpfilter,serve} $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/subversion.config $(1)/etc/config/subversion + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/subversion.init $(1)/etc/init.d/subversion +endef + +define Package/subversion-server/prerm +#!/bin/sh + ps | grep '\(/svnserve$\| svnserve\)' | grep -cvq grep >/dev/null && /etc/init.d/subversion stop + /etc/init.d/subversion disable +endef + +$(eval $(call BuildPackage,subversion-libs)) +$(eval $(call BuildPackage,subversion-client)) +$(eval $(call BuildPackage,subversion-server)) diff --git a/net/subversion/files/subversion.config b/net/subversion/files/subversion.config new file mode 100644 index 0000000..3297c8d --- /dev/null +++ b/net/subversion/files/subversion.config @@ -0,0 +1,3 @@ +config subversion + option path '/var/local/svn' + option port '3690' diff --git a/net/subversion/files/subversion.init b/net/subversion/files/subversion.init new file mode 100644 index 0000000..660a297 --- /dev/null +++ b/net/subversion/files/subversion.init @@ -0,0 +1,37 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2016 OpenWrt.org + +START=50 + +start_instance () { + local section="$1" + config_get path "$section" 'path' + config_get port "$section" 'port' + + if [ ! -d "$path" ]; then + echo "The subversion repository (${path}) does not exist." + echo "Create a new repository and/or change the path in /etc/config/subversion" + echo + echo "Create a new subversion repository with:" + echo " mkdir -p ${path}" + echo " svnadmin create --fs-type fsfs ${path}" + echo + echo "Changing the path using UCI (default path is: /var/local/svn):" + echo " uci set subversion.@[0].path="/srv/svn"" + echo " uci commit" + echo " /etc/init.d/subversion restart" + return 1 + fi + + service_start /usr/bin/svnserve -d --listen-port ${port} -r ${path} +} + +start() { + config_load 'subversion' + config_foreach start_instance 'subversion' +} + +stop() { + SERVICE_SIG_STOP="INT" \ + service_stop /usr/bin/svnserve +} diff --git a/net/subversion/patches/301-cross-compilation-macos.patch b/net/subversion/patches/301-cross-compilation-macos.patch new file mode 100644 index 0000000..b964949 --- /dev/null +++ b/net/subversion/patches/301-cross-compilation-macos.patch @@ -0,0 +1,97 @@ +--- a/build/ac-macros/macosx.m4 2016-02-09 01:24:13.181409245 -0500 ++++ b/build/ac-macros/macosx.m4 2016-02-09 01:25:15.873408288 -0500 +@@ -17,94 +17,4 @@ dnl specific language governing permis + dnl under the License. + dnl =================================================================== + dnl +-dnl Mac OS X specific checks + +-dnl SVN_LIB_MACHO_ITERATE +-dnl Check for _dyld_image_name and _dyld_image_header availability +-AC_DEFUN(SVN_LIB_MACHO_ITERATE, +-[ +- AC_MSG_CHECKING([for Mach-O dynamic module iteration functions]) +- AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +- #include +- #include +- ]],[[ +- const struct mach_header *header = _dyld_get_image_header(0); +- const char *name = _dyld_get_image_name(0); +- if (name && header) return 0; +- return 1; +- ]])],[ +- AC_DEFINE([SVN_HAVE_MACHO_ITERATE], [1], +- [Is Mach-O low-level _dyld API available?]) +- AC_MSG_RESULT([yes]) +- ],[ +- AC_MSG_RESULT([no]) +- ]) +-]) +- +-dnl SVN_LIB_MACOS_PLIST +-dnl Assign variables for Mac OS property list support +-AC_DEFUN(SVN_LIB_MACOS_PLIST, +-[ +- AC_MSG_CHECKING([for Mac OS property list utilities]) +- +- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +- #include +- #if !defined(MAC_OS_X_VERSION_MAX_ALLOWED) \ +- || !defined(MAC_OS_X_VERSION_10_0) \ +- || (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_0) +- #error ProperyList API unavailable. +- #endif +- ]],[[]])],[ +- dnl ### Hack. We should only need to pass the -framework options when +- dnl linking libsvn_subr, since it is the only library that uses Keychain. +- dnl +- dnl Unfortunately, libtool 1.5.x doesn't track transitive dependencies for +- dnl OS X frameworks like it does for normal libraries, so we need to +- dnl explicitly pass the option to all the users of libsvn_subr to allow +- dnl static builds to link successfully. +- dnl +- dnl This does mean that all executables we link will be linked directly +- dnl to these frameworks - even when building shared libraries - but that +- dnl shouldn't cause any problems. +- +- LIBS="$LIBS -framework CoreFoundation" +- AC_DEFINE([SVN_HAVE_MACOS_PLIST], [1], +- [Is Mac OS property list API available?]) +- AC_MSG_RESULT([yes]) +- ],[ +- AC_MSG_RESULT([no]) +- ]) +-]) +- +-dnl SVN_LIB_MACOS_KEYCHAIN +-dnl Check configure options and assign variables related to Keychain support +- +-AC_DEFUN(SVN_LIB_MACOS_KEYCHAIN, +-[ +- AC_ARG_ENABLE(keychain, +- AS_HELP_STRING([--disable-keychain], +- [Disable use of Mac OS KeyChain for auth credentials]), +- [enable_keychain=$enableval],[enable_keychain=yes]) +- +- AC_MSG_CHECKING([for Mac OS KeyChain Services]) +- +- if test "$enable_keychain" = "yes"; then +- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +- #include +- #if !defined(MAC_OS_X_VERSION_MAX_ALLOWED) \ +- || !defined(MAC_OS_X_VERSION_10_2) \ +- || (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2) +- #error KeyChain API unavailable. +- #endif +- ]],[[]])],[ +- dnl ### Hack, see SVN_LIB_MACOS_PLIST +- LIBS="$LIBS -framework Security" +- LIBS="$LIBS -framework CoreServices" +- AC_DEFINE([SVN_HAVE_KEYCHAIN_SERVICES], [1], [Is Mac OS KeyChain support enabled?]) +- AC_MSG_RESULT([yes]) +- ],[ +- enable_keychain=no +- AC_MSG_RESULT([no]) +- ]) +- fi +-]) diff --git a/net/tcpproxy/Makefile b/net/tcpproxy/Makefile new file mode 100644 index 0000000..77ef825 --- /dev/null +++ b/net/tcpproxy/Makefile @@ -0,0 +1,85 @@ +# +# Copyright (C) 2010 Christian Pointner, +# +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# This Makefile builds tcpproxy Package for OpenWRT +# +# $Id: $ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=tcpproxy +PKG_VERSION:=1.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.spreadspace.org/tcpproxy/releases/ +PKG_MD5SUM:=14f734a61350c52556909e2ed5bff361 +PKG_MAINTAINER:=Christian Pointner +PKG_LICENSE:=GPL-3.0+ +PKG_LICENSE_FILES:=LICENSE +include $(INCLUDE_DIR)/package.mk + + +define Package/tcpproxy + SECTION:=net + CATEGORY:=Network + SUBMENU:=Routing and Redirection + TITLE:=IPv4/IPv6 tcp connection proxy + URL:=http://www.spreadspace.org/tcpproxy/ +endef + +define Package/tcpproxy/conffiles +/etc/config/tcpproxy +endef + +define Package/tcpproxy/description +tcpproxy is a simple tcp connection proxy which combines the features of rinetd and 6tunnel. + tcpproxy supports IPv4 and IPv6 and also supports connections from IPv6 to IPv4 endpoints and vice versa. +endef + +define Package/tcpproxy/configure +endef + +define Build/Configure + (cd $(PKG_BUILD_DIR)/src; \ + touch include.mk; \ + echo '#ifndef TCPPROXY_config_h_INCLUDED' > config.h; \ + echo '#define TCPPROXY_config_h_INCLUDED' >> config.h; \ + echo '' >> config.h; \ + echo '#define VERSION_STRING_0 "tcpproxy version '`cat $(PKG_BUILD_DIR)/version`'"' >> config.h; \ + echo '#define VERSION_STRING_1 "built on '`hostname`', '`date +"%d.%m.%Y %H:%M:%S %Z"`'"' >> config.h; \ + echo '' >> config.h; \ + echo '#define TARGET "linux"' >> config.h; \ + echo '#define PREFIX "/usr"' >> config.h; \ + echo '#define BINDIR "/usr/bin"' >> config.h; \ + echo '#define SYSTEMDDIR "/tmp"' >> config.h; \ + echo '#define ETCDIR "/etc"' >> config.h; \ + echo '#define CONFFILE "/etc/tcpproxy.conf"' >> config.h; \ + echo '' >> config.h; \ + echo '#endif' >> config.h \ + ) +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR)/src \ + $(TARGET_CONFIGURE_OPTS) \ + TARGET=Linux \ + CFLAGS="$(TARGET_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" + $(STRIP) $(PKG_BUILD_DIR)/src/tcpproxy +endef + +define Package/tcpproxy/install + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/tcpproxy.config $(1)/etc/config/tcpproxy + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(2)/src/tcpproxy $(1)/usr/bin/tcpproxy + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/tcpproxy.init $(1)/etc/init.d/tcpproxy +endef + +$(eval $(call BuildPackage,tcpproxy)) diff --git a/net/tcpproxy/files/tcpproxy.config b/net/tcpproxy/files/tcpproxy.config new file mode 100644 index 0000000..cd3f67c --- /dev/null +++ b/net/tcpproxy/files/tcpproxy.config @@ -0,0 +1,26 @@ +config tcpproxy + option username 'nobody' + option groupname 'nogroup' +# option chroot "/var/run/tcpproxy" +# option log 'syslog:3,tcpproxy,daemon' + +config listen + option disabled 1 + + option local_port '8000' + option resolv 'ipv4' + + option remote_addr 'www.google.at' + option remote_port '80' + option remote_resolv 'ipv6' + option source_addr '2a02:3e0:2002:1:215:58ff:fe31:2ce7' + +config listen + option disabled 1 + + option local_addr '2a02:3e0:2002:1:215:58ff:fe31:2ce7' + option local_port '1234' + + option remote_addr 'www.google.at' + option remote_port '80' + option remote_resolv 'ipv4' diff --git a/net/tcpproxy/files/tcpproxy.init b/net/tcpproxy/files/tcpproxy.init new file mode 100644 index 0000000..4587a1c --- /dev/null +++ b/net/tcpproxy/files/tcpproxy.init @@ -0,0 +1,96 @@ +#!/bin/sh /etc/rc.common +START=50 + +BIN=tcpproxy +DAEMON=/usr/bin/$BIN +DAEMON_ARGS="" +DESC=$BIN +RUN_D=/var/run +CONFIG_DIR=/var/etc +CONFIG_FILE=$CONFIG_DIR/$BIN.conf + +tcpproxy_write_config() { + local cfg="$1" + + config_get_bool value "$cfg" disabled 0 + [ "$value" -ne 0 ] && return + + local local_addr="" + local resolv="" + local local_port="" + local remote_addr="" + local remote_resolv="" + local remote_port="" + local source_addr="" + + config_get local_addr "$cfg" local_addr + config_get local_port "$cfg" local_port + config_get resolv "$cfg" resolv + config_get remote_addr "$cfg" remote_addr + config_get remote_port "$cfg" remote_port + config_get remote_resolv "$cfg" remote_resolv + config_get source_addr "$cfg" source_addr + + if [ -z "$local_addr" ]; then + local_addr="*" + fi + + echo "listen $local_addr $local_port" >> $CONFIG_FILE + echo "{" >> $CONFIG_FILE + if [ -n "$resolv" ]; then + echo " resolv: $resolv;" >> $CONFIG_FILE + fi + echo " remote: $remote_addr $remote_port;" >> $CONFIG_FILE + if [ -n "$remote_resolv" ]; then + echo " remote-resolv: $remote_resolv;" >> $CONFIG_FILE + fi + if [ -n "$source_addr" ]; then + echo " source: $source_addr;" >> $CONFIG_FILE + fi + echo "};" >> $CONFIG_FILE + echo "" >> $CONFIG_FILE +} + +tcpproxy_generate_args() { + local cfg="$1" + local option + local value + + for option in username groupname chroot log + do + config_get value "$cfg" "$option" + option=`echo $option | tr '_' '-'` + if [ -n "$value" ]; then + DAEMON_ARGS="$DAEMON_ARGS --$option $value" + fi + done +} + +tcpproxy_rebuild_config() { + mkdir -p $CONFIG_DIR + rm -f $CONFIG_FILE + touch $CONFIG_FILE + config_load $BIN + config_foreach tcpproxy_write_config listen +} + +start() { + echo -n "Starting $DESC " + tcpproxy_rebuild_config + config_foreach tcpproxy_generate_args $BIN + $DAEMON $DAEMON_ARGS --config $CONFIG_FILE --write-pid "$RUN_D/$BIN.pid" + echo "." +} + +reload() { + echo -n "Reloading $DESC " + tcpproxy_rebuild_config + kill -SIGHUP `cat "$RUN_D/$BIN.pid"` + echo "." +} + +stop() { + echo -n "Stopping $DESC " + kill `cat $RUN_D/$BIN.pid` > /dev/null 2>&1 + echo "." +} diff --git a/net/tcpproxy/patches/001-ragel_generated.patch b/net/tcpproxy/patches/001-ragel_generated.patch new file mode 100644 index 0000000..600e602 --- /dev/null +++ b/net/tcpproxy/patches/001-ragel_generated.patch @@ -0,0 +1,1378 @@ +diff -Nur tcpproxy-1.2.orig/src/cfg_parser.c tcpproxy-1.2/src/cfg_parser.c +--- tcpproxy-1.2.orig/src/cfg_parser.c 1970-01-01 01:00:00.000000000 +0100 ++++ tcpproxy-1.2/src/cfg_parser.c 2015-05-17 18:10:54.933307372 +0200 +@@ -0,0 +1,1374 @@ ++ ++#line 1 "cfg_parser.rl" ++/* ++ * tcpproxy ++ * ++ * tcpproxy is a simple tcp connection proxy which combines the ++ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and ++ * IPv6 and also supports connections from IPv6 to IPv4 ++ * endpoints and vice versa. ++ * ++ * ++ * Copyright (C) 2010-2015 Christian Pointner ++ * ++ * This file is part of tcpproxy. ++ * ++ * tcpproxy is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * any later version. ++ * ++ * tcpproxy is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with tcpproxy. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "datatypes.h" ++#include "log.h" ++#include "options.h" ++#include "tcp.h" ++#include "listener.h" ++ ++struct listener { ++ char* la_; ++ resolv_type_t lrt_; ++ char* lp_; ++ char* ra_; ++ resolv_type_t rrt_; ++ char* rp_; ++ char* sa_; ++}; ++ ++static void init_listener_struct(struct listener* l) ++{ ++ if(!l) return; ++ ++ l->la_ = NULL; ++ l->lrt_ = ANY; ++ l->lp_ = NULL; ++ l->ra_ = NULL; ++ l->rrt_ = ANY; ++ l->rp_ = NULL; ++ l->sa_ = NULL; ++} ++ ++static void clear_listener_struct(struct listener* l) ++{ ++ if(!l) return; ++ ++ if(l->la_) ++ free(l->la_); ++ if(l->lp_) ++ free(l->lp_); ++ if(l->ra_) ++ free(l->ra_); ++ if(l->rp_) ++ free(l->rp_); ++ if(l->sa_) ++ free(l->sa_); ++ ++ init_listener_struct(l); ++} ++ ++static int owrt_string(char** dest, char* start, char* end) ++{ ++ if(!dest || start >= end) ++ return -1; ++ ++ if(*dest) free(*dest); ++ int n = end - start; ++ *dest = malloc(n+1); ++ if(!(*dest)) ++ return -2; ++ ++ memcpy(*dest, start, n); ++ (*dest)[n] = 0; ++ ++ return 0; ++} ++ ++ ++#line 162 "cfg_parser.rl" ++ ++ ++ ++int parse_listener(char* p, char* pe, listeners_t* listener) ++{ ++ int cs, ret = 0, cur_line = 1; ++ ++ ++#line 114 "cfg_parser.c" ++static const int cfg_parser_start = 67; ++static const int cfg_parser_first_final = 67; ++static const int cfg_parser_error = 0; ++ ++static const int cfg_parser_en_main = 67; ++ ++ ++#line 170 "cfg_parser.rl" ++ ++#line 124 "cfg_parser.c" ++ { ++ cs = cfg_parser_start; ++ } ++ ++#line 171 "cfg_parser.rl" ++ ++ char* cpy_start = NULL; ++ struct listener lst; ++ init_listener_struct(&lst); ++ ++ char* eof = pe; ++ ++#line 137 "cfg_parser.c" ++ { ++ if ( p == pe ) ++ goto _test_eof; ++ goto _resume; ++ ++_again: ++ switch ( cs ) { ++ case 67: goto st67; ++ case 0: goto st0; ++ case 1: goto st1; ++ case 2: goto st2; ++ case 3: goto st3; ++ case 4: goto st4; ++ case 5: goto st5; ++ case 6: goto st6; ++ case 7: goto st7; ++ case 8: goto st8; ++ case 9: goto st9; ++ case 10: goto st10; ++ case 11: goto st11; ++ case 12: goto st12; ++ case 13: goto st13; ++ case 14: goto st14; ++ case 15: goto st15; ++ case 16: goto st16; ++ case 17: goto st17; ++ case 18: goto st18; ++ case 19: goto st19; ++ case 20: goto st20; ++ case 21: goto st21; ++ case 22: goto st22; ++ case 23: goto st23; ++ case 24: goto st24; ++ case 25: goto st25; ++ case 26: goto st26; ++ case 27: goto st27; ++ case 28: goto st28; ++ case 29: goto st29; ++ case 30: goto st30; ++ case 31: goto st31; ++ case 32: goto st32; ++ case 33: goto st33; ++ case 34: goto st34; ++ case 35: goto st35; ++ case 36: goto st36; ++ case 37: goto st37; ++ case 38: goto st38; ++ case 39: goto st39; ++ case 40: goto st40; ++ case 41: goto st41; ++ case 42: goto st42; ++ case 43: goto st43; ++ case 44: goto st44; ++ case 45: goto st45; ++ case 46: goto st46; ++ case 47: goto st47; ++ case 48: goto st48; ++ case 49: goto st49; ++ case 50: goto st50; ++ case 51: goto st51; ++ case 52: goto st52; ++ case 53: goto st53; ++ case 54: goto st54; ++ case 55: goto st55; ++ case 56: goto st56; ++ case 57: goto st57; ++ case 58: goto st58; ++ case 59: goto st59; ++ case 60: goto st60; ++ case 61: goto st61; ++ case 62: goto st62; ++ case 63: goto st63; ++ case 64: goto st64; ++ case 65: goto st65; ++ case 66: goto st66; ++ default: break; ++ } ++ ++ if ( ++p == pe ) ++ goto _test_eof; ++_resume: ++ switch ( cs ) ++ { ++tr1: ++#line 127 "cfg_parser.rl" ++ {cur_line++;} ++ goto st67; ++tr90: ++#line 114 "cfg_parser.rl" ++ { ++ ret = listeners_add(listener, lst.la_, lst.lrt_, lst.lp_, lst.ra_, lst.rrt_, lst.rp_, lst.sa_); ++ clear_listener_struct(&lst); ++ } ++ goto st67; ++st67: ++ if ( ++p == pe ) ++ goto _test_eof67; ++case 67: ++#line 236 "cfg_parser.c" ++ switch( (*p) ) { ++ case 10: goto tr1; ++ case 32: goto st67; ++ case 35: goto st1; ++ case 108: goto st2; ++ } ++ if ( 9 <= (*p) && (*p) <= 13 ) ++ goto st67; ++ goto tr2; ++tr2: ++#line 118 "cfg_parser.rl" ++ { ++ if(p == eof) ++ log_printf(ERROR, "config file syntax error: unexpected end of file"); ++ else ++ log_printf(ERROR, "config file syntax error at line %d", cur_line); ++ ++ {cs = (cfg_parser_error); goto _again;} ++ } ++ goto st0; ++#line 257 "cfg_parser.c" ++st0: ++cs = 0; ++ goto _out; ++st1: ++ if ( ++p == pe ) ++ goto _test_eof1; ++case 1: ++ if ( (*p) == 10 ) ++ goto tr1; ++ goto st1; ++st2: ++ if ( ++p == pe ) ++ goto _test_eof2; ++case 2: ++ if ( (*p) == 105 ) ++ goto st3; ++ goto tr2; ++st3: ++ if ( ++p == pe ) ++ goto _test_eof3; ++case 3: ++ if ( (*p) == 115 ) ++ goto st4; ++ goto tr2; ++st4: ++ if ( ++p == pe ) ++ goto _test_eof4; ++case 4: ++ if ( (*p) == 116 ) ++ goto st5; ++ goto tr2; ++st5: ++ if ( ++p == pe ) ++ goto _test_eof5; ++case 5: ++ if ( (*p) == 101 ) ++ goto st6; ++ goto tr2; ++st6: ++ if ( ++p == pe ) ++ goto _test_eof6; ++case 6: ++ if ( (*p) == 110 ) ++ goto st7; ++ goto tr2; ++st7: ++ if ( ++p == pe ) ++ goto _test_eof7; ++case 7: ++ switch( (*p) ) { ++ case 9: goto st8; ++ case 32: goto st8; ++ } ++ goto tr2; ++st8: ++ if ( ++p == pe ) ++ goto _test_eof8; ++case 8: ++ switch( (*p) ) { ++ case 9: goto st8; ++ case 32: goto st8; ++ case 42: goto st9; ++ case 58: goto tr12; ++ } ++ if ( (*p) < 65 ) { ++ if ( (*p) > 46 ) { ++ if ( 48 <= (*p) && (*p) <= 57 ) ++ goto tr11; ++ } else if ( (*p) >= 45 ) ++ goto tr10; ++ } else if ( (*p) > 70 ) { ++ if ( (*p) < 97 ) { ++ if ( 71 <= (*p) && (*p) <= 90 ) ++ goto tr10; ++ } else if ( (*p) > 102 ) { ++ if ( 103 <= (*p) && (*p) <= 122 ) ++ goto tr10; ++ } else ++ goto tr11; ++ } else ++ goto tr11; ++ goto tr2; ++st9: ++ if ( ++p == pe ) ++ goto _test_eof9; ++case 9: ++ switch( (*p) ) { ++ case 9: goto st10; ++ case 32: goto st10; ++ } ++ goto tr2; ++tr91: ++#line 105 "cfg_parser.rl" ++ { ret = owrt_string(&(lst.la_), cpy_start, p); cpy_start = NULL; } ++ goto st10; ++st10: ++ if ( ++p == pe ) ++ goto _test_eof10; ++case 10: ++#line 357 "cfg_parser.c" ++ switch( (*p) ) { ++ case 9: goto st10; ++ case 32: goto st10; ++ case 45: goto tr14; ++ } ++ if ( (*p) < 65 ) { ++ if ( 48 <= (*p) && (*p) <= 57 ) ++ goto tr14; ++ } else if ( (*p) > 90 ) { ++ if ( 97 <= (*p) && (*p) <= 122 ) ++ goto tr14; ++ } else ++ goto tr14; ++ goto tr2; ++tr14: ++#line 104 "cfg_parser.rl" ++ { cpy_start = p; } ++ goto st11; ++st11: ++ if ( ++p == pe ) ++ goto _test_eof11; ++case 11: ++#line 380 "cfg_parser.c" ++ switch( (*p) ) { ++ case 10: goto tr16; ++ case 32: goto tr15; ++ case 35: goto tr17; ++ case 45: goto st11; ++ case 123: goto tr19; ++ } ++ if ( (*p) < 48 ) { ++ if ( 9 <= (*p) && (*p) <= 13 ) ++ goto tr15; ++ } else if ( (*p) > 57 ) { ++ if ( (*p) > 90 ) { ++ if ( 97 <= (*p) && (*p) <= 122 ) ++ goto st11; ++ } else if ( (*p) >= 65 ) ++ goto st11; ++ } else ++ goto st11; ++ goto tr2; ++tr21: ++#line 127 "cfg_parser.rl" ++ {cur_line++;} ++ goto st12; ++tr15: ++#line 106 "cfg_parser.rl" ++ { ret = owrt_string(&(lst.lp_), cpy_start, p); cpy_start = NULL; } ++ goto st12; ++tr16: ++#line 106 "cfg_parser.rl" ++ { ret = owrt_string(&(lst.lp_), cpy_start, p); cpy_start = NULL; } ++#line 127 "cfg_parser.rl" ++ {cur_line++;} ++ goto st12; ++st12: ++ if ( ++p == pe ) ++ goto _test_eof12; ++case 12: ++#line 418 "cfg_parser.c" ++ switch( (*p) ) { ++ case 10: goto tr21; ++ case 32: goto st12; ++ case 35: goto st13; ++ case 123: goto st14; ++ } ++ if ( 9 <= (*p) && (*p) <= 13 ) ++ goto st12; ++ goto tr2; ++tr17: ++#line 106 "cfg_parser.rl" ++ { ret = owrt_string(&(lst.lp_), cpy_start, p); cpy_start = NULL; } ++ goto st13; ++st13: ++ if ( ++p == pe ) ++ goto _test_eof13; ++case 13: ++#line 436 "cfg_parser.c" ++ if ( (*p) == 10 ) ++ goto tr21; ++ goto st13; ++tr24: ++#line 127 "cfg_parser.rl" ++ {cur_line++;} ++ goto st14; ++tr19: ++#line 106 "cfg_parser.rl" ++ { ret = owrt_string(&(lst.lp_), cpy_start, p); cpy_start = NULL; } ++ goto st14; ++tr48: ++#line 110 "cfg_parser.rl" ++ { ret = owrt_string(&(lst.rp_), cpy_start, p); cpy_start = NULL; } ++ goto st14; ++tr87: ++#line 113 "cfg_parser.rl" ++ { ret = owrt_string(&(lst.sa_), cpy_start, p); cpy_start = NULL; } ++ goto st14; ++st14: ++ if ( ++p == pe ) ++ goto _test_eof14; ++case 14: ++#line 460 "cfg_parser.c" ++ switch( (*p) ) { ++ case 10: goto tr24; ++ case 32: goto st14; ++ case 35: goto st15; ++ case 114: goto st16; ++ case 115: goto st52; ++ case 125: goto st63; ++ } ++ if ( 9 <= (*p) && (*p) <= 13 ) ++ goto st14; ++ goto tr2; ++st15: ++ if ( ++p == pe ) ++ goto _test_eof15; ++case 15: ++ if ( (*p) == 10 ) ++ goto tr24; ++ goto st15; ++st16: ++ if ( ++p == pe ) ++ goto _test_eof16; ++case 16: ++ if ( (*p) == 101 ) ++ goto st17; ++ goto tr2; ++st17: ++ if ( ++p == pe ) ++ goto _test_eof17; ++case 17: ++ switch( (*p) ) { ++ case 109: goto st18; ++ case 115: goto st43; ++ } ++ goto tr2; ++st18: ++ if ( ++p == pe ) ++ goto _test_eof18; ++case 18: ++ if ( (*p) == 111 ) ++ goto st19; ++ goto tr2; ++st19: ++ if ( ++p == pe ) ++ goto _test_eof19; ++case 19: ++ if ( (*p) == 116 ) ++ goto st20; ++ goto tr2; ++st20: ++ if ( ++p == pe ) ++ goto _test_eof20; ++case 20: ++ if ( (*p) == 101 ) ++ goto st21; ++ goto tr2; ++st21: ++ if ( ++p == pe ) ++ goto _test_eof21; ++case 21: ++ switch( (*p) ) { ++ case 9: goto st22; ++ case 32: goto st22; ++ case 45: goto st31; ++ case 58: goto st23; ++ } ++ goto tr2; ++st22: ++ if ( ++p == pe ) ++ goto _test_eof22; ++case 22: ++ switch( (*p) ) { ++ case 9: goto st22; ++ case 32: goto st22; ++ case 58: goto st23; ++ } ++ goto tr2; ++st23: ++ if ( ++p == pe ) ++ goto _test_eof23; ++case 23: ++ switch( (*p) ) { ++ case 9: goto st24; ++ case 32: goto st24; ++ } ++ goto tr2; ++st24: ++ if ( ++p == pe ) ++ goto _test_eof24; ++case 24: ++ switch( (*p) ) { ++ case 9: goto st24; ++ case 32: goto st24; ++ case 58: goto tr41; ++ } ++ if ( (*p) < 65 ) { ++ if ( (*p) > 46 ) { ++ if ( 48 <= (*p) && (*p) <= 57 ) ++ goto tr40; ++ } else if ( (*p) >= 45 ) ++ goto tr39; ++ } else if ( (*p) > 70 ) { ++ if ( (*p) < 97 ) { ++ if ( 71 <= (*p) && (*p) <= 90 ) ++ goto tr39; ++ } else if ( (*p) > 102 ) { ++ if ( 103 <= (*p) && (*p) <= 122 ) ++ goto tr39; ++ } else ++ goto tr40; ++ } else ++ goto tr40; ++ goto tr2; ++tr39: ++#line 104 "cfg_parser.rl" ++ { cpy_start = p; } ++ goto st25; ++st25: ++ if ( ++p == pe ) ++ goto _test_eof25; ++case 25: ++#line 581 "cfg_parser.c" ++ switch( (*p) ) { ++ case 9: goto tr42; ++ case 32: goto tr42; ++ } ++ if ( (*p) < 48 ) { ++ if ( 45 <= (*p) && (*p) <= 46 ) ++ goto st25; ++ } else if ( (*p) > 57 ) { ++ if ( (*p) > 90 ) { ++ if ( 97 <= (*p) && (*p) <= 122 ) ++ goto st25; ++ } else if ( (*p) >= 65 ) ++ goto st25; ++ } else ++ goto st25; ++ goto tr2; ++tr42: ++#line 109 "cfg_parser.rl" ++ { ret = owrt_string(&(lst.ra_), cpy_start, p); cpy_start = NULL; } ++ goto st26; ++st26: ++ if ( ++p == pe ) ++ goto _test_eof26; ++case 26: ++#line 606 "cfg_parser.c" ++ switch( (*p) ) { ++ case 9: goto st26; ++ case 32: goto st26; ++ case 45: goto tr45; ++ } ++ if ( (*p) < 65 ) { ++ if ( 48 <= (*p) && (*p) <= 57 ) ++ goto tr45; ++ } else if ( (*p) > 90 ) { ++ if ( 97 <= (*p) && (*p) <= 122 ) ++ goto tr45; ++ } else ++ goto tr45; ++ goto tr2; ++tr45: ++#line 104 "cfg_parser.rl" ++ { cpy_start = p; } ++ goto st27; ++st27: ++ if ( ++p == pe ) ++ goto _test_eof27; ++case 27: ++#line 629 "cfg_parser.c" ++ switch( (*p) ) { ++ case 9: goto tr46; ++ case 32: goto tr46; ++ case 45: goto st27; ++ case 59: goto tr48; ++ } ++ if ( (*p) < 65 ) { ++ if ( 48 <= (*p) && (*p) <= 57 ) ++ goto st27; ++ } else if ( (*p) > 90 ) { ++ if ( 97 <= (*p) && (*p) <= 122 ) ++ goto st27; ++ } else ++ goto st27; ++ goto tr2; ++tr46: ++#line 110 "cfg_parser.rl" ++ { ret = owrt_string(&(lst.rp_), cpy_start, p); cpy_start = NULL; } ++ goto st28; ++tr63: ++#line 111 "cfg_parser.rl" ++ { lst.rrt_ = IPV4_ONLY; } ++ goto st28; ++tr64: ++#line 112 "cfg_parser.rl" ++ { lst.rrt_ = IPV6_ONLY; } ++ goto st28; ++tr73: ++#line 107 "cfg_parser.rl" ++ { lst.lrt_ = IPV4_ONLY; } ++ goto st28; ++tr74: ++#line 108 "cfg_parser.rl" ++ { lst.lrt_ = IPV6_ONLY; } ++ goto st28; ++tr85: ++#line 113 "cfg_parser.rl" ++ { ret = owrt_string(&(lst.sa_), cpy_start, p); cpy_start = NULL; } ++ goto st28; ++st28: ++ if ( ++p == pe ) ++ goto _test_eof28; ++case 28: ++#line 673 "cfg_parser.c" ++ switch( (*p) ) { ++ case 9: goto st28; ++ case 32: goto st28; ++ case 59: goto st14; ++ } ++ goto tr2; ++tr40: ++#line 104 "cfg_parser.rl" ++ { cpy_start = p; } ++ goto st29; ++st29: ++ if ( ++p == pe ) ++ goto _test_eof29; ++case 29: ++#line 688 "cfg_parser.c" ++ switch( (*p) ) { ++ case 9: goto tr42; ++ case 32: goto tr42; ++ case 58: goto st30; ++ } ++ if ( (*p) < 65 ) { ++ if ( (*p) > 46 ) { ++ if ( 48 <= (*p) && (*p) <= 57 ) ++ goto st29; ++ } else if ( (*p) >= 45 ) ++ goto st25; ++ } else if ( (*p) > 70 ) { ++ if ( (*p) < 97 ) { ++ if ( 71 <= (*p) && (*p) <= 90 ) ++ goto st25; ++ } else if ( (*p) > 102 ) { ++ if ( 103 <= (*p) && (*p) <= 122 ) ++ goto st25; ++ } else ++ goto st29; ++ } else ++ goto st29; ++ goto tr2; ++tr41: ++#line 104 "cfg_parser.rl" ++ { cpy_start = p; } ++ goto st30; ++st30: ++ if ( ++p == pe ) ++ goto _test_eof30; ++case 30: ++#line 720 "cfg_parser.c" ++ switch( (*p) ) { ++ case 9: goto tr42; ++ case 32: goto tr42; ++ } ++ if ( (*p) < 65 ) { ++ if ( 48 <= (*p) && (*p) <= 58 ) ++ goto st30; ++ } else if ( (*p) > 70 ) { ++ if ( 97 <= (*p) && (*p) <= 102 ) ++ goto st30; ++ } else ++ goto st30; ++ goto tr2; ++st31: ++ if ( ++p == pe ) ++ goto _test_eof31; ++case 31: ++ if ( (*p) == 114 ) ++ goto st32; ++ goto tr2; ++st32: ++ if ( ++p == pe ) ++ goto _test_eof32; ++case 32: ++ if ( (*p) == 101 ) ++ goto st33; ++ goto tr2; ++st33: ++ if ( ++p == pe ) ++ goto _test_eof33; ++case 33: ++ if ( (*p) == 115 ) ++ goto st34; ++ goto tr2; ++st34: ++ if ( ++p == pe ) ++ goto _test_eof34; ++case 34: ++ if ( (*p) == 111 ) ++ goto st35; ++ goto tr2; ++st35: ++ if ( ++p == pe ) ++ goto _test_eof35; ++case 35: ++ if ( (*p) == 108 ) ++ goto st36; ++ goto tr2; ++st36: ++ if ( ++p == pe ) ++ goto _test_eof36; ++case 36: ++ if ( (*p) == 118 ) ++ goto st37; ++ goto tr2; ++st37: ++ if ( ++p == pe ) ++ goto _test_eof37; ++case 37: ++ switch( (*p) ) { ++ case 9: goto st37; ++ case 32: goto st37; ++ case 58: goto st38; ++ } ++ goto tr2; ++st38: ++ if ( ++p == pe ) ++ goto _test_eof38; ++case 38: ++ switch( (*p) ) { ++ case 9: goto st39; ++ case 32: goto st39; ++ } ++ goto tr2; ++st39: ++ if ( ++p == pe ) ++ goto _test_eof39; ++case 39: ++ switch( (*p) ) { ++ case 9: goto st39; ++ case 32: goto st39; ++ case 73: goto st40; ++ case 105: goto st40; ++ } ++ goto tr2; ++st40: ++ if ( ++p == pe ) ++ goto _test_eof40; ++case 40: ++ switch( (*p) ) { ++ case 80: goto st41; ++ case 112: goto st41; ++ } ++ goto tr2; ++st41: ++ if ( ++p == pe ) ++ goto _test_eof41; ++case 41: ++ switch( (*p) ) { ++ case 86: goto st42; ++ case 118: goto st42; ++ } ++ goto tr2; ++st42: ++ if ( ++p == pe ) ++ goto _test_eof42; ++case 42: ++ switch( (*p) ) { ++ case 52: goto tr63; ++ case 54: goto tr64; ++ } ++ goto tr2; ++st43: ++ if ( ++p == pe ) ++ goto _test_eof43; ++case 43: ++ if ( (*p) == 111 ) ++ goto st44; ++ goto tr2; ++st44: ++ if ( ++p == pe ) ++ goto _test_eof44; ++case 44: ++ if ( (*p) == 108 ) ++ goto st45; ++ goto tr2; ++st45: ++ if ( ++p == pe ) ++ goto _test_eof45; ++case 45: ++ if ( (*p) == 118 ) ++ goto st46; ++ goto tr2; ++st46: ++ if ( ++p == pe ) ++ goto _test_eof46; ++case 46: ++ switch( (*p) ) { ++ case 9: goto st46; ++ case 32: goto st46; ++ case 58: goto st47; ++ } ++ goto tr2; ++st47: ++ if ( ++p == pe ) ++ goto _test_eof47; ++case 47: ++ switch( (*p) ) { ++ case 9: goto st48; ++ case 32: goto st48; ++ } ++ goto tr2; ++st48: ++ if ( ++p == pe ) ++ goto _test_eof48; ++case 48: ++ switch( (*p) ) { ++ case 9: goto st48; ++ case 32: goto st48; ++ case 73: goto st49; ++ case 105: goto st49; ++ } ++ goto tr2; ++st49: ++ if ( ++p == pe ) ++ goto _test_eof49; ++case 49: ++ switch( (*p) ) { ++ case 80: goto st50; ++ case 112: goto st50; ++ } ++ goto tr2; ++st50: ++ if ( ++p == pe ) ++ goto _test_eof50; ++case 50: ++ switch( (*p) ) { ++ case 86: goto st51; ++ case 118: goto st51; ++ } ++ goto tr2; ++st51: ++ if ( ++p == pe ) ++ goto _test_eof51; ++case 51: ++ switch( (*p) ) { ++ case 52: goto tr73; ++ case 54: goto tr74; ++ } ++ goto tr2; ++st52: ++ if ( ++p == pe ) ++ goto _test_eof52; ++case 52: ++ if ( (*p) == 111 ) ++ goto st53; ++ goto tr2; ++st53: ++ if ( ++p == pe ) ++ goto _test_eof53; ++case 53: ++ if ( (*p) == 117 ) ++ goto st54; ++ goto tr2; ++st54: ++ if ( ++p == pe ) ++ goto _test_eof54; ++case 54: ++ if ( (*p) == 114 ) ++ goto st55; ++ goto tr2; ++st55: ++ if ( ++p == pe ) ++ goto _test_eof55; ++case 55: ++ if ( (*p) == 99 ) ++ goto st56; ++ goto tr2; ++st56: ++ if ( ++p == pe ) ++ goto _test_eof56; ++case 56: ++ if ( (*p) == 101 ) ++ goto st57; ++ goto tr2; ++st57: ++ if ( ++p == pe ) ++ goto _test_eof57; ++case 57: ++ switch( (*p) ) { ++ case 9: goto st57; ++ case 32: goto st57; ++ case 58: goto st58; ++ } ++ goto tr2; ++st58: ++ if ( ++p == pe ) ++ goto _test_eof58; ++case 58: ++ switch( (*p) ) { ++ case 9: goto st59; ++ case 32: goto st59; ++ } ++ goto tr2; ++st59: ++ if ( ++p == pe ) ++ goto _test_eof59; ++case 59: ++ switch( (*p) ) { ++ case 9: goto st59; ++ case 32: goto st59; ++ case 58: goto tr84; ++ } ++ if ( (*p) < 65 ) { ++ if ( (*p) > 46 ) { ++ if ( 48 <= (*p) && (*p) <= 57 ) ++ goto tr83; ++ } else if ( (*p) >= 45 ) ++ goto tr82; ++ } else if ( (*p) > 70 ) { ++ if ( (*p) < 97 ) { ++ if ( 71 <= (*p) && (*p) <= 90 ) ++ goto tr82; ++ } else if ( (*p) > 102 ) { ++ if ( 103 <= (*p) && (*p) <= 122 ) ++ goto tr82; ++ } else ++ goto tr83; ++ } else ++ goto tr83; ++ goto tr2; ++tr82: ++#line 104 "cfg_parser.rl" ++ { cpy_start = p; } ++ goto st60; ++st60: ++ if ( ++p == pe ) ++ goto _test_eof60; ++case 60: ++#line 1000 "cfg_parser.c" ++ switch( (*p) ) { ++ case 9: goto tr85; ++ case 32: goto tr85; ++ case 59: goto tr87; ++ } ++ if ( (*p) < 48 ) { ++ if ( 45 <= (*p) && (*p) <= 46 ) ++ goto st60; ++ } else if ( (*p) > 57 ) { ++ if ( (*p) > 90 ) { ++ if ( 97 <= (*p) && (*p) <= 122 ) ++ goto st60; ++ } else if ( (*p) >= 65 ) ++ goto st60; ++ } else ++ goto st60; ++ goto tr2; ++tr83: ++#line 104 "cfg_parser.rl" ++ { cpy_start = p; } ++ goto st61; ++st61: ++ if ( ++p == pe ) ++ goto _test_eof61; ++case 61: ++#line 1026 "cfg_parser.c" ++ switch( (*p) ) { ++ case 9: goto tr85; ++ case 32: goto tr85; ++ case 58: goto st62; ++ case 59: goto tr87; ++ } ++ if ( (*p) < 65 ) { ++ if ( (*p) > 46 ) { ++ if ( 48 <= (*p) && (*p) <= 57 ) ++ goto st61; ++ } else if ( (*p) >= 45 ) ++ goto st60; ++ } else if ( (*p) > 70 ) { ++ if ( (*p) < 97 ) { ++ if ( 71 <= (*p) && (*p) <= 90 ) ++ goto st60; ++ } else if ( (*p) > 102 ) { ++ if ( 103 <= (*p) && (*p) <= 122 ) ++ goto st60; ++ } else ++ goto st61; ++ } else ++ goto st61; ++ goto tr2; ++tr84: ++#line 104 "cfg_parser.rl" ++ { cpy_start = p; } ++ goto st62; ++st62: ++ if ( ++p == pe ) ++ goto _test_eof62; ++case 62: ++#line 1059 "cfg_parser.c" ++ switch( (*p) ) { ++ case 9: goto tr85; ++ case 32: goto tr85; ++ case 59: goto tr87; ++ } ++ if ( (*p) < 65 ) { ++ if ( 48 <= (*p) && (*p) <= 58 ) ++ goto st62; ++ } else if ( (*p) > 70 ) { ++ if ( 97 <= (*p) && (*p) <= 102 ) ++ goto st62; ++ } else ++ goto st62; ++ goto tr2; ++st63: ++ if ( ++p == pe ) ++ goto _test_eof63; ++case 63: ++ if ( (*p) == 59 ) ++ goto tr90; ++ goto tr2; ++tr10: ++#line 104 "cfg_parser.rl" ++ { cpy_start = p; } ++ goto st64; ++st64: ++ if ( ++p == pe ) ++ goto _test_eof64; ++case 64: ++#line 1089 "cfg_parser.c" ++ switch( (*p) ) { ++ case 9: goto tr91; ++ case 32: goto tr91; ++ } ++ if ( (*p) < 48 ) { ++ if ( 45 <= (*p) && (*p) <= 46 ) ++ goto st64; ++ } else if ( (*p) > 57 ) { ++ if ( (*p) > 90 ) { ++ if ( 97 <= (*p) && (*p) <= 122 ) ++ goto st64; ++ } else if ( (*p) >= 65 ) ++ goto st64; ++ } else ++ goto st64; ++ goto tr2; ++tr11: ++#line 104 "cfg_parser.rl" ++ { cpy_start = p; } ++ goto st65; ++st65: ++ if ( ++p == pe ) ++ goto _test_eof65; ++case 65: ++#line 1114 "cfg_parser.c" ++ switch( (*p) ) { ++ case 9: goto tr91; ++ case 32: goto tr91; ++ case 58: goto st66; ++ } ++ if ( (*p) < 65 ) { ++ if ( (*p) > 46 ) { ++ if ( 48 <= (*p) && (*p) <= 57 ) ++ goto st65; ++ } else if ( (*p) >= 45 ) ++ goto st64; ++ } else if ( (*p) > 70 ) { ++ if ( (*p) < 97 ) { ++ if ( 71 <= (*p) && (*p) <= 90 ) ++ goto st64; ++ } else if ( (*p) > 102 ) { ++ if ( 103 <= (*p) && (*p) <= 122 ) ++ goto st64; ++ } else ++ goto st65; ++ } else ++ goto st65; ++ goto tr2; ++tr12: ++#line 104 "cfg_parser.rl" ++ { cpy_start = p; } ++ goto st66; ++st66: ++ if ( ++p == pe ) ++ goto _test_eof66; ++case 66: ++#line 1146 "cfg_parser.c" ++ switch( (*p) ) { ++ case 9: goto tr91; ++ case 32: goto tr91; ++ } ++ if ( (*p) < 65 ) { ++ if ( 48 <= (*p) && (*p) <= 58 ) ++ goto st66; ++ } else if ( (*p) > 70 ) { ++ if ( 97 <= (*p) && (*p) <= 102 ) ++ goto st66; ++ } else ++ goto st66; ++ goto tr2; ++ } ++ _test_eof67: cs = 67; goto _test_eof; ++ _test_eof1: cs = 1; goto _test_eof; ++ _test_eof2: cs = 2; goto _test_eof; ++ _test_eof3: cs = 3; goto _test_eof; ++ _test_eof4: cs = 4; goto _test_eof; ++ _test_eof5: cs = 5; goto _test_eof; ++ _test_eof6: cs = 6; goto _test_eof; ++ _test_eof7: cs = 7; goto _test_eof; ++ _test_eof8: cs = 8; goto _test_eof; ++ _test_eof9: cs = 9; goto _test_eof; ++ _test_eof10: cs = 10; goto _test_eof; ++ _test_eof11: cs = 11; goto _test_eof; ++ _test_eof12: cs = 12; goto _test_eof; ++ _test_eof13: cs = 13; goto _test_eof; ++ _test_eof14: cs = 14; goto _test_eof; ++ _test_eof15: cs = 15; goto _test_eof; ++ _test_eof16: cs = 16; goto _test_eof; ++ _test_eof17: cs = 17; goto _test_eof; ++ _test_eof18: cs = 18; goto _test_eof; ++ _test_eof19: cs = 19; goto _test_eof; ++ _test_eof20: cs = 20; goto _test_eof; ++ _test_eof21: cs = 21; goto _test_eof; ++ _test_eof22: cs = 22; goto _test_eof; ++ _test_eof23: cs = 23; goto _test_eof; ++ _test_eof24: cs = 24; goto _test_eof; ++ _test_eof25: cs = 25; goto _test_eof; ++ _test_eof26: cs = 26; goto _test_eof; ++ _test_eof27: cs = 27; goto _test_eof; ++ _test_eof28: cs = 28; goto _test_eof; ++ _test_eof29: cs = 29; goto _test_eof; ++ _test_eof30: cs = 30; goto _test_eof; ++ _test_eof31: cs = 31; goto _test_eof; ++ _test_eof32: cs = 32; goto _test_eof; ++ _test_eof33: cs = 33; goto _test_eof; ++ _test_eof34: cs = 34; goto _test_eof; ++ _test_eof35: cs = 35; goto _test_eof; ++ _test_eof36: cs = 36; goto _test_eof; ++ _test_eof37: cs = 37; goto _test_eof; ++ _test_eof38: cs = 38; goto _test_eof; ++ _test_eof39: cs = 39; goto _test_eof; ++ _test_eof40: cs = 40; goto _test_eof; ++ _test_eof41: cs = 41; goto _test_eof; ++ _test_eof42: cs = 42; goto _test_eof; ++ _test_eof43: cs = 43; goto _test_eof; ++ _test_eof44: cs = 44; goto _test_eof; ++ _test_eof45: cs = 45; goto _test_eof; ++ _test_eof46: cs = 46; goto _test_eof; ++ _test_eof47: cs = 47; goto _test_eof; ++ _test_eof48: cs = 48; goto _test_eof; ++ _test_eof49: cs = 49; goto _test_eof; ++ _test_eof50: cs = 50; goto _test_eof; ++ _test_eof51: cs = 51; goto _test_eof; ++ _test_eof52: cs = 52; goto _test_eof; ++ _test_eof53: cs = 53; goto _test_eof; ++ _test_eof54: cs = 54; goto _test_eof; ++ _test_eof55: cs = 55; goto _test_eof; ++ _test_eof56: cs = 56; goto _test_eof; ++ _test_eof57: cs = 57; goto _test_eof; ++ _test_eof58: cs = 58; goto _test_eof; ++ _test_eof59: cs = 59; goto _test_eof; ++ _test_eof60: cs = 60; goto _test_eof; ++ _test_eof61: cs = 61; goto _test_eof; ++ _test_eof62: cs = 62; goto _test_eof; ++ _test_eof63: cs = 63; goto _test_eof; ++ _test_eof64: cs = 64; goto _test_eof; ++ _test_eof65: cs = 65; goto _test_eof; ++ _test_eof66: cs = 66; goto _test_eof; ++ ++ _test_eof: {} ++ if ( p == eof ) ++ { ++ switch ( cs ) { ++ case 1: ++ case 2: ++ case 3: ++ case 4: ++ case 5: ++ case 6: ++ case 7: ++ case 8: ++ case 9: ++ case 10: ++ case 11: ++ case 12: ++ case 13: ++ case 14: ++ case 15: ++ case 16: ++ case 17: ++ case 18: ++ case 19: ++ case 20: ++ case 21: ++ case 22: ++ case 23: ++ case 24: ++ case 25: ++ case 26: ++ case 27: ++ case 28: ++ case 29: ++ case 30: ++ case 31: ++ case 32: ++ case 33: ++ case 34: ++ case 35: ++ case 36: ++ case 37: ++ case 38: ++ case 39: ++ case 40: ++ case 41: ++ case 42: ++ case 43: ++ case 44: ++ case 45: ++ case 46: ++ case 47: ++ case 48: ++ case 49: ++ case 50: ++ case 51: ++ case 52: ++ case 53: ++ case 54: ++ case 55: ++ case 56: ++ case 57: ++ case 58: ++ case 59: ++ case 60: ++ case 61: ++ case 62: ++ case 63: ++ case 64: ++ case 65: ++ case 66: ++#line 118 "cfg_parser.rl" ++ { ++ if(p == eof) ++ log_printf(ERROR, "config file syntax error: unexpected end of file"); ++ else ++ log_printf(ERROR, "config file syntax error at line %d", cur_line); ++ ++ {cs = (cfg_parser_error); goto _again;} ++ } ++ break; ++#line 1309 "cfg_parser.c" ++ } ++ } ++ ++ _out: {} ++ } ++ ++#line 178 "cfg_parser.rl" ++ ++ if(cs == cfg_parser_error) { ++ listeners_revert(listener); ++ ret = 1; ++ } ++ else ++ ret = listeners_update(listener); ++ ++ clear_listener_struct(&lst); ++ ++ return ret; ++} ++ ++int read_configfile(const char* filename, listeners_t* listener) ++{ ++ int fd = open(filename, 0); ++ if(fd < 0) { ++ log_printf(ERROR, "open('%s') failed: %s", filename, strerror(errno)); ++ return -1; ++ } ++ ++ struct stat sb; ++ if(fstat(fd, &sb) == -1) { ++ log_printf(ERROR, "fstat() error: %s", strerror(errno)); ++ close(fd); ++ return -1; ++ } ++ ++ if(!sb.st_size) { ++ log_printf(ERROR, "config file %s is empty", filename); ++ close(fd); ++ return -1; ++ } ++ ++ if(!S_ISREG(sb.st_mode)) { ++ log_printf(ERROR, "config file %s is not a regular file", filename); ++ close(fd); ++ return -1; ++ } ++ ++ char* p = (char*)mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, fd, 0); ++ if(p == MAP_FAILED) { ++ log_printf(ERROR, "mmap() error: %s", strerror(errno)); ++ close(fd); ++ return -1; ++ } ++ close(fd); ++ ++ log_printf(DEBUG, "mapped %ld bytes from file %s at address 0x%08lX", sb.st_size, filename, p); ++ int ret = parse_listener(p, p + sb.st_size, listener); ++ ++ if(munmap(p, sb.st_size) == -1) { ++ log_printf(ERROR, "munmap() error: %s", strerror(errno)); ++ return -1; ++ } ++ log_printf(DEBUG, "unmapped file %s", filename); ++ ++ return ret; ++} diff --git a/net/tcpreplay/Makefile b/net/tcpreplay/Makefile new file mode 100644 index 0000000..d7dce05 --- /dev/null +++ b/net/tcpreplay/Makefile @@ -0,0 +1,158 @@ +# +# Copyright (C) 2016 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:=tcpreplay +PKG_VERSION:=4.1.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/appneta/tcpreplay/releases/download/v$(PKG_VERSION) +PKG_MD5SUM:=3105b10b07dbc0b07ce2da07a2368359 + +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=docs/LICENSE + +PKG_FIXUP:=libtool +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +TCPREPLAY_MODULES:= \ + tcpbridge tcpcapinfo tcpliveplay tcpprep \ + tcpreplay tcpreplay-edit tcprewrite + +define Package/tcpreplay/default + SUBMENU:=tcprelay + SECTION:=net + CATEGORY:=Network + URL:=http://tcpreplay.appneta.com/ + MAINTAINER:=Alexandru Ardelean + DEPENDS:=+librt +libpcap +endef + +define Package/tcpbridge +$(call Package/tcpreplay/default) + TITLE:=Bridge network traffic across two interfaces +endef + +define Package/tcpcapinfo +$(call Package/tcpreplay/default) + TITLE:=Pcap file dissector for debugging broken pcap files +endef + +define Package/tcpliveplay +$(call Package/tcpreplay/default) + TITLE:=Replays network traffic stored in a pcap file on live networks using new TCP connections +endef + +define Package/tcpprep +$(call Package/tcpreplay/default) + TITLE:=Create a tcpreplay cache file from a pcap file +endef + +define Package/tcpreplay +$(call Package/tcpreplay/default) + TITLE:=Replay network traffic stored in pcap files +endef + +define Package/tcpreplay-edit +$(call Package/tcpreplay/default) + TITLE:=Replay network traffic stored in pcap files +endef + +define Package/tcprewrite +$(call Package/tcpreplay/default) + TITLE:=Rewrite the packets in a pcap file +endef + +define Package/tcpreplay-all +$(call Package/tcpreplay/default) + TITLE:=Pcap editing and replaying utilities + DEPENDS:=$(foreach m,$(TCPREPLAY_MODULES),+$(m)) +endef + +define Package/tcpbridge/description + tcpbridge is a tool for selectively briding network traffic across two + interfaces and optionally modifying the packets in between +endef + +define Package/tcpcapinfo/description + tcpcapinfo is a tool for decoding the structure of a pcap(3) file with a + focus on finding broken pcap files and determining how two related pcap + files might differ. +endef + +define Package/tcpliveplay/description + This program, 'tcpliveplay' replays a captured set of packets using new TCP + connections with the captured TCP payloads against a remote host in order + to do comprehensive vulnerability testings. +endef + +define Package/tcpprep/description + tcpprep is a ``pcap(3)'' file pre-processor which creates a cache file + which provides "rules" for ``tcprewrite(1)'' and ``tcpreplay(1)'' on how to + process and send packets. +endef + +define Package/tcpreplay/description + tcpreplay is a tool for replaying network traffic from files saved with + tcpdump or other tools which write pcap(3) files. +endef + +define Package/tcpreplay-edit/description + tcpreplay-edit includes all the functionality of both tcpreplay + and tcprewrite. +endef + +define Package/tcprewrite/description + Rewrite/edit the packets in a pcap file +endef + +define Package/tcpreplay-all/description + Tcpreplay is a suite of free Open Source utilities for + editing and replaying previously captured network traffic. + Originally designed to replay malicious traffic patterns to + Intrusion Detection/Prevention Systems, it has seen many evolutions + including capabilities to replay to web servers. + + Version 4.0.0 introduces features and performance enhancements + to support switches, routers, and IP Flow/NetFlow appliances. +endef + +CONFIGURE_VARS += \ + ac_cv_lib_nl_nl_cache_alloc=no \ + ac_cv_lib_nl_genl_3_genl_connect=no \ + ac_cv_lib_nl_3_nl_cache_alloc=no \ + ac_cv_lib_dbus_1_dbus_malloc=no + +CONFIGURE_ARGS += \ + --enable-force-pf \ + --enable-dynamic-link \ + --prefix="$(PKG_INSTALL_DIR)/usr" \ + --exec-prefix="$(PKG_INSTALL_DIR)/usr" \ + --with-libpcap="$(STAGING_DIR)/usr" + +define tcpreplayTemplate + define Package/$(1)/install + $(INSTALL_DIR) $$(1)/usr/bin ; \ + $(CP) $$(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin + endef +endef + +define Package/tcpreplay-all/install + : +endef + +$(foreach m, $(TCPREPLAY_MODULES), \ + $(eval $(call tcpreplayTemplate,$(m))) \ + $(eval $(call BuildPackage,$(m))) \ +) + +$(eval $(call BuildPackage,tcpreplay-all)) + diff --git a/net/tgt/Makefile b/net/tgt/Makefile new file mode 100644 index 0000000..3a01173 --- /dev/null +++ b/net/tgt/Makefile @@ -0,0 +1,62 @@ +# +# Copyright (C) 2012-2016 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:=tgt +PKG_VERSION:=1.0.65 +PKG_REV:=c8f86393d2ea3f37b64963f66af240f17d88b43d +PKG_RELEASE:=1 +PKG_USE_MIPS16:=0 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/fujita/tgt.git + +PKG_SOURCE_VERSION:=$(PKG_REV) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_REV).tar.gz +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_MAINTAINER:=Maxim Storchak +PKG_LICENSE:=GPL-2.0 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) + +include $(INCLUDE_DIR)/package.mk + +define Package/tgt + SECTION:=net + CATEGORY:=Network + URL:=http://stgt.sourceforge.net/ + TITLE:=userspace iSCSI target + DEPENDS:=+libpthread +libaio @KERNEL_AIO @KERNEL_DIRECT_IO +endef + +define Package/tgt/description +Linux SCSI target framework (tgt) aims to simplify various SCSI target driver (iSCSI, Fibre Channel, SRP, etc) creation and maintenance. +Key goals of the project are the clean integration into the scsi-mid layer and implementing a great portion of tgt in user space. +Tgt consists of kernel-space and user-space code. The kernel-space component is included in upstream as of 2.6.20. +Note that if you are interested in only iSCSI (probably you are), you need only the user-space code (any kernel version is fine). +endef + +define Build/Compile + CC=$(TARGET_CC) CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + LD="$(TARGET_CC)" \ + install-programs +endef + +define Package/tgt/conffiles +/etc/config/tgt +endef + +define Package/tgt/install + $(INSTALL_DIR) $(1)/ + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) ./files/* $(1)/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/tgtd $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/tgtadm $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,tgt)) diff --git a/net/tgt/files/etc/config/tgt b/net/tgt/files/etc/config/tgt new file mode 100644 index 0000000..de5239d --- /dev/null +++ b/net/tgt/files/etc/config/tgt @@ -0,0 +1,64 @@ +config options 'tgt' +# iothreads limits number of worker threads per rdwr target, default is 16 +# which seems to be too much for an avarage router + option iothreads '2' +# option nop_count '3' +# option nop_interval '1' +# list portal '[::1]' +# list portal '127.0.0.1:3261' +# list portal '0.0.0.0:3262' +# list portal '[::]:3263' + +config target 1 + option name 'iqn.2012-06.org.openwrt:target1' +# list allow_name 'iqn.1994-05.org.example:fedcba987654' +# list allow_address '192.168.2.128/27' + +#config target 2 +# option name 'iqn.2012-06.org.openwrt:t2' + +# all options are set to default, except for the device +# lun "name" is constructed as TGTID_LUN +#config lun 1_1 +# option 'device' '/dev/sda' +# type of scsi device. available options: disk, cd, pt (sg passthrough) +# option 'type' 'disk' +# backing store access method: rdwr (read-write), aio (async IO), sg (for pt type only, device must be /dev/sgN) +# option 'bstype' 'aio' +# set sync and/or direct flags when opening device, affect only rdwr +# option 'sync' '0' +# option 'direct' '0' +# block size for lun, default is 512 +# option 'blocksize' 4096 +# override SCSI mode page, see tgtadm man page for details +# option 'mode_page' 'string' +# vendor, product, revision, SCSI ID and SCSI Serial number +# option 'vendor_id' 'string' +# option 'product_id' 'string' +# option 'product_rev' 'string' +# option 'scsi_id' 'string' +# option 'scsi_sn' 'string' +# refuse write attempts. applies only to disk type +# option 'readonly' '0' +# Disk devices default to non-removable, cd - to removable +# option 'removable' '0' +# 0 = Classic sense format, 1 = Support descriptor format. +# option 'sense_format' '0' + +#config lun 2_1 +# option device /mnt/iscsi.img + +#config lun 2_2 +# option device /dev/sdc + +#config account +# list target 1 +# list target 2 +# option user "username1" +# option password "pass1" + +#config account +# option target 2 +# option user "user2" +# option password "pwd2" +# option outgoing 1 diff --git a/net/tgt/files/etc/init.d/tgt b/net/tgt/files/etc/init.d/tgt new file mode 100755 index 0000000..bd5f983 --- /dev/null +++ b/net/tgt/files/etc/init.d/tgt @@ -0,0 +1,237 @@ +#!/bin/sh /etc/rc.common +START=91 +STOP=10 + +EXTRA_COMMANDS="show" +EXTRA_HELP=" show Show current configuration of tgtd" + +NAME=tgt +PROG=/usr/sbin/tgtd +USE_PROCD=1 + +tgtadm="/usr/sbin/tgtadm --lld iscsi" +logger="logger -p daemon.err -s -t $NAME" + +validate_lun_section() { + uci_validate_section tgt lun $1 \ + 'device:or(file, device)' \ + 'type:or("disk", "cd", "pt"):disk' \ + 'bstype:or("rdwr", "aio", "sg"):rdwr' \ + 'sync:bool:0' \ + 'direct:bool:0' \ + 'blocksize:uinteger' \ + 'mode_page:string' \ + 'product_id:string' \ + 'product_rev:string' \ + 'readonly:bool:0' \ + 'removable:bool' \ + 'scsi_id:string' \ + 'scsi_sn:string' \ + 'sense_format:range(0, 1)' \ + 'vendor_id:string' +} + +handle_lun() { + local tgt_lun=$1 + local tgtid=$2 + local readonly device type bstype sync direct + local my_tgtid=${tgt_lun%_*} + local lun=${tgt_lun#*_} + + [ $my_tgtid -eq $tgtid ] || return 0 + + validate_lun_section $tgt_lun || { + $logger "Validation failed for LUN $tgt_lun" + return 1 + } + [ "$device" ] || { + $logger "Device is required for target $tgt_lun" + return 1 + } + + if [ $sync -ne 0 -o $direct -ne 0 ]; then + local bsoflags + [ $sync -ne 0 ] && bsoflags="sync" + [ $direct -ne 0 ] && bsoflags="direct" + [ $sync -ne 0 -a $direct -ne 0 ] && bsoflags="sync:direct" + bsoflags="--bsoflags $bsoflags" + fi + + blocksize=${blocksize+--blocksize=$blocksize} + local params='' i + for i in mode_page product_id product_rev readonly removable scsi_id scsi_sn sense_format vendor_id; do + eval params=\${$i+$i=\$$i,}\$params + done + + local _tgtadm="$tgtadm --mode logicalunit --tid $tgtid --lun $lun" + $_tgtadm --op new --backing-store $device --device-type $type --bstype $bstype --bstype $bstype $bsoflags $blocksize || { + $logger "Failed to create lun $tgt_lun" + return 1 + } + $_tgtadm --op update --param $params || { + $logger "Failed to update lun $tgt_lun" + return 1 + } +} + +validate_account_section () { + uci_validate_section tgt account $1 \ + 'target:list(uinteger)' \ + 'user:string' \ + 'password:string' \ + 'outgoing:bool:0' +} + +handle_account() { + local _tgtadm="$tgtadm --mode account" + local user password target outgoing + + validate_account_section $1 || { + $logger "Validation failed for account ${user:-$1}" + return 1 + } + [ "$user" ] || { + $logger "User is required for account $1. Run 'uci show tgt.$1' and check options" + return 1 + } + [ "$target" ] || { + $logger "Target is required for account $user" + return 1 + } + [ "$password" ] || { + $logger "Password is required for account $user" + return 1 + } + $_tgtadm --op new --user "$user" --password "$password" || { + $logger "Failed to create user $username" + return 1 + } +} + +bind_account_to_target() { + local _tgtadm="$tgtadm --mode account" + local tgtid=$2 user password outgoing + + validate_account_section $1 || { + $logger "Validation failed for account ${user:-$1}" + return 1 + } + + [ "$outgoing" -ne 0 ] && outgoing=--outgoing || outgoing="" + local t + for t in $target; do + [ "$t" -eq "$tgtid" ] && { + $_tgtadm --op bind --tid $tgtid --user "$user" $outgoing || { + $logger "Failed to bind user $username to target $tgtid" + return 1 + } + } + done + return 0 +} + +validate_target_section() { + uci_validate_section tgt target $1 \ + 'name:string:iqn.2012-06.org.openwrt' \ + 'allow_address:list(string):ALL' \ + 'allow_name:list(string)' +} + +handle_target() { + local tgtid=$1 + local _tgtadm="$tgtadm --mode target" + local name allow + + [ $tgtid -ge 0 ] || return 1 + validate_target_section $tgtid || { + $logger "Validation failed for target $tgtid" + return 1 + } + $_tgtadm --op new --tid $tgtid --targetname $name || { + $logger "Failed to create target $tgtid" + return 1 + } + local i + for i in $allow_address; do + $_tgtadm --op bind --tid $tgtid --initiator-address $i || { + $logger "Failed to set allow $i to connect to target $tgtid" + return 1 + } + done + for i in $allow_name; do + $_tgtadm --op bind --tid $tgtid --initiator-name $i || { + $logger "Failed to set allow $i to connect to target $tgtid" + return 1 + } + done + config_foreach handle_lun lun $tgtid || return 1 + config_foreach bind_account_to_target account $tgtid || return 1 +} + +configure() { + config_load $NAME + $tgtadm --mode sys --op update --name State -v offline || { + $logger "Failed to set system state to Offline" + return 1 + } + config_foreach handle_account account || return 1 + config_foreach handle_target target || return 1 + $tgtadm --mode sys --op update --name State -v ready || { + $logger "Failed to set system state to Ready" + return 1 + } + return 0 +} + +validate_tgt_section() { + uci_validate_section tgt options $1 \ + 'iothreads:uinteger' \ + 'portal:list(string)' \ + 'nop_interval:uinteger' \ + 'nop_count:uinteger' +} + +start_service() { + local iothreads portal nop_interval nop_count + validate_tgt_section tgt || { + $logger "Validation failed for tgt options" + return 1 + } + procd_open_instance + procd_set_param command $PROG -f + [ "$iothreads" ] && procd_append_param command -t $iothreads + [ "${portal}${nop_interval}${nop_count}" ] && { + local iscsi="" i + for i in nop_interval nop_count; do + eval iscsi=\${$i+$i=\$$i,}\$iscsi + done + for i in $portal; do + iscsi="portal=$i,$iscsi" + done + procd_append_param command --iscsi $iscsi + } + procd_set_param respawn + procd_close_instance + logger -p daemon.info -t $NAME -s "Configuration will be loaded in seconds" + ( sleep 5; configure || { stop_service; exit 1; } ) & +} + +stop_service() { + $tgtadm --mode sys --op update --name State -v offline || { + $logger "Failed to set system state to Offline" + return 1 + } + $tgtadm --mode target --op show \ + | awk '$1 == "Target" {sub(/:/,"",$2); print $2}' \ + | xargs -r -n1 $tgtadm --mode target --op delete --force --tid + $tgtadm --mode sys --op delete +} + +reload_service() { + stop_service + start_service +} + +show() { + $tgtadm --mode target --op show +} diff --git a/net/tgt/patches/020-usr_Makefile.patch b/net/tgt/patches/020-usr_Makefile.patch new file mode 100644 index 0000000..0120595 --- /dev/null +++ b/net/tgt/patches/020-usr_Makefile.patch @@ -0,0 +1,51 @@ +diff --git a/usr/Makefile b/usr/Makefile +index d4e3eaf..ec1c9a3 100644 +--- a/usr/Makefile ++++ b/usr/Makefile +@@ -1,11 +1,11 @@ + sbindir ?= $(PREFIX)/sbin + libdir ?= $(PREFIX)/lib/tgt + +-ifneq ($(shell test -e /usr/include/linux/signalfd.h && echo 1),) ++ifneq ($(shell test -n $(shell find $(STAGING_DIR)/usr/include -name "signalfd.h" | head -n1) && echo 1),) + CFLAGS += -DUSE_SIGNALFD + endif + +-ifneq ($(shell test -n $(shell find /usr/include -name "timerfd.h" | head -n1) && echo 1),) ++ifneq ($(shell test -n $(shell find $(STAGING_DIR)/usr/include -name "timerfd.h" | head -n1) && echo 1),) + CFLAGS += -DUSE_TIMERFD + endif + +@@ -25,7 +25,7 @@ ifneq ($(SD_NOTIFY),) + CFLAGS += -DUSE_SYSTEMD + endif + +-ifneq ($(shell test -e /usr/include/sys/eventfd.h && test -e /usr/include/libaio.h && echo 1),) ++ifneq ($(shell test -n $(shell find $(STAGING_DIR)/usr/include -name "eventfd.h" | head -n1) && test -n $(shell find $(STAGING_DIR)/usr/include -name "libaio.h" | head -n1) && echo 1),) + CFLAGS += -DUSE_EVENTFD + TGTD_OBJS += bs_aio.o + LIBS += -laio +@@ -55,7 +55,7 @@ ifneq ($(SD_NOTIFY),) + LIBS += -lsystemd + endif + +-PROGRAMS += tgtd tgtadm tgtimg ++PROGRAMS += tgtd tgtadm + TGTD_OBJS += tgtd.o mgmt.o target.o scsi.o log.o driver.o util.o work.o \ + concat_buf.o parser.o spc.o sbc.o mmc.o osd.o scc.o smc.o \ + ssc.o libssc.o bs_rdwr.o bs_ssc.o \ +@@ -82,14 +82,6 @@ tgtadm: $(TGTADM_OBJS) + + -include $(TGTADM_DEP) + +-TGTIMG_OBJS = tgtimg.o libssc.o libcrc32c.o +-TGTIMG_DEP = $(TGTIMG_OBJS:.o=.d) +- +-tgtimg: $(TGTIMG_OBJS) +- $(CC) $^ -o $@ +- +--include $(TGTIMG_DEP) +- + %.o: %.c + $(CC) -c $(CFLAGS) $*.c -o $*.o + @$(CC) -MM $(CFLAGS) -MF $*.d -MT $*.o $*.c diff --git a/net/tgt/patches/030-Makefile.patch b/net/tgt/patches/030-Makefile.patch new file mode 100644 index 0000000..ab54f22 --- /dev/null +++ b/net/tgt/patches/030-Makefile.patch @@ -0,0 +1,11 @@ +--- tgt-1.0.48.orig/Makefile 2014-06-04 15:03:53.000000000 +0300 ++++ tgt-1.0.48/Makefile 2014-06-04 15:18:13.132963670 +0300 +@@ -64,7 +64,7 @@ + $(MAKE) -C conf clean + + .PHONY: install +-install: install-programs install-doc install-conf install-scripts ++install: install-programs + + .PHONY: rpm + rpm: diff --git a/net/tgt/patches/100-musl-compat.patch b/net/tgt/patches/100-musl-compat.patch new file mode 100644 index 0000000..f606207 --- /dev/null +++ b/net/tgt/patches/100-musl-compat.patch @@ -0,0 +1,30 @@ +diff --git a/usr/tgtd.h b/usr/tgtd.h +index d8b2ac1..c6eee54 100644 +--- a/usr/tgtd.h ++++ b/usr/tgtd.h +@@ -9,6 +9,10 @@ + #include + #endif + ++#ifndef __WORDSIZE ++#include ++#endif ++ + struct concat_buf; + + #define NR_SCSI_OPCODES 256 +diff --git a/usr/util.h b/usr/util.h +index 0e34c35..3e2e63b 100644 +--- a/usr/util.h ++++ b/usr/util.h +@@ -16,6 +16,10 @@ + #include + #include + ++#ifndef __WORDSIZE ++#include ++#endif ++ + #include "be_byteshift.h" + + #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) diff --git a/net/tinc/Makefile b/net/tinc/Makefile new file mode 100644 index 0000000..d8f4c00 --- /dev/null +++ b/net/tinc/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2007-2015 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:=tinc +PKG_VERSION:=1.0.30 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.tinc-vpn.org/packages +PKG_MD5SUM:=f3ca1fc1154ed1f2cac408ea06a1c1ca + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/tinc + SECTION:=net + CATEGORY:=Network + DEPENDS:=+liblzo +libopenssl +kmod-tun +zlib + TITLE:=VPN tunneling daemon + URL:=http://www.tinc-vpn.org/ + MAINTAINER:=Saverio Proto + SUBMENU:=VPN +endef + +define Package/tinc/description + tinc is a Virtual Private Network (VPN) daemon that uses tunnelling and + encryption to create a secure private network between hosts on the Internet. +endef + +TARGET_CFLAGS += -std=gnu99 + +CONFIGURE_ARGS += \ + --with-kernel="$(LINUX_DIR)" \ + --with-zlib="$(STAGING_DIR)/usr" \ + --with-lzo-include="$(STAGING_DIR)/usr/include/lzo" + +define Package/tinc/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/tincd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME) + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME) + $(INSTALL_DIR) $(1)/etc/tinc + $(INSTALL_DIR) $(1)/lib/upgrade/keep.d + $(INSTALL_DATA) files/tinc.upgrade $(1)/lib/upgrade/keep.d/tinc +endef + +define Package/tinc/conffiles +/etc/config/tinc +endef + +$(eval $(call BuildPackage,tinc)) diff --git a/net/tinc/files/tinc.config b/net/tinc/files/tinc.config new file mode 100644 index 0000000..1894078 --- /dev/null +++ b/net/tinc/files/tinc.config @@ -0,0 +1,56 @@ +config tinc-net NETNAME + option enabled 0 + + ## Daemon Configuration (cmd arguments) + #option generate_keys 0 + #option key_size 2048 + #option logfile /tmp/log/tinc.NETNAME.log + #option debug 3 + + ## Server Configuration (tinc.conf) + #option AddressFamily any + #option BindToAddress 127.0.0.1 + #option BindToInterface lo + + #list ConnectTo peer1 + + #option DirectOnly 0 + #option Forwarding internal + #option GraphDumpFile /tmp/log/tinc.NETNAME.dot + #option Hostnames 0 + #option IffOneQueue 0 + #option Interface NETNAME + #option KeyExpire 3600 + #option MACExpire 600 + #option MaxTimeout 900 + #option Mode router + + option Name NODENAME + + #option PingInterval 60 + #option PingTimeout 5 + #option PriorityInheritance 0 + #option PrivateKeyFile /etc/tinc/NETNAME/rsa_key.priv + #option ProcessPriority normal + #option ReplayWindow 16 + #option StrictSubnets 0 + #option TunnelServer 0 + #option UDPRcvBuf x + #option UDPSndBuf x + +config tinc-host NODENAME + option enabled 0 + + option net NETNAME + + #list Address example.com + #option Cipher blowfish + #option ClampMSS yes + #option Compression 0 + #option Digest sha1 + #option IndirectData 0 + #option MACLength 4 + #option PMTU 1514 + #option PMTUDiscovery yes + #option Port 655 + #option Subnet 192.168.1.0/24 diff --git a/net/tinc/files/tinc.init b/net/tinc/files/tinc.init new file mode 100644 index 0000000..e49b358 --- /dev/null +++ b/net/tinc/files/tinc.init @@ -0,0 +1,239 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2011 OpenWrt.org +# Copyright (C) 2011 Linus Lüssing +# Based on Jo-Philipp Wich's OpenVPN init script +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. + +START=42 + +SERVICE_USE_PID=1 + +BIN=/usr/sbin/tincd +EXTRA_COMMANDS="up down" + +LIST_SEP=" +" +TMP_TINC="/tmp/tinc" + +append_param() { + local v="$1" + case "$v" in + *_*_*_*) v=${v%%_*}-${v#*_}; v=${v%%_*}-${v#*_}; v=${v%%_*}-${v#*_} ;; + *_*_*) v=${v%%_*}-${v#*_}; v=${v%%_*}-${v#*_} ;; + *_*) v=${v%%_*}-${v#*_} ;; + esac + ARGS="$ARGS --$v" + return 0 +} + +append_conf_bools() { + local p; local v; local s="$1"; local f="$2"; shift; shift + for p in $*; do + config_get_bool v "$s" "$p" + [ "$v" == 1 ] && echo "$p = yes" >> "$f" + [ "$v" == 0 ] && echo "$p = no" >> "$f" + done +} + +append_params() { + local p; local v; local s="$1"; shift + for p in $*; do + config_get v "$s" "$p" + IFS="$LIST_SEP" + for v in $v; do + [ -n "$v" ] && append_param "$p" && ARGS="$ARGS=$v" + done + unset IFS + done +} + +append_conf_params() { + local p; local v; local s="$1"; local f="$2"; shift; shift + for p in $*; do + config_get v "$s" "$p" + IFS="$LIST_SEP" + for v in $v; do + # Look up OpenWRT interface names + [ "$p" = "BindToInterface" ] && { + local ifname=$(uci -P /var/state get network.$v.ifname 2>&-) + [ -n "$ifname" ] && v="$ifname" + } + + [ -n "$v" ] && echo "$p = $v" >> "$f" + done + unset IFS + done +} + +section_enabled() { + config_get_bool enabled "$1" 'enabled' 0 + [ $enabled -gt 0 ] +} + +prepare_host() { + local s="$1" + local n + + # net disabled? + config_get n "$s" net + section_enabled "$n" || return 1 + + if [ "$#" = "2" ]; then + [ "$2" != "$n" ] && return 1 + fi + + # host disabled? + section_enabled "$s" || { + [ -f "$TMP_TINC/$n/hosts/$s" ] && rm "$TMP_TINC/$n/hosts/$s" + return 1 + } + + [ ! -f "/etc/tinc/$n/hosts/$s" ] && { + echo -n "tinc: Warning, public key for $s for network $n " + echo -n "missing in /etc/tinc/$n/hosts/$s, " + echo "skipping configuration of $s" + return 1 + } + + # append flags + append_conf_bools "$s" "$TMP_TINC/$n/hosts/$s" \ + ClampMSS IndirectData PMTUDiscovery TCPOnly + + # append params + append_conf_params "$s" "$TMP_TINC/$n/hosts/$s" \ + Address Cipher Compression Digest MACLength PMTU \ + Port PublicKey PublicKeyFile Subnet +} + +check_gen_own_key() { + local s="$1"; local n; local k + + config_get n "$s" Name + config_get_bool k "$s" generate_keys 0 + [ "$k" == 0 ] && return 0 + + ([ -z "$n" ] || [ -f "$TMP_TINC/$s/hosts/$n" ] || [ -f "$TMP_TINC/$s/rsa_key.priv" ]) && \ + return 0 + [ ! -d "$TMP_TINC/$s/hosts" ] && mkdir -p "$TMP_TINC/$s/hosts" + + config_get k "$s" key_size + if [ -z "$k" ]; then + $BIN -c "$TMP_TINC/$s" --generate-keys + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/tinyproxy + SUBMENU:=Web Servers/Proxies + SECTION:=net + CATEGORY:=Network + TITLE:=Tinyproxy is a lightweight HTTP and HTTPS proxy + URL:=http://tinyproxy.sourceforge.net/ +endef + +define Package/tinyproxy/conffiles +/etc/config/tinyproxy +endef + +CONFIGURE_ARGS+= \ + --enable-filter \ + --enable-transparent \ + --disable-regexcheck \ + +define Package/tinyproxy/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/tinyproxy $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/usr/share/tinyproxy + $(CP) $(PKG_INSTALL_DIR)/usr/share/tinyproxy/*.html $(1)/usr/share/tinyproxy/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/tinyproxy.config $(1)/etc/config/tinyproxy + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/tinyproxy.init $(1)/etc/init.d/tinyproxy +endef + +$(eval $(call BuildPackage,tinyproxy)) diff --git a/net/tinyproxy/files/tinyproxy.config b/net/tinyproxy/files/tinyproxy.config new file mode 100644 index 0000000..ac7b46f --- /dev/null +++ b/net/tinyproxy/files/tinyproxy.config @@ -0,0 +1,251 @@ +config tinyproxy + +# +# Enable the proxy +# +option enabled 0 + +# +# Name of the user the tinyproxy daemon should switch to after the port +# has been bound. +# +option User nobody +option Group nogroup + +# +# Port to listen on. +# +option Port 8888 + +# +# If you have multiple interfaces this allows you to bind to only one. If +# this is commented out, tinyproxy will bind to all interfaces present. +# +#option Listen 192.168.0.1 + +# +# The Bind directive allows you to bind the outgoing connections to a +# particular IP address. +# +#option Bind 192.168.0.1 + +# +# Timeout: The number of seconds of inactivity a connection is allowed to +# have before it closed by tinyproxy. +# +option Timeout 600 + +# +# ErrorFile: Defines the HTML file to send when a given HTTP error +# occurs. You will probably need to customize the location to your +# particular install. The usual locations to check are: +# /usr/local/share/tinyproxy +# /usr/share/tinyproxy +# /etc/tinyproxy +# +#option ErrorFile_404 "/usr/share/tinyproxy/404.html" +#option ErrorFile_400 "/usr/share/tinyproxy/400.html" +#option ErrorFile_503 "/usr/share/tinyproxy/503.html" +#option ErrorFile_403 "/usr/share/tinyproxy/403.html" +#option ErrorFile_408 "/usr/share/tinyproxy/408.html" + +# +# DefaultErrorFile: The HTML file that gets sent if there is no +# HTML file defined with an ErrorFile keyword for the HTTP error +# that has occurred. +# +option DefaultErrorFile "/usr/share/tinyproxy/default.html" + +# +# StatFile: The HTML file that gets sent when a request is made +# for the stathost. If this file doesn't exist a basic page is +# hardcoded in tinyproxy. +# +option StatFile "/usr/share/tinyproxy/stats.html" + +# +# Where to log the information. Either LogFile or Syslog should be set, +# but not both. +# +option LogFile "/var/log/tinyproxy.log" +#option Syslog 1 + +# +# Set the logging level. Allowed settings are: +# Critical (least verbose) +# Error +# Warning +# Notice +# Connect (to log connections without Info's noise) +# Info (most verbose) +# The LogLevel logs from the set level and above. For example, if the LogLevel +# was set to Warning, than all log messages from Warning to Critical would be +# output, but Notice and below would be suppressed. +# +option LogLevel Info + +# +# Include the X-Tinyproxy header, which has the client's IP address when +# connecting to the sites listed. +# +# list XTinyproxy mydomain.com + +# +# This is the absolute highest number of threads which will be created. In +# other words, only MaxClients number of clients can be connected at the +# same time. +# +option MaxClients 100 + +# +# These settings set the upper and lower limit for the number of +# spare servers which should be available. If the number of spare servers +# falls below MinSpareServers then new ones will be created. If the number +# of servers exceeds MaxSpareServers then the extras will be killed off. +# +option MinSpareServers 5 +option MaxSpareServers 20 + +# +# Number of servers to start initially. +# +option StartServers 10 + +# +# MaxRequestsPerChild is the number of connections a thread will handle +# before it is killed. In practise this should be set to 0, which disables +# thread reaping. If you do notice problems with memory leakage, then set +# this to something like 10000 +# +option MaxRequestsPerChild 0 + +# +# The following is the authorization controls. If there are any access +# control keywords then the default action is to DENY. Otherwise, the +# default action is ALLOW. +# +# Also the order of the controls are important. The incoming connections +# are tested against the controls based on order. +# +list Allow 127.0.0.1 +#list Allow 192.168.0.0/16 +#list Allow 172.16.0.0/12 +#list Allow 10.0.0.0/8 + +# +# The "Via" header is required by the HTTP RFC, but using the real host name +# is a security concern. If the following directive is enabled, the string +# supplied will be used as the host name in the Via header; otherwise, the +# server's host name will be used. +# +option ViaProxyName "tinyproxy" + +# +# The location of the filter file. +# +#option Filter "/etc/tinyproxy/filter" + +# +# Filter based on URLs rather than domains. +# +#option FilterURLs 1 + +# +# Use POSIX Extended regular expressions rather than basic. +# +#option FilterExtended 1 + +# +# Use case sensitive regular expressions. +# +#option FilterCaseSensitive 1 + +# +# Change the default policy of the filtering system. If this directive is +# commented out, or is set to "0" then the default policy is to allow +# everything which is not specifically denied by the filter file. +# +# However, by setting this directive to "1" the default policy becomes to +# deny everything which is _not_ specifically allowed by the filter file. +# +#option FilterDefaultDeny 1 + +# +# If an Anonymous keyword is present, then anonymous proxying is enabled. +# The headers listed are allowed through, while all others are denied. If +# no Anonymous keyword is present, then all header are allowed through. +# You must include quotes around the headers. +# +#list Anonymous "Host" +#list Anonymous "Authorization" + +# +# This is a list of ports allowed by tinyproxy when the CONNECT method +# is used. To disable the CONNECT method altogether, set the value to 0. +# If no ConnectPort line is found, all ports are allowed (which is not +# very secure.) +# +# The following two ports are used by SSL. +# +list ConnectPort 443 +list ConnectPort 563 + +# +# Turns on upstream proxy support. +# +# The upstream rules allow you to selectively route upstream connections +# based on the host/domain of the site being accessed. +# +# For example: +# # connection to test domain goes through testproxy +# +#config upstream +# option type proxy +# option via testproxy:8008 +# option target ".test.domain.invalid" +# +#config upstream +# option type proxy +# option via testproxy:8008 +# option target ".our_testbed.example.com" +# +#config upstream +# option type proxy +# option via testproxy:8008 +# option target "192.168.128.0/255.255.254.0" +# +# # no upstream proxy for internal websites and unqualified hosts +# +#config upstream +# option type reject +# option target ".internal.example.com" +# +#config upstream +# option type reject +# option target "www.example.com" +# +#config upstream +# option type reject +# option target "10.0.0.0/8" +# +#config upstream +# option type reject +# option target "192.168.0.0/255.255.254.0" +# +#config upstream +# option type reject +# option target "." +# +# # default upstream is internet firewall +# +#config upstream +# option type proxy +# option via firewall.internal.example.com:80 +# +# The LAST matching rule wins the route decision. As you can see, you +# can use a host, or a domain: +# name matches host exactly +# .name matches any host in domain "name" +# . matches any host with no domain (in 'empty' domain) +# IP/bits matches network/mask +# IP/mask matches network/mask diff --git a/net/tinyproxy/files/tinyproxy.init b/net/tinyproxy/files/tinyproxy.init new file mode 100644 index 0000000..73f38c6 --- /dev/null +++ b/net/tinyproxy/files/tinyproxy.init @@ -0,0 +1,142 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008-2011 OpenWrt.org + +START=50 + +CFGFILE=/var/etc/tinyproxy.conf + +section_enabled() { + config_get_bool enabled "$1" 'enabled' 0 + [ $enabled -gt 0 ] +} + +start() { + config_load 'tinyproxy' + config_foreach start_proxy 'tinyproxy' +} + +stop() { + service_stop /usr/sbin/tinyproxy +} + +start_proxy() { + section_enabled "$1" || return 1 + + mkdir -m0755 -p /var/etc + echo '### AUTOGENERATED CONFIGURATION' > $CFGFILE + echo '### DO NOT EDIT' >> $CFGFILE + echo '### SEE /etc/config/tinyproxy INSTEAD' >> $CFGFILE + echo '' >> $CFGFILE + + proxy_atom "$1" User >> $CFGFILE + proxy_atom "$1" Group >> $CFGFILE + proxy_atom "$1" Port 8888 >> $CFGFILE + proxy_atom "$1" Listen >> $CFGFILE + proxy_atom "$1" Bind >> $CFGFILE + proxy_atom "$1" Timeout >> $CFGFILE + + proxy_string "$1" ErrorFile_400 "ErrorFile 400" >> $CFGFILE + proxy_string "$1" ErrorFile_403 "ErrorFile 403" >> $CFGFILE + proxy_string "$1" ErrorFile_404 "ErrorFile 404" >> $CFGFILE + proxy_string "$1" ErrorFile_408 "ErrorFile 408" >> $CFGFILE + proxy_string "$1" ErrorFile_503 "ErrorFile 503" >> $CFGFILE + + proxy_string "$1" DefaultErrorFile >> $CFGFILE + proxy_string "$1" StatHost StatHost 127.0.0.1 >> $CFGFILE + proxy_string "$1" StatFile >> $CFGFILE + proxy_string "$1" LogFile >> $CFGFILE + + proxy_flag "$1" Syslog >> $CFGFILE + + proxy_atom "$1" LogLevel >> $CFGFILE + + proxy_list "$1" XTinyproxy >> $CFGFILE + + proxy_atom "$1" MaxClients >> $CFGFILE + proxy_atom "$1" MinSpareServers >> $CFGFILE + proxy_atom "$1" MaxSpareServers >> $CFGFILE + proxy_atom "$1" StartServers >> $CFGFILE + proxy_atom "$1" MaxRequestsPerChild >> $CFGFILE + proxy_list "$1" Allow >> $CFGFILE + + proxy_string "$1" ViaProxyName >> $CFGFILE + proxy_string "$1" Filter >> $CFGFILE + + proxy_flag "$1" FilterURLs >> $CFGFILE + proxy_flag "$1" FilterExtended >> $CFGFILE + proxy_flag "$1" FilterCaseSensitive >> $CFGFILE + proxy_flag "$1" FilterDefaultDeny Yes No >> $CFGFILE + + proxy_list "$1" Anonymous '"' >> $CFGFILE + proxy_list "$1" ConnectPort >> $CFGFILE + + config_foreach write_upstream upstream + + service_start /usr/sbin/tinyproxy -c "$CFGFILE" +} + +write_upstream() { + local type + local via + local target + + config_get "type" "$1" "type" + config_get via "$1" via + config_get target "$1" target + [ -n "$target" ] && target=' "'"$target"'"' + + [ "$type" == "proxy" -a -n "$via" ] && \ + echo "upstream $via$target" >> $CFGFILE + + [ "$type" == "reject" -a -n "$target" ] && \ + echo "no upstream$target" >> $CFGFILE +} + +proxy_atom() { + local SECTION=$1 + local OPTION=$2 + local DEFAULT=$3 + + config_get _value "$SECTION" "$OPTION" + [ -z "$_value" ] && _value="$DEFAULT" + [ -n "$_value" ] && echo "$OPTION $_value" +} + +proxy_string() { + local SECTION=$1 + local OPTION=$2 + local ALIAS=$3 + local DEFAULT=$4 + + config_get _value "$SECTION" "$OPTION" + [ -z "$_value" ] && _value="$DEFAULT" + [ -n "$_value" ] && echo "${ALIAS:-${OPTION}} "'"'"$_value"'"' + [ -n "$_value" -a "$OPTION" = "LogFile" ] && { + touch $_value + chmod 666 $_value + } +} + +proxy_flag() { + local SECTION=$1 + local OPTION=$2 + local TRUE="${3:-On}" + local FALSE="${4:-Off}" + + config_get_bool _value "$SECTION" "$OPTION" 0 + [ "$_value" -eq "1" ] && _value="$TRUE" || _value="$FALSE" + echo "$OPTION $_value" +} + +proxy_list() { + local SECTION=$1 + local OPTION=$2 + local ENCLOSE=$3 + + config_get _value "$SECTION" "$OPTION" + [ -n "$_value" ] && { + for entry in $_value; do + echo "$OPTION ${ENCLOSE}${entry}${ENCLOSE}" + done + } +} diff --git a/net/tinyproxy/patches/010-no-docs-and-tests.patch b/net/tinyproxy/patches/010-no-docs-and-tests.patch new file mode 100644 index 0000000..cbb0dd1 --- /dev/null +++ b/net/tinyproxy/patches/010-no-docs-and-tests.patch @@ -0,0 +1,86 @@ +--- a/configure ++++ b/configure +@@ -6815,59 +6815,8 @@ fi + + + +-# Check for asciidoc +-# Extract the first word of "a2x", so it can be a program name with args. +-set dummy a2x; ac_word=$2 +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +-$as_echo_n "checking for $ac_word... " >&6; } +-if test "${ac_cv_path_A2X+set}" = set; then : +- $as_echo_n "(cached) " >&6 +-else +- case $A2X in +- [\\/]* | ?:[\\/]*) +- ac_cv_path_A2X="$A2X" # Let the user override the test with a path. +- ;; +- *) +- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +-for as_dir in $PATH +-do +- IFS=$as_save_IFS +- test -z "$as_dir" && as_dir=. +- for ac_exec_ext in '' $ac_executable_extensions; do +- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then +- ac_cv_path_A2X="$as_dir/$ac_word$ac_exec_ext" +- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 +- break 2 +- fi +-done +- done +-IFS=$as_save_IFS +- +- test -z "$ac_cv_path_A2X" && ac_cv_path_A2X="no" +- ;; +-esac +-fi +-A2X=$ac_cv_path_A2X +-if test -n "$A2X"; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $A2X" >&5 +-$as_echo "$A2X" >&6; } +-else +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-$as_echo "no" >&6; } +-fi +- +- +- if test "x$A2X" != "xno"; then +- HAVE_A2X_TRUE= +- HAVE_A2X_FALSE='#' +-else + HAVE_A2X_TRUE='#' + HAVE_A2X_FALSE= +-fi +- +-if test x"$A2X" = x"no"; then +- as_fn_error $? "Test for asciidoc failed. See the file 'INSTALL' for help." "$LINENO" 5 +-fi + + ac_config_files="$ac_config_files Makefile src/Makefile data/Makefile data/templates/Makefile etc/Makefile docs/Makefile docs/man5/Makefile docs/man5/tinyproxy.conf.txt docs/man8/Makefile docs/man8/tinyproxy.txt m4macros/Makefile tests/Makefile tests/scripts/Makefile" + +--- a/Makefile.am ++++ b/Makefile.am +@@ -2,9 +2,7 @@ SUBDIRS = \ + src \ + data \ + etc \ +- docs \ + m4macros \ +- tests + + # tools want this on a single line + ACLOCAL_AMFLAGS = -I m4macros +--- a/Makefile.in ++++ b/Makefile.in +@@ -222,9 +222,7 @@ SUBDIRS = \ + src \ + data \ + etc \ +- docs \ + m4macros \ +- tests + + + # tools want this on a single line diff --git a/net/tinyproxy/patches/020-config_and_pid-path.patch b/net/tinyproxy/patches/020-config_and_pid-path.patch new file mode 100644 index 0000000..3ab7482 --- /dev/null +++ b/net/tinyproxy/patches/020-config_and_pid-path.patch @@ -0,0 +1,13 @@ +--- a/src/main.c ++++ b/src/main.c +@@ -326,8 +326,8 @@ static void initialize_config_defaults ( + conf->errorpages = NULL; + conf->stathost = safestrdup (TINYPROXY_STATHOST); + conf->idletimeout = MAX_IDLE_TIME; +- conf->logf_name = safestrdup (LOCALSTATEDIR "/log/tinyproxy/tinyproxy.log"); +- conf->pidpath = safestrdup (LOCALSTATEDIR "/run/tinyproxy/tinyproxy.pid"); ++ conf->logf_name = safestrdup (LOCALSTATEDIR "/log/tinyproxy.log"); ++ conf->pidpath = safestrdup (LOCALSTATEDIR "/tinyproxy.pid"); + } + + /** diff --git a/net/tinyproxy/patches/030-allow_bind_in_transparent_mode.patch b/net/tinyproxy/patches/030-allow_bind_in_transparent_mode.patch new file mode 100644 index 0000000..68d89db --- /dev/null +++ b/net/tinyproxy/patches/030-allow_bind_in_transparent_mode.patch @@ -0,0 +1,22 @@ +--- a/src/conf.c ++++ b/src/conf.c +@@ -865,7 +865,6 @@ static HANDLE_FUNC (handle_deny) + + static HANDLE_FUNC (handle_bind) + { +-#ifndef TRANSPARENT_PROXY + int r = set_string_arg (&conf->bind_address, line, &match[2]); + + if (r) +@@ -873,11 +872,6 @@ static HANDLE_FUNC (handle_bind) + log_message (LOG_INFO, + "Outgoing connections bound to IP %s", conf->bind_address); + return 0; +-#else +- fprintf (stderr, +- "\"Bind\" cannot be used with transparent support enabled.\n"); +- return 1; +-#endif + } + + static HANDLE_FUNC (handle_listen) diff --git a/net/tinyproxy/patches/120-fix_INET6.patch b/net/tinyproxy/patches/120-fix_INET6.patch new file mode 100644 index 0000000..1c26835 --- /dev/null +++ b/net/tinyproxy/patches/120-fix_INET6.patch @@ -0,0 +1,38 @@ +--- a/src/sock.c ++++ b/src/sock.c +@@ -39,8 +39,7 @@ + * returned if the bind succeeded. Otherwise, -1 is returned + * to indicate an error. + */ +-static int +-bind_socket (int sockfd, const char *addr, int family) ++static int bind_socket (int sockfd, const char *addr) + { + struct addrinfo hints, *res, *ressave; + +@@ -48,7 +47,7 @@ bind_socket (int sockfd, const char *add + assert (addr != NULL && strlen (addr) != 0); + + memset (&hints, 0, sizeof (struct addrinfo)); +- hints.ai_family = family; ++ hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + + /* The local port it not important */ +@@ -106,14 +105,12 @@ int opensock (const char *host, int port + + /* Bind to the specified address */ + if (bind_to) { +- if (bind_socket (sockfd, bind_to, +- res->ai_family) < 0) { ++ if (bind_socket (sockfd, bind_to) < 0) { + close (sockfd); + continue; /* can't bind, so try again */ + } + } else if (config.bind_address) { +- if (bind_socket (sockfd, config.bind_address, +- res->ai_family) < 0) { ++ if (bind_socket (sockfd, config.bind_address) < 0) { + close (sockfd); + continue; /* can't bind, so try again */ + } diff --git a/net/tinyproxy/patches/CVE-2012-3505-tiniproxy-randomized-hashmaps.patch b/net/tinyproxy/patches/CVE-2012-3505-tiniproxy-randomized-hashmaps.patch new file mode 100644 index 0000000..4737b8b --- /dev/null +++ b/net/tinyproxy/patches/CVE-2012-3505-tiniproxy-randomized-hashmaps.patch @@ -0,0 +1,101 @@ +--- a/src/child.c ++++ b/src/child.c +@@ -20,6 +20,9 @@ + * processing incoming connections. + */ + ++#include ++#include ++ + #include "main.h" + + #include "child.h" +@@ -196,6 +199,7 @@ static void child_main (struct child_s * + } + + ptr->connects = 0; ++ srand(time(NULL)); + + while (!config.quit) { + ptr->status = T_WAITING; +--- a/src/hashmap.c ++++ b/src/hashmap.c +@@ -25,6 +25,8 @@ + * don't try to free the data, or realloc the memory. :) + */ + ++#include ++ + #include "main.h" + + #include "hashmap.h" +@@ -50,6 +52,7 @@ struct hashbucket_s { + }; + + struct hashmap_s { ++ uint32_t seed; + unsigned int size; + hashmap_iter end_iterator; + +@@ -65,7 +68,7 @@ struct hashmap_s { + * + * If any of the arguments are invalid a negative number is returned. + */ +-static int hashfunc (const char *key, unsigned int size) ++static int hashfunc (const char *key, unsigned int size, uint32_t seed) + { + uint32_t hash; + +@@ -74,7 +77,7 @@ static int hashfunc (const char *key, un + if (size == 0) + return -ERANGE; + +- for (hash = tolower (*key++); *key != '\0'; key++) { ++ for (hash = seed; *key != '\0'; key++) { + uint32_t bit = (hash & 1) ? (1 << (sizeof (uint32_t) - 1)) : 0; + + hash >>= 1; +@@ -104,6 +107,7 @@ hashmap_t hashmap_create (unsigned int n + if (!ptr) + return NULL; + ++ ptr->seed = (uint32_t)rand(); + ptr->size = nbuckets; + ptr->buckets = (struct hashbucket_s *) safecalloc (nbuckets, + sizeof (struct +@@ -201,7 +205,7 @@ hashmap_insert (hashmap_t map, const cha + if (!data || len < 1) + return -ERANGE; + +- hash = hashfunc (key, map->size); ++ hash = hashfunc (key, map->size, map->seed); + if (hash < 0) + return hash; + +@@ -382,7 +386,7 @@ ssize_t hashmap_search (hashmap_t map, c + if (map == NULL || key == NULL) + return -EINVAL; + +- hash = hashfunc (key, map->size); ++ hash = hashfunc (key, map->size, map->seed); + if (hash < 0) + return hash; + +@@ -416,7 +420,7 @@ ssize_t hashmap_entry_by_key (hashmap_t + if (!map || !key || !data) + return -EINVAL; + +- hash = hashfunc (key, map->size); ++ hash = hashfunc (key, map->size, map->seed); + if (hash < 0) + return hash; + +@@ -451,7 +455,7 @@ ssize_t hashmap_remove (hashmap_t map, c + if (map == NULL || key == NULL) + return -EINVAL; + +- hash = hashfunc (key, map->size); ++ hash = hashfunc (key, map->size, map->seed); + if (hash < 0) + return hash; + diff --git a/net/tinyproxy/patches/CVE-2012-3505-tinyproxy-limit-headers.patch b/net/tinyproxy/patches/CVE-2012-3505-tinyproxy-limit-headers.patch new file mode 100644 index 0000000..b8023ab --- /dev/null +++ b/net/tinyproxy/patches/CVE-2012-3505-tinyproxy-limit-headers.patch @@ -0,0 +1,44 @@ +--- a/src/reqs.c ++++ b/src/reqs.c +@@ -610,6 +610,11 @@ add_header_to_connection (hashmap_t hash + return hashmap_insert (hashofheaders, header, sep, len); + } + ++/* define max number of headers. big enough to handle legitimate cases, ++ * but limited to avoid DoS ++ */ ++#define MAX_HEADERS 10000 ++ + /* + * Read all the headers from the stream + */ +@@ -617,6 +622,7 @@ static int get_all_headers (int fd, hash + { + char *line = NULL; + char *header = NULL; ++ int count; + char *tmp; + ssize_t linelen; + ssize_t len = 0; +@@ -625,7 +631,7 @@ static int get_all_headers (int fd, hash + assert (fd >= 0); + assert (hashofheaders != NULL); + +- for (;;) { ++ for (count = 0; count < MAX_HEADERS; count++) { + if ((linelen = readline (fd, &line)) <= 0) { + safefree (header); + safefree (line); +@@ -691,6 +697,12 @@ static int get_all_headers (int fd, hash + + safefree (line); + } ++ ++ /* if we get there, this is we reached MAX_HEADERS count. ++ bail out with error */ ++ safefree (header); ++ safefree (line); ++ return -1; + } + + /* diff --git a/net/tor/Makefile b/net/tor/Makefile new file mode 100644 index 0000000..ccdd47b --- /dev/null +++ b/net/tor/Makefile @@ -0,0 +1,100 @@ +# +# Copyright (C) 2008-2016 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:=tor +PKG_VERSION:=0.2.8.9 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://dist.torproject.org/ \ + https://archive.torproject.org/tor-package-archive +PKG_MD5SUM:=3f5c273bb887be4aff11f4d99b9e2e52d293b81ff4f6302b730161ff16dc5316 +PKG_MAINTAINER:=Hauke Mehrtens +PKG_LICENSE_FILES:=LICENSE + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/tor/Default + SECTION:=net + CATEGORY:=Network + URL:=https://www.torproject.org/ + USERID:=tor=52:tor=52 +endef + +define Package/tor/Default/description + Tor is a toolset for a wide range of organizations and people that want to + improve their safety and security on the Internet. Using Tor can help you + anonymize web browsing and publishing, instant messaging, IRC, SSH, and + more. Tor also provides a platform on which software developers can build + new applications with built-in anonymity, safety, and privacy features. +endef + +define Package/tor +$(call Package/tor/Default) + TITLE:=An anonymous Internet communication system + DEPENDS:=+libevent2 +libopenssl +libpthread +librt +zlib +libcap +endef + +define Package/tor/description +$(call Package/tor/Default/description) + This package contains the tor daemon. +endef + +define Package/tor-geoip +$(call Package/tor/Default) + TITLE:=GeoIP db for tor + DEPENDS:=+tor +endef + +define Package/tor-geoip/description +$(call Package/tor/Default/description) + This package contains a GeoIP database mapping IP addresses to countries. +endef + +define Package/tor/conffiles +/etc/tor/torrc +endef + +CONFIGURE_ARGS += \ + --with-libevent-dir="$(STAGING_DIR)/usr" \ + --with-ssl-dir="$(STAGING_DIR)/usr" \ + --disable-asciidoc \ + --disable-seccomp + +ifneq ($(CONFIG_SSP_SUPPORT),y) + CONFIGURE_ARGS += \ + --disable-gcc-hardening + MAKE_FLAGS += \ + CFLAGS="$(TARGET_CFLAGS) -std=gnu99" +else + MAKE_FLAGS += \ + CFLAGS="$(TARGET_CFLAGS) -fPIC -std=gnu99" +endif + +CONFIGURE_VARS += \ + CROSS_COMPILE="yes" + +define Package/tor/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor + $(INSTALL_DIR) $(1)/etc/tor + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/tor/torrc.sample $(1)/etc/tor/torrc +endef + +define Package/tor-geoip/install + $(INSTALL_DIR) $(1)/usr/share/tor + $(CP) $(PKG_INSTALL_DIR)/usr/share/tor/geoip $(1)/usr/share/tor/ +endef + +$(eval $(call BuildPackage,tor)) +$(eval $(call BuildPackage,tor-geoip)) diff --git a/net/tor/files/tor.init b/net/tor/files/tor.init new file mode 100644 index 0000000..6974057 --- /dev/null +++ b/net/tor/files/tor.init @@ -0,0 +1,26 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=50 +STOP=50 + +USE_PROCD=1 + +start_service() { + [ -f /var/run/tor.pid ] || { + touch /var/run/tor.pid + chown tor:tor /var/run/tor.pid + } + [ -d /var/lib/tor ] || { + mkdir -m 0755 -p /var/lib/tor + chmod 0700 /var/lib/tor + chown tor:tor /var/lib/tor + } + [ -d /var/log/tor ] || { + mkdir -m 0755 -p /var/log/tor + chown tor:tor /var/log/tor + } + procd_open_instance + procd_set_param command /usr/sbin/tor --runasdaemon 0 + procd_close_instance +} diff --git a/net/tor/patches/001-torrc.patch b/net/tor/patches/001-torrc.patch new file mode 100644 index 0000000..e295219 --- /dev/null +++ b/net/tor/patches/001-torrc.patch @@ -0,0 +1,21 @@ +--- a/src/config/torrc.sample.in ++++ b/src/config/torrc.sample.in +@@ -45,11 +45,11 @@ + ## Uncomment this to start the process in the background... or use + ## --runasdaemon 1 on the command line. This is ignored on Windows; + ## see the FAQ entry if you want Tor to run as an NT service. +-#RunAsDaemon 1 ++RunAsDaemon 1 + + ## The directory for keeping all the keys/etc. By default, we store + ## things in $HOME/.tor on Unix, and in Application Data\tor on Windows. +-#DataDirectory @LOCALSTATEDIR@/lib/tor ++DataDirectory @LOCALSTATEDIR@/lib/tor + + ## The port on which Tor will listen for local connections from Tor + ## controller applications, as documented in control-spec.txt. +@@ -190,3 +190,4 @@ + ## address manually to your friends, uncomment this line: + #PublishServerDescriptor 0 + ++User tor diff --git a/net/transmission/Makefile b/net/transmission/Makefile new file mode 100644 index 0000000..5a8a6be --- /dev/null +++ b/net/transmission/Makefile @@ -0,0 +1,193 @@ +# +# Copyright (C) 2009-2016 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:=transmission +PKG_VERSION:=2.92 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=https://github.com/transmission/transmission-releases/raw/master +PKG_MD5SUM:=3fce404a436e3cd7fde80fb6ed61c264 + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/transmission/template + SUBMENU:=BitTorrent + SECTION:=net + CATEGORY:=Network + TITLE:=BitTorrent client + URL:=http://www.transmissionbt.com + MAINTAINER:=Cezary Jackiewicz +endef + +define Package/transmission-daemon/Default + $(call Package/transmission/template) + DEPENDS:=+libcurl +libpthread +libevent2 +librt +zlib + USERID:=transmission=224:transmission=224 +endef + +define Package/transmission-daemon-openssl + $(call Package/transmission-daemon/Default) + TITLE+= (with OpenSSL) + DEPENDS+=+libopenssl + VARIANT:=openssl +endef + +define Package/transmission-daemon-polarssl + $(call Package/transmission-daemon/Default) + TITLE+= (with PolarSSL) + DEPENDS+=+libpolarssl + VARIANT:=polarssl +endef + +define Package/transmission-cli/Default + $(call Package/transmission/template) + DEPENDS:=+libcurl +libpthread +libevent2 +librt +zlib +endef + +define Package/transmission-cli-openssl + $(call Package/transmission-cli/Default) + TITLE+= (with OpenSSL) + DEPENDS+=+libopenssl + VARIANT:=openssl +endef + +define Package/transmission-cli-polarssl + $(call Package/transmission-cli/Default) + TITLE+= (with PolarSSL) + DEPENDS+=+libpolarssl + VARIANT:=polarssl +endef + +define Package/transmission-remote/Default + $(call Package/transmission/template) + DEPENDS:=+libcurl +libpthread +libevent2 +librt +zlib +endef + +define Package/transmission-remote-openssl + $(call Package/transmission-remote/Default) + TITLE+= (with OpenSSL) + DEPENDS+=+libopenssl + VARIANT:=openssl +endef + +define Package/transmission-remote-polarssl + $(call Package/transmission-remote/Default) + TITLE+= (with PolarSSL) + DEPENDS+=+libpolarssl + VARIANT:=polarssl +endef + +define Package/transmission-web + $(call Package/transmission/template) + TITLE+= (webinterface) + DEPENDS:=@(PACKAGE_transmission-daemon-openssl||PACKAGE_transmission-daemon-polarssl) +endef + + +define Package/transmission-daemon/Default/description + Transmission is a simple BitTorrent client. + It features a very simple, intuitive interface + on top on an efficient, cross-platform back-end. + This package contains the daemon itself. +endef +Package/transmission-daemon-openssl/description = $(Package/transmission-daemon/Default/description) +Package/transmission-daemon-polarssl/description = $(Package/transmission-daemon/Default/description) + +define Package/transmission-cli/Default/description + CLI utilities for transmission. +endef +Package/transmission-cli-openssl/description = $(Package/transmission-cli/Default/description) +Package/transmission-cli-polarssl/description = $(Package/transmission-cli/Default/description) + +define Package/transmission-remote/Default/description + CLI remote interface for transmission. +endef +Package/transmission-remote-openssl/description = $(Package/transmission-remote/Default/description) +Package/transmission-remote-polarssl/description = $(Package/transmission-remote/Default/description) + +define Package/transmission-web/description + Webinterface resources for transmission. +endef + +define Package/transmission-daemon-openssl/conffiles +/etc/config/transmission +endef +Package/transmission-daemon-polarssl/conffiles = $(Package/transmission-daemon-openssl/conffiles) + + +CONFIGURE_VARS += \ + LIBEVENT_LIBS="$(STAGING_DIR)/usr/lib/libevent-2.0.so.5" + +CONFIGURE_ARGS += \ + --enable-daemon \ + --enable-cli \ + --without-gtk \ + --enable-largefile \ + --enable-lightweight + +ifeq ($(BUILD_VARIANT),openssl) + CONFIGURE_ARGS += \ + --with-crypto=openssl +endif + +ifeq ($(BUILD_VARIANT),polarssl) + CONFIGURE_ARGS += \ + --with-crypto=polarssl +endif + +MAKE_FLAGS += \ + CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE" + +TARGET_CFLAGS += -std=gnu99 + +define Package/transmission-daemon-openssl/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/transmission-daemon $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) files/transmission.init $(1)/etc/init.d/transmission + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) files/transmission.config $(1)/etc/config/transmission +endef +Package/transmission-daemon-polarssl/install = $(Package/transmission-daemon-openssl/install) + +define Package/transmission-cli-openssl/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/transmission-cli \ + $(PKG_INSTALL_DIR)/usr/bin/transmission-create \ + $(PKG_INSTALL_DIR)/usr/bin/transmission-edit \ + $(PKG_INSTALL_DIR)/usr/bin/transmission-show \ + $(1)/usr/bin/ +endef +Package/transmission-cli-polarssl/install = $(Package/transmission-cli-openssl/install) + +define Package/transmission-remote-openssl/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/transmission-remote $(1)/usr/bin/ +endef +Package/transmission-remote-polarssl/install = $(Package/transmission-remote-openssl/install) + +define Package/transmission-web/install + $(INSTALL_DIR) $(1)/usr/share/transmission + $(CP) $(PKG_INSTALL_DIR)/usr/share/transmission/web $(1)/usr/share/transmission/ +endef + +$(eval $(call BuildPackage,transmission-daemon-openssl)) +$(eval $(call BuildPackage,transmission-daemon-polarssl)) +$(eval $(call BuildPackage,transmission-cli-openssl)) +$(eval $(call BuildPackage,transmission-cli-polarssl)) +$(eval $(call BuildPackage,transmission-remote-openssl)) +$(eval $(call BuildPackage,transmission-remote-polarssl)) +$(eval $(call BuildPackage,transmission-web)) diff --git a/net/transmission/files/transmission.config b/net/transmission/files/transmission.config new file mode 100644 index 0000000..2ea69d0 --- /dev/null +++ b/net/transmission/files/transmission.config @@ -0,0 +1,74 @@ +config transmission + option enabled 0 + option config_dir '/tmp/transmission' + #option user 'nobody' + option mem_percentage 50 + option nice 10 + option ionice_flags '-c 3' + option alt_speed_down 50 + option alt_speed_enabled false + option alt_speed_time_begin 540 + option alt_speed_time_day 127 + option alt_speed_time_enabled false + option alt_speed_time_end 1020 + option alt_speed_up 50 + option bind_address_ipv4 '0.0.0.0' + option bind_address_ipv6 '::' + option blocklist_enabled false + option blocklist_url '' + option cache_size_mb 2 + option dht_enabled true + option download_dir '/tmp/transmission/done' + option download_queue_enabled true + option download_queue_size 4 + option encryption 1 + option idle_seeding_limit 30 + option idle_seeding_limit_enabled false + option incomplete_dir '/tmp/transmission/incomplete' + option incomplete_dir_enabled false + option lazy_bitfield_enabled true + option lpd_enabled false + option message_level 1 + option peer_congestion_algorithm '' + option peer_limit_global 240 + option peer_limit_per_torrent 60 + option peer_port 51413 + option peer_port_random_high 65535 + option peer_port_random_low 49152 + option peer_port_random_on_start false + option peer_socket_tos 'default' + option pex_enabled true + option port_forwarding_enabled true + option preallocation 1 + option prefetch_enabled true + option queue_stalled_enabled true + option queue_stalled_minutes 30 + option ratio_limit 2.0000 + option ratio_limit_enabled false + option rename_partial_files true + option rpc_authentication_required false + option rpc_bind_address '0.0.0.0' + option rpc_enabled true + option rpc_password '' + option rpc_port 9091 + option rpc_url '/transmission/' + option rpc_username '' + option rpc_whitelist '127.0.0.1,192.168.1.*' + option rpc_whitelist_enabled true + option scrape_paused_torrents_enabled true + option script_torrent_done_enabled false + option script_torrent_done_filename '' + option seed_queue_enabled false + option seed_queue_size 10 + option speed_limit_down 100 + option speed_limit_down_enabled false + option speed_limit_up 20 + option speed_limit_up_enabled false + option start_added_torrents true + option trash_original_torrent_files false + option umask 18 + option upload_slots_per_torrent 14 + option utp_enabled true + option scrape_paused_torrents true + option watch_dir_enabled false + option watch_dir '' diff --git a/net/transmission/files/transmission.init b/net/transmission/files/transmission.init new file mode 100644 index 0000000..f7b1d41 --- /dev/null +++ b/net/transmission/files/transmission.init @@ -0,0 +1,134 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2010-2015 OpenWrt.org + +START=99 +USE_PROCD=1 + + +LIST_SEP=" +" + +append_params() { + local p; local v; local s="$1"; shift + for p in $*; do + config_get v "$s" "$p" + IFS="$LIST_SEP" + for v in $v; do + [ -n "$v" ] && ( + echo "\""$p"\": "$v"," | sed -e 's|_|-|g' >> $config_file + ) + done + unset IFS + done +} + +append_params_quotes() { + local p; local v; local s="$1"; shift + for p in $*; do + config_get v "$s" "$p" + IFS="$LIST_SEP" + for v in $v; do + [ -n "$v" ] && ( + echo -n "\""$p | sed -e 's|/|\\/|g;s|_|-|g' >> $config_file; \ + echo "\": \""$v"\"," >> $config_file + ) + done + unset IFS + done +} + +section_enabled() { + config_get_bool enabled "$1" 'enabled' 0 + [ $enabled -gt 0 ] +} + +transmission() { + local cfg="$1" + local USE + + local user + local download_dir config_dir + local mem_percentage + local config_overwrite nice ionice_flags + local cmdline + + section_enabled "$section" || return 1 + + config_get config_dir "$cfg" 'config_dir' '/var/etc/transmission' + config_get user "$cfg" 'user' + config_get download_dir "$cfg" 'download_dir' '/var/etc/transmission' + config_get mem_percentage "$cfg" 'mem_percentage' '50' + config_get config_overwrite "$cfg" config_overwrite 1 + config_get nice "$cfg" nice 0 + config_get ionice_flags "$cfg" ionice_flags '' + which ionice > /dev/null || ionice_flags='' + + local MEM=$(sed -ne 's!^MemTotal:[[:space:]]*\([0-9]*\) kB$!\1!p' /proc/meminfo) + if test "$MEM" -gt 1;then + USE=$(expr $MEM \* $mem_percentage \* 10) + fi + + config_file="$config_dir/settings.json" + [ -d $config_dir ] || { + mkdir -m 0755 -p "$config_dir" + touch $config_file + [ -z "$user" ] || chown -R $user $config_dir + } + + [ "$config_overwrite" == 0 ] || { + + echo "{" > $config_file + + append_params "$cfg" \ + alt_speed_down alt_speed_enabled alt_speed_time_begin alt_speed_time_day \ + alt_speed_time_enabled alt_speed_time_end alt_speed_up blocklist_enabled \ + cache_size_mb download_queue_enabled download_queue_size \ + dht_enabled encryption idle_seeding_limit idle_seeding_limit_enabled \ + incomplete_dir_enabled lazy_bitfield_enabled lpd_enabled message_level \ + peer_limit_global peer_limit_per_torrent peer_port \ + peer_port_random_high peer_port_random_low peer_port_random_on_start \ + pex_enabled port_forwarding_enabled preallocation prefetch_enabled \ + ratio_limit ratio_limit_enabled rename_partial_files rpc_authentication_required \ + rpc_enabled rpc_port rpc_whitelist_enabled queue_stalled_enabled \ + queue_stalled_minutes scrape_paused_torrents_enabled script_torrent_done_enabled \ + seed_queue_enabled seed_queue_size \ + speed_limit_down speed_limit_down_enabled speed_limit_up \ + speed_limit_up_enabled start_added_torrents trash_original_torrent_files \ + umask upload_slots_per_torrent utp_enabled scrape_paused_torrents \ + watch_dir_enabled + + append_params_quotes "$cfg" \ + blocklist_url bind_address_ipv4 bind_address_ipv6 download_dir incomplete_dir \ + peer_congestion_algorithm peer_socket_tos rpc_bind_address rpc_password rpc_url \ + rpc_username rpc_whitelist script_torrent_done_filename watch_dir + + echo "\""invalid-key"\": false" >> $config_file + echo "}" >> $config_file + + } + + cmdline="/usr/bin/transmission-daemon -g $config_dir -f" + [ "$ionice_flags" ] && cmdline="ionice $ionice_flags $cmdline" + procd_open_instance + procd_set_param command $cmdline + procd_set_param respawn retry=60 + procd_set_param user "$user" + procd_set_param nice "$nice" + if test -z "$USE";then + procd_set_param limits core="0 0" + else + procd_set_param limits core="0 0" as="$USE $USE" + logger -t transmission "Starting with $USE virt mem" + fi + + procd_add_jail transmission log + procd_add_jail_mount $config_file + procd_add_jail_mount_rw $download_dir + procd_close_instance +} + +start_service() { + config_load 'transmission' + config_foreach transmission 'transmission' +} + diff --git a/net/transmission/patches/020-use-internal-miniupnp.patch b/net/transmission/patches/020-use-internal-miniupnp.patch new file mode 100644 index 0000000..9a99fe8 --- /dev/null +++ b/net/transmission/patches/020-use-internal-miniupnp.patch @@ -0,0 +1,11 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -378,7 +378,7 @@ dnl See if ANY version of miniupnpc is i + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([#include ], + [struct UPNPDev dev;])], +- [upnp_version="unknown"], ++ [upnp_version="none"], + [upnp_version="none"] + ) + diff --git a/net/transmission/patches/030-fix-musl-build.patch b/net/transmission/patches/030-fix-musl-build.patch new file mode 100644 index 0000000..1747402 --- /dev/null +++ b/net/transmission/patches/030-fix-musl-build.patch @@ -0,0 +1,30 @@ +--- a/libtransmission/bitfield.c ++++ b/libtransmission/bitfield.c +@@ -7,6 +7,8 @@ + * $Id: bitfield.c 14646 2015-12-31 05:22:42Z mikedld $ + */ + ++#define __NEED_ssize_t ++ + #include + #include /* memset */ + +@@ -14,6 +16,7 @@ + #include "bitfield.h" + #include "utils.h" /* tr_new0 () */ + ++ + const tr_bitfield TR_BITFIELD_INIT = { NULL, 0, 0, 0, false, false }; + + /**** +--- a/libtransmission/fdlimit.h ++++ b/libtransmission/fdlimit.h +@@ -11,6 +11,8 @@ + #error only libtransmission should #include this header. + #endif + ++#define __NEED_off_t ++ + #include "transmission.h" + #include "file.h" + #include "net.h" diff --git a/net/travelmate/Makefile b/net/travelmate/Makefile new file mode 100644 index 0000000..ec41e09 --- /dev/null +++ b/net/travelmate/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (c) 2016 Dirk Brenken (dev@brenken.org) +# This is free software, licensed under the GNU General Public License v3. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=travelmate +PKG_VERSION:=0.2.7 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-3.0+ +PKG_MAINTAINER:=Dirk Brenken + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SECTION:=net + CATEGORY:=Network + TITLE:=A wlan connection manager for travel router + PKGARCH:=all +endef + +define Package/$(PKG_NAME)/description +A wlan connection manager for travel router. +Please see https://github.com/openwrt/packages/blob/master/net/travelmate/files/README.md for further information. + +endef + +define Package/$(PKG_NAME)/conffiles +/etc/config/travelmate +endef + +define Build/Prepare +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) ./files/travelmate.sh $(1)/usr/bin/ + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/travelmate.init $(1)/etc/init.d/travelmate + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/travelmate.conf $(1)/etc/config/travelmate +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/net/travelmate/files/README.md b/net/travelmate/files/README.md new file mode 100644 index 0000000..2f8084a --- /dev/null +++ b/net/travelmate/files/README.md @@ -0,0 +1,138 @@ +# travelmate, a wlan connection manager for travel router + +## Description +If you’re planning an upcoming vacation or a business trip, taking your laptop, tablet or smartphone give you the ability to connect with friends or complete work on the go. But many hotels don’t have a secure wireless network setup or you’re limited on using a single device at once. Investing in a portable, mini travel router is a great way to connect all of your devices at once while having total control over your own personalized wireless network. +A logical combination of AP+STA mode on one physical radio allows most of OpenWrt/LEDE supported router devices to connect to a wireless hotspot/station (STA) and provide a wireless access point (AP) from that hotspot at the same time. Downside of this solution: whenever the STA interface looses the connection it will go into an active scan cycle which renders the radio unusable for AP mode operation, therefore the AP is taken down if the STA looses its association. +To avoid these kind of deadlocks, travelmate set all station interfaces in an "always off" mode, connects automatically to available hotspots and monitor & change these uplink connections automatically if required. + +## Main Features +* STA interfaces operating in an "always off" mode, to make sure that the AP is always accessible +* fast uplink connections +* reliable connection tracking +* easy setup within normal OpenWrt/LEDE environment +* status & debug logging to syslog +* procd init system support + +## Prerequisites +* [OpenWrt](https://openwrt.org) or [LEDE](https://www.lede-project.org) trunk +* iw (default) or iwinfo for wlan scanning + +## OpenWrt / LEDE trunk Installation & Usage +* download the package [here](https://downloads.lede-project.org/snapshots/packages/x86_64/packages) +* install 'travelmate' (_opkg install travelmate_) +* configure your network to support (multiple) wlan uplinks and set travelmate config options (details see below) +* set 'trm\_enabled' option in travelmate config to '1' +* travelmate starts automatically during boot, triggered by procd as soon as the wireless subsystem is up & running + +## LuCI travelmate companion package +* download the package [here](https://downloads.lede-project.org/snapshots/packages/x86_64/luci) +* install 'luci-app-travelmate' (_opkg install luci-app-travelmate_) +* the application is located in LuCI under 'Services' menu +* _Thanks to Hannu Nyman for this great LuCI frontend!_ + +## Chaos Calmer installation notes +* 'travelmate' and 'luci-app-travelmate' are _not_ available as ipk packages in the Chaos Calmer download repository +* download the packages from a development snapshot directory (see download links above) +* manually transfer the packages to your routers temp directory (with tools like _sshfs_ or _winscp_) +* install the packages as described above + +## Travelmate config options +* mandatory config options: + * trm\_enabled => main switch to enable/disable the travelmate service (default: '0', disabled) + * trm\_loop => loop timeout in seconds for wlan monitoring (default: '30') + * trm\_maxretry => how many times should travelmate try to connect to a certain uplink, to disable this check at all set it to '0' (default: '3') +* optional config options: + * trm\_debug => enable/disable debug logging (default: '0', disabled) + * trm\_device => limit travelmate to a dedicated radio, i.e 'radio0' (default: use all radios) + * trm\_iw => set this option to '0' to use iwinfo for wlan scanning (default: '1', use iw) + +## Setup +**1. configure a wwan interface in /etc/config/network:** +

+[...]
+config interface 'wwan'
+        option proto 'dhcp'
+[...]
+
+ +**2. add this interface to your firewall configuration in /etc/config/firewall:** +

+[...]
+config zone
+        option name 'wan'
+        option input 'REJECT'
+        option output 'ACCEPT'
+        option forward 'REJECT'
+        option masq '1'
+        option mtu_fix '1'
+        option network 'wan wan6 wwan'
+[...]
+
+ +**3. add required ap and wwan stations to your wireless configuration in etc/config/wireless:** +

+[...]
+config wifi-iface
+        option device 'radio0'
+        option network 'lan'
+        option ifname 'wlan0'
+        option mode 'ap'
+        option ssid 'example_ap'
+        option encryption 'psk2+ccmp'
+        option key 'abc'
+        option disabled '0'
+[...]
+config wifi-iface
+        option device 'radio0'
+        option network 'wwan'
+        option mode 'sta'
+        option ssid 'example_01'
+        option ifname 'wwan01'
+        option encryption 'psk2+ccmp'
+        option key 'abc'
+        option disabled '1'
+config wifi-iface
+        option device 'radio0'
+        option network 'wwan'
+        option mode 'sta'
+        option ssid 'example_02'
+        option ifname 'wwan02'
+        option encryption 'psk2+ccmp'
+        option key 'xyz'
+        option disabled '1'
+config wifi-iface
+        option device 'radio0'
+        option network 'wwan'
+        option mode 'sta'
+        option ssid 'example_03'
+        option ifname 'wwan03'
+        option encryption 'none'
+        option disabled '1'
+[...]
+
+ +**4. reload network configuration & start travelmate:** +

+/etc/init.d/network reload
+/etc/init.d/travelmate start
+
+ +**Common runtime outputs (visible via logread)** + +**Success:** Sun Oct 9 17:02:21 2016 user.notice root: travelmate-0.2.1[712] info : wlan interface "wwan06" connected to uplink "blackhole.nl" + +**Disabled service:** Sun Oct 9 18:06:32 2016 user.notice root: travelmate-0.2.1[2379] info : travelmate is currently disabled, please set 'trm_enabled' to use this service + +**Misconfigured/broken uplink:** Sun Oct 9 18:56:42 2016 user.notice root: travelmate-0.2.1[2435] info : uplink "blackhole.nl" disabled due to permanent connection failures + +**Uplink disappeared:** Sun Oct 9 19:00:28 2016 user.notice root: travelmate-0.2.1[3876] info : uplink "Neffos C5L" get lost + +## Support +Please join the travelmate discussion in this [forum thread](https://forum.openwrt.org/viewtopic.php?id=67697) or contact me by [mail](mailto:dev@brenken.org) + +## Removal +* stop the travelmate daemon with _/etc/init.d/travelmate stop_ +* optional: remove the travelmate package (_opkg remove travelmate_) + +Have fun! +Dirk diff --git a/net/travelmate/files/travelmate.conf b/net/travelmate/files/travelmate.conf new file mode 100644 index 0000000..e413a8c --- /dev/null +++ b/net/travelmate/files/travelmate.conf @@ -0,0 +1,7 @@ +# travelmate configuration, for further information +# see 'https://github.com/openwrt/packages/blob/master/net/travelmate/files/README.md' + +config travelmate 'global' + option trm_enabled '0' + option trm_loop '30' + option trm_maxretry '3' diff --git a/net/travelmate/files/travelmate.init b/net/travelmate/files/travelmate.init new file mode 100755 index 0000000..fc3e9ed --- /dev/null +++ b/net/travelmate/files/travelmate.init @@ -0,0 +1,25 @@ +#!/bin/sh /etc/rc.common + +START=85 +USE_PROCD=1 + +exec 2>/dev/null +trm_script="/usr/bin/travelmate.sh" + +start_service() +{ + ubus -t 30 wait_for network.wireless + if [ $(($?)) -eq 0 ] + then + procd_open_instance + procd_set_param command "${trm_script}" + procd_close_instance + else + logger -s "travelmate [procd]:" "no wlan devices found, travelmate startup canceled" + fi +} + +service_triggers() +{ + procd_add_reload_trigger "travelmate" +} diff --git a/net/travelmate/files/travelmate.sh b/net/travelmate/files/travelmate.sh new file mode 100755 index 0000000..fa0d7ae --- /dev/null +++ b/net/travelmate/files/travelmate.sh @@ -0,0 +1,281 @@ +#!/bin/sh +# travelmate, a wlan connection manager for travel router +# written by Dirk Brenken (dev@brenken.org) + +# This is free software, licensed under the GNU General Public License v3. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# prepare environment +# +LC_ALL=C +PATH="/usr/sbin:/usr/bin:/sbin:/bin" +trm_pid="${$}" +trm_ver="0.2.7" +trm_debug=0 +trm_loop=30 +trm_maxretry=3 +trm_iw=1 +trm_device="" + +# function to prepare all relevant AP and STA interfaces +# +f_prepare() +{ + local config="${1}" + local mode="$(uci -q get wireless."${config}".mode)" + local device="$(uci -q get wireless."${config}".device)" + local network="$(uci -q get wireless."${config}".network)" + local disabled="$(uci -q get wireless."${config}".disabled)" + + if [ "${mode}" = "ap" ] && [ -n "${network}" ] && + ([ -z "${trm_device}" ] || [ "${trm_device}" = "${device}" ]) + then + f_ifname "${device}" + if [ -z "${disabled}" ] || [ "${disabled}" = "1" ] + then + f_set "none" "${config}" "${network}" "up" + fi + elif [ "${mode}" = "sta" ] && [ -n "${network}" ] + then + trm_stalist="${trm_stalist} ${config}_${network}" + if [ -z "${disabled}" ] || [ "${disabled}" = "0" ] + then + f_set "none" "${config}" "${network}" "down" + fi + fi +} + +# function to set different wlan interface status +# +f_set() +{ + local change="${1}" + local config="${2}" + local interface="${3}" + local command="${4}" + + if [ "${command}" = "up" ] + then + uci -q set wireless."${config}".disabled=0 + ubus call network.interface."${interface}" "${command}" + trm_checklist="${trm_checklist} ${interface}" + elif [ "${command}" = "down" ] + then + uci -q set wireless."${config}".disabled=1 + ubus call network.interface."${interface}" "${command}" + fi + + f_log "debug" "set ::: change: ${change}, config: ${config}, interface: ${interface}, command: ${command}, checklist: ${trm_checklist}, uci-changes: $(uci -q changes wireless)" + if [ -n "$(uci -q changes wireless)" ] + then + if [ "${change}" = "commit" ] + then + uci -q commit wireless + ubus call network reload + f_check + elif [ "${change}" = "partial" ] + then + ubus call network reload + f_check + elif [ "${change}" = "defer" ] + then + uci -q revert wireless + elif [ "${change}" = "revert" ] + then + uci -q revert wireless + ubus call network reload + f_check + fi + fi +} + +# function to get ap ifnames by ubus call +# +f_ifname() +{ + local device="${1}" + local name cfg + + json_load "$(ubus -S call network.wireless status)" + json_select "${device}" + json_get_keys if_list interfaces + json_select interfaces + for iface in ${if_list} + do + json_select "${iface}" + json_get_var name ifname + json_select "config" + json_get_var cfg mode + if [ -n "${name}" ] && [ "${cfg}" = "ap" ] + then + trm_aplist="${trm_aplist} ${name}" + fi + done +} + +# function to check interface status on "up" event +# +f_check() +{ + local interface value + local cnt=0 + + for interface in ${trm_checklist} + do + while [ $((cnt)) -lt 15 ] + do + json_load "$(ubus -S call network.interface."${interface}" status)" + json_get_var trm_status up + if [ "${trm_status}" = "1" ] || [ -n "${trm_uplink}" ] + then + f_log "debug" "check::: interface: ${interface}, status: ${trm_status}, uplink-cfg: ${trm_uplink}, uplink-ssid: ${trm_ssid}, loop-cnt: ${cnt}, error-cnt: $((trm_count_${trm_config}))" + json_cleanup + break + fi + cnt=$((cnt+1)) + sleep 1 + done + done + if [ -n "${trm_uplink}" ] && [ "${trm_status}" = "0" ] + then + ubus call network reload + eval "trm_count_${trm_uplink}=\$((trm_count_${trm_uplink}+1))" + trm_checklist="" + trm_uplink="" + f_log "info" "uplink ${trm_ssid} get lost" + elif [ -z "${trm_uplink}" ] && [ -n "${trm_checklist}" ] + then + trm_checklist="" + fi +} + +# function to write to syslog +# +f_log() +{ + local class="${1}" + local log_msg="${2}" + + if [ -n "${log_msg}" ] && ([ "${class}" != "debug" ] || ([ "${class}" = "debug" ] && [ $((trm_debug)) -eq 1 ])) + then + logger -t "travelmate-${trm_ver}[${trm_pid}] ${class}" "${log_msg}" 2>&1 + fi +} + +# source required system libraries +# +if [ -r "/lib/functions.sh" ] && [ -r "/usr/share/libubox/jshn.sh" ] +then + . "/lib/functions.sh" + . "/usr/share/libubox/jshn.sh" + json_init +else + f_log "error" "required system libraries not found" + exit 255 +fi + +# load uci config and check 'enabled' option +# +option_cb() +{ + local option="${1}" + local value="${2}" + eval "${option}=\"${value}\"" +} + +config_load travelmate + +if [ "${trm_enabled}" != "1" ] +then + f_log "info" "travelmate is currently disabled, please set 'trm_enabled' to '1' to use this service" + exit 0 +fi + +# check for preferred wireless tool +# +if [ $((trm_iw)) -eq 1 ] +then + trm_scanner="$(which iw)" +else + trm_scanner="$(which iwinfo)" +fi + +if [ -z "${trm_scanner}" ] +then + f_log "error" "no wireless tool for wlan scanning found, please install 'iw' or 'iwinfo'" + exit 1 +fi + +# infinitive loop to establish and track STA uplink connections +# +while true +do + if [ -z "${trm_uplink}" ] || [ "${trm_status}" = "0" ] + then + trm_aplist="" + trm_stalist="" + config_load wireless + config_foreach f_prepare wifi-iface + f_set "commit" + if [ -z "${trm_aplist}" ] + then + f_log "error" "no usable AP configuration found, please check '/etc/config/wireless'" + exit 1 + fi + for ap in ${trm_aplist} + do + ubus -t 10 wait_for hostapd."${ap}" + if [ $((trm_iw)) -eq 1 ] + then + trm_ssidlist="$(${trm_scanner} dev "${ap}" scan 2>/dev/null | awk '/SSID: /{if(!seen[$0]++){printf "\"";for(i=2; i<=NF; i++)if(i==2)printf $i;else printf " "$i;printf "\" "}}')" + else + trm_ssidlist="$(${trm_scanner} "${ap}" scan | awk '/ESSID: ".*"/{ORS=" ";if (!seen[$0]++) for(i=2; i<=NF; i++) print $i}')" + fi + f_log "debug" "main ::: scan-tool: ${trm_scanner}, aplist: ${trm_aplist}, ssidlist: ${trm_ssidlist}" + if [ -n "${trm_ssidlist}" ] + then + if [ -z "${trm_stalist}" ] + then + f_log "error" "no usable STA configuration found, please check '/etc/config/wireless'" + exit 1 + fi + for sta in ${trm_stalist} + do + trm_config="${sta%%_*}" + trm_network="${sta##*_}" + trm_ssid="\"$(uci -q get wireless."${trm_config}".ssid)\"" + if [ $((trm_count_${trm_config})) -lt $((trm_maxretry)) ] || [ $((trm_maxretry)) -eq 0 ] + then + if [ -n "$(printf "${trm_ssidlist}" | grep -Fo "${trm_ssid}")" ] + then + f_set "partial" "${trm_config}" "${trm_network}" "up" + if [ "${trm_status}" = "1" ] + then + trm_checklist="${trm_network}" + trm_uplink="${trm_config}" + f_set "defer" + f_log "info" "wwan interface connected to uplink ${trm_ssid}" + break 2 + else + f_set "revert" + eval "trm_count_${trm_config}=\$((trm_count_${trm_config}+1))" + fi + fi + elif [ $((trm_count_${trm_config})) -eq $((trm_maxretry)) ] && [ $((trm_maxretry)) -ne 0 ] + then + eval "trm_count_${trm_config}=\$((trm_count_${trm_config}+1))" + f_log "info" "uplink ${trm_ssid} disabled due to permanent connection failures" + fi + done + fi + sleep 5 + done + else + f_check + if [ -n "${trm_uplink}" ] + then + sleep ${trm_loop} + fi + fi +done diff --git a/net/u2pnpd/Makefile b/net/u2pnpd/Makefile new file mode 100644 index 0000000..3f77ba3 --- /dev/null +++ b/net/u2pnpd/Makefile @@ -0,0 +1,63 @@ +# +# Copyright (C) 2015-2016 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:=u2pnpd +PKG_VERSION:=0.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=https://github.com/mhei/u2pnpd/releases/download/v$(PKG_VERSION) +PKG_MD5SUM:=ac6f378590d3e4e38b40e4b13f03b369 + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_MAINTAINER:=Michael Heimpold + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/u2pnpd + SECTION:=net + CATEGORY:=Network + TITLE:=Announce device via UPnP on the network + URL:=https://github.com/mhei/u2pnpd + DEPENDS:=+libupnp +endef + +define Package/u2pnpd/description + This tools announces a device via UPnP on the local network, thus it is possible + to find it within the network neightboorhood of a well-known OS and the user + can easily double-click on an icon to open the web frontend of this device without + knowing the IP address. +endef + +define Package/u2pnpd/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/u2pnpd $(1)/usr/bin/ + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/u2pnpd.init $(1)/etc/init.d/u2pnpd + + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_DATA) ./files/u2pnpd.defaults $(1)/etc/uci-defaults/u2pnpd + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/u2pnpd.config $(1)/etc/config/u2pnpd +endef + +define Package/u2pnpd/postinst +#!/bin/sh +[ -n "$${IPKG_INSTROOT}" ] || (. /etc/uci-defaults/u2pnpd) && rm -f /etc/uci-defaults/u2pnpd +exit 0 +endef + +$(eval $(call BuildPackage,u2pnpd)) diff --git a/net/u2pnpd/files/u2pnpd.config b/net/u2pnpd/files/u2pnpd.config new file mode 100644 index 0000000..8c0d561 --- /dev/null +++ b/net/u2pnpd/files/u2pnpd.config @@ -0,0 +1,11 @@ +config u2pnpd +# option interface br-lan +# option use_https no +# option manufacturer 'OpenWrt' +# option manufacturerURL 'http://www.openwrt.org/' +# option modelDescription '' +# option modelName 'Generic' +# option modelNumber '' +# option modelURL '' +# option serialNumber '' +# option uuid '' diff --git a/net/u2pnpd/files/u2pnpd.defaults b/net/u2pnpd/files/u2pnpd.defaults new file mode 100644 index 0000000..322b0bc --- /dev/null +++ b/net/u2pnpd/files/u2pnpd.defaults @@ -0,0 +1,10 @@ +#!/bin/sh + +uuid=$(cat /proc/sys/kernel/random/uuid) + +uci -q batch <<-EOF >/dev/null + set u2pnpd.@u2pnpd[0].uuid=$uuid + commit u2pnpd +EOF + +exit 0 diff --git a/net/u2pnpd/files/u2pnpd.init b/net/u2pnpd/files/u2pnpd.init new file mode 100644 index 0000000..01437fd --- /dev/null +++ b/net/u2pnpd/files/u2pnpd.init @@ -0,0 +1,62 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 OpenWrt.org + +START=50 +STOP=20 + +SERVICE_DAEMONIZE=1 +SERVICE_PID_FILE=/var/run/u2pnpd.pid +SERVICE_USE_PID=1 +SERVICE_WRITE_PID=1 + +start_instance() { + local section="$1" + local enabled + local interface manufacturer manufacturerURL modelDescription + local modelName modelNumber modelURL serialNumber friendlyName + local uuid httpsURL + local i + + config_get_bool enabled "$section" 'enabled' 1 + [ "$enabled" -gt 0 ] || return 0 + + for i in interface httpsURL manufacturer manufacturerURL modelDescription \ + modelName modelNumber modelURL serialNumber friendlyName uuid; do + config_get "$i" "$section" "$i" + done + + [ -n "$interface" ] && SERVICE_PID_FILE="/var/run/u2pnpd.$interface.pid" + + service_start /usr/bin/u2pnpd ${httpsURL:+-s} \ + ${interface:+--interface="$interface"} \ + ${manufacturer:+--manufacturer="$manufacturer"} \ + ${manufacturerURL:+--manufacturerURL="$manufacturerURL"} \ + ${modelDescription:+--modelDescription="$modelDescription"} \ + ${modelName:+--modelName="$modelName"} \ + ${modelNumber:+--modelNumber="$modelNumber"} \ + ${modelURL:+--modelURL="$modelURL"} \ + ${serialNumber:+--serialNumber="$serialNumber"} \ + ${friendlyName:+--friendlyName="$friendlyName"} \ + ${uuid:+--uuid="$uuid"} +} + +stop_instance() { + local section="$1" + local interface + + config_get interface "$section" 'interface' + [ -n "$interface" ] && SERVICE_PID_FILE="/var/run/u2pnpd.$interface.pid" + + service_stop /usr/bin/u2pnpd + rm -f "$SERVICE_PID_FILE" +} + +start() { + config_load 'u2pnpd' + config_foreach start_instance 'u2pnpd' +} + +stop() { + config_load 'u2pnpd' + config_foreach stop_instance 'u2pnpd' +} diff --git a/net/uanytun/Makefile b/net/uanytun/Makefile new file mode 100644 index 0000000..d9b8c98 --- /dev/null +++ b/net/uanytun/Makefile @@ -0,0 +1,175 @@ +# +# Copyright (C) 2008-2014 Christian Pointner, +# +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# This Makefile builds uAnytun Package for OpenWRT +# +# $Id: $ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=uanytun +PKG_VERSION:=0.3.5 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.anytun.org/download/ +PKG_MD5SUM:=ce47ad45003ff1d84eaf5276941b9ddf +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) +PKG_MAINTAINER:=Christian Pointner +PKG_LICENSE:=GPL-3.0+ +PKG_LICENSE_FILES:=LICENSE +include $(INCLUDE_DIR)/package.mk + + +define Package/uanytun/template + SECTION:=net + CATEGORY:=Network + SUBMENU:=VPN + DEPENDS:=+kmod-tun + TITLE:=micro anycast tunneling daemon + URL:=http://www.anytun.org/ +endef + + +define Package/uanytun + $(call Package/uanytun/template) + TITLE+= (gcrypt) + VARIANT:=gcrypt + DEPENDS+=+libgcrypt +endef + +define Package/uanytun/conffiles +/etc/config/uanytun +endef + +define Package/uanytun/description +uAnytun is a tiny implementation of SATP the secure anycast tunneling protocol. + SATP defines a protocol used for communication between any combination of + unicast and anycast tunnel endpoints. It has less protocol overhead than + IPSec in Tunnel mode and allows tunneling of every ETHER TYPE protocol (e.g. + ethernet, ip, arp ...). SATP directly includes cryptography and message + authentication based on the methods used by SRTP. It is intended to deliver + a generic, scalable and secure solution for tunneling and relaying of packets + of any protocol. + Unlike Anytun which is a full featured implementation uAnytun has no support + for multiple connections or synchronisation. It is a small single threaded + implementation intended to act as a client on small platforms. +endef + + +define Package/uanytun-nettle + $(call Package/uanytun/template) + TITLE+= (nettle) + VARIANT:=nettle + DEPENDS+=+libnettle +endef + +Package/uanytun-nettle/conffiles=$(Package/uanytun/conffiles) +Package/uanytun-nettle/description=$(Package/uanytun/description) + + +define Package/uanytun-sslcrypt + $(call Package/uanytun/template) + TITLE+= (openssl) + VARIANT:=sslcrypt + DEPENDS+=+libopenssl +endef + +Package/uanytun-sslcrypt/conffiles=$(Package/uanytun/conffiles) +Package/uanytun-sslcrypt/description=$(Package/uanytun/description) + + +define Package/uanytun-nocrypt + $(call Package/uanytun/template) + TITLE+= (no crypt) + VARIANT:=nocrypt +endef + +Package/uanytun-nocrypt/conffiles=$(Package/uanytun/conffiles) +Package/uanytun-nocrypt/description=$(Package/uanytun/description) + + + +define Build/Configure + (cd $(PKG_BUILD_DIR)/src; \ + touch include.mk; \ + ln -s linux/tun.c .; \ + echo '#ifndef UANYTUN_version_h_INCLUDED' > version.h; \ + echo '#define UANYTUN_version_h_INCLUDED' >> version.h; \ + echo '' >> version.h; \ + echo '#define VERSION_STRING_0 "uanytun version '`cat $(PKG_BUILD_DIR)/version`'"' >> version.h; \ + echo '#define VERSION_STRING_1 "built on '`hostname`', '`date +"%d.%m.%Y %H:%M:%S %Z"`'"' >> version.h; \ + echo '' >> version.h; \ + echo '#endif' >> version.h \ + ) +endef + +VARIANT_CFLAGS:= +VARIANT_LDFLAGS:=-ldl +VARIANT_MAKE_OPTS:= + +ifeq ($(BUILD_VARIANT),gcrypt) +VARIANT_CFLAGS+=-DUSE_GCRYPT +VARIANT_LDFLAGS+=-lgpg-error -lgcrypt +endif + +ifeq ($(BUILD_VARIANT),nettle) +VARIANT_CFLAGS+=-DUSE_NETTLE +VARIANT_LDFLAGS+=-lnettle +endif + +ifeq ($(BUILD_VARIANT),sslcrypt) +VARIANT_CFLAGS+=-DUSE_SSL_CRYPTO +VARIANT_LDFLAGS+=-lcrypto +endif + +ifeq ($(BUILD_VARIANT),nocrypt) +VARIANT_CFLAGS+=-DNO_CRYPT +VARIANT_MAKE_OPTS+=NO_CRYPT_OBJ=1 +endif + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR)/src \ + $(TARGET_CONFIGURE_OPTS) \ + $(VARIANT_MAKE_OPTS) \ + TARGET=Linux \ + CFLAGS="$(TARGET_CFLAGS) $(VARIANT_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS) $(VARIANT_LDFLAGS)" + $(STRIP) $(PKG_BUILD_DIR)/src/uanytun +endef + + +define Package/uanytun/install-generic + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/$(2) $(1)/etc/config/$(PKG_NAME) + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/uanytun $(1)/usr/sbin/$(PKG_NAME) + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/uanytun.init $(1)/etc/init.d/$(PKG_NAME) +endef + +define Package/uanytun/install + $(call Package/uanytun/install-generic,$(1),uanytun.config) +endef + +define Package/uanytun-nettle/install + $(call Package/uanytun/install-generic,$(1),uanytun.config) +endef + +define Package/uanytun-sslcrypt/install + $(call Package/uanytun/install-generic,$(1),uanytun.config) +endef + +define Package/uanytun-nocrypt/install + $(call Package/uanytun/install-generic,$(1),uanytun-nocrypt.config) +endef + + +$(eval $(call BuildPackage,uanytun)) +$(eval $(call BuildPackage,uanytun-nettle)) +$(eval $(call BuildPackage,uanytun-sslcrypt)) +$(eval $(call BuildPackage,uanytun-nocrypt)) diff --git a/net/uanytun/files/uanytun-nocrypt.config b/net/uanytun/files/uanytun-nocrypt.config new file mode 100644 index 0000000..9792d1f --- /dev/null +++ b/net/uanytun/files/uanytun-nocrypt.config @@ -0,0 +1,88 @@ +config "client1" + option disabled 0 + option username 'nobody' + option groupname 'nogroup' +# option chroot "/var/run/uanytun" + +# option interface '' +# option port '4444' +# option sender_id '1' + +# option dev 'anytun0' + option type 'tun' + option ifconfig '192.168.123.1/24' +# option post-up-script '/etc/uanytun/client1-post-up.sh' + + option remote_host 'example.com' + option remote_port '4444' + + option window_size 0 + option mux 1 + + option log 'syslog:3,anytun-client1,daemon' + + +config "client2" + option disabled 1 + option username 'nobody' + option groupname 'nogroup' + + option type 'tun' + option ifconfig '192.168.123.2/24' + + option remote_host 'example.com' + option remote_port '4444' + + option window_size 0 + option mux 2 + + option log 'syslog:3,anytun-client2,daemon' + + +config "client3" + option disabled 1 + option username 'nobody' + option groupname 'nogroup' + + option type 'tun' + option ifconfig '192.168.123.3/24' + + option remote_host 'example.com' + option remote_port '4444' + + option window_size 0 + option mux 3 + + option log 'syslog:3,anytun-client3,daemon' + + +config "p2p-a" + option disabled 1 + option username 'nobody' + option groupname 'nogroup' + + option type 'tun' + option ifconfig '192.168.223.1/24' + + option remote_host 'p2p-b.example.com' + option remote_port '4444' + + option window_size 0 + + option log 'syslog:3,anytun-p2p-a,daemon' + + +config "p2p-b" + option disabled 1 + option username 'nobody' + option groupname 'nogroup' + + option type 'tun' + option ifconfig '192.168.223.2/24' + + option remote_host 'p2p-a.example.com' + option remote_port '4444' + + option window_size 0 + + option log 'syslog:3,anytun-p2p-b,daemon' diff --git a/net/uanytun/files/uanytun.config b/net/uanytun/files/uanytun.config new file mode 100644 index 0000000..c53db37 --- /dev/null +++ b/net/uanytun/files/uanytun.config @@ -0,0 +1,116 @@ +config "client1" + option disabled 0 +# option username 'nobody' +# option groupname 'nogroup' +# option chroot "/var/run/uanytun" + +# option interface '' +# option port '4444' +# option sender_id '1' + + option cipher 'aes-ctr' +# option cipher 'null' +# option cipher 'aes-ctr-128' +# option cipher 'aes-ctr-192' +# option cipher 'aes-ctr-256' + option auth_algo 'sha1' +# option auth_algo 'null' +# option auth_tag_length 10 + +# option dev 'anytun0' + option type 'tun' + option ifconfig '192.168.123.1/24' +# option post-up-script '/etc/uanytun/client1-post-up.sh' + + option remote_host 'example.com' + option remote_port '4444' + + option window_size 0 + option mux 1 + + option role 'client' +# option kd_prf 'null' +# option kd_prf 'aes-ctr' +# option kd_prf 'aes-ctr-128' +# option kd_prf 'aes-ctr-192' +# option kd_prf 'aes-ctr-256' +# option ld_kdr '0' +# option key '0123456789ABCDEF0123456789ABCDEF' +# option salt '0123456789ABCD0123456789ABCD' + option passphrase 'Creating_VPN_Tunnels_With_Anytun_Is_Easy' + + option log 'syslog:3,anytun-client1,daemon' + + +config "client2" + option disabled 1 + + option cipher 'aes-ctr' + option auth_algo 'sha1' + option type 'tun' + option ifconfig '192.168.123.2/24' + + option remote_host 'example.com' + option remote_port '4444' + + option window_size 0 + option mux 2 + option role 'client' + option passphrase 'Creating_VPN_Tunnels_With_Anytun_Is_Easy' + + option log 'syslog:3,anytun-client2,daemon' + + +config "client3" + option disabled 1 + + option cipher 'aes-ctr' + option auth_algo 'sha1' + option type 'tun' + option ifconfig '192.168.123.3/24' + + option remote_host 'example.com' + option remote_port '4444' + + option window_size 0 + option mux 3 + option role 'client' + option passphrase 'Creating_VPN_Tunnels_With_Anytun_Is_Easy' + + option log 'syslog:3,anytun-client3,daemon' + + +config "p2p-a" + option disabled 1 + + option cipher 'aes-ctr' + option auth_algo 'sha1' + option type 'tun' + option ifconfig '192.168.223.1/24' + + option remote_host 'p2p-b.example.com' + option remote_port '4444' + + option window_size 0 + option role 'alice' + option passphrase 'Creating_P2P_VPN_Tunnels_With_Anytun_Is_Easy' + + option log 'syslog:3,anytun-p2p-a,daemon' + + +config "p2p-b" + option disabled 1 + + option cipher 'aes-ctr' + option auth_algo 'sha1' + option type 'tun' + option ifconfig '192.168.223.2/24' + + option remote_host 'p2p-a.example.com' + option remote_port '4444' + + option window_size 0 + option role 'bob' + option passphrase 'Creating_P2P_VPN_Tunnels_With_Anytun_Is_Easy' + + option log 'syslog:3,anytun-p2p-b,daemon' diff --git a/net/uanytun/files/uanytun.init b/net/uanytun/files/uanytun.init new file mode 100644 index 0000000..21609ca --- /dev/null +++ b/net/uanytun/files/uanytun.init @@ -0,0 +1,104 @@ +#!/bin/sh /etc/rc.common +START=50 + +BIN=uanytun +DAEMON=/usr/sbin/$BIN +DESC=$BIN +RUN_D=/var/run + + +option_cb() { + local varname="$1" + local value="$2" + + if ! echo "$CONFIG_OPTIONS" | grep " $varname " > /dev/null; then + CONFIG_OPTIONS="$CONFIG_OPTIONS $varname " + fi +} + +foreach_config_forced() { + foreach_config $1 "forced" +} + +foreach_config() { + local cfg="$1" + local name + local option + local value + local args="" + local forced=0 + + if [ -n "$2" ] && [ "x$2" == "xforced" ]; then + forced=1 + fi + + config_get name "$cfg" TYPE + for option in $CONFIG_OPTIONS + do + config_get value "$cfg" "$option" + if [ "x$option" == "xdisabled" ]; then + if [ $forced -eq 0 ] && [ $value -eq 1 ]; then + echo -n " $name(disabled)" + return + fi + continue + fi + + option=`echo $option | tr '_' '-'` + if [ -n "$value" ]; then + args="$args --$option $value" + fi + done + echo -n " $name" + local status="OK" + $DAEMON --write-pid "$RUN_D/$BIN.$name.pid" $args || status="failed" + echo -n "($status)" +} + +stop_vpn() { + local name=$1 + local pidfile=$RUN_D/$BIN.$name.pid + echo -n " $name" + local status="OK" + if [ ! -f "$pidfile" ]; then + status="tunnel not active" + else + kill `cat $pidfile` > /dev/null 2>&1 || status="failed" + rm -f $pidfile + fi + echo -n "($status)" +} + +start() { + echo -n "Starting $DESC:" + config_load $BIN + if [ $# -gt 0 ]; then + while [ $# -gt 0 ]; do + config_foreach foreach_config_forced "$1" + shift + done + else + config_foreach foreach_config "" + fi + echo "." +} + +stop() { + echo -n "Stopping $DESC:" + local name + local pidfile + + if [ $# -gt 0 ]; then + while [ $# -gt 0 ]; do + stop_vpn $1 + shift + done + else + for pidfile in `ls $RUN_D/$BIN.*.pid 2> /dev/null`; do + name=${pidfile%%.pid} + name=${name##$RUN_D/$BIN.} + stop_vpn $name + done + fi + echo "." +} diff --git a/net/udpxy/Makefile b/net/udpxy/Makefile new file mode 100644 index 0000000..6bb5748 --- /dev/null +++ b/net/udpxy/Makefile @@ -0,0 +1,64 @@ +# +# Copyright (C) 2006-2016 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:=udpxy +PKG_SOURCE_VERSION:=53e4672a7522311c40e9f6110ff256041c52c8b4 +PKG_VERSION:=2016-09-18-$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/pcherenkov/udpxy.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_MAINTAINER:=Álvaro Fernández Rojas + +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=gpl.txt + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +MAKE_PATH:=chipmunk + +define Package/udpxy + SECTION:=net + CATEGORY:=Network + TITLE:=Convert UDP IPTV streams into HTTP streams + URL:=https://github.com/pcherenkov/udpxy +endef + +define Package/udpxy/description + udproxy makes it possible to convert UDP IPTV streams into HTTP + streams which can be viewed even over WLANs. HTTP streams do + not generate huge amounts of multicast traffic, so a sd stream + only takes about 300k. Interesting for peoply who have IPTV at + home and do not want to rent multiple decoders from their + provider but just use their own streaming client (for example + popcornhour/mediatomb/vlc). +endef + +define Package/udpxy/conffiles +/etc/config/udpxy +endef + +MAKE_FLAGS += \ + INSTALLROOT="$(PKG_INSTALL_DIR)/usr" \ + ALL_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" + +define Package/udpxy/install + $(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/config + $(INSTALL_CONF) ./files/udpxy.conf $(1)/etc/config/udpxy + $(INSTALL_BIN) ./files/udpxy.init $(1)/etc/init.d/udpxy + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/udpxy $(1)/usr/bin/ + ln -sf udpxy $(1)/usr/bin/udpxrec +endef + +$(eval $(call BuildPackage,udpxy)) diff --git a/net/udpxy/files/udpxy.conf b/net/udpxy/files/udpxy.conf new file mode 100644 index 0000000..9117a53 --- /dev/null +++ b/net/udpxy/files/udpxy.conf @@ -0,0 +1,15 @@ +config udpxy + option disabled '1' + option respawn '1' + option verbose '0' + option status '1' + # option bind '0.0.0.0' + option port '4022' + # option source '0.0.0.0' + # option max_clients '3' + # option log_file '/var/log/udpxy' + # option buffer_size '4096' + # option buffer_messages '-1' + # option buffer_time '-1' + # option nice_increment '0' + # option mcsub_renew '0' diff --git a/net/udpxy/files/udpxy.init b/net/udpxy/files/udpxy.init new file mode 100644 index 0000000..6f911a6 --- /dev/null +++ b/net/udpxy/files/udpxy.init @@ -0,0 +1,67 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2014 OpenWrt.org + +START=50 +USE_PROCD=1 + +append_arg() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}" +} + +append_bool() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get_bool val "$cfg" "$var" "$def" + [ "$val" = 1 ] && procd_append_param command "$opt" +} + +start_instance() { + local cfg="$1" + local aux + + config_get_bool aux "$cfg" 'disabled' '0' + [ "$aux" = 1 ] && return 1 + + procd_open_instance + + procd_set_param command /usr/bin/udpxy + procd_append_param command "-T" + + append_bool "$cfg" verbose "-V" + append_bool "$cfg" status "-S" + append_arg "$cfg" bind "-a" + append_arg "$cfg" port "-p" + append_arg "$cfg" source "-m" + append_arg "$cfg" max_clients "-c" + append_arg "$cfg" log_file "-l" + append_arg "$cfg" buffer_size "-B" + append_arg "$cfg" buffer_messages "-R" + append_arg "$cfg" buffer_time "-H" + append_arg "$cfg" nice_increment "-n" + append_arg "$cfg" mcsub_renew "-M" + + config_get_bool aux "$cfg" 'respawn' '0' + [ "$aux" = 1 ] && procd_set_param respawn + + procd_close_instance +} + +service_triggers() { + procd_add_reload_trigger "udpxy" +} + +start_service() { + config_load udpxy + config_foreach start_instance udpxy +} diff --git a/net/ulogd/Makefile b/net/ulogd/Makefile new file mode 100644 index 0000000..2fa9f6c --- /dev/null +++ b/net/ulogd/Makefile @@ -0,0 +1,210 @@ +# +# Copyright (C) 2006-2015 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:=ulogd +PKG_VERSION:=2.0.5 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=ftp://ftp.netfilter.org/pub/ulogd/ \ + ftp://ftp.be.netfilter.org/pub/netfilter/ulogd/ \ + ftp://ftp.de.netfilter.org/pub/netfilter/ulogd/ \ + ftp://ftp.no.netfilter.org/pub/netfilter/ulogd/ +PKG_MD5SUM:=f0f8fe1371fa28b5e06cb16aaa0111dd + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Nicolas Thill + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/ulogd/Default + SECTION:=net + CATEGORY:=Network + URL:=http://www.netfilter.org/projects/ulogd/index.html +endef + +define Package/ulogd + $(call Package/ulogd/Default) + DEPENDS:=+libmnl +libnfnetlink +libpthread + TITLE:=Netfilter userspace logging daemon + MENU:=1 +endef + +define Package/ulogd/conffiles +/etc/ulogd.conf +endef + +define Package/ulogd-mod-dbi + $(call Package/ulogd/Default) + DEPENDS:=ulogd +libdbi + TITLE:=Output plugin for logging to a database using libdbi +endef + +define Package/ulogd-mod-json + $(call Package/ulogd/Default) + DEPENDS:=ulogd +jansson + TITLE:=JSON output plugin +endef + +define Package/ulogd-mod-mysql + $(call Package/ulogd/Default) + DEPENDS:=ulogd +libmysqlclient + TITLE:=Output plugin for logging to a MySQL database +endef + +define Package/ulogd-mod-nfacct + $(call Package/ulogd/Default) + DEPENDS:=ulogd +libnetfilter-acct + TITLE:=Input plugin for flow-based logging (accounting) +endef + +define Package/ulogd-mod-nfct + $(call Package/ulogd/Default) + DEPENDS:=ulogd +libnetfilter-conntrack + TITLE:=Input plugin for flow-based logging (conntracking) +endef + +define Package/ulogd-mod-nflog + $(call Package/ulogd/Default) + DEPENDS:=ulogd +libnetfilter-log + TITLE:=Input plugin using NFLOG +endef + +define Package/ulogd-mod-pcap + $(call Package/ulogd/Default) + DEPENDS:=ulogd +libpcap + TITLE:=Output plugin for logging in pcap format +endef + +define Package/ulogd-mod-pgsql + $(call Package/ulogd/Default) + DEPENDS:=ulogd +libpq + TITLE:=Output plugin for logging to a PostgreSQL database +endef + +define Package/ulogd-mod-sqlite + $(call Package/ulogd/Default) + DEPENDS:=ulogd +libsqlite3 + TITLE:=Output plugin for logging to an SQLite database +endef + +define Package/ulogd-mod-syslog + $(call Package/ulogd/Default) + DEPENDS:=ulogd + TITLE:=Syslog output plugin +endef + +define Package/ulogd-mod-xml + $(call Package/ulogd/Default) + DEPENDS:=ulogd +libnetfilter-acct +libnetfilter-conntrack +libnetfilter-log + TITLE:=XML output plugin +endef + +define Package/ulogd-mod-extra + $(call Package/ulogd/Default) + DEPENDS:=ulogd + TITLE:=Extra plugins +endef + +PKG_BUILD_DEPENDS:=libnetfilter-acct libnetfilter-conntrack libnetfilter-log + +PKG_CONFIG_DEPENDS:= \ + CONFIG_PACKAGE_ulogd-mod-dbi \ + CONFIG_PACKAGE_ulogd-mod-mysql \ + CONFIG_PACKAGE_ulogd-mod-pgsql \ + CONFIG_PACKAGE_ulogd-mod-sqlite \ + +TARGET_CFLAGS += \ + -D_GNU_SOURCE \ + +CONFIGURE_ARGS += \ + --enable-nfacct \ + --enable-nfct \ + --enable-nflog \ + +ifneq ($(DEVELOPER)$(SDK)$(CONFIG_PACKAGE_ulogd-mod-dbi),) + CONFIGURE_ARGS += --with-dbi \ + --with-dbi-inc=$(STAGING_DIR)/usr/include/dbi \ + --with-dbi-lib=$(STAGING_DIR)/usr/lib +else + CONFIGURE_ARGS += --without-dbi +endif + +ifneq ($(DEVELOPER)$(SDK)$(CONFIG_PACKAGE_ulogd-mod-mysql),) + CONFIGURE_ARGS += --with-mysql="$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS += --without-mysql +endif + +ifneq ($(DEVELOPER)$(SDK)$(CONFIG_PACKAGE_ulogd-mod-pgsql),) + CONFIGURE_ARGS += --with-pgsql="$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS += --without-pgsql +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_ulogd-mod-sqlite),) + CONFIGURE_ARGS += --with-sqlite="$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS += --without-sqlite +endif + +define Package/ulogd/install + $(INSTALL_DIR) $(1)/etc + $(CP) $(PKG_BUILD_DIR)/ulogd.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ulogd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/usr/lib/ulogd + $(CP) $(PKG_INSTALL_DIR)/usr/lib/ulogd/ulogd_raw2packet_BASE.so $(1)/usr/lib/ulogd/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/ulogd.init $(1)/etc/init.d/ulogd +endef + +define BuildPlugin + define Package/ulogd-mod-$(1)/install + $(INSTALL_DIR) $$(1)/usr/lib/ulogd + for m in $(2); do \ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/ulogd/ulogd_$$$$$$$${m}.so $$(1)/usr/lib/ulogd/ ; \ + done + endef + $$(eval $$(call BuildPackage,ulogd-mod-$(1))) +endef + +ULOGD_EXTRA_PLUGINS:= \ + filter_HWHDR \ + filter_IFINDEX \ + filter_IP2BIN \ + filter_IP2HBIN \ + filter_IP2STR \ + filter_MARK \ + filter_PRINTFLOW \ + filter_PRINTPKT \ + filter_PWSNIFF \ + inppkt_UNIXSOCK \ + output_GPRINT \ + output_GRAPHITE \ + output_LOGEMU \ + output_OPRINT \ + +$(eval $(call BuildPackage,ulogd)) +$(eval $(call BuildPlugin,dbi,output_DBI)) +$(eval $(call BuildPlugin,json,output_JSON)) +$(eval $(call BuildPlugin,mysql,output_MYSQL)) +$(eval $(call BuildPlugin,nfacct,inpflow_NFACCT)) +$(eval $(call BuildPlugin,nfct,inpflow_NFCT)) +$(eval $(call BuildPlugin,nflog,inppkt_NFLOG)) +$(eval $(call BuildPlugin,pcap,output_PCAP)) +$(eval $(call BuildPlugin,pgsql,output_PGSQL)) +$(eval $(call BuildPlugin,sqlite,output_SQLITE3)) +$(eval $(call BuildPlugin,syslog,output_SYSLOG)) +$(eval $(call BuildPlugin,xml,output_XML)) +$(eval $(call BuildPlugin,extra,$(ULOGD_EXTRA_PLUGINS))) diff --git a/net/ulogd/files/ulogd.init b/net/ulogd/files/ulogd.init new file mode 100644 index 0000000..3650322 --- /dev/null +++ b/net/ulogd/files/ulogd.init @@ -0,0 +1,12 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014 OpenWrt.org + +START=20 + +USE_PROCD=1 + +start_service() { + procd_open_instance + procd_set_param command /usr/sbin/ulogd + procd_close_instance +} diff --git a/net/ulogd/patches/100-musl-compat.patch b/net/ulogd/patches/100-musl-compat.patch new file mode 100644 index 0000000..2f1c293 --- /dev/null +++ b/net/ulogd/patches/100-musl-compat.patch @@ -0,0 +1,57 @@ +--- a/src/ulogd.c ++++ b/src/ulogd.c +@@ -83,7 +83,7 @@ static char *ulogd_logfile = NULL; + static const char *ulogd_configfile = ULOGD_CONFIGFILE; + static const char *ulogd_pidfile = NULL; + static int ulogd_pidfile_fd = -1; +-static FILE syslog_dummy; ++static int ulogd_use_syslog = 0; + + static int info_mode = 0; + +@@ -427,7 +427,7 @@ void __ulogd_log(int level, char *file, + if (level < loglevel_ce.u.value) + return; + +- if (logfile == &syslog_dummy) { ++ if (ulogd_use_syslog) { + /* FIXME: this omits the 'file' string */ + va_start(ap, format); + vsyslog(ulogd2syslog_level(level), format, ap); +@@ -950,7 +950,7 @@ static int logfile_open(const char *name + logfile = stdout; + } else if (!strcmp(name, "syslog")) { + openlog("ulogd", LOG_PID, LOG_DAEMON); +- logfile = &syslog_dummy; ++ ulogd_use_syslog = 1; + } else { + logfile = fopen(ulogd_logfile, "a"); + if (!logfile) { +@@ -1240,7 +1240,7 @@ static void sigterm_handler(int signal) + unload_plugins(); + #endif + +- if (logfile != NULL && logfile != stdout && logfile != &syslog_dummy) { ++ if (logfile != NULL && logfile != stdout) { + fclose(logfile); + logfile = NULL; + } +@@ -1262,7 +1262,7 @@ static void signal_handler(int signal) + switch (signal) { + case SIGHUP: + /* reopen logfile */ +- if (logfile != stdout && logfile != &syslog_dummy) { ++ if (logfile != NULL && logfile != stdout) { + fclose(logfile); + logfile = fopen(ulogd_logfile, "a"); + if (!logfile) { +--- a/filter/raw2packet/ulogd_raw2packet_BASE.c ++++ b/filter/raw2packet/ulogd_raw2packet_BASE.c +@@ -42,6 +42,7 @@ + #include + #include + #include ++#include + #include + + enum input_keys { diff --git a/net/umurmur/Makefile b/net/umurmur/Makefile new file mode 100644 index 0000000..2725423 --- /dev/null +++ b/net/umurmur/Makefile @@ -0,0 +1,103 @@ +# +# Copyright (C) 2009-2015 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:=umurmur +PKG_VERSION:=0.2.16 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=git://github.com/umurmur/umurmur.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=0.2.16 + +PKG_INSTALL:=1 +PKG_FIXUP:=autoreconf + +PKG_MAINTAINER:=Martin Johansson +PKG_LICENSE:=BSD-3-Clause + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/umurmur/Default + SECTION:=net + CATEGORY:=Network + SUBMENU:=Instant Messaging + TITLE:=uMurmur + DEPENDS:=+libconfig +libprotobuf-c + URL:=http://code.google.com/p/umurmur + MAINTAINER:=Martin Johansson +endef + +define Package/umurmur/Default/description + Minimalistic Mumble server daemon. +endef + +define Package/umurmur-openssl + $(call Package/umurmur/Default) + TITLE+= (with OpenSSL support) + DEPENDS+= +libopenssl + VARIANT:=openssl +endef + +define Package/umurmur-openssl/description + $(call Package/umurmur/Default/description) + Uses OpenSSL library for SSL and crypto. +endef + +define Package/umurmur-polarssl + $(call Package/umurmur/Default) + TITLE+= (with PolarSSL support) + DEPENDS+= +libpolarssl + VARIANT:=polarssl +endef + +define Package/umurmur-polarssl/description + $(call Package/umurmur/Default/description) + Uses the PolarSSL library for SSL and crypto. +endef + +define Build/Compile + CC="$(TARGET_CC)" \ + CFLAGS="$(TARGET_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + $(MAKE) -C $(PKG_BUILD_DIR)/src all +endef + +define Package/umurmur-openssl/conffiles +/etc/umurmur.conf +endef + +Package/umurmur-polarssl/conffiles = $(Package/umurmur-openssl/conffiles) + +define Package/umurmur-openssl/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/umurmurd $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_BUILD_DIR)/openwrt/files/umurmur.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/files/umurmur.init $(1)/etc/init.d/umurmur + $(INSTALL_DIR) $(1)/etc/umurmur +endef + +Package/umurmur-polarssl/install = $(Package/umurmur-openssl/install) + +ifeq ($(BUILD_VARIANT),openssl) + CONFIGURE_ARGS += \ + --with-ssl=openssl +endif + +ifeq ($(BUILD_VARIANT),polarssl) + CONFIGURE_ARGS += \ + --with-ssl=polarssl +endif + +$(eval $(call BuildPackage,umurmur-openssl)) +$(eval $(call BuildPackage,umurmur-polarssl)) diff --git a/net/umurmur/patches/10-Add-compile-time-check-for-POLARSSL_VERSION_FEATURES.patch b/net/umurmur/patches/10-Add-compile-time-check-for-POLARSSL_VERSION_FEATURES.patch new file mode 100644 index 0000000..c8fcdc8 --- /dev/null +++ b/net/umurmur/patches/10-Add-compile-time-check-for-POLARSSL_VERSION_FEATURES.patch @@ -0,0 +1,17 @@ +diff --git a/src/ssli_polarssl.c b/src/ssli_polarssl.c +index a36ccb6..167637b 100644 +--- a/src/ssli_polarssl.c ++++ b/src/ssli_polarssl.c +@@ -225,8 +225,12 @@ void SSLi_init(void) + Log_fatal("Cannot open /dev/urandom"); + #endif + ++#ifdef POLARSSL_VERSION_FEATURES + version_get_string(verstring); + Log_info("PolarSSL library version %s initialized", verstring); ++#else ++ Log_info("PolarSSL library initialized"); ++#endif + } + + void SSLi_deinit(void) diff --git a/net/unbound/Makefile b/net/unbound/Makefile new file mode 100644 index 0000000..17f3065 --- /dev/null +++ b/net/unbound/Makefile @@ -0,0 +1,190 @@ +# +# Copyright (C) 2010-2016 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:=unbound +PKG_VERSION:=1.5.10 +PKG_RELEASE:=5 + +PKG_LICENSE:=BSD-3-Clause +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Eric Luehrsen + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.unbound.net/downloads +PKG_MD5SUM:=0a3a236811f1ab5c1dc31974fa74e047 + +PKG_BUILD_DEPENDS:=libexpat +PKG_BUILD_PARALLEL:=1 +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/unbound/Default + TITLE:=Unbound is a validating, recursive, and caching DNS resolver. + URL:=http://www.unbound.net/ + DEPENDS:=+libopenssl +endef + +define Package/unbound + $(call Package/unbound/Default) + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names + USERID:=unbound=553:unbound=553 + TITLE+= (daemon) + DEPENDS+= +libunbound +endef + +define Package/unbound/description + This package contains the Unbound daemon. +endef + +define Package/unbound-anchor + $(call Package/unbound/Default) + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names + TITLE+= (anchor utility) + DEPENDS+= +unbound +libexpat +endef + +define Package/unbound-anchor/description + This package contains the Unbound anchor utility. +endef + +define Package/unbound-control + $(call Package/unbound/Default) + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names + TITLE+= (control utility) + DEPENDS+= +unbound +endef + +define Package/unbound-control/description + This package contains the Unbound control utility. +endef + +define Package/unbound-control-setup + $(call Package/unbound/Default) + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names + TITLE+= (control setup utility) + DEPENDS+= +unbound-control +openssl-util +endef + +define Package/unbound-control-setup/description + This package contains the Unbound control setup utility. +endef + +define Package/unbound-host + $(call Package/unbound/Default) + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names + TITLE+= (DNS lookup utility) + DEPENDS+= +libunbound +endef + +define Package/unbound-host/description + This package contains the Unbound DNS lookup utility. +endef + +define Package/libunbound + $(call Package/unbound/Default) + SECTION:=libs + CATEGORY:=Libraries + TITLE+= (library) + DEPENDS+= +libpthread +endef + +define Package/libunbound/description + This package contains the Unbound shared library. +endef + +CONFIGURE_ARGS += \ + --disable-dsa \ + --disable-gost \ + --enable-allsymbols \ + --with-libexpat="$(STAGING_DIR)/usr" \ + --with-ssl="$(STAGING_DIR)/usr" \ + --with-pidfile=/var/run/unbound.pid \ + --with-user=unbound + +define Package/unbound/conffiles +/etc/config/unbound +/etc/unbound/unbound.conf +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/unbound.h $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libunbound.{so*,a,la} $(1)/usr/lib/ +endef + +define Package/unbound/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/sbin/unbound \ + $(PKG_INSTALL_DIR)/usr/sbin/unbound-checkconf \ + $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/unbound + $(INSTALL_DATA) \ + $(PKG_INSTALL_DIR)/etc/unbound/unbound.conf \ + $(1)/etc/unbound/unbound.conf + $(INSTALL_DATA) ./files/root.key $(1)/etc/unbound/root.key + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/unbound.uci $(1)/etc/config/unbound + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) ./files/unbound.iface $(1)/etc/hotplug.d/iface/25-unbound + $(INSTALL_DIR) $(1)/etc/hotplug.d/ntp + $(INSTALL_BIN) ./files/unbound.ntpd $(1)/etc/hotplug.d/ntp/25-unbound + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/unbound.init $(1)/etc/init.d/unbound + $(INSTALL_DIR) $(1)/usr/lib/unbound + $(INSTALL_DATA) ./files/dnsmasq.sh $(1)/usr/lib/unbound/dnsmasq.sh + $(INSTALL_DATA) ./files/iptools.sh $(1)/usr/lib/unbound/iptools.sh + $(INSTALL_DATA) ./files/rootzone.sh $(1)/usr/lib/unbound/rootzone.sh + $(INSTALL_DATA) ./files/unbound.sh $(1)/usr/lib/unbound/unbound.sh +endef + +define Package/unbound-anchor/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/unbound-anchor $(1)/usr/sbin/ +endef + +define Package/unbound-control/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/unbound-control $(1)/usr/sbin/ +endef + +define Package/unbound-control-setup/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/unbound-control-setup $(1)/usr/sbin/ +endef + +define Package/unbound-host/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/unbound-host $(1)/usr/sbin/ +endef + +define Package/libunbound/install + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libunbound.so.* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,unbound)) +$(eval $(call BuildPackage,unbound-anchor)) +$(eval $(call BuildPackage,unbound-control)) +$(eval $(call BuildPackage,unbound-control-setup)) +$(eval $(call BuildPackage,unbound-host)) +$(eval $(call BuildPackage,libunbound)) diff --git a/net/unbound/files/README.md b/net/unbound/files/README.md new file mode 100644 index 0000000..a66ac74 --- /dev/null +++ b/net/unbound/files/README.md @@ -0,0 +1,128 @@ +# Unbound Recursive DNS Server with UCI + +## Unbound Description +Unbound is a validating, recursive, and caching DNS resolver. The C implementation of Unbound is developed and maintained by [NLnet Labs](https://www.unbound.net/). It is based on ideas and algorithms taken from a java prototype developed by Verisign labs, Nominet, Kirei and ep.net. Unbound is designed as a set of modular components, so that also DNSSEC (secure DNS) validation and stub-resolvers (that do not run as a server, but are linked into an application) are easily possible. + +## Package Overview +Unbound may be useful on consumer grade embedded hardware. It is *intended* to be a recursive resolver only. [NLnet Labs NSD](https://www.nlnetlabs.nl/projects/nsd/) is *intended* for the authoritative task. This is different than [ISC Bind](https://www.isc.org/downloads/bind/) and its inclusive functions. Unbound configuration effort and memory consumption may be easier to control. A consumer could have their own recursive resolver, and remove potential issues from forwarding resolvers outside of their control. + +This package builds on Unbounds capabilities with OpenWrt UCI. Not every Unbound option is in UCI, but rather, UCI simplifies the combination of related options. Unbounds native options are bundled and balanced within a smaller set of choices. Options include resources, DNSSEC, access control, and some TTL tweaking. The UCI also provides an escape option and work at the raw "unbound.conf" level. + +## Work with dnsmasq +Some UCI options will help Unbound and dnsmasq work together in **parallel**. The default DHCP and DNS stub resolver in OpenWrt is dnsmasq, and it will continue to serve this purpose. The following actions will make Unbound the primary DNS server, and make dnsmasq only provide DNS to local DHCP. + +- Set `unbound` UCI `option dnsmasq_link_dns` to true. +- Set other `unbound` UCI options how you wish. +- Set `dnsmasq` UCI `option noresolv` to true. +- Set `dnsmasq` UCI `option resolvfile` to blank single-quotes. +- Set `dnsmasq` UCI `option port` to 1053 or 5353. +- Add to each `dhcp` UCI `list dhcp_option option:dns-server,0.0.0.0` + +Alternatives are mentioned here for completeness. DHCP event scripts which write host records are difficult to formulate for Unbound, NSD, or Bind. These programs sometimes need to be forcefully reloaded with host configuration, and reloads can bust cache. **Serial** configuration between dnsmasq and Unbound can be made on 127.0.0.1 with an off-port like #1053. This may double cache storage and incur unnecessary transfer delay. + +## Back to Manual Configuration +You don't want UCI, but don't worry. We have UCI for that. However, OpenWrt or LEDE are targeted at embedded machines with flash ROM. The initialization scripts do a few things to protect flash ROM. + +All of `/etc/unbound` (persistent, ROM) is copied to `/var/lib/unbound` (tmpfs, RAM). Edit your manual `/etc/unbound/unbound.conf` to reference this `/var/lib/unbound` location for included files. Note in preparation for a jail, `/var/lib/unbound` is `chown unbound`. Configure for security in`/etc/unbound/unbound.conf` with options `username:unbound` and `chroot:/var/lib/unbound`. + +Finally, `root.key` maintenance for DNSKEY RFC5011 would be hard on flash. Unbound natively updates frequently. It also creates and destroys working files in the process. In `/var/lib/unbound` this is no problem, but it would be gone at the next reboot. If you have DNSSEC (validator) active, then you should consider this UCI option. Choose how many days to copy from `/var/lib/unbound/root.key` (tmpfs) to `/etc/unbound/root.key` (flash). Keep the DNSKEY updated with your choice of flash activity. + + config unbound + option manual_conf '1' + option root_age '30' + +## Complete List of UCI Options +**/etc/config/unbound**: + + config unbound + Currently only one instance is supported. + + option dnsmasq_gate_name '0' + Boolean. Forward PTR records for interfaces not serving DHCP. + Assume these are WAN. Example dnsmasq option here to provide + logs with a name when your ISP won't link DHCP-DNS. + "dnsmasq.conf: interface-name=way-out.myrouter.lan,eth0.1" + + option dnsmasq_link_dns '0' + Boolean. Master link to dnsmasq. Parse /etc/config/dhcp for dnsmasq + options. Forward domain such as "lan" and PTR records for DHCP + interfaces and their deligated subnets, IP4 and IP6. + + option dnsmasq_only_local '0' + TODO: not yet implemented + Boolean. Restrict link to dnsmasq. DNS only to local host. Obscure + names of other connected hosts on the network. Example: + "drill -x 198.51.100.17 ~ IN PTR way-out.myrouter.lan" + "drill -x 192.168.10.1 ~ IN PTR guest-wifi.myrouter.lan" + "drill -x 192.168.10.201 ~ NODATA" (insted of james-laptop.lan) + + option edns_size '1280' + Extended DNS is necessary for DNSSEC. However, it can run into MTU + issues. Use this size in bytes to manage drop outs. + + option listen_port '53' + Port. Incoming. Where Unbound will listen for queries. + + option localservice '1' + Boolean. Prevent DNS amplification attacks. Only provide access to + Unbound from subnets this machine has interfaces on. + + option manual_conf '0' + Boolean. Skip all this UCI nonsense. Manually edit the + configuration. Make changes to /etc/unbound/unbound.conf. + + option query_minimize '0' + Boolean. Enable a minor privacy option. Query only one name piece + at a time. Don't let each server know the next recursion. + + option rebind_localhost '0' + Boolean. Prevent loopback "127.0.0.0/8" or "::1/128" responses. + These may used by black hole servers for good purposes like + ad-blocking or parental access control. Obviously these responses + also can be used to for bad purposes. + + option rebind_protection '1' + Boolean. Prevent RFC 1918 Reponses from global DNS. Example a + poisoned reponse within "192.168.0.0/24" could be used to turn a + local browser into an external attack proxy server. + + option recursion 'passive' + Unbound has numerous options for how it recurses. This UCI combines + them into "passive," "aggressive," or Unbound's own "default." + Passive is easy on resources, but slower until cache fills. + + option resource 'small' + Unbound has numerous options for resources. This UCI gives "tiny," + "small," "medium," and "large." Medium is most like the compiled + defaults with a bit of balancing. Tiny is close to the published + memory restricted configuration. Small 1/2 medium, and large 2x. + + option root_age '30' + Days. >90 Disables. Age limit for Unbound root data like root + DNSSEC key. Unbound uses RFC 5011 to manage root key. This could + harm flash ROM. This activity is mapped to "tmpfs," but every so + often it needs to be copied back to flash for the next reboot. + + option ttl_min '120' + Seconds. Minimum TTL in cache. Recursion can be expensive without + cache. A low TTL is normal for server migration. A low TTL can be + abused for snoop-vertising (DNS hit counts; recording query IP). + Typical to configure maybe 0~300, but 1800 is the maximum accepted. + + option unbound_control '0' + Boolean. Enables unbound-control application access ports. Enabling + this without the unbound-control package installed is robust. + + option validator '0' + Boolean. Enable DNSSEC. Unbound names this the "validator" module. + + option validator_ntp '1' + Boolean. Disable DNSSEC time checks at boot. Once NTP confirms + global real time, then DNSSEC is restarted at full strength. Many + embedded devices don't have a real time power off clock. NTP needs + DNS to resolve servers. This works around the chicken-and-egg. + + list domain_insecure + List. Domains or pointers that you wish to skip DNSSEC. Your DHCP + domains and pointers in dnsmasq will get this automatically. + diff --git a/net/unbound/files/dnsmasq.sh b/net/unbound/files/dnsmasq.sh new file mode 100644 index 0000000..f9eec7d --- /dev/null +++ b/net/unbound/files/dnsmasq.sh @@ -0,0 +1,182 @@ +#!/bin/sh +############################################################################## +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# Copyright (C) 2016 Eric Luehrsen +# +############################################################################## +# +# This crosses over to the dnsmasq UCI file "dhcp" and parses it for fields +# that will allow Unbound to request local host DNS of dnsmasq. We need to look +# at the interfaces in "dhcp" and get their subnets. The Unbound conf syntax +# makes this a little difficult. First in "server:" we need to create private +# zones for the domain and PTR records. Then we need to create numerous +# "forward:" clauses to forward those zones to dnsmasq. +# +############################################################################## + +create_local_zone() { + local cfg="$1" + local fwd_port fwd_domain + + config_get fwd_domain "$cfg" domain + config_get fwd_port "$cfg" port + + + if [ -n "$fwd_domain" -a -n "$fwd_port" -a ! "$fwd_port" -eq 53 ] ; then + # dnsmasq localhost listening ports (possible multiple instances) + UNBOUND_N_FWD_PORTS="$UNBOUND_N_FWD_PORTS $fwd_port" + UNBOUND_TXT_FWD_ZONE="$UNBOUND_TXT_FWD_ZONE $fwd_domain" + + { + # This creates DOMAIN local privledges + echo " private-domain: \"$fwd_domain\"" + echo " local-zone: \"$fwd_domain.\" transparent" + echo " domain-insecure: \"$fwd_domain\"" + echo + } >> $UNBOUND_CONFFILE + fi +} + +############################################################################## + +create_local_arpa() { + local cfg="$1" + local logint dhcpv4 dhcpv6 ignore + local subnets subnets4 subnets6 + local forward arpa + local validip4 validip6 privateip + + config_get logint "$cfg" interface + config_get dhcpv4 "$cfg" dhcpv4 + config_get dhcpv6 "$cfg" dhcpv6 + config_get_bool ignore "$cfg" ignore 0 + + # Find the list of addresses assigned to a logical interface + # Its typical to have a logical gateway split NAME and NAME6 + network_get_subnets subnets4 "$logint" + network_get_subnets6 subnets6 "$logint" + subnets="$subnets4 $subnets6" + + network_get_subnets subnets4 "${logint}6" + network_get_subnets6 subnets6 "${logint}6" + subnets="$subnets $subnets4 $subnets6" + + + if [ -z "$subnets" ] ; then + forward="" + + elif [ -z "$UNBOUND_N_FWD_PORTS" ] ; then + forward="" + + elif [ "$ignore" -gt 0 ] ; then + if [ "$UNBOUND_B_GATE_NAME" -gt 0 ] ; then + # Only forward the one gateway host. + forward="host" + + else + forward="" + fi + + else + # Forward the entire private subnet. + forward="domain" + fi + + + if [ -n "$forward" ] ; then + for subnet in $subnets ; do + validip4=$( valid_subnet4 $subnet ) + validip6=$( valid_subnet6 $subnet ) + privateip=$( private_subnet $subnet ) + + + if [ "$validip4" = "ok" -a "$dhcpv4" != "disable" ] ; then + if [ "$forward" = "domain" ] ; then + arpa=$( domain_ptr_ip4 "$subnet" ) + else + arpa=$( host_ptr_ip4 "$subnet" ) + fi + + elif [ "$validip6" = "ok" -a "$dhcpv6" != "disable" ] ; then + if [ "$forward" = "domain" ] ; then + arpa=$( domain_ptr_ip6 "$subnet" ) + else + arpa=$( host_ptr_ip6 "$subnet" ) + fi + + else + arpa="" + fi + + + if [ -n "$arpa" ] ; then + if [ "$privateip" = "ok" ] ; then + { + # This creates ARPA local zone privledges + echo " local-zone: \"$arpa.\" transparent" + echo " domain-insecure: \"$arpa\"" + echo + } >> $UNBOUND_CONFFILE + fi + + + UNBOUND_TXT_FWD_ZONE="$UNBOUND_TXT_FWD_ZONE $arpa" + fi + done + fi +} + +############################################################################## + +forward_local_zone() { + if [ -n "$UNBOUND_N_FWD_PORTS" -a -n "$UNBOUND_TXT_FWD_ZONE" ] ; then + for fwd_domain in $UNBOUND_TXT_FWD_ZONE ; do + { + # This is derived of create_local_zone/arpa + # but forward: clauses need to be seperate + echo "forward-zone:" + echo " name: \"$fwd_domain.\"" + + for port in $UNBOUND_N_FWD_PORTS ; do + echo " forward-addr: 127.0.0.1@$port" + done + + echo + } >> $UNBOUND_CONFFILE + done + fi +} + +############################################################################## + +dnsmasq_link() { + #################### + # UCI @ dhcp # + #################### + + + if [ "$UNBOUND_B_DNSMASQ" -gt 0 ] ; then + # Forward to dnsmasq on same host for DHCP lease hosts + echo " do-not-query-localhost: no" >> $UNBOUND_CONFFILE + # Look at dnsmasq settings + config_load dhcp + # Zone for DHCP / SLAAC-PING DOMAIN + config_foreach create_local_zone dnsmasq + # Zone for DHCP / SLAAC-PING ARPA + config_foreach create_local_arpa dhcp + # Now create ALL seperate forward: clauses + forward_local_zone + fi +} + +############################################################################## + diff --git a/net/unbound/files/iptools.sh b/net/unbound/files/iptools.sh new file mode 100644 index 0000000..1725242 --- /dev/null +++ b/net/unbound/files/iptools.sh @@ -0,0 +1,140 @@ +#!/bin/sh +############################################################################## +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# Copyright (C) 2016 Eric Luehrsen +# +############################################################################## +# +# These are iptools that might be useful in a larger package, if provided +# elsewhere for common use. One example that many may find useful is turning +# flexible IPV6 colon dividers into PTR. Otherwise these are incomplete and +# would need robustness improvements for more generic applications. +# +############################################################################## + +domain_ptr_ip6() { + # Get the nibble rounded /CIDR ...ip6.arpa. + echo "$1" | awk -F: \ + 'BEGIN { OFS = "" ; } + { CIDR = $0 ; + sub(/.*\//,"",CIDR) ; + CIDR = (CIDR / 4) ; + sub(/\/[0-9]+/,"",$0) ; + ct_stop = 9 - NF ; + for(i=1; i<=NF; i++) { + if(length($i) == 0) { + for(j=1; j<=ct_stop; j++) { $i = ($i "0000") ; } } + else { $i = substr(("0000" $i), length($i)+5-4) ; } } ; + y = $0 ; + ct_start = length(y) - 32 + CIDR ; + for(i=ct_start; i>0; i--) { x = (x substr(y,i,1)) ; } ; + gsub(/./,"&\.",x) ; + x = (x "ip6.arpa") ; + print x }' +} + +############################################################################## + +host_ptr_ip6() { + # Get complete host ...ip6.arpa. + echo "$1" | awk -F: \ + 'BEGIN { OFS = "" ; } + { sub(/\/[0-9]+/,"",$0) ; + ct_stop = 9 - NF ; + for(i=1; i<=NF; i++) { + if(length($i) == 0) { + for(j=1; j<=ct_stop; j++) { $i = ($i "0000") ; } } + else { $i = substr(("0000" $i), length($i)+5-4) ; } } ; + y = $0 ; + ct_start = length(y); + for(i=ct_start; i>0; i--) { x = (x substr(y,i,1)) ; } ; + sub(/[0-9]+\//,"",x) ; + gsub(/./,"&\.",x) ; + x = (x "ip6.arpa") ; + print x }' +} + +############################################################################## + +domain_ptr_ip4() { + # Get the byte rounded /CIDR ...in-addr.arpa. + echo "$1" | awk \ + '{ CIDR = $0 ; + sub(/.*\//,"",CIDR) ; + CIDR = (CIDR / 8) ; + dtxt = $0 ; + sub(/\/.*/,"",dtxt) ; + split(dtxt, dtxt, ".") ; + for(i=1; i<=CIDR; i++) { x = (dtxt[i] "." x) ; } + x = (x "in-addr.arpa") ; + print x }' +} + +############################################################################## + +host_ptr_ip4() { + # Get omplete host ...in-addr.arpa. + echo "$1" | awk -F. \ + '{ x = ( $4"."$3"."$2"."$1".in-addr.arpa" ) ; + sub(/\/[0-9]+/,"",x) ; + print x }' +} + +############################################################################## + +valid_subnet6() { + case "$1" in + # GA + [1-9][0-9a-f][0-9a-f][0-9a-f]":"*) echo "ok" ;; + # ULA + f[cd][0-9a-f][0-9a-f]":"*) echo "ok" ;; + # fe80::, ::1, and such + *) echo "not" ;; + esac +} + +############################################################################## + +valid_subnet4() { + case "$1" in + # Link, Local, and Such + 169"."254"."*) echo "not" ;; + 127"."*) echo "not" ;; + 0"."*) echo "not" ;; + 255"."*) echo "not" ;; + # Other Normal + 25[0-4]"."[0-9]*) echo "ok" ;; + 2[0-4][0-9]"."[0-9]*) echo "ok" ;; + 1[0-9][0-9]"."[0-9]*) echo "ok" ;; + [0-9][0-9]"."[0-9]*) echo "ok" ;; + [0-9]"."[0-9]*) echo "ok" ;; + # Not Right + *) echo "not";; + esac +} + +############################################################################## + +private_subnet() { + case "$1" in + 10"."*) echo "ok" ;; + 172"."1[6-9]"."*) echo "ok" ;; + 172"."2[0-9]"."*) echo "ok" ;; + 172"."3[0-1]"."*) echo "ok" ;; + 192"."168"."*) echo "ok" ;; + f[cd][0-9a-f][0-9a-f]":"*) echo "ok" ;; + *) echo "not" ;; + esac +} + +############################################################################## + diff --git a/net/unbound/files/root.key b/net/unbound/files/root.key new file mode 100644 index 0000000..2ad6641 --- /dev/null +++ b/net/unbound/files/root.key @@ -0,0 +1 @@ +. IN DS 19036 8 2 49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE32F24E8FB5 diff --git a/net/unbound/files/rootzone.sh b/net/unbound/files/rootzone.sh new file mode 100644 index 0000000..143c056 --- /dev/null +++ b/net/unbound/files/rootzone.sh @@ -0,0 +1,119 @@ +#!/bin/sh +############################################################################## +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# Copyright (C) 2016 Eric Luehrsen +# +############################################################################## +# +# This component needs to be used within the unbound.sh as an include. It uses +# defaults and UCI scope variables defined there. It will copy root.key back +# to /etc/unbound/ periodically, but avoid ROM flash abuse (UCI option). +# +############################################################################## + +rootzone_uci() { + local cfg=$1 + + # This will likely be called outside of "start_service()" context + config_get_bool UNBOUND_B_DNSSEC "$cfg" validator 0 + config_get_bool UNBOUND_B_NTP_BOOT "$cfg" validator_ntp 1 + config_get UNBOUND_N_ROOT_AGE "$cfg" root_age 30 +} + +############################################################################## + +roothints_update() { + # TODO: Might not be implemented. Unbound doesn't natively update hints. + # Unbound philosophy is built in root hints are good for machine life. + return 0 +} + +############################################################################## + +rootkey_update() { + local basekey_date rootkey_date rootkey_age filestuff + + + if [ "$UNBOUND_N_ROOT_AGE" -gt 90 -o "$UNBOUND_B_DNSSEC" -lt 1 ] ; then + # Feature disabled + return 0 + + elif [ "$UNBOUND_B_NTP_BOOT" -gt 0 -a ! -f "$UNBOUND_TIMEFILE" ] ; then + # We don't have time yet + return 0 + fi + + + if [ -f /etc/unbound/root.key ] ; then + basekey_date=$( date -r /etc/unbound/root.key +%s ) + + else + # No persistent storage key + basekey_date=$( date -d 2000-01-01 +%s ) + fi + + + if [ -f "$UNBOUND_KEYFILE" ] ; then + # Unbound maintains it itself + rootkey_date=$( date -r $UNBOUND_KEYFILE +%s ) + rootkey_age=$(( (rootkey_date - basekey_date) / 86440 )) + + elif [ -x "$UNBOUND_ANCHOR" ] ; then + # No tmpfs key - use unbound-anchor + rootkey_date=$( date -I +%s ) + rootkey_age=$(( (rootkey_date - basekey_date) / 86440 )) + $UNBOUND_ANCHOR -a $UNBOUND_KEYFILE + + else + # give up + rootkey_age=0 + fi + + + if [ "$rootkey_age" -gt "$UNBOUND_N_ROOT_AGE" ] ; then + filestuff=$( cat $UNBOUND_KEYFILE ) + + + case "$filestuff" in + *NOERROR*) + # Header comment for drill and dig + logger -t unbound -s "root.key updated after $rootkey_age days" + cp -p $UNBOUND_KEYFILE /etc/unbound/root.key + ;; + + *"state=2 [ VALID ]"*) + # Comment inline to key for unbound-anchor + logger -t unbound -s "root.key updated after $rootkey_age days" + cp -p $UNBOUND_KEYFILE /etc/unbound/root.key + ;; + + *) + logger -t unbound -s "root.key still $rootkey_age days old" + ;; + esac + fi +} + +############################################################################## + +rootzone_update() { + # Partial UCI fetch for this functional group + config_load unbound + config_foreach rootzone_uci unbound + + # You need root.hints and root.key to boot strap recursion + roothints_update + rootkey_update +} + +############################################################################## + diff --git a/net/unbound/files/unbound.iface b/net/unbound/files/unbound.iface new file mode 100755 index 0000000..172bcae --- /dev/null +++ b/net/unbound/files/unbound.iface @@ -0,0 +1,20 @@ +#!/bin/sh +############################################################################## +# +# Copyright (C) 2016 Eric Luehrsen +# +############################################################################## +# +# "Restart" Unbound on hotplug interface up: +# - Clean rebind of unbound to new interfaces +# - Some of Unbound conf options to not reload run time +# - Unbound can grow a bit so this will shrink it back +# +############################################################################## + +if [ "$ACTION" = ifup ] && /etc/init.d/unbound enabled ; then + /etc/init.d/unbound restart +fi + +############################################################################## + diff --git a/net/unbound/files/unbound.init b/net/unbound/files/unbound.init new file mode 100755 index 0000000..0f5049d --- /dev/null +++ b/net/unbound/files/unbound.init @@ -0,0 +1,46 @@ +#!/bin/sh /etc/rc.common +############################################################################## +# +# Copyright (C) 2016 Michael Hanselmann, Eric Luehrsen +# +############################################################################## +# +# This init script is just the entry point for Unbound UCI. +# +############################################################################## + +START=60 +USE_PROCD=1 +PROG=/usr/sbin/unbound + +############################################################################## + +. /usr/lib/unbound/unbound.sh + +############################################################################## + +start_service() { + unbound_prepare + + procd_open_instance + procd_set_param command $PROG -d -c $UNBOUND_CONFFILE + procd_set_param respawn + procd_close_instance +} + +############################################################################## + +stop_service() { + rootzone_update +} + +############################################################################## + +service_triggers() { + procd_add_reload_trigger "dhcp" + procd_add_reload_trigger "network" + procd_add_reload_trigger "unbound" +} + +############################################################################## + diff --git a/net/unbound/files/unbound.ntpd b/net/unbound/files/unbound.ntpd new file mode 100755 index 0000000..9244284 --- /dev/null +++ b/net/unbound/files/unbound.ntpd @@ -0,0 +1,28 @@ +#!/bin/sh +############################################################################## +# +# Copyright (C) 2016 Eric Luehrsen +# +############################################################################## +# +# "Restart" Unbound on hotplug NTP ready: +# - Only do this the first time when no file exists +# - Some of Unbound conf options to not reload run time +# - Change the enable flag for DNSSEC date-time checking +# +############################################################################## + +# Common file location definitions +. /usr/lib/unbound/unbound.sh + +############################################################################## + +if [ "$ACTION" = stratum -a ! -f "$UNBOUND_TIMEFILE" ] \ + && /etc/init.d/dnsmasq enabled ; then + # + echo "ntpd: $( date )" > $UNBOUND_TIMEFILE + /etc/init.d/unbound restart +fi + +############################################################################## + diff --git a/net/unbound/files/unbound.sh b/net/unbound/files/unbound.sh new file mode 100644 index 0000000..568c627 --- /dev/null +++ b/net/unbound/files/unbound.sh @@ -0,0 +1,532 @@ +#!/bin/sh +############################################################################## +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# Copyright (C) 2016 Eric Luehrsen +# +############################################################################## +# +# This builds the basic UCI components currently supported for Unbound. It is +# intentionally NOT comprehensive and bundles a lot of options. The UCI is to +# be a simpler presentation of the total Unbound conf set. +# +############################################################################## + +UNBOUND_B_CONTROL=0 +UNBOUND_B_DNSMASQ=0 +UNBOUND_B_DNSSEC=0 +UNBOUND_B_GATE_NAME=0 +UNBOUND_B_LOCL_BLCK=0 +UNBOUND_B_LOCL_NAME=0 +UNBOUND_B_LOCL_SERV=1 +UNBOUND_B_MAN_CONF=0 +UNBOUND_B_NTP_BOOT=1 +UNBOUND_B_PRIV_BLCK=1 +UNBOUND_B_QUERY_MIN=0 + +UNBOUND_D_RESOURCE=small +UNBOUND_D_RECURSION=passive + +UNBOUND_TXT_FWD_ZONE="" +UNBOUND_TTL_MIN=120 + +UNBOUND_N_EDNS_SIZE=1280 +UNBOUND_N_FWD_PORTS="" +UNBOUND_N_RX_PORT=53 +UNBOUND_N_ROOT_AGE=28 + +############################################################################## + +UNBOUND_ANCHOR=/usr/bin/unbound-anchor +UNBOUND_CONTROL=/usr/bin/unbound-control + +UNBOUND_LIBDIR=/usr/lib/unbound + +UNBOUND_PIDFILE=/var/run/unbound.pid + +UNBOUND_VARDIR=/var/lib/unbound +UNBOUND_CONFFILE=$UNBOUND_VARDIR/unbound.conf +UNBOUND_KEYFILE=$UNBOUND_VARDIR/root.key +UNBOUND_HINTFILE=$UNBOUND_VARDIR/root.hints +UNBOUND_TIMEFILE=$UNBOUND_VARDIR/unbound.time +UNBOUND_CHECKFILE=$UNBOUND_VARDIR/unbound.check + +############################################################################## + +. /lib/functions.sh +. /lib/functions/network.sh + +. $UNBOUND_LIBDIR/dnsmasq.sh +. $UNBOUND_LIBDIR/iptools.sh +. $UNBOUND_LIBDIR/rootzone.sh + +############################################################################## + +create_access_control() { + local cfg="$1" + local subnets subnets4 subnets6 + local validip4 validip6 + + network_get_subnets subnets4 "$cfg" + network_get_subnets6 subnets6 "$cfg" + subnets="$subnets4 $subnets6" + + + if [ -n "$subnets" ] ; then + for subnet in $subnets ; do + validip4=$( valid_subnet4 $subnet ) + validip6=$( valid_subnet6 $subnet ) + + + if [ "$validip4" = "ok" -o "$validip6" = "ok" ] ; then + # For each "network" UCI add "access-control:" white list for queries + echo " access-control: $subnet allow" >> $UNBOUND_CONFFILE + fi + done + fi +} + +############################################################################## + +create_domain_insecure() { + echo " domain-insecure: \"$1\"" >> $UNBOUND_CONFFILE +} + +############################################################################## + +unbound_mkdir() { + mkdir -p $UNBOUND_VARDIR + touch $UNBOUND_CONFFILE + + + if [ -f /etc/unbound/root.hints ] ; then + # Your own local copy of root.hints + cp -p /etc/unbound/root.hints $UNBOUND_HINTFILE + + elif [ -f /usr/share/dns/root.hints ] ; then + # Debian-like package dns-root-data + cp -p /usr/share/dns/root.hints $UNBOUND_HINTFILE + + else + logger -t unbound -s "iterator will use built-in root hints" + fi + + + if [ -f /etc/unbound/root.key ] ; then + # Your own local copy of a root.key + cp -p /etc/unbound/root.key $UNBOUND_KEYFILE + + elif [ -f /usr/share/dns/root.key ] ; then + # Debian-like package dns-root-data + cp -p /usr/share/dns/root.key $UNBOUND_KEYFILE + + elif [ -x "$UNBOUND_ANCHOR" ] ; then + $UNBOUND_ANCHOR -a $UNBOUND_KEYFILE + + else + logger -t unbound -s "validator will use built-in trust anchor" + fi +} + +############################################################################## + +unbound_conf() { + local cfg=$1 + local rt_mem rt_conn + + { + # Make fresh conf file + echo "# $UNBOUND_CONFFILE generated by UCI $( date )" + echo + } > $UNBOUND_CONFFILE + + + if [ "$UNBOUND_B_CONTROL" -gt 0 ] ; then + { + # Enable remote control tool, but only at local host for security + echo "remote-control:" + echo " control-enable: yes" + echo " control-use-cert: no" + echo " control-interface: 127.0.0.1" + echo " control-interface: ::1" + echo + } >> $UNBOUND_CONFFILE + + else + { + # "control:" clause is seperate before "server:" so we can append + # dnsmasq "server:" parts and "forward:" cluases towards the end. + echo "remote-control:" + echo " control-enable: no" + echo + } >> $UNBOUND_CONFFILE + fi + + + { + # No threading + echo "server:" + echo " username: unbound" + echo " num-threads: 1" + echo " msg-cache-slabs: 1" + echo " rrset-cache-slabs: 1" + echo " infra-cache-slabs: 1" + echo " key-cache-slabs: 1" + echo + } >> $UNBOUND_CONFFILE + + + { + # Logging + echo " verbosity: 1" + echo " statistics-interval: 0" + echo " statistics-cumulative: no" + echo " extended-statistics: no" + echo + } >> $UNBOUND_CONFFILE + + + { + # Interfaces (access contol "option local_service") + echo " interface: 0.0.0.0" + echo " interface: ::0" + echo " outgoing-interface: 0.0.0.0" + echo " outgoing-interface: ::0" + echo + } >> $UNBOUND_CONFFILE + + + { + # protocol level tuning + echo " edns-buffer-size: $UNBOUND_N_EDNS_SIZE" + echo " msg-buffer-size: 8192" + echo " port: $UNBOUND_N_RX_PORT" + echo " outgoing-port-permit: 10240-65535" + echo + } >> $UNBOUND_CONFFILE + + + { + # Other harding and options for an embedded router + echo " harden-short-bufsize: yes" + echo " harden-large-queries: yes" + echo " harden-glue: yes" + echo " harden-below-nxdomain: no" + echo " harden-referral-path: no" + echo " use-caps-for-id: no" + echo + } >> $UNBOUND_CONFFILE + + + { + # Default Files + echo " use-syslog: yes" + echo " chroot: \"$UNBOUND_VARDIR\"" + echo " directory: \"$UNBOUND_VARDIR\"" + echo " pidfile: \"$UNBOUND_PIDFILE\"" + } >> $UNBOUND_CONFFILE + + + if [ -f "$UNBOUND_HINTFILE" ] ; then + # Optional hints if found + echo " root-hints: \"$UNBOUND_HINTFILE\"" >> $UNBOUND_CONFFILE + fi + + + if [ "$UNBOUND_B_DNSSEC" -gt 0 -a -f "$UNBOUND_KEYFILE" ] ; then + { + echo " auto-trust-anchor-file: \"$UNBOUND_KEYFILE\"" + echo + } >> $UNBOUND_CONFFILE + + else + echo >> $UNBOUND_CONFFILE + fi + + + case "$UNBOUND_D_RESOURCE" in + # Tiny - Unbound's recommended cheap hardware config + tiny) rt_mem=1 ; rt_conn=1 ;; + # Small - Half RRCACHE and open ports + small) rt_mem=8 ; rt_conn=5 ;; + # Medium - Nearly default but with some added balancintg + medium) rt_mem=16 ; rt_conn=10 ;; + # Large - Double medium + large) rt_mem=32 ; rt_conn=10 ;; + # Whatever unbound does + *) rt_mem=0 ; rt_conn=0 ;; + esac + + + if [ "$rt_mem" -gt 0 ] ; then + { + # Set memory sizing parameters + echo " outgoing-range: $(($rt_conn*64))" + echo " num-queries-per-thread: $(($rt_conn*32))" + echo " outgoing-num-tcp: $(($rt_conn))" + echo " incoming-num-tcp: $(($rt_conn))" + echo " rrset-cache-size: $(($rt_mem*256))k" + echo " msg-cache-size: $(($rt_mem*128))k" + echo " key-cache-size: $(($rt_mem*128))k" + echo " neg-cache-size: $(($rt_mem*64))k" + echo " infra-cache-numhosts: $(($rt_mem*256))" + echo + } >> $UNBOUND_CONFFILE + + else + logger -t unbound -s "default memory resource consumption" + fi + + + if [ "$UNBOUND_B_DNSSEC" -gt 0 ] ; then + if [ ! -f "$UNBOUND_TIMEFILE" -a "$UNBOUND_B_NTP_BOOT" -gt 0 ] ; then + # DNSSEC chicken and egg with getting NTP time + echo " val-override-date: -1" >> $UNBOUND_CONFFILE + fi + + + { + # Validation of DNSSEC + echo " module-config: \"validator iterator\"" + echo " harden-dnssec-stripped: yes" + echo " val-clean-additional: yes" + echo " ignore-cd-flag: yes" + echo + } >> $UNBOUND_CONFFILE + + else + { + # Just iteration without DNSSEC + echo " module-config: \"iterator\"" + echo + } >> $UNBOUND_CONFFILE + fi + + + if [ "$UNBOUND_B_QUERY_MIN" -gt 0 ] ; then + # Minor improvement on query privacy + echo " qname-minimisation: yes" >> $UNBOUND_CONFFILE + + else + echo " qname-minimisation: no" >> $UNBOUND_CONFFILE + fi + + + case "$UNBOUND_D_RECURSION" in + passive) + { + echo " prefetch: no" + echo " prefetch-key: no" + echo " target-fetch-policy: \"0 0 0 0 0\"" + echo + } >> $UNBOUND_CONFFILE + ;; + + aggressive) + { + echo " prefetch: yes" + echo " prefetch-key: yes" + echo " target-fetch-policy: \"3 2 1 0 0\"" + echo + } >> $UNBOUND_CONFFILE + ;; + + *) + logger -t unbound -s "default recursion configuration" + ;; + esac + + + { + # Reload records more than 10 hours old + # DNSSEC 5 minute bogus cool down before retry + # Adaptive infrastructure info kept for 15 minutes + echo " cache-min-ttl: $UNBOUND_TTL_MIN" + echo " cache-max-ttl: 36000" + echo " val-bogus-ttl: 300" + echo " infra-host-ttl: 900" + echo + } >> $UNBOUND_CONFFILE + + + if [ "$UNBOUND_B_PRIV_BLCK" -gt 0 ] ; then + { + # Remove DNS reponses from upstream with private IP + echo " private-address: 10.0.0.0/8" + echo " private-address: 169.254.0.0/16" + echo " private-address: 172.16.0.0/12" + echo " private-address: 192.168.0.0/16" + echo " private-address: fc00::/8" + echo " private-address: fd00::/8" + echo " private-address: fe80::/10" + } >> $UNBOUND_CONFFILE + fi + + + if [ "$UNBOUND_B_LOCL_BLCK" -gt 0 ] ; then + { + # Remove DNS reponses from upstream with loopback IP + # Black hole DNS method for ad blocking, so consider... + echo " private-address: 127.0.0.0/8" + echo " private-address: ::1/128" + echo + } >> $UNBOUND_CONFFILE + + else + echo >> $UNBOUND_CONFFILE + fi + + + # Domain Exceptions + config_list_foreach "$cfg" "domain_insecure" create_domain_insecure + echo >> $UNBOUND_CONFFILE + + + #################### + # UCI @ network # + #################### + + + if [ "$UNBOUND_B_LOCL_SERV" -gt 0 ] ; then + # Only respond to queries from which this device has an interface. + # Prevent DNS amplification attacks by not responding to the universe. + config_load network + config_foreach create_access_control interface + + { + echo " access-control: 127.0.0.0/8 allow" + echo " access-control: ::1/128 allow" + echo " access-control: fe80::/10 allow" + echo + } >> $UNBOUND_CONFFILE + + else + { + echo " access-control: 0.0.0.0/0 allow" + echo " access-control: ::0/0 allow" + echo + } >> $UNBOUND_CONFFILE + fi +} + +############################################################################## + +unbound_uci() { + local cfg=$1 + local dnsmasqpath + + #################### + # UCI @ unbound # + #################### + + config_get_bool UNBOUND_B_GATE_NAME "$cfg" dnsmsaq_gate_name 0 + config_get_bool UNBOUND_B_DNSMASQ "$cfg" dnsmasq_link_dns 0 + config_get_bool UNBOUND_B_LOCL_NAME "$cfg" dnsmasq_only_local 0 + config_get_bool UNBOUND_B_LOCL_SERV "$cfg" localservice 1 + config_get_bool UNBOUND_B_MAN_CONF "$cfg" manual_conf 0 + config_get_bool UNBOUND_B_QUERY_MIN "$cfg" query_minimize 0 + config_get_bool UNBOUND_B_PRIV_BLCK "$cfg" rebind_protection 1 + config_get_bool UNBOUND_B_LOCL_BLCK "$cfg" rebind_localhost 0 + config_get_bool UNBOUND_B_CONTROL "$cfg" unbound_control 0 + config_get_bool UNBOUND_B_DNSSEC "$cfg" validator 0 + config_get_bool UNBOUND_B_NTP_BOOT "$cfg" validator_ntp 1 + + config_get UNBOUND_N_EDNS_SIZE "$cfg" edns_size 1280 + config_get UNBOUND_N_RX_PORT "$cfg" listen_port 53 + config_get UNBOUND_D_RECURSION "$cfg" recursion passive + config_get UNBOUND_D_RESOURCE "$cfg" resource small + config_get UNBOUND_N_ROOT_AGE "$cfg" root_age 7 + config_get UNBOUND_TTL_MIN "$cfg" ttl_min 120 + + + if [ "$UNBOUND_B_DNSMASQ" -gt 0 ] ; then + dnsmasqpath=$( which dnsmasq ) + + + if [ ! -x "$dnsmasqpath" ] ; then + logger -t unbound -s "cannot forward to dnsmasq" + UNBOUND_B_DNSMASQ=0 + fi + fi + + + if [ "$UNBOUND_N_EDNS_SIZE" -lt 512 \ + -o 4096 -lt "$UNBOUND_N_EDNS_SIZE" ] ; then + # exceeds range, back to default + UNBOUND_N_EDNS_SIZE=1280 + fi + + + if [ "$UNBOUND_N_RX_PORT" -lt 1024 \ + -o 10240 -lt "$UNBOUND_N_RX_PORT" ] ; then + # special port or in 5 digits, back to default + UNBOUND_N_RX_PORT=53 + fi + + + if [ "$UNBOUND_TTL_MIN" -gt 1800 ] ; then + # that could have had awful side effects + UNBOUND_TTL_MIN=300 + fi + + + if [ "$UNBOUND_B_MAN_CONF" -gt 0 ] ; then + # Don't want this being triggered. Maybe we could, but then the + # base conf you provide would need to be just right. + UNBOUND_B_DNSMASQ=0 + + else + unbound_conf $cfg + fi +} + +############################################################################## + +unbound_own () { + # Debug UCI + { + echo "# $UNBOUND_CHECKFILE generated by UCI $( date )" + echo + set | grep ^UNBOUND_ + } > $UNBOUND_CHECKFILE + + + if [ "$UNBOUND_B_MAN_CONF" -gt 0 ] ; then + # You are doing your own thing, so just copy /etc/ to /var/ + cp -p /etc/unbound/* $UNBOUND_VARDIR/ + fi + + + # Ensure access and prepare to jail + chown -R unbound:unbound $UNBOUND_VARDIR + chmod 775 $UNBOUND_VARDIR + chmod 664 $UNBOUND_VARDIR/* +} + +############################################################################## + +unbound_prepare() { + # Make a home for Unbound in /var/lib/unbound + unbound_mkdir + + # Load up the chunks of UCI + config_load unbound + config_foreach unbound_uci unbound + + # Unbound primary DNS, and dnsmasq side service DHCP-DNS (dnsmasq.sh) + dnsmasq_link + + # Unbound needs chroot ownership + unbound_own +} + +############################################################################## + diff --git a/net/unbound/files/unbound.uci b/net/unbound/files/unbound.uci new file mode 100644 index 0000000..02854a8 --- /dev/null +++ b/net/unbound/files/unbound.uci @@ -0,0 +1,20 @@ +config unbound + option dnsmsaq_gate_name '0' + option dnsmasq_link_dns '0' + option dnsmasq_only_local '0' + option edns_size '1280' + option listen_port '53' + option localservice '1' + option manual_conf '0' + option query_minimize '0' + option rebind_localhost '0' + option rebind_protection '1' + option recursion 'passive' + option resource 'small' + option root_age '28' + option ttl_min '120' + option unbound_control '0' + option validator '0' + option validator_ntp '1' + #list domain_insecure '' + diff --git a/net/unbound/patches/001-conf.patch b/net/unbound/patches/001-conf.patch new file mode 100644 index 0000000..5f6b4c5 --- /dev/null +++ b/net/unbound/patches/001-conf.patch @@ -0,0 +1,95 @@ +diff --git a/doc/example.conf.in b/doc/example.conf.in +index c520c88..98a148a 100644 +--- a/doc/example.conf.in ++++ b/doc/example.conf.in +@@ -1,20 +1,82 @@ +-# +-# Example configuration file. +-# +-# See unbound.conf(5) man page, version 1.5.10. +-# +-# this is a comment. ++############################################################################## ++# MEMORY CONTROL EXAMPLE ++# In the example config settings below memory usage is reduced. Some ser- ++# vice levels are lower, notable very large data and a high TCP load are ++# no longer supported ... are exceptional for the DNS. ++# (http://unbound.net/documentation/unbound.conf.html) ++############################################################################## + + #Use this to include other text into the file. + #include: "otherfile.conf" + + # The server clause sets the main parameters. + server: +- # whitespace is not necessary, but looks cleaner. + +- # verbosity number, 0 is least verbose. 1 is default. ++ # verbosity 1 is default + verbosity: 1 + ++ # Self jail Unbound with user "unbound" to /var/lib/unbound ++ # The script /etc/init.d/unbound will setup the location ++ username: "unbound" ++ directory: "/var/lib/unbound" ++ chroot: "/var/lib/unbound" ++ ++ # The pid file is created before privleges drop so no concern ++ pidfile: "/var/run/unbound.pid" ++ ++ # no threads and no memory slabs for threads ++ num-threads: 1 ++ msg-cache-slabs: 1 ++ rrset-cache-slabs: 1 ++ infra-cache-slabs: 1 ++ key-cache-slabs: 1 ++ ++ # don't be picky about interfaces but consider your firewall ++ interface: 0.0.0.0 ++ interface: ::0 ++ access-control: 0.0.0.0/0 allow ++ access-control: ::0/0 allow ++ ++ # this limits TCP service but uses less buffers ++ outgoing-num-tcp: 1 ++ incoming-num-tcp: 1 ++ ++ # use somewhat higher port numbers versus possible NAT issue ++ outgoing-port-permit: "10240-65335" ++ ++ # uses less memory but less performance ++ outgoing-range: 60 ++ num-queries-per-thread: 30 ++ ++ # exclude large responses ++ msg-buffer-size: 8192 ++ ++ # tiny memory cache ++ infra-cache-numhosts: 200 ++ msg-cache-size: 100k ++ rrset-cache-size: 100k ++ key-cache-size: 100k ++ neg-cache-size: 10k ++ ++ # gentle on recursion ++ target-fetch-policy: "2 1 0 0 0 0" ++ harden-large-queries: yes ++ harden-short-bufsize: yes ++ ++ # DNSSEC enable by removing comments on "module-config:" and "auto-trust- ++ # -anchor-file:" The init script will copy root key to /var/lib/unbound. ++ # See package documentation for crontab entry to copy RFC5011 results back. ++ #module-config: "validator iterator" ++ #auto-trust-anchor-file: "/var/lib/unbound/root.key" ++ ++ # DNSSEC needs real time to validate signatures. If your device does not ++ # have power off clock (reboot), then you may need this work around. ++ #domain-insecure: "pool.ntp.org" ++ ++############################################################################## ++# Resume Stock example.conf.in ++############################################################################## ++ + # print statistics to the log (for every thread) every N seconds. + # Set to "" or 0 to disable. Default is disabled. + # statistics-interval: 0 diff --git a/net/usbip/Makefile b/net/usbip/Makefile new file mode 100644 index 0000000..3148514 --- /dev/null +++ b/net/usbip/Makefile @@ -0,0 +1,109 @@ +# +# Copyright (C) 2010-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=usbip +PKG_RELEASE:=5 +PKG_LICENSE:=GPL-2.0 + +# Since kernel 2.6.39.1 userspace tools are inside the kernel tree +# Package Automatic match version in kernel +# MD5SUM is not useful kernel package already check it +PKG_VERSION:=$(shell sed -n -e '/^AC_INIT/s/.*\[\([[:digit:]\.]*\)\].*/\1/gp' $(LINUX_DIR)/tools/usb/usbip/configure.ac) +PKG_SOURCE:= +PKG_SOURCE_URL:= +PKG_MD5SUM:=unknown + +PKG_MAINTAINER:=Nuno Goncalves + +PATCH_DIR:=./patches-$(PKG_VERSION) + +define prepare_source_directory + rm -rf $(PKG_BUILD_DIR) + $(CP) $(LINUX_DIR)/tools/usb/usbip $(PKG_BUILD_DIR) +endef +Hooks/Prepare/Pre += prepare_source_directory + +PKG_BUILD_DEPENDS:=eudev +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 +PKG_FLAGS:=nonshared + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/usbip/Common + TITLE:=USB-over-IP + URL:=http://usbip.sourceforge.net/ + DEPENDS:=@USB_SUPPORT +endef + +define Package/usbip/Default + $(call Package/usbip/Common) + SECTION:=net + CATEGORY:=Network +endef + +define Package/usbip + $(call Package/usbip/Default) + TITLE+= (common) + DEPENDS+= +libwrap +kmod-usbip +eudev +endef + +define Package/usbip-client + $(call Package/usbip/Default) + TITLE+= (client) + DEPENDS+= usbip +kmod-usbip-client +endef + +define Package/usbip-server + $(call Package/usbip/Default) + TITLE+= (server) + DEPENDS+= usbip +kmod-usbip-server +endef + +CONFIGURE_PATH:=. +MAKE_PATH:=. +LIBTOOL_PATHS:=. +MAKE_FLAGS+=CFLAGS="-Wno-implicit-function-declaration" + +define Build/Configure + (cd $(PKG_BUILD_DIR); ./autogen.sh ); + $(call Build/Configure/Default) +endef + +CFLAGS+="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" + +define Download/usb.ids + URL:=http://www.linux-usb.org/ + FILE:=usb.ids + MD5SUM:= +endef + +define Package/usbip/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libusbip.so.* $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/share/hwdata + $(CP) $(DL_DIR)/usb.ids $(1)/usr/share/hwdata/ +endef + +define Package/usbip-client/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/usbip $(1)/usr/sbin/ +endef + +define Package/usbip-server/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/usbipd $(1)/usr/sbin/ +endef + +$(eval $(call Download,usb.ids)) +$(eval $(call BuildPackage,usbip)) +$(eval $(call BuildPackage,usbip-client)) +$(eval $(call BuildPackage,usbip-server)) diff --git a/net/usbip/patches-2.0/100-musl-compat.patch b/net/usbip/patches-2.0/100-musl-compat.patch new file mode 100644 index 0000000..a64678c --- /dev/null +++ b/net/usbip/patches-2.0/100-musl-compat.patch @@ -0,0 +1,11 @@ +--- a/src/usbipd.c ++++ b/src/usbipd.c +@@ -453,7 +453,7 @@ static void set_signal(void) + sigaction(SIGTERM, &act, NULL); + sigaction(SIGINT, &act, NULL); + act.sa_handler = SIG_IGN; +- sigaction(SIGCLD, &act, NULL); ++ sigaction(SIGCHLD, &act, NULL); + } + + static const char *pid_file; diff --git a/net/usbip/patches/001-upstream_svn_r99.diff b/net/usbip/patches/001-upstream_svn_r99.diff new file mode 100644 index 0000000..aa193e1 --- /dev/null +++ b/net/usbip/patches/001-upstream_svn_r99.diff @@ -0,0 +1,11 @@ +Index: trunk/src/cmd/Makefile.am +=================================================================== +--- trunk/src/cmd/Makefile.am (revision 98) ++++ trunk/src/cmd/Makefile.am (revision 99) +@@ -17,5 +17,5 @@ + INCLUDES = -I$(top_srcdir)/lib + LDADD = ../lib/libusbip.la @PACKAGE_LIBS@ + EXTRA_CFLAGS = @EXTRA_CFLAGS@ +-AM_CFLAGS = -Wall -W -Wstrict-prototypes -std=gnu99 $(EXTRA_CFLAGS) @PACKAGE_CFLAGS@ ++AM_CFLAGS = -Wall -W -Wstrict-prototypes -std=gnu99 $(EXTRA_CFLAGS) @PACKAGE_CFLAGS@ -DUSBIDS_FILE='"@USBIDS_DIR@/usb.ids"' + diff --git a/net/usbip/patches/002-upstream_svn_r152.patch b/net/usbip/patches/002-upstream_svn_r152.patch new file mode 100644 index 0000000..e7135a6 --- /dev/null +++ b/net/usbip/patches/002-upstream_svn_r152.patch @@ -0,0 +1,229 @@ +--- a/drivers/head/stub_dev.c ++++ b/drivers/head/stub_dev.c +@@ -398,7 +398,11 @@ static int stub_probe(struct usb_interfa + { + struct usb_device *udev = interface_to_usbdev(interface); + struct stub_device *sdev = NULL; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) + char *udev_busid = interface->dev.parent->bus_id; ++#else ++ char *udev_busid = dev_name(interface->dev.parent); ++#endif + int err = 0; + + udbg("Enter\n"); +--- a/drivers/head/stub_main.c ++++ b/drivers/head/stub_main.c +@@ -252,18 +252,17 @@ static int __init usb_stub_init(void) + return -ENOMEM; + } + ++ info(DRIVER_DESC "" DRIVER_VERSION); ++ ++ memset(busid_table, 0, sizeof(busid_table)); ++ spin_lock_init(&busid_table_lock); ++ + ret = usb_register(&stub_driver); + if (ret) { + uerr("usb_register failed %d\n", ret); + return ret; + } + +- +- info(DRIVER_DESC "" DRIVER_VERSION); +- +- memset(busid_table, 0, sizeof(busid_table)); +- spin_lock_init(&busid_table_lock); +- + ret = driver_create_file(&stub_driver.drvwrap.driver, &driver_attr_match_busid); + + if (ret) { +--- a/drivers/head/stub_rx.c ++++ b/drivers/head/stub_rx.c +@@ -159,7 +159,11 @@ static int tweak_set_configuration_cmd(s + * A user may need to set a special configuration value before + * exporting the device. + */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) + uinfo("set_configuration (%d) to %s\n", config, urb->dev->dev.bus_id); ++#else ++ uinfo("set_configuration (%d) to %s\n", config, dev_name(&urb->dev->dev)); ++#endif + uinfo("but, skip!\n"); + + return 0; +@@ -177,7 +181,11 @@ static int tweak_reset_device_cmd(struct + value = le16_to_cpu(req->wValue); + index = le16_to_cpu(req->wIndex); + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) + uinfo("reset_device (port %d) to %s\n", index, urb->dev->dev.bus_id); ++#else ++ uinfo("reset_device (port %d) to %s\n", index, dev_name(&urb->dev->dev)); ++#endif + + /* all interfaces should be owned by usbip driver, so just reset it. */ + ret = usb_lock_device_for_reset(urb->dev, NULL); +@@ -187,7 +195,11 @@ static int tweak_reset_device_cmd(struct + } + + /* try to reset the device */ +- ret = usb_reset_composite_device(urb->dev, NULL); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) ++ ret = usb_reset_composite_device(urb->dev, NULL); ++#else ++ ret = usb_reset_device(urb->dev); ++#endif + if (ret < 0) + uerr("device reset\n"); + +--- a/drivers/head/usbip_common.c ++++ b/drivers/head/usbip_common.c +@@ -55,10 +55,7 @@ static ssize_t show_flag(struct device * + static ssize_t store_flag(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) + { +- unsigned long flag; +- +- sscanf(buf, "%lx", &flag); +- usbip_debug_flag = flag; ++ sscanf(buf, "%lx", &usbip_debug_flag); + + return count; + } +@@ -390,7 +387,7 @@ int usbip_thread(void *param) + unlock_kernel(); + + /* srv.rb must wait for rx_thread starting */ +- complete(&ut->thread_done); ++ complete(&ut->thread_started); + + /* start of while loop */ + ut->loop_ops(ut); +@@ -403,15 +400,21 @@ int usbip_thread(void *param) + + void usbip_start_threads(struct usbip_device *ud) + { ++ + /* + * threads are invoked per one device (per one connection). + */ ++ INIT_COMPLETION(ud->tcp_rx.thread_started); ++ INIT_COMPLETION(ud->tcp_tx.thread_started); ++ INIT_COMPLETION(ud->tcp_rx.thread_done); ++ INIT_COMPLETION(ud->tcp_tx.thread_done); ++ + kernel_thread((int(*)(void *))usbip_thread, (void *)&ud->tcp_rx, 0); + kernel_thread((int(*)(void *))usbip_thread, (void *)&ud->tcp_tx, 0); + + /* confirm threads are starting */ +- wait_for_completion(&ud->tcp_rx.thread_done); +- wait_for_completion(&ud->tcp_tx.thread_done); ++ wait_for_completion(&ud->tcp_rx.thread_started); ++ wait_for_completion(&ud->tcp_tx.thread_started); + } + EXPORT_SYMBOL(usbip_start_threads); + +@@ -436,6 +439,7 @@ void usbip_task_init(struct usbip_task * + void (*loop_ops)(struct usbip_task *)) + { + ut->thread = NULL; ++ init_completion(&ut->thread_started); + init_completion(&ut->thread_done); + ut->name = name; + ut->loop_ops = loop_ops; +--- a/drivers/head/usbip_event.c ++++ b/drivers/head/usbip_event.c +@@ -38,7 +38,7 @@ void usbip_start_eh(struct usbip_device + + kernel_thread((int(*)(void *)) usbip_thread, (void *) eh, 0); + +- wait_for_completion(&eh->thread_done); ++ wait_for_completion(&eh->thread_started); + } + EXPORT_SYMBOL(usbip_start_eh); + +--- a/drivers/head/vhci_hcd.c ++++ b/drivers/head/vhci_hcd.c +@@ -58,7 +58,7 @@ static void vhci_stop(struct usb_hcd *hc + static int vhci_get_frame_number(struct usb_hcd *hcd); + + static const char driver_name[] = "vhci_hcd"; +-static const char driver_desc[] = "USB/IP Virtual Host Contoroller"; ++static const char driver_desc[] = "USB/IP Virtual Host Controller"; + + + +@@ -416,14 +416,6 @@ static int vhci_hub_control(struct usb_h + case USB_PORT_FEAT_SUSPEND: + dbg_vhci_rh(" SetPortFeature: USB_PORT_FEAT_SUSPEND\n"); + uerr(" not yet\n"); +-#if 0 +- dum->port_status[rhport] |= (1 << USB_PORT_FEAT_SUSPEND); +- if (dum->driver->suspend) { +- spin_unlock (&dum->lock); +- dum->driver->suspend (&dum->gadget); +- spin_lock (&dum->lock); +- } +-#endif + break; + case USB_PORT_FEAT_RESET: + dbg_vhci_rh(" SetPortFeature: USB_PORT_FEAT_RESET\n"); +@@ -432,12 +424,6 @@ static int vhci_hub_control(struct usb_h + dum->port_status[rhport] &= ~(USB_PORT_STAT_ENABLE + | USB_PORT_STAT_LOW_SPEED + | USB_PORT_STAT_HIGH_SPEED); +-#if 0 +- if (dum->driver) { +- dev_dbg (hardware, "disconnect\n"); +- stop_activity (dum, dum->driver); +- } +-#endif + + /* FIXME test that code path! */ + } +@@ -1060,7 +1046,7 @@ static int vhci_hcd_probe(struct platfor + struct usb_hcd *hcd; + int ret; + +- uinfo("proving...\n"); ++ uinfo("probing...\n"); + + dbg_vhci_hc("name %s id %d\n", pdev->name, pdev->id); + +@@ -1076,7 +1062,11 @@ static int vhci_hcd_probe(struct platfor + * Allocate and initialize hcd. + * Our private data is also allocated automatically. + */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) + hcd = usb_create_hcd(&vhci_hc_driver, &pdev->dev, pdev->dev.bus_id); ++#else ++ hcd = usb_create_hcd(&vhci_hc_driver, &pdev->dev, dev_name(&pdev->dev)); ++#endif + if (!hcd) { + uerr("create hcd failed\n"); + return -ENOMEM; +--- a/drivers/head/vhci_sysfs.c ++++ b/drivers/head/vhci_sysfs.c +@@ -123,7 +123,11 @@ static ssize_t show_status(struct device + out += sprintf(out, "%03u %08x ", + vdev->speed, vdev->devid); + out += sprintf(out, "%16p ", vdev->ud.tcp_socket); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) + out += sprintf(out, "%s", vdev->udev->dev.bus_id); ++#else ++ out += sprintf(out, "%s", dev_name(&vdev->udev->dev)); ++#endif + + } else + out += sprintf(out, "000 000 000 0000000000000000 0-0"); +--- a/drivers/head/usbip_common.h ++++ b/drivers/head/usbip_common.h +@@ -300,6 +300,7 @@ struct usbip_device; + + struct usbip_task { + struct task_struct *thread; ++ struct completion thread_started; + struct completion thread_done; + char *name; + void (*loop_ops)(struct usbip_task *); diff --git a/net/vncrepeater/Makefile b/net/vncrepeater/Makefile new file mode 100644 index 0000000..b9c2884 --- /dev/null +++ b/net/vncrepeater/Makefile @@ -0,0 +1,70 @@ +# +# 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:=vncrepeater +PKG_VERSION:=0.14 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Jirka Spicak +PKG_LICENSE:=GPL-2.0 + + +PKG_SOURCE:=repeater014.zip +PKG_SOURCE_URL:=http://jtko.mbnet.fi/uvncrepeater +PKG_MD5SUM:=3005ebbb2f9442cbea4cbcaa71925dbf + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/uclibc++.mk +include $(INCLUDE_DIR)/package.mk + +define Package/vncrepeater + SECTION:=net + CATEGORY:=Network + DEPENDS:=$(CXX_DEPENDS) + TITLE:=UltraVNC repeater for Linux + URL:=http://www.uvnc.com/addons/repeater.html +endef + +define Package/vncrepeater/conffiles +/etc/vncrepeater.conf +endef + +define Package/vncrepeater/description + Viewer can be behind Nat router or directly connected to the internet + instead of forwarding serveral ports, you only need to forward 1 port. + If the PC that runs the Repeater has access to the local DNS server, + you can use your local DNS names instead of 10.10.10.12. + This could be handy when you have a dynamic DHCP server allocating + ip adresses for your PC. +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) + $(PKG_UNPACK) + $(CP) $(PKG_BUILD_DIR)/../Ver014/* $(PKG_BUILD_DIR)/ + rm -rf $(PKG_BUILD_DIR)/../Ver014/ + $(Build/Patch) +endef + +define Build/Compile + $(call Build/Compile/Default, \ + CC="$(TARGET_CXX)" \ + CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -fno-rtti" \ + repeater \ + ) +endef + +define Package/vncrepeater/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_BUILD_DIR)/repeater $(1)/usr/sbin/$(PKG_NAME) + $(INSTALL_DIR) $(1)/etc + $(CP) $(PKG_BUILD_DIR)/uvncrepeater.ini $(1)/etc/vncrepeater.conf +endef + +$(eval $(call BuildPackage,vncrepeater)) diff --git a/net/vncrepeater/patches/001-uclibcxx_linking.patch b/net/vncrepeater/patches/001-uclibcxx_linking.patch new file mode 100644 index 0000000..eca2c3a --- /dev/null +++ b/net/vncrepeater/patches/001-uclibcxx_linking.patch @@ -0,0 +1,39 @@ +--- vncrepeater-0.14/Makefile 2006-04-09 23:37:10.000000000 +0200 ++++ vncrepeater-0.14.new/Makefile 2016-11-09 19:59:13.000000000 +0100 +@@ -1,27 +1,28 @@ + CFLAGS=-Wall + repeater: repeater.o repeaterproc.o openbsd_stringfuncs.o iniparser.o readini.o repeaterutil.o repeaterevents.o +- g++ $(CFLAGS) -o repeater repeater.o repeaterproc.o openbsd_stringfuncs.o iniparser.o readini.o repeaterutil.o repeaterevents.o ++ $(CC) $(CFLAGS) -o repeater repeater.o repeaterproc.o openbsd_stringfuncs.o iniparser.o readini.o repeaterutil.o repeaterevents.o $(LDFLAGS) + + repeater.o: repeater.cpp +- g++ $(CFLAGS) -c repeater.cpp ++ $(CC) $(CFLAGS) -c repeater.cpp + + repeaterproc.o: repeaterproc.cpp +- g++ $(CFLAGS) -c repeaterproc.cpp ++ $(CC) $(CFLAGS) -c repeaterproc.cpp + + openbsd_stringfuncs.o: openbsd_stringfuncs.cpp +- g++ $(CFLAGS) -c openbsd_stringfuncs.cpp ++ $(CC) $(CFLAGS) -c openbsd_stringfuncs.cpp + + iniparser.o: iniparser.cpp +- g++ $(CFLAGS) -c iniparser.cpp ++ $(CC) $(CFLAGS) -c iniparser.cpp + + readini.o: readini.cpp +- g++ $(CFLAGS) -c readini.cpp ++ $(CC) $(CFLAGS) -c readini.cpp + + repeaterutil.o: repeaterutil.cpp +- g++ $(CFLAGS) -c repeaterutil.cpp ++ $(CC) $(CFLAGS) -c repeaterutil.cpp + + repeaterevents.o: repeaterevents.cpp +- g++ $(CFLAGS) -c repeaterevents.cpp ++ $(CC) $(CFLAGS) -c repeaterevents.cpp + + clean: + rm -f *.o repeater ++ diff --git a/net/vncrepeater/patches/002-cfg-path.patch b/net/vncrepeater/patches/002-cfg-path.patch new file mode 100644 index 0000000..976504b --- /dev/null +++ b/net/vncrepeater/patches/002-cfg-path.patch @@ -0,0 +1,38 @@ +--- vncrepeater-0.14/repeater.cpp 2006-10-20 17:07:50.000000000 +0200 ++++ vncrepeater-0.14.new/repeater.cpp 2016-11-19 17:04:59.907871000 +0100 +@@ -593,7 +593,9 @@ + static long parseId(char *IdCode) + { + unsigned int ii; +- int retVal; ++ //PFaf 20101122: Minor correction due to compiler warning ++ //int retVal; ++ long retVal; + + debug(LEVEL_3, "parseId(): IdCode = %s\n", IdCode); + +@@ -998,9 +1000,13 @@ + allow = false; + + //server 0 == denied +- if ((srvAddr.a == 0) || (srvAddr.b == 0) || (srvAddr.c == 0) || (srvAddr.d == 0)) ++ //Fix by PFaf - 20101122 ++ //Server address can be X.0.0.Y i.e. 10.0.0.1 ++ //since these are valid addresses, so we should not exclude them. ++ //Only exclude addresses that start or end with zeros (0). ++ //if ((srvAddr.a == 0) || (srvAddr.b == 0) || (srvAddr.c == 0) || (srvAddr.d == 0)) ++ if ((srvAddr.a == 0) || (srvAddr.d == 0)) + allow = false; +- + + //allowed so far ? + if (allow) +@@ -1983,7 +1989,7 @@ + struct sigaction saInt; + + //ini file default +- char defaultIniFilePathAndName[] = "/etc/uvncrepeater.ini"; ++ char defaultIniFilePathAndName[] = "/etc/vncrepeater.conf"; + char tmpBuf[MAX_PATH]; + bool memoryOk; + diff --git a/net/vnstat/Makefile b/net/vnstat/Makefile new file mode 100644 index 0000000..921597d --- /dev/null +++ b/net/vnstat/Makefile @@ -0,0 +1,110 @@ +# +# 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:=vnstat +PKG_VERSION:=1.12 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://humdi.net/vnstat +PKG_MD5SUM:=a154b2196771e06a8accd1c24374009c +PKG_MAINTAINER:=Jo-Philipp Wich + +PKG_INSTALL:=1 + +PKG_BUILD_DEPENDS:=libgd +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/vnstat/Default + SECTION:=net + CATEGORY:=Network + URL:=http://humdi.net/vnstat/ +endef + +define Package/vnstat +$(call Package/vnstat/Default) + TITLE:=Console-based network traffic monitor +endef + +define Package/vnstat/description + vnStat is a network traffic monitor for Linux that keeps a log of daily + network traffic for the selected interface(s). vnStat isn't a packet + sniffer. The traffic information is analyzed from the /proc -filesystem, + so vnStat can be used without root permissions. +endef + +define Package/vnstati +$(call Package/vnstat/Default) + DEPENDS+=vnstat +libgd + TITLE:=PNG image output support for vnStat +endef + +define Package/vnstati/description + The purpose of vnstati is to provide image output support for statistics + collected using vnstat(1). However, the image file format is limited to + png. All basic outputs of vnStat are supported excluding live traffic + features. The image can be outputted either to a file or to standard + output. +endef + +define Package/vnstat/conffiles +/etc/vnstat.conf +/etc/config/vnstat +endef + +define Build/Compile/vnstat + +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" +endef + +define Build/Compile/vnstati + +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \ + LDFLAGS="$(TARGET_LDFLAGS) -Wl,-rpath-link,$(STAGING_DIR)/usr/lib" \ + all +endef + +define Build/Compile +$(call Build/Compile/vnstat) +$(call Build/Compile/vnstati) +endef + +define Package/vnstat/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/vnstat $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/vnstatd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/vnstat.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/vnstat.config $(1)/etc/config/vnstat + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/vnstat.init $(1)/etc/init.d/vnstat + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) ./files/vnstat.defaults $(1)/etc/uci-defaults/vnstat +endef + +define Package/vnstati/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/vnstati $(1)/usr/bin/ +endef + +define Package/vnstat/postinst +#!/bin/sh +[ -n "$${IPKG_INSTROOT}" ] || (. /etc/uci-defaults/vnstat) && rm -f /etc/uci-defaults/vnstat +exit 0 +endef + +$(eval $(call BuildPackage,vnstat)) +$(eval $(call BuildPackage,vnstati)) diff --git a/net/vnstat/files/vnstat.config b/net/vnstat/files/vnstat.config new file mode 100644 index 0000000..9da71ed --- /dev/null +++ b/net/vnstat/files/vnstat.config @@ -0,0 +1,5 @@ +config vnstat + list interface br-lan +# list interface eth0.1 +# option remote http://example.org/vnstat/ +# option symlink /www/vnstat diff --git a/net/vnstat/files/vnstat.defaults b/net/vnstat/files/vnstat.defaults new file mode 100644 index 0000000..e013b8e --- /dev/null +++ b/net/vnstat/files/vnstat.defaults @@ -0,0 +1,13 @@ +#!/bin/sh + +wan="$(uci -P/var/state get network.wan.ifname)" + +if [ -n "$wan" ]; then + uci -q batch <<-EOF >/dev/null + del_list vnstat.@vnstat[-1].interface=$wan + add_list vnstat.@vnstat[-1].interface=$wan + commit vnstat + EOF +fi + +exit 0 diff --git a/net/vnstat/files/vnstat.init b/net/vnstat/files/vnstat.init new file mode 100644 index 0000000..7921cbc --- /dev/null +++ b/net/vnstat/files/vnstat.init @@ -0,0 +1,89 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008-2011 OpenWrt.org + +START=99 + +vnstat_option() { + sed -ne "s/^[[:space:]]*$1[[:space:]]*['\"]\([^'\"]*\)['\"].*/\1/p" \ + /etc/vnstat.conf +} + +start() { + local lib="$(vnstat_option DatabaseDir)" + local pid="$(vnstat_option PidFile)" + + [ -n "$lib" ] || { + echo "Error: No DatabaseDir set in vnstat.conf" >&2 + exit 1 + } + + [ -n "$pid" ] || { + echo "Error: No PidFile set in vnstat.conf" >&2 + exit 1 + } + + mkdir -p "$lib" + + init_ifaces() { + local cfg="$1" + local url lnk + + init_iface() { + local ifn="$1" + + if [ -n "$url" ]; then + local try=0 + local max=3 + local hostname="$(cat /proc/sys/kernel/hostname)" + + while [ $((++try)) -le $max ]; do + if wget -q -O "$lib/$ifn" "$url/${hostname}_$ifn" 2>/dev/null && [ -e "$lib/$ifn" ]; then + logger -t "vnstat" "Downloaded backup for database $ifn" + break + else + logger -t "vnstat" "Download try $try/$max for database $ifn failed" + sleep 30 + fi + done + elif [ -n "$backup_dir" ]; then + if cp -f "$backup_dir/$ifn" "$lib/" &>/dev/null; then + logger -t "vnstat" "Restored backup for database $ifn" + else + logger -t "vnstat" "Restore of backup for database $ifn failed" + fi + fi + + /usr/bin/vnstat -u -i "$ifn" >/dev/null + + [ -n "$lnk" ] && { + mkdir -p "$lnk" + [ -L "$lnk/$ifn" ] || ln -s "$lib/$ifn" "$lnk/$ifn" + } + } + + config_get url "$cfg" remote + config_get lnk "$cfg" symlink + config_get backup_dir "$cfg" backup_dir + config_list_foreach "$cfg" interface init_iface + + return 1 + } + + config_load vnstat + config_foreach init_ifaces vnstat + + SERVICE_PID_FILE="${pid}" + service_start /usr/sbin/vnstatd -d +} + +stop() { + local pid="$(vnstat_option PidFile)" + + [ -n "$pid" ] || { + echo "Error: No PidFile set in vnstat.conf" >&2 + exit 1 + } + + SERVICE_PID_FILE="${pid}" + service_stop /usr/sbin/vnstatd +} diff --git a/net/vnstat/patches/001-conf.patch b/net/vnstat/patches/001-conf.patch new file mode 100644 index 0000000..5fb24c3 --- /dev/null +++ b/net/vnstat/patches/001-conf.patch @@ -0,0 +1,19 @@ +--- a/cfg/vnstat.conf ++++ b/cfg/vnstat.conf +@@ -78,13 +78,13 @@ DaemonUser "" + DaemonGroup "" + + # how often (in seconds) interface data is updated +-UpdateInterval 30 ++UpdateInterval 60 + + # how often (in seconds) interface status changes are checked +-PollInterval 5 ++PollInterval 30 + + # how often (in minutes) data is saved to file +-SaveInterval 5 ++SaveInterval 30 + + # how often (in minutes) data is saved when all interface are offline + OfflineSaveInterval 30 diff --git a/net/vnstat/patches/002-no_install_strip.patch b/net/vnstat/patches/002-no_install_strip.patch new file mode 100644 index 0000000..8f11de6 --- /dev/null +++ b/net/vnstat/patches/002-no_install_strip.patch @@ -0,0 +1,35 @@ +--- a/Makefile ++++ b/Makefile +@@ -66,11 +66,11 @@ install: + + # install everything else + install -d -m 755 $(BIN) $(SBIN) $(MAN)/man1 $(MAN)/man5 +- install -s -m 755 src/vnstat $(BIN) +- install -s -m 755 src/vnstatd $(SBIN) ++ install -m 755 src/vnstat $(BIN) ++ install -m 755 src/vnstatd $(SBIN) + @if [ -f "src/vnstati" ]; \ +- then echo install -s -m 755 src/vnstati $(BIN); \ +- install -s -m 755 src/vnstati $(BIN); \ ++ then echo install -m 755 src/vnstati $(BIN); \ ++ install -m 755 src/vnstati $(BIN); \ + fi + + # update man pages, gzip it if previous version was done so +@@ -139,12 +139,12 @@ bsdinstall: + + # install binaries + install -d -m 755 $(DESTDIR)/var/db/vnstat +- install -s -m 755 src/vnstat $(BIN_BSD) +- install -s -m 755 src/vnstatd $(SBIN_BSD) ++ install -m 755 src/vnstat $(BIN_BSD) ++ install -m 755 src/vnstatd $(SBIN_BSD) + + @if [ -f "src/vnstati" ]; \ +- then echo install -s -m 755 src/vnstati $(BIN_BSD); \ +- install -s -m 755 src/vnstati $(BIN_BSD); \ ++ then echo install -m 755 src/vnstati $(BIN_BSD); \ ++ install -m 755 src/vnstati $(BIN_BSD); \ + fi + + # install default config if such doesn't exist diff --git a/net/vnstat/patches/003-no_install_uname.patch b/net/vnstat/patches/003-no_install_uname.patch new file mode 100644 index 0000000..14c17d5 --- /dev/null +++ b/net/vnstat/patches/003-no_install_uname.patch @@ -0,0 +1,15 @@ +--- a/Makefile ++++ b/Makefile +@@ -33,12 +33,6 @@ debug: + install: + @echo "Installing vnStat..." + +-# check that system is really Linux +- @if [ `uname` != "Linux" ]; \ +- then echo "This isn't a Linux system. Maybe 'make bsdinstall' is what you need?"; \ +- false; \ +- fi +- + # check that there's something to install + @if [ ! -f "src/vnstat" ] || [ ! -f "src/vnstatd" ]; \ + then echo "Nothing to install, run make first."; \ diff --git a/net/vnstat/patches/100-musl-compat.patch b/net/vnstat/patches/100-musl-compat.patch new file mode 100644 index 0000000..0512389 --- /dev/null +++ b/net/vnstat/patches/100-musl-compat.patch @@ -0,0 +1,10 @@ +--- a/src/common.h ++++ b/src/common.h +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + + #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__FreeBSD_kernel__) + #include diff --git a/net/vpnc-scripts/Makefile b/net/vpnc-scripts/Makefile new file mode 100644 index 0000000..910aac1 --- /dev/null +++ b/net/vpnc-scripts/Makefile @@ -0,0 +1,37 @@ +# +# Copyright (C) 2006-2015 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:=vpnc-scripts +PKG_VERSION:=20151220 +PKG_RELEASE:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/vpnc-scripts + SECTION:=net + CATEGORY:=Network + TITLE:=VPN configuration script for vpnc and OpenConnect + MAINTAINER:=Nikos Mavrogiannopoulos + SUBMENU:=VPN +endef + +define Package/vpnc-scripts/description + This package contains the vpnc-script which is used by vpnc + and OpenConnect to configure the tunnel interface. +endef + +define Build/Compile +endef + +define Package/vpnc-scripts/install + $(INSTALL_DIR) $(1)/lib/netifd + $(INSTALL_BIN) ./files/vpnc-script $(1)/lib/netifd/ +endef + +$(eval $(call BuildPackage,vpnc-scripts)) diff --git a/net/vpnc-scripts/files/vpnc-script b/net/vpnc-scripts/files/vpnc-script new file mode 100755 index 0000000..5575c3c --- /dev/null +++ b/net/vpnc-scripts/files/vpnc-script @@ -0,0 +1,219 @@ +#!/bin/sh +# List of parameters passed through environment +#* reason -- why this script was called, one of: pre-init connect disconnect +#* VPNGATEWAY -- vpn gateway address (always present) +#* TUNDEV -- tunnel device (always present) +#* INTERNAL_IP4_ADDRESS -- address (always present) +#* INTERNAL_IP4_MTU -- mtu (often unset) +#* INTERNAL_IP4_NETMASK -- netmask (often unset) +#* INTERNAL_IP4_NETMASKLEN -- netmask length (often unset) +#* INTERNAL_IP4_NETADDR -- address of network (only present if netmask is set) +#* INTERNAL_IP4_DNS -- list of dns servers +#* INTERNAL_IP4_NBNS -- list of wins servers +#* INTERNAL_IP6_ADDRESS -- IPv6 address +#* INTERNAL_IP6_NETMASK -- IPv6 netmask +#* INTERNAL_IP6_DNS -- IPv6 list of dns servers +#* CISCO_DEF_DOMAIN -- default domain name +#* CISCO_BANNER -- banner from server +#* CISCO_SPLIT_INC -- number of networks in split-network-list +#* CISCO_SPLIT_INC_%d_ADDR -- network address +#* CISCO_SPLIT_INC_%d_MASK -- subnet mask (for example: 255.255.255.0) +#* CISCO_SPLIT_INC_%d_MASKLEN -- subnet masklen (for example: 24) +#* CISCO_SPLIT_INC_%d_PROTOCOL -- protocol (often just 0) +#* CISCO_SPLIT_INC_%d_SPORT -- source port (often just 0) +#* CISCO_SPLIT_INC_%d_DPORT -- destination port (often just 0) +#* CISCO_IPV6_SPLIT_INC -- number of networks in IPv6 split-network-list +#* CISCO_IPV6_SPLIT_INC_%d_ADDR -- IPv6 network address +#* CISCO_IPV6_SPLIT_INC_$%d_MASKLEN -- IPv6 subnet masklen + +HOOKS_DIR=/etc/openconnect + +# FIXMEs: + +# Section A: route handling + +# 1) The 3 values CISCO_SPLIT_INC_%d_PROTOCOL/SPORT/DPORT are currently being ignored +# In order to use them, we'll probably need os specific solutions +# * Linux: iptables -t mangle -I PREROUTING -j ROUTE --oif $TUNDEV +# This would be an *alternative* to changing the routes (and thus 2) and 3) +# shouldn't be relevant at all) +# 2) There are two different functions to set routes: generic routes and the +# default route. Why isn't the defaultroute handled via the generic route case? +# 3) In the split tunnel case, all routes but the default route might get replaced +# without getting restored later. We should explicitely check and save them just +# like the defaultroute +# 4) Replies to a dhcp-server should never be sent into the tunnel + +# Section B: Split DNS handling + +# 1) We parse CISCO_SPLIT_DNS and use dnsmasq to set it + +do_connect() { + if [ -n "$CISCO_BANNER" ]; then + logger -t openconnect "Connect Banner:" + echo "$CISCO_BANNER" | while read LINE ; do logger -t openconnect "|" "$LINE" ; done + fi + + proto_init_update "$TUNDEV" 1 + + if [ -n "$INTERNAL_IP4_MTU" ]; then + MTU=$INTERNAL_IP4_MTU + fi + + if [ -z "$MTU" ]; then + MTU=1412 + fi + + proto_add_ipv4_address "$INTERNAL_IP4_ADDRESS" 32 "" "$INTERNAL_IP4_ADDRESS" + + if [ -n "$INTERNAL_IP4_NETMASKLEN" ]; then + proto_add_ipv4_route "$INTERNAL_IP4_NETADDR" "$INTERNAL_IP4_NETMASKLEN" + fi + + # If the netmask is provided, it contains the address _and_ netmask + if [ -n "$INTERNAL_IP6_ADDRESS" ] && [ -z "$INTERNAL_IP6_NETMASK" ]; then + INTERNAL_IP6_NETMASK="$INTERNAL_IP6_ADDRESS/128" + fi + + if [ -n "$INTERNAL_IP6_NETMASK" ]; then + addr="${INTERNAL_IP6_NETMASK%%/*}" + mask="${INTERNAL_IP6_NETMASK##*/}" + [[ "$addr" != "$mask" ]] && proto_add_ipv6_address "$addr" "$mask" + fi + + DNSMASQ_FILE="/tmp/dnsmasq.d/openconnect.$TUNDEV" + LOCAL_DOMAIN=$(uci get dhcp.@dnsmasq[0].domain) + rm -f $DNSMASQ_FILE + if [ -n "$CISCO_SPLIT_DNS" ] && [ -d "/tmp/dnsmasq.d/" ];then + SDNS=`echo $CISCO_SPLIT_DNS|sed 's/,/\n/g'` + echo "$SDNS" | while read i; do + if [ "$i" = "$LOCAL_DOMAIN" ];then + continue + fi + if [ -n "$INTERNAL_IP4_DNS" ];then + for dns in $INTERNAL_IP4_DNS;do + echo "server=/$i/$dns" >> $DNSMASQ_FILE + done + fi + if [ -n "$INTERNAL_IP6_DNS" ];then + for dns in $INTERNAL_IP6_DNS;do + echo "server=/$i/$dns" >> $DNSMASQ_FILE + done + fi + echo "rebind-domain-ok=$i" >> $DNSMASQ_FILE + done + /etc/init.d/dnsmasq restart + else + if [ -n "$INTERNAL_IP4_DNS" ];then + for dns in $INTERNAL_IP4_DNS;do + proto_add_dns_server "$dns" + done + fi + if [ -n "$INTERNAL_IP6_DNS" ];then + for dns in $INTERNAL_IP6_DNS;do + proto_add_dns_server "$dns" + done + fi + if [ -n "$CISCO_DEF_DOMAIN" ] && [ "$CISCO_DEF_DOMAIN" != "$LOCAL_DOMAIN" ];then + if [ -n "$INTERNAL_IP4_DNS" ];then + for dns in $INTERNAL_IP4_DNS;do + echo "server=/$CISCO_DEF_DOMAIN/$dns" >> $DNSMASQ_FILE + done + fi + if [ -n "$INTERNAL_IP6_DNS" ];then + for dns in $INTERNAL_IP6_DNS;do + echo "server=/$CISCO_DEF_DOMAIN/$dns" >> $DNSMASQ_FILE + done + fi + proto_add_dns_search "$CISCO_DEF_DOMAIN" + fi + fi + + if [ -n "$CISCO_SPLIT_INC" ]; then + i=0 + while [ $i -lt $CISCO_SPLIT_INC ] ; do + eval NETWORK="\${CISCO_SPLIT_INC_${i}_ADDR}" + eval NETMASK="\${CISCO_SPLIT_INC_${i}_MASK}" + eval NETMASKLEN="\${CISCO_SPLIT_INC_${i}_MASKLEN}" + if [ $NETWORK != "0.0.0.0" ]; then + proto_add_ipv4_route "$NETWORK" "$NETMASKLEN" + else + proto_add_ipv4_route "0.0.0.0" 0 + fi + i=$(($i + 1)) + done + elif [ -n "$INTERNAL_IP4_ADDRESS" ]; then + proto_add_ipv4_route "0.0.0.0" 0 + fi + if [ -n "$CISCO_IPV6_SPLIT_INC" ]; then + i=0 + while [ $i -lt $CISCO_IPV6_SPLIT_INC ] ; do + eval NETWORK="\${CISCO_IPV6_SPLIT_INC_${i}_ADDR}" + eval NETMASKLEN="\${CISCO_IPV6_SPLIT_INC_${i}_MASKLEN}" + if [ $NETMASKLEN -lt 128 ]; then + proto_add_ipv6_route "$NETWORK" "$NETMASKLEN" + else + proto_add_ipv6_route "::0" 0 + fi + i=$(($i + 1)) + done + elif [ -n "$INTERNAL_IP6_NETMASK" -o -n "$INTERNAL_IP6_ADDRESS" ]; then + proto_add_ipv6_route "::0" 0 + fi + proto_send_update "$INTERFACE" +} + +do_disconnect() { + rm -f "/tmp/dnsmasq.d/openconnect.$TUNDEV" + proto_init_update "$TUNDEV" 0 + proto_send_update "$INTERFACE" +} + +#### Hooks +run_hooks() { + HOOK="$1" + + if [ -d ${HOOKS_DIR}/${HOOK}.d ]; then + for script in ${HOOKS_DIR}/${HOOK}.d/* ; do + [ -f $script ] && . $script + done + fi +} + +#### Main + +if [ -z "$reason" ]; then + logger -t openconnect "this script must be called from vpnc" 1>&2 + exit 1 +fi +if [ -z "$INTERFACE" ]; then + logger -t openconnect "this script must be called for an active interface" + exit 1 +fi + +. /lib/netifd/netifd-proto.sh + +case "$reason" in + pre-init) + run_hooks pre-init + ;; + connect) + run_hooks connect + do_connect + run_hooks post-connect + ;; + disconnect) + run_hooks disconnect + do_disconnect + run_hooks post-disconnect + ;; + reconnect) + run_hooks reconnect + ;; + *) + logger -t openconnect "unknown reason '$reason'. Maybe vpnc-script is out of date" 1>&2 + exit 1 + ;; +esac + +exit 0 diff --git a/net/vpnc/Config.in b/net/vpnc/Config.in new file mode 100644 index 0000000..5eacd97 --- /dev/null +++ b/net/vpnc/Config.in @@ -0,0 +1,18 @@ +# vpnc avanced configuration + +menu "Configuration" + depends on PACKAGE_vpnc + +choice + prompt "SSL library" + default VPNC_GNUTLS + +config VPNC_GNUTLS + bool "GnuTLS support" + +config VPNC_OPENSSL + bool "OpenSSL" + +endchoice + +endmenu diff --git a/net/vpnc/Makefile b/net/vpnc/Makefile new file mode 100644 index 0000000..147bca9 --- /dev/null +++ b/net/vpnc/Makefile @@ -0,0 +1,94 @@ +# +# Copyright (C) 2006-2015 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:=vpnc +PKG_REV:=550 +PKG_VERSION:=0.5.3.r$(PKG_REV) +PKG_RELEASE:=5 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://svn.unix-ag.uni-kl.de/vpnc/trunk/ +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=$(PKG_REV) +PKG_SOURCE_PROTO:=svn + +PKG_MAINTAINER:=Daniel Gimpelevich +PKG_LICENSE:=VARIOUS +PKG_LICENSE_FILES:=COPYING + +PKG_CONFIG_DEPENDS:= \ + CONFIG_VPNC_GNUTLS \ + CONFIG_VPNC_OPENSSL \ + + +include $(INCLUDE_DIR)/package.mk + +define Package/vpnc/config + source "$(SOURCE)/Config.in" +endef + +define Package/vpnc + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libgpg-error +libgcrypt +kmod-tun +VPNC_OPENSSL:libopenssl +VPNC_GNUTLS:libgnutls +vpnc-scripts +resolveip + TITLE:=VPN client for Cisco EasyVPN + URL:=http://www.unix-ag.uni-kl.de/~massar/vpnc/ + SUBMENU:=VPN +endef + +define Package/vpnc/description + A VPN client compatible with Cisco's EasyVPN equipment. + + Supports IPSec (ESP) with Mode Configuration and Xauth. Supports only + shared-secret IPSec authentication with Xauth, AES (256, 192, 128), + 3DES, 1DES, MD5, SHA1, DH1/2/5 and IP tunneling. +endef + +define Package/vpnc/conffiles +/etc/vpnc/default.conf +endef + +ifeq ($(CONFIG_VPNC_OPENSSL),y) +define Build/Compile + $(call Build/Compile/Default, \ + OFLAGS="$(TARGET_CFLAGS)" \ + OS="Linux" VERSION="$(PKG_VERSION)" \ + STAGING_DIR="$(STAGING_DIR)" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + OPENSSL_GPL_VIOLATION=yes PREFIX=/usr \ + all install \ + ) +endef +else +define Build/Compile + $(call Build/Compile/Default, \ + OFLAGS="$(TARGET_CFLAGS)" \ + OS="Linux" VERSION="$(PKG_VERSION)" \ + STAGING_DIR="$(STAGING_DIR)" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + PREFIX=/usr \ + all install \ + ) +endef +endif + +define Package/vpnc/install + $(INSTALL_DIR) $(1)/lib/netifd/proto + $(INSTALL_BIN) ./files/vpnc.sh $(1)/lib/netifd/proto/ + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/vpnc \ + $(PKG_INSTALL_DIR)/usr/sbin/vpnc-disconnect \ + $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/vpnc + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/vpnc/default.conf $(1)/etc/vpnc/ + $(INSTALL_DIR) $(1)/lib/upgrade/keep.d + $(INSTALL_DATA) ./files/vpnc.upgrade $(1)/lib/upgrade/keep.d/vpnc +endef + +$(eval $(call BuildPackage,vpnc)) diff --git a/net/vpnc/README b/net/vpnc/README new file mode 100644 index 0000000..975ee36 --- /dev/null +++ b/net/vpnc/README @@ -0,0 +1,41 @@ +The vpnc client expects to be configured using the uci interface. + +To setup a VPN connection, add the following to /etc/config/network: + +config interface 'MYVPN' + option proto 'vpnc' + option interface 'wan' + option server 'vpn.example.com' + option username 'test' + option password 'secret' # or: + option hexpasswd 'AE7FF6A0426F0A0CD0A02EB9EC3C5066FAEB0B25' + option authgroup 'DEFAULT' + option passgroup 'groupsecret' # or: + option hexpassgroup '52B0BEAF6605C3CE9BE20A0DC0A0F6240A6FF7EA' + option domain 'WORKGROUP' + option vendor 'cisco' # or 'netscreen' + option natt_mode 'natt' # or 'none' or 'force-natt' or 'cisco-udp' + option dh_group 'dh2' # or 'dh1' or 'dh5' + option pfs 'server' # or 'nopfs' or 'dh1' or 'dh2' or 'dh5' + option enable_single_des '0' + option enable_no_enc '0' # '1' to enable unencrypted VPN + option mtu '0' + option local_addr '0.0.0.0' + option local_port '500' # '0' to use a random port + option udp_port '10000' # '0' to use a random port + option dpd_idle '300' + option auth_mode 'psk' # or 'hybrid' + option target_network '0.0.0.0/0.0.0.0' # network/netmask or CIDR + +The additional file(s) are also used: +/etc/vpnc/ca-vpn-MYVPN.pem: The server's CA certificate (for auth_mode 'hybrid') + +After these are setup you can initiate the VPN using "ifup MYVPN", and +deinitialize it using ifdown. You may also use the luci web interface +(Network -> Interfaces -> MYVPN Connect). + +Note that you need to configure the firewall to allow communication between +the MYVPN interface and lan. + +If you install this package via opkg, there are reports that you must reboot +before it can be used. diff --git a/net/vpnc/files/vpnc.sh b/net/vpnc/files/vpnc.sh new file mode 100755 index 0000000..971b823 --- /dev/null +++ b/net/vpnc/files/vpnc.sh @@ -0,0 +1,110 @@ +#!/bin/sh +. /lib/functions.sh +. ../netifd-proto.sh +init_proto "$@" + +proto_vpnc_init_config() { + proto_config_add_string "server" + proto_config_add_string "username" + proto_config_add_string "hexpasswd" + proto_config_add_string "authgroup" + proto_config_add_string "password" + proto_config_add_string "token_mode" + proto_config_add_string "token_secret" + proto_config_add_string "interface" + proto_config_add_string "passgroup" + proto_config_add_string "hexpassgroup" + proto_config_add_string "domain" + proto_config_add_string "vendor" + proto_config_add_string "natt_mode" + proto_config_add_string "dh_group" + proto_config_add_string "pfs" + proto_config_add_boolean "enable_single_des" + proto_config_add_boolean "enable_no_enc" + proto_config_add_int "mtu" + proto_config_add_string "local_addr" + proto_config_add_int "local_port" + proto_config_add_int "udp_port" + proto_config_add_int "dpd_idle" + proto_config_add_string "auth_mode" + proto_config_add_string "target_network" + proto_config_add_boolean "authfail" + no_device=1 + available=1 +} + +proto_vpnc_setup() { + local config="$1" + + json_get_vars server username hexpasswd authgroup password token_mode token_secret interface passgroup hexpassgroup domain vendor natt_mode dh_group pfs enable_single_des enable_no_enc mtu local_addr local_port udp_port dpd_idle auth_mode target_network authfail + + grep -q tun /proc/modules || insmod tun + + logger -t vpnc "initializing..." + serv_addr= + for ip in $(resolveip -t 10 "$server"); do + ( proto_add_host_dependency "vpn-$config" "$ip" $interface ) + serv_addr=1 + done + [ -n "$serv_addr" ] || { + logger -t vpnc "Could not resolve server address: '$server'" + sleep 60 + proto_setup_failed "$config" + exit 1 + } + + mkdir -p /var/etc + umask 077 + pwfile="/var/etc/vpnc-$config.conf" + echo "IPSec gateway $server" > "$pwfile" + cmdline="--no-detach --pid-file /var/run/vpnc-$config.pid --ifname vpn-$config --non-inter --script /lib/netifd/vpnc-script $pwfile" + + [ -f /etc/vpnc/ca-vpn-$config.pem ] && echo "CA-File /etc/vpnc/ca-vpn-$config.pem" >> "$pwfile" + [ -n "$hexpasswd" ] && echo "Xauth obfuscated password $hexpasswd" >> "$pwfile" + [ -n "$authgroup" ] && echo "IPSec ID $authgroup" >> "$pwfile" + [ -n "$username" ] && echo "Xauth username $username" >> "$pwfile" + [ -n "$password" ] && echo "Xauth password $password" >> "$pwfile" + [ -n "$passgroup" ] && echo "IPSec secret $passgroup" >> "$pwfile" + [ -n "$hexpassgroup" ] && echo "IPSec obfuscated secret $hexpassgroup" >> "$pwfile" + [ -n "$domain" ] && echo "Domain $domain" >> "$pwfile" + [ -n "$vendor" ] && echo "Vendor $vendor" >> "$pwfile" + [ -n "$natt_mode" ] && echo "NAT Traversal Mode $natt_mode" >> "$pwfile" + [ -n "$dh_group" ] && echo "IKE DH Group $dh_group" >> "$pwfile" + [ -n "$pfs" ] && echo "Perfect Forward Secrecy $pfs" >> "$pwfile" + [ "${enable_single_des:-0}" -gt 0 ] && echo "Enable Single DES" >> "$pwfile" + [ "${enable_no_enc:-0}" -gt 0 ] && echo "Enable no encryption" >> "$pwfile" + [ -n "$mtu" ] && echo "Interface MTU $mtu" >> "$pwfile" + [ -n "$local_addr" ] && echo "Local Addr $local_addr" >> "$pwfile" + [ -n "$local_port" ] && echo "Local Port $local_port" >> "$pwfile" + [ -n "$udp_port" ] && echo "Cisco UDP Encapsulation Port $udp_port" >> "$pwfile" + [ -n "$dpd_idle" ] && echo "DPD idle timeout (our side) $dpd_idle" >> "$pwfile" + [ -n "$auth_mode" ] && echo "IKE Authmode $auth_mode" >> "$pwfile" + [ -n "$target_network" ] && echo "IPSEC target network $target_network" >> "$pwfile" + + proto_export INTERFACE="$config" + logger -t vpnc "executing 'vpnc $cmdline'" + proto_run_command "$config" /usr/sbin/vpnc $cmdline +} + +proto_vpnc_teardown() { + local config="$1" + + pwfile="/var/etc/vpnc-$config.conf" + + json_get_var authfail authfail + # On error exit (vpnc only has success = 0 and error = 1, so + # we can't be fine-grained and say only auth error) + # and authfail setting true, then don't retry starting vpnc + # This is used for the case were the server blocks repeated + # failed authentication attempts (which will occur if the password + # is wrong, for example). + if [ ${ERROR:-0} -gt 0 ] && [ "${authfail:-0}" -gt 0 ]; then + proto_block_restart "$config" + fi + + rm -f $pwfile + logger -t vpnc "bringing down vpnc" + proto_kill_command "$config" 2 +} + +add_protocol vpnc diff --git a/net/vpnc/files/vpnc.upgrade b/net/vpnc/files/vpnc.upgrade new file mode 100644 index 0000000..585513d --- /dev/null +++ b/net/vpnc/files/vpnc.upgrade @@ -0,0 +1,2 @@ +/etc/vpnc/ca-vpn-*.pem + diff --git a/net/vpnc/patches/001-cross.patch b/net/vpnc/patches/001-cross.patch new file mode 100644 index 0000000..33bcfee --- /dev/null +++ b/net/vpnc/patches/001-cross.patch @@ -0,0 +1,42 @@ +--- a/Makefile ++++ b/Makefile +@@ -20,7 +20,7 @@ + # $Id: Makefile 539 2013-12-04 13:41:04Z Antonio Borneo $ + + DESTDIR= +-PREFIX=/usr/local ++PREFIX=/usr + ETCDIR=/etc/vpnc + BINDIR=$(PREFIX)/bin + SBINDIR=$(PREFIX)/sbin +@@ -57,18 +57,15 @@ OBJS = $(addsuffix .o,$(basename $(SRCS) + CRYPTO_OBJS = $(addsuffix .o,$(basename $(CRYPTO_SRCS))) + BINOBJS = $(addsuffix .o,$(BINS)) + BINSRCS = $(addsuffix .c,$(BINS)) +-VERSION := $(shell sh mk-version) + RELEASE_VERSION := $(shell cat VERSION) + + CC ?= gcc +-CFLAGS ?= -O3 -g + CFLAGS += -W -Wall -Wmissing-declarations -Wwrite-strings +-CFLAGS += $(shell libgcrypt-config --cflags) $(CRYPTO_CFLAGS) ++CFLAGS += -O3 -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include $(OFLAGS) $(CRYPTO_CFLAGS) + CPPFLAGS += -DVERSION=\"$(VERSION)\" +-LDFLAGS ?= -g +-LIBS += $(shell libgcrypt-config --libs) $(CRYPTO_LDADD) ++LIBS += -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -lgcrypt -lgpg-error $(CRYPTO_LDADD) + +-ifeq ($(shell uname -s), SunOS) ++ifeq ($(OS), SunOS) + LIBS += -lnsl -lresolv -lsocket + endif + ifneq (,$(findstring Apple,$(shell $(CC) --version))) +@@ -82,7 +79,7 @@ vpnc : $(OBJS) vpnc.o + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) + + vpnc.8 : vpnc.8.template makeman.pl vpnc +- ./makeman.pl ++ touch vpnc.8 + + cisco-decrypt : cisco-decrypt.o decrypt-utils.o + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) diff --git a/net/vpnc/patches/100-musl-compat.patch b/net/vpnc/patches/100-musl-compat.patch new file mode 100644 index 0000000..0a46770 --- /dev/null +++ b/net/vpnc/patches/100-musl-compat.patch @@ -0,0 +1,42 @@ +--- a/sysdep.h ++++ b/sysdep.h +@@ -37,12 +37,14 @@ int tun_read(int fd, unsigned char *buf, + int tun_get_hwaddr(int fd, char *dev, uint8_t *hwaddr); + + /***************************************************************************/ +-#if defined(__linux__) || defined(__GLIBC__) ++#if defined(__GLIBC__) || defined(__UCLIBC__) + #include ++#define HAVE_ERROR 1 ++#endif + ++#if defined(__linux__) || defined(__GLIBC__) + #define HAVE_VASPRINTF 1 + #define HAVE_ASPRINTF 1 +-#define HAVE_ERROR 1 + #define HAVE_UNSETENV 1 + #define HAVE_SETENV 1 + #endif +--- a/sysdep.c ++++ b/sysdep.c +@@ -59,6 +59,10 @@ + #if defined(__DragonFly__) + #include + #elif defined(__linux__) ++# if !defined(__GLIBC__) && !defined(__UCLIBC__) ++# define _LINUX_IF_ETHER_H ++# include ++# endif + #include + #elif defined(__APPLE__) + /* no header for tun */ +--- a/config.c ++++ b/config.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + #include + #include + #include diff --git a/net/vsftpd/Makefile b/net/vsftpd/Makefile new file mode 100644 index 0000000..da50698 --- /dev/null +++ b/net/vsftpd/Makefile @@ -0,0 +1,94 @@ +# +# Copyright (C) 2006-2015 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:=vsftpd +PKG_VERSION:=3.0.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://security.appspot.com/downloads/ +PKG_MD5SUM:=da119d084bd3f98664636ea05b5bb398 +PKG_LICENSE:=GPLv2 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/vsftpd/Default + SUBMENU:=File Transfer + SECTION:=net + CATEGORY:=Network + TITLE:=A fast and secure FTP server + URL:=http://vsftpd.beasts.org/ + MAINTAINER:=Cezary Jackiewicz +endef + + +define Package/vsftpd +$(call Package/vsftpd/Default) + VARIANT:=notls + TITLE+= (no TLS) +endef + +define Package/vsftpd-tls +$(call Package/vsftpd/Default) + VARIANT:=tls + TITLE+= (TLS) + DEPENDS+=+libopenssl +endef + +define Package/vsftpd/conffiles +/etc/vsftpd.conf +endef + +Package/vsftpd-tls/conffiles=$(Package/vsftpd/conffiles) + +ifneq ($(CONFIG_USE_MUSL),) + NLSSTRING:=-lcrypt +else + NLSSTRING:=-lcrypt -lnsl +endif + +ifeq ($(BUILD_VARIANT),notls) + define Build/Compile + $(SED) 's/-lcrypt -lnsl/$(NLSSTRING)/' $(PKG_BUILD_DIR)/Makefile + $(MAKE) -C $(PKG_BUILD_DIR) \ + CC="$(TARGET_CC)" \ + CFLAGS="$(TARGET_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + vsftpd + endef +endif + +ifeq ($(BUILD_VARIANT),tls) + define Build/Compile + $(SED) 's/#undef VSF_BUILD_SSL/#define VSF_BUILD_SSL/' $(PKG_BUILD_DIR)/builddefs.h + $(SED) 's/-lcrypt -lnsl/-lcrypt -lnsl -lssl -lcrypto/' $(PKG_BUILD_DIR)/Makefile + $(SED) 's/-lcrypt -lnsl/$(NLSSTRING)/' $(PKG_BUILD_DIR)/Makefile + $(MAKE) -C $(PKG_BUILD_DIR) \ + CC="$(TARGET_CC)" \ + CFLAGS="$(TARGET_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + vsftpd + endef +endif + +define Package/vsftpd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) ./files/$(PKG_NAME).conf $(1)/etc/$(PKG_NAME).conf + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME) +endef + +Package/vsftpd-tls/install=$(Package/vsftpd/install) + +$(eval $(call BuildPackage,vsftpd)) +$(eval $(call BuildPackage,vsftpd-tls)) diff --git a/net/vsftpd/files/vsftpd.conf b/net/vsftpd/files/vsftpd.conf new file mode 100644 index 0000000..7d46506 --- /dev/null +++ b/net/vsftpd/files/vsftpd.conf @@ -0,0 +1,30 @@ +background=YES +listen=YES +anonymous_enable=NO +local_enable=YES +write_enable=YES +local_umask=022 +check_shell=NO +#dirmessage_enable=YES +#ftpd_banner=Welcome to blah FTP service. +session_support=NO +#syslog_enable=YES +#userlist_enable=YES +#userlist_deny=NO +#userlist_file=/etc/vsftpd.users +#xferlog_enable=YES +#xferlog_file=/var/log/vsftpd.log +#xferlog_std_format=YES +### +### TLS/SSL options +### example key generation: openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/config/vsftpd_privkey.pem -out /etc/config/vsftpd_cert.pem -subj /C="DE"/ST="Saxony"/L="Leipzig"/CN="OpenWrt" +#ssl_enable=YES +#allow_anon_ssl=NO +#force_local_data_ssl=NO +#force_local_logins_ssl=NO +#ssl_tlsv1=YES +#ssl_sslv2=NO +#ssl_sslv3=NO +#rsa_cert_file=/etc/config/vsftpd_cert.pem +#rsa_private_key_file=/etc/config/vsftpd_privkey.pem + diff --git a/net/vsftpd/files/vsftpd.init b/net/vsftpd/files/vsftpd.init new file mode 100644 index 0000000..ad3e23d --- /dev/null +++ b/net/vsftpd/files/vsftpd.init @@ -0,0 +1,13 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=50 + +start() { + mkdir -m 0755 -p /var/run/vsftpd + service_start /usr/sbin/vsftpd +} + +stop() { + service_stop /usr/sbin/vsftpd +} diff --git a/net/vsftpd/patches/001-destdir.patch b/net/vsftpd/patches/001-destdir.patch new file mode 100644 index 0000000..b0274ac --- /dev/null +++ b/net/vsftpd/patches/001-destdir.patch @@ -0,0 +1,47 @@ +--- a/Makefile ++++ b/Makefile +@@ -22,6 +22,8 @@ OBJS = main.o utility.o prelogin.o ftpcm + seccompsandbox.o + + ++DESTDIR = ++ + .c.o: + $(CC) -c $*.c $(CFLAGS) $(IFLAGS) + +@@ -29,21 +31,20 @@ vsftpd: $(OBJS) + $(CC) -o vsftpd $(OBJS) $(LINK) $(LDFLAGS) $(LIBS) + + install: +- if [ -x /usr/local/sbin ]; then \ +- $(INSTALL) -m 755 vsftpd /usr/local/sbin/vsftpd; \ +- else \ +- $(INSTALL) -m 755 vsftpd /usr/sbin/vsftpd; fi +- if [ -x /usr/local/man ]; then \ +- $(INSTALL) -m 644 vsftpd.8 /usr/local/man/man8/vsftpd.8; \ +- $(INSTALL) -m 644 vsftpd.conf.5 /usr/local/man/man5/vsftpd.conf.5; \ +- elif [ -x /usr/share/man ]; then \ +- $(INSTALL) -m 644 vsftpd.8 /usr/share/man/man8/vsftpd.8; \ +- $(INSTALL) -m 644 vsftpd.conf.5 /usr/share/man/man5/vsftpd.conf.5; \ +- else \ +- $(INSTALL) -m 644 vsftpd.8 /usr/man/man8/vsftpd.8; \ +- $(INSTALL) -m 644 vsftpd.conf.5 /usr/man/man5/vsftpd.conf.5; fi +- if [ -x /etc/xinetd.d ]; then \ +- $(INSTALL) -m 644 xinetd.d/vsftpd /etc/xinetd.d/vsftpd; fi ++ mkdir -p $(DESTDIR)/usr/sbin ++ $(INSTALL) -m 755 vsftpd $(DESTDIR)/usr/sbin/ ++ mkdir -p $(DESTDIR)/usr/share/man/man8 ++ $(INSTALL) -m 644 vsftpd.8 $(DESTDIR)/usr/share/man/man8/ ++ mkdir -p $(DESTDIR)/usr/share/man/man5 ++ $(INSTALL) -m 644 vsftpd.conf.5 $(DESTDIR)/usr/share/man/man5/ ++ mkdir -p $(DESTDIR)/etc/xinetd.d ++ $(INSTALL) -m 644 xinetd.d/vsftpd $(DESTDIR)/etc/xinetd.d/ ++ ++uninstall: ++ rm -f $(DESTDIR)/usr/sbin/vsftpd ++ rm -f $(DESTDIR)/usr/share/man/man8/vsftpd.8 ++ rm -f $(DESTDIR)/usr/share/man/man5/vsftpd.conf.5 ++ rm -f $(DESTDIR)/etc/xinetd.d/vsftpd + + clean: + rm -f *.o *.swp vsftpd diff --git a/net/vsftpd/patches/002-find_libs.patch b/net/vsftpd/patches/002-find_libs.patch new file mode 100644 index 0000000..daf83ef --- /dev/null +++ b/net/vsftpd/patches/002-find_libs.patch @@ -0,0 +1,13 @@ +--- a/Makefile ++++ b/Makefile +@@ -8,8 +8,8 @@ CFLAGS = -O2 -fPIE -fstack-protector --p + -D_FORTIFY_SOURCE=2 \ + #-pedantic -Wconversion + +-LIBS = `./vsf_findlibs.sh` +-LINK = -Wl,-s ++LIBS = -lcrypt -lnsl ++LINK = + LDFLAGS = -fPIE -pie -Wl,-z,relro -Wl,-z,now + + OBJS = main.o utility.o prelogin.o ftpcmdio.o postlogin.o privsock.o \ diff --git a/net/vsftpd/patches/003-chroot.patch b/net/vsftpd/patches/003-chroot.patch new file mode 100644 index 0000000..8965da4 --- /dev/null +++ b/net/vsftpd/patches/003-chroot.patch @@ -0,0 +1,11 @@ +--- a/tunables.c ++++ b/tunables.c +@@ -254,7 +254,7 @@ tunables_load_defaults() + /* -rw------- */ + tunable_chown_upload_mode = 0600; + +- install_str_setting("/usr/share/empty", &tunable_secure_chroot_dir); ++ install_str_setting("/var/run/vsftpd", &tunable_secure_chroot_dir); + install_str_setting("ftp", &tunable_ftp_username); + install_str_setting("root", &tunable_chown_username); + install_str_setting("/var/log/xferlog", &tunable_xferlog_file); diff --git a/net/vsftpd/patches/004-disable-capabilities.patch b/net/vsftpd/patches/004-disable-capabilities.patch new file mode 100644 index 0000000..7aa6330 --- /dev/null +++ b/net/vsftpd/patches/004-disable-capabilities.patch @@ -0,0 +1,12 @@ +--- a/sysdeputil.c ++++ b/sysdeputil.c +@@ -165,6 +165,9 @@ + #endif + /* END config */ + ++#undef VSF_SYSDEP_HAVE_CAPABILITIES ++#undef VSF_SYSDEP_HAVE_LIBCAP ++ + /* PAM support - we include our own dummy version if the system lacks this */ + #include + diff --git a/net/vsftpd/patches/005-disable-pam.patch b/net/vsftpd/patches/005-disable-pam.patch new file mode 100644 index 0000000..ebb7244 --- /dev/null +++ b/net/vsftpd/patches/005-disable-pam.patch @@ -0,0 +1,11 @@ +--- a/builddefs.h ++++ b/builddefs.h +@@ -2,7 +2,7 @@ + #define VSF_BUILDDEFS_H + + #undef VSF_BUILD_TCPWRAPPERS +-#define VSF_BUILD_PAM ++#undef VSF_BUILD_PAM + #undef VSF_BUILD_SSL + + #endif /* VSF_BUILDDEFS_H */ diff --git a/net/vsftpd/patches/006-musl-compatibility.patch b/net/vsftpd/patches/006-musl-compatibility.patch new file mode 100644 index 0000000..9eefec7 --- /dev/null +++ b/net/vsftpd/patches/006-musl-compatibility.patch @@ -0,0 +1,13 @@ +--- a/sysdeputil.c ++++ b/sysdeputil.c +@@ -58,7 +58,9 @@ + #define VSF_SYSDEP_HAVE_SHADOW + #define VSF_SYSDEP_HAVE_USERSHELL + #define VSF_SYSDEP_HAVE_LIBCAP +-#define VSF_SYSDEP_HAVE_UTMPX ++#if defined(__GLIBC__) || defined(__UCLIBC__) ++ #define VSF_SYSDEP_HAVE_UTMPX ++#endif + + #define __USE_GNU + #include diff --git a/net/vsftpd/patches/007-CVE-2015-1419.patch b/net/vsftpd/patches/007-CVE-2015-1419.patch new file mode 100644 index 0000000..173027a --- /dev/null +++ b/net/vsftpd/patches/007-CVE-2015-1419.patch @@ -0,0 +1,98 @@ +Description: CVE-2015-1419: config option deny_file is not handled correctly +Author: Marcus Meissner +Origin: https://bugzilla.novell.com/show_bug.cgi?id=CVE-2015-1419 +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=776922 +Last-Update: 2015-02-24 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/ls.c ++++ b/ls.c +@@ -7,6 +7,7 @@ + * Would you believe, code to handle directory listing. + */ + ++#include + #include "ls.h" + #include "access.h" + #include "defs.h" +@@ -243,11 +244,42 @@ vsf_filename_passes_filter(const struct + struct mystr temp_str = INIT_MYSTR; + struct mystr brace_list_str = INIT_MYSTR; + struct mystr new_filter_str = INIT_MYSTR; ++ struct mystr normalize_filename_str = INIT_MYSTR; ++ const char *normname; ++ const char *path; + int ret = 0; + char last_token = 0; + int must_match_at_current_pos = 1; ++ + str_copy(&filter_remain_str, p_filter_str); +- str_copy(&name_remain_str, p_filename_str); ++ ++ /* normalize filepath */ ++ path = str_strdup(p_filename_str); ++ normname = realpath(path, NULL); ++ if (normname == NULL) ++ goto out; ++ str_alloc_text(&normalize_filename_str, normname); ++ ++ if (!str_isempty (&filter_remain_str) && !str_isempty(&normalize_filename_str)) { ++ if (str_get_char_at(p_filter_str, 0) == '/') { ++ if (str_get_char_at(&normalize_filename_str, 0) != '/') { ++ str_getcwd (&name_remain_str); ++ ++ if (str_getlen(&name_remain_str) > 1) /* cwd != root dir */ ++ str_append_char (&name_remain_str, '/'); ++ ++ str_append_str (&name_remain_str, &normalize_filename_str); ++ } ++ else ++ str_copy (&name_remain_str, &normalize_filename_str); ++ } else { ++ if (str_get_char_at(p_filter_str, 0) != '{') ++ str_basename (&name_remain_str, &normalize_filename_str); ++ else ++ str_copy (&name_remain_str, &normalize_filename_str); ++ } ++ } else ++ str_copy(&name_remain_str, &normalize_filename_str); + + while (!str_isempty(&filter_remain_str) && *iters < VSFTP_MATCHITERS_MAX) + { +@@ -360,6 +392,9 @@ vsf_filename_passes_filter(const struct + ret = 0; + } + out: ++ free(normname); ++ free(path); ++ str_free(&normalize_filename_str); + str_free(&filter_remain_str); + str_free(&name_remain_str); + str_free(&temp_str); +--- a/str.c ++++ b/str.c +@@ -711,3 +711,14 @@ str_replace_unprintable(struct mystr* p_ + } + } + ++void ++str_basename (struct mystr* d_str, const struct mystr* path) ++{ ++ static struct mystr tmp; ++ ++ str_copy (&tmp, path); ++ str_split_char_reverse(&tmp, d_str, '/'); ++ ++ if (str_isempty(d_str)) ++ str_copy (d_str, path); ++} +--- a/str.h ++++ b/str.h +@@ -100,6 +100,7 @@ void str_replace_unprintable(struct myst + int str_atoi(const struct mystr* p_str); + filesize_t str_a_to_filesize_t(const struct mystr* p_str); + unsigned int str_octal_to_uint(const struct mystr* p_str); ++void str_basename (struct mystr* d_str, const struct mystr* path); + + /* PURPOSE: Extract a line of text (delimited by \n or EOF) from a string + * buffer, starting at character position 'p_pos'. The extracted line will diff --git a/net/wavemon/Makefile b/net/wavemon/Makefile new file mode 100644 index 0000000..327a12f --- /dev/null +++ b/net/wavemon/Makefile @@ -0,0 +1,58 @@ +# +# Copyright (C) 2008-2015 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:=wavemon +PKG_VERSION:=0.8.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=https://github.com/uoaerg/wavemon.git +PKG_SOURCE_VERSION:=v$(PKG_VERSION) + +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Jonathan McCrohan + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/wavemon + SECTION:=net + CATEGORY:=Network + TITLE:=N-curses based wireless network devices monitor + DEPENDS:=+libncurses +libpthread +libnl-genl + SUBMENU:=wireless + URL:=https://github.com/uoaerg/wavemon/releases +endef + +define Package/wavemon/description + wavemon is a ncurses-based monitoring application for wireless network + devices. It currently works under Linux with devices that are supported + by the wireless extensions by Jean Tourrilhes (included in Kernel 2.4 + and higher), e.g. the Lucent Orinoco cards. +endef + +CONFIGURE_VARS += \ + ac_cv_lib_cap_cap_get_flag=no + +TARGET_CFLAGS += -pthread -I$(STAGING_DIR)/usr/include/libnl3 + +MAKE_FLAGS += \ + CFLAGS="$(TARGET_CFLAGS) -L$(STAGING_DIR)/usr/lib -I$(STAGING_DIR)/usr/include" + +define Package/wavemon/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/wavemon $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,wavemon)) diff --git a/net/wavemon/patches/musl-fix.patch b/net/wavemon/patches/musl-fix.patch new file mode 100644 index 0000000..a0a7866 --- /dev/null +++ b/net/wavemon/patches/musl-fix.patch @@ -0,0 +1,21 @@ +diff --git a/wavemon.h b/wavemon.h +index e7584f7..8c76d11 100644 +--- a/wavemon.h ++++ b/wavemon.h +@@ -19,6 +19,7 @@ + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + #include ++#include + #include + #include + #include +@@ -33,7 +34,7 @@ + #include + #include + #include +-#include ++#include + + #include "llist.h" + diff --git a/net/webui-aria2/Makefile b/net/webui-aria2/Makefile new file mode 100644 index 0000000..514ad18 --- /dev/null +++ b/net/webui-aria2/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2016 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:=webui-aria2 +PKG_VERSION:=2016-10-11 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/ziahamza/webui-aria2.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=6a29c1b1d0224e1daa88906e88bc2e177ca2ad76 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Hsing-Wang Liao + +include $(INCLUDE_DIR)/package.mk + +define Package/webui-aria2 + SECTION:=net + CATEGORY:=Network + SUBMENU:=Download Manager + DEPENDS:= + TITLE:=An interface to interact with aria2 + URL:=https://github.com/ziahamza/webui-aria2 + PKGARCH:=all +endef + +define Package/webui-aria2/description + The aim for this project is to create the worlds best and hottest interface to interact with aria2. Very simple to use. +endef + +define Build/Compile +endef + +define Package/webui-aria2/install + $(INSTALL_DIR) $(1)/www/webui-aria2 + + $(CP) $(PKG_BUILD_DIR)/fonts $(1)/www/webui-aria2 + $(CP) $(PKG_BUILD_DIR)/flags $(1)/www/webui-aria2 + $(CP) $(PKG_BUILD_DIR)/js $(1)/www/webui-aria2 + $(CP) $(PKG_BUILD_DIR)/img $(1)/www/webui-aria2 + $(CP) $(PKG_BUILD_DIR)/css $(1)/www/webui-aria2 + $(CP) $(PKG_BUILD_DIR)/index.html $(1)/www/webui-aria2 + $(CP) $(PKG_BUILD_DIR)/favicon.ico $(1)/www/webui-aria2 + $(CP) $(PKG_BUILD_DIR)/configuration.js $(1)/www/webui-aria2 +endef + +$(eval $(call BuildPackage,webui-aria2)) diff --git a/net/wget/Makefile b/net/wget/Makefile new file mode 100644 index 0000000..052f2d8 --- /dev/null +++ b/net/wget/Makefile @@ -0,0 +1,99 @@ +# +# Copyright (C) 2007-2016 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:=wget +PKG_VERSION:=1.18 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@GNU/$(PKG_NAME) +PKG_MD5SUM:=af9ca95a4bb8ac4a9bf10aeae66fa5ec +PKG_MAINTAINER:=Maxim Storchak +PKG_LICENSE:=GPL-3.0+ +PKG_LICENSE_FILES:=COPYING + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/wget/Default + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpcre +zlib + SUBMENU:=File Transfer + TITLE:=Non-interactive network downloader + URL:=http://www.gnu.org/software/wget/index.html +endef + +define Package/wget/Default/description + Wget is a network utility to retrieve files from the Web using http + and ftp, the two most widely used Internet protocols. It works + non-interactively, so it will work in the background, after having + logged off. The program supports recursive retrieval of web-authoring + pages as well as ftp sites -- you can use wget to make mirrors of + archives and home pages or to travel the Web like a WWW robot. +endef + +define Package/wget +$(call Package/wget/Default) + DEPENDS+= +libopenssl +librt + TITLE+= (with SSL support) + VARIANT:=ssl +endef + +define Package/wget/description +$(call Package/wget/Default/description) + This package is built with SSL support. +endef + +define Package/wget-nossl +$(call Package/wget/Default) + TITLE+= (without SSL support) + VARIANT:=nossl +endef + +define Package/wget-nossl/description +$(call Package/wget/Default/description) + This package is built without SSL support. +endef + +CONFIGURE_ARGS+= \ + --disable-rpath \ + --disable-iri \ + --without-libuuid + +CONFIGURE_VARS += \ + ac_cv_header_uuid_uuid_h=no + +ifeq ($(BUILD_VARIANT),ssl) + CONFIGURE_ARGS+= \ + --with-ssl=openssl \ + --with-libssl-prefix="$(STAGING_DIR)/usr" +endif + +ifeq ($(BUILD_VARIANT),nossl) + CONFIGURE_ARGS+= \ + --disable-ntlm \ + --without-ssl +endif + +define Package/wget/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/wget $(1)/usr/bin/wget-ssl + ln -sf wget-ssl $(1)/usr/bin/wget +endef + +define Package/wget-nossl/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/wget $(1)/usr/bin/wget-nossl + ln -sf wget-nossl $(1)/usr/bin/wget +endef + +$(eval $(call BuildPackage,wget)) +$(eval $(call BuildPackage,wget-nossl)) diff --git a/net/wifidog/Makefile b/net/wifidog/Makefile new file mode 100644 index 0000000..591f291 --- /dev/null +++ b/net/wifidog/Makefile @@ -0,0 +1,103 @@ +# +# Copyright (C) 2006,2015 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:=wifidog +PKG_VERSION:=1.3.0 +PKG_RELEASE=1 + + +PKG_LICENSE:=GPL-2.0 +# Note: Packaging is maintained upstream at +# https://github.com/wifidog/packages +PKG_MAINTAINER:=Michael Haas +PKG_LICENSE_FILES:=COPYING + + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://github.com/wifidog/wifidog-gateway.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=1.3.0 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_FIXUP:=autoreconf +# do not run make install +PKG_INSTALL:=0 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/wifidog/Default + SUBMENU:=Captive Portals + SECTION:=net + CATEGORY:=Network + DEPENDS:=+iptables-mod-extra +iptables-mod-ipopt +iptables-mod-nat-extra +libpthread + TITLE:=A wireless captive portal solution + URL:=http://www.wifidog.org +endef + +define Package/wifidog +$(call Package/wifidog/Default) + VARIANT:=normal +endef + +define Package/wifidog-tls +$(call Package/wifidog/Default) + DEPENDS+= +libcyassl + VARIANT:=tls +endef + + +define Package/wifidog/description + The Wifidog project is a complete and embeddable captive + portal solution for wireless community groups or individuals + who wish to open a free Hotspot while still preventing abuse + of their Internet connection. +endef + +define Package/wifidog-tls/description +$(call Package/wifidog/description) + +This variant can talk TLS to the auth server. +endef + +define Package/wifidog/conffiles +/etc/wifidog.conf +endef + +Package/wifidog-tls/conffiles = $(Package/wifidog/conffiles) + + +define Package/wifidog/configure + $(call Build/Configure/Default) +endef + +ifeq ($(BUILD_VARIANT),tls) + +CONFIGURE_ARGS += \ + --enable-cyassl + +endif + +define Package/wifidog/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/wifidog $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/wdctl $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libhttpd.so* $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) $(PKG_BUILD_DIR)/wifidog.conf $(1)/etc/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/wifidog-msg.html $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/wifidog.init $(1)/etc/init.d/wifidog +endef + +Package/wifidog-tls/install = $(Package/wifidog/install) + +$(eval $(call BuildPackage,wifidog)) +$(eval $(call BuildPackage,wifidog-tls)) diff --git a/net/wifidog/files/wifidog.init b/net/wifidog/files/wifidog.init new file mode 100644 index 0000000..6ebf64f --- /dev/null +++ b/net/wifidog/files/wifidog.init @@ -0,0 +1,22 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org +START=65 + +USE_PROCD=1 + +EXTRA_COMMANDS="status" +EXTRA_HELP=" status Print the status of the service" + +start_service() { + procd_open_instance + # -s: log to syslog + # -f: run in foreground + procd_set_param command /usr/bin/wifidog -s -f + procd_set_param respawn # respawn automatically if something died + procd_set_param file /etc/wifidog.conf + procd_close_instance +} + +status() { + /usr/bin/wdctl status +} diff --git a/net/wifischedule/LICENSE b/net/wifischedule/LICENSE new file mode 100644 index 0000000..e313028 --- /dev/null +++ b/net/wifischedule/LICENSE @@ -0,0 +1,11 @@ +Copyright (c) 2016, prpl Foundation + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without +fee is hereby granted, provided that the above copyright notice and this permission notice appear +in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE +FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/net/wifischedule/Makefile b/net/wifischedule/Makefile new file mode 100644 index 0000000..a9dd3f7 --- /dev/null +++ b/net/wifischedule/Makefile @@ -0,0 +1,51 @@ +# Copyright (c) 2016, prpl Foundation +# +# Permission to use, copy, modify, and/or distribute this software for any purpose with or without +# fee is hereby granted, provided that the above copyright notice and this permission notice appear +# in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE +# FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +# Author: Nils Koenig + +include $(TOPDIR)/rules.mk + +PKG_NAME:=wifischedule +PKG_VERSION:=1 +PKG_RELEASE:=1 +PKG_LICENSE:=PRPL + +PKG_MAINTAINER:=Nils Koenig + +include $(INCLUDE_DIR)/package.mk + +define Package/wifischedule + SUBMENU:=wireless + TITLE:=Turns WiFi on and off according to a schedule + SECTION:=net + CATEGORY:=Network +endef + +define Package/wifischedule/description +Turns WiFi on and off according to a schedule defined in UCI. +endef + +define Package/wifischedule/conffiles +/etc/config/wifi_schedule +endef + +define Build/Compile +endef + +define Package/wifischedule/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) ./net/usr/bin/wifi_schedule.sh $(1)/usr/bin/wifi_schedule.sh + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./net/etc/config/wifi_schedule $(1)/etc/config/wifi_schedule +endef + +$(eval $(call BuildPackage,wifischedule)) diff --git a/net/wifischedule/README.md b/net/wifischedule/README.md new file mode 100644 index 0000000..591abb1 --- /dev/null +++ b/net/wifischedule/README.md @@ -0,0 +1,86 @@ +# wifischedule +Turns WiFi on and off according to a schedule on an openwrt router + +## Components +* wifischedule: Shell script that creates cron jobs based on configuration provided in UCI and does all the other logic of enabling and disabling wifi with the use of `/sbin/wifi` and `/usr/bin/iwinfo`. Can be used standalone. +* luci-app-wifischedule: LUCI frontend for creating the UCI configuration and triggering the actions. Depends on wifischedule. + + +## Use cases +You can create user-defined events when to enable or disable WiFi. +There are various use cases why you would like to do so: + +1. Reduce power consumption and therefore reduce CO2 emissions. +2. Reduce emitted electromagnatic radiation. +3. Force busincess hours when WiFi is available. + +Regarding 1: Please note, that you need to unload the wireless driver modules in order to get the most effect of saving power. +In my test scenario only disabling WiFi saves about ~0.4 Watt, unloading the modules removes another ~0.4 Watt. + +Regarding 2: Think of a wireless accesspoint e.g. in your bedrom, kids room where you want to remove the ammount of radiation emitted. + +Regarding 3: E.g. in a company, why would wireless need to be enabled weekends if no one is there working? +Or think of an accesspoint in your kids room when you want the youngsters to sleep after 10 pm instead of facebooking... + +## Configuration +You can create an arbitrary number of schedule events. Please note that there is on sanity check done wheather the start / stop times overlap or make sense. +If start and stop time are equal, this leads to disabling the WiFi at the given time. + +Logging if enabled is done to the file `/var/log/wifi_schedule.log` and can be reviewed through the "View Logfile" tab. +The cron jobs created can be reviewed through the "View Cron Jobs" tab. + +Please note that the "Unload Modules" function is currently considered as experimental. You can manually add / remove modules in the text field. +The button "Determine Modules Automatically" tries to make a best guess determining regarding the driver module and its dependencies. +When un-/loading the modules, there is a certain number of retries (`module_load`) performed. + +The option "Force disabling wifi even if stations associated" does what it says - when activated it simply shuts down WiFi. +When unchecked, its checked every `recheck_interval` minutes if there are still stations associated. Once the stations disconnect, WiFi is disabled. + +Please note, that the parameters `module_load` and `recheck_interval` are only accessible through uci. + +## UCI Configuration `wifi_schedule` +UCI configuration file: `/etc/config/wifi_schedule`: + +``` +config global + option logging '0' + option enabled '0' + option recheck_interval '10' + option modules_retries '10' + +config entry 'Businesshours' + option enabled '0' + option daysofweek 'Monday Tuesday Wednesday Thursday Friday' + option starttime '06:00' + option stoptime '22:00' + option forcewifidown '0' + +config entry 'Weekend' + option enabled '0' + option daysofweek 'Saturday Sunday' + option starttime '00:00' + option stoptime '00:00' + option forcewifidown '1' +``` + +## Script: `wifi_schedule.sh` +This is the script that does the work. Make your changes to the UCI config file: `/etc/config/wifi_schedule` + +Then call the script as follows in order to get the necessary cron jobs created: + +`wifi_schedule.sh cron` + +All commands: + +``` +wifi_schedule.sh cron|start|stop|forcestop|recheck|getmodules|savemodules|help + + cron: Create cronjob entries. + start: Start wifi. + stop: Stop wifi gracefully, i.e. check if there are stations associated and if so keep retrying. + forcestop: Stop wifi immediately. + recheck: Recheck if wifi can be disabled now. + getmodules: Returns a list of modules used by the wireless driver(s) + savemodules: Saves a list of automatic determined modules to UCI + help: This description. +``` diff --git a/net/wifischedule/net/etc/config/wifi_schedule b/net/wifischedule/net/etc/config/wifi_schedule new file mode 100644 index 0000000..946a1ff --- /dev/null +++ b/net/wifischedule/net/etc/config/wifi_schedule @@ -0,0 +1,19 @@ +config global + option logging '0' + option enabled '0' + option recheck_interval '10' + option modules_retries '10' + +config entry 'Businesshours' + option enabled '0' + option daysofweek 'Monday Tuesday Wednesday Thursday Friday' + option starttime '06:00' + option stoptime '22:00' + option forcewifidown '0' + +config entry 'Weekend' + option enabled '0' + option daysofweek 'Saturday Sunday' + option starttime '00:00' + option stoptime '00:00' + option forcewifidown '1' diff --git a/net/wifischedule/net/usr/bin/wifi_schedule.sh b/net/wifischedule/net/usr/bin/wifi_schedule.sh new file mode 100755 index 0000000..363f95d --- /dev/null +++ b/net/wifischedule/net/usr/bin/wifi_schedule.sh @@ -0,0 +1,321 @@ +#!/bin/sh + +# Copyright (c) 2016, prpl Foundation +# +# Permission to use, copy, modify, and/or distribute this software for any purpose with or without +# fee is hereby granted, provided that the above copyright notice and this permission notice appear +# in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE +# FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +# Author: Nils Koenig + +SCRIPT=$0 +LOCKFILE=/tmp/wifi_schedule.lock +LOGFILE=/tmp/log/wifi_schedule.log +LOGGING=0 #default is off +PACKAGE=wifi_schedule +GLOBAL=${PACKAGE}.@global[0] + +_log() +{ + if [ ${LOGGING} -eq 1 ]; then + local ts=$(date) + echo "$ts $@" >> ${LOGFILE} + fi +} + +_exit() +{ + local rc=$1 + lock -u ${LOCKFILE} + exit ${rc} +} + +_cron_restart() +{ + /etc/init.d/cron restart > /dev/null +} + +_add_cron_script() +{ + (crontab -l ; echo "$1") | sort | uniq | crontab - + _cron_restart +} + +_rm_cron_script() +{ + crontab -l | grep -v "$1" | sort | uniq | crontab - + _cron_restart +} + +_get_uci_value_raw() +{ + local value + value=$(uci get $1 2> /dev/null) + local rc=$? + echo ${value} + return ${rc} +} + +_get_uci_value() +{ + local value + value=$(_get_uci_value_raw $1) + local rc=$? + if [ ${rc} -ne 0 ]; then + _log "Could not determine UCI value $1" + return 1 + fi + echo ${value} +} + +_format_dow_list() +{ + local dow=$1 + local flist="" + local day + for day in ${dow} + do + if [ ! -z ${flist} ]; then + flist="${flist}," + fi + flist="${flist}${day:0:3}" + done + echo ${flist} +} + + +_enable_wifi_schedule() +{ + local entry=$1 + local starttime + local stoptime + starttime=$(_get_uci_value ${PACKAGE}.${entry}.starttime) || _exit 1 + stoptime=$(_get_uci_value ${PACKAGE}.${entry}.stoptime) || _exit 1 + + local dow + dow=$(_get_uci_value_raw ${PACKAGE}.${entry}.daysofweek) || _exit 1 + + local fdow=$(_format_dow_list "$dow") + local forcewifidown + forcewifidown=$(_get_uci_value ${PACKAGE}.${entry}.forcewifidown) + local stopmode="stop" + if [ $forcewifidown -eq 1 ]; then + stopmode="forcestop" + fi + + + local stop_cron_entry="$(echo ${stoptime} | awk -F':' '{print $2, $1}') * * ${fdow} ${SCRIPT} ${stopmode}" # ${entry}" + _add_cron_script "${stop_cron_entry}" + + if [[ $starttime != $stoptime ]] + then + local start_cron_entry="$(echo ${starttime} | awk -F':' '{print $2, $1}') * * ${fdow} ${SCRIPT} start" # ${entry}" + _add_cron_script "${start_cron_entry}" + fi + + return 0 +} + +_get_wireless_interfaces() +{ + local n=$(cat /proc/net/wireless | wc -l) + cat /proc/net/wireless | tail -n $(($n - 2))|awk -F':' '{print $1}'| sed 's/ //' +} + + +get_module_list() +{ + local mod_list + local _if + for _if in $(_get_wireless_interfaces) + do + local mod=$(basename $(readlink -f /sys/class/net/${_if}/device/driver)) + local mod_dep=$(modinfo ${mod} | awk '{if ($1 ~ /depends/) print $2}') + mod_list=$(echo -e "${mod_list}\n${mod},${mod_dep}" | sort | uniq) + done + echo $mod_list | tr ',' ' ' +} + +save_module_list_uci() +{ + local list=$(get_module_list) + uci set ${GLOBAL}.modules="${list}" + uci commit ${PACKAGE} +} + +_unload_modules() +{ + local list=$(_get_uci_value ${GLOBAL}.modules) + local retries + retries=$(_get_uci_value ${GLOBAL}.modules_retries) || _exit 1 + _log "unload_modules ${list} (retries: ${retries})" + local i=0 + while [[ ${i} -lt ${retries} && "${list}" != "" ]] + do + i=$(($i+1)) + local mod + local first=0 + for mod in ${list} + do + if [ $first -eq 0 ]; then + list="" + first=1 + fi + rmmod ${mod} > /dev/null 2>&1 + if [ $? -ne 0 ]; then + list="$list $mod" + fi + done + done +} + + +_load_modules() +{ + local list=$(_get_uci_value ${GLOBAL}.modules) + local retries + retries=$(_get_uci_value ${GLOBAL}.modules_retries) || _exit 1 + _log "load_modules ${list} (retries: ${retries})" + local i=0 + while [[ ${i} -lt ${retries} && "${list}" != "" ]] + do + i=$(($i+1)) + local mod + local first=0 + for mod in ${list} + do + if [ $first -eq 0 ]; then + list="" + first=1 + fi + modprobe ${mod} > /dev/null 2>&1 + rc=$? + if [ $rc -ne 255 ]; then + list="$list $mod" + fi + done + done +} + +_create_cron_entries() +{ + local entries=$(uci show ${PACKAGE} 2> /dev/null | awk -F'.' '{print $2}' | grep -v '=' | grep -v '@global\[0\]' | uniq | sort) + local _entry + for entry in ${entries} + do + local status + status=$(_get_uci_value ${PACKAGE}.${entry}.enabled) || _exit 1 + if [ ${status} -eq 1 ] + then + _enable_wifi_schedule ${entry} + fi + done +} + +check_cron_status() +{ + local global_enabled + global_enabled=$(_get_uci_value ${GLOBAL}.enabled) || _exit 1 + _rm_cron_script "${SCRIPT}" + if [ ${global_enabled} -eq 1 ]; then + _create_cron_entries + fi +} + +disable_wifi() +{ + _rm_cron_script "${SCRIPT} recheck" + /sbin/wifi down + local unload_modules + unload_modules=$(_get_uci_value_raw ${GLOBAL}.unload_modules) || _exit 1 + if [[ "${unload_modules}" == "1" ]]; then + _unload_modules + fi +} + +soft_disable_wifi() +{ + local _disable_wifi=1 + local iwinfo=/usr/bin/iwinfo + if [ ! -e ${iwinfo} ]; then + _log "${iwinfo} not available, skipping" + return 1 + fi + + # check if no stations are associated + local _if + for _if in $(_get_wireless_interfaces) + do + output=$(${iwinfo} ${_if} assoclist) + if [[ "$output" != "No station connected" ]] + then + _disable_wifi=0 + local stations=$(echo ${output}| grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' | tr '\n' ' ') + _log "Station(s) ${stations}associated on ${_if}" + fi + done + + if [ ${_disable_wifi} -eq 1 ]; then + _log "No stations associated, disable wifi." + disable_wifi + else + _log "Could not disable wifi due to associated stations, retrying..." + local recheck_interval=$(_get_uci_value ${GLOBAL}.recheck_interval) + _add_cron_script "*/${recheck_interval} * * * * ${SCRIPT} recheck" + fi +} + +enable_wifi() +{ + _rm_cron_script "${SCRIPT} recheck" + local unload_modules + unload_modules=$(_get_uci_value_raw ${GLOBAL}.unload_modules) || _exit 1 + if [[ "${unload_modules}" == "1" ]]; then + _load_modules + fi + /sbin/wifi +} + +usage() +{ + echo "" + echo "$0 cron|start|stop|forcestop|recheck|getmodules|savemodules|help" + echo "" + echo " UCI Config File: /etc/config/${PACKAGE}" + echo "" + echo " cron: Create cronjob entries." + echo " start: Start wifi." + echo " stop: Stop wifi gracefully, i.e. check if there are stations associated and if so keep retrying." + echo " forcestop: Stop wifi immediately." + echo " recheck: Recheck if wifi can be disabled now." + echo " getmodules: Returns a list of modules used by the wireless driver(s)" + echo " savemodules: Saves a list of automatic determined modules to UCI" + echo " help: This description." + echo "" +} + +############################################################################### +# MAIN +############################################################################### +LOGGING=$(_get_uci_value ${GLOBAL}.logging) || _exit 1 +_log ${SCRIPT} $1 $2 +lock ${LOCKFILE} + +case "$1" in + cron) check_cron_status ;; + start) enable_wifi ;; + forcestop) disable_wifi ;; + stop) soft_disable_wifi ;; + recheck) soft_disable_wifi ;; + getmodules) get_module_list ;; + savemodules) save_module_list_uci ;; + help|--help|-h|*) usage ;; +esac + +_exit 0 diff --git a/net/wireguard/Makefile b/net/wireguard/Makefile new file mode 100644 index 0000000..fa3acc7 --- /dev/null +++ b/net/wireguard/Makefile @@ -0,0 +1,108 @@ +# +# Copyright (C) 2016 Baptiste Jonglez +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=wireguard + +PKG_VERSION:=0.0.20161129 +PKG_RELEASE:=1 + +PKG_SOURCE:=WireGuard-experimental-$(PKG_VERSION).tar.xz +# This is actually SHA256, but OpenWRT/LEDE will figure it out based on the length +PKG_MD5SUM:=7bdce3e56aaae91b195b8bbf7afc8d07f68632c997aa702c1ab84745c099d1b7 +PKG_SOURCE_URL:=https://git.zx2c4.com/WireGuard/snapshot/ +PKG_BUILD_DIR:=$(BUILD_DIR)/WireGuard-experimental-$(PKG_VERSION) + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_USE_MIPS16:=0 +PKG_BUILD_PARALLEL:=1 + +# Wireguard's makefile needs this to know where to build the kernel module +export KERNELDIR:=$(LINUX_DIR) + +include $(INCLUDE_DIR)/package.mk + +define Package/wireguard/Default + SECTION:=net + CATEGORY:=Network + URL:=https://www.wireguard.io + MAINTAINER:=Baptiste Jonglez +endef + +define Package/wireguard/Default/description + WireGuard is a novel VPN that runs inside the Linux Kernel and utilizes + state-of-the-art cryptography. It aims to be faster, simpler, leaner, and + more useful than IPSec, while avoiding the massive headache. It intends to + be considerably more performant than OpenVPN. WireGuard is designed as a + general purpose VPN for running on embedded interfaces and super computers + alike, fit for many different circumstances. + It runs over UDP. +endef + +define Package/wireguard + $(call Package/wireguard/Default) + TITLE:=Wireguard meta-package + DEPENDS:=+wireguard-tools +kmod-wireguard +endef + +include $(INCLUDE_DIR)/kernel-defaults.mk +include $(INCLUDE_DIR)/package-defaults.mk + +# Used by Build/Compile/Default +MAKE_PATH:=src/tools + +define Build/Compile + $(MAKE) $(KERNEL_MAKEOPTS) M="$(PKG_BUILD_DIR)/src" modules + $(call Build/Compile/Default) +endef + +define Package/wireguard/description + $(call Package/wireguard/Default/description) +endef + +define Package/wireguard-tools + $(call Package/wireguard/Default) + TITLE:=Wireguard userspace control program (wg) + DEPENDS:=+libmnl +resolveip +endef + +define Package/wireguard-tools/description + $(call Package/wireguard/Default/description) + + This package provides the userspace control program for wireguard, `wg`, + and a netifd protocol helper. +endef + +define Package/wireguard-tools/install + $(INSTALL_DIR) $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/tools/wg $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/lib/netifd/proto/ + $(INSTALL_BIN) ./files/wireguard.sh $(1)/lib/netifd/proto/ +endef + +define KernelPackage/wireguard + SECTION:=kernel + CATEGORY:=Kernel modules + SUBMENU:=Network Support + TITLE:=Wireguard kernel module + DEPENDS:=@IPV6 +kmod-udptunnel4 +kmod-udptunnel6 +kmod-ipt-hashlimit + FILES:= $(PKG_BUILD_DIR)/src/wireguard.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,33,wireguard) +endef + +define KernelPackage/wireguard/description + $(call Package/wireguard/Default/description) + + This package provides the kernel module for wireguard. +endef + +$(eval $(call BuildPackage,wireguard)) +$(eval $(call BuildPackage,wireguard-tools)) +$(eval $(call KernelPackage,wireguard)) diff --git a/net/wireguard/files/wireguard.sh b/net/wireguard/files/wireguard.sh new file mode 100644 index 0000000..67fd1d1 --- /dev/null +++ b/net/wireguard/files/wireguard.sh @@ -0,0 +1,176 @@ +#!/bin/sh +# Copyright 2016 Dan Luedtke +# Licensed to the public under the Apache License 2.0. + + +WG=/usr/bin/wg +if [ ! -x $WG ]; then + logger -t "wireguard" "error: missing wireguard-tools (${WG})" + exit 0 +fi + + +[ -n "$INCLUDE_ONLY" ] || { + . /lib/functions.sh + . ../netifd-proto.sh + init_proto "$@" +} + + +proto_wireguard_init_config() { + proto_config_add_string "private_key" + proto_config_add_int "listen_port" + proto_config_add_int "mtu" + proto_config_add_string "preshared_key" + available=1 + no_proto_task=1 +} + + +proto_wireguard_setup_peer() { + local peer_config="$1" + + local public_key + local allowed_ips + local route_allowed_ips + local endpoint_host + local endpoint_port + local persistent_keepalive + + config_get public_key "${peer_config}" "public_key" + config_get allowed_ips "${peer_config}" "allowed_ips" + config_get_bool route_allowed_ips "${peer_config}" "route_allowed_ips" 0 + config_get endpoint_host "${peer_config}" "endpoint_host" + config_get endpoint_port "${peer_config}" "endpoint_port" + config_get persistent_keepalive "${peer_config}" "persistent_keepalive" + + # peer configuration + echo "[Peer]" >> "${wg_cfg}" + echo "PublicKey=${public_key}" >> "${wg_cfg}" + for allowed_ip in $allowed_ips; do + echo "AllowedIPs=${allowed_ip}" >> "${wg_cfg}" + done + if [ "${endpoint_host}" ]; then + case "${endpoint_host}" in + *:*) + endpoint="[${endpoint_host}]" + ;; + *) + endpoint="${endpoint_host}" + ;; + esac + if [ "${endpoint_port}" ]; then + endpoint="${endpoint}:${endpoint_port}" + else + endpoint="${endpoint}:51820" + fi + echo "Endpoint=${endpoint}" >> "${wg_cfg}" + fi + if [ "${persistent_keepalive}" ]; then + echo "PersistentKeepalive=${persistent_keepalive}" >> "${wg_cfg}" + fi + + # add routes for allowed ips + if [ ${route_allowed_ips} -ne 0 ]; then + for allowed_ip in ${allowed_ips}; do + case "${allowed_ip}" in + *:*/*) + proto_add_ipv6_route "${allowed_ip%%/*}" "${allowed_ip##*/}" + ;; + */*) + proto_add_ipv4_route "${allowed_ip%%/*}" "${allowed_ip##*/}" + ;; + esac + done + fi + + #### FEATURE DISABLED + # proto_add_host_dependency() has failed with IPv6 addresses during tests. + # Endpoint dependency feature is disabled until the issue is fixed. + #### + # # endpoint dependency + # if [ "${endpoint_host}" ]; then + # endpoint_dependency=0 + # for ip in $(resolveip -t 10 "${endpoint_host}"); do + # echo "adding host depedency for ${ip} at ${config}" + # proto_add_host_dependency "${config}" "${ip}" + # endpoint_dependency=1 + # done + # if [ ${endpoint_dependency} -eq 0 ]; then + # echo "error resolving ${endpoint_host}!" + # sleep 5 + # proto_setup_failed "${config}" + # exit 1 + # fi + # fi + #### +} + + +proto_wireguard_setup() { + local config="$1" + local wg_dir="/tmp/wireguard" + local wg_cfg="${wg_dir}/${config}" + + local private_key + local listen_port + local mtu + local preshared_key + + # load configuration + config_load network + config_get private_key "${config}" "private_key" + config_get listen_port "${config}" "listen_port" + config_get mtu "${config}" "mtu" + config_get preshared_key "${config}" "preshared_key" + + # create interface + ip link del dev "${config}" 2>/dev/null + ip link add dev "${config}" type wireguard + + if [ "${mtu}" ]; then + ip link set mtu "${mtu}" dev "${config}" + fi + + proto_init_update "${config}" 1 + + # generate configuration file + umask 077 + mkdir -p "${wg_dir}" + echo "[Interface]" > "${wg_cfg}" + echo "PrivateKey=${private_key}" >> "${wg_cfg}" + if [ "${listen_port}" ]; then + echo "ListenPort=${listen_port}" >> "${wg_cfg}" + fi + if [ "${preshared_key}" ]; then + echo "PresharedKey=${preshared_key}" >> "${wg_cfg}" + fi + config_foreach proto_wireguard_setup_peer "wireguard_${config}" + + # apply configuration file + ${WG} setconf ${config} "${wg_cfg}" + WG_RETURN=$? + + # delete configuration file + rm -f "${wg_cfg}" + + # check status + if [ ${WG_RETURN} -ne 0 ]; then + sleep 5 + proto_setup_failed "${config}" + exit 1 + fi + + proto_send_update "${config}" +} + + +proto_wireguard_teardown() { + local config="$1" + ip link del dev "${config}" >/dev/null 2>&1 +} + + +[ -n "$INCLUDE_ONLY" ] || { + add_protocol wireguard +} diff --git a/net/wshaper/Makefile b/net/wshaper/Makefile new file mode 100644 index 0000000..d897464 --- /dev/null +++ b/net/wshaper/Makefile @@ -0,0 +1,58 @@ +# +# Copyright (C) 2007-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:=wshaper +PKG_VERSION:=1.1a +PKG_RELEASE:=1 + +PKG_MAINTAINER:=Jo-Philipp Wich + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/wshaper + SECTION:=net + CATEGORY:=Network + DEPENDS:=+kmod-sched +tc + TITLE:=wshaper + URL:=http://lartc.org/wondershaper/ + PKGARCH:=all +endef + +define Package/wshaper/description + A script to do traffing shaping with the HTB algorithm. + Wshaper attempts to: + * Maintain low latency for interfactive traffic at all times + * Allow 'surfing' at reasonable speeds while up or downloading + * Make sure uploads don't harm downloads, and the other way around +endef + +define Build/Prepare +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/wshaper/install + $(INSTALL_DIR) $(1)/usr/sbin/ $(1)/etc/init.d $(1)/etc/config $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) ./files/wshaper.htb $(1)/usr/sbin/ + $(INSTALL_BIN) ./files/wshaper.init $(1)/etc/init.d/wshaper + $(INSTALL_BIN) ./files/wshaper.iface $(1)/etc/hotplug.d/iface/10-wshaper + $(INSTALL_DATA) ./files/wshaper.config $(1)/etc/config/wshaper +endef + +define Package/wshaper/conffiles +/etc/config/wshaper +endef + +$(eval $(call BuildPackage,wshaper)) diff --git a/net/wshaper/files/wshaper.config b/net/wshaper/files/wshaper.config new file mode 100644 index 0000000..ed857c5 --- /dev/null +++ b/net/wshaper/files/wshaper.config @@ -0,0 +1,4 @@ +config 'wshaper' 'settings' + option 'network' 'wan' + option 'downlink' '2000' + option 'uplink' '240' diff --git a/net/wshaper/files/wshaper.htb b/net/wshaper/files/wshaper.htb new file mode 100755 index 0000000..4b63eee --- /dev/null +++ b/net/wshaper/files/wshaper.htb @@ -0,0 +1,166 @@ +#!/bin/sh +# Wonder Shaper +# please read the README before filling out these values +# +# Set the following values to somewhat less than your actual download +# and uplink speed. In kilobits. Also set the device that is to be shaped. + +# All config needs to be done in /etc/config/wshaper + +. /lib/functions.sh +. /lib/functions/network.sh + +config_load wshaper +for s in downlink uplink network nopriohostdst nopriohostsrc noprioportdst noprioportsrc; do + config_get $s settings $s +done + +if ! network_get_device device "$network"; then + logger -t wondershaper "Error: Could not find the device for network $network, aborting." + exit 1 +fi + +[ -z "$downlink" ] && logger -t wondershaper "Error: Downlink speed not set, aborting." && exit 1 +[ -z "$uplink" ] && logger -t wondershaper "Error: Uplink speed not set, aborting." && exit 1 + +MODULES='sch_ingress sch_sfq sch_htb cls_u32 act_police' +DOWNLINK="$downlink" +UPLINK="$uplink" +DEV="$device" + +# low priority OUTGOING traffic - you can leave this blank if you want +# low priority source netmasks +NOPRIOHOSTSRC="$nopriohostsrc" + +# low priority destination netmasks +NOPRIOHOSTDST="$nopriohostdst" + +# low priority source ports +NOPRIOPORTSRC="$noprioportsrc" + +# low priority destination ports +NOPRIOPORTDST="$noprioportdst" + +if [ "$1" = "status" ] +then + tc -s qdisc ls dev $DEV + tc -s class ls dev $DEV + exit +fi + + +# clean existing down- and uplink qdiscs, hide errors +tc qdisc del dev $DEV root 2> /dev/null > /dev/null +tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null + +if [ "$1" = "stop" ] +then + for i in $MODULES ; do + rmmod $i + done + exit +fi + +for i in $MODULES ; do + insmod $i +done + +###### uplink + +# install root HTB, point default traffic to 1:20: + +tc qdisc add dev $DEV root handle 1: htb default 20 + +# shape everything at $UPLINK speed - this prevents huge queues in your +# DSL modem which destroy latency: + +tc class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6k + +# high prio class 1:10: + +tc class add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK}kbit \ + burst 6k prio 1 + +# bulk & default class 1:20 - gets slightly less traffic, +# and a lower priority: + +tc class add dev $DEV parent 1:1 classid 1:20 htb rate $((9*$UPLINK/10))kbit \ + burst 6k prio 2 + +tc class add dev $DEV parent 1:1 classid 1:30 htb rate $((8*$UPLINK/10))kbit \ + burst 6k prio 2 + +# all get Stochastic Fairness: +tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10 +tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10 +tc qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10 + +# TOS Minimum Delay (ssh, NOT scp) in 1:10: + +tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \ + match ip tos 0x10 0xff flowid 1:10 + +# ICMP (ip protocol 1) in the interactive class 1:10 so we +# can do measurements & impress our friends: +tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \ + match ip protocol 1 0xff flowid 1:10 + +# To speed up downloads while an upload is going on, put ACK packets in +# the interactive class: + +tc filter add dev $DEV parent 1: protocol ip prio 10 u32 \ + match ip protocol 6 0xff \ + match u8 0x05 0x0f at 0 \ + match u16 0x0000 0xffc0 at 2 \ + match u8 0x10 0xff at 33 \ + flowid 1:10 + +# rest is 'non-interactive' ie 'bulk' and ends up in 1:20 + +# some traffic however suffers a worse fate +for a in $NOPRIOPORTDST +do + tc filter add dev $DEV parent 1: protocol ip prio 14 u32 \ + match ip dport $a 0xffff flowid 1:30 +done + +for a in $NOPRIOPORTSRC +do + tc filter add dev $DEV parent 1: protocol ip prio 15 u32 \ + match ip sport $a 0xffff flowid 1:30 +done + +for a in $NOPRIOHOSTSRC +do + tc filter add dev $DEV parent 1: protocol ip prio 16 u32 \ + match ip src $a flowid 1:30 +done + +for a in $NOPRIOHOSTDST +do + tc filter add dev $DEV parent 1: protocol ip prio 17 u32 \ + match ip dst $a flowid 1:30 +done + +# rest is 'non-interactive' ie 'bulk' and ends up in 1:20 + +tc filter add dev $DEV parent 1: protocol ip prio 18 u32 \ + match ip dst 0.0.0.0/0 flowid 1:20 + + +########## downlink ############# +# slow downloads down to somewhat less than the real speed to prevent +# queuing at our ISP. Tune to see how high you can set it. +# ISPs tend to have *huge* queues to make sure big downloads are fast +# +# attach ingress policer: + +tc qdisc add dev $DEV handle ffff: ingress + +# filter *everything* to it (0.0.0.0/0), drop everything that's +# coming in too fast: + +tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \ + 0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1 + +logger -t wondershaper "Wondershaper was started on device $device." diff --git a/net/wshaper/files/wshaper.iface b/net/wshaper/files/wshaper.iface new file mode 100644 index 0000000..2964005 --- /dev/null +++ b/net/wshaper/files/wshaper.iface @@ -0,0 +1,3 @@ +#!/bin/sh + +[ "$ACTION" = ifup ] && /etc/init.d/wshaper enabled && /etc/init.d/wshaper start || exit 0 diff --git a/net/wshaper/files/wshaper.init b/net/wshaper/files/wshaper.init new file mode 100644 index 0000000..638cef2 --- /dev/null +++ b/net/wshaper/files/wshaper.init @@ -0,0 +1,10 @@ +#!/bin/sh /etc/rc.common + +START=45 +start() { + wshaper.htb +} + +stop() { + wshaper.htb stop +} diff --git a/net/xinetd/Makefile b/net/xinetd/Makefile new file mode 100644 index 0000000..c1586b7 --- /dev/null +++ b/net/xinetd/Makefile @@ -0,0 +1,66 @@ +# +# Copyright (C) 2006-2015 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:=xinetd +PKG_VERSION:=2.3.15 +PKG_RELEASE:=4 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.xinetd.org +PKG_MD5SUM:=77358478fd58efa6366accae99b8b04c +PKG_LICENSE:=xinetd +PKG_LICENSE_FILES:=COPYRIGHT + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/xinetd + SECTION:=net + CATEGORY:=Network + TITLE:=A powerful and secure super-server + URL:=http://www.xinetd.org/ + PKG_MAINTAINER:=Jonathan McCrohan +endef + +define Package/xinetd/description + xinetd has access control mechanisms, extensive logging capabilities, + the ability to make services available based on time, can place limits + on the number of servers that can be started, and has deployable + defence mechanisms to protect against port scanners, among other + things. +endef + +define Package/xinetd/conffiles +/etc/xinetd.conf +endef + +TARGET_CFLAGS += -DNO_RPC +TARGET_CPPFLAGS += -DHAVE_RLIM_T + +CONFIGURE_ARGS += \ + --without-libwrap \ + --with-loadavg + +CONFIGURE_VARS += \ + ac_cv_header_rpc_pmap_clnt_h=no \ + ac_cv_header_rpc_rpc_h=no \ + ac_cv_header_rpc_rpcent_h=no + +define Package/xinetd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xinetd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) ./files/xinetd.conf $(1)/etc/xinetd.conf + $(INSTALL_DIR) $(1)/etc/xinetd.d + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/xinetd.init $(1)/etc/init.d/xinetd +endef + +$(eval $(call BuildPackage,xinetd)) diff --git a/net/xinetd/files/xinetd.conf b/net/xinetd/files/xinetd.conf new file mode 100644 index 0000000..bd473ed --- /dev/null +++ b/net/xinetd/files/xinetd.conf @@ -0,0 +1,6 @@ +defaults +{ + +} + +includedir /etc/xinetd.d diff --git a/net/xinetd/files/xinetd.init b/net/xinetd/files/xinetd.init new file mode 100644 index 0000000..1437f58 --- /dev/null +++ b/net/xinetd/files/xinetd.init @@ -0,0 +1,15 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=50 + +SERVICE_USE_PID=1 + +start() { + service_start /usr/sbin/xinetd -pidfile /var/run/xinetd.pid +} + +stop() { + service_stop /usr/sbin/xinetd +} + diff --git a/net/xinetd/patches/001-ar.patch b/net/xinetd/patches/001-ar.patch new file mode 100644 index 0000000..4d961ba --- /dev/null +++ b/net/xinetd/patches/001-ar.patch @@ -0,0 +1,66 @@ +--- a/libs/src/misc/Makefile.in ++++ b/libs/src/misc/Makefile.in +@@ -62,7 +62,7 @@ libopt: clean + + + $(LIBNAME): $(OBJECTS) +- ar r $@ $? ++ $(AR) r $@ $? + $(RANLIB) $@ + + install: $(LIBNAME) +--- a/libs/src/portable/Makefile.in ++++ b/libs/src/portable/Makefile.in +@@ -57,7 +57,7 @@ libopt: clean + + + $(LIBNAME): $(OBJECTS) +- ar r $@ $? ++ $(AR) r $@ $? + $(RANLIB) $@ + + install: $(LIBNAME) +--- a/libs/src/pset/Makefile.in ++++ b/libs/src/pset/Makefile.in +@@ -53,7 +53,7 @@ libopt: clean + mv $(LIBNAME) $(LIBDIR)/optimized + + $(LIBNAME): $(OBJECTS) +- ar r $@ $? ++ $(AR) r $@ $? + $(RANLIB) $@ + + install: $(LIBNAME) +--- a/libs/src/sio/Makefile.in ++++ b/libs/src/sio/Makefile.in +@@ -52,7 +52,7 @@ libopt: clean + $(INSTALL) $(FMODE) $(LIBNAME) $(LIBDIR)/optimized + + $(LIBNAME): $(OBJECTS) +- ar r $@ $? ++ $(AR) r $@ $? + $(RANLIB) $@ + + install: $(LIBNAME) +--- a/libs/src/str/Makefile.in ++++ b/libs/src/str/Makefile.in +@@ -63,7 +63,7 @@ libopt: clean + $(INSTALL) $(FMODE) $(LIBNAME) $(LIBDIR)-O + + $(LIBNAME): $(OBJECTS) +- ar r $@ $? ++ $(AR) r $@ $? + $(RANLIB) $@ + + LINT_IGNORE=possible pointer alignment|RCSid unused +--- a/libs/src/xlog/Makefile.in ++++ b/libs/src/xlog/Makefile.in +@@ -58,7 +58,7 @@ libopt: clean + $(INSTALL) $(FMODE) $(LIBNAME) $(LIBDIR)/optimized + + $(LIBNAME): $(OBJECTS) +- ar r $@ $? ++ $(AR) r $@ $? + $(RANLIB) $@ + + install: $(LIBNAME) diff --git a/net/xinetd/patches/002-destdir.patch b/net/xinetd/patches/002-destdir.patch new file mode 100644 index 0000000..89075c8 --- /dev/null +++ b/net/xinetd/patches/002-destdir.patch @@ -0,0 +1,27 @@ +--- a/Makefile.in ++++ b/Makefile.in +@@ -75,15 +75,15 @@ dlibxlog: dlibsio dlibstr + + install: build + for i in $(DAEMONDIR) $(BINDIR) $(MANDIR)/man5 $(MANDIR)/man8 ; do \ +- test -d $$i || mkdir -p $$i ; done +- $(INSTALL_CMD) -m 755 xinetd/xinetd $(DAEMONDIR) +- $(INSTALL_CMD) -m 755 xinetd/itox $(DAEMONDIR) +- $(INSTALL_CMD) -m 755 $(SRCDIR)/xinetd/xconv.pl $(DAEMONDIR) +- $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.conf.man $(MANDIR)/man5/xinetd.conf.5 +- $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.log.man $(MANDIR)/man8/xinetd.log.8 +- $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.man $(MANDIR)/man8/xinetd.8 +- $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/itox.8 $(MANDIR)/man8/itox.8 +- $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xconv.pl.8 $(MANDIR)/man8/xconv.pl.8 ++ test -d $(DESTDIR)$$i || mkdir -p $(DESTDIR)$$i ; done ++ $(INSTALL_CMD) -m 755 xinetd/xinetd $(DESTDIR)$(DAEMONDIR) ++ $(INSTALL_CMD) -m 755 xinetd/itox $(DESTDIR)$(DAEMONDIR) ++ $(INSTALL_CMD) -m 755 $(SRCDIR)/xinetd/xconv.pl $(DESTDIR)$(DAEMONDIR) ++ $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.conf.man $(DESTDIR)$(MANDIR)/man5/xinetd.conf.5 ++ $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.log.man $(DESTDIR)$(MANDIR)/man8/xinetd.log.8 ++ $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.man $(DESTDIR)$(MANDIR)/man8/xinetd.8 ++ $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/itox.8 $(DESTDIR)$(MANDIR)/man8/itox.8 ++ $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xconv.pl.8 $(DESTDIR)$(MANDIR)/man8/xconv.pl.8 + @echo "You must put your xinetd.conf in /etc/xinetd.conf" + @echo "There is a sample config file in xinetd/sample.conf and you can" + @echo "use xconv.pl to convert your old inetd.conf file to an xinetd format" diff --git a/net/xinetd/patches/003-rpc_fix.patch b/net/xinetd/patches/003-rpc_fix.patch new file mode 100644 index 0000000..11f47e7 --- /dev/null +++ b/net/xinetd/patches/003-rpc_fix.patch @@ -0,0 +1,19 @@ +--- a/xinetd/confparse.c ++++ b/xinetd/confparse.c +@@ -745,7 +745,7 @@ static status_e check_entry( struct serv + } + } + +-/* #ifndef NO_RPC */ ++#ifndef NO_RPC + #if defined(HAVE_RPC_RPCENT_H) || defined(HAVE_NETDB_H) + if ( SC_IS_RPC( scp ) && !SC_IS_UNLISTED( scp ) ) + { +@@ -759,6 +759,7 @@ static status_e check_entry( struct serv + SC_RPCDATA( scp )->rd_program_number = rep->r_number ; + } + else ++#endif + #endif /* ! NO_RPC */ + { + if ( !SC_IS_UNLISTED( scp ) ) diff --git a/net/xinetd/patches/004-ident-bind.patch b/net/xinetd/patches/004-ident-bind.patch new file mode 100644 index 0000000..0da0148 --- /dev/null +++ b/net/xinetd/patches/004-ident-bind.patch @@ -0,0 +1,42 @@ +xinetd: socket bind: Invalid argument (errno = 22) when using USERID on ipv6 + +Use right size of addresses in bind() call. Also use getpeername addresses when +connecting to ident service to prevent address family mismatch between socket(), +bind() and connect() calls. + +Author: Jan Safranek +Reviewed-By: Adam Tkac + +#diff -up xinetd-2.3.14/xinetd/ident.c.orig xinetd-2.3.14/xinetd/ident.c +--- a/xinetd/ident.c ++++ b/xinetd/ident.c +@@ -97,7 +97,13 @@ idresult_e log_remote_user( const struct + } + + CLEAR( sin_contact ); +- sin_remote = *CONN_XADDRESS( SERVER_CONNECTION( serp ) ) ; ++ ++ sin_len = sizeof( sin_remote ); ++ if ( getpeername( SERVER_FD( serp ), &sin_remote.sa, &sin_len ) == -1 ) ++ { ++ msg( LOG_ERR, func, "(%d) getpeername: %m", getpid() ) ; ++ return( IDR_ERROR ) ; ++ } + sin_contact = sin_remote; + memcpy( &sin_bind, &sin_local, sizeof(sin_bind) ) ; + local_port = 0; +@@ -127,7 +133,13 @@ idresult_e log_remote_user( const struct + msg( LOG_ERR, func, "socket creation: %m" ) ; + return( IDR_ERROR ) ; + } +- if ( bind(sd, &sin_bind.sa, sizeof(sin_bind.sa)) == -1 ) ++ ++ if ( sin_bind.sa.sa_family == AF_INET ) ++ sin_len = sizeof( sin_bind.sa_in ) ; ++ else ++ sin_len = sizeof( sin_bind.sa_in6 ) ; ++ ++ if ( bind(sd, &sin_bind.sa, sin_len) == -1 ) + { + msg( LOG_ERR, func, "socket bind: %m" ) ; + (void) Sclose( sd ) ; diff --git a/net/xl2tpd/Makefile b/net/xl2tpd/Makefile new file mode 100644 index 0000000..ae5a41b --- /dev/null +++ b/net/xl2tpd/Makefile @@ -0,0 +1,90 @@ +# +# Copyright (C) 2006-2015 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:=xl2tpd +PKG_VERSION:=devel-20151125 +PKG_RELEASE:=2 +PKG_MAINTAINER:=Yousong Zhou +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=LICENSE + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/xelerance/xl2tpd.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=e2065bf0fc22ba33001ad503c01bba01648024a8 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/xl2tpd + SECTION:=net + CATEGORY:=Network + TITLE:=An L2TP (Layer 2 Tunneling Protocol) daemon + URL:=http://www.xelerance.com/software/xl2tpd/ + SUBMENU:=VPN + DEPENDS:=+ppp-mod-pppol2tp +resolveip +endef + +define Package/xl2tpd/description +l2tpd is the open source implementation of the L2TP tunneling protocol (RFC2661). +It does implement both LAC and LNS role in a L2TP networking architecture. The +main goal of this protocol is to tunnel PPP frame trough an IP network. +endef + +# Use optimization options from OpenWrt build system +MAKE_FLAGS += OFLAGS="" + +ifneq (0,0) + # debugging options from Makefile of xl2tpd package + EXTRA_CFLAGS += \ + -DDEBUG_ZLB \ + -DDEBUG_HELLO \ + -DDEBUG_CLOSE \ + -DDEBUG_FLOW \ + -DDEBUG_FILE \ + -DDEBUG_AAA \ + -DDEBUG_PAYLOAD \ + -DDEBUG_CONTROL \ + -DDEBUG_PPPD \ + -DDEBUG_HIDDEN \ + -DDEBUG_ENTROPY \ + -DDEBUG_CONTROL_XMIT \ + -DDEBUG_MAGIC \ + -DDEBUG_FLOW_MORE \ + -DDEBUG_AUTH +endif + +define Package/xl2tpd/conffiles +/etc/xl2tpd/xl2tpd.conf +/etc/xl2tpd/xl2tp-secrets +/etc/ppp/options.xl2tpd +endef + +define Package/xl2tpd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/sbin/xl2tpd $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/sbin/xl2tpd-control $(1)/usr/sbin/ + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/xl2tpd.init $(1)/etc/init.d/xl2tpd + + $(INSTALL_DIR) $(1)/etc/xl2tpd + $(INSTALL_DATA) ./files/xl2tpd.conf $(1)/etc/xl2tpd/ + $(INSTALL_CONF) ./files/xl2tp-secrets $(1)/etc/xl2tpd/ + + $(INSTALL_DIR) $(1)/etc/ppp + $(INSTALL_DATA) ./files/options.xl2tpd $(1)/etc/ppp/ + + $(INSTALL_DIR) $(1)/lib/netifd/proto + $(INSTALL_BIN) ./files/l2tp.sh $(1)/lib/netifd/proto +endef + +$(eval $(call BuildPackage,xl2tpd)) diff --git a/net/xl2tpd/README b/net/xl2tpd/README new file mode 100644 index 0000000..aadc26e --- /dev/null +++ b/net/xl2tpd/README @@ -0,0 +1,23 @@ +OpenWRT Package for xl2tpd + +xl2tpd is a development from the original l2tpd package originally written by +Mark Spencer, subsequently forked by Scott Balmos and David Stipp, inherited +by Jeff McAdams, modified substantially by Jacco de Leeuw and then forked +again by Xelerance (after it was abandoned by l2tpd.org). + +Rationale for inclusion in OpenWRT: + +l2tpd has some serious alignment problems on RISC platforms. It also runs +purely in userspace. + +Some of the features added in this fork include: + +1. IPSec SA reference tracking inconjunction with openswan's IPSec transport + mode, which adds support for multiple clients behind the same NAT router + and multiple clients on the same internal IP behind different NAT routers. + +2. Support for the pppol2tp kernel mode L2TP. + +3. Alignment and endian problems resolved. + +hcg diff --git a/net/xl2tpd/files/l2tp.sh b/net/xl2tpd/files/l2tp.sh new file mode 100644 index 0000000..38c8025 --- /dev/null +++ b/net/xl2tpd/files/l2tp.sh @@ -0,0 +1,127 @@ +#!/bin/sh + +[ -x /usr/sbin/xl2tpd ] || exit 0 + +[ -n "$INCLUDE_ONLY" ] || { + . /lib/functions.sh + . ../netifd-proto.sh + init_proto "$@" +} + +proto_l2tp_init_config() { + proto_config_add_string "username" + proto_config_add_string "password" + proto_config_add_string "keepalive" + proto_config_add_string "pppd_options" + proto_config_add_boolean "ipv6" + proto_config_add_int "demand" + proto_config_add_int "mtu" + proto_config_add_int "checkup_interval" + proto_config_add_string "server" + available=1 + no_device=1 + no_proto_task=1 + teardown_on_l3_link_down=1 +} + +proto_l2tp_setup() { + local interface="$1" + local optfile="/tmp/l2tp/options.${interface}" + local ip serv_addr server host + + json_get_var server server + host="${server%:*}" + for ip in $(resolveip -t 5 "$host"); do + ( proto_add_host_dependency "$interface" "$ip" ) + serv_addr=1 + done + [ -n "$serv_addr" ] || { + echo "Could not resolve server address" >&2 + sleep 5 + proto_setup_failed "$interface" + exit 1 + } + + # Start and wait for xl2tpd + if [ ! -p /var/run/xl2tpd/l2tp-control -o -z "$(pidof xl2tpd)" ]; then + /etc/init.d/xl2tpd restart + + local wait_timeout=0 + while [ ! -p /var/run/xl2tpd/l2tp-control ]; do + wait_timeout=$(($wait_timeout + 1)) + [ "$wait_timeout" -gt 5 ] && { + echo "Cannot find xl2tpd control file." >&2 + proto_setup_failed "$interface" + exit 1 + } + sleep 1 + done + fi + + local ipv6 demand keepalive username password pppd_options mtu + json_get_vars ipv6 demand keepalive username password pppd_options mtu + [ "$ipv6" = 1 ] || ipv6="" + if [ "${demand:-0}" -gt 0 ]; then + demand="precompiled-active-filter /etc/ppp/filter demand idle $demand" + else + demand="persist" + fi + + local interval="${keepalive##*[, ]}" + [ "$interval" != "$keepalive" ] || interval=5 + + keepalive="${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}}" + username="${username:+user \"$username\" password \"$password\"}" + ipv6="${ipv6:++ipv6}" + mtu="${mtu:+mtu $mtu mru $mtu}" + + mkdir -p /tmp/l2tp + cat <"$optfile" +usepeerdns +nodefaultroute +ipparam "$interface" +ifname "l2tp-$interface" +ip-up-script /lib/netifd/ppp-up +ipv6-up-script /lib/netifd/ppp-up +ip-down-script /lib/netifd/ppp-down +ipv6-down-script /lib/netifd/ppp-down +# Don't wait for LCP term responses; exit immediately when killed. +lcp-max-terminate 0 +$keepalive +$username +$ipv6 +$mtu +$pppd_options +EOF + + xl2tpd-control add l2tp-${interface} pppoptfile=${optfile} lns=${server} || { + echo "xl2tpd-control: Add l2tp-$interface failed" >&2 + proto_setup_failed "$interface" + exit 1 + } + xl2tpd-control connect l2tp-${interface} || { + echo "xl2tpd-control: Connect l2tp-$interface failed" >&2 + proto_setup_failed "$interface" + exit 1 + } +} + +proto_l2tp_teardown() { + local interface="$1" + local optfile="/tmp/l2tp/options.${interface}" + + rm -f ${optfile} + if [ -p /var/run/xl2tpd/l2tp-control ]; then + xl2tpd-control remove l2tp-${interface} || { + echo "xl2tpd-control: Remove l2tp-$interface failed" >&2 + } + fi + # Wait for interface to go down + while [ -d /sys/class/net/l2tp-${interface} ]; do + sleep 1 + done +} + +[ -n "$INCLUDE_ONLY" ] || { + add_protocol l2tp +} diff --git a/net/xl2tpd/files/options.xl2tpd b/net/xl2tpd/files/options.xl2tpd new file mode 100644 index 0000000..f0fc4f4 --- /dev/null +++ b/net/xl2tpd/files/options.xl2tpd @@ -0,0 +1,13 @@ +# + +lock +noauth +debug +dump +logfd 2 +logfile /var/log/xl2tpd.log +noccp +novj +novjccomp +nopcomp +noaccomp diff --git a/net/xl2tpd/files/xl2tp-secrets b/net/xl2tpd/files/xl2tp-secrets new file mode 100644 index 0000000..0fb513f --- /dev/null +++ b/net/xl2tpd/files/xl2tp-secrets @@ -0,0 +1,5 @@ +# Secrets for authenticating l2tp tunnels +# us them secret +# * marko blah2 +# zeus marko blah +# * * interop diff --git a/net/xl2tpd/files/xl2tpd.conf b/net/xl2tpd/files/xl2tpd.conf new file mode 100644 index 0000000..2423ff6 --- /dev/null +++ b/net/xl2tpd/files/xl2tpd.conf @@ -0,0 +1,23 @@ +[global] +port = 1701 +auth file = /etc/xl2tpd/xl2tp-secrets +access control = no + +;[lns default] +;exclusive = yes +;ip range = 192.168.254.202-192.168.254.210 +;lac = 10.0.1.2 +;hidden bit = no +;local ip = 192.168.254.200 +;length bit = yes +;refuse authentication = yes +;name = VersaLink +;ppp debug = yes +;pppoptfile = /etc/ppp/options.xl2tpd + +;[lac left] +;lns = 10.0.1.2 +;refuse authentication = yes +;name = VersaLink +;ppp debug = yes +;pppoptfile = /etc/ppp/options.xl2tpd diff --git a/net/xl2tpd/files/xl2tpd.conf.sample b/net/xl2tpd/files/xl2tpd.conf.sample new file mode 100644 index 0000000..477afa5 --- /dev/null +++ b/net/xl2tpd/files/xl2tpd.conf.sample @@ -0,0 +1,73 @@ +; +; Sample l2tpd configuration file +; +; This example file should give you some idea of how the options for l2tpd +; should work. The best place to look for a list of all options is in +; the source code itself, until I have the time to write better documetation :) +; Specifically, the file "file.c" contains a list of commands at the end. +; +; You most definitely don't have to spell out everything as it is done here +; +; [global] ; Global parameters: +; port = 1701 ; * Bind to port 1701 +; auth file = /etc/xl2tpd/xl2tp-secrets ; * Where our challenge secrets are +; access control = yes ; * Refuse connections without IP match +; rand source = dev ; Source for entropy for random +; ; numbers, options are: +; ; dev - reads of /dev/urandom +; ; sys - uses rand() +; ; egd - reads from egd socket +; ; egd is not yet implemented +; +; [lns default] ; Our fallthrough LNS definition +; exclusive = no ; * Only permit one tunnel per host +; ip range = 192.168.0.1-192.168.0.20 ; * Allocate from this IP range +; no ip range = 192.168.0.3-192.168.0.9 ; * Except these hosts +; ip range = 192.168.0.5 ; * But this one is okay +; ip range = lac1-lac2 ; * And anything from lac1 to lac2's IP +; lac = 192.168.1.4 - 192.168.1.8 ; * These can connect as LAC's +; no lac = untrusted.marko.net ; * This guy can't connect +; hidden bit = no ; * Use hidden AVP's? +; local ip = 192.168.1.2 ; * Our local IP to use +; length bit = yes ; * Use length bit in payload? +; require chap = yes ; * Require CHAP auth. by peer +; refuse pap = yes ; * Refuse PAP authentication +; refuse chap = no ; * Refuse CHAP authentication +; refuse authentication = no ; * Refuse authentication altogether +; require authentication = yes ; * Require peer to authenticate +; unix authentication = no ; * Use /etc/passwd for auth. +; name = myhostname ; * Report this as our hostname +; ppp debug = no ; * Turn on PPP debugging +; pppoptfile = /etc/ppp/options.xl2tpd.lns ; * ppp options file +; call rws = 10 ; * RWS for call (-1 is valid) +; tunnel rws = 4 ; * RWS for tunnel (must be > 0) +; flow bit = yes ; * Include sequence numbers +; challenge = yes ; * Challenge authenticate peer ; +; +; [lac marko] ; Example VPN LAC definition +; lns = lns.marko.net ; * Who is our LNS? +; lns = lns2.marko.net ; * A backup LNS (not yet used) +; redial = yes ; * Redial if disconnected? +; redial timeout = 15 ; * Wait n seconds between redials +; max redials = 5 ; * Give up after n consecutive failures +; hidden bit = yes ; * User hidden AVP's? +; local ip = 192.168.1.1 ; * Force peer to use this IP for us +; remote ip = 192.168.1.2 ; * Force peer to use this as their IP +; length bit = no ; * Use length bit in payload? +; require pap = no ; * Require PAP auth. by peer +; require chap = yes ; * Require CHAP auth. by peer +; refuse pap = yes ; * Refuse PAP authentication +; refuse chap = no ; * Refuse CHAP authentication +; refuse authentication = no ; * Refuse authentication altogether +; require authentication = yes ; * Require peer to authenticate +; name = marko ; * Report this as our hostname +; ppp debug = no ; * Turn on PPP debugging +; pppoptfile = /etc/ppp/options.xl2tpd.marko ; * ppp options file for this lac +; call rws = 10 ; * RWS for call (-1 is valid) +; tunnel rws = 4 ; * RWS for tunnel (must be > 0) +; flow bit = yes ; * Include sequence numbers +; challenge = yes ; * Challenge authenticate peer +; +; [lac cisco] ; Another quick LAC +; lns = cisco.marko.net ; * Required, but can take from default +; require authentication = yes diff --git a/net/xl2tpd/files/xl2tpd.init b/net/xl2tpd/files/xl2tpd.init new file mode 100644 index 0000000..7d2e9ea --- /dev/null +++ b/net/xl2tpd/files/xl2tpd.init @@ -0,0 +1,24 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2015 OpenWrt.org + +START=60 +USE_PROCD=1 + +BIN=xl2tpd +RUN_D="/var/run/xl2tpd" +PID_F="/var/run/xl2tpd.pid" + +start_service() { + rm -rf "$RUN_D" + mkdir -p "$RUN_D" + + procd_open_instance + procd_set_param command $BIN -D -l -p "$PID_F" + procd_set_param respawn + procd_close_instance +} + +stop_service() { + rm -rf "$RUN_D" + rm -rf "$PID_F" +} diff --git a/net/xl2tpd/patches/100-makefile_opt_flags.patch b/net/xl2tpd/patches/100-makefile_opt_flags.patch new file mode 100644 index 0000000..f945d94 --- /dev/null +++ b/net/xl2tpd/patches/100-makefile_opt_flags.patch @@ -0,0 +1,12 @@ +--- a/Makefile ++++ b/Makefile +@@ -97,7 +97,8 @@ OSFLAGS+= -DUSE_KERNEL + + IPFLAGS?= -DIP_ALLOCATION + +-CFLAGS+= $(DFLAGS) -Os -fno-builtin -Wall -DSANITY $(OSFLAGS) $(IPFLAGS) ++OFLAGS=-Os ++CFLAGS+= $(DFLAGS) $(OFLAGS) -fno-builtin -Wall -DSANITY $(OSFLAGS) $(IPFLAGS) + HDRS=l2tp.h avp.h misc.h control.h call.h scheduler.h file.h aaa.h md5.h + OBJS=xl2tpd.o pty.o misc.o control.o avp.o call.o network.o avpsend.o scheduler.o file.o aaa.o md5.o + SRCS=${OBJS:.o=.c} ${HDRS} diff --git a/net/xl2tpd/patches/110-makefile_dont_build_pfc.patch b/net/xl2tpd/patches/110-makefile_dont_build_pfc.patch new file mode 100644 index 0000000..f76364f --- /dev/null +++ b/net/xl2tpd/patches/110-makefile_dont_build_pfc.patch @@ -0,0 +1,43 @@ +--- a/Makefile ++++ b/Makefile +@@ -113,10 +113,10 @@ BINDIR?=$(DESTDIR)${PREFIX}/bin + MANDIR?=$(DESTDIR)${PREFIX}/share/man + + +-all: $(EXEC) pfc $(CONTROL_EXEC) ++all: $(EXEC) $(CONTROL_EXEC) + + clean: +- rm -f $(OBJS) $(EXEC) pfc.o pfc $(CONTROL_EXEC) ++ rm -f $(OBJS) $(EXEC) $(CONTROL_EXEC) + + $(EXEC): $(OBJS) $(HDRS) + $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS) +@@ -124,14 +124,10 @@ $(EXEC): $(OBJS) $(HDRS) + $(CONTROL_EXEC): $(CONTROL_SRCS) + $(CC) $(CFLAGS) $(LDFLAGS) $(CONTROL_SRCS) -o $@ + +-pfc: +- $(CC) $(CFLAGS) -c contrib/pfc.c +- $(CC) $(LDFLAGS) -o pfc pfc.o -lpcap $(LDLIBS) +- + romfs: + $(ROMFSINST) /bin/$(EXEC) + +-install: ${EXEC} pfc ${CONTROL_EXEC} ++install: ${EXEC} ${CONTROL_EXEC} + install -d -m 0755 ${SBINDIR} + install -m 0755 $(EXEC) ${SBINDIR}/$(EXEC) + install -d -m 0755 ${MANDIR}/man5 +@@ -139,11 +135,6 @@ install: ${EXEC} pfc ${CONTROL_EXEC} + install -m 0644 doc/xl2tpd.8 ${MANDIR}/man8/ + install -m 0644 doc/xl2tpd.conf.5 doc/l2tp-secrets.5 \ + ${MANDIR}/man5/ +- # pfc +- install -d -m 0755 ${BINDIR} +- install -m 0755 pfc ${BINDIR}/pfc +- install -d -m 0755 ${MANDIR}/man1 +- install -m 0644 contrib/pfc.1 ${MANDIR}/man1/ + # control exec + install -d -m 0755 ${SBINDIR} + install -m 0755 $(CONTROL_EXEC) ${SBINDIR}/$(CONTROL_EXEC) diff --git a/net/xl2tpd/patches/120-no-bsd-signal-in-musl.patch b/net/xl2tpd/patches/120-no-bsd-signal-in-musl.patch new file mode 100644 index 0000000..c8c4a7d --- /dev/null +++ b/net/xl2tpd/patches/120-no-bsd-signal-in-musl.patch @@ -0,0 +1,11 @@ +--- a/xl2tpd.c ++++ b/xl2tpd.c +@@ -30,7 +30,7 @@ + #include + #include + #include +-#if (__GLIBC__ < 2) ++#if defined (__GLIBC__) && (__GLIBC__ < 2) + # if defined(FREEBSD) || defined(OPENBSD) + # include + # elif defined(LINUX) diff --git a/net/yaaw/Makefile b/net/yaaw/Makefile new file mode 100644 index 0000000..e78a7d6 --- /dev/null +++ b/net/yaaw/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2016 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:=yaaw +PKG_VERSION:=2016-05-28 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Hsing-Wang Liao + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/binux/yaaw.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=c28cde2252b707fe0661693f78c5e5e3beee09a1 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_LICENSE:=LGPL-3.0 + +include $(INCLUDE_DIR)/package.mk + +define Package/yaaw + SECTION:=net + CATEGORY:=Network + SUBMENU:=Download Manager + DEPENDS:= + TITLE:=Yet another aria2 web frontend + URL:=https://github.com/binux/yaaw + PKGARCH:=all +endef + +define Package/yaaw/description + Yet Another Aria2 Web Frontend in pure HTML/CSS/Javascirpt. +endef + +define Build/Compile +endef + +define Package/yaaw/install + $(INSTALL_DIR) $(1)/www/yaaw + $(CP) $(PKG_BUILD_DIR)/js $(1)/www/yaaw + $(CP) $(PKG_BUILD_DIR)/img $(1)/www/yaaw + $(CP) $(PKG_BUILD_DIR)/css $(1)/www/yaaw + $(CP) $(PKG_BUILD_DIR)/index.html $(1)/www/yaaw + $(CP) $(PKG_BUILD_DIR)/offline.appcache $(1)/www/yaaw +endef + +$(eval $(call BuildPackage,yaaw)) diff --git a/net/znc/Config.in b/net/znc/Config.in new file mode 100644 index 0000000..519de55 --- /dev/null +++ b/net/znc/Config.in @@ -0,0 +1,18 @@ +# +# Copyright (C) 2010-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +menu "Configuration" + depends on PACKAGE_znc + +config ZNC_ICU + bool + prompt "Enable ICU character encoding support." + help + Allows configuration of the charset used between clients and ZNC, and + between ZNC and the IRC server". + +endmenu diff --git a/net/znc/Makefile b/net/znc/Makefile new file mode 100644 index 0000000..2d0c34d --- /dev/null +++ b/net/znc/Makefile @@ -0,0 +1,313 @@ +# +# Copyright (C) 2009-2010 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:=znc +PKG_VERSION:=1.6.3 +PKG_RELEASE:=5 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://znc.in/releases \ + http://znc.in/releases/archive +PKG_MD5SUM:=0dad0307e2faea26b9e304e308f7ec63 + +PKG_MAINTAINER:=Jonas Gorski +PKG_LICENSE:=Apache-2.0 +PKG_LICENSE_FILES:=LICENSE + +PKG_USE_MIPS16:=0 +PKG_BUILD_PARALLEL:=1 + +PKG_CONFIG_DEPENDS := CONFIG_ZNC_ICU + +define Package/znc/default + SUBMENU:=Instant Messaging + SECTION:=net + CATEGORY:=Network + TITLE:=ZNC + URL:=http://en.znc.in/ + USERID:=znc:znc +endef + +define Package/znc + $(Package/znc/default) + DEPENDS:=+libopenssl +libpthread +libstdcpp +ZNC_ICU:icu +zlib + MENU:=1 +endef + +define Package/znc/description + ZNC is an IRC bouncer with many advanced features like detaching, + multiple users, per channel playback buffer, SSL, IPv6, transparent DCC + bouncing, and c++ module support to name a few. +endef + +define Package/znc/config + source "$(SOURCE)/Config.in" +endef + +define Package/znc/conffiles +/etc/config/znc +endef + + +define Package/znc/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/znc $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/znc.init $(1)/etc/init.d/znc + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/znc.conf $(1)/etc/config/znc + $(INSTALL_DIR) $(1)/usr/lib/znc/ +endef + + +ZNC_MODULES := +ZNC_MODULE_TARGETS := + +define module + define Package/znc-mod-$(strip $(1)) + $(Package/znc/default) + TITLE+= ($(strip $(1)) plugin) + DEPENDS:=znc + endef + + define Package/znc-mod-$(strip $(1))/description + $(strip $(2)) + endef + + define Package/znc-mod-$(strip $(1))/install + $(INSTALL_DIR) $$(1)/usr/lib/znc/ + $(INSTALL_BIN) $$(PKG_BUILD_DIR)/modules/$(subst -,_,$(strip $(1))).so $$(1)/usr/lib/znc/ + # include webadmin page templates if existing + if [ -d $$(PKG_BUILD_DIR)/modules/data/$(subst -,_,$(strip $(1))) ]; then \ + $(INSTALL_DIR) $$(1)/usr/share/znc/modules ;\ + $(CP) $$(PKG_BUILD_DIR)/modules/data/$(subst -,_,$(strip $(1))) $$(1)/usr/share/znc/modules ;\ + fi + endef + + ZNC_MODULES += znc-mod-$(strip $(1)) + $(if $(CONFIG_PACKAGE_znc-mod-$(strip $(1))),ZNC_MODULE_TARGETS += $(subst -,_,$(strip $(1))).so) +endef + +define webadmin + define Package/znc-mod-webadmin + $(Package/znc/default) + TITLE+= (webadmin plugin) + DEPENDS:=znc + endef + + define Package/znc-mod-webadmin/description + Allows you to add/remove/edit users and settings on the fly via a web browser. + endef + + define Package/znc-mod-webadmin/install + $(INSTALL_DIR) $$(1)/usr/lib/znc/ + $(INSTALL_BIN) $$(PKG_BUILD_DIR)/modules/webadmin.so $$(1)/usr/lib/znc/ + $(INSTALL_DIR) $$(1)/usr/share/znc/modules + $(CP) $$(PKG_BUILD_DIR)/modules/data/webadmin $$(1)/usr/share/znc/modules + $(INSTALL_DIR) $$(1)/usr/share/znc/webskins/ + $(CP) $$(PKG_BUILD_DIR)/webskins/_default_ $$(1)/usr/share/znc/webskins/ + endef + + ZNC_MODULES += znc-mod-webadmin + $(if $(CONFIG_PACKAGE_znc-mod-webadmin),ZNC_MODULE_TARGETS += webadmin.so) +endef + +define webskin + define Package/znc-webskin-$(strip $(1)) + $(Package/znc/default) + TITLE+= ($(strip $(1)) webskin) + DEPENDS:=znc-mod-webadmin + endef + + define Package/znc-webskin-$(strip $(1))/description + $(strip $(1)) webskin for webadmin + endef + + define Package/znc-webskin-$(strip $(1))/install + $(INSTALL_DIR) $$(1)/usr/share/znc/webskins/ + $(CP) $$(PKG_BUILD_DIR)/webskins/$(strip $(1)) $$(1)/usr/share/znc/webskins/ + endef + ZNC_MODULES += znc-webskin-$(strip $(1)) +endef + +, := , + +$(eval $(call module,adminlog,Log user connects and disconnects and failed \ + logins to file or syslog.)) + +$(eval $(call module,alias,Provides bouncer-side command alias support.)) + +$(eval $(call module,autoattach,Reattaches you to channels on activity.)) + +$(eval $(call module,autocycle,Cycles a channel when you are the only one in \ + there and you don't have op.)) + +$(eval $(call module,autoop,Auto op the good guys.)) + +$(eval $(call module,autoreply,Gives a automatic reply if someone messages you \ + if you are away.)) + +$(eval $(call module,autovoice,Autovoices everyone who joins some channel.)) + +$(eval $(call module,awaynick,Change your nick while you are away.)) + +$(eval $(call module,awaystore,Stores messages while away$(,) also auto away.)) + +$(eval $(call module,block-motd,This module blocks the server's Message of the \ + Day.)) + +$(eval $(call module,blockuser,Blocks certain users from using ZNC saying \ + their account was disabled.)) + +$(eval $(call module,bouncedcc,Bounces dcc transfers through the znc server \ + instead of sending them directly to the user.)) + +$(eval $(call module,buffextras,Add nick changes$(,) joins$(,) parts$(,) topic \ + changes etc. to your playback buffer.)) + +$(eval $(call module,cert,Use a SSL certificate for connecting to a server.)) + +$(eval $(call module,certauth,This module allows users to log in to ZNC via \ + SSL client keys.)) + +$(eval $(call module,chansaver,Keeping config up to date when user joins and \ + parts.)) + +$(eval $(call module,clearbufferonmsg,This module keeps the buffer until the \ + next message from the client.)) + +$(eval $(call module,clientnotify,Notify about new incoming connections to \ + your user.)) + +$(eval $(call module,controlpanel,Allows you to add/remove/edit users and \ + settings on the fly via IRC messages.)) + +$(eval $(call module,crypt,Encryption for channel/private messages.)) + +$(eval $(call module,ctcpflood,This module tries to block ctcp floods.)) + +$(eval $(call module,dcc,Allows you to transfer files to and from ZNC.)) + +$(eval $(call module,disconkick,This module will kick your client from all \ + channels where you are$(,) in case if ZNC disconnects from server.)) + +$(eval $(call module,fail2ban,Block IPs for some time after a failed login.)) + +$(eval $(call module,flooddetach,This module detaches you from channels which \ + are flooded.)) + +$(eval $(call module,identfile,Places the ident of a user to a file when they \ + are trying to connect.)) + +$(eval $(call module,imapauth,Allow users to authenticate via IMAP.)) + +$(eval $(call module,keepnick,Tries to get you your primary nick.)) + +$(eval $(call module,kickrejoin,Implements auto-rejoin-on-kick.)) + +$(eval $(call module,lastseen,Logs when a user last logged in to ZNC.)) + +$(eval $(call module,listsockets,This module displays a list of all open \ + sockets in ZNC.)) + +$(eval $(call module,log,Log conversations to file.)) + +$(eval $(call module,missingmotd,Sends 422 to clients when they login.)) + +$(eval $(call module,modules_online,This module fakes the online status of \ + ZNC-*users.)) + +$(eval $(call module,nickserv,Auths you with NickServ.)) + +$(eval $(call module,notes,This modules stores and displays short notes using \ + a key/note pairs and shows them to you on connect.)) + +$(eval $(call module,notify-connect,Sends a notice to all admins when a user \ + logs in or out.)) + +$(eval $(call module,partyline,Allows ZNC users to join internal channels and \ + query other ZNC users on the same ZNC.)) + +$(eval $(call module,perform,Performs commands on connect.)) + +$(eval $(call module,playback,Avoid repetitive playback buffers on re-connect \ + with supported clients (e.g. mutter, colluquy))) + +$(eval $(call module,q,Auths you with Q (and a little more).)) + +$(eval $(call module,raw,View all of the raw traffic.)) + +$(eval $(call module,route-replies,Routes back answers to the right client \ + when connected with multiple clients.)) + +$(eval $(call module,sasl,The SASL module allows you to authenticate to an \ + IRC network via SASL.)) + +$(eval $(call module,savebuff,Saves your channel buffers into an encrypted \ + file so they can survive restarts and reboots.)) + +$(eval $(call module,schat,SSL (encrypted) DCC chats.)) + +$(eval $(call module,send-raw,Allows you to send raw traffic to IRC from \ + other users.)) + +$(eval $(call module,simple-away,This module will automatically set you away \ + on IRC while you are disconnected from the bouncer.)) + +$(eval $(call module,shell,Have your unix shell in a query window right inside \ + of your IRC client.)) + +$(eval $(call module,stickychan,Keeps you sticked to specific channels.)) + +$(eval $(call module,watch,Monitor activity for specific text patterns from \ + specific users and have the text sent to a special query window.)) + +$(eval $(call webadmin)) + +$(eval $(call webskin,dark-clouds)) +$(eval $(call webskin,forest)) +$(eval $(call webskin,ice)) + +PKG_CONFIG_DEPENDS += $(patsubst %,CONFIG_PACKAGE_%,$(ZNC_MODULES)) + +include $(INCLUDE_DIR)/package.mk + +CONFIGURE_VARS += \ + CXXFLAGS="$(TARGET_CFLAGS) -fno-builtin -fno-rtti" \ + CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \ + LDFLAGS="-nodefaultlibs -lc -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \ + LIBS="-lstdc++ -lm -lssl -lcrypto $(LIBGCC_S) -lc" + +CONFIGURE_ARGS += \ + $(if $(CONFIG_ZNC_ICU), --enable-charset, --disable-charset) \ + --disable-cyrus \ + --disable-debug \ + --enable-largefile \ + --disable-perl \ + --enable-poll \ + --disable-python \ + --enable-ssl \ + --disable-swig \ + --disable-tcl \ + --enable-tdns \ + --enable-zlib + +define Build/Configure + $(call Build/Configure/Default,) + $(call libtool_disable_rpath) +endef + +define Build/Compile + $(call Build/Compile/Default,znc) + +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/modules \ + $(MAKE_FLAGS) $(ZNC_MODULE_TARGETS) +endef + +$(eval $(call BuildPackage,znc)) +$(foreach m,$(ZNC_MODULES),$(eval $(call BuildPackage,$(m)))) diff --git a/net/znc/files/znc.conf b/net/znc/files/znc.conf new file mode 100644 index 0000000..1b0d842 --- /dev/null +++ b/net/znc/files/znc.conf @@ -0,0 +1,29 @@ +config znc + # where to listen for connections + list listener '192.168.1.1 1234' + # If using SSL sockets, use the following certifcate: + # option znc_ssl_cert '/etc/znc.cert' + + # load global modules (You need to install them first): + # list module 'fail2ban' + + # remove this to enable the service + option disabled 1 + +config user 'sampleUser' + # Use either a plain text password or use the full sha256#... line. + # You can generate one with 'znc -s'. + option password 'changeme' + option nick 'sampleUser' + option altnick 'userSample' + option ident 'openwrt' + option realname 'John Doe' + + # This adds support for channels in znc configuration: + # list channel '#chan optional_password' + + # list of allowed servers: + # list server 'chat.freenode.net 6667' + + # load user modules (' [params...]'): + # list module 'simple_away -timer 10 disconnected' diff --git a/net/znc/files/znc.init b/net/znc/files/znc.init new file mode 100644 index 0000000..0277aff --- /dev/null +++ b/net/znc/files/znc.init @@ -0,0 +1,183 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2010 Openwrt.org + +START=60 + +USE_PROCD=1 + +ZNC_CONFIG_PATH=/tmp/etc/znc +PID_FILE=${ZNC_CONFIG_PATH}/znc.pid +ZNC_CONFIG=${ZNC_CONFIG_PATH}/configs/znc.conf + +EXTERNAL_CONFIG=0 +DISABLED= + +RUNAS_USER= +RUNAS_GROUP= + +add_param() { + echo "$1 = $2" >> $ZNC_CONFIG +} + +add_chan() { + chan=${1% *} + pass=${1#* } + echo " " >> $ZNC_CONFIG + [ "$chan" != "$pass" ] && echo " Key = $pass" >> $ZNC_CONFIG + echo " " >> $ZNC_CONFIG +} + +add_network() { + local current_user="$1" + local network="$2" + local user + local name + + config_get user "$network" user + + [ "$user" = "$current_user" ] || return 0 + + config_get name "$network" name + echo " " >> $ZNC_CONFIG + config_list_foreach "$network" server "add_param \" Server\"" + config_list_foreach "$network" fingerprint "add_param \" trustedserverfingerprint\"" + config_list_foreach "$network" channel "add_chan" + echo " " >> $ZNC_CONFIG +} + +znc_global() { + local znc="$1" + local anoniplimit + local maxbuffersize + local connectdelay + local serverthrottle + local znc_config_path + local znc_pem_file + + config_get_bool DISABLED "$znc" disabled 0 + + [ "$DISABLED" -eq 0 ] || return 0 + + config_get znc_config_path "$znc" znc_config_path + + config_get RUNAS_USER "$znc" runas_user znc + config_get RUNAS_GROUP "$znc" runas_group znc + + if [ "${znc_config_path}" ] + then + ZNC_CONFIG_PATH=$znc_config_path + EXTERNAL_CONFIG=1 + else + mkdir -p $ZNC_CONFIG_PATH/configs/ + [ ! -f "$ZNC_CONFIG" ] || rm "$ZNC_CONFIG" + + add_param "Version" "1.0" + + config_get anoniplimit "$znc" anoniplimit + config_get maxbuffersize "$znc" maxbuffersize + config_get connectdelay "$znc" connectdelay + config_get serverthrottle "$znc" serverthrottle + config_get znc_pem_file "$znc" znc_ssl_cert + + [ -z "$znc_pem_file" ] || ln -sf "$znc_pem_file" $ZNC_CONFIG_PATH/znc.pem + + [ -z $anoniplimit ] || echo "AnonIPLimit = $anoniplimit" >> $ZNC_CONFIG + [ -z $maxbuffersize ] || echo "MaxBufferSize = $maxbuffersize" >> $ZNC_CONFIG + [ -z $connectdelay ] || echo "ConnectDelay = $connectdelay" >> $ZNC_CONFIG + [ -z $serverthrottle ] || echo "ServerThrottle = $anoniplimit" >> $ZNC_CONFIG + + echo "PidFile = $PID_FILE" >> $ZNC_CONFIG + + config_list_foreach "$znc" listener "add_param Listener" + config_list_foreach "$znc" module "add_param LoadModule" + fi +} + +add_user() { + local user="$1" + local password + local nick + local altnick + local ident + local realname + local buffer + local quitmsg + local chanmodes + local vhost + local server + + config_get password "$user" password + config_get nick "$user" nick + config_get altnick "$user" altnick + config_get ident "$user" ident + config_get realname "$user" realname + config_get buffer "$user" buffer + config_get quitmsg "$user" quitmsg + config_get chanmodes "$user" chanmodes + config_get vhost "$user" vhost + config_get server "$user" server + + echo "" >> $ZNC_CONFIG + + case "$password" in + "md5#"* | "sha256#"* | "plain#"*) + add_param " Pass" "$password" + ;; + *) + add_param " Pass" "plain#$password" + ;; + esac + + add_param " Nick" "$nick" + add_param " AltNick" "${altnick:-$nick"_"}" + add_param " Ident" "${ident:-$nick}" + add_param " RealName" "${realname:-$nick}" + [ -z "$vhost" ] || add_param " VHost" "$vhost" + add_param " Buffer" "${buffer:-50}" + add_param " KeepBuffer" "false" + add_param " ChanModes" "${chanmodes:-"+stn"}" + [ -z "$quitmsg" ] || add_param " QuitMsg" "$quitmsg" + + config_list_foreach "$user" module "add_param \" LoadModule\"" + + # add legacy network + if [ "$server" ]; then + echo " " >> $ZNC_CONFIG + config_list_foreach "$user" server "add_param \" Server\"" + config_list_foreach "$user" fingerprint "add_param \" trustedserverfingerprint\"" + config_list_foreach "$user" channel "add_chan" + echo " " >> $ZNC_CONFIG + fi + + config_foreach "add_network \"$user\"" network + + echo "" >> $ZNC_CONFIG +} + +start_service() { + config_load znc + config_foreach znc_global znc + + [ "$DISABLED" -eq 0 ] || return 0 + + if [ "$EXTERNAL_CONFIG" -eq 0 ] + then + config_foreach add_listener listener + config_foreach add_user user + + fi + + chown -hR ${RUNAS_USER}:${RUNAS_GROUP} ${ZNC_CONFIG_PATH} || { + logger -s -t ZNC -p daemon.err "Invalid UID/GID. Aborting startup" + exit 1 + } + + procd_open_instance + procd_set_param file /etc/config/znc + [ "$EXTERNAL_CONFIG" -eq 1 ] && procd_set_param file "${ZNC_CONFIG}/configs/znc.conf" + procd_set_param command /usr/bin/znc + procd_append_param command -f -d$ZNC_CONFIG_PATH + procd_set_param user ${RUNAS_USER} + procd_set_param respawn + procd_close_instance +} diff --git a/net/znc/patches/100-move_rootcheck_after_config.patch b/net/znc/patches/100-move_rootcheck_after_config.patch new file mode 100644 index 0000000..6ef6630 --- /dev/null +++ b/net/znc/patches/100-move_rootcheck_after_config.patch @@ -0,0 +1,52 @@ +From adf42357c9043c38d9a9b47544a1b46445bdae19 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski +Date: Wed, 6 Apr 2011 04:10:23 +0200 +Subject: [PATCH] Move the root check to after config parsing + +--- + src/main.cpp | 27 ++++++++++++++------------- + 1 file changed, 14 insertions(+), 13 deletions(-) + +--- a/src/main.cpp ++++ b/src/main.cpp +@@ -304,19 +304,6 @@ int main(int argc, char** argv) { + CUtils::PrintStatus(true, ""); + } + +- if (isRoot()) { +- CUtils::PrintError("You are running ZNC as root! Don't do that! There are not many valid"); +- CUtils::PrintError("reasons for this and it can, in theory, cause great damage!"); +- if (!bAllowRoot) { +- CZNC::DestroyInstance(); +- return 1; +- } +- CUtils::PrintError("You have been warned."); +- CUtils::PrintError("Hit CTRL+C now if you don't want to run ZNC as root."); +- CUtils::PrintError("ZNC will start in 30 seconds."); +- sleep(30); +- } +- + if (bMakeConf) { + if (!pZNC->WriteNewConfig(sConfig)) { + CZNC::DestroyInstance(); +@@ -338,6 +325,20 @@ int main(int argc, char** argv) { + return 1; + } + ++ if (isRoot()) { ++ CUtils::PrintError("You are running ZNC as root! Don't do that! There are not many valid"); ++ CUtils::PrintError("reasons for this and it can, in theory, cause great damage!"); ++ if (!bAllowRoot) { ++ CZNC::DestroyInstance(); ++ return 1; ++ } ++ CUtils::PrintError("You have been warned."); ++ CUtils::PrintError("Hit CTRL+C now if you don't want to run ZNC as root."); ++ CUtils::PrintError("ZNC will start in 30 seconds."); ++ sleep(30); ++ } ++ ++ + if (bForeground) { + int iPid = getpid(); + CUtils::PrintMessage("Staying open for debugging [pid: " + CString(iPid) + "]"); diff --git a/net/znc/patches/101-Reduce_rebuild_time.patch b/net/znc/patches/101-Reduce_rebuild_time.patch new file mode 100644 index 0000000..60d335c --- /dev/null +++ b/net/znc/patches/101-Reduce_rebuild_time.patch @@ -0,0 +1,39 @@ +From 0527869a72c27bfb25b5f92fdd77a04c39d939db Mon Sep 17 00:00:00 2001 +From: Jonas Gorski +Date: Sat, 16 Apr 2011 05:51:04 +0200 +Subject: [PATCH] Don't rebuild everything when the Makefile's timestamp + changed + +--- + Makefile.in | 2 +- + modules/Makefile.in | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +--- a/Makefile.in ++++ b/Makefile.in +@@ -112,7 +112,7 @@ clean: + distclean: clean + rm -rf $(DISTCLEAN) + +-src/%.o: src/%.cpp Makefile include/znc/Csocket.h ++src/%.o: src/%.cpp include/znc/Csocket.h + @mkdir -p .depend src + $(E) Building core object $*... + $(Q)$(CXX) $(CXXFLAGS) -c -o $@ $< -MD -MF .depend/$*.dep -MT $@ +--- a/modules/Makefile.in ++++ b/modules/Makefile.in +@@ -112,12 +112,12 @@ install_datadir: + clean: + rm -rf $(CLEAN) + +-%.o: %.cpp Makefile ++%.o: %.cpp + @mkdir -p .depend + $(E) Building module $(notdir $(basename $@))... + $(Q)$(CXX) $(MODFLAGS) -c -o $@ $< $($(notdir $(basename $@))CXXFLAGS) -MD -MF .depend/$(notdir $@).dep + +-%.so: %.o Makefile ++%.so: %.o + $(E) "Linking module" $(notdir $(basename $@))... + $(Q)$(CXX) $(MODFLAGS) $(LDFLAGS) $(MODLINK) -o $@ $< $($(notdir $(basename $@))LDFLAGS) $(LIBS) + diff --git a/net/znc/patches/103-Csocket-Add-some-ifdef-feature-checks.patch b/net/znc/patches/103-Csocket-Add-some-ifdef-feature-checks.patch new file mode 100644 index 0000000..a0dbe01 --- /dev/null +++ b/net/znc/patches/103-Csocket-Add-some-ifdef-feature-checks.patch @@ -0,0 +1,71 @@ +From d81a18d87d15bbf54ddbd675bfa829cf7dfdce9e Mon Sep 17 00:00:00 2001 +From: Edoardo Spadolini +Date: Mon, 8 Feb 2016 14:01:51 +0100 +Subject: [PATCH] Add some #ifdef feature checks to fix compilation with + BoringSSL + +--- + Csocket.cc | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/src/Csocket.cpp ++++ b/src/Csocket.cpp +@@ -45,9 +45,12 @@ + + #ifdef HAVE_LIBSSL + #include ++#include + #include + #include ++#ifndef OPENSSL_NO_COMP + #include ++#endif + #endif /* HAVE_LIBSSL */ + + #ifdef HAVE_ICU +@@ -531,8 +534,12 @@ void ShutdownCsocket() + { + #ifdef HAVE_LIBSSL + ERR_remove_state( 0 ); ++#ifndef OPENSSL_NO_ENGINE + ENGINE_cleanup(); ++#endif ++#ifndef OPENSSL_IS_BORINGSSL + CONF_modules_unload( 1 ); ++#endif + ERR_free_strings(); + EVP_cleanup(); + CRYPTO_cleanup_all_ex_data(); +@@ -573,6 +580,7 @@ bool InitSSL( ECompType eCompressionType + } + #endif /* _WIN32 */ + ++#ifndef OPENSSL_NO_COMP + COMP_METHOD *cm = NULL; + + if( CT_ZLIB & eCompressionType ) +@@ -588,6 +596,7 @@ bool InitSSL( ECompType eCompressionType + if( cm ) + SSL_COMP_add_compression_method( CT_RLE, cm ); + } ++#endif + + // setting this up once in the begining + s_iCsockSSLIdx = SSL_get_ex_new_index( 0, NULL, NULL, NULL, NULL ); +@@ -1724,6 +1733,8 @@ SSL_CTX * Csock::SetupServerCTX() + #ifndef OPENSSL_NO_ECDH + // Errors for the following block are non-fatal (ECDHE is nice to have + // but not a requirement) ++#ifndef OPENSSL_IS_BORINGSSL ++ // BoringSSL does this thing automatically + #if defined( SSL_CTX_set_ecdh_auto ) + // Auto-select sensible curve + if( !SSL_CTX_set_ecdh_auto( pCTX , 1 ) ) +@@ -1742,6 +1753,7 @@ SSL_CTX * Csock::SetupServerCTX() + ERR_clear_error(); + } + #endif /* SSL_CTX_set_tmp_ecdh */ ++#endif /* !OPENSSL_IS_BORINGSSL */ + #endif /* OPENSSL_NO_ECDH */ + + if( !ConfigureCTXOptions( pCTX ) ) diff --git a/net/znc/patches/104-disable-empty-modules-check.patch b/net/znc/patches/104-disable-empty-modules-check.patch new file mode 100644 index 0000000..22b5c38 --- /dev/null +++ b/net/znc/patches/104-disable-empty-modules-check.patch @@ -0,0 +1,15 @@ +--- a/src/main.cpp ++++ b/src/main.cpp +@@ -296,10 +296,12 @@ int main(int argc, char** argv) { + CUtils::PrintStatus(false, ""); + CUtils::PrintError("No modules found. Perhaps you didn't install ZNC properly?"); + CUtils::PrintError("Read http://wiki.znc.in/Installation for instructions."); ++#if 0 + if (!CUtils::GetBoolInput("Do you really want to run ZNC without any modules?", false)) { + CZNC::DestroyInstance(); + return 1; + } ++#endif + } + CUtils::PrintStatus(true, ""); + } diff --git a/net/znc/patches/110-add-playback-module.patch b/net/znc/patches/110-add-playback-module.patch new file mode 100644 index 0000000..41a4f36 --- /dev/null +++ b/net/znc/patches/110-add-playback-module.patch @@ -0,0 +1,291 @@ +--- /dev/null ++++ b/modules/playback.cpp +@@ -0,0 +1,288 @@ ++/* ++ * Copyright (C) 2015 J-P Nurmi ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#if (VERSION_MAJOR < 1) || (VERSION_MAJOR == 1 && VERSION_MINOR < 6) ++#error The playback module requires ZNC version 1.6.0 or later. ++#endif ++ ++static const char* PlaybackCap = "znc.in/playback"; ++ ++class CPlaybackMod : public CModule ++{ ++public: ++ MODCONSTRUCTOR(CPlaybackMod) ++ { ++ m_play = false; ++ AddHelpCommand(); ++ AddCommand("Clear", static_cast(&CPlaybackMod::ClearCommand), "", "Clears playback for given buffers."); ++ AddCommand("Play", static_cast(&CPlaybackMod::PlayCommand), " [from] [to]", "Sends playback for given buffers."); ++ AddCommand("List", static_cast(&CPlaybackMod::ListCommand), "[buffer(s)]", "Lists available/matching buffers."); ++ AddCommand("Limit", static_cast(&CPlaybackMod::LimitCommand), " [limit]", "Get/set the buffer limit (<= 0 to clear) for the given client."); ++ } ++ ++ void OnClientCapLs(CClient* client, SCString& caps) override ++ { ++ caps.insert(PlaybackCap); ++ } ++ ++ bool IsClientCapSupported(CClient* client, const CString& cap, bool state) override ++ { ++ return cap.Equals(PlaybackCap); ++ } ++ ++ EModRet OnChanBufferStarting(CChan& chan, CClient& client) override ++ { ++ if (!m_play && client.IsCapEnabled(PlaybackCap)) ++ return HALTCORE; ++ return CONTINUE; ++ } ++ ++ EModRet OnChanBufferPlayLine(CChan& chan, CClient& client, CString& line) override ++ { ++ if (!m_play && client.IsCapEnabled(PlaybackCap)) ++ return HALTCORE; ++ return CONTINUE; ++ } ++ ++ EModRet OnChanBufferEnding(CChan& chan, CClient& client) override ++ { ++ if (!m_play && client.IsCapEnabled(PlaybackCap)) ++ return HALTCORE; ++ return CONTINUE; ++ } ++ ++ EModRet OnPrivBufferPlayLine(CClient& client, CString& line) override ++ { ++ if (!m_play && client.IsCapEnabled(PlaybackCap)) ++ return HALTCORE; ++ return CONTINUE; ++ } ++ ++ void ClearCommand(const CString& line) ++ { ++ // CLEAR ++ const CString arg = line.Token(1); ++ if (arg.empty() || !line.Token(2).empty()) ++ return; ++ std::vector chans = FindChans(arg); ++ for (CChan* chan : chans) ++ chan->ClearBuffer(); ++ std::vector queries = FindQueries(arg); ++ for (CQuery* query : queries) ++ query->ClearBuffer(); ++ } ++ ++ void PlayCommand(const CString& line) ++ { ++ // PLAY [from] [to] ++ const CString arg = line.Token(1); ++ if (arg.empty() || !line.Token(4).empty()) ++ return; ++ double from = line.Token(2).ToDouble(); ++ double to = DBL_MAX; ++ if (!line.Token(3).empty()) ++ to = line.Token(3).ToDouble(); ++ int limit = -1; ++ if (CClient* client = GetClient()) ++ limit = GetLimit(client->GetIdentifier()); ++ std::vector chans = FindChans(arg); ++ for (CChan* chan : chans) { ++ if (chan->IsOn() && !chan->IsDetached()) { ++ CBuffer lines = GetLines(chan->GetBuffer(), from, to, limit); ++ m_play = true; ++ chan->SendBuffer(GetClient(), lines); ++ m_play = false; ++ } ++ } ++ std::vector queries = FindQueries(arg); ++ for (CQuery* query : queries) { ++ CBuffer lines = GetLines(query->GetBuffer(), from, to, limit); ++ m_play = true; ++ query->SendBuffer(GetClient(), lines); ++ m_play = false; ++ } ++ } ++ ++ void ListCommand(const CString& line) ++ { ++ // LIST [buffer(s)] ++ CString arg = line.Token(1); ++ if (arg.empty()) ++ arg = "*"; ++ std::vector chans = FindChans(arg); ++ for (CChan* chan : chans) { ++ if (chan->IsOn() && !chan->IsDetached()) { ++ CBuffer buffer = chan->GetBuffer(); ++ if (!buffer.IsEmpty()) { ++ timeval from = UniversalTime(buffer.GetBufLine(0).GetTime()); ++ timeval to = UniversalTime(buffer.GetBufLine(buffer.Size() - 1).GetTime()); ++ PutModule(chan->GetName() + " " + CString(Timestamp(from)) + " " + CString(Timestamp(to))); ++ } ++ } ++ } ++ std::vector queries = FindQueries(arg); ++ for (CQuery* query : queries) { ++ CBuffer buffer = query->GetBuffer(); ++ if (!buffer.IsEmpty()) { ++ timeval from = UniversalTime(buffer.GetBufLine(0).GetTime()); ++ timeval to = UniversalTime(buffer.GetBufLine(buffer.Size() - 1).GetTime()); ++ PutModule(query->GetName() + " " + CString(Timestamp(from)) + " " + CString(Timestamp(to))); ++ } ++ } ++ } ++ ++ void LimitCommand(const CString& line) ++ { ++ // LIMIT [limit] ++ const CString client = line.Token(1); ++ if (client.empty()) { ++ PutModule("Usage: LIMIT [limit]"); ++ return; ++ } ++ const CString arg = line.Token(2); ++ int limit = GetLimit(client); ++ if (!arg.empty()) { ++ limit = arg.ToInt(); ++ SetLimit(client, limit); ++ } ++ if (limit <= 0) ++ PutModule(client + " buffer limit: -"); ++ else ++ PutModule(client + " buffer limit: " + CString(limit)); ++ } ++ ++ EModRet OnSendToClient(CString& line, CClient& client) override ++ { ++ if (client.IsAttached() && client.IsCapEnabled(PlaybackCap) && !line.Token(0).Equals("CAP")) { ++ MCString tags = CUtils::GetMessageTags(line); ++ if (tags.find("time") == tags.end()) { ++ // CUtils::FormatServerTime() converts to UTC ++ tags["time"] = CUtils::FormatServerTime(LocalTime()); ++ CUtils::SetMessageTags(line, tags); ++ } ++ } ++ return CONTINUE; ++ } ++ ++private: ++ static double Timestamp(timeval tv) ++ { ++ return tv.tv_sec + tv.tv_usec / 1000000.0; ++ } ++ ++ static timeval LocalTime() ++ { ++ timeval tv; ++ if (gettimeofday(&tv, NULL) == -1) { ++ tv.tv_sec = time(NULL); ++ tv.tv_usec = 0; ++ } ++ return tv; ++ } ++ ++ static timeval UniversalTime(timeval tv = LocalTime()) ++ { ++ tm stm; ++ memset(&stm, 0, sizeof(stm)); ++ const time_t secs = tv.tv_sec; // OpenBSD has tv_sec as int, so explicitly convert it to time_t to make gmtime_r() happy ++ gmtime_r(&secs, &stm); ++ const char* tz = getenv("TZ"); ++ setenv("TZ", "UTC", 1); ++ tzset(); ++ tv.tv_sec = mktime(&stm); ++ if (tz) ++ setenv("TZ", tz, 1); ++ else ++ unsetenv("TZ"); ++ tzset(); ++ return tv; ++ } ++ ++ std::vector FindChans(const CString& arg) const ++ { ++ std::vector chans; ++ CIRCNetwork* network = GetNetwork(); ++ if (network) { ++ VCString vargs; ++ arg.Split(",", vargs, false); ++ ++ for (const CString& name : vargs) { ++ std::vector found = network->FindChans(name); ++ chans.insert(chans.end(), found.begin(), found.end()); ++ } ++ } ++ return chans; ++ } ++ ++ std::vector FindQueries(const CString& arg) const ++ { ++ std::vector queries; ++ CIRCNetwork* network = GetNetwork(); ++ if (network) { ++ VCString vargs; ++ arg.Split(",", vargs, false); ++ ++ for (const CString& name : vargs) { ++ std::vector found = network->FindQueries(name); ++ queries.insert(queries.end(), found.begin(), found.end()); ++ } ++ } ++ return queries; ++ } ++ ++ int GetLimit(const CString& client) const ++ { ++ return GetNV(client).ToInt(); ++ } ++ ++ void SetLimit(const CString& client, int limit) ++ { ++ if (limit > 0) ++ SetNV(client, CString(limit)); ++ else ++ DelNV(client); ++ } ++ ++ static CBuffer GetLines(const CBuffer& buffer, double from, double to, int limit) ++ { ++ CBuffer lines(buffer.Size()); ++ for (size_t i = 0; i < buffer.Size(); ++i) { ++ const CBufLine& line = buffer.GetBufLine(i); ++ timeval tv = UniversalTime(line.GetTime()); ++ if (from < Timestamp(tv) && to >= Timestamp(tv)) ++ lines.AddLine(line.GetFormat(), line.GetText(), &tv); ++ } ++ if (limit > 0) ++ lines.SetLineCount(limit); ++ return lines; ++ } ++ ++ bool m_play; ++}; ++ ++GLOBALMODULEDEFS(CPlaybackMod, "An advanced playback module for ZNC") diff --git a/sound/alsa-utils/Makefile b/sound/alsa-utils/Makefile new file mode 100644 index 0000000..0c01a6e --- /dev/null +++ b/sound/alsa-utils/Makefile @@ -0,0 +1,89 @@ +# +# Copyright (C) 2006-2016 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:=alsa-utils +PKG_VERSION:=1.1.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=ftp://ftp.alsa-project.org/pub/utils/ \ + http://alsa.cybermirror.org/utils/ +PKG_MD5SUM:=b9d6102fbbd0b68040bb77023ed30c0c +PKG_INSTALL:=1 +PKG_MAINTAINER:=Ted Hess + +include $(INCLUDE_DIR)/package.mk + +define Package/alsa-utils + SECTION:=sound + CATEGORY:=Sound + DEPENDS:=+alsa-lib +libncursesw +libpthread + TITLE:=ALSA (Advanced Linux Sound Architecture) utilities + URL:=http://www.alsa-project.org/ +endef + +define Package/alsa-utils-seq + SECTION:=sound + CATEGORY:=Sound + DEPENDS:=+alsa-lib +libpthread + TITLE:=ALSA sequencer utilities + URL:=http://www.alsa-project.org/ +endef + +define Package/alsa-utils-tests + SECTION:=sound + CATEGORY:=Sound + TITLE:=ALSA utilities test data (adds ~1.3M to image) + DEPENDS:=+alsa-lib +libpthread + URL:=http://www.alsa-project.org/ +endef + +CONFIGURE_ARGS+= \ + --disable-rpath \ + --disable-alsatest \ + --disable-bat \ + --disable-xmlto \ + --with-curses=ncursesw + +define Package/alsa-utils/install + $(INSTALL_DIR) $(1)/usr/{s,}bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/amixer $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/alsamixer $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/aplay $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/arecord $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/alsactl $(1)/usr/sbin/ + + $(INSTALL_DIR) $(1)/usr/share/alsa/init + $(INSTALL_DATA) \ + $(PKG_INSTALL_DIR)/usr/share/alsa/init/* \ + $(1)/usr/share/alsa/init/ +endef + +define Package/alsa-utils-seq/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/aconnect $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/amidi $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/aplaymidi $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/arecordmidi $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/aseqdump $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/aseqnet $(1)/usr/bin/ +endef + +define Package/alsa-utils-tests/install + $(INSTALL_DIR) $(1)/usr/{s,}bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/speaker-test $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/share/sounds/alsa + $(INSTALL_DATA) \ + $(PKG_INSTALL_DIR)/usr/share/sounds/alsa/* \ + $(1)/usr/share/sounds/alsa/ +endef + +$(eval $(call BuildPackage,alsa-utils)) +$(eval $(call BuildPackage,alsa-utils-seq)) +$(eval $(call BuildPackage,alsa-utils-tests)) diff --git a/sound/alsa-utils/patches/100-uClibc-compat.patch b/sound/alsa-utils/patches/100-uClibc-compat.patch new file mode 100644 index 0000000..987c9b8 --- /dev/null +++ b/sound/alsa-utils/patches/100-uClibc-compat.patch @@ -0,0 +1,23 @@ +--- a/alsamixer/volume_mapping.c ++++ b/alsamixer/volume_mapping.c +@@ -114,9 +114,9 @@ static double get_normalized_volume(snd_ + if (use_linear_dB_scale(min, max)) + return (value - min) / (double)(max - min); + +- normalized = exp10((value - max) / 6000.0); ++ normalized = pow(10, (value - max) / 6000.0); + if (min != SND_CTL_TLV_DB_GAIN_MUTE) { +- min_norm = exp10((min - max) / 6000.0); ++ min_norm = pow(10, (min - max) / 6000.0); + normalized = (normalized - min_norm) / (1 - min_norm); + } + +@@ -149,7 +149,7 @@ static int set_normalized_volume(snd_mix + } + + if (min != SND_CTL_TLV_DB_GAIN_MUTE) { +- min_norm = exp10((min - max) / 6000.0); ++ min_norm = pow(10, (min - max) / 6000.0); + volume = volume * (1 - min_norm) + min_norm; + } + value = lrint_dir(6000.0 * log10(volume), dir) + max; diff --git a/sound/espeak/Makefile b/sound/espeak/Makefile new file mode 100644 index 0000000..fd06c6e --- /dev/null +++ b/sound/espeak/Makefile @@ -0,0 +1,57 @@ +# +# 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:=espeak +PKG_VERSION:=1.48.04 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-source.zip +PKG_SOURCE_URL:=@SF/espeak +PKG_MD5SUM:=cadd7482eaafe9239546bdc09fa244c3 + +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=License.txt +PKG_MAINTAINER:=Nicolas Thill + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-source +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/espeak + SECTION:=sound + CATEGORY:=Sound + DEPENDS:=+libpthread +libstdcpp +portaudio + TITLE:=Speech synthesizer + URL:=http://espeak.sourceforge.net/ +endef + +define Package/espeak/description + eSpeak is a compact open source software speech synthesizer for English and + other languages. +endef + +MAKE_FLAGS+= \ + AUDIO="portaudio" \ + DATADIR="/usr/share/espeak" \ + CXXFLAGS="$(TARGET_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + +MAKE_PATH:=./src + +define Package/espeak/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/espeak $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libespeak.so.* $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/share + $(CP) $(PKG_INSTALL_DIR)/usr/share/espeak $(1)/usr/share/ +endef + +$(eval $(call BuildPackage,espeak)) diff --git a/sound/espeak/patches/101-portaudio.patch b/sound/espeak/patches/101-portaudio.patch new file mode 100644 index 0000000..ff396b3 --- /dev/null +++ b/sound/espeak/patches/101-portaudio.patch @@ -0,0 +1,2093 @@ +--- a/src/portaudio.h ++++ /dev/null +@@ -1,466 +0,0 @@ +-// NOTE: Copy this file to portaudio.h in order to compile with V18 portaudio +- +- +-#ifndef PORT_AUDIO_H +-#define PORT_AUDIO_H +- +-#ifdef __cplusplus +-extern "C" +-{ +-#endif /* __cplusplus */ +- +-/* +- * $Id: portaudio.h,v 1.5 2002/03/26 18:04:22 philburk Exp $ +- * PortAudio Portable Real-Time Audio Library +- * PortAudio API Header File +- * Latest version available at: http://www.audiomulch.com/portaudio/ +- * +- * Copyright (c) 1999-2000 Ross Bencina and Phil Burk +- * +- * Permission is hereby granted, free of charge, to any person obtaining +- * a copy of this software and associated documentation files +- * (the "Software"), to deal in the Software without restriction, +- * including without limitation the rights to use, copy, modify, merge, +- * publish, distribute, sublicense, and/or sell copies of the Software, +- * and to permit persons to whom the Software is furnished to do so, +- * subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be +- * included in all copies or substantial portions of the Software. +- * +- * Any person wishing to distribute modifications to the Software is +- * requested to send the modifications to the original developer so that +- * they can be incorporated into the canonical version. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +- * +- */ +- +-typedef int PaError; +-typedef enum { +- paNoError = 0, +- +- paHostError = -10000, +- paInvalidChannelCount, +- paInvalidSampleRate, +- paInvalidDeviceId, +- paInvalidFlag, +- paSampleFormatNotSupported, +- paBadIODeviceCombination, +- paInsufficientMemory, +- paBufferTooBig, +- paBufferTooSmall, +- paNullCallback, +- paBadStreamPtr, +- paTimedOut, +- paInternalError, +- paDeviceUnavailable +-} PaErrorNum; +- +-/* +- Pa_Initialize() is the library initialisation function - call this before +- using the library. +- +-*/ +- +-PaError Pa_Initialize( void ); +- +-/* +- Pa_Terminate() is the library termination function - call this after +- using the library. +- +-*/ +- +-PaError Pa_Terminate( void ); +- +-/* +- Pa_GetHostError() returns a host specific error code. +- This can be called after receiving a PortAudio error code of paHostError. +- +-*/ +- +-long Pa_GetHostError( void ); +- +-/* +- Pa_GetErrorText() translates the supplied PortAudio error number +- into a human readable message. +- +-*/ +- +-const char *Pa_GetErrorText( PaError errnum ); +- +-/* +- Sample formats +- +- These are formats used to pass sound data between the callback and the +- stream. Each device has a "native" format which may be used when optimum +- efficiency or control over conversion is required. +- +- Formats marked "always available" are supported (emulated) by all +- PortAudio implementations. +- +- The floating point representation (paFloat32) uses +1.0 and -1.0 as the +- maximum and minimum respectively. +- +- paUInt8 is an unsigned 8 bit format where 128 is considered "ground" +- +-*/ +- +-typedef unsigned long PaSampleFormat; +-#define paFloat32 ((PaSampleFormat) (1<<0)) /*always available*/ +-#define paInt16 ((PaSampleFormat) (1<<1)) /*always available*/ +-#define paInt32 ((PaSampleFormat) (1<<2)) /*always available*/ +-#define paInt24 ((PaSampleFormat) (1<<3)) +-#define paPackedInt24 ((PaSampleFormat) (1<<4)) +-#define paInt8 ((PaSampleFormat) (1<<5)) +-#define paUInt8 ((PaSampleFormat) (1<<6)) +-#define paCustomFormat ((PaSampleFormat) (1<<16)) +- +-/* +- Device enumeration mechanism. +- +- Device ids range from 0 to Pa_CountDevices()-1. +- +- Devices may support input, output or both. +- +-*/ +- +-typedef int PaDeviceID; +-#define paNoDevice -1 +- +-int Pa_CountDevices( void ); +- +-typedef struct +-{ +- int structVersion; +- const char *name; +- int maxInputChannels; +- int maxOutputChannels; +- /* Number of discrete rates, or -1 if range supported. */ +- int numSampleRates; +- /* Array of supported sample rates, or {min,max} if range supported. */ +- const double *sampleRates; +- PaSampleFormat nativeSampleFormats; +-} +-PaDeviceInfo; +- +-/* +- Pa_GetDefaultInputDeviceID(), Pa_GetDefaultOutputDeviceID() return the +- default device ids for input and output respectively, or paNoDevice if +- no device is available. +- The result can be passed to Pa_OpenStream(). +- +- On the PC, the user can specify a default device by +- setting an environment variable. For example, to use device #1. +- +- set PA_RECOMMENDED_OUTPUT_DEVICE=1 +- +- The user should first determine the available device ids by using +- the supplied application "pa_devs". +- +-*/ +- +-PaDeviceID Pa_GetDefaultInputDeviceID( void ); +-PaDeviceID Pa_GetDefaultOutputDeviceID( void ); +- +- +- +-/* +- Pa_GetDeviceInfo() returns a pointer to an immutable PaDeviceInfo structure +- for the device specified. +- If the device parameter is out of range the function returns NULL. +- +- PortAudio manages the memory referenced by the returned pointer, the client +- must not manipulate or free the memory. The pointer is only guaranteed to be +- valid between calls to Pa_Initialize() and Pa_Terminate(). +- +-*/ +- +-const PaDeviceInfo* Pa_GetDeviceInfo( PaDeviceID device ); +- +-/* +- PaTimestamp is used to represent a continuous sample clock with arbitrary +- start time that can be used for syncronization. The type is used for the +- outTime argument to the PortAudioCallback and as the result of Pa_StreamTime() +- +-*/ +- +-typedef double PaTimestamp; +- +-/* +- PortAudioCallback is implemented by PortAudio clients. +- +- inputBuffer and outputBuffer are arrays of interleaved samples, +- the format, packing and number of channels used by the buffers are +- determined by parameters to Pa_OpenStream() (see below). +- +- framesPerBuffer is the number of sample frames to be processed by the callback. +- +- outTime is the time in samples when the buffer(s) processed by +- this callback will begin being played at the audio output. +- See also Pa_StreamTime() +- +- userData is the value of a user supplied pointer passed to Pa_OpenStream() +- intended for storing synthesis data etc. +- +- return value: +- The callback can return a non-zero value to stop the stream. This may be +- useful in applications such as soundfile players where a specific duration +- of output is required. However, it is not necessary to utilise this mechanism +- as StopStream() will also terminate the stream. A callback returning a +- non-zero value must fill the entire outputBuffer. +- +- NOTE: None of the other stream functions may be called from within the +- callback function except for Pa_GetCPULoad(). +- +-*/ +- +-typedef int (PortAudioCallback)( +- void *inputBuffer, void *outputBuffer, +- unsigned long framesPerBuffer, +- PaTimestamp outTime, void *userData ); +- +- +-/* +- Stream flags +- +- These flags may be supplied (ored together) in the streamFlags argument to +- the Pa_OpenStream() function. +- +-*/ +- +-#define paNoFlag (0) +-#define paClipOff (1<<0) /* disable default clipping of out of range samples */ +-#define paDitherOff (1<<1) /* disable default dithering */ +-#define paPlatformSpecificFlags (0x00010000) +-typedef unsigned long PaStreamFlags; +- +-/* +- A single PortAudioStream provides multiple channels of real-time +- input and output audio streaming to a client application. +- Pointers to PortAudioStream objects are passed between PortAudio functions. +-*/ +- +-typedef void PortAudioStream; +-#define PaStream PortAudioStream +- +-/* +- Pa_OpenStream() opens a stream for either input, output or both. +- +- stream is the address of a PortAudioStream pointer which will receive +- a pointer to the newly opened stream. +- +- inputDevice is the id of the device used for input (see PaDeviceID above.) +- inputDevice may be paNoDevice to indicate that an input device is not required. +- +- numInputChannels is the number of channels of sound to be delivered to the +- callback. It can range from 1 to the value of maxInputChannels in the +- PaDeviceInfo record for the device specified by the inputDevice parameter. +- If inputDevice is paNoDevice numInputChannels is ignored. +- +- inputSampleFormat is the sample format of inputBuffer provided to the callback +- function. inputSampleFormat may be any of the formats described by the +- PaSampleFormat enumeration (see above). PortAudio guarantees support for +- the device's native formats (nativeSampleFormats in the device info record) +- and additionally 16 and 32 bit integer and 32 bit floating point formats. +- Support for other formats is implementation defined. +- +- inputDriverInfo is a pointer to an optional driver specific data structure +- containing additional information for device setup or stream processing. +- inputDriverInfo is never required for correct operation. If not used +- inputDriverInfo should be NULL. +- +- outputDevice is the id of the device used for output (see PaDeviceID above.) +- outputDevice may be paNoDevice to indicate that an output device is not required. +- +- numOutputChannels is the number of channels of sound to be supplied by the +- callback. See the definition of numInputChannels above for more details. +- +- outputSampleFormat is the sample format of the outputBuffer filled by the +- callback function. See the definition of inputSampleFormat above for more +- details. +- +- outputDriverInfo is a pointer to an optional driver specific data structure +- containing additional information for device setup or stream processing. +- outputDriverInfo is never required for correct operation. If not used +- outputDriverInfo should be NULL. +- +- sampleRate is the desired sampleRate. For full-duplex streams it is the +- sample rate for both input and output +- +- framesPerBuffer is the length in sample frames of all internal sample buffers +- used for communication with platform specific audio routines. Wherever +- possible this corresponds to the framesPerBuffer parameter passed to the +- callback function. +- +- numberOfBuffers is the number of buffers used for multibuffered communication +- with the platform specific audio routines. If you pass zero, then an optimum +- value will be chosen for you internally. This parameter is provided only +- as a guide - and does not imply that an implementation must use multibuffered +- i/o when reliable double buffering is available (such as SndPlayDoubleBuffer() +- on the Macintosh.) +- +- streamFlags may contain a combination of flags ORed together. +- These flags modify the behaviour of the streaming process. Some flags may only +- be relevant to certain buffer formats. +- +- callback is a pointer to a client supplied function that is responsible +- for processing and filling input and output buffers (see above for details.) +- +- userData is a client supplied pointer which is passed to the callback +- function. It could for example, contain a pointer to instance data necessary +- for processing the audio buffers. +- +- return value: +- Upon success Pa_OpenStream() returns PaNoError and places a pointer to a +- valid PortAudioStream in the stream argument. The stream is inactive (stopped). +- If a call to Pa_OpenStream() fails a non-zero error code is returned (see +- PaError above) and the value of stream is invalid. +- +-*/ +- +-PaError Pa_OpenStream( PortAudioStream** stream, +- PaDeviceID inputDevice, +- int numInputChannels, +- PaSampleFormat inputSampleFormat, +- void *inputDriverInfo, +- PaDeviceID outputDevice, +- int numOutputChannels, +- PaSampleFormat outputSampleFormat, +- void *outputDriverInfo, +- double sampleRate, +- unsigned long framesPerBuffer, +- unsigned long numberOfBuffers, +- PaStreamFlags streamFlags, +- PortAudioCallback *callback, +- void *userData ); +- +- +-/* +- Pa_OpenDefaultStream() is a simplified version of Pa_OpenStream() that opens +- the default input and/or output devices. Most parameters have identical meaning +- to their Pa_OpenStream() counterparts, with the following exceptions: +- +- If either numInputChannels or numOutputChannels is 0 the respective device +- is not opened. This has the same effect as passing paNoDevice in the device +- arguments to Pa_OpenStream(). +- +- sampleFormat applies to both the input and output buffers. +- +-*/ +- +-PaError Pa_OpenDefaultStream( PortAudioStream** stream, +- int numInputChannels, +- int numOutputChannels, +- PaSampleFormat sampleFormat, +- double sampleRate, +- unsigned long framesPerBuffer, +- unsigned long numberOfBuffers, +- PortAudioCallback *callback, +- void *userData ); +- +-/* +- Pa_CloseStream() closes an audio stream, flushing any pending buffers. +- +-*/ +- +-PaError Pa_CloseStream( PortAudioStream* ); +- +-/* +- Pa_StartStream() and Pa_StopStream() begin and terminate audio processing. +- Pa_StopStream() waits until all pending audio buffers have been played. +- Pa_AbortStream() stops playing immediately without waiting for pending +- buffers to complete. +- +-*/ +- +-PaError Pa_StartStream( PortAudioStream *stream ); +- +-PaError Pa_StopStream( PortAudioStream *stream ); +- +-PaError Pa_AbortStream( PortAudioStream *stream ); +- +-/* +- Pa_StreamActive() returns one (1) when the stream is active (ie playing +- or recording audio), zero (0) when not playing, or a negative error number +- if the stream is invalid. +- The stream is active between calls to Pa_StartStream() and Pa_StopStream(), +- but may also become inactive if the callback returns a non-zero value. +- In the latter case, the stream is considered inactive after the last +- buffer has finished playing. +- +-*/ +- +-PaError Pa_StreamActive( PortAudioStream *stream ); +- +-/* +- Pa_StreamTime() returns the current output time in samples for the stream. +- This time may be used as a time reference (for example synchronizing audio to +- MIDI). +- +-*/ +- +-PaTimestamp Pa_StreamTime( PortAudioStream *stream ); +- +-/* +- Pa_GetCPULoad() returns the CPU Load for the stream. +- The "CPU Load" is a fraction of total CPU time consumed by the stream's +- audio processing routines including, but not limited to the client supplied +- callback. +- A value of 0.5 would imply that PortAudio and the sound generating +- callback was consuming roughly 50% of the available CPU time. +- This function may be called from the callback function or the application. +- +-*/ +- +-double Pa_GetCPULoad( PortAudioStream* stream ); +- +-/* +- Pa_GetMinNumBuffers() returns the minimum number of buffers required by +- the current host based on minimum latency. +- On the PC, for the DirectSound implementation, latency can be optionally set +- by user by setting an environment variable. +- For example, to set latency to 200 msec, put: +- +- set PA_MIN_LATENCY_MSEC=200 +- +- in the AUTOEXEC.BAT file and reboot. +- If the environment variable is not set, then the latency will be determined +- based on the OS. Windows NT has higher latency than Win95. +- +-*/ +- +-int Pa_GetMinNumBuffers( int framesPerBuffer, double sampleRate ); +- +-/* +- Pa_Sleep() puts the caller to sleep for at least 'msec' milliseconds. +- You may sleep longer than the requested time so don't rely on this for +- accurate musical timing. +- +- Pa_Sleep() is provided as a convenience for authors of portable code (such as +- the tests and examples in the PortAudio distribution.) +- +-*/ +- +-void Pa_Sleep( long msec ); +- +-/* +- Pa_GetSampleSize() returns the size in bytes of a single sample in the +- supplied PaSampleFormat, or paSampleFormatNotSupported if the format is +- no supported. +- +-*/ +- +-PaError Pa_GetSampleSize( PaSampleFormat format ); +- +- +-#ifdef __cplusplus +-} +-#endif /* __cplusplus */ +-#endif /* PORT_AUDIO_H */ +--- a/src/portaudio18.h ++++ /dev/null +@@ -1,466 +0,0 @@ +-// NOTE: Copy this file to portaudio.h in order to compile with V18 portaudio +- +- +-#ifndef PORT_AUDIO_H +-#define PORT_AUDIO_H +- +-#ifdef __cplusplus +-extern "C" +-{ +-#endif /* __cplusplus */ +- +-/* +- * $Id: portaudio.h,v 1.5 2002/03/26 18:04:22 philburk Exp $ +- * PortAudio Portable Real-Time Audio Library +- * PortAudio API Header File +- * Latest version available at: http://www.audiomulch.com/portaudio/ +- * +- * Copyright (c) 1999-2000 Ross Bencina and Phil Burk +- * +- * Permission is hereby granted, free of charge, to any person obtaining +- * a copy of this software and associated documentation files +- * (the "Software"), to deal in the Software without restriction, +- * including without limitation the rights to use, copy, modify, merge, +- * publish, distribute, sublicense, and/or sell copies of the Software, +- * and to permit persons to whom the Software is furnished to do so, +- * subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be +- * included in all copies or substantial portions of the Software. +- * +- * Any person wishing to distribute modifications to the Software is +- * requested to send the modifications to the original developer so that +- * they can be incorporated into the canonical version. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +- * +- */ +- +-typedef int PaError; +-typedef enum { +- paNoError = 0, +- +- paHostError = -10000, +- paInvalidChannelCount, +- paInvalidSampleRate, +- paInvalidDeviceId, +- paInvalidFlag, +- paSampleFormatNotSupported, +- paBadIODeviceCombination, +- paInsufficientMemory, +- paBufferTooBig, +- paBufferTooSmall, +- paNullCallback, +- paBadStreamPtr, +- paTimedOut, +- paInternalError, +- paDeviceUnavailable +-} PaErrorNum; +- +-/* +- Pa_Initialize() is the library initialisation function - call this before +- using the library. +- +-*/ +- +-PaError Pa_Initialize( void ); +- +-/* +- Pa_Terminate() is the library termination function - call this after +- using the library. +- +-*/ +- +-PaError Pa_Terminate( void ); +- +-/* +- Pa_GetHostError() returns a host specific error code. +- This can be called after receiving a PortAudio error code of paHostError. +- +-*/ +- +-long Pa_GetHostError( void ); +- +-/* +- Pa_GetErrorText() translates the supplied PortAudio error number +- into a human readable message. +- +-*/ +- +-const char *Pa_GetErrorText( PaError errnum ); +- +-/* +- Sample formats +- +- These are formats used to pass sound data between the callback and the +- stream. Each device has a "native" format which may be used when optimum +- efficiency or control over conversion is required. +- +- Formats marked "always available" are supported (emulated) by all +- PortAudio implementations. +- +- The floating point representation (paFloat32) uses +1.0 and -1.0 as the +- maximum and minimum respectively. +- +- paUInt8 is an unsigned 8 bit format where 128 is considered "ground" +- +-*/ +- +-typedef unsigned long PaSampleFormat; +-#define paFloat32 ((PaSampleFormat) (1<<0)) /*always available*/ +-#define paInt16 ((PaSampleFormat) (1<<1)) /*always available*/ +-#define paInt32 ((PaSampleFormat) (1<<2)) /*always available*/ +-#define paInt24 ((PaSampleFormat) (1<<3)) +-#define paPackedInt24 ((PaSampleFormat) (1<<4)) +-#define paInt8 ((PaSampleFormat) (1<<5)) +-#define paUInt8 ((PaSampleFormat) (1<<6)) +-#define paCustomFormat ((PaSampleFormat) (1<<16)) +- +-/* +- Device enumeration mechanism. +- +- Device ids range from 0 to Pa_CountDevices()-1. +- +- Devices may support input, output or both. +- +-*/ +- +-typedef int PaDeviceID; +-#define paNoDevice -1 +- +-int Pa_CountDevices( void ); +- +-typedef struct +-{ +- int structVersion; +- const char *name; +- int maxInputChannels; +- int maxOutputChannels; +- /* Number of discrete rates, or -1 if range supported. */ +- int numSampleRates; +- /* Array of supported sample rates, or {min,max} if range supported. */ +- const double *sampleRates; +- PaSampleFormat nativeSampleFormats; +-} +-PaDeviceInfo; +- +-/* +- Pa_GetDefaultInputDeviceID(), Pa_GetDefaultOutputDeviceID() return the +- default device ids for input and output respectively, or paNoDevice if +- no device is available. +- The result can be passed to Pa_OpenStream(). +- +- On the PC, the user can specify a default device by +- setting an environment variable. For example, to use device #1. +- +- set PA_RECOMMENDED_OUTPUT_DEVICE=1 +- +- The user should first determine the available device ids by using +- the supplied application "pa_devs". +- +-*/ +- +-PaDeviceID Pa_GetDefaultInputDeviceID( void ); +-PaDeviceID Pa_GetDefaultOutputDeviceID( void ); +- +- +- +-/* +- Pa_GetDeviceInfo() returns a pointer to an immutable PaDeviceInfo structure +- for the device specified. +- If the device parameter is out of range the function returns NULL. +- +- PortAudio manages the memory referenced by the returned pointer, the client +- must not manipulate or free the memory. The pointer is only guaranteed to be +- valid between calls to Pa_Initialize() and Pa_Terminate(). +- +-*/ +- +-const PaDeviceInfo* Pa_GetDeviceInfo( PaDeviceID device ); +- +-/* +- PaTimestamp is used to represent a continuous sample clock with arbitrary +- start time that can be used for syncronization. The type is used for the +- outTime argument to the PortAudioCallback and as the result of Pa_StreamTime() +- +-*/ +- +-typedef double PaTimestamp; +- +-/* +- PortAudioCallback is implemented by PortAudio clients. +- +- inputBuffer and outputBuffer are arrays of interleaved samples, +- the format, packing and number of channels used by the buffers are +- determined by parameters to Pa_OpenStream() (see below). +- +- framesPerBuffer is the number of sample frames to be processed by the callback. +- +- outTime is the time in samples when the buffer(s) processed by +- this callback will begin being played at the audio output. +- See also Pa_StreamTime() +- +- userData is the value of a user supplied pointer passed to Pa_OpenStream() +- intended for storing synthesis data etc. +- +- return value: +- The callback can return a non-zero value to stop the stream. This may be +- useful in applications such as soundfile players where a specific duration +- of output is required. However, it is not necessary to utilise this mechanism +- as StopStream() will also terminate the stream. A callback returning a +- non-zero value must fill the entire outputBuffer. +- +- NOTE: None of the other stream functions may be called from within the +- callback function except for Pa_GetCPULoad(). +- +-*/ +- +-typedef int (PortAudioCallback)( +- void *inputBuffer, void *outputBuffer, +- unsigned long framesPerBuffer, +- PaTimestamp outTime, void *userData ); +- +- +-/* +- Stream flags +- +- These flags may be supplied (ored together) in the streamFlags argument to +- the Pa_OpenStream() function. +- +-*/ +- +-#define paNoFlag (0) +-#define paClipOff (1<<0) /* disable default clipping of out of range samples */ +-#define paDitherOff (1<<1) /* disable default dithering */ +-#define paPlatformSpecificFlags (0x00010000) +-typedef unsigned long PaStreamFlags; +- +-/* +- A single PortAudioStream provides multiple channels of real-time +- input and output audio streaming to a client application. +- Pointers to PortAudioStream objects are passed between PortAudio functions. +-*/ +- +-typedef void PortAudioStream; +-#define PaStream PortAudioStream +- +-/* +- Pa_OpenStream() opens a stream for either input, output or both. +- +- stream is the address of a PortAudioStream pointer which will receive +- a pointer to the newly opened stream. +- +- inputDevice is the id of the device used for input (see PaDeviceID above.) +- inputDevice may be paNoDevice to indicate that an input device is not required. +- +- numInputChannels is the number of channels of sound to be delivered to the +- callback. It can range from 1 to the value of maxInputChannels in the +- PaDeviceInfo record for the device specified by the inputDevice parameter. +- If inputDevice is paNoDevice numInputChannels is ignored. +- +- inputSampleFormat is the sample format of inputBuffer provided to the callback +- function. inputSampleFormat may be any of the formats described by the +- PaSampleFormat enumeration (see above). PortAudio guarantees support for +- the device's native formats (nativeSampleFormats in the device info record) +- and additionally 16 and 32 bit integer and 32 bit floating point formats. +- Support for other formats is implementation defined. +- +- inputDriverInfo is a pointer to an optional driver specific data structure +- containing additional information for device setup or stream processing. +- inputDriverInfo is never required for correct operation. If not used +- inputDriverInfo should be NULL. +- +- outputDevice is the id of the device used for output (see PaDeviceID above.) +- outputDevice may be paNoDevice to indicate that an output device is not required. +- +- numOutputChannels is the number of channels of sound to be supplied by the +- callback. See the definition of numInputChannels above for more details. +- +- outputSampleFormat is the sample format of the outputBuffer filled by the +- callback function. See the definition of inputSampleFormat above for more +- details. +- +- outputDriverInfo is a pointer to an optional driver specific data structure +- containing additional information for device setup or stream processing. +- outputDriverInfo is never required for correct operation. If not used +- outputDriverInfo should be NULL. +- +- sampleRate is the desired sampleRate. For full-duplex streams it is the +- sample rate for both input and output +- +- framesPerBuffer is the length in sample frames of all internal sample buffers +- used for communication with platform specific audio routines. Wherever +- possible this corresponds to the framesPerBuffer parameter passed to the +- callback function. +- +- numberOfBuffers is the number of buffers used for multibuffered communication +- with the platform specific audio routines. If you pass zero, then an optimum +- value will be chosen for you internally. This parameter is provided only +- as a guide - and does not imply that an implementation must use multibuffered +- i/o when reliable double buffering is available (such as SndPlayDoubleBuffer() +- on the Macintosh.) +- +- streamFlags may contain a combination of flags ORed together. +- These flags modify the behaviour of the streaming process. Some flags may only +- be relevant to certain buffer formats. +- +- callback is a pointer to a client supplied function that is responsible +- for processing and filling input and output buffers (see above for details.) +- +- userData is a client supplied pointer which is passed to the callback +- function. It could for example, contain a pointer to instance data necessary +- for processing the audio buffers. +- +- return value: +- Upon success Pa_OpenStream() returns PaNoError and places a pointer to a +- valid PortAudioStream in the stream argument. The stream is inactive (stopped). +- If a call to Pa_OpenStream() fails a non-zero error code is returned (see +- PaError above) and the value of stream is invalid. +- +-*/ +- +-PaError Pa_OpenStream( PortAudioStream** stream, +- PaDeviceID inputDevice, +- int numInputChannels, +- PaSampleFormat inputSampleFormat, +- void *inputDriverInfo, +- PaDeviceID outputDevice, +- int numOutputChannels, +- PaSampleFormat outputSampleFormat, +- void *outputDriverInfo, +- double sampleRate, +- unsigned long framesPerBuffer, +- unsigned long numberOfBuffers, +- PaStreamFlags streamFlags, +- PortAudioCallback *callback, +- void *userData ); +- +- +-/* +- Pa_OpenDefaultStream() is a simplified version of Pa_OpenStream() that opens +- the default input and/or output devices. Most parameters have identical meaning +- to their Pa_OpenStream() counterparts, with the following exceptions: +- +- If either numInputChannels or numOutputChannels is 0 the respective device +- is not opened. This has the same effect as passing paNoDevice in the device +- arguments to Pa_OpenStream(). +- +- sampleFormat applies to both the input and output buffers. +- +-*/ +- +-PaError Pa_OpenDefaultStream( PortAudioStream** stream, +- int numInputChannels, +- int numOutputChannels, +- PaSampleFormat sampleFormat, +- double sampleRate, +- unsigned long framesPerBuffer, +- unsigned long numberOfBuffers, +- PortAudioCallback *callback, +- void *userData ); +- +-/* +- Pa_CloseStream() closes an audio stream, flushing any pending buffers. +- +-*/ +- +-PaError Pa_CloseStream( PortAudioStream* ); +- +-/* +- Pa_StartStream() and Pa_StopStream() begin and terminate audio processing. +- Pa_StopStream() waits until all pending audio buffers have been played. +- Pa_AbortStream() stops playing immediately without waiting for pending +- buffers to complete. +- +-*/ +- +-PaError Pa_StartStream( PortAudioStream *stream ); +- +-PaError Pa_StopStream( PortAudioStream *stream ); +- +-PaError Pa_AbortStream( PortAudioStream *stream ); +- +-/* +- Pa_StreamActive() returns one (1) when the stream is active (ie playing +- or recording audio), zero (0) when not playing, or a negative error number +- if the stream is invalid. +- The stream is active between calls to Pa_StartStream() and Pa_StopStream(), +- but may also become inactive if the callback returns a non-zero value. +- In the latter case, the stream is considered inactive after the last +- buffer has finished playing. +- +-*/ +- +-PaError Pa_StreamActive( PortAudioStream *stream ); +- +-/* +- Pa_StreamTime() returns the current output time in samples for the stream. +- This time may be used as a time reference (for example synchronizing audio to +- MIDI). +- +-*/ +- +-PaTimestamp Pa_StreamTime( PortAudioStream *stream ); +- +-/* +- Pa_GetCPULoad() returns the CPU Load for the stream. +- The "CPU Load" is a fraction of total CPU time consumed by the stream's +- audio processing routines including, but not limited to the client supplied +- callback. +- A value of 0.5 would imply that PortAudio and the sound generating +- callback was consuming roughly 50% of the available CPU time. +- This function may be called from the callback function or the application. +- +-*/ +- +-double Pa_GetCPULoad( PortAudioStream* stream ); +- +-/* +- Pa_GetMinNumBuffers() returns the minimum number of buffers required by +- the current host based on minimum latency. +- On the PC, for the DirectSound implementation, latency can be optionally set +- by user by setting an environment variable. +- For example, to set latency to 200 msec, put: +- +- set PA_MIN_LATENCY_MSEC=200 +- +- in the AUTOEXEC.BAT file and reboot. +- If the environment variable is not set, then the latency will be determined +- based on the OS. Windows NT has higher latency than Win95. +- +-*/ +- +-int Pa_GetMinNumBuffers( int framesPerBuffer, double sampleRate ); +- +-/* +- Pa_Sleep() puts the caller to sleep for at least 'msec' milliseconds. +- You may sleep longer than the requested time so don't rely on this for +- accurate musical timing. +- +- Pa_Sleep() is provided as a convenience for authors of portable code (such as +- the tests and examples in the PortAudio distribution.) +- +-*/ +- +-void Pa_Sleep( long msec ); +- +-/* +- Pa_GetSampleSize() returns the size in bytes of a single sample in the +- supplied PaSampleFormat, or paSampleFormatNotSupported if the format is +- no supported. +- +-*/ +- +-PaError Pa_GetSampleSize( PaSampleFormat format ); +- +- +-#ifdef __cplusplus +-} +-#endif /* __cplusplus */ +-#endif /* PORT_AUDIO_H */ +--- a/src/portaudio19.h ++++ /dev/null +@@ -1,1127 +0,0 @@ +-// NOTE: Copy this file to portaudio.h in order to compile with V19 portaudio +- +-#ifndef PORTAUDIO_H +-#define PORTAUDIO_H +-/* +- * $Id: portaudio.h 1061 2006-06-19 22:46:41Z lschwardt $ +- * PortAudio Portable Real-Time Audio Library +- * PortAudio API Header File +- * Latest version available at: http://www.portaudio.com/ +- * +- * Copyright (c) 1999-2002 Ross Bencina and Phil Burk +- * +- * Permission is hereby granted, free of charge, to any person obtaining +- * a copy of this software and associated documentation files +- * (the "Software"), to deal in the Software without restriction, +- * including without limitation the rights to use, copy, modify, merge, +- * publish, distribute, sublicense, and/or sell copies of the Software, +- * and to permit persons to whom the Software is furnished to do so, +- * subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be +- * included in all copies or substantial portions of the Software. +- * +- * Any person wishing to distribute modifications to the Software is +- * requested to send the modifications to the original developer so that +- * they can be incorporated into the canonical version. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +- */ +- +-/** @file +- @brief The PortAudio API. +-*/ +- +- +-#ifdef __cplusplus +-extern "C" +-{ +-#endif /* __cplusplus */ +- +- +-/** Retrieve the release number of the currently running PortAudio build, +- eg 1900. +-*/ +-int Pa_GetVersion( void ); +- +- +-/** Retrieve a textual description of the current PortAudio build, +- eg "PortAudio V19-devel 13 October 2002". +-*/ +-const char* Pa_GetVersionText( void ); +- +- +-/** Error codes returned by PortAudio functions. +- Note that with the exception of paNoError, all PaErrorCodes are negative. +-*/ +- +-typedef int PaError; +-typedef enum PaErrorCode +-{ +- paNoError = 0, +- +- paNotInitialized = -10000, +- paUnanticipatedHostError, +- paInvalidChannelCount, +- paInvalidSampleRate, +- paInvalidDevice, +- paInvalidFlag, +- paSampleFormatNotSupported, +- paBadIODeviceCombination, +- paInsufficientMemory, +- paBufferTooBig, +- paBufferTooSmall, +- paNullCallback, +- paBadStreamPtr, +- paTimedOut, +- paInternalError, +- paDeviceUnavailable, +- paIncompatibleHostApiSpecificStreamInfo, +- paStreamIsStopped, +- paStreamIsNotStopped, +- paInputOverflowed, +- paOutputUnderflowed, +- paHostApiNotFound, +- paInvalidHostApi, +- paCanNotReadFromACallbackStream, /**< @todo review error code name */ +- paCanNotWriteToACallbackStream, /**< @todo review error code name */ +- paCanNotReadFromAnOutputOnlyStream, /**< @todo review error code name */ +- paCanNotWriteToAnInputOnlyStream, /**< @todo review error code name */ +- paIncompatibleStreamHostApi, +- paBadBufferPtr +-} PaErrorCode; +- +- +-/** Translate the supplied PortAudio error code into a human readable +- message. +-*/ +-const char *Pa_GetErrorText( PaError errorCode ); +- +- +-/** Library initialization function - call this before using PortAudio. +- This function initialises internal data structures and prepares underlying +- host APIs for use. This function MUST be called before using any other +- PortAudio API functions. +- +- If Pa_Initialize() is called multiple times, each successful +- call must be matched with a corresponding call to Pa_Terminate(). +- Pairs of calls to Pa_Initialize()/Pa_Terminate() may overlap, and are not +- required to be fully nested. +- +- Note that if Pa_Initialize() returns an error code, Pa_Terminate() should +- NOT be called. +- +- @return paNoError if successful, otherwise an error code indicating the cause +- of failure. +- +- @see Pa_Terminate +-*/ +-PaError Pa_Initialize( void ); +- +- +-/** Library termination function - call this when finished using PortAudio. +- This function deallocates all resources allocated by PortAudio since it was +- initializied by a call to Pa_Initialize(). In cases where Pa_Initialise() has +- been called multiple times, each call must be matched with a corresponding call +- to Pa_Terminate(). The final matching call to Pa_Terminate() will automatically +- close any PortAudio streams that are still open. +- +- Pa_Terminate() MUST be called before exiting a program which uses PortAudio. +- Failure to do so may result in serious resource leaks, such as audio devices +- not being available until the next reboot. +- +- @return paNoError if successful, otherwise an error code indicating the cause +- of failure. +- +- @see Pa_Initialize +-*/ +-PaError Pa_Terminate( void ); +- +- +- +-/** The type used to refer to audio devices. Values of this type usually +- range from 0 to (Pa_DeviceCount-1), and may also take on the PaNoDevice +- and paUseHostApiSpecificDeviceSpecification values. +- +- @see Pa_DeviceCount, paNoDevice, paUseHostApiSpecificDeviceSpecification +-*/ +-typedef int PaDeviceIndex; +- +- +-/** A special PaDeviceIndex value indicating that no device is available, +- or should be used. +- +- @see PaDeviceIndex +-*/ +-#define paNoDevice ((PaDeviceIndex)-1) +- +- +-/** A special PaDeviceIndex value indicating that the device(s) to be used +- are specified in the host api specific stream info structure. +- +- @see PaDeviceIndex +-*/ +-#define paUseHostApiSpecificDeviceSpecification ((PaDeviceIndex)-2) +- +- +-/* Host API enumeration mechanism */ +- +-/** The type used to enumerate to host APIs at runtime. Values of this type +- range from 0 to (Pa_GetHostApiCount()-1). +- +- @see Pa_GetHostApiCount +-*/ +-typedef int PaHostApiIndex; +- +- +-/** Retrieve the number of available host APIs. Even if a host API is +- available it may have no devices available. +- +- @return A non-negative value indicating the number of available host APIs +- or, a PaErrorCode (which are always negative) if PortAudio is not initialized +- or an error is encountered. +- +- @see PaHostApiIndex +-*/ +-PaHostApiIndex Pa_GetHostApiCount( void ); +- +- +-/** Retrieve the index of the default host API. The default host API will be +- the lowest common denominator host API on the current platform and is +- unlikely to provide the best performance. +- +- @return A non-negative value ranging from 0 to (Pa_GetHostApiCount()-1) +- indicating the default host API index or, a PaErrorCode (which are always +- negative) if PortAudio is not initialized or an error is encountered. +-*/ +-PaHostApiIndex Pa_GetDefaultHostApi( void ); +- +- +-/** Unchanging unique identifiers for each supported host API. This type +- is used in the PaHostApiInfo structure. The values are guaranteed to be +- unique and to never change, thus allowing code to be written that +- conditionally uses host API specific extensions. +- +- New type ids will be allocated when support for a host API reaches +- "public alpha" status, prior to that developers should use the +- paInDevelopment type id. +- +- @see PaHostApiInfo +-*/ +-typedef enum PaHostApiTypeId +-{ +- paInDevelopment=0, /* use while developing support for a new host API */ +- paDirectSound=1, +- paMME=2, +- paASIO=3, +- paSoundManager=4, +- paCoreAudio=5, +- paOSS=7, +- paALSA=8, +- paAL=9, +- paBeOS=10, +- paWDMKS=11, +- paJACK=12, +- paWASAPI=13, +- paAudioScienceHPI=14 +-} PaHostApiTypeId; +- +- +-/** A structure containing information about a particular host API. */ +- +-typedef struct PaHostApiInfo +-{ +- /** this is struct version 1 */ +- int structVersion; +- /** The well known unique identifier of this host API @see PaHostApiTypeId */ +- PaHostApiTypeId type; +- /** A textual description of the host API for display on user interfaces. */ +- const char *name; +- +- /** The number of devices belonging to this host API. This field may be +- used in conjunction with Pa_HostApiDeviceIndexToDeviceIndex() to enumerate +- all devices for this host API. +- @see Pa_HostApiDeviceIndexToDeviceIndex +- */ +- int deviceCount; +- +- /** The default input device for this host API. The value will be a +- device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice +- if no default input device is available. +- */ +- PaDeviceIndex defaultInputDevice; +- +- /** The default output device for this host API. The value will be a +- device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice +- if no default output device is available. +- */ +- PaDeviceIndex defaultOutputDevice; +- +-} PaHostApiInfo; +- +- +-/** Retrieve a pointer to a structure containing information about a specific +- host Api. +- +- @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1) +- +- @return A pointer to an immutable PaHostApiInfo structure describing +- a specific host API. If the hostApi parameter is out of range or an error +- is encountered, the function returns NULL. +- +- The returned structure is owned by the PortAudio implementation and must not +- be manipulated or freed. The pointer is only guaranteed to be valid between +- calls to Pa_Initialize() and Pa_Terminate(). +-*/ +-const PaHostApiInfo * Pa_GetHostApiInfo( PaHostApiIndex hostApi ); +- +- +-/** Convert a static host API unique identifier, into a runtime +- host API index. +- +- @param type A unique host API identifier belonging to the PaHostApiTypeId +- enumeration. +- +- @return A valid PaHostApiIndex ranging from 0 to (Pa_GetHostApiCount()-1) or, +- a PaErrorCode (which are always negative) if PortAudio is not initialized +- or an error is encountered. +- +- The paHostApiNotFound error code indicates that the host API specified by the +- type parameter is not available. +- +- @see PaHostApiTypeId +-*/ +-PaHostApiIndex Pa_HostApiTypeIdToHostApiIndex( PaHostApiTypeId type ); +- +- +-/** Convert a host-API-specific device index to standard PortAudio device index. +- This function may be used in conjunction with the deviceCount field of +- PaHostApiInfo to enumerate all devices for the specified host API. +- +- @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1) +- +- @param hostApiDeviceIndex A valid per-host device index in the range +- 0 to (Pa_GetHostApiInfo(hostApi)->deviceCount-1) +- +- @return A non-negative PaDeviceIndex ranging from 0 to (Pa_GetDeviceCount()-1) +- or, a PaErrorCode (which are always negative) if PortAudio is not initialized +- or an error is encountered. +- +- A paInvalidHostApi error code indicates that the host API index specified by +- the hostApi parameter is out of range. +- +- A paInvalidDevice error code indicates that the hostApiDeviceIndex parameter +- is out of range. +- +- @see PaHostApiInfo +-*/ +-PaDeviceIndex Pa_HostApiDeviceIndexToDeviceIndex( PaHostApiIndex hostApi, +- int hostApiDeviceIndex ); +- +- +- +-/** Structure used to return information about a host error condition. +-*/ +-typedef struct PaHostErrorInfo{ +- PaHostApiTypeId hostApiType; /**< the host API which returned the error code */ +- long errorCode; /**< the error code returned */ +- const char *errorText; /**< a textual description of the error if available, otherwise a zero-length string */ +-}PaHostErrorInfo; +- +- +-/** Return information about the last host error encountered. The error +- information returned by Pa_GetLastHostErrorInfo() will never be modified +- asyncronously by errors occurring in other PortAudio owned threads +- (such as the thread that manages the stream callback.) +- +- This function is provided as a last resort, primarily to enhance debugging +- by providing clients with access to all available error information. +- +- @return A pointer to an immutable structure constaining information about +- the host error. The values in this structure will only be valid if a +- PortAudio function has previously returned the paUnanticipatedHostError +- error code. +-*/ +-const PaHostErrorInfo* Pa_GetLastHostErrorInfo( void ); +- +- +- +-/* Device enumeration and capabilities */ +- +-/** Retrieve the number of available devices. The number of available devices +- may be zero. +- +- @return A non-negative value indicating the number of available devices or, +- a PaErrorCode (which are always negative) if PortAudio is not initialized +- or an error is encountered. +-*/ +-PaDeviceIndex Pa_GetDeviceCount( void ); +- +- +-/** Retrieve the index of the default input device. The result can be +- used in the inputDevice parameter to Pa_OpenStream(). +- +- @return The default input device index for the default host API, or paNoDevice +- if no default input device is available or an error was encountered. +-*/ +-PaDeviceIndex Pa_GetDefaultInputDevice( void ); +- +- +-/** Retrieve the index of the default output device. The result can be +- used in the outputDevice parameter to Pa_OpenStream(). +- +- @return The default output device index for the defualt host API, or paNoDevice +- if no default output device is available or an error was encountered. +- +- @note +- On the PC, the user can specify a default device by +- setting an environment variable. For example, to use device #1. +-
+- set PA_RECOMMENDED_OUTPUT_DEVICE=1
+-
+- The user should first determine the available device ids by using +- the supplied application "pa_devs". +-*/ +-PaDeviceIndex Pa_GetDefaultOutputDevice( void ); +- +- +-/** The type used to represent monotonic time in seconds that can be used +- for syncronisation. The type is used for the outTime argument to the +- PaStreamCallback and as the result of Pa_GetStreamTime(). +- +- @see PaStreamCallback, Pa_GetStreamTime +-*/ +-typedef double PaTime; +- +- +-/** A type used to specify one or more sample formats. Each value indicates +- a possible format for sound data passed to and from the stream callback, +- Pa_ReadStream and Pa_WriteStream. +- +- The standard formats paFloat32, paInt16, paInt32, paInt24, paInt8 +- and aUInt8 are usually implemented by all implementations. +- +- The floating point representation (paFloat32) uses +1.0 and -1.0 as the +- maximum and minimum respectively. +- +- paUInt8 is an unsigned 8 bit format where 128 is considered "ground" +- +- The paNonInterleaved flag indicates that a multichannel buffer is passed +- as a set of non-interleaved pointers. +- +- @see Pa_OpenStream, Pa_OpenDefaultStream, PaDeviceInfo +- @see paFloat32, paInt16, paInt32, paInt24, paInt8 +- @see paUInt8, paCustomFormat, paNonInterleaved +-*/ +-typedef unsigned long PaSampleFormat; +- +- +-#define paFloat32 ((PaSampleFormat) 0x00000001) /**< @see PaSampleFormat */ +-#define paInt32 ((PaSampleFormat) 0x00000002) /**< @see PaSampleFormat */ +-#define paInt24 ((PaSampleFormat) 0x00000004) /**< Packed 24 bit format. @see PaSampleFormat */ +-#define paInt16 ((PaSampleFormat) 0x00000008) /**< @see PaSampleFormat */ +-#define paInt8 ((PaSampleFormat) 0x00000010) /**< @see PaSampleFormat */ +-#define paUInt8 ((PaSampleFormat) 0x00000020) /**< @see PaSampleFormat */ +-#define paCustomFormat ((PaSampleFormat) 0x00010000)/**< @see PaSampleFormat */ +- +-#define paNonInterleaved ((PaSampleFormat) 0x80000000) +- +-/** A structure providing information and capabilities of PortAudio devices. +- Devices may support input, output or both input and output. +-*/ +-typedef struct PaDeviceInfo +-{ +- int structVersion; /* this is struct version 2 */ +- const char *name; +- PaHostApiIndex hostApi; /* note this is a host API index, not a type id*/ +- +- int maxInputChannels; +- int maxOutputChannels; +- +- /* Default latency values for interactive performance. */ +- PaTime defaultLowInputLatency; +- PaTime defaultLowOutputLatency; +- /* Default latency values for robust non-interactive applications (eg. playing sound files). */ +- PaTime defaultHighInputLatency; +- PaTime defaultHighOutputLatency; +- +- double defaultSampleRate; +-} PaDeviceInfo; +- +- +-/** Retrieve a pointer to a PaDeviceInfo structure containing information +- about the specified device. +- @return A pointer to an immutable PaDeviceInfo structure. If the device +- parameter is out of range the function returns NULL. +- +- @param device A valid device index in the range 0 to (Pa_GetDeviceCount()-1) +- +- @note PortAudio manages the memory referenced by the returned pointer, +- the client must not manipulate or free the memory. The pointer is only +- guaranteed to be valid between calls to Pa_Initialize() and Pa_Terminate(). +- +- @see PaDeviceInfo, PaDeviceIndex +-*/ +-const PaDeviceInfo* Pa_GetDeviceInfo( PaDeviceIndex device ); +- +- +-/** Parameters for one direction (input or output) of a stream. +-*/ +-typedef struct PaStreamParameters +-{ +- /** A valid device index in the range 0 to (Pa_GetDeviceCount()-1) +- specifying the device to be used or the special constant +- paUseHostApiSpecificDeviceSpecification which indicates that the actual +- device(s) to use are specified in hostApiSpecificStreamInfo. +- This field must not be set to paNoDevice. +- */ +- PaDeviceIndex device; +- +- /** The number of channels of sound to be delivered to the +- stream callback or accessed by Pa_ReadStream() or Pa_WriteStream(). +- It can range from 1 to the value of maxInputChannels in the +- PaDeviceInfo record for the device specified by the device parameter. +- */ +- int channelCount; +- +- /** The sample format of the buffer provided to the stream callback, +- a_ReadStream() or Pa_WriteStream(). It may be any of the formats described +- by the PaSampleFormat enumeration. +- */ +- PaSampleFormat sampleFormat; +- +- /** The desired latency in seconds. Where practical, implementations should +- configure their latency based on these parameters, otherwise they may +- choose the closest viable latency instead. Unless the suggested latency +- is greater than the absolute upper limit for the device implementations +- should round the suggestedLatency up to the next practial value - ie to +- provide an equal or higher latency than suggestedLatency wherever possibe. +- Actual latency values for an open stream may be retrieved using the +- inputLatency and outputLatency fields of the PaStreamInfo structure +- returned by Pa_GetStreamInfo(). +- @see default*Latency in PaDeviceInfo, *Latency in PaStreamInfo +- */ +- PaTime suggestedLatency; +- +- /** An optional pointer to a host api specific data structure +- containing additional information for device setup and/or stream processing. +- hostApiSpecificStreamInfo is never required for correct operation, +- if not used it should be set to NULL. +- */ +- void *hostApiSpecificStreamInfo; +- +-} PaStreamParameters; +- +- +-/** Return code for Pa_IsFormatSupported indicating success. */ +-#define paFormatIsSupported (0) +- +-/** Determine whether it would be possible to open a stream with the specified +- parameters. +- +- @param inputParameters A structure that describes the input parameters used to +- open a stream. The suggestedLatency field is ignored. See PaStreamParameters +- for a description of these parameters. inputParameters must be NULL for +- output-only streams. +- +- @param outputParameters A structure that describes the output parameters used +- to open a stream. The suggestedLatency field is ignored. See PaStreamParameters +- for a description of these parameters. outputParameters must be NULL for +- input-only streams. +- +- @param sampleRate The required sampleRate. For full-duplex streams it is the +- sample rate for both input and output +- +- @return Returns 0 if the format is supported, and an error code indicating why +- the format is not supported otherwise. The constant paFormatIsSupported is +- provided to compare with the return value for success. +- +- @see paFormatIsSupported, PaStreamParameters +-*/ +-PaError Pa_IsFormatSupported( const PaStreamParameters *inputParameters, +- const PaStreamParameters *outputParameters, +- double sampleRate ); +- +- +- +-/* Streaming types and functions */ +- +- +-/** +- A single PaStream can provide multiple channels of real-time +- streaming audio input and output to a client application. A stream +- provides access to audio hardware represented by one or more +- PaDevices. Depending on the underlying Host API, it may be possible +- to open multiple streams using the same device, however this behavior +- is implementation defined. Portable applications should assume that +- a PaDevice may be simultaneously used by at most one PaStream. +- +- Pointers to PaStream objects are passed between PortAudio functions that +- operate on streams. +- +- @see Pa_OpenStream, Pa_OpenDefaultStream, Pa_OpenDefaultStream, Pa_CloseStream, +- Pa_StartStream, Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive, +- Pa_GetStreamTime, Pa_GetStreamCpuLoad +- +-*/ +-typedef void PaStream; +- +- +-/** Can be passed as the framesPerBuffer parameter to Pa_OpenStream() +- or Pa_OpenDefaultStream() to indicate that the stream callback will +- accept buffers of any size. +-*/ +-#define paFramesPerBufferUnspecified (0) +- +- +-/** Flags used to control the behavior of a stream. They are passed as +- parameters to Pa_OpenStream or Pa_OpenDefaultStream. Multiple flags may be +- ORed together. +- +- @see Pa_OpenStream, Pa_OpenDefaultStream +- @see paNoFlag, paClipOff, paDitherOff, paNeverDropInput, +- paPrimeOutputBuffersUsingStreamCallback, paPlatformSpecificFlags +-*/ +-typedef unsigned long PaStreamFlags; +- +-/** @see PaStreamFlags */ +-#define paNoFlag ((PaStreamFlags) 0) +- +-/** Disable default clipping of out of range samples. +- @see PaStreamFlags +-*/ +-#define paClipOff ((PaStreamFlags) 0x00000001) +- +-/** Disable default dithering. +- @see PaStreamFlags +-*/ +-#define paDitherOff ((PaStreamFlags) 0x00000002) +- +-/** Flag requests that where possible a full duplex stream will not discard +- overflowed input samples without calling the stream callback. This flag is +- only valid for full duplex callback streams and only when used in combination +- with the paFramesPerBufferUnspecified (0) framesPerBuffer parameter. Using +- this flag incorrectly results in a paInvalidFlag error being returned from +- Pa_OpenStream and Pa_OpenDefaultStream. +- +- @see PaStreamFlags, paFramesPerBufferUnspecified +-*/ +-#define paNeverDropInput ((PaStreamFlags) 0x00000004) +- +-/** Call the stream callback to fill initial output buffers, rather than the +- default behavior of priming the buffers with zeros (silence). This flag has +- no effect for input-only and blocking read/write streams. +- +- @see PaStreamFlags +-*/ +-#define paPrimeOutputBuffersUsingStreamCallback ((PaStreamFlags) 0x00000008) +- +-/** A mask specifying the platform specific bits. +- @see PaStreamFlags +-*/ +-#define paPlatformSpecificFlags ((PaStreamFlags)0xFFFF0000) +- +-/** +- Timing information for the buffers passed to the stream callback. +-*/ +-typedef struct PaStreamCallbackTimeInfo{ +- PaTime inputBufferAdcTime; +- PaTime currentTime; +- PaTime outputBufferDacTime; +-} PaStreamCallbackTimeInfo; +- +- +-/** +- Flag bit constants for the statusFlags to PaStreamCallback. +- +- @see paInputUnderflow, paInputOverflow, paOutputUnderflow, paOutputOverflow, +- paPrimingOutput +-*/ +-typedef unsigned long PaStreamCallbackFlags; +- +-/** In a stream opened with paFramesPerBufferUnspecified, indicates that +- input data is all silence (zeros) because no real data is available. In a +- stream opened without paFramesPerBufferUnspecified, it indicates that one or +- more zero samples have been inserted into the input buffer to compensate +- for an input underflow. +- @see PaStreamCallbackFlags +-*/ +-#define paInputUnderflow ((PaStreamCallbackFlags) 0x00000001) +- +-/** In a stream opened with paFramesPerBufferUnspecified, indicates that data +- prior to the first sample of the input buffer was discarded due to an +- overflow, possibly because the stream callback is using too much CPU time. +- Otherwise indicates that data prior to one or more samples in the +- input buffer was discarded. +- @see PaStreamCallbackFlags +-*/ +-#define paInputOverflow ((PaStreamCallbackFlags) 0x00000002) +- +-/** Indicates that output data (or a gap) was inserted, possibly because the +- stream callback is using too much CPU time. +- @see PaStreamCallbackFlags +-*/ +-#define paOutputUnderflow ((PaStreamCallbackFlags) 0x00000004) +- +-/** Indicates that output data will be discarded because no room is available. +- @see PaStreamCallbackFlags +-*/ +-#define paOutputOverflow ((PaStreamCallbackFlags) 0x00000008) +- +-/** Some of all of the output data will be used to prime the stream, input +- data may be zero. +- @see PaStreamCallbackFlags +-*/ +-#define paPrimingOutput ((PaStreamCallbackFlags) 0x00000010) +- +-/** +- Allowable return values for the PaStreamCallback. +- @see PaStreamCallback +-*/ +-typedef enum PaStreamCallbackResult +-{ +- paContinue=0, +- paComplete=1, +- paAbort=2 +-} PaStreamCallbackResult; +- +- +-/** +- Functions of type PaStreamCallback are implemented by PortAudio clients. +- They consume, process or generate audio in response to requests from an +- active PortAudio stream. +- +- @param input and @param output are arrays of interleaved samples, +- the format, packing and number of channels used by the buffers are +- determined by parameters to Pa_OpenStream(). +- +- @param frameCount The number of sample frames to be processed by +- the stream callback. +- +- @param timeInfo The time in seconds when the first sample of the input +- buffer was received at the audio input, the time in seconds when the first +- sample of the output buffer will begin being played at the audio output, and +- the time in seconds when the stream callback was called. +- See also Pa_GetStreamTime() +- +- @param statusFlags Flags indicating whether input and/or output buffers +- have been inserted or will be dropped to overcome underflow or overflow +- conditions. +- +- @param userData The value of a user supplied pointer passed to +- Pa_OpenStream() intended for storing synthesis data etc. +- +- @return +- The stream callback should return one of the values in the +- PaStreamCallbackResult enumeration. To ensure that the callback continues +- to be called, it should return paContinue (0). Either paComplete or paAbort +- can be returned to finish stream processing, after either of these values is +- returned the callback will not be called again. If paAbort is returned the +- stream will finish as soon as possible. If paComplete is returned, the stream +- will continue until all buffers generated by the callback have been played. +- This may be useful in applications such as soundfile players where a specific +- duration of output is required. However, it is not necessary to utilise this +- mechanism as Pa_StopStream(), Pa_AbortStream() or Pa_CloseStream() can also +- be used to stop the stream. The callback must always fill the entire output +- buffer irrespective of its return value. +- +- @see Pa_OpenStream, Pa_OpenDefaultStream +- +- @note With the exception of Pa_GetStreamCpuLoad() it is not permissable to call +- PortAudio API functions from within the stream callback. +-*/ +-typedef int PaStreamCallback( +- const void *input, void *output, +- unsigned long frameCount, +- const PaStreamCallbackTimeInfo* timeInfo, +- PaStreamCallbackFlags statusFlags, +- void *userData ); +- +- +-/** Opens a stream for either input, output or both. +- +- @param stream The address of a PaStream pointer which will receive +- a pointer to the newly opened stream. +- +- @param inputParameters A structure that describes the input parameters used by +- the opened stream. See PaStreamParameters for a description of these parameters. +- inputParameters must be NULL for output-only streams. +- +- @param outputParameters A structure that describes the output parameters used by +- the opened stream. See PaStreamParameters for a description of these parameters. +- outputParameters must be NULL for input-only streams. +- +- @param sampleRate The desired sampleRate. For full-duplex streams it is the +- sample rate for both input and output +- +- @param framesPerBuffer The number of frames passed to the stream callback +- function, or the preferred block granularity for a blocking read/write stream. +- The special value paFramesPerBufferUnspecified (0) may be used to request that +- the stream callback will recieve an optimal (and possibly varying) number of +- frames based on host requirements and the requested latency settings. +- Note: With some host APIs, the use of non-zero framesPerBuffer for a callback +- stream may introduce an additional layer of buffering which could introduce +- additional latency. PortAudio guarantees that the additional latency +- will be kept to the theoretical minimum however, it is strongly recommended +- that a non-zero framesPerBuffer value only be used when your algorithm +- requires a fixed number of frames per stream callback. +- +- @param streamFlags Flags which modify the behaviour of the streaming process. +- This parameter may contain a combination of flags ORed together. Some flags may +- only be relevant to certain buffer formats. +- +- @param streamCallback A pointer to a client supplied function that is responsible +- for processing and filling input and output buffers. If this parameter is NULL +- the stream will be opened in 'blocking read/write' mode. In blocking mode, +- the client can receive sample data using Pa_ReadStream and write sample data +- using Pa_WriteStream, the number of samples that may be read or written +- without blocking is returned by Pa_GetStreamReadAvailable and +- Pa_GetStreamWriteAvailable respectively. +- +- @param userData A client supplied pointer which is passed to the stream callback +- function. It could for example, contain a pointer to instance data necessary +- for processing the audio buffers. This parameter is ignored if streamCallback +- is NULL. +- +- @return +- Upon success Pa_OpenStream() returns paNoError and places a pointer to a +- valid PaStream in the stream argument. The stream is inactive (stopped). +- If a call to Pa_OpenStream() fails, a non-zero error code is returned (see +- PaError for possible error codes) and the value of stream is invalid. +- +- @see PaStreamParameters, PaStreamCallback, Pa_ReadStream, Pa_WriteStream, +- Pa_GetStreamReadAvailable, Pa_GetStreamWriteAvailable +-*/ +-PaError Pa_OpenStream( PaStream** stream, +- const PaStreamParameters *inputParameters, +- const PaStreamParameters *outputParameters, +- double sampleRate, +- unsigned long framesPerBuffer, +- PaStreamFlags streamFlags, +- PaStreamCallback *streamCallback, +- void *userData ); +- +- +-/** A simplified version of Pa_OpenStream() that opens the default input +- and/or output devices. +- +- @param stream The address of a PaStream pointer which will receive +- a pointer to the newly opened stream. +- +- @param numInputChannels The number of channels of sound that will be supplied +- to the stream callback or returned by Pa_ReadStream. It can range from 1 to +- the value of maxInputChannels in the PaDeviceInfo record for the default input +- device. If 0 the stream is opened as an output-only stream. +- +- @param numOutputChannels The number of channels of sound to be delivered to the +- stream callback or passed to Pa_WriteStream. It can range from 1 to the value +- of maxOutputChannels in the PaDeviceInfo record for the default output dvice. +- If 0 the stream is opened as an output-only stream. +- +- @param sampleFormat The sample format of both the input and output buffers +- provided to the callback or passed to and from Pa_ReadStream and Pa_WriteStream. +- sampleFormat may be any of the formats described by the PaSampleFormat +- enumeration. +- +- @param sampleRate Same as Pa_OpenStream parameter of the same name. +- @param framesPerBuffer Same as Pa_OpenStream parameter of the same name. +- @param streamCallback Same as Pa_OpenStream parameter of the same name. +- @param userData Same as Pa_OpenStream parameter of the same name. +- +- @return As for Pa_OpenStream +- +- @see Pa_OpenStream, PaStreamCallback +-*/ +-PaError Pa_OpenDefaultStream( PaStream** stream, +- int numInputChannels, +- int numOutputChannels, +- PaSampleFormat sampleFormat, +- double sampleRate, +- unsigned long framesPerBuffer, +- PaStreamCallback *streamCallback, +- void *userData ); +- +- +-/** Closes an audio stream. If the audio stream is active it +- discards any pending buffers as if Pa_AbortStream() had been called. +-*/ +-PaError Pa_CloseStream( PaStream *stream ); +- +- +-/** Functions of type PaStreamFinishedCallback are implemented by PortAudio +- clients. They can be registered with a stream using the Pa_SetStreamFinishedCallback +- function. Once registered they are called when the stream becomes inactive +- (ie once a call to Pa_StopStream() will not block). +- A stream will become inactive after the stream callback returns non-zero, +- or when Pa_StopStream or Pa_AbortStream is called. For a stream providing audio +- output, if the stream callback returns paComplete, or Pa_StopStream is called, +- the stream finished callback will not be called until all generated sample data +- has been played. +- +- @param userData The userData parameter supplied to Pa_OpenStream() +- +- @see Pa_SetStreamFinishedCallback +-*/ +-typedef void PaStreamFinishedCallback( void *userData ); +- +- +-/** Register a stream finished callback function which will be called when the +- stream becomes inactive. See the description of PaStreamFinishedCallback for +- further details about when the callback will be called. +- +- @param stream a pointer to a PaStream that is in the stopped state - if the +- stream is not stopped, the stream's finished callback will remain unchanged +- and an error code will be returned. +- +- @param streamFinishedCallback a pointer to a function with the same signature +- as PaStreamFinishedCallback, that will be called when the stream becomes +- inactive. Passing NULL for this parameter will un-register a previously +- registered stream finished callback function. +- +- @return on success returns paNoError, otherwise an error code indicating the cause +- of the error. +- +- @see PaStreamFinishedCallback +-*/ +-PaError Pa_SetStreamFinishedCallback( PaStream *stream, PaStreamFinishedCallback* streamFinishedCallback ); +- +- +-/** Commences audio processing. +-*/ +-PaError Pa_StartStream( PaStream *stream ); +- +- +-/** Terminates audio processing. It waits until all pending +- audio buffers have been played before it returns. +-*/ +-PaError Pa_StopStream( PaStream *stream ); +- +- +-/** Terminates audio processing immediately without waiting for pending +- buffers to complete. +-*/ +-PaError Pa_AbortStream( PaStream *stream ); +- +- +-/** Determine whether the stream is stopped. +- A stream is considered to be stopped prior to a successful call to +- Pa_StartStream and after a successful call to Pa_StopStream or Pa_AbortStream. +- If a stream callback returns a value other than paContinue the stream is NOT +- considered to be stopped. +- +- @return Returns one (1) when the stream is stopped, zero (0) when +- the stream is running or, a PaErrorCode (which are always negative) if +- PortAudio is not initialized or an error is encountered. +- +- @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive +-*/ +-PaError Pa_IsStreamStopped( PaStream *stream ); +- +- +-/** Determine whether the stream is active. +- A stream is active after a successful call to Pa_StartStream(), until it +- becomes inactive either as a result of a call to Pa_StopStream() or +- Pa_AbortStream(), or as a result of a return value other than paContinue from +- the stream callback. In the latter case, the stream is considered inactive +- after the last buffer has finished playing. +- +- @return Returns one (1) when the stream is active (ie playing or recording +- audio), zero (0) when not playing or, a PaErrorCode (which are always negative) +- if PortAudio is not initialized or an error is encountered. +- +- @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamStopped +-*/ +-PaError Pa_IsStreamActive( PaStream *stream ); +- +- +- +-/** A structure containing unchanging information about an open stream. +- @see Pa_GetStreamInfo +-*/ +- +-typedef struct PaStreamInfo +-{ +- /** this is struct version 1 */ +- int structVersion; +- +- /** The input latency of the stream in seconds. This value provides the most +- accurate estimate of input latency available to the implementation. It may +- differ significantly from the suggestedLatency value passed to Pa_OpenStream(). +- The value of this field will be zero (0.) for output-only streams. +- @see PaTime +- */ +- PaTime inputLatency; +- +- /** The output latency of the stream in seconds. This value provides the most +- accurate estimate of output latency available to the implementation. It may +- differ significantly from the suggestedLatency value passed to Pa_OpenStream(). +- The value of this field will be zero (0.) for input-only streams. +- @see PaTime +- */ +- PaTime outputLatency; +- +- /** The sample rate of the stream in Hertz (samples per second). In cases +- where the hardware sample rate is inaccurate and PortAudio is aware of it, +- the value of this field may be different from the sampleRate parameter +- passed to Pa_OpenStream(). If information about the actual hardware sample +- rate is not available, this field will have the same value as the sampleRate +- parameter passed to Pa_OpenStream(). +- */ +- double sampleRate; +- +-} PaStreamInfo; +- +- +-/** Retrieve a pointer to a PaStreamInfo structure containing information +- about the specified stream. +- @return A pointer to an immutable PaStreamInfo structure. If the stream +- parameter invalid, or an error is encountered, the function returns NULL. +- +- @param stream A pointer to an open stream previously created with Pa_OpenStream. +- +- @note PortAudio manages the memory referenced by the returned pointer, +- the client must not manipulate or free the memory. The pointer is only +- guaranteed to be valid until the specified stream is closed. +- +- @see PaStreamInfo +-*/ +-const PaStreamInfo* Pa_GetStreamInfo( PaStream *stream ); +- +- +-/** Determine the current time for the stream according to the same clock used +- to generate buffer timestamps. This time may be used for syncronising other +- events to the audio stream, for example synchronizing audio to MIDI. +- +- @return The stream's current time in seconds, or 0 if an error occurred. +- +- @see PaTime, PaStreamCallback +-*/ +-PaTime Pa_GetStreamTime( PaStream *stream ); +- +- +-/** Retrieve CPU usage information for the specified stream. +- The "CPU Load" is a fraction of total CPU time consumed by a callback stream's +- audio processing routines including, but not limited to the client supplied +- stream callback. This function does not work with blocking read/write streams. +- +- This function may be called from the stream callback function or the +- application. +- +- @return +- A floating point value, typically between 0.0 and 1.0, where 1.0 indicates +- that the stream callback is consuming the maximum number of CPU cycles possible +- to maintain real-time operation. A value of 0.5 would imply that PortAudio and +- the stream callback was consuming roughly 50% of the available CPU time. The +- return value may exceed 1.0. A value of 0.0 will always be returned for a +- blocking read/write stream, or if an error occurrs. +-*/ +-double Pa_GetStreamCpuLoad( PaStream* stream ); +- +- +-/** Read samples from an input stream. The function doesn't return until +- the entire buffer has been filled - this may involve waiting for the operating +- system to supply the data. +- +- @param stream A pointer to an open stream previously created with Pa_OpenStream. +- +- @param buffer A pointer to a buffer of sample frames. The buffer contains +- samples in the format specified by the inputParameters->sampleFormat field +- used to open the stream, and the number of channels specified by +- inputParameters->numChannels. If non-interleaved samples were requested, +- buffer is a pointer to the first element of an array of non-interleaved +- buffer pointers, one for each channel. +- +- @param frames The number of frames to be read into buffer. This parameter +- is not constrained to a specific range, however high performance applications +- will want to match this parameter to the framesPerBuffer parameter used +- when opening the stream. +- +- @return On success PaNoError will be returned, or PaInputOverflowed if input +- data was discarded by PortAudio after the previous call and before this call. +-*/ +-PaError Pa_ReadStream( PaStream* stream, +- void *buffer, +- unsigned long frames ); +- +- +-/** Write samples to an output stream. This function doesn't return until the +- entire buffer has been consumed - this may involve waiting for the operating +- system to consume the data. +- +- @param stream A pointer to an open stream previously created with Pa_OpenStream. +- +- @param buffer A pointer to a buffer of sample frames. The buffer contains +- samples in the format specified by the outputParameters->sampleFormat field +- used to open the stream, and the number of channels specified by +- outputParameters->numChannels. If non-interleaved samples were requested, +- buffer is a pointer to the first element of an array of non-interleaved +- buffer pointers, one for each channel. +- +- @param frames The number of frames to be written from buffer. This parameter +- is not constrained to a specific range, however high performance applications +- will want to match this parameter to the framesPerBuffer parameter used +- when opening the stream. +- +- @return On success PaNoError will be returned, or paOutputUnderflowed if +- additional output data was inserted after the previous call and before this +- call. +-*/ +-PaError Pa_WriteStream( PaStream* stream, +- const void *buffer, +- unsigned long frames ); +- +- +-/** Retrieve the number of frames that can be read from the stream without +- waiting. +- +- @return Returns a non-negative value representing the maximum number of frames +- that can be read from the stream without blocking or busy waiting or, a +- PaErrorCode (which are always negative) if PortAudio is not initialized or an +- error is encountered. +-*/ +-signed long Pa_GetStreamReadAvailable( PaStream* stream ); +- +- +-/** Retrieve the number of frames that can be written to the stream without +- waiting. +- +- @return Returns a non-negative value representing the maximum number of frames +- that can be written to the stream without blocking or busy waiting or, a +- PaErrorCode (which are always negative) if PortAudio is not initialized or an +- error is encountered. +-*/ +-signed long Pa_GetStreamWriteAvailable( PaStream* stream ); +- +- +-/* Miscellaneous utilities */ +- +- +-/** Retrieve the size of a given sample format in bytes. +- +- @return The size in bytes of a single sample in the specified format, +- or paSampleFormatNotSupported if the format is not supported. +-*/ +-PaError Pa_GetSampleSize( PaSampleFormat format ); +- +- +-/** Put the caller to sleep for at least 'msec' milliseconds. This function is +- provided only as a convenience for authors of portable code (such as the tests +- and examples in the PortAudio distribution.) +- +- The function may sleep longer than requested so don't rely on this for accurate +- musical timing. +-*/ +-void Pa_Sleep( long msec ); +- +- +- +-#ifdef __cplusplus +-} +-#endif /* __cplusplus */ +-#endif /* PORTAUDIO_H */ +--- a/src/wave.cpp ++++ b/src/wave.cpp +@@ -31,7 +31,10 @@ + #include + #include + +-#include "portaudio.h" ++#ifdef USE_PORTAUDIO ++#include ++#endif ++ + #ifdef PLATFORM_WINDOWS + #include + #else +--- a/src/wavegen.cpp ++++ b/src/wavegen.cpp +@@ -40,7 +40,7 @@ + #endif + + #ifdef USE_PORTAUDIO +-#include "portaudio.h" ++#include + #undef USE_PORTAUDIO + // determine portaudio version by looking for a #define which is not in V18 + #ifdef paNeverDropInput diff --git a/sound/forked-daapd/Makefile b/sound/forked-daapd/Makefile new file mode 100644 index 0000000..b33bb44 --- /dev/null +++ b/sound/forked-daapd/Makefile @@ -0,0 +1,75 @@ +# +# Copyright (C) 2006-2016 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:=forked-daapd +PKG_VERSION:=24.2 +PKG_RELEASE:=1 +PKG_REV:=1b6283752ed0b790a6658bed1f05946e1af193da + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://github.com/ejurgensen/forked-daapd.git +PKG_SOURCE_VERSION:=$(PKG_REV) + +PKG_BUILD_DEPENDS:=gperf/host +PKG_FIXUP:=autoreconf +PKG_USE_MIPS16:=0 +PKG_INSTALL:=1 + +PKG_MAINTAINER:=Espen Jürgensen +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/forked-daapd +SECTION:=sound +CATEGORY:=Sound +TITLE:=iTunes (DAAP) server for Apple Remote and AirPlay +URL:=https://github.com/ejurgensen/forked-daapd +DEPENDS:=+libgpg-error +libgcrypt +libgdbm +zlib +libexpat +libunistring \ + +libevent2 +libdaemon +libantlr3c +confuse +alsa-lib +libffmpeg-full \ + +mxml +libavahi-client +sqlite3-cli +libplist +libcurl +libjson-c \ + +libprotobuf-c +libgnutls $(ICONV_DEPENDS) +endef + +define Package/forked-daapd/description + forked-daapd is a Linux/FreeBSD DAAP (iTunes), MPD (Music Player Daemon) and + RSP (Roku) media server. It has support for AirPlay speakers, Chromecast, + Apple Remote (and compatibles), MPD clients, internet radio and LastFM. It + does not support AirPlay/Chromecast video. +endef + +define Package/forked-daapd/conffiles +/etc/forked-daapd.conf +endef + +CONFIGURE_ARGS += \ + --enable-itunes \ + --enable-lastfm \ + --enable-mpd \ + --enable-chromecast + +TARGET_CFLAGS += $(FPIC) +TARGET_LDFLAGS += -Wl,-rpath-link,$(STAGING_DIR)/usr/lib + +define Package/forked-daapd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/forked-daapd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) ./files/forked-daapd.conf $(1)/etc/forked-daapd.conf + $(INSTALL_DIR) $(1)/usr/lib/forked-daapd + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/forked-daapd/* $(1)/usr/lib/forked-daapd/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/forked-daapd.init $(1)/etc/init.d/forked-daapd +endef + +$(eval $(call BuildPackage,forked-daapd)) diff --git a/sound/forked-daapd/files/forked-daapd.conf b/sound/forked-daapd/files/forked-daapd.conf new file mode 100644 index 0000000..0f756e0 --- /dev/null +++ b/sound/forked-daapd/files/forked-daapd.conf @@ -0,0 +1,187 @@ +# A quick guide to configuring forked-daapd: +# +# For regular use, the most important setting to configure is "directories", +# which should be the location of your media. Whatever user you have set as +# "uid" must have read access to this location. If the location is a network +# mount, please see the README. +# +# In all likelihood, that's all you need to do! + +general { + # Username + # Make sure the user has read access to the library directories you set + # below, and full access to the databases, log and local audio + uid = "daapd" + + # Database location + db_path = "/var/cache/forked-daapd/songs3.db" + + # Log file and level + # Available levels: fatal, log, warning, info, debug, spam + logfile = "/var/log/forked-daapd.log" + loglevel = log + + # Admin password for the non-existent web interface + admin_password = "unused" + + # Enable/disable IPv6 + ipv6 = no + + # Location of cache database + cache_path = "/var/cache/forked-daapd/cache.db" + + # DAAP requests that take longer than this threshold (in msec) get their + # replies cached for next time. Set to 0 to disable caching. +# cache_daap_threshold = 1000 +} + +# Library configuration +library { + # Name of the library as displayed by the clients + # %h: hostname, %v: version + name = "My Music on %h" + + # TCP port to listen on. Default port is 3689 (daap) + port = 3689 + + # Password for the library. Optional. +# password = "" + + # Directories to index + directories = { "/srv/music" } + + # Directories containing podcasts + # For each directory that is indexed the path is matched against these + # names. If there is a match all items in the directory are marked as + # podcasts. Eg. if you index /srv/music, and your podcasts are in + # /srv/music/Podcasts, you can set this to "/Podcasts". + # (changing this setting only takes effect after rescan, see the README) + podcasts = { "/Podcasts" } + + # Directories containing audiobooks + # For each directory that is indexed the path is matched against these + # names. If there is a match all items in the directory are marked as + # audiobooks. + # (changing this setting only takes effect after rescan, see the README) + audiobooks = { "/Audiobooks" } + + # Directories containing compilations (eg soundtracks) + # For each directory that is indexed the path is matched against these + # names. If there is a match all items in the directory are marked as + # compilations. + # (changing this setting only takes effect after rescan, see the README) + compilations = { "/Compilations" } + + # Compilations usually have many artists, and if you don't want every + # artist to be listed when artist browsing in Remote, you can set + # a single name which will be used for all music in the compilation dir + # (changing this setting only takes effect after rescan, see the README) + compilation_artist = "Various artists" + + # Internet streams in your playlists will by default be shown in the + # "Radio" library, like iTunes does. However, some clients (like + # TunesRemote+) won't show the "Radio" library. If you would also like + # to have them shown like normal playlists, you can enable this option. +# radio_playlists = false + + # There are 5 default playlists: "Library", "Music", "Movies", "TV Shows" + # and "Podcasts". Here you can change the names of these playlists. +# name_library = "Library" +# name_music = "Music" +# name_movies = "Movies" +# name_tvshows = "TV Shows" +# name_podcasts = "Podcasts" +# name_audiobooks = "Audiobooks" +# name_radio = "Radio" + + # Artwork file names (without file type extension) + # forked-daapd will look for jpg and png files with these base names +# artwork_basenames = { "artwork", "cover", "Folder" } + + # Enable searching for artwork corresponding to each individual media + # file instead of only looking for album artwork. This is disabled by + # default to reduce cache size. +# artwork_individual = false + + # File types the scanner should ignore + # Non-audio files will never be added to the database, but here you + # can prevent the scanner from even probing them. This might improve + # scan time. By default .db, .ini, .db-journal and .pdf are ignored. +# filetypes_ignore = { ".db", ".ini", ".db-journal", ".pdf" } + + # File paths the scanner should ignore + # If you want to exclude files on a more advanced basis you can enter + # one or more POSIX regular expressions, and any file with a matching + # path will be ignored. +# filepath_ignore = { "myregex" } + + # Disable startup file scanning + # When forked-daapd starts it will do an initial file scan of your + # library (and then watch it for changes). If you are sure your library + # never changes while forked-daapd is not running, you can disable the + # initial file scan and save some system ressources. Disabling this scan + # may lead to forked-daapd's database coming out of sync with the + # library. If that happens read the instructions in the README on how + # to trigger a rescan. +# filescan_disable = false + + # Should iTunes metadata override ours? +# itunes_overrides = false + + # Formats: mp4a, mp4v, mpeg, alac, flac, mpc, ogg, wma, wmal, wmav, aif, wav + # Formats that should never be transcoded +# no_transcode = { "alac", "mp4a" } + # Formats that should always be transcoded +# force_transcode = { "ogg", "flac" } +} + +# Local audio output +audio { + # Name - used in the speaker list in Remote + nickname = "OpenWrt" + + # Audio device name for local audio output +# card = "default" + + # Mixer channel to use for volume control - ALSA/Linux only + # If not set, PCM will be used if available, otherwise Master. +# mixer = "" +} + +# AirPlay/Airport Express device settings +# (make sure you get the capitalization of the device name right) +#airplay "My AirPlay device" { + # forked-daapd's volume goes to 11! If that's more than you can handle + # you can set a lower value here +# max_volume = 11 + + # AirPlay password +# password = "s1kr3t" +#} + +# SQLite configuration (allows to modify the operation of the SQLite databases) +# Make sure to read the SQLite documentation for the corresponding PRAGMA statements as +# changing them from the defaults may increase the possibility of database corruptions! +# By default the SQLite default values are used. +sqlite { + # Cache size in number of db pages for the library database + # (SQLite default page size is 1024 bytes and cache size is 2000 pages) +# pragma_cache_size_library = 2000 + + # Cache size in number of db pages for the daap cache database + # (SQLite default page size is 1024 bytes and cache size is 2000 pages) +# pragma_cache_size_cache = 2000 + + # Sets the journal mode for the database + # DELETE (default), TRUNCATE, PERSIST, MEMORY, WAL, OFF +# pragma_journal_mode = DELETE + + # Change the setting of the "synchronous" flag + # 0: OFF, 1: NORMAL, 2: FULL (default) +# pragma_synchronous = 2 + + # Should the database be vacuumed on startup? (increases startup time, + # but may reduce database size). Default is yes. +# vacuum = yes +} + diff --git a/sound/forked-daapd/files/forked-daapd.init b/sound/forked-daapd/files/forked-daapd.init new file mode 100644 index 0000000..3ae38f9 --- /dev/null +++ b/sound/forked-daapd/files/forked-daapd.init @@ -0,0 +1,15 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014 OpenWrt.org + +START=99 +BIN=/usr/sbin/forked-daapd +PID=/var/run/forked-daapd.pid +SSD=start-stop-daemon + +start() { + $SSD -p $PID -S -x $BIN -- -P $PID +} + +stop() { + $SSD -p $PID -K -s SIGINT +} diff --git a/sound/forked-daapd/patches/010-include_pregen.patch b/sound/forked-daapd/patches/010-include_pregen.patch new file mode 100644 index 0000000..762f625 --- /dev/null +++ b/sound/forked-daapd/patches/010-include_pregen.patch @@ -0,0 +1,23739 @@ +diff --git a/src/pregen/DAAP.u b/src/pregen/DAAP.u +new file mode 100644 +index 0000000..3de527b +--- /dev/null ++++ b/src/pregen/DAAP.u +@@ -0,0 +1,6 @@ ++DAAPParser.c : DAAP.g ++./DAAP.tokens : DAAP.g ++DAAPParser.h : DAAP.g ++DAAPLexer.c : DAAP.g ++DAAPLexer.h : DAAP.g ++ANTLR_PRODUCTS += DAAPParser.c ./DAAP.tokens DAAPParser.h DAAPLexer.c DAAPLexer.h +\ No newline at end of file +diff --git a/src/pregen/DAAP2SQL.c b/src/pregen/DAAP2SQL.c +new file mode 100644 +index 0000000..04d6153 +--- /dev/null ++++ b/src/pregen/DAAP2SQL.c +@@ -0,0 +1,975 @@ ++/** \file ++ * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : DAAP2SQL.g ++ * - On : 2016-01-01 12:23:43 ++ * - for the tree parser : DAAP2SQLTreeParser * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++*/ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++ ++/* ============================================================================= ++ * This is what the grammar programmer asked us to put at the top of every file. ++ */ ++ ++ #include ++ #include ++ #include ++ #include ++ #include ++ ++ #include "logger.h" ++ #include "db.h" ++ #include "daap_query.h" ++ ++/* End of Header action. ++ * ============================================================================= ++ */ ++/* ----------------------------------------- ++ * Include the ANTLR3 generated header file. ++ */ ++#include "DAAP2SQL.h" ++/* ----------------------------------------- */ ++ ++ ++ ++ ++ ++/* MACROS that hide the C interface implementations from the ++ * generated code, which makes it a little more understandable to the human eye. ++ * I am very much against using C pre-processor macros for function calls and bits ++ * of code as you cannot see what is happening when single stepping in debuggers ++ * and so on. The exception (in my book at least) is for generated code, where you are ++ * not maintaining it, but may wish to read and understand it. If you single step it, you know that input() ++ * hides some indirect calls, but is always referring to the input stream. This is ++ * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig ++ * the runtime interfaces without changing the generated code too often, without ++ * confusing the reader of the generated output, who may not wish to know the gory ++ * details of the interface inheritance. ++ */ ++ ++#define CTX ctx ++ ++/* Aids in accessing scopes for grammar programmers ++ */ ++#undef SCOPE_TYPE ++#undef SCOPE_STACK ++#undef SCOPE_TOP ++#define SCOPE_TYPE(scope) pDAAP2SQL_##scope##_SCOPE ++#define SCOPE_STACK(scope) pDAAP2SQL_##scope##Stack ++#define SCOPE_TOP(scope) ctx->pDAAP2SQL_##scope##Top ++#define SCOPE_SIZE(scope) ctx->pDAAP2SQL_##scope##Stack_limit ++#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i)) ++ ++/* Macros for accessing things in the parser ++ */ ++ ++#undef PARSER ++#undef RECOGNIZER ++#undef HAVEPARSEDRULE ++#undef INPUT ++#undef STRSTREAM ++#undef HASEXCEPTION ++#undef EXCEPTION ++#undef MATCHT ++#undef MATCHANYT ++#undef FOLLOWSTACK ++#undef FOLLOWPUSH ++#undef FOLLOWPOP ++#undef PRECOVER ++#undef PREPORTERROR ++#undef LA ++#undef LT ++#undef CONSTRUCTEX ++#undef CONSUME ++#undef MARK ++#undef REWIND ++#undef REWINDLAST ++#undef PERRORRECOVERY ++#undef HASFAILED ++#undef FAILEDFLAG ++#undef RECOVERFROMMISMATCHEDSET ++#undef RECOVERFROMMISMATCHEDELEMENT ++#undef BACKTRACKING ++#undef ADAPTOR ++#undef RULEMEMO ++#undef SEEK ++#undef INDEX ++#undef DBG ++ ++#define PARSER ctx->pTreeParser ++#define RECOGNIZER PARSER->rec ++#define PSRSTATE RECOGNIZER->state ++#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r) ++#define INPUT PARSER->ctnstream ++#define ISTREAM INPUT->tnstream->istream ++#define STRSTREAM INPUT->tnstream ++#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE) ++#define EXCEPTION PSRSTATE->exception ++#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs) ++#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER) ++#define FOLLOWSTACK PSRSTATE->following ++#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL) ++#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK) ++#define PRECOVER() RECOGNIZER->recover(RECOGNIZER) ++#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER) ++#define LA(n) ISTREAM->_LA(ISTREAM, n) ++#define LT(n) INPUT->tnstream->_LT(INPUT->tnstream, n) ++#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER) ++#define CONSUME() ISTREAM->consume(ISTREAM) ++#define MARK() ISTREAM->mark(ISTREAM) ++#define REWIND(m) ISTREAM->rewind(ISTREAM, m) ++#define REWINDLAST() ISTREAM->rewindLast(ISTREAM) ++#define PERRORRECOVERY PSRSTATE->errorRecovery ++#define FAILEDFLAG PSRSTATE->failed ++#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE) ++#define BACKTRACKING PSRSTATE->backtracking ++#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s) ++#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s) ++#define ADAPTOR INPUT->adaptor ++#define RULEMEMO PSRSTATE->ruleMemo ++#define SEEK(n) ISTREAM->seek(ISTREAM, n) ++#define INDEX() ISTREAM->index(ISTREAM) ++#define DBG RECOGNIZER->debugger ++ ++ ++#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt ++ ++/* The 4 tokens defined below may well clash with your own #defines or token types. If so ++ * then for the present you must use different names for your defines as these are hard coded ++ * in the code generator. It would be better not to use such names internally, and maybe ++ * we can change this in a forthcoming release. I deliberately do not #undef these ++ * here as this will at least give you a redefined error somewhere if they clash. ++ */ ++#define UP ANTLR3_TOKEN_UP ++#define DOWN ANTLR3_TOKEN_DOWN ++#define EOR ANTLR3_TOKEN_EOR ++#define INVALID ANTLR3_TOKEN_INVALID ++ ++ ++/* ============================================================================= ++ * Functions to create and destroy scopes. First come the rule scopes, followed ++ * by the global declared scopes. ++ */ ++ ++ ++ ++/* ============================================================================= */ ++ ++/* ============================================================================= ++ * Start of recognizer ++ */ ++ ++ ++ ++/** \brief Table of all token names in symbolic order, mainly used for ++ * error reporting. ++ */ ++pANTLR3_UINT8 DAAP2SQLTokenNames[8+4] ++ = { ++ (pANTLR3_UINT8) "", /* String to print to indicate an invalid token */ ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "NEWLINE", ++ (pANTLR3_UINT8) "OPOR", ++ (pANTLR3_UINT8) "OPAND", ++ (pANTLR3_UINT8) "LPAR", ++ (pANTLR3_UINT8) "RPAR", ++ (pANTLR3_UINT8) "STR", ++ (pANTLR3_UINT8) "QUOTE", ++ (pANTLR3_UINT8) "ESCAPED" ++ }; ++ ++ ++ ++// Forward declare the locally static matching functions we have generated. ++// ++static pANTLR3_STRING query (pDAAP2SQL ctx); ++static DAAP2SQL_expr_return expr (pDAAP2SQL ctx); ++static void DAAP2SQLFree(pDAAP2SQL ctx); ++/* For use in tree output where we are accumulating rule labels via label += ruleRef ++ * we need a function that knows how to free a return scope when the list is destroyed. ++ * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro. ++ */ ++static void ANTLR3_CDECL freeScope(void * scope) ++{ ++ ANTLR3_FREE(scope); ++} ++ ++/** \brief Name of the grammar file that generated this code ++ */ ++static const char fileName[] = "DAAP2SQL.g"; ++ ++/** \brief Return the name of the grammar file that generated this code. ++ */ ++static const char * getGrammarFileName() ++{ ++ return fileName; ++} ++/** \brief Create a new DAAP2SQL parser and return a context for it. ++ * ++ * \param[in] instream Pointer to an input stream interface. ++ * ++ * \return Pointer to new parser context upon success. ++ */ ++ANTLR3_API pDAAP2SQL ++DAAP2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream) ++{ ++ // See if we can create a new parser with the standard constructor ++ // ++ return DAAP2SQLNewSSD(instream, NULL); ++} ++ ++/** \brief Create a new DAAP2SQL parser and return a context for it. ++ * ++ * \param[in] instream Pointer to an input stream interface. ++ * ++ * \return Pointer to new parser context upon success. ++ */ ++ANTLR3_API pDAAP2SQL ++DAAP2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state) ++{ ++ pDAAP2SQL ctx; /* Context structure we will build and return */ ++ ++ ctx = (pDAAP2SQL) ANTLR3_CALLOC(1, sizeof(DAAP2SQL)); ++ ++ if (ctx == NULL) ++ { ++ // Failed to allocate memory for parser context ++ // ++ return NULL; ++ } ++ ++ /* ------------------------------------------------------------------- ++ * Memory for basic structure is allocated, now to fill in ++ * the base ANTLR3 structures. We initialize the function pointers ++ * for the standard ANTLR3 parser function set, but upon return ++ * from here, the programmer may set the pointers to provide custom ++ * implementations of each function. ++ * ++ * We don't use the macros defined in DAAP2SQL.h here, in order that you can get a sense ++ * of what goes where. ++ */ ++ ++ /* Create a base Tree parser/recognizer, using the supplied tree node stream ++ */ ++ ctx->pTreeParser = antlr3TreeParserNewStream(ANTLR3_SIZE_HINT, instream, state); ++ /* Install the implementation of our DAAP2SQL interface ++ */ ++ ctx->query = query; ++ ctx->expr = expr; ++ ctx->free = DAAP2SQLFree; ++ ctx->getGrammarFileName = getGrammarFileName; ++ ++ /* Install the scope pushing methods. ++ */ ++ ++ ++ ++ ++ ++ /* Install the token table ++ */ ++ PSRSTATE->tokenNames = DAAP2SQLTokenNames; ++ ++ ++ /* Return the newly built parser to the caller ++ */ ++ return ctx; ++} ++ ++/** Free the parser resources ++ */ ++ static void ++ DAAP2SQLFree(pDAAP2SQL ctx) ++ { ++ /* Free any scope memory ++ */ ++ ++ ++ // Free this parser ++ // ++ ctx->pTreeParser->free(ctx->pTreeParser); ++ ANTLR3_FREE(ctx); ++ ++ /* Everything is released, so we can return ++ */ ++ return; ++ } ++ ++/** Return token names used by this tree parser ++ * ++ * The returned pointer is used as an index into the token names table (using the token ++ * number as the index). ++ * ++ * \return Pointer to first char * in the table. ++ */ ++static pANTLR3_UINT8 *getTokenNames() ++{ ++ return DAAP2SQLTokenNames; ++} ++ ++ ++ struct dmap_query_field_map { ++ char *dmap_field; ++ char *db_col; ++ int as_int; ++ }; ++ ++ /* gperf static hash, daap_query.gperf */ ++ #include "daap_query_hash.c" ++ ++ ++/* Declare the bitsets ++ */ ++ ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_query70 */ ++static ANTLR3_BITWORD FOLLOW_expr_in_query70_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_expr_in_query70 = { FOLLOW_expr_in_query70_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_OPAND_in_expr95 */ ++static ANTLR3_BITWORD FOLLOW_OPAND_in_expr95_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) }; ++static ANTLR3_BITSET_LIST FOLLOW_OPAND_in_expr95 = { FOLLOW_OPAND_in_expr95_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr101 */ ++static ANTLR3_BITWORD FOLLOW_expr_in_expr101_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000260) }; ++static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr101 = { FOLLOW_expr_in_expr101_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr107 */ ++static ANTLR3_BITWORD FOLLOW_expr_in_expr107_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) }; ++static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr107 = { FOLLOW_expr_in_expr107_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_OPOR_in_expr118 */ ++static ANTLR3_BITWORD FOLLOW_OPOR_in_expr118_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) }; ++static ANTLR3_BITSET_LIST FOLLOW_OPOR_in_expr118 = { FOLLOW_OPOR_in_expr118_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr124 */ ++static ANTLR3_BITWORD FOLLOW_expr_in_expr124_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000260) }; ++static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr124 = { FOLLOW_expr_in_expr124_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr130 */ ++static ANTLR3_BITWORD FOLLOW_expr_in_expr130_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) }; ++static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr130 = { FOLLOW_expr_in_expr130_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_expr140 */ ++static ANTLR3_BITWORD FOLLOW_STR_in_expr140_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_STR_in_expr140 = { FOLLOW_STR_in_expr140_bits, 1 }; ++ ++ ++ ++ ++/* ============================================== ++ * Parsing rules ++ */ ++/** ++ * $ANTLR start query ++ * DAAP2SQL.g:50:1: query returns [ pANTLR3_STRING result ] : e= expr ; ++ */ ++static pANTLR3_STRING ++query(pDAAP2SQL ctx) ++{ ++ pANTLR3_STRING result = NULL; ++ ++ DAAP2SQL_expr_return e; ++ #undef RETURN_TYPE_e ++ #define RETURN_TYPE_e DAAP2SQL_expr_return ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ result= NULL; ++ { ++ // DAAP2SQL.g:52:2: (e= expr ) ++ // DAAP2SQL.g:52:4: e= expr ++ { ++ FOLLOWPUSH(FOLLOW_expr_in_query70); ++ e=expr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto rulequeryEx; ++ } ++ ++ { ++ ++ if (!e.valid) ++ { ++ result= NULL; ++ } ++ else ++ { ++ result= e.result->factory->newRaw(e.result->factory); ++ result->append8(result, "("); ++ result->appendS(result, e.result); ++ result->append8(result, ")"); ++ } ++ ++ } ++ ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto rulequeryEx; /* Prevent compiler warnings */ ++ rulequeryEx: ; ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ } ++ ++ ++ return result; ++} ++/* $ANTLR end query */ ++ ++/** ++ * $ANTLR start expr ++ * DAAP2SQL.g:68:1: expr returns [ pANTLR3_STRING result, int valid ] : ( ^( OPAND a= expr b= expr ) | ^( OPOR a= expr b= expr ) | STR ); ++ */ ++static DAAP2SQL_expr_return ++expr(pDAAP2SQL ctx) ++{ ++ DAAP2SQL_expr_return retval; ++ ++ pANTLR3_BASE_TREE STR1; ++ DAAP2SQL_expr_return a; ++ #undef RETURN_TYPE_a ++ #define RETURN_TYPE_a DAAP2SQL_expr_return ++ ++ DAAP2SQL_expr_return b; ++ #undef RETURN_TYPE_b ++ #define RETURN_TYPE_b DAAP2SQL_expr_return ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ retval.result= NULL; retval.valid= 1; ++ STR1 = NULL; ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ { ++ { ++ // DAAP2SQL.g:70:2: ( ^( OPAND a= expr b= expr ) | ^( OPOR a= expr b= expr ) | STR ) ++ ++ ANTLR3_UINT32 alt1; ++ ++ alt1=3; ++ ++ switch ( LA(1) ) ++ { ++ case OPAND: ++ { ++ alt1=1; ++ } ++ break; ++ case OPOR: ++ { ++ alt1=2; ++ } ++ break; ++ case STR: ++ { ++ alt1=3; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleexprEx; ++ } ++ ++ switch (alt1) ++ { ++ case 1: ++ // DAAP2SQL.g:70:4: ^( OPAND a= expr b= expr ) ++ { ++ MATCHT(OPAND, &FOLLOW_OPAND_in_expr95); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_DOWN, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_expr_in_expr101); ++ a=expr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_expr_in_expr107); ++ b=expr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_UP, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ { ++ ++ if (a.valid && b.valid) ++ { ++ retval.result= a.result->factory->newRaw(a.result->factory); ++ retval.result->append8(retval.result, "("); ++ retval.result->appendS(retval.result, a.result); ++ retval.result->append8(retval.result, " AND "); ++ retval.result->appendS(retval.result, b.result); ++ retval.result->append8(retval.result, ")"); ++ } ++ else if (a.valid) ++ { ++ retval.result= a.result->factory->newRaw(a.result->factory); ++ retval.result->appendS(retval.result, a.result); ++ } ++ else if (b.valid) ++ { ++ retval.result= b.result->factory->newRaw(b.result->factory); ++ retval.result->appendS(retval.result, b.result); ++ } ++ else ++ { ++ retval.valid= 0; ++ } ++ ++ } ++ ++ } ++ break; ++ case 2: ++ // DAAP2SQL.g:96:4: ^( OPOR a= expr b= expr ) ++ { ++ MATCHT(OPOR, &FOLLOW_OPOR_in_expr118); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_DOWN, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_expr_in_expr124); ++ a=expr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_expr_in_expr130); ++ b=expr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_UP, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ { ++ ++ if (a.valid && b.valid) ++ { ++ retval.result= a.result->factory->newRaw(a.result->factory); ++ retval.result->append8(retval.result, "("); ++ retval.result->appendS(retval.result, a.result); ++ retval.result->append8(retval.result, " OR "); ++ retval.result->appendS(retval.result, b.result); ++ retval.result->append8(retval.result, ")"); ++ } ++ else if (a.valid) ++ { ++ retval.result= a.result->factory->newRaw(a.result->factory); ++ retval.result->appendS(retval.result, a.result); ++ } ++ else if (b.valid) ++ { ++ retval.result= b.result->factory->newRaw(b.result->factory); ++ retval.result->appendS(retval.result, b.result); ++ } ++ else ++ { ++ retval.valid= 0; ++ } ++ ++ } ++ ++ } ++ break; ++ case 3: ++ // DAAP2SQL.g:122:4: STR ++ { ++ STR1 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expr140); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ { ++ ++ pANTLR3_STRING str; ++ pANTLR3_UINT8 field; ++ pANTLR3_UINT8 val; ++ pANTLR3_UINT8 escaped; ++ ANTLR3_UINT8 op; ++ int neg_op; ++ const struct dmap_query_field_map *dqfm; ++ char *end; ++ long long llval; ++ ++ escaped = NULL; ++ ++ retval.result= (STR1->getText(STR1))->factory->newRaw((STR1->getText(STR1))->factory); ++ ++ str = (STR1->getText(STR1))->toUTF8((STR1->getText(STR1))); ++ ++ /* NOTE: the lexer delivers the string without quotes ++ which may not be obvious from the grammar due to embedded code ++ */ ++ ++ /* Make daap.songalbumid:0 a no-op */ ++ if (strcmp((char *)str->chars, "daap.songalbumid:0") == 0) ++ { ++ retval.result->append8(retval.result, "1 = 1"); ++ ++ goto STR_out; ++ } ++ ++ field = str->chars; ++ ++ val = field; ++ while ((*val != '\0') && ((*val == '.') ++ || (*val == '-') ++ || ((*val >= 'a') && (*val <= 'z')) ++ || ((*val >= 'A') && (*val <= 'Z')) ++ || ((*val >= '0') && (*val <= '9')))) ++ { ++ val++; ++ } ++ ++ if (*field == '\0') ++ { ++ DPRINTF(E_LOG, L_DAAP, "No field name found in clause '%s'\n", field); ++ retval.valid= 0; ++ goto STR_result_valid_0; /* ABORT */ ++ } ++ ++ if (*val == '\0') ++ { ++ DPRINTF(E_LOG, L_DAAP, "No operator found in clause '%s'\n", field); ++ retval.valid= 0; ++ goto STR_result_valid_0; /* ABORT */ ++ } ++ ++ op = *val; ++ *val = '\0'; ++ val++; ++ ++ if (op == '!') ++ { ++ if (*val == '\0') ++ { ++ DPRINTF(E_LOG, L_DAAP, "Negation found but operator missing in clause '%s%c'\n", field, op); ++ retval.valid= 0; ++ goto STR_result_valid_0; /* ABORT */ ++ } ++ ++ neg_op = 1; ++ op = *val; ++ val++; ++ } ++ else ++ neg_op = 0; ++ ++ /* Lookup DMAP field in the query field map */ ++ dqfm = daap_query_field_lookup((char *)field, strlen((char *)field)); ++ if (!dqfm) ++ { ++ DPRINTF(E_LOG, L_DAAP, "DMAP field '%s' is not a valid field in queries\n", field); ++ retval.valid= 0; ++ goto STR_result_valid_0; /* ABORT */ ++ } ++ ++ /* Empty values OK for string fields, NOK for integer */ ++ if (*val == '\0') ++ { ++ if (dqfm->as_int) ++ { ++ DPRINTF(E_LOG, L_DAAP, "No value given in clause '%s%s%c'\n", field, (neg_op) ? "!" : "", op); ++ retval.valid= 0; ++ goto STR_result_valid_0; /* ABORT */ ++ } ++ ++ /* No need to exclude empty artist and album, as forked-daapd makes sure there always exists an artist/album. */ ++ if (neg_op && op == ':' ++ && (strcmp((char *)field, "daap.songalbumartist") == 0 ++ || strcmp((char *)field, "daap.songartist") == 0 ++ || strcmp((char *)field, "daap.songalbum") == 0)) ++ { ++ DPRINTF(E_DBG, L_DAAP, "Ignoring clause '%s%s%c'\n", field, (neg_op) ? "!" : "", op); ++ retval.valid= 0; ++ goto STR_result_valid_0; ++ } ++ ++ /* Need to check against NULL too */ ++ if (op == ':') ++ retval.result->append8(retval.result, "("); ++ } ++ ++ /* Int field: check integer conversion */ ++ if (dqfm->as_int) ++ { ++ errno = 0; ++ llval = strtoll((const char *)val, &end, 10); ++ ++ if (((errno == ERANGE) && ((llval == LLONG_MAX) || (llval == LLONG_MIN))) ++ || ((errno != 0) && (llval == 0))) ++ { ++ DPRINTF(E_LOG, L_DAAP, "Value '%s' in clause '%s%s%c%s' does not convert to an integer type\n", ++ val, field, (neg_op) ? "!" : "", op, val); ++ retval.valid= 0; ++ goto STR_result_valid_0; /* ABORT */ ++ } ++ ++ if (end == (char *)val) ++ { ++ DPRINTF(E_LOG, L_DAAP, "Value '%s' in clause '%s%s%c%s' does not represent an integer value\n", ++ val, field, (neg_op) ? "!" : "", op, val); ++ retval.valid= 0; ++ goto STR_result_valid_0; /* ABORT */ ++ } ++ ++ *end = '\0'; /* Cut out potential garbage - we're being kind */ ++ ++ /* forked-daapd only has media_kind = 1 for music - so remove media_kind = 32 to imporve select query performance. */ ++ if (llval == 32 ++ && (strcmp((char *)field, "com.apple.itunes.mediakind") == 0 ++ || strcmp((char *)field, "com.apple.itunes.extended-media-kind") == 0)) ++ { ++ DPRINTF(E_DBG, L_DAAP, "Ignoring clause '%s%s%c%s'\n", field, (neg_op) ? "!" : "", op, val); ++ ++ if (neg_op) ++ retval.result->append8(retval.result, "1 = 1"); ++ else ++ retval.result->append8(retval.result, "1 = 0"); ++ ++ goto STR_out; ++ } ++ } ++ /* String field: escape string, check for '*' */ ++ else ++ { ++ if (op != ':') ++ { ++ DPRINTF(E_LOG, L_DAAP, "Operation '%c' not valid for string values\n", op); ++ retval.valid= 0; ++ goto STR_result_valid_0; /* ABORT */ ++ } ++ ++ escaped = (pANTLR3_UINT8)db_escape_string((char *)val); ++ if (!escaped) ++ { ++ DPRINTF(E_LOG, L_DAAP, "Could not escape value\n"); ++ retval.valid= 0; ++ goto STR_result_valid_0; /* ABORT */ ++ } ++ ++ val = escaped; ++ ++ if (val[0] == '*') ++ { ++ op = '%'; ++ val[0] = '%'; ++ } ++ ++ if (val[0] && val[1] && val[strlen((char *)val) - 1] == '*') ++ { ++ op = '%'; ++ val[strlen((char *)val) - 1] = '%'; ++ } ++ } ++ ++ retval.result->append8(retval.result, dqfm->db_col); ++ ++ switch(op) ++ { ++ case ':': ++ if (neg_op) ++ retval.result->append8(retval.result, " <> "); ++ else ++ retval.result->append8(retval.result, " = "); ++ break; ++ ++ case '+': ++ if (neg_op) ++ retval.result->append8(retval.result, " <= "); ++ else ++ retval.result->append8(retval.result, " > "); ++ break; ++ ++ case '-': ++ if (neg_op) ++ retval.result->append8(retval.result, " >= "); ++ else ++ retval.result->append8(retval.result, " < "); ++ break; ++ ++ case '%': ++ retval.result->append8(retval.result, " LIKE "); ++ break; ++ ++ default: ++ if (neg_op) ++ DPRINTF(E_LOG, L_DAAP, "Missing or unknown operator '%c' in clause '%s!%c%s'\n", op, field, op, val); ++ else ++ DPRINTF(E_LOG, L_DAAP, "Unknown operator '%c' in clause '%s%c%s'\n", op, field, op, val); ++ retval.valid= 0; ++ goto STR_result_valid_0; /* ABORT */ ++ break; ++ } ++ ++ if (!dqfm->as_int) ++ retval.result->append8(retval.result, "'"); ++ ++ retval.result->append8(retval.result, (const char *)val); ++ ++ if (!dqfm->as_int) ++ retval.result->append8(retval.result, "'"); ++ ++ /* For empty string value, we need to check against NULL too */ ++ if ((*val == '\0') && (op == ':')) ++ { ++ if (neg_op) ++ retval.result->append8(retval.result, " AND "); ++ else ++ retval.result->append8(retval.result, " OR "); ++ ++ retval.result->append8(retval.result, dqfm->db_col); ++ ++ if (neg_op) ++ retval.result->append8(retval.result, " IS NOT NULL"); ++ else ++ retval.result->append8(retval.result, " IS NULL"); ++ ++ retval.result->append8(retval.result, ")"); ++ } ++ ++ STR_result_valid_0: /* bail out label */ ++ ; ++ ++ if (escaped) ++ free(escaped); ++ ++ STR_out: /* get out of here */ ++ ; ++ ++ } ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleexprEx; /* Prevent compiler warnings */ ++ ruleexprEx: ; ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end expr */ ++/* End of parsing rules ++ * ============================================== ++ */ ++ ++/* ============================================== ++ * Syntactic predicates ++ */ ++/* End of syntactic predicates ++ * ============================================== ++ */ ++ ++ ++ ++ ++ ++ ++/* End of code ++ * ============================================================================= ++ */ +diff --git a/src/pregen/DAAP2SQL.h b/src/pregen/DAAP2SQL.h +new file mode 100644 +index 0000000..e829049 +--- /dev/null ++++ b/src/pregen/DAAP2SQL.h +@@ -0,0 +1,195 @@ ++/** \file ++ * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : DAAP2SQL.g ++ * - On : 2016-01-01 12:23:43 ++ * - for the tree parser : DAAP2SQLTreeParser * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++ * The tree parser DAAP2SQL has the callable functions (rules) shown below, ++ * which will invoke the code for the associated rule in the source grammar ++ * assuming that the input stream is pointing to a token/text stream that could begin ++ * this rule. ++ * ++ * For instance if you call the first (topmost) rule in a parser grammar, you will ++ * get the results of a full parse, but calling a rule half way through the grammar will ++ * allow you to pass part of a full token stream to the parser, such as for syntax checking ++ * in editors and so on. ++ * ++ * The parser entry points are called indirectly (by function pointer to function) via ++ * a parser context typedef pDAAP2SQL, which is returned from a call to DAAP2SQLNew(). ++ * ++ * The methods in pDAAP2SQL are as follows: ++ * ++ * - pANTLR3_STRING pDAAP2SQL->query(pDAAP2SQL) ++ * - DAAP2SQL_expr_return pDAAP2SQL->expr(pDAAP2SQL) ++ * ++ * The return type for any particular rule is of course determined by the source ++ * grammar file. ++ */ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++#ifndef _DAAP2SQL_H ++#define _DAAP2SQL_H ++/* ============================================================================= ++ * Standard antlr3 C runtime definitions ++ */ ++#include ++ ++/* End of standard antlr 3 runtime definitions ++ * ============================================================================= ++ */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++// Forward declare the context typedef so that we can use it before it is ++// properly defined. Delegators and delegates (from import statements) are ++// interdependent and their context structures contain pointers to each other ++// C only allows such things to be declared if you pre-declare the typedef. ++// ++typedef struct DAAP2SQL_Ctx_struct DAAP2SQL, * pDAAP2SQL; ++ ++ ++ ++ #include ++ #include ++ #include ++ #include ++ #include ++ ++ #include "logger.h" ++ #include "db.h" ++ #include "daap_query.h" ++ ++ ++#ifdef ANTLR3_WINDOWS ++// Disable: Unreferenced parameter, - Rules with parameters that are not used ++// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually) ++// initialized but unused variable - tree rewrite variables declared but not needed ++// Unreferenced local variable - lexer rule declares but does not always use _type ++// potentially unitialized variable used - retval always returned from a rule ++// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns ++// ++// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at ++// and the codegen must generate some of these warnings by necessity, apart from 4100, which is ++// usually generated when a parser rule is given a parameter that it does not use. Mostly though ++// this is a matter of orthogonality hence I disable that one. ++// ++#pragma warning( disable : 4100 ) ++#pragma warning( disable : 4101 ) ++#pragma warning( disable : 4127 ) ++#pragma warning( disable : 4189 ) ++#pragma warning( disable : 4505 ) ++#pragma warning( disable : 4701 ) ++#endif ++typedef struct DAAP2SQL_expr_return_struct ++{ ++ pANTLR3_BASE_TREE start; ++ pANTLR3_BASE_TREE stop; ++ pANTLR3_STRING result; ++ int valid; ++} ++ DAAP2SQL_expr_return; ++ ++ ++ ++/** Context tracking structure for DAAP2SQL ++ */ ++struct DAAP2SQL_Ctx_struct ++{ ++ /** Built in ANTLR3 context tracker contains all the generic elements ++ * required for context tracking. ++ */ ++ pANTLR3_TREE_PARSER pTreeParser; ++ ++ ++ pANTLR3_STRING (*query) (struct DAAP2SQL_Ctx_struct * ctx); ++ DAAP2SQL_expr_return (*expr) (struct DAAP2SQL_Ctx_struct * ctx); ++ // Delegated rules ++ const char * (*getGrammarFileName)(); ++ void (*free) (struct DAAP2SQL_Ctx_struct * ctx); ++ ++}; ++ ++// Function protoypes for the constructor functions that external translation units ++// such as delegators and delegates may wish to call. ++// ++ANTLR3_API pDAAP2SQL DAAP2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream); ++ANTLR3_API pDAAP2SQL DAAP2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state); ++ ++/** Symbolic definitions of all the tokens that the tree parser will work with. ++ * \{ ++ * ++ * Antlr will define EOF, but we can't use that as it it is too common in ++ * in C header files and that would be confusing. There is no way to filter this out at the moment ++ * so we just undef it here for now. That isn't the value we get back from C recognizers ++ * anyway. We are looking for ANTLR3_TOKEN_EOF. ++ */ ++#ifdef EOF ++#undef EOF ++#endif ++#ifdef Tokens ++#undef Tokens ++#endif ++#define STR 9 ++#define QUOTE 10 ++#define NEWLINE 4 ++#define LPAR 7 ++#define OPOR 5 ++#define RPAR 8 ++#define ESCAPED 11 ++#define OPAND 6 ++#define EOF -1 ++#ifdef EOF ++#undef EOF ++#define EOF ANTLR3_TOKEN_EOF ++#endif ++ ++#ifndef TOKENSOURCE ++#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource ++#endif ++ ++/* End of token definitions for DAAP2SQL ++ * ============================================================================= ++ */ ++/** \} */ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif ++ ++/* END - Note:Keep extra line feed to satisfy UNIX systems */ +diff --git a/src/pregen/DAAP2SQL.u b/src/pregen/DAAP2SQL.u +new file mode 100644 +index 0000000..385d80b +--- /dev/null ++++ b/src/pregen/DAAP2SQL.u +@@ -0,0 +1,5 @@ ++DAAP2SQL.g: DAAP.tokens ++DAAP2SQL.c : DAAP2SQL.g ++./DAAP2SQL.tokens : DAAP2SQL.g ++DAAP2SQL.h : DAAP2SQL.g ++ANTLR_PRODUCTS += DAAP2SQL.c ./DAAP2SQL.tokens DAAP2SQL.h +\ No newline at end of file +diff --git a/src/pregen/DAAPLexer.c b/src/pregen/DAAPLexer.c +new file mode 100644 +index 0000000..eab3ff4 +--- /dev/null ++++ b/src/pregen/DAAPLexer.c +@@ -0,0 +1,1101 @@ ++/** \file ++ * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : DAAP.g ++ * - On : 2016-01-01 12:23:41 ++ * - for the lexer : DAAPLexerLexer * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++*/ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++/* ----------------------------------------- ++ * Include the ANTLR3 generated header file. ++ */ ++#include "DAAPLexer.h" ++/* ----------------------------------------- */ ++ ++ ++ ++ ++ ++/* MACROS that hide the C interface implementations from the ++ * generated code, which makes it a little more understandable to the human eye. ++ * I am very much against using C pre-processor macros for function calls and bits ++ * of code as you cannot see what is happening when single stepping in debuggers ++ * and so on. The exception (in my book at least) is for generated code, where you are ++ * not maintaining it, but may wish to read and understand it. If you single step it, you know that input() ++ * hides some indirect calls, but is always referring to the input stream. This is ++ * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig ++ * the runtime interfaces without changing the generated code too often, without ++ * confusing the reader of the generated output, who may not wish to know the gory ++ * details of the interface inheritance. ++ */ ++ ++#define CTX ctx ++ ++/* Aids in accessing scopes for grammar programmers ++ */ ++#undef SCOPE_TYPE ++#undef SCOPE_STACK ++#undef SCOPE_TOP ++#define SCOPE_TYPE(scope) pDAAPLexer_##scope##_SCOPE ++#define SCOPE_STACK(scope) pDAAPLexer_##scope##Stack ++#define SCOPE_TOP(scope) ctx->pDAAPLexer_##scope##Top ++#define SCOPE_SIZE(scope) ctx->pDAAPLexer_##scope##Stack_limit ++#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i)) ++ ++ ++/* Macros for accessing things in a lexer ++ */ ++#undef LEXER ++#undef RECOGNIZER ++#undef RULEMEMO ++#undef GETCHARINDEX ++#undef GETLINE ++#undef GETCHARPOSITIONINLINE ++#undef EMIT ++#undef EMITNEW ++#undef MATCHC ++#undef MATCHS ++#undef MATCHRANGE ++#undef LTOKEN ++#undef HASFAILED ++#undef FAILEDFLAG ++#undef INPUT ++#undef STRSTREAM ++#undef LA ++#undef HASEXCEPTION ++#undef EXCEPTION ++#undef CONSTRUCTEX ++#undef CONSUME ++#undef LRECOVER ++#undef MARK ++#undef REWIND ++#undef REWINDLAST ++#undef BACKTRACKING ++#undef MATCHANY ++#undef MEMOIZE ++#undef HAVEPARSEDRULE ++#undef GETTEXT ++#undef INDEX ++#undef SEEK ++#undef PUSHSTREAM ++#undef POPSTREAM ++#undef SETTEXT ++#undef SETTEXT8 ++ ++#define LEXER ctx->pLexer ++#define RECOGNIZER LEXER->rec ++#define LEXSTATE RECOGNIZER->state ++#define TOKSOURCE LEXSTATE->tokSource ++#define GETCHARINDEX() LEXER->getCharIndex(LEXER) ++#define GETLINE() LEXER->getLine(LEXER) ++#define GETTEXT() LEXER->getText(LEXER) ++#define GETCHARPOSITIONINLINE() LEXER->getCharPositionInLine(LEXER) ++#define EMIT() LEXSTATE->type = _type; LEXER->emit(LEXER) ++#define EMITNEW(t) LEXER->emitNew(LEXER, t) ++#define MATCHC(c) LEXER->matchc(LEXER, c) ++#define MATCHS(s) LEXER->matchs(LEXER, s) ++#define MATCHRANGE(c1,c2) LEXER->matchRange(LEXER, c1, c2) ++#define MATCHANY() LEXER->matchAny(LEXER) ++#define LTOKEN LEXSTATE->token ++#define HASFAILED() (LEXSTATE->failed == ANTLR3_TRUE) ++#define BACKTRACKING LEXSTATE->backtracking ++#define FAILEDFLAG LEXSTATE->failed ++#define INPUT LEXER->input ++#define STRSTREAM INPUT ++#define ISTREAM INPUT->istream ++#define INDEX() ISTREAM->index(ISTREAM) ++#define SEEK(n) ISTREAM->seek(ISTREAM, n) ++#define EOF_TOKEN &(LEXSTATE->tokSource->eofToken) ++#define HASEXCEPTION() (LEXSTATE->error == ANTLR3_TRUE) ++#define EXCEPTION LEXSTATE->exception ++#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER) ++#define LRECOVER() LEXER->recover(LEXER) ++#define MARK() ISTREAM->mark(ISTREAM) ++#define REWIND(m) ISTREAM->rewind(ISTREAM, m) ++#define REWINDLAST() ISTREAM->rewindLast(ISTREAM) ++#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si) ++#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r) ++#define PUSHSTREAM(str) LEXER->pushCharStream(LEXER, str) ++#define POPSTREAM() LEXER->popCharStream(LEXER) ++#define SETTEXT(str) LEXSTATE->text = str ++#define SKIP() LEXSTATE->token = &(TOKSOURCE->skipToken) ++#define USER1 LEXSTATE->user1 ++#define USER2 LEXSTATE->user2 ++#define USER3 LEXSTATE->user3 ++#define CUSTOM LEXSTATE->custom ++#define RULEMEMO LEXSTATE->ruleMemo ++#define DBG RECOGNIZER->debugger ++ ++/* If we have been told we can rely on the standard 8 bit or 16 bit input ++ * stream, then we can define our macros to use the direct pointers ++ * in the input object, which is much faster than indirect calls. This ++ * is really only significant to lexers with a lot of fragment rules (which ++ * do not place LA(1) in a temporary at the moment) and even then ++ * only if there is a lot of input (order of say 1M or so). ++ */ ++#if defined(ANTLR3_INLINE_INPUT_ASCII) || defined(ANTLR3_INLINE_INPUT_UTF16) ++ ++# ifdef ANTLR3_INLINE_INPUT_ASCII ++ ++/* 8 bit "ASCII" (actually any 8 bit character set) */ ++ ++# define NEXTCHAR ((pANTLR3_UINT8)(INPUT->nextChar)) ++# define DATAP ((pANTLR3_UINT8)(INPUT->data)) ++ ++# else ++ ++# define NEXTCHAR ((pANTLR3_UINT16)(INPUT->nextChar)) ++# define DATAP ((pANTLR3_UINT16)(INPUT->data)) ++ ++# endif ++ ++# define LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1))) ++# define CONSUME() \ ++{ \ ++ if (NEXTCHAR < (DATAP + INPUT->sizeBuf)) \ ++ { \ ++ INPUT->charPositionInLine++; \ ++ if ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar) \ ++ { \ ++ INPUT->line++; \ ++ INPUT->charPositionInLine = 0; \ ++ INPUT->currentLine = (void *)(NEXTCHAR + 1); \ ++ } \ ++ INPUT->nextChar = (void *)(NEXTCHAR + 1); \ ++ } \ ++} ++ ++#else ++ ++// Pick up the input character by calling the input stream implementation. ++// ++#define CONSUME() INPUT->istream->consume(INPUT->istream) ++#define LA(n) INPUT->istream->_LA(INPUT->istream, n) ++ ++#endif ++#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt ++ ++/* The 4 tokens defined below may well clash with your own #defines or token types. If so ++ * then for the present you must use different names for your defines as these are hard coded ++ * in the code generator. It would be better not to use such names internally, and maybe ++ * we can change this in a forthcoming release. I deliberately do not #undef these ++ * here as this will at least give you a redefined error somewhere if they clash. ++ */ ++#define UP ANTLR3_TOKEN_UP ++#define DOWN ANTLR3_TOKEN_DOWN ++#define EOR ANTLR3_TOKEN_EOR ++#define INVALID ANTLR3_TOKEN_INVALID ++ ++ ++/* ============================================================================= ++ * Functions to create and destroy scopes. First come the rule scopes, followed ++ * by the global declared scopes. ++ */ ++ ++ ++ ++/* ============================================================================= */ ++ ++/* ============================================================================= ++ * Start of recognizer ++ */ ++ ++ ++/* Forward declare the locally static matching functions we have generated and any predicate functions. ++ */ ++static ANTLR3_INLINE void mQUOTE (pDAAPLexer ctx); ++static ANTLR3_INLINE void mLPAR (pDAAPLexer ctx); ++static ANTLR3_INLINE void mRPAR (pDAAPLexer ctx); ++static ANTLR3_INLINE void mOPAND (pDAAPLexer ctx); ++static ANTLR3_INLINE void mOPOR (pDAAPLexer ctx); ++static ANTLR3_INLINE void mNEWLINE (pDAAPLexer ctx); ++static ANTLR3_INLINE void mSTR (pDAAPLexer ctx); ++static ANTLR3_INLINE void mESCAPED (pDAAPLexer ctx); ++static ANTLR3_INLINE void mTokens (pDAAPLexer ctx); ++static void DAAPLexerFree(pDAAPLexer ctx); ++ ++/* ========================================================================= ++ * Lexer matching rules end. ++ * ========================================================================= ++ */ ++ ++ ++ ++static void ++DAAPLexerFree (pDAAPLexer ctx) ++{ ++ LEXER->free(LEXER); ++ ++ ANTLR3_FREE(ctx); ++} ++ ++/** \brief Name of the grammar file that generated this code ++ */ ++static const char fileName[] = "DAAP.g"; ++ ++/** \brief Return the name of the grammar file that generated this code. ++ */ ++static const char * getGrammarFileName() ++{ ++ return fileName; ++} ++ ++/** \brief Create a new lexer called DAAPLexer ++ * ++ * \param[in] instream Pointer to an initialized input stream ++ * \return ++ * - Success pDAAPLexer initialized for the lex start ++ * - Fail NULL ++ */ ++ANTLR3_API pDAAPLexer DAAPLexerNew ++(pANTLR3_INPUT_STREAM instream) ++{ ++ // See if we can create a new lexer with the standard constructor ++ // ++ return DAAPLexerNewSSD(instream, NULL); ++} ++ ++/** \brief Create a new lexer called DAAPLexer ++ * ++ * \param[in] instream Pointer to an initialized input stream ++ * \param[state] state Previously created shared recognizer stat ++ * \return ++ * - Success pDAAPLexer initialized for the lex start ++ * - Fail NULL ++ */ ++ANTLR3_API pDAAPLexer DAAPLexerNewSSD ++(pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state) ++{ ++ pDAAPLexer ctx; // Context structure we will build and return ++ ++ ctx = (pDAAPLexer) ANTLR3_CALLOC(1, sizeof(DAAPLexer)); ++ ++ if (ctx == NULL) ++ { ++ // Failed to allocate memory for lexer context ++ return NULL; ++ } ++ ++ /* ------------------------------------------------------------------- ++ * Memory for basic structure is allocated, now to fill in ++ * in base ANTLR3 structures. We initialize the function pointers ++ * for the standard ANTLR3 lexer function set, but upon return ++ * from here, the programmer may set the pointers to provide custom ++ * implementations of each function. ++ * ++ * We don't use the macros defined in DAAPLexer.h here so you can get a sense ++ * of what goes where. ++ */ ++ ++ /* Create a base lexer, using the supplied input stream ++ */ ++ ctx->pLexer = antlr3LexerNewStream(ANTLR3_SIZE_HINT, instream, state); ++ ++ /* Check that we allocated the memory correctly ++ */ ++ if (ctx->pLexer == NULL) ++ { ++ ANTLR3_FREE(ctx); ++ return NULL; ++ } ++ /* Install the implementation of our DAAPLexer interface ++ */ ++ ctx->mQUOTE = mQUOTE; ++ ctx->mLPAR = mLPAR; ++ ctx->mRPAR = mRPAR; ++ ctx->mOPAND = mOPAND; ++ ctx->mOPOR = mOPOR; ++ ctx->mNEWLINE = mNEWLINE; ++ ctx->mSTR = mSTR; ++ ctx->mESCAPED = mESCAPED; ++ ctx->mTokens = mTokens; ++ ++ /** When the nextToken() call is made to this lexer's pANTLR3_TOKEN_SOURCE ++ * it will call mTokens() in this generated code, and will pass it the ctx ++ * pointer of this lexer, not the context of the base lexer, so store that now. ++ */ ++ ctx->pLexer->ctx = ctx; ++ ++ /**Install the token matching function ++ */ ++ ctx->pLexer->mTokens = (void (*) (void *))(mTokens); ++ ++ ctx->getGrammarFileName = getGrammarFileName; ++ ctx->free = DAAPLexerFree; ++ ++ ++ ++ ++ ++ /* Return the newly built lexer to the caller ++ */ ++ return ctx; ++} ++ ++ ++/* ========================================================================= ++ * Functions to match the lexer grammar defined tokens from the input stream ++ */ ++ ++// Comes from: 40:7: ( '\\'' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start QUOTE ++ * ++ * Looks to match the characters the constitute the token QUOTE ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mQUOTE(pDAAPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = QUOTE; ++ ++ ++ // DAAP.g:40:7: ( '\\'' ) ++ // DAAP.g:40:9: '\\'' ++ { ++ MATCHC('\''); ++ if (HASEXCEPTION()) ++ { ++ goto ruleQUOTEEx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleQUOTEEx; /* Prevent compiler warnings */ ++ ruleQUOTEEx: ; ++ ++} ++// $ANTLR end QUOTE ++ ++// Comes from: 41:6: ( '(' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start LPAR ++ * ++ * Looks to match the characters the constitute the token LPAR ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mLPAR(pDAAPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = LPAR; ++ ++ ++ // DAAP.g:41:6: ( '(' ) ++ // DAAP.g:41:8: '(' ++ { ++ MATCHC('('); ++ if (HASEXCEPTION()) ++ { ++ goto ruleLPAREx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleLPAREx; /* Prevent compiler warnings */ ++ ruleLPAREx: ; ++ ++} ++// $ANTLR end LPAR ++ ++// Comes from: 42:6: ( ')' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start RPAR ++ * ++ * Looks to match the characters the constitute the token RPAR ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mRPAR(pDAAPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = RPAR; ++ ++ ++ // DAAP.g:42:6: ( ')' ) ++ // DAAP.g:42:8: ')' ++ { ++ MATCHC(')'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleRPAREx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleRPAREx; /* Prevent compiler warnings */ ++ ruleRPAREx: ; ++ ++} ++// $ANTLR end RPAR ++ ++// Comes from: 44:7: ( '+' | ' ' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start OPAND ++ * ++ * Looks to match the characters the constitute the token OPAND ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mOPAND(pDAAPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = OPAND; ++ ++ ++ // DAAP.g:44:7: ( '+' | ' ' ) ++ // DAAP.g: ++ { ++ if ( LA(1) == ' ' || LA(1) == '+' ) ++ { ++ CONSUME(); ++ ++ } ++ else ++ { ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION; ++ EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME; ++ ++ LRECOVER(); goto ruleOPANDEx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleOPANDEx; /* Prevent compiler warnings */ ++ ruleOPANDEx: ; ++ ++} ++// $ANTLR end OPAND ++ ++// Comes from: 45:6: ( ',' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start OPOR ++ * ++ * Looks to match the characters the constitute the token OPOR ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mOPOR(pDAAPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = OPOR; ++ ++ ++ // DAAP.g:45:6: ( ',' ) ++ // DAAP.g:45:8: ',' ++ { ++ MATCHC(','); ++ if (HASEXCEPTION()) ++ { ++ goto ruleOPOREx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleOPOREx; /* Prevent compiler warnings */ ++ ruleOPOREx: ; ++ ++} ++// $ANTLR end OPOR ++ ++// Comes from: 47:9: ( ( '\\r' )? '\\n' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start NEWLINE ++ * ++ * Looks to match the characters the constitute the token NEWLINE ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mNEWLINE(pDAAPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = NEWLINE; ++ ++ ++ // DAAP.g:47:9: ( ( '\\r' )? '\\n' ) ++ // DAAP.g:47:11: ( '\\r' )? '\\n' ++ { ++ ++ // DAAP.g:47:11: ( '\\r' )? ++ { ++ int alt1=2; ++ switch ( LA(1) ) ++ { ++ case '\r': ++ { ++ alt1=1; ++ } ++ break; ++ } ++ ++ switch (alt1) ++ { ++ case 1: ++ // DAAP.g:47:11: '\\r' ++ { ++ MATCHC('\r'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleNEWLINEEx; ++ } ++ ++ ++ } ++ break; ++ ++ } ++ } ++ MATCHC('\n'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleNEWLINEEx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleNEWLINEEx; /* Prevent compiler warnings */ ++ ruleNEWLINEEx: ; ++ ++} ++// $ANTLR end NEWLINE ++ ++// Comes from: 55:2: ( QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start STR ++ * ++ * Looks to match the characters the constitute the token STR ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mSTR(pDAAPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ pANTLR3_COMMON_TOKEN esc; ++ ANTLR3_UINT32 reg; ++ ++ ++ esc = NULL; ++ ++ _type = STR; ++ ++ pANTLR3_STRING unesc = GETTEXT()->factory->newRaw(GETTEXT()->factory); ++ ++ // DAAP.g:55:2: ( QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE ) ++ // DAAP.g:55:4: QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE ++ { ++ /* 55:4: QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE */ ++ mQUOTE(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTREx; ++ } ++ ++ // DAAP.g:55:10: (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ ++ { ++ int cnt2=0; ++ ++ for (;;) ++ { ++ int alt2=3; ++ { ++ /* dfaLoopbackState(k,edges,eotPredictsAlt,description,stateNumber,semPredState) ++ */ ++ int LA2_0 = LA(1); ++ if ( (((LA2_0 >= 0x0000) && (LA2_0 <= '&')) || ((LA2_0 >= '(') && (LA2_0 <= '[')) || ((LA2_0 >= ']') && (LA2_0 <= 0xFFFF))) ) ++ { ++ alt2=1; ++ } ++ else if ( (LA2_0 == '\\') ) ++ { ++ alt2=2; ++ } ++ ++ } ++ switch (alt2) ++ { ++ case 1: ++ // DAAP.g:55:12: reg=~ ( '\\\\' | '\\'' ) ++ { ++ reg= LA(1); ++ if ( ((LA(1) >= 0x0000) && (LA(1) <= '&')) || ((LA(1) >= '(') && (LA(1) <= '[')) || ((LA(1) >= ']') && (LA(1) <= 0xFFFF)) ) ++ { ++ CONSUME(); ++ ++ } ++ else ++ { ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION; ++ EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME; ++ ++ LRECOVER(); goto ruleSTREx; ++ } ++ ++ { ++ unesc->addc(unesc, reg); ++ } ++ ++ } ++ break; ++ case 2: ++ // DAAP.g:56:6: esc= ESCAPED ++ { ++ /* 56:6: esc= ESCAPED */ ++ { ++ ANTLR3_MARKER escStart118 = GETCHARINDEX(); ++ mESCAPED(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTREx; ++ } ++ ++ esc = LEXSTATE->tokFactory->newToken(LEXSTATE->tokFactory); ++ esc->setType(esc, ANTLR3_TOKEN_INVALID); ++ esc->setStartIndex(esc, escStart118); ++ esc->setStopIndex(esc, GETCHARINDEX()-1); ++ esc->input = INPUT; ++ } ++ { ++ unesc->appendS(unesc, GETTEXT()); ++ } ++ ++ } ++ break; ++ ++ default: ++ ++ if ( cnt2 >= 1 ) ++ { ++ goto loop2; ++ } ++ /* mismatchedSetEx() ++ */ ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION; ++ EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME; ++ ++ ++ goto ruleSTREx; ++ } ++ cnt2++; ++ } ++ loop2: ; /* Jump to here if this rule does not match */ ++ } ++ /* 55:4: QUOTE (reg=~ ( '\\\\' | '\\'' ) | esc= ESCAPED )+ QUOTE */ ++ mQUOTE(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTREx; ++ } ++ ++ { ++ SETTEXT(unesc); ++ } ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleSTREx; /* Prevent compiler warnings */ ++ ruleSTREx: ; ++ ++ esc = NULL; ++ ++} ++// $ANTLR end STR ++ ++// Comes from: 59:9: ( '\\\\' ( '\\\\' | '\\'' ) ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start ESCAPED ++ * ++ * Looks to match the characters the constitute the token ESCAPED ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mESCAPED(pDAAPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ ++ // DAAP.g:59:9: ( '\\\\' ( '\\\\' | '\\'' ) ) ++ // DAAP.g:59:11: '\\\\' ( '\\\\' | '\\'' ) ++ { ++ MATCHC('\\'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleESCAPEDEx; ++ } ++ ++ ++ // DAAP.g:60:3: ( '\\\\' | '\\'' ) ++ { ++ int alt3=2; ++ switch ( LA(1) ) ++ { ++ case '\\': ++ { ++ alt3=1; ++ } ++ break; ++ case '\'': ++ { ++ alt3=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 3; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleESCAPEDEx; ++ } ++ ++ switch (alt3) ++ { ++ case 1: ++ // DAAP.g:60:5: '\\\\' ++ { ++ MATCHC('\\'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleESCAPEDEx; ++ } ++ ++ { ++ SETTEXT(GETTEXT()->factory->newStr8(GETTEXT()->factory, (pANTLR3_UINT8)"\\")); ++ } ++ ++ } ++ break; ++ case 2: ++ // DAAP.g:61:5: '\\'' ++ { ++ MATCHC('\''); ++ if (HASEXCEPTION()) ++ { ++ goto ruleESCAPEDEx; ++ } ++ ++ { ++ SETTEXT(GETTEXT()->factory->newStr8(GETTEXT()->factory, (pANTLR3_UINT8)"\'")); ++ } ++ ++ } ++ break; ++ ++ } ++ } ++ ++ } ++ ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleESCAPEDEx; /* Prevent compiler warnings */ ++ ruleESCAPEDEx: ; ++ ++} ++// $ANTLR end ESCAPED ++ ++/** This is the entry point in to the lexer from an object that ++ * wants to generate the next token, such as a pCOMMON_TOKEN_STREAM ++ */ ++static void ++mTokens(pDAAPLexer ctx) ++{ ++ { ++ // DAAP.g:1:8: ( QUOTE | LPAR | RPAR | OPAND | OPOR | NEWLINE | STR ) ++ ++ ANTLR3_UINT32 alt4; ++ ++ alt4=7; ++ ++ switch ( LA(1) ) ++ { ++ case '\'': ++ { ++ ++ { ++ int LA4_1 = LA(2); ++ if ( (((LA4_1 >= 0x0000) && (LA4_1 <= '&')) || ((LA4_1 >= '(') && (LA4_1 <= 0xFFFF))) ) ++ { ++ alt4=7; ++ } ++ else ++ { ++ alt4=1; } ++ } ++ } ++ break; ++ case '(': ++ { ++ alt4=2; ++ } ++ break; ++ case ')': ++ { ++ alt4=3; ++ } ++ break; ++ case ' ': ++ case '+': ++ { ++ alt4=4; ++ } ++ break; ++ case ',': ++ { ++ alt4=5; ++ } ++ break; ++ case '\n': ++ case '\r': ++ { ++ alt4=6; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 4; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ switch (alt4) ++ { ++ case 1: ++ // DAAP.g:1:10: QUOTE ++ { ++ /* 1:10: QUOTE */ ++ mQUOTE(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 2: ++ // DAAP.g:1:16: LPAR ++ { ++ /* 1:16: LPAR */ ++ mLPAR(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 3: ++ // DAAP.g:1:21: RPAR ++ { ++ /* 1:21: RPAR */ ++ mRPAR(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 4: ++ // DAAP.g:1:26: OPAND ++ { ++ /* 1:26: OPAND */ ++ mOPAND(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 5: ++ // DAAP.g:1:32: OPOR ++ { ++ /* 1:32: OPOR */ ++ mOPOR(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 6: ++ // DAAP.g:1:37: NEWLINE ++ { ++ /* 1:37: NEWLINE */ ++ mNEWLINE(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 7: ++ // DAAP.g:1:45: STR ++ { ++ /* 1:45: STR */ ++ mSTR(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ ++ } ++ } ++ ++ ++ goto ruleTokensEx; /* Prevent compiler warnings */ ++ruleTokensEx: ; ++} ++ ++/* ========================================================================= ++ * Lexer matching rules end. ++ * ========================================================================= ++ */ ++/* End of Lexer code ++ * ================================================ ++ * ================================================ ++ */ ++ ++ ++/* End of code ++ * ============================================================================= ++ */ +diff --git a/src/pregen/DAAPLexer.h b/src/pregen/DAAPLexer.h +new file mode 100644 +index 0000000..685a0bc +--- /dev/null ++++ b/src/pregen/DAAPLexer.h +@@ -0,0 +1,188 @@ ++/** \file ++ * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : DAAP.g ++ * - On : 2016-01-01 12:23:41 ++ * - for the lexer : DAAPLexerLexer * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++ * The lexer DAAPLexer has the callable functions (rules) shown below, ++ * which will invoke the code for the associated rule in the source grammar ++ * assuming that the input stream is pointing to a token/text stream that could begin ++ * this rule. ++ * ++ * For instance if you call the first (topmost) rule in a parser grammar, you will ++ * get the results of a full parse, but calling a rule half way through the grammar will ++ * allow you to pass part of a full token stream to the parser, such as for syntax checking ++ * in editors and so on. ++ * ++ * The parser entry points are called indirectly (by function pointer to function) via ++ * a parser context typedef pDAAPLexer, which is returned from a call to DAAPLexerNew(). ++ * ++ * As this is a generated lexer, it is unlikely you will call it 'manually'. However ++ * the methods are provided anyway. ++ * * The methods in pDAAPLexer are as follows: ++ * ++ * - void pDAAPLexer->QUOTE(pDAAPLexer) ++ * - void pDAAPLexer->LPAR(pDAAPLexer) ++ * - void pDAAPLexer->RPAR(pDAAPLexer) ++ * - void pDAAPLexer->OPAND(pDAAPLexer) ++ * - void pDAAPLexer->OPOR(pDAAPLexer) ++ * - void pDAAPLexer->NEWLINE(pDAAPLexer) ++ * - void pDAAPLexer->STR(pDAAPLexer) ++ * - void pDAAPLexer->ESCAPED(pDAAPLexer) ++ * - void pDAAPLexer->Tokens(pDAAPLexer) ++ * ++ * The return type for any particular rule is of course determined by the source ++ * grammar file. ++ */ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++#ifndef _DAAPLexer_H ++#define _DAAPLexer_H ++/* ============================================================================= ++ * Standard antlr3 C runtime definitions ++ */ ++#include ++ ++/* End of standard antlr 3 runtime definitions ++ * ============================================================================= ++ */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++// Forward declare the context typedef so that we can use it before it is ++// properly defined. Delegators and delegates (from import statements) are ++// interdependent and their context structures contain pointers to each other ++// C only allows such things to be declared if you pre-declare the typedef. ++// ++typedef struct DAAPLexer_Ctx_struct DAAPLexer, * pDAAPLexer; ++ ++ ++ ++#ifdef ANTLR3_WINDOWS ++// Disable: Unreferenced parameter, - Rules with parameters that are not used ++// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually) ++// initialized but unused variable - tree rewrite variables declared but not needed ++// Unreferenced local variable - lexer rule declares but does not always use _type ++// potentially unitialized variable used - retval always returned from a rule ++// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns ++// ++// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at ++// and the codegen must generate some of these warnings by necessity, apart from 4100, which is ++// usually generated when a parser rule is given a parameter that it does not use. Mostly though ++// this is a matter of orthogonality hence I disable that one. ++// ++#pragma warning( disable : 4100 ) ++#pragma warning( disable : 4101 ) ++#pragma warning( disable : 4127 ) ++#pragma warning( disable : 4189 ) ++#pragma warning( disable : 4505 ) ++#pragma warning( disable : 4701 ) ++#endif ++ ++/** Context tracking structure for DAAPLexer ++ */ ++struct DAAPLexer_Ctx_struct ++{ ++ /** Built in ANTLR3 context tracker contains all the generic elements ++ * required for context tracking. ++ */ ++ pANTLR3_LEXER pLexer; ++ ++ ++ void (*mQUOTE) (struct DAAPLexer_Ctx_struct * ctx); ++ void (*mLPAR) (struct DAAPLexer_Ctx_struct * ctx); ++ void (*mRPAR) (struct DAAPLexer_Ctx_struct * ctx); ++ void (*mOPAND) (struct DAAPLexer_Ctx_struct * ctx); ++ void (*mOPOR) (struct DAAPLexer_Ctx_struct * ctx); ++ void (*mNEWLINE) (struct DAAPLexer_Ctx_struct * ctx); ++ void (*mSTR) (struct DAAPLexer_Ctx_struct * ctx); ++ void (*mESCAPED) (struct DAAPLexer_Ctx_struct * ctx); ++ void (*mTokens) (struct DAAPLexer_Ctx_struct * ctx); const char * (*getGrammarFileName)(); ++ void (*free) (struct DAAPLexer_Ctx_struct * ctx); ++ ++}; ++ ++// Function protoypes for the constructor functions that external translation units ++// such as delegators and delegates may wish to call. ++// ++ANTLR3_API pDAAPLexer DAAPLexerNew (pANTLR3_INPUT_STREAM instream); ++ANTLR3_API pDAAPLexer DAAPLexerNewSSD (pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state); ++ ++/** Symbolic definitions of all the tokens that the lexer will work with. ++ * \{ ++ * ++ * Antlr will define EOF, but we can't use that as it it is too common in ++ * in C header files and that would be confusing. There is no way to filter this out at the moment ++ * so we just undef it here for now. That isn't the value we get back from C recognizers ++ * anyway. We are looking for ANTLR3_TOKEN_EOF. ++ */ ++#ifdef EOF ++#undef EOF ++#endif ++#ifdef Tokens ++#undef Tokens ++#endif ++#define STR 9 ++#define QUOTE 10 ++#define NEWLINE 4 ++#define LPAR 7 ++#define OPOR 5 ++#define RPAR 8 ++#define ESCAPED 11 ++#define OPAND 6 ++#define EOF -1 ++#ifdef EOF ++#undef EOF ++#define EOF ANTLR3_TOKEN_EOF ++#endif ++ ++#ifndef TOKENSOURCE ++#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource ++#endif ++ ++/* End of token definitions for DAAPLexer ++ * ============================================================================= ++ */ ++/** \} */ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif ++ ++/* END - Note:Keep extra line feed to satisfy UNIX systems */ +diff --git a/src/pregen/DAAPParser.c b/src/pregen/DAAPParser.c +new file mode 100644 +index 0000000..1091f05 +--- /dev/null ++++ b/src/pregen/DAAPParser.c +@@ -0,0 +1,1014 @@ ++/** \file ++ * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : DAAP.g ++ * - On : 2016-01-01 12:23:41 ++ * - for the parser : DAAPParserParser * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++*/ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++/* ----------------------------------------- ++ * Include the ANTLR3 generated header file. ++ */ ++#include "DAAPParser.h" ++/* ----------------------------------------- */ ++ ++ ++ ++ ++ ++/* MACROS that hide the C interface implementations from the ++ * generated code, which makes it a little more understandable to the human eye. ++ * I am very much against using C pre-processor macros for function calls and bits ++ * of code as you cannot see what is happening when single stepping in debuggers ++ * and so on. The exception (in my book at least) is for generated code, where you are ++ * not maintaining it, but may wish to read and understand it. If you single step it, you know that input() ++ * hides some indirect calls, but is always referring to the input stream. This is ++ * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig ++ * the runtime interfaces without changing the generated code too often, without ++ * confusing the reader of the generated output, who may not wish to know the gory ++ * details of the interface inheritance. ++ */ ++ ++#define CTX ctx ++ ++/* Aids in accessing scopes for grammar programmers ++ */ ++#undef SCOPE_TYPE ++#undef SCOPE_STACK ++#undef SCOPE_TOP ++#define SCOPE_TYPE(scope) pDAAPParser_##scope##_SCOPE ++#define SCOPE_STACK(scope) pDAAPParser_##scope##Stack ++#define SCOPE_TOP(scope) ctx->pDAAPParser_##scope##Top ++#define SCOPE_SIZE(scope) ctx->pDAAPParser_##scope##Stack_limit ++#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i)) ++ ++/* Macros for accessing things in the parser ++ */ ++ ++#undef PARSER ++#undef RECOGNIZER ++#undef HAVEPARSEDRULE ++#undef MEMOIZE ++#undef INPUT ++#undef STRSTREAM ++#undef HASEXCEPTION ++#undef EXCEPTION ++#undef MATCHT ++#undef MATCHANYT ++#undef FOLLOWSTACK ++#undef FOLLOWPUSH ++#undef FOLLOWPOP ++#undef PRECOVER ++#undef PREPORTERROR ++#undef LA ++#undef LT ++#undef CONSTRUCTEX ++#undef CONSUME ++#undef MARK ++#undef REWIND ++#undef REWINDLAST ++#undef PERRORRECOVERY ++#undef HASFAILED ++#undef FAILEDFLAG ++#undef RECOVERFROMMISMATCHEDSET ++#undef RECOVERFROMMISMATCHEDELEMENT ++#undef INDEX ++#undef ADAPTOR ++#undef SEEK ++#undef RULEMEMO ++#undef DBG ++ ++#define PARSER ctx->pParser ++#define RECOGNIZER PARSER->rec ++#define PSRSTATE RECOGNIZER->state ++#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r) ++#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si) ++#define INPUT PARSER->tstream ++#define STRSTREAM INPUT ++#define ISTREAM INPUT->istream ++#define INDEX() ISTREAM->index(INPUT->istream) ++#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE) ++#define EXCEPTION PSRSTATE->exception ++#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs) ++#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER) ++#define FOLLOWSTACK PSRSTATE->following ++#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL) ++#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK) ++#define PRECOVER() RECOGNIZER->recover(RECOGNIZER) ++#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER) ++#define LA(n) INPUT->istream->_LA(ISTREAM, n) ++#define LT(n) INPUT->_LT(INPUT, n) ++#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER) ++#define CONSUME() ISTREAM->consume(ISTREAM) ++#define MARK() ISTREAM->mark(ISTREAM) ++#define REWIND(m) ISTREAM->rewind(ISTREAM, m) ++#define REWINDLAST() ISTREAM->rewindLast(ISTREAM) ++#define SEEK(n) ISTREAM->seek(ISTREAM, n) ++#define PERRORRECOVERY PSRSTATE->errorRecovery ++#define FAILEDFLAG PSRSTATE->failed ++#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE) ++#define BACKTRACKING PSRSTATE->backtracking ++#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s) ++#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s) ++#define ADAPTOR ctx->adaptor ++#define RULEMEMO PSRSTATE->ruleMemo ++#define DBG RECOGNIZER->debugger ++ ++#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt ++ ++/* The 4 tokens defined below may well clash with your own #defines or token types. If so ++ * then for the present you must use different names for your defines as these are hard coded ++ * in the code generator. It would be better not to use such names internally, and maybe ++ * we can change this in a forthcoming release. I deliberately do not #undef these ++ * here as this will at least give you a redefined error somewhere if they clash. ++ */ ++#define UP ANTLR3_TOKEN_UP ++#define DOWN ANTLR3_TOKEN_DOWN ++#define EOR ANTLR3_TOKEN_EOR ++#define INVALID ANTLR3_TOKEN_INVALID ++ ++ ++/* ============================================================================= ++ * Functions to create and destroy scopes. First come the rule scopes, followed ++ * by the global declared scopes. ++ */ ++ ++ ++ ++/* ============================================================================= */ ++ ++/* ============================================================================= ++ * Start of recognizer ++ */ ++ ++ ++ ++/** \brief Table of all token names in symbolic order, mainly used for ++ * error reporting. ++ */ ++pANTLR3_UINT8 DAAPParserTokenNames[8+4] ++ = { ++ (pANTLR3_UINT8) "", /* String to print to indicate an invalid token */ ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "NEWLINE", ++ (pANTLR3_UINT8) "OPOR", ++ (pANTLR3_UINT8) "OPAND", ++ (pANTLR3_UINT8) "LPAR", ++ (pANTLR3_UINT8) "RPAR", ++ (pANTLR3_UINT8) "STR", ++ (pANTLR3_UINT8) "QUOTE", ++ (pANTLR3_UINT8) "ESCAPED" ++ }; ++ ++ ++ ++// Forward declare the locally static matching functions we have generated. ++// ++static DAAPParser_query_return query (pDAAPParser ctx); ++static DAAPParser_expr_return expr (pDAAPParser ctx); ++static DAAPParser_aexpr_return aexpr (pDAAPParser ctx); ++static DAAPParser_crit_return crit (pDAAPParser ctx); ++static void DAAPParserFree(pDAAPParser ctx); ++/* For use in tree output where we are accumulating rule labels via label += ruleRef ++ * we need a function that knows how to free a return scope when the list is destroyed. ++ * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro. ++ */ ++static void ANTLR3_CDECL freeScope(void * scope) ++{ ++ ANTLR3_FREE(scope); ++} ++ ++/** \brief Name of the grammar file that generated this code ++ */ ++static const char fileName[] = "DAAP.g"; ++ ++/** \brief Return the name of the grammar file that generated this code. ++ */ ++static const char * getGrammarFileName() ++{ ++ return fileName; ++} ++/** \brief Create a new DAAPParser parser and return a context for it. ++ * ++ * \param[in] instream Pointer to an input stream interface. ++ * ++ * \return Pointer to new parser context upon success. ++ */ ++ANTLR3_API pDAAPParser ++DAAPParserNew (pANTLR3_COMMON_TOKEN_STREAM instream) ++{ ++ // See if we can create a new parser with the standard constructor ++ // ++ return DAAPParserNewSSD(instream, NULL); ++} ++ ++/** \brief Create a new DAAPParser parser and return a context for it. ++ * ++ * \param[in] instream Pointer to an input stream interface. ++ * ++ * \return Pointer to new parser context upon success. ++ */ ++ANTLR3_API pDAAPParser ++DAAPParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state) ++{ ++ pDAAPParser ctx; /* Context structure we will build and return */ ++ ++ ctx = (pDAAPParser) ANTLR3_CALLOC(1, sizeof(DAAPParser)); ++ ++ if (ctx == NULL) ++ { ++ // Failed to allocate memory for parser context ++ // ++ return NULL; ++ } ++ ++ /* ------------------------------------------------------------------- ++ * Memory for basic structure is allocated, now to fill in ++ * the base ANTLR3 structures. We initialize the function pointers ++ * for the standard ANTLR3 parser function set, but upon return ++ * from here, the programmer may set the pointers to provide custom ++ * implementations of each function. ++ * ++ * We don't use the macros defined in DAAPParser.h here, in order that you can get a sense ++ * of what goes where. ++ */ ++ ++ /* Create a base parser/recognizer, using the supplied token stream ++ */ ++ ctx->pParser = antlr3ParserNewStream(ANTLR3_SIZE_HINT, instream->tstream, state); ++ /* Install the implementation of our DAAPParser interface ++ */ ++ ctx->query = query; ++ ctx->expr = expr; ++ ctx->aexpr = aexpr; ++ ctx->crit = crit; ++ ctx->free = DAAPParserFree; ++ ctx->getGrammarFileName = getGrammarFileName; ++ ++ /* Install the scope pushing methods. ++ */ ++ ADAPTOR = ANTLR3_TREE_ADAPTORNew(instream->tstream->tokenSource->strFactory); ++ ctx->vectors = antlr3VectorFactoryNew(0); ++ ++ ++ ++ /* Install the token table ++ */ ++ PSRSTATE->tokenNames = DAAPParserTokenNames; ++ ++ ++ /* Return the newly built parser to the caller ++ */ ++ return ctx; ++} ++ ++/** Free the parser resources ++ */ ++ static void ++ DAAPParserFree(pDAAPParser ctx) ++ { ++ /* Free any scope memory ++ */ ++ ++ ctx->vectors->close(ctx->vectors); ++ /* We created the adaptor so we must free it ++ */ ++ ADAPTOR->free(ADAPTOR); ++ // Free this parser ++ // ++ ctx->pParser->free(ctx->pParser); ++ ANTLR3_FREE(ctx); ++ ++ /* Everything is released, so we can return ++ */ ++ return; ++ } ++ ++/** Return token names used by this parser ++ * ++ * The returned pointer is used as an index into the token names table (using the token ++ * number as the index). ++ * ++ * \return Pointer to first char * in the table. ++ */ ++static pANTLR3_UINT8 *getTokenNames() ++{ ++ return DAAPParserTokenNames; ++} ++ ++ ++/* Declare the bitsets ++ */ ++ ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_query42 */ ++static ANTLR3_BITWORD FOLLOW_expr_in_query42_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) }; ++static ANTLR3_BITSET_LIST FOLLOW_expr_in_query42 = { FOLLOW_expr_in_query42_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_NEWLINE_in_query44 */ ++static ANTLR3_BITWORD FOLLOW_NEWLINE_in_query44_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000000) }; ++static ANTLR3_BITSET_LIST FOLLOW_NEWLINE_in_query44 = { FOLLOW_NEWLINE_in_query44_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_EOF_in_query47 */ ++static ANTLR3_BITWORD FOLLOW_EOF_in_query47_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_EOF_in_query47 = { FOLLOW_EOF_in_query47_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expr62 */ ++static ANTLR3_BITWORD FOLLOW_aexpr_in_expr62_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) }; ++static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expr62 = { FOLLOW_aexpr_in_expr62_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_OPOR_in_expr65 */ ++static ANTLR3_BITWORD FOLLOW_OPOR_in_expr65_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) }; ++static ANTLR3_BITSET_LIST FOLLOW_OPOR_in_expr65 = { FOLLOW_OPOR_in_expr65_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expr68 */ ++static ANTLR3_BITWORD FOLLOW_aexpr_in_expr68_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) }; ++static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expr68 = { FOLLOW_aexpr_in_expr68_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_aexpr80 */ ++static ANTLR3_BITWORD FOLLOW_crit_in_aexpr80_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) }; ++static ANTLR3_BITSET_LIST FOLLOW_crit_in_aexpr80 = { FOLLOW_crit_in_aexpr80_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_OPAND_in_aexpr83 */ ++static ANTLR3_BITWORD FOLLOW_OPAND_in_aexpr83_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) }; ++static ANTLR3_BITSET_LIST FOLLOW_OPAND_in_aexpr83 = { FOLLOW_OPAND_in_aexpr83_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_aexpr86 */ ++static ANTLR3_BITWORD FOLLOW_crit_in_aexpr86_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) }; ++static ANTLR3_BITSET_LIST FOLLOW_crit_in_aexpr86 = { FOLLOW_crit_in_aexpr86_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_LPAR_in_crit98 */ ++static ANTLR3_BITWORD FOLLOW_LPAR_in_crit98_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) }; ++static ANTLR3_BITSET_LIST FOLLOW_LPAR_in_crit98 = { FOLLOW_LPAR_in_crit98_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_crit100 */ ++static ANTLR3_BITWORD FOLLOW_expr_in_crit100_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000100) }; ++static ANTLR3_BITSET_LIST FOLLOW_expr_in_crit100 = { FOLLOW_expr_in_crit100_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_RPAR_in_crit102 */ ++static ANTLR3_BITWORD FOLLOW_RPAR_in_crit102_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_RPAR_in_crit102 = { FOLLOW_RPAR_in_crit102_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_crit112 */ ++static ANTLR3_BITWORD FOLLOW_STR_in_crit112_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_STR_in_crit112 = { FOLLOW_STR_in_crit112_bits, 1 }; ++ ++ ++ ++ ++/* ============================================== ++ * Parsing rules ++ */ ++/** ++ * $ANTLR start query ++ * DAAP.g:27:1: query : expr ( NEWLINE )? EOF -> expr ; ++ */ ++static DAAPParser_query_return ++query(pDAAPParser ctx) ++{ ++ DAAPParser_query_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN NEWLINE2; ++ pANTLR3_COMMON_TOKEN EOF3; ++ DAAPParser_expr_return expr1; ++ #undef RETURN_TYPE_expr1 ++ #define RETURN_TYPE_expr1 DAAPParser_expr_return ++ ++ pANTLR3_BASE_TREE NEWLINE2_tree; ++ pANTLR3_BASE_TREE EOF3_tree; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NEWLINE; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_EOF; ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expr; ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ NEWLINE2 = NULL; ++ EOF3 = NULL; ++ expr1.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ NEWLINE2_tree = NULL; ++ EOF3_tree = NULL; ++ ++ stream_NEWLINE = NULL; ++ #define CREATE_stream_NEWLINE if (stream_NEWLINE == NULL) {stream_NEWLINE = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NEWLINE"); } ++ stream_EOF = NULL; ++ #define CREATE_stream_EOF if (stream_EOF == NULL) {stream_EOF = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token EOF"); } ++ stream_expr = NULL; ++ #define CREATE_stream_expr if (stream_expr == NULL) {stream_expr = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expr"); } ++ ++ retval.tree = NULL; ++ { ++ // DAAP.g:27:7: ( expr ( NEWLINE )? EOF -> expr ) ++ // DAAP.g:27:9: expr ( NEWLINE )? EOF ++ { ++ FOLLOWPUSH(FOLLOW_expr_in_query42); ++ expr1=expr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto rulequeryEx; ++ } ++ ++ CREATE_stream_expr; stream_expr->add(stream_expr, expr1.tree, NULL); ++ ++ // DAAP.g:27:14: ( NEWLINE )? ++ { ++ int alt1=2; ++ switch ( LA(1) ) ++ { ++ case NEWLINE: ++ { ++ alt1=1; ++ } ++ break; ++ } ++ ++ switch (alt1) ++ { ++ case 1: ++ // DAAP.g:27:14: NEWLINE ++ { ++ NEWLINE2 = (pANTLR3_COMMON_TOKEN) MATCHT(NEWLINE, &FOLLOW_NEWLINE_in_query44); ++ if (HASEXCEPTION()) ++ { ++ goto rulequeryEx; ++ } ++ ++ CREATE_stream_NEWLINE; stream_NEWLINE->add(stream_NEWLINE, NEWLINE2, NULL); ++ ++ ++ } ++ break; ++ ++ } ++ } ++ EOF3 = (pANTLR3_COMMON_TOKEN) MATCHT(EOF, &FOLLOW_EOF_in_query47); ++ if (HASEXCEPTION()) ++ { ++ goto rulequeryEx; ++ } ++ ++ CREATE_stream_EOF; stream_EOF->add(stream_EOF, EOF3, NULL); ++ ++ ++ ++ /* AST REWRITE ++ * elements : expr ++ * token labels : ++ * rule labels : retval ++ * token list labels : ++ * rule list labels : ++ */ ++ { ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval; ++ ++ stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL); ++ ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ retval.tree = root_0; ++ // 27:27: -> expr ++ { ++ ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr)); ++ ++ } ++ ++ retval.tree = root_0; // set result root ++ if (stream_retval != NULL) stream_retval->free(stream_retval); ++ ++ ++ } ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto rulequeryEx; /* Prevent compiler warnings */ ++ rulequeryEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ if (stream_NEWLINE != NULL) stream_NEWLINE->free(stream_NEWLINE); ++ if (stream_EOF != NULL) stream_EOF->free(stream_EOF); ++ if (stream_expr != NULL) stream_expr->free(stream_expr); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end query */ ++ ++/** ++ * $ANTLR start expr ++ * DAAP.g:30:1: expr : aexpr ( OPOR aexpr )* ; ++ */ ++static DAAPParser_expr_return ++expr(pDAAPParser ctx) ++{ ++ DAAPParser_expr_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN OPOR5; ++ DAAPParser_aexpr_return aexpr4; ++ #undef RETURN_TYPE_aexpr4 ++ #define RETURN_TYPE_aexpr4 DAAPParser_aexpr_return ++ ++ DAAPParser_aexpr_return aexpr6; ++ #undef RETURN_TYPE_aexpr6 ++ #define RETURN_TYPE_aexpr6 DAAPParser_aexpr_return ++ ++ pANTLR3_BASE_TREE OPOR5_tree; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ OPOR5 = NULL; ++ aexpr4.tree = NULL; ++ ++ aexpr6.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ OPOR5_tree = NULL; ++ ++ ++ retval.tree = NULL; ++ { ++ // DAAP.g:30:6: ( aexpr ( OPOR aexpr )* ) ++ // DAAP.g:30:8: aexpr ( OPOR aexpr )* ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ FOLLOWPUSH(FOLLOW_aexpr_in_expr62); ++ aexpr4=aexpr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, aexpr4.tree); ++ ++ // DAAP.g:30:14: ( OPOR aexpr )* ++ ++ for (;;) ++ { ++ int alt2=2; ++ switch ( LA(1) ) ++ { ++ case OPOR: ++ { ++ alt2=1; ++ } ++ break; ++ ++ } ++ ++ switch (alt2) ++ { ++ case 1: ++ // DAAP.g:30:15: OPOR aexpr ++ { ++ OPOR5 = (pANTLR3_COMMON_TOKEN) MATCHT(OPOR, &FOLLOW_OPOR_in_expr65); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ OPOR5_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OPOR5)); ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OPOR5_tree, root_0)); ++ ++ FOLLOWPUSH(FOLLOW_aexpr_in_expr68); ++ aexpr6=aexpr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, aexpr6.tree); ++ ++ } ++ break; ++ ++ default: ++ goto loop2; /* break out of the loop */ ++ break; ++ } ++ } ++ loop2: ; /* Jump out to here if this rule does not match */ ++ ++ ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleexprEx; /* Prevent compiler warnings */ ++ ruleexprEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end expr */ ++ ++/** ++ * $ANTLR start aexpr ++ * DAAP.g:33:1: aexpr : crit ( OPAND crit )* ; ++ */ ++static DAAPParser_aexpr_return ++aexpr(pDAAPParser ctx) ++{ ++ DAAPParser_aexpr_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN OPAND8; ++ DAAPParser_crit_return crit7; ++ #undef RETURN_TYPE_crit7 ++ #define RETURN_TYPE_crit7 DAAPParser_crit_return ++ ++ DAAPParser_crit_return crit9; ++ #undef RETURN_TYPE_crit9 ++ #define RETURN_TYPE_crit9 DAAPParser_crit_return ++ ++ pANTLR3_BASE_TREE OPAND8_tree; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ OPAND8 = NULL; ++ crit7.tree = NULL; ++ ++ crit9.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ OPAND8_tree = NULL; ++ ++ ++ retval.tree = NULL; ++ { ++ // DAAP.g:33:7: ( crit ( OPAND crit )* ) ++ // DAAP.g:33:9: crit ( OPAND crit )* ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ FOLLOWPUSH(FOLLOW_crit_in_aexpr80); ++ crit7=crit(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleaexprEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, crit7.tree); ++ ++ // DAAP.g:33:14: ( OPAND crit )* ++ ++ for (;;) ++ { ++ int alt3=2; ++ switch ( LA(1) ) ++ { ++ case OPAND: ++ { ++ alt3=1; ++ } ++ break; ++ ++ } ++ ++ switch (alt3) ++ { ++ case 1: ++ // DAAP.g:33:15: OPAND crit ++ { ++ OPAND8 = (pANTLR3_COMMON_TOKEN) MATCHT(OPAND, &FOLLOW_OPAND_in_aexpr83); ++ if (HASEXCEPTION()) ++ { ++ goto ruleaexprEx; ++ } ++ ++ OPAND8_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OPAND8)); ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OPAND8_tree, root_0)); ++ ++ FOLLOWPUSH(FOLLOW_crit_in_aexpr86); ++ crit9=crit(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleaexprEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, crit9.tree); ++ ++ } ++ break; ++ ++ default: ++ goto loop3; /* break out of the loop */ ++ break; ++ } ++ } ++ loop3: ; /* Jump out to here if this rule does not match */ ++ ++ ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleaexprEx; /* Prevent compiler warnings */ ++ ruleaexprEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end aexpr */ ++ ++/** ++ * $ANTLR start crit ++ * DAAP.g:36:1: crit : ( LPAR expr RPAR -> expr | STR ); ++ */ ++static DAAPParser_crit_return ++crit(pDAAPParser ctx) ++{ ++ DAAPParser_crit_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN LPAR10; ++ pANTLR3_COMMON_TOKEN RPAR12; ++ pANTLR3_COMMON_TOKEN STR13; ++ DAAPParser_expr_return expr11; ++ #undef RETURN_TYPE_expr11 ++ #define RETURN_TYPE_expr11 DAAPParser_expr_return ++ ++ pANTLR3_BASE_TREE LPAR10_tree; ++ pANTLR3_BASE_TREE RPAR12_tree; ++ pANTLR3_BASE_TREE STR13_tree; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_RPAR; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_LPAR; ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expr; ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ LPAR10 = NULL; ++ RPAR12 = NULL; ++ STR13 = NULL; ++ expr11.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ LPAR10_tree = NULL; ++ RPAR12_tree = NULL; ++ STR13_tree = NULL; ++ ++ stream_RPAR = NULL; ++ #define CREATE_stream_RPAR if (stream_RPAR == NULL) {stream_RPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token RPAR"); } ++ stream_LPAR = NULL; ++ #define CREATE_stream_LPAR if (stream_LPAR == NULL) {stream_LPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token LPAR"); } ++ stream_expr = NULL; ++ #define CREATE_stream_expr if (stream_expr == NULL) {stream_expr = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expr"); } ++ ++ retval.tree = NULL; ++ { ++ { ++ // DAAP.g:36:6: ( LPAR expr RPAR -> expr | STR ) ++ ++ ANTLR3_UINT32 alt4; ++ ++ alt4=2; ++ ++ switch ( LA(1) ) ++ { ++ case LPAR: ++ { ++ alt4=1; ++ } ++ break; ++ case STR: ++ { ++ alt4=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 4; ++ EXCEPTION->state = 0; ++ ++ ++ goto rulecritEx; ++ } ++ ++ switch (alt4) ++ { ++ case 1: ++ // DAAP.g:36:8: LPAR expr RPAR ++ { ++ LPAR10 = (pANTLR3_COMMON_TOKEN) MATCHT(LPAR, &FOLLOW_LPAR_in_crit98); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ CREATE_stream_LPAR; stream_LPAR->add(stream_LPAR, LPAR10, NULL); ++ ++ FOLLOWPUSH(FOLLOW_expr_in_crit100); ++ expr11=expr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ CREATE_stream_expr; stream_expr->add(stream_expr, expr11.tree, NULL); ++ RPAR12 = (pANTLR3_COMMON_TOKEN) MATCHT(RPAR, &FOLLOW_RPAR_in_crit102); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ CREATE_stream_RPAR; stream_RPAR->add(stream_RPAR, RPAR12, NULL); ++ ++ ++ ++ /* AST REWRITE ++ * elements : expr ++ * token labels : ++ * rule labels : retval ++ * token list labels : ++ * rule list labels : ++ */ ++ { ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval; ++ ++ stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL); ++ ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ retval.tree = root_0; ++ // 36:24: -> expr ++ { ++ ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr)); ++ ++ } ++ ++ retval.tree = root_0; // set result root ++ if (stream_retval != NULL) stream_retval->free(stream_retval); ++ ++ ++ } ++ } ++ break; ++ case 2: ++ // DAAP.g:37:4: STR ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ STR13 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_crit112); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ STR13_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STR13)); ++ ADAPTOR->addChild(ADAPTOR, root_0, STR13_tree); ++ ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto rulecritEx; /* Prevent compiler warnings */ ++ rulecritEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ if (stream_RPAR != NULL) stream_RPAR->free(stream_RPAR); ++ if (stream_LPAR != NULL) stream_LPAR->free(stream_LPAR); ++ if (stream_expr != NULL) stream_expr->free(stream_expr); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end crit */ ++/* End of parsing rules ++ * ============================================== ++ */ ++ ++/* ============================================== ++ * Syntactic predicates ++ */ ++/* End of syntactic predicates ++ * ============================================== ++ */ ++ ++ ++ ++ ++ ++ ++/* End of code ++ * ============================================================================= ++ */ +diff --git a/src/pregen/DAAPParser.h b/src/pregen/DAAPParser.h +new file mode 100644 +index 0000000..e206694 +--- /dev/null ++++ b/src/pregen/DAAPParser.h +@@ -0,0 +1,226 @@ ++/** \file ++ * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : DAAP.g ++ * - On : 2016-01-01 12:23:41 ++ * - for the parser : DAAPParserParser * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++ * The parser DAAPParser has the callable functions (rules) shown below, ++ * which will invoke the code for the associated rule in the source grammar ++ * assuming that the input stream is pointing to a token/text stream that could begin ++ * this rule. ++ * ++ * For instance if you call the first (topmost) rule in a parser grammar, you will ++ * get the results of a full parse, but calling a rule half way through the grammar will ++ * allow you to pass part of a full token stream to the parser, such as for syntax checking ++ * in editors and so on. ++ * ++ * The parser entry points are called indirectly (by function pointer to function) via ++ * a parser context typedef pDAAPParser, which is returned from a call to DAAPParserNew(). ++ * ++ * The methods in pDAAPParser are as follows: ++ * ++ * - DAAPParser_query_return pDAAPParser->query(pDAAPParser) ++ * - DAAPParser_expr_return pDAAPParser->expr(pDAAPParser) ++ * - DAAPParser_aexpr_return pDAAPParser->aexpr(pDAAPParser) ++ * - DAAPParser_crit_return pDAAPParser->crit(pDAAPParser) ++ * ++ * The return type for any particular rule is of course determined by the source ++ * grammar file. ++ */ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++#ifndef _DAAPParser_H ++#define _DAAPParser_H ++/* ============================================================================= ++ * Standard antlr3 C runtime definitions ++ */ ++#include ++ ++/* End of standard antlr 3 runtime definitions ++ * ============================================================================= ++ */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++// Forward declare the context typedef so that we can use it before it is ++// properly defined. Delegators and delegates (from import statements) are ++// interdependent and their context structures contain pointers to each other ++// C only allows such things to be declared if you pre-declare the typedef. ++// ++typedef struct DAAPParser_Ctx_struct DAAPParser, * pDAAPParser; ++ ++ ++ ++#ifdef ANTLR3_WINDOWS ++// Disable: Unreferenced parameter, - Rules with parameters that are not used ++// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually) ++// initialized but unused variable - tree rewrite variables declared but not needed ++// Unreferenced local variable - lexer rule declares but does not always use _type ++// potentially unitialized variable used - retval always returned from a rule ++// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns ++// ++// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at ++// and the codegen must generate some of these warnings by necessity, apart from 4100, which is ++// usually generated when a parser rule is given a parameter that it does not use. Mostly though ++// this is a matter of orthogonality hence I disable that one. ++// ++#pragma warning( disable : 4100 ) ++#pragma warning( disable : 4101 ) ++#pragma warning( disable : 4127 ) ++#pragma warning( disable : 4189 ) ++#pragma warning( disable : 4505 ) ++#pragma warning( disable : 4701 ) ++#endif ++typedef struct DAAPParser_query_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ DAAPParser_query_return; ++ ++typedef struct DAAPParser_expr_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ DAAPParser_expr_return; ++ ++typedef struct DAAPParser_aexpr_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ DAAPParser_aexpr_return; ++ ++typedef struct DAAPParser_crit_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ DAAPParser_crit_return; ++ ++ ++ ++/** Context tracking structure for DAAPParser ++ */ ++struct DAAPParser_Ctx_struct ++{ ++ /** Built in ANTLR3 context tracker contains all the generic elements ++ * required for context tracking. ++ */ ++ pANTLR3_PARSER pParser; ++ ++ ++ DAAPParser_query_return (*query) (struct DAAPParser_Ctx_struct * ctx); ++ DAAPParser_expr_return (*expr) (struct DAAPParser_Ctx_struct * ctx); ++ DAAPParser_aexpr_return (*aexpr) (struct DAAPParser_Ctx_struct * ctx); ++ DAAPParser_crit_return (*crit) (struct DAAPParser_Ctx_struct * ctx); ++ // Delegated rules ++ const char * (*getGrammarFileName)(); ++ void (*free) (struct DAAPParser_Ctx_struct * ctx); ++ /* @headerFile.members() */ ++ pANTLR3_BASE_TREE_ADAPTOR adaptor; ++ pANTLR3_VECTOR_FACTORY vectors; ++ /* End @headerFile.members() */ ++}; ++ ++// Function protoypes for the constructor functions that external translation units ++// such as delegators and delegates may wish to call. ++// ++ANTLR3_API pDAAPParser DAAPParserNew (pANTLR3_COMMON_TOKEN_STREAM instream); ++ANTLR3_API pDAAPParser DAAPParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state); ++ ++/** Symbolic definitions of all the tokens that the parser will work with. ++ * \{ ++ * ++ * Antlr will define EOF, but we can't use that as it it is too common in ++ * in C header files and that would be confusing. There is no way to filter this out at the moment ++ * so we just undef it here for now. That isn't the value we get back from C recognizers ++ * anyway. We are looking for ANTLR3_TOKEN_EOF. ++ */ ++#ifdef EOF ++#undef EOF ++#endif ++#ifdef Tokens ++#undef Tokens ++#endif ++#define STR 9 ++#define QUOTE 10 ++#define LPAR 7 ++#define NEWLINE 4 ++#define OPOR 5 ++#define RPAR 8 ++#define ESCAPED 11 ++#define OPAND 6 ++#define EOF -1 ++#ifdef EOF ++#undef EOF ++#define EOF ANTLR3_TOKEN_EOF ++#endif ++ ++#ifndef TOKENSOURCE ++#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource ++#endif ++ ++/* End of token definitions for DAAPParser ++ * ============================================================================= ++ */ ++/** \} */ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif ++ ++/* END - Note:Keep extra line feed to satisfy UNIX systems */ +diff --git a/src/pregen/RSP.u b/src/pregen/RSP.u +new file mode 100644 +index 0000000..89256ff +--- /dev/null ++++ b/src/pregen/RSP.u +@@ -0,0 +1,6 @@ ++RSPParser.c : RSP.g ++./RSP.tokens : RSP.g ++RSPParser.h : RSP.g ++RSPLexer.c : RSP.g ++RSPLexer.h : RSP.g ++ANTLR_PRODUCTS += RSPParser.c ./RSP.tokens RSPParser.h RSPLexer.c RSPLexer.h +\ No newline at end of file +diff --git a/src/pregen/RSP2SQL.c b/src/pregen/RSP2SQL.c +new file mode 100644 +index 0000000..40958f9 +--- /dev/null ++++ b/src/pregen/RSP2SQL.c +@@ -0,0 +1,2546 @@ ++/** \file ++ * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : RSP2SQL.g ++ * - On : 2016-01-01 12:23:43 ++ * - for the tree parser : RSP2SQLTreeParser * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++*/ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++ ++/* ============================================================================= ++ * This is what the grammar programmer asked us to put at the top of every file. ++ */ ++ ++ /* Needs #define _GNU_SOURCE for strptime() */ ++ ++ #include ++ #include ++ #include ++ #include ++ ++ #include "logger.h" ++ #include "db.h" ++ #include "misc.h" ++ #include "rsp_query.h" ++ ++/* End of Header action. ++ * ============================================================================= ++ */ ++/* ----------------------------------------- ++ * Include the ANTLR3 generated header file. ++ */ ++#include "RSP2SQL.h" ++/* ----------------------------------------- */ ++ ++ ++ ++ ++ ++/* MACROS that hide the C interface implementations from the ++ * generated code, which makes it a little more understandable to the human eye. ++ * I am very much against using C pre-processor macros for function calls and bits ++ * of code as you cannot see what is happening when single stepping in debuggers ++ * and so on. The exception (in my book at least) is for generated code, where you are ++ * not maintaining it, but may wish to read and understand it. If you single step it, you know that input() ++ * hides some indirect calls, but is always referring to the input stream. This is ++ * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig ++ * the runtime interfaces without changing the generated code too often, without ++ * confusing the reader of the generated output, who may not wish to know the gory ++ * details of the interface inheritance. ++ */ ++ ++#define CTX ctx ++ ++/* Aids in accessing scopes for grammar programmers ++ */ ++#undef SCOPE_TYPE ++#undef SCOPE_STACK ++#undef SCOPE_TOP ++#define SCOPE_TYPE(scope) pRSP2SQL_##scope##_SCOPE ++#define SCOPE_STACK(scope) pRSP2SQL_##scope##Stack ++#define SCOPE_TOP(scope) ctx->pRSP2SQL_##scope##Top ++#define SCOPE_SIZE(scope) ctx->pRSP2SQL_##scope##Stack_limit ++#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i)) ++ ++/* Macros for accessing things in the parser ++ */ ++ ++#undef PARSER ++#undef RECOGNIZER ++#undef HAVEPARSEDRULE ++#undef INPUT ++#undef STRSTREAM ++#undef HASEXCEPTION ++#undef EXCEPTION ++#undef MATCHT ++#undef MATCHANYT ++#undef FOLLOWSTACK ++#undef FOLLOWPUSH ++#undef FOLLOWPOP ++#undef PRECOVER ++#undef PREPORTERROR ++#undef LA ++#undef LT ++#undef CONSTRUCTEX ++#undef CONSUME ++#undef MARK ++#undef REWIND ++#undef REWINDLAST ++#undef PERRORRECOVERY ++#undef HASFAILED ++#undef FAILEDFLAG ++#undef RECOVERFROMMISMATCHEDSET ++#undef RECOVERFROMMISMATCHEDELEMENT ++#undef BACKTRACKING ++#undef ADAPTOR ++#undef RULEMEMO ++#undef SEEK ++#undef INDEX ++#undef DBG ++ ++#define PARSER ctx->pTreeParser ++#define RECOGNIZER PARSER->rec ++#define PSRSTATE RECOGNIZER->state ++#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r) ++#define INPUT PARSER->ctnstream ++#define ISTREAM INPUT->tnstream->istream ++#define STRSTREAM INPUT->tnstream ++#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE) ++#define EXCEPTION PSRSTATE->exception ++#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs) ++#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER) ++#define FOLLOWSTACK PSRSTATE->following ++#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL) ++#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK) ++#define PRECOVER() RECOGNIZER->recover(RECOGNIZER) ++#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER) ++#define LA(n) ISTREAM->_LA(ISTREAM, n) ++#define LT(n) INPUT->tnstream->_LT(INPUT->tnstream, n) ++#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER) ++#define CONSUME() ISTREAM->consume(ISTREAM) ++#define MARK() ISTREAM->mark(ISTREAM) ++#define REWIND(m) ISTREAM->rewind(ISTREAM, m) ++#define REWINDLAST() ISTREAM->rewindLast(ISTREAM) ++#define PERRORRECOVERY PSRSTATE->errorRecovery ++#define FAILEDFLAG PSRSTATE->failed ++#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE) ++#define BACKTRACKING PSRSTATE->backtracking ++#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s) ++#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s) ++#define ADAPTOR INPUT->adaptor ++#define RULEMEMO PSRSTATE->ruleMemo ++#define SEEK(n) ISTREAM->seek(ISTREAM, n) ++#define INDEX() ISTREAM->index(ISTREAM) ++#define DBG RECOGNIZER->debugger ++ ++ ++#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt ++ ++/* The 4 tokens defined below may well clash with your own #defines or token types. If so ++ * then for the present you must use different names for your defines as these are hard coded ++ * in the code generator. It would be better not to use such names internally, and maybe ++ * we can change this in a forthcoming release. I deliberately do not #undef these ++ * here as this will at least give you a redefined error somewhere if they clash. ++ */ ++#define UP ANTLR3_TOKEN_UP ++#define DOWN ANTLR3_TOKEN_DOWN ++#define EOR ANTLR3_TOKEN_EOR ++#define INVALID ANTLR3_TOKEN_INVALID ++ ++ ++/* ============================================================================= ++ * Functions to create and destroy scopes. First come the rule scopes, followed ++ * by the global declared scopes. ++ */ ++ ++ ++ ++/* ============================================================================= */ ++ ++/* ============================================================================= ++ * Start of recognizer ++ */ ++ ++ ++ ++/** \brief Table of all token names in symbolic order, mainly used for ++ * error reporting. ++ */ ++pANTLR3_UINT8 RSP2SQLTokenNames[30+4] ++ = { ++ (pANTLR3_UINT8) "", /* String to print to indicate an invalid token */ ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "NEWLINE", ++ (pANTLR3_UINT8) "OR", ++ (pANTLR3_UINT8) "AND", ++ (pANTLR3_UINT8) "LPAR", ++ (pANTLR3_UINT8) "RPAR", ++ (pANTLR3_UINT8) "FIELD", ++ (pANTLR3_UINT8) "STR", ++ (pANTLR3_UINT8) "NOT", ++ (pANTLR3_UINT8) "EQUAL", ++ (pANTLR3_UINT8) "INCLUDES", ++ (pANTLR3_UINT8) "STARTSW", ++ (pANTLR3_UINT8) "ENDSW", ++ (pANTLR3_UINT8) "INT", ++ (pANTLR3_UINT8) "LESS", ++ (pANTLR3_UINT8) "GREATER", ++ (pANTLR3_UINT8) "LTE", ++ (pANTLR3_UINT8) "GTE", ++ (pANTLR3_UINT8) "BEFORE", ++ (pANTLR3_UINT8) "AFTER", ++ (pANTLR3_UINT8) "DATE", ++ (pANTLR3_UINT8) "TODAY", ++ (pANTLR3_UINT8) "DAY", ++ (pANTLR3_UINT8) "WEEK", ++ (pANTLR3_UINT8) "MONTH", ++ (pANTLR3_UINT8) "YEAR", ++ (pANTLR3_UINT8) "QUOTE", ++ (pANTLR3_UINT8) "WS", ++ (pANTLR3_UINT8) "DIGIT19", ++ (pANTLR3_UINT8) "DIGIT09", ++ (pANTLR3_UINT8) "ESCAPED" ++ }; ++ ++ ++ ++// Forward declare the locally static matching functions we have generated. ++// ++static pANTLR3_STRING query (pRSP2SQL ctx); ++static RSP2SQL_expr_return expr (pRSP2SQL ctx); ++static RSP2SQL_strcrit_return strcrit (pRSP2SQL ctx); ++static pANTLR3_COMMON_TOKEN strop (pRSP2SQL ctx); ++static RSP2SQL_intcrit_return intcrit (pRSP2SQL ctx); ++static pANTLR3_COMMON_TOKEN intop (pRSP2SQL ctx); ++static RSP2SQL_datecrit_return datecrit (pRSP2SQL ctx); ++static pANTLR3_COMMON_TOKEN dateop (pRSP2SQL ctx); ++static RSP2SQL_datespec_return datespec (pRSP2SQL ctx); ++static RSP2SQL_dateref_return dateref (pRSP2SQL ctx); ++static RSP2SQL_dateintval_return dateintval (pRSP2SQL ctx); ++static void RSP2SQLFree(pRSP2SQL ctx); ++/* For use in tree output where we are accumulating rule labels via label += ruleRef ++ * we need a function that knows how to free a return scope when the list is destroyed. ++ * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro. ++ */ ++static void ANTLR3_CDECL freeScope(void * scope) ++{ ++ ANTLR3_FREE(scope); ++} ++ ++/** \brief Name of the grammar file that generated this code ++ */ ++static const char fileName[] = "RSP2SQL.g"; ++ ++/** \brief Return the name of the grammar file that generated this code. ++ */ ++static const char * getGrammarFileName() ++{ ++ return fileName; ++} ++/** \brief Create a new RSP2SQL parser and return a context for it. ++ * ++ * \param[in] instream Pointer to an input stream interface. ++ * ++ * \return Pointer to new parser context upon success. ++ */ ++ANTLR3_API pRSP2SQL ++RSP2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream) ++{ ++ // See if we can create a new parser with the standard constructor ++ // ++ return RSP2SQLNewSSD(instream, NULL); ++} ++ ++/** \brief Create a new RSP2SQL parser and return a context for it. ++ * ++ * \param[in] instream Pointer to an input stream interface. ++ * ++ * \return Pointer to new parser context upon success. ++ */ ++ANTLR3_API pRSP2SQL ++RSP2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state) ++{ ++ pRSP2SQL ctx; /* Context structure we will build and return */ ++ ++ ctx = (pRSP2SQL) ANTLR3_CALLOC(1, sizeof(RSP2SQL)); ++ ++ if (ctx == NULL) ++ { ++ // Failed to allocate memory for parser context ++ // ++ return NULL; ++ } ++ ++ /* ------------------------------------------------------------------- ++ * Memory for basic structure is allocated, now to fill in ++ * the base ANTLR3 structures. We initialize the function pointers ++ * for the standard ANTLR3 parser function set, but upon return ++ * from here, the programmer may set the pointers to provide custom ++ * implementations of each function. ++ * ++ * We don't use the macros defined in RSP2SQL.h here, in order that you can get a sense ++ * of what goes where. ++ */ ++ ++ /* Create a base Tree parser/recognizer, using the supplied tree node stream ++ */ ++ ctx->pTreeParser = antlr3TreeParserNewStream(ANTLR3_SIZE_HINT, instream, state); ++ /* Install the implementation of our RSP2SQL interface ++ */ ++ ctx->query = query; ++ ctx->expr = expr; ++ ctx->strcrit = strcrit; ++ ctx->strop = strop; ++ ctx->intcrit = intcrit; ++ ctx->intop = intop; ++ ctx->datecrit = datecrit; ++ ctx->dateop = dateop; ++ ctx->datespec = datespec; ++ ctx->dateref = dateref; ++ ctx->dateintval = dateintval; ++ ctx->free = RSP2SQLFree; ++ ctx->getGrammarFileName = getGrammarFileName; ++ ++ /* Install the scope pushing methods. ++ */ ++ ++ ++ ++ ++ ++ /* Install the token table ++ */ ++ PSRSTATE->tokenNames = RSP2SQLTokenNames; ++ ++ ++ /* Return the newly built parser to the caller ++ */ ++ return ctx; ++} ++ ++/** Free the parser resources ++ */ ++ static void ++ RSP2SQLFree(pRSP2SQL ctx) ++ { ++ /* Free any scope memory ++ */ ++ ++ ++ // Free this parser ++ // ++ ctx->pTreeParser->free(ctx->pTreeParser); ++ ANTLR3_FREE(ctx); ++ ++ /* Everything is released, so we can return ++ */ ++ return; ++ } ++ ++/** Return token names used by this tree parser ++ * ++ * The returned pointer is used as an index into the token names table (using the token ++ * number as the index). ++ * ++ * \return Pointer to first char * in the table. ++ */ ++static pANTLR3_UINT8 *getTokenNames() ++{ ++ return RSP2SQLTokenNames; ++} ++ ++ ++ #define RSP_TYPE_STRING 0 ++ #define RSP_TYPE_INT 1 ++ #define RSP_TYPE_DATE 2 ++ ++ struct rsp_query_field_map { ++ char *rsp_field; ++ int field_type; ++ /* RSP fields are named after the DB columns - or vice versa */ ++ }; ++ ++ /* gperf static hash, rsp_query.gperf */ ++ #include "rsp_query_hash.c" ++ ++ ++/* Declare the bitsets ++ */ ++ ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_query70 */ ++static ANTLR3_BITWORD FOLLOW_expr_in_query70_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_expr_in_query70 = { FOLLOW_expr_in_query70_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AND_in_expr95 */ ++static ANTLR3_BITWORD FOLLOW_AND_in_expr95_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) }; ++static ANTLR3_BITSET_LIST FOLLOW_AND_in_expr95 = { FOLLOW_AND_in_expr95_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr101 */ ++static ANTLR3_BITWORD FOLLOW_expr_in_expr101_bits[] = { ANTLR3_UINT64_LIT(0x00000000007EF860) }; ++static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr101 = { FOLLOW_expr_in_expr101_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr107 */ ++static ANTLR3_BITWORD FOLLOW_expr_in_expr107_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) }; ++static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr107 = { FOLLOW_expr_in_expr107_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_OR_in_expr118 */ ++static ANTLR3_BITWORD FOLLOW_OR_in_expr118_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) }; ++static ANTLR3_BITSET_LIST FOLLOW_OR_in_expr118 = { FOLLOW_OR_in_expr118_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr124 */ ++static ANTLR3_BITWORD FOLLOW_expr_in_expr124_bits[] = { ANTLR3_UINT64_LIT(0x00000000007EF860) }; ++static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr124 = { FOLLOW_expr_in_expr124_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_expr130 */ ++static ANTLR3_BITWORD FOLLOW_expr_in_expr130_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) }; ++static ANTLR3_BITSET_LIST FOLLOW_expr_in_expr130 = { FOLLOW_expr_in_expr130_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_strcrit_in_expr144 */ ++static ANTLR3_BITWORD FOLLOW_strcrit_in_expr144_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_strcrit_in_expr144 = { FOLLOW_strcrit_in_expr144_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_expr154 */ ++static ANTLR3_BITWORD FOLLOW_NOT_in_expr154_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) }; ++static ANTLR3_BITSET_LIST FOLLOW_NOT_in_expr154 = { FOLLOW_NOT_in_expr154_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_strcrit_in_expr160 */ ++static ANTLR3_BITWORD FOLLOW_strcrit_in_expr160_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) }; ++static ANTLR3_BITSET_LIST FOLLOW_strcrit_in_expr160 = { FOLLOW_strcrit_in_expr160_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_intcrit_in_expr174 */ ++static ANTLR3_BITWORD FOLLOW_intcrit_in_expr174_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_intcrit_in_expr174 = { FOLLOW_intcrit_in_expr174_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_expr184 */ ++static ANTLR3_BITWORD FOLLOW_NOT_in_expr184_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) }; ++static ANTLR3_BITSET_LIST FOLLOW_NOT_in_expr184 = { FOLLOW_NOT_in_expr184_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_intcrit_in_expr190 */ ++static ANTLR3_BITWORD FOLLOW_intcrit_in_expr190_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) }; ++static ANTLR3_BITSET_LIST FOLLOW_intcrit_in_expr190 = { FOLLOW_intcrit_in_expr190_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_datecrit_in_expr204 */ ++static ANTLR3_BITWORD FOLLOW_datecrit_in_expr204_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_datecrit_in_expr204 = { FOLLOW_datecrit_in_expr204_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_strop_in_strcrit233 */ ++static ANTLR3_BITWORD FOLLOW_strop_in_strcrit233_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) }; ++static ANTLR3_BITSET_LIST FOLLOW_strop_in_strcrit233 = { FOLLOW_strop_in_strcrit233_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_strcrit239 */ ++static ANTLR3_BITWORD FOLLOW_FIELD_in_strcrit239_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000400) }; ++static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_strcrit239 = { FOLLOW_FIELD_in_strcrit239_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_strcrit245 */ ++static ANTLR3_BITWORD FOLLOW_STR_in_strcrit245_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) }; ++static ANTLR3_BITSET_LIST FOLLOW_STR_in_strcrit245 = { FOLLOW_STR_in_strcrit245_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_EQUAL_in_strop274 */ ++static ANTLR3_BITWORD FOLLOW_EQUAL_in_strop274_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_EQUAL_in_strop274 = { FOLLOW_EQUAL_in_strop274_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INCLUDES_in_strop287 */ ++static ANTLR3_BITWORD FOLLOW_INCLUDES_in_strop287_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_INCLUDES_in_strop287 = { FOLLOW_INCLUDES_in_strop287_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STARTSW_in_strop300 */ ++static ANTLR3_BITWORD FOLLOW_STARTSW_in_strop300_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_STARTSW_in_strop300 = { FOLLOW_STARTSW_in_strop300_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENDSW_in_strop313 */ ++static ANTLR3_BITWORD FOLLOW_ENDSW_in_strop313_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_ENDSW_in_strop313 = { FOLLOW_ENDSW_in_strop313_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_intop_in_intcrit342 */ ++static ANTLR3_BITWORD FOLLOW_intop_in_intcrit342_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) }; ++static ANTLR3_BITSET_LIST FOLLOW_intop_in_intcrit342 = { FOLLOW_intop_in_intcrit342_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_intcrit348 */ ++static ANTLR3_BITWORD FOLLOW_FIELD_in_intcrit348_bits[] = { ANTLR3_UINT64_LIT(0x0000000000010000) }; ++static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_intcrit348 = { FOLLOW_FIELD_in_intcrit348_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_intcrit354 */ ++static ANTLR3_BITWORD FOLLOW_INT_in_intcrit354_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) }; ++static ANTLR3_BITSET_LIST FOLLOW_INT_in_intcrit354 = { FOLLOW_INT_in_intcrit354_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_EQUAL_in_intop383 */ ++static ANTLR3_BITWORD FOLLOW_EQUAL_in_intop383_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_EQUAL_in_intop383 = { FOLLOW_EQUAL_in_intop383_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_LESS_in_intop396 */ ++static ANTLR3_BITWORD FOLLOW_LESS_in_intop396_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_LESS_in_intop396 = { FOLLOW_LESS_in_intop396_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_GREATER_in_intop409 */ ++static ANTLR3_BITWORD FOLLOW_GREATER_in_intop409_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_GREATER_in_intop409 = { FOLLOW_GREATER_in_intop409_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_LTE_in_intop422 */ ++static ANTLR3_BITWORD FOLLOW_LTE_in_intop422_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_LTE_in_intop422 = { FOLLOW_LTE_in_intop422_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_GTE_in_intop435 */ ++static ANTLR3_BITWORD FOLLOW_GTE_in_intop435_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_GTE_in_intop435 = { FOLLOW_GTE_in_intop435_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateop_in_datecrit464 */ ++static ANTLR3_BITWORD FOLLOW_dateop_in_datecrit464_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) }; ++static ANTLR3_BITSET_LIST FOLLOW_dateop_in_datecrit464 = { FOLLOW_dateop_in_datecrit464_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_datecrit470 */ ++static ANTLR3_BITWORD FOLLOW_FIELD_in_datecrit470_bits[] = { ANTLR3_UINT64_LIT(0x0000000001FEF860) }; ++static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_datecrit470 = { FOLLOW_FIELD_in_datecrit470_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_datespec_in_datecrit476 */ ++static ANTLR3_BITWORD FOLLOW_datespec_in_datecrit476_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) }; ++static ANTLR3_BITSET_LIST FOLLOW_datespec_in_datecrit476 = { FOLLOW_datespec_in_datecrit476_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_dateop505 */ ++static ANTLR3_BITWORD FOLLOW_BEFORE_in_dateop505_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_dateop505 = { FOLLOW_BEFORE_in_dateop505_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_dateop518 */ ++static ANTLR3_BITWORD FOLLOW_AFTER_in_dateop518_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_dateop518 = { FOLLOW_AFTER_in_dateop518_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateref_in_datespec546 */ ++static ANTLR3_BITWORD FOLLOW_dateref_in_datespec546_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_dateref_in_datespec546 = { FOLLOW_dateref_in_datespec546_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateop_in_datespec560 */ ++static ANTLR3_BITWORD FOLLOW_dateop_in_datespec560_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) }; ++static ANTLR3_BITSET_LIST FOLLOW_dateop_in_datespec560 = { FOLLOW_dateop_in_datespec560_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateref_in_datespec566 */ ++static ANTLR3_BITWORD FOLLOW_dateref_in_datespec566_bits[] = { ANTLR3_UINT64_LIT(0x0000000000010000) }; ++static ANTLR3_BITSET_LIST FOLLOW_dateref_in_datespec566 = { FOLLOW_dateref_in_datespec566_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_datespec572 */ ++static ANTLR3_BITWORD FOLLOW_INT_in_datespec572_bits[] = { ANTLR3_UINT64_LIT(0x000000001E000000) }; ++static ANTLR3_BITSET_LIST FOLLOW_INT_in_datespec572 = { FOLLOW_INT_in_datespec572_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateintval_in_datespec578 */ ++static ANTLR3_BITWORD FOLLOW_dateintval_in_datespec578_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) }; ++static ANTLR3_BITSET_LIST FOLLOW_dateintval_in_datespec578 = { FOLLOW_dateintval_in_datespec578_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateref607 */ ++static ANTLR3_BITWORD FOLLOW_DATE_in_dateref607_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateref607 = { FOLLOW_DATE_in_dateref607_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_TODAY_in_dateref616 */ ++static ANTLR3_BITWORD FOLLOW_TODAY_in_dateref616_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_TODAY_in_dateref616 = { FOLLOW_TODAY_in_dateref616_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DAY_in_dateintval640 */ ++static ANTLR3_BITWORD FOLLOW_DAY_in_dateintval640_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_DAY_in_dateintval640 = { FOLLOW_DAY_in_dateintval640_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_WEEK_in_dateintval649 */ ++static ANTLR3_BITWORD FOLLOW_WEEK_in_dateintval649_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_WEEK_in_dateintval649 = { FOLLOW_WEEK_in_dateintval649_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_MONTH_in_dateintval658 */ ++static ANTLR3_BITWORD FOLLOW_MONTH_in_dateintval658_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_MONTH_in_dateintval658 = { FOLLOW_MONTH_in_dateintval658_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_YEAR_in_dateintval667 */ ++static ANTLR3_BITWORD FOLLOW_YEAR_in_dateintval667_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_YEAR_in_dateintval667 = { FOLLOW_YEAR_in_dateintval667_bits, 1 }; ++ ++ ++ ++ ++/* ============================================== ++ * Parsing rules ++ */ ++/** ++ * $ANTLR start query ++ * RSP2SQL.g:56:1: query returns [ pANTLR3_STRING result ] : e= expr ; ++ */ ++static pANTLR3_STRING ++query(pRSP2SQL ctx) ++{ ++ pANTLR3_STRING result = NULL; ++ ++ RSP2SQL_expr_return e; ++ #undef RETURN_TYPE_e ++ #define RETURN_TYPE_e RSP2SQL_expr_return ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ result= NULL; ++ { ++ // RSP2SQL.g:58:2: (e= expr ) ++ // RSP2SQL.g:58:4: e= expr ++ { ++ FOLLOWPUSH(FOLLOW_expr_in_query70); ++ e=expr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto rulequeryEx; ++ } ++ ++ { ++ ++ if (!e.valid) ++ { ++ result= NULL; ++ } ++ else ++ { ++ result= e.result->factory->newRaw(e.result->factory); ++ result->append8(result, "("); ++ result->appendS(result, e.result); ++ result->append8(result, ")"); ++ } ++ ++ } ++ ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto rulequeryEx; /* Prevent compiler warnings */ ++ rulequeryEx: ; ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ } ++ ++ ++ return result; ++} ++/* $ANTLR end query */ ++ ++/** ++ * $ANTLR start expr ++ * RSP2SQL.g:74:1: expr returns [ pANTLR3_STRING result, int valid ] : ( ^( AND a= expr b= expr ) | ^( OR a= expr b= expr ) | c= strcrit | ^( NOT c= strcrit ) | i= intcrit | ^( NOT i= intcrit ) | d= datecrit ); ++ */ ++static RSP2SQL_expr_return ++expr(pRSP2SQL ctx) ++{ ++ RSP2SQL_expr_return retval; ++ ++ RSP2SQL_expr_return a; ++ #undef RETURN_TYPE_a ++ #define RETURN_TYPE_a RSP2SQL_expr_return ++ ++ RSP2SQL_expr_return b; ++ #undef RETURN_TYPE_b ++ #define RETURN_TYPE_b RSP2SQL_expr_return ++ ++ RSP2SQL_strcrit_return c; ++ #undef RETURN_TYPE_c ++ #define RETURN_TYPE_c RSP2SQL_strcrit_return ++ ++ RSP2SQL_intcrit_return i; ++ #undef RETURN_TYPE_i ++ #define RETURN_TYPE_i RSP2SQL_intcrit_return ++ ++ RSP2SQL_datecrit_return d; ++ #undef RETURN_TYPE_d ++ #define RETURN_TYPE_d RSP2SQL_datecrit_return ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ retval.result= NULL; retval.valid= 1; ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ { ++ { ++ // RSP2SQL.g:76:2: ( ^( AND a= expr b= expr ) | ^( OR a= expr b= expr ) | c= strcrit | ^( NOT c= strcrit ) | i= intcrit | ^( NOT i= intcrit ) | d= datecrit ) ++ ++ ANTLR3_UINT32 alt1; ++ ++ alt1=7; ++ ++ switch ( LA(1) ) ++ { ++ case AND: ++ { ++ alt1=1; ++ } ++ break; ++ case OR: ++ { ++ alt1=2; ++ } ++ break; ++ case EQUAL: ++ { ++ switch ( LA(2) ) ++ { ++ case DOWN: ++ { ++ switch ( LA(3) ) ++ { ++ case FIELD: ++ { ++ switch ( LA(4) ) ++ { ++ case INT: ++ { ++ alt1=5; ++ } ++ break; ++ case STR: ++ { ++ alt1=3; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 10; ++ ++ ++ goto ruleexprEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 8; ++ ++ ++ goto ruleexprEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 3; ++ ++ ++ goto ruleexprEx; ++ } ++ ++ } ++ break; ++ case INCLUDES: ++ case STARTSW: ++ case ENDSW: ++ { ++ alt1=3; ++ } ++ break; ++ case NOT: ++ { ++ switch ( LA(2) ) ++ { ++ case DOWN: ++ { ++ switch ( LA(3) ) ++ { ++ case EQUAL: ++ { ++ switch ( LA(4) ) ++ { ++ case DOWN: ++ { ++ switch ( LA(5) ) ++ { ++ case FIELD: ++ { ++ switch ( LA(6) ) ++ { ++ case STR: ++ { ++ alt1=4; ++ } ++ break; ++ case INT: ++ { ++ alt1=6; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 15; ++ ++ ++ goto ruleexprEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 14; ++ ++ ++ goto ruleexprEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 11; ++ ++ ++ goto ruleexprEx; ++ } ++ ++ } ++ break; ++ case LESS: ++ case GREATER: ++ case LTE: ++ case GTE: ++ { ++ alt1=6; ++ } ++ break; ++ case INCLUDES: ++ case STARTSW: ++ case ENDSW: ++ { ++ alt1=4; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 9; ++ ++ ++ goto ruleexprEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 5; ++ ++ ++ goto ruleexprEx; ++ } ++ ++ } ++ break; ++ case LESS: ++ case GREATER: ++ case LTE: ++ case GTE: ++ { ++ alt1=5; ++ } ++ break; ++ case BEFORE: ++ case AFTER: ++ { ++ alt1=7; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleexprEx; ++ } ++ ++ switch (alt1) ++ { ++ case 1: ++ // RSP2SQL.g:76:4: ^( AND a= expr b= expr ) ++ { ++ MATCHT(AND, &FOLLOW_AND_in_expr95); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_DOWN, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_expr_in_expr101); ++ a=expr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_expr_in_expr107); ++ b=expr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_UP, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ { ++ ++ if (!a.valid || !b.valid) ++ { ++ retval.valid= 0; ++ } ++ else ++ { ++ retval.result= a.result->factory->newRaw(a.result->factory); ++ retval.result->append8(retval.result, "("); ++ retval.result->appendS(retval.result, a.result); ++ retval.result->append8(retval.result, " AND "); ++ retval.result->appendS(retval.result, b.result); ++ retval.result->append8(retval.result, ")"); ++ } ++ ++ } ++ ++ } ++ break; ++ case 2: ++ // RSP2SQL.g:92:4: ^( OR a= expr b= expr ) ++ { ++ MATCHT(OR, &FOLLOW_OR_in_expr118); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_DOWN, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_expr_in_expr124); ++ a=expr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_expr_in_expr130); ++ b=expr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_UP, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ { ++ ++ if (!a.valid || !b.valid) ++ { ++ retval.valid= 0; ++ } ++ else ++ { ++ retval.result= a.result->factory->newRaw(a.result->factory); ++ retval.result->append8(retval.result, "("); ++ retval.result->appendS(retval.result, a.result); ++ retval.result->append8(retval.result, " OR "); ++ retval.result->appendS(retval.result, b.result); ++ retval.result->append8(retval.result, ")"); ++ } ++ ++ } ++ ++ } ++ break; ++ case 3: ++ // RSP2SQL.g:108:4: c= strcrit ++ { ++ FOLLOWPUSH(FOLLOW_strcrit_in_expr144); ++ c=strcrit(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ { ++ ++ retval.valid= c.valid; ++ retval.result= c.result; ++ ++ } ++ ++ } ++ break; ++ case 4: ++ // RSP2SQL.g:113:4: ^( NOT c= strcrit ) ++ { ++ MATCHT(NOT, &FOLLOW_NOT_in_expr154); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_DOWN, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_strcrit_in_expr160); ++ c=strcrit(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_UP, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ { ++ ++ if (!c.valid) ++ { ++ retval.valid= 0; ++ } ++ else ++ { ++ retval.result= c.result->factory->newRaw(c.result->factory); ++ retval.result->append8(retval.result, "(NOT "); ++ retval.result->appendS(retval.result, c.result); ++ retval.result->append8(retval.result, ")"); ++ } ++ ++ } ++ ++ } ++ break; ++ case 5: ++ // RSP2SQL.g:127:4: i= intcrit ++ { ++ FOLLOWPUSH(FOLLOW_intcrit_in_expr174); ++ i=intcrit(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ { ++ ++ retval.valid= i.valid; ++ retval.result= i.result; ++ ++ } ++ ++ } ++ break; ++ case 6: ++ // RSP2SQL.g:132:4: ^( NOT i= intcrit ) ++ { ++ MATCHT(NOT, &FOLLOW_NOT_in_expr184); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_DOWN, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_intcrit_in_expr190); ++ i=intcrit(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_UP, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ { ++ ++ if (!i.valid) ++ { ++ retval.valid= 0; ++ } ++ else ++ { ++ retval.result= i.result->factory->newRaw(i.result->factory); ++ retval.result->append8(retval.result, "(NOT "); ++ retval.result->appendS(retval.result, i.result); ++ retval.result->append8(retval.result, ")"); ++ } ++ ++ } ++ ++ } ++ break; ++ case 7: ++ // RSP2SQL.g:146:4: d= datecrit ++ { ++ FOLLOWPUSH(FOLLOW_datecrit_in_expr204); ++ d=datecrit(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ { ++ ++ retval.valid= d.valid; ++ retval.result= d.result; ++ ++ } ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleexprEx; /* Prevent compiler warnings */ ++ ruleexprEx: ; ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end expr */ ++ ++/** ++ * $ANTLR start strcrit ++ * RSP2SQL.g:153:1: strcrit returns [ pANTLR3_STRING result, int valid ] : ^(o= strop f= FIELD s= STR ) ; ++ */ ++static RSP2SQL_strcrit_return ++strcrit(pRSP2SQL ctx) ++{ ++ RSP2SQL_strcrit_return retval; ++ ++ pANTLR3_BASE_TREE f; ++ pANTLR3_BASE_TREE s; ++ pANTLR3_COMMON_TOKEN o; ++ #undef RETURN_TYPE_o ++ #define RETURN_TYPE_o pANTLR3_COMMON_TOKEN ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ retval.result= NULL; retval.valid= 1; ++ f = NULL; ++ s = NULL; ++ o = NULL; ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ { ++ // RSP2SQL.g:155:2: ( ^(o= strop f= FIELD s= STR ) ) ++ // RSP2SQL.g:155:4: ^(o= strop f= FIELD s= STR ) ++ { ++ FOLLOWPUSH(FOLLOW_strop_in_strcrit233); ++ o=strop(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto rulestrcritEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_DOWN, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto rulestrcritEx; ++ } ++ ++ f = (pANTLR3_BASE_TREE) MATCHT(FIELD, &FOLLOW_FIELD_in_strcrit239); ++ if (HASEXCEPTION()) ++ { ++ goto rulestrcritEx; ++ } ++ ++ s = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_strcrit245); ++ if (HASEXCEPTION()) ++ { ++ goto rulestrcritEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_UP, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto rulestrcritEx; ++ } ++ ++ { ++ ++ char *op; ++ const struct rsp_query_field_map *rqfp; ++ pANTLR3_STRING field; ++ char *escaped; ++ ANTLR3_UINT32 optok; ++ ++ escaped = NULL; ++ ++ op = NULL; ++ optok = o->getType(o); ++ switch (optok) ++ { ++ case EQUAL: ++ op = " = "; ++ break; ++ ++ case INCLUDES: ++ case STARTSW: ++ case ENDSW: ++ op = " LIKE "; ++ break; ++ } ++ ++ field = f->getText(f); ++ ++ /* Field lookup */ ++ rqfp = rsp_query_field_lookup((char *)field->chars, strlen((char *)field->chars)); ++ if (!rqfp) ++ { ++ DPRINTF(E_LOG, L_RSP, "Field '%s' is not a valid field in queries\n", field->chars); ++ retval.valid= 0; ++ goto strcrit_valid_0; /* ABORT */ ++ } ++ ++ /* Check field type */ ++ if (rqfp->field_type != RSP_TYPE_STRING) ++ { ++ DPRINTF(E_LOG, L_RSP, "Field '%s' is not a string field\n", field->chars); ++ retval.valid= 0; ++ goto strcrit_valid_0; /* ABORT */ ++ } ++ ++ escaped = db_escape_string((char *)s->getText(s)->chars); ++ if (!escaped) ++ { ++ DPRINTF(E_LOG, L_RSP, "Could not escape value\n"); ++ retval.valid= 0; ++ goto strcrit_valid_0; /* ABORT */ ++ } ++ ++ retval.result= field->factory->newRaw(field->factory); ++ retval.result->append8(retval.result, "f."); ++ retval.result->appendS(retval.result, field); ++ retval.result->append8(retval.result, op); ++ retval.result->append8(retval.result, "'"); ++ if ((optok == INCLUDES) || (optok == STARTSW)) ++ retval.result->append8(retval.result, "%"); ++ ++ retval.result->append8(retval.result, escaped); ++ ++ if ((optok == INCLUDES) || (optok == ENDSW)) ++ retval.result->append8(retval.result, "%"); ++ retval.result->append8(retval.result, "'"); ++ ++ strcrit_valid_0: ++ ; ++ ++ if (escaped) ++ free(escaped); ++ ++ } ++ ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto rulestrcritEx; /* Prevent compiler warnings */ ++ rulestrcritEx: ; ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end strcrit */ ++ ++/** ++ * $ANTLR start strop ++ * RSP2SQL.g:229:1: strop returns [ pANTLR3_COMMON_TOKEN op ] : (n= EQUAL | n= INCLUDES | n= STARTSW | n= ENDSW ); ++ */ ++static pANTLR3_COMMON_TOKEN ++strop(pRSP2SQL ctx) ++{ ++ pANTLR3_COMMON_TOKEN op = NULL; ++ ++ pANTLR3_BASE_TREE n; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ op= NULL; ++ n = NULL; ++ ++ { ++ { ++ // RSP2SQL.g:231:2: (n= EQUAL | n= INCLUDES | n= STARTSW | n= ENDSW ) ++ ++ ANTLR3_UINT32 alt2; ++ ++ alt2=4; ++ ++ switch ( LA(1) ) ++ { ++ case EQUAL: ++ { ++ alt2=1; ++ } ++ break; ++ case INCLUDES: ++ { ++ alt2=2; ++ } ++ break; ++ case STARTSW: ++ { ++ alt2=3; ++ } ++ break; ++ case ENDSW: ++ { ++ alt2=4; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 2; ++ EXCEPTION->state = 0; ++ ++ ++ goto rulestropEx; ++ } ++ ++ switch (alt2) ++ { ++ case 1: ++ // RSP2SQL.g:231:4: n= EQUAL ++ { ++ n = (pANTLR3_BASE_TREE) MATCHT(EQUAL, &FOLLOW_EQUAL_in_strop274); ++ if (HASEXCEPTION()) ++ { ++ goto rulestropEx; ++ } ++ ++ { ++ op= n->getToken(n); ++ } ++ ++ } ++ break; ++ case 2: ++ // RSP2SQL.g:233:4: n= INCLUDES ++ { ++ n = (pANTLR3_BASE_TREE) MATCHT(INCLUDES, &FOLLOW_INCLUDES_in_strop287); ++ if (HASEXCEPTION()) ++ { ++ goto rulestropEx; ++ } ++ ++ { ++ op= n->getToken(n); ++ } ++ ++ } ++ break; ++ case 3: ++ // RSP2SQL.g:235:4: n= STARTSW ++ { ++ n = (pANTLR3_BASE_TREE) MATCHT(STARTSW, &FOLLOW_STARTSW_in_strop300); ++ if (HASEXCEPTION()) ++ { ++ goto rulestropEx; ++ } ++ ++ { ++ op= n->getToken(n); ++ } ++ ++ } ++ break; ++ case 4: ++ // RSP2SQL.g:237:4: n= ENDSW ++ { ++ n = (pANTLR3_BASE_TREE) MATCHT(ENDSW, &FOLLOW_ENDSW_in_strop313); ++ if (HASEXCEPTION()) ++ { ++ goto rulestropEx; ++ } ++ ++ { ++ op= n->getToken(n); ++ } ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto rulestropEx; /* Prevent compiler warnings */ ++ rulestropEx: ; ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ } ++ ++ ++ return op; ++} ++/* $ANTLR end strop */ ++ ++/** ++ * $ANTLR start intcrit ++ * RSP2SQL.g:241:1: intcrit returns [ pANTLR3_STRING result, int valid ] : ^(o= intop f= FIELD i= INT ) ; ++ */ ++static RSP2SQL_intcrit_return ++intcrit(pRSP2SQL ctx) ++{ ++ RSP2SQL_intcrit_return retval; ++ ++ pANTLR3_BASE_TREE f; ++ pANTLR3_BASE_TREE i; ++ pANTLR3_COMMON_TOKEN o; ++ #undef RETURN_TYPE_o ++ #define RETURN_TYPE_o pANTLR3_COMMON_TOKEN ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ retval.result= NULL; retval.valid= 1; ++ f = NULL; ++ i = NULL; ++ o = NULL; ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ { ++ // RSP2SQL.g:243:2: ( ^(o= intop f= FIELD i= INT ) ) ++ // RSP2SQL.g:243:4: ^(o= intop f= FIELD i= INT ) ++ { ++ FOLLOWPUSH(FOLLOW_intop_in_intcrit342); ++ o=intop(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintcritEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_DOWN, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintcritEx; ++ } ++ ++ f = (pANTLR3_BASE_TREE) MATCHT(FIELD, &FOLLOW_FIELD_in_intcrit348); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintcritEx; ++ } ++ ++ i = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_intcrit354); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintcritEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_UP, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintcritEx; ++ } ++ ++ { ++ ++ char *op; ++ const struct rsp_query_field_map *rqfp; ++ pANTLR3_STRING field; ++ ++ op = NULL; ++ switch (o->getType(o)) ++ { ++ case EQUAL: ++ op = " = "; ++ break; ++ ++ case LESS: ++ op = " < "; ++ break; ++ ++ case GREATER: ++ op = " > "; ++ break; ++ ++ case LTE: ++ op = " <= "; ++ break; ++ ++ case GTE: ++ op = " >= "; ++ break; ++ } ++ ++ field = f->getText(f); ++ ++ /* Field lookup */ ++ rqfp = rsp_query_field_lookup((char *)field->chars, strlen((char *)field->chars)); ++ if (!rqfp) ++ { ++ DPRINTF(E_LOG, L_RSP, "Field '%s' is not a valid field in queries\n", field->chars); ++ retval.valid= 0; ++ goto intcrit_valid_0; /* ABORT */ ++ } ++ ++ /* Check field type */ ++ if (rqfp->field_type != RSP_TYPE_INT) ++ { ++ DPRINTF(E_LOG, L_RSP, "Field '%s' is not an integer field\n", field->chars); ++ retval.valid= 0; ++ goto intcrit_valid_0; /* ABORT */ ++ } ++ ++ retval.result= field->factory->newRaw(field->factory); ++ retval.result->append8(retval.result, "f."); ++ retval.result->appendS(retval.result, field); ++ retval.result->append8(retval.result, op); ++ retval.result->appendS(retval.result, i->getText(i)); ++ ++ intcrit_valid_0: ++ ; ++ ++ } ++ ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleintcritEx; /* Prevent compiler warnings */ ++ ruleintcritEx: ; ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end intcrit */ ++ ++/** ++ * $ANTLR start intop ++ * RSP2SQL.g:303:1: intop returns [ pANTLR3_COMMON_TOKEN op ] : (n= EQUAL | n= LESS | n= GREATER | n= LTE | n= GTE ); ++ */ ++static pANTLR3_COMMON_TOKEN ++intop(pRSP2SQL ctx) ++{ ++ pANTLR3_COMMON_TOKEN op = NULL; ++ ++ pANTLR3_BASE_TREE n; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ op= NULL; ++ n = NULL; ++ ++ { ++ { ++ // RSP2SQL.g:305:2: (n= EQUAL | n= LESS | n= GREATER | n= LTE | n= GTE ) ++ ++ ANTLR3_UINT32 alt3; ++ ++ alt3=5; ++ ++ switch ( LA(1) ) ++ { ++ case EQUAL: ++ { ++ alt3=1; ++ } ++ break; ++ case LESS: ++ { ++ alt3=2; ++ } ++ break; ++ case GREATER: ++ { ++ alt3=3; ++ } ++ break; ++ case LTE: ++ { ++ alt3=4; ++ } ++ break; ++ case GTE: ++ { ++ alt3=5; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 3; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleintopEx; ++ } ++ ++ switch (alt3) ++ { ++ case 1: ++ // RSP2SQL.g:305:4: n= EQUAL ++ { ++ n = (pANTLR3_BASE_TREE) MATCHT(EQUAL, &FOLLOW_EQUAL_in_intop383); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintopEx; ++ } ++ ++ { ++ op= n->getToken(n); ++ } ++ ++ } ++ break; ++ case 2: ++ // RSP2SQL.g:307:4: n= LESS ++ { ++ n = (pANTLR3_BASE_TREE) MATCHT(LESS, &FOLLOW_LESS_in_intop396); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintopEx; ++ } ++ ++ { ++ op= n->getToken(n); ++ } ++ ++ } ++ break; ++ case 3: ++ // RSP2SQL.g:309:4: n= GREATER ++ { ++ n = (pANTLR3_BASE_TREE) MATCHT(GREATER, &FOLLOW_GREATER_in_intop409); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintopEx; ++ } ++ ++ { ++ op= n->getToken(n); ++ } ++ ++ } ++ break; ++ case 4: ++ // RSP2SQL.g:311:4: n= LTE ++ { ++ n = (pANTLR3_BASE_TREE) MATCHT(LTE, &FOLLOW_LTE_in_intop422); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintopEx; ++ } ++ ++ { ++ op= n->getToken(n); ++ } ++ ++ } ++ break; ++ case 5: ++ // RSP2SQL.g:313:4: n= GTE ++ { ++ n = (pANTLR3_BASE_TREE) MATCHT(GTE, &FOLLOW_GTE_in_intop435); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintopEx; ++ } ++ ++ { ++ op= n->getToken(n); ++ } ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleintopEx; /* Prevent compiler warnings */ ++ ruleintopEx: ; ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ } ++ ++ ++ return op; ++} ++/* $ANTLR end intop */ ++ ++/** ++ * $ANTLR start datecrit ++ * RSP2SQL.g:317:1: datecrit returns [ pANTLR3_STRING result, int valid ] : ^(o= dateop f= FIELD d= datespec ) ; ++ */ ++static RSP2SQL_datecrit_return ++datecrit(pRSP2SQL ctx) ++{ ++ RSP2SQL_datecrit_return retval; ++ ++ pANTLR3_BASE_TREE f; ++ pANTLR3_COMMON_TOKEN o; ++ #undef RETURN_TYPE_o ++ #define RETURN_TYPE_o pANTLR3_COMMON_TOKEN ++ ++ RSP2SQL_datespec_return d; ++ #undef RETURN_TYPE_d ++ #define RETURN_TYPE_d RSP2SQL_datespec_return ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ retval.result= NULL; retval.valid= 1; ++ f = NULL; ++ o = NULL; ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ { ++ // RSP2SQL.g:319:2: ( ^(o= dateop f= FIELD d= datespec ) ) ++ // RSP2SQL.g:319:4: ^(o= dateop f= FIELD d= datespec ) ++ { ++ FOLLOWPUSH(FOLLOW_dateop_in_datecrit464); ++ o=dateop(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatecritEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_DOWN, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatecritEx; ++ } ++ ++ f = (pANTLR3_BASE_TREE) MATCHT(FIELD, &FOLLOW_FIELD_in_datecrit470); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatecritEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_datespec_in_datecrit476); ++ d=datespec(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatecritEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_UP, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatecritEx; ++ } ++ ++ { ++ ++ char *op; ++ const struct rsp_query_field_map *rqfp; ++ pANTLR3_STRING field; ++ char buf[32]; ++ int ret; ++ ++ op = NULL; ++ switch (o->getType(o)) ++ { ++ case BEFORE: ++ op = " < "; ++ break; ++ ++ case AFTER: ++ op = " > "; ++ break; ++ } ++ ++ field = f->getText(f); ++ ++ /* Field lookup */ ++ rqfp = rsp_query_field_lookup((char *)field->chars, strlen((char *)field->chars)); ++ if (!rqfp) ++ { ++ DPRINTF(E_LOG, L_RSP, "Field '%s' is not a valid field in queries\n", field->chars); ++ retval.valid= 0; ++ goto datecrit_valid_0; /* ABORT */ ++ } ++ ++ /* Check field type */ ++ if (rqfp->field_type != RSP_TYPE_DATE) ++ { ++ DPRINTF(E_LOG, L_RSP, "Field '%s' is not a date field\n", field->chars); ++ retval.valid= 0; ++ goto datecrit_valid_0; /* ABORT */ ++ } ++ ++ ret = snprintf(buf, sizeof(buf), "%ld", d.date); ++ if ((ret < 0) || (ret >= sizeof(buf))) ++ { ++ DPRINTF(E_LOG, L_RSP, "Date %ld too large for buffer, oops!\n", d.date); ++ retval.valid= 0; ++ goto datecrit_valid_0; /* ABORT */ ++ } ++ ++ retval.result= field->factory->newRaw(field->factory); ++ retval.result->append8(retval.result, "f."); ++ retval.result->appendS(retval.result, field); ++ retval.result->append8(retval.result, op); ++ retval.result->append8(retval.result, buf); ++ ++ datecrit_valid_0: ++ ; ++ ++ } ++ ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruledatecritEx; /* Prevent compiler warnings */ ++ ruledatecritEx: ; ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end datecrit */ ++ ++/** ++ * $ANTLR start dateop ++ * RSP2SQL.g:377:1: dateop returns [ pANTLR3_COMMON_TOKEN op ] : (n= BEFORE | n= AFTER ); ++ */ ++static pANTLR3_COMMON_TOKEN ++dateop(pRSP2SQL ctx) ++{ ++ pANTLR3_COMMON_TOKEN op = NULL; ++ ++ pANTLR3_BASE_TREE n; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ op= NULL; ++ n = NULL; ++ ++ { ++ { ++ // RSP2SQL.g:379:2: (n= BEFORE | n= AFTER ) ++ ++ ANTLR3_UINT32 alt4; ++ ++ alt4=2; ++ ++ switch ( LA(1) ) ++ { ++ case BEFORE: ++ { ++ alt4=1; ++ } ++ break; ++ case AFTER: ++ { ++ alt4=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 4; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruledateopEx; ++ } ++ ++ switch (alt4) ++ { ++ case 1: ++ // RSP2SQL.g:379:4: n= BEFORE ++ { ++ n = (pANTLR3_BASE_TREE) MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateop505); ++ if (HASEXCEPTION()) ++ { ++ goto ruledateopEx; ++ } ++ ++ { ++ op= n->getToken(n); ++ } ++ ++ } ++ break; ++ case 2: ++ // RSP2SQL.g:381:4: n= AFTER ++ { ++ n = (pANTLR3_BASE_TREE) MATCHT(AFTER, &FOLLOW_AFTER_in_dateop518); ++ if (HASEXCEPTION()) ++ { ++ goto ruledateopEx; ++ } ++ ++ { ++ op= n->getToken(n); ++ } ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruledateopEx; /* Prevent compiler warnings */ ++ ruledateopEx: ; ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ } ++ ++ ++ return op; ++} ++/* $ANTLR end dateop */ ++ ++/** ++ * $ANTLR start datespec ++ * RSP2SQL.g:385:1: datespec returns [ time_t date, int valid ] : (r= dateref | ^(o= dateop r= dateref m= INT i= dateintval ) ); ++ */ ++static RSP2SQL_datespec_return ++datespec(pRSP2SQL ctx) ++{ ++ RSP2SQL_datespec_return retval; ++ ++ pANTLR3_BASE_TREE m; ++ RSP2SQL_dateref_return r; ++ #undef RETURN_TYPE_r ++ #define RETURN_TYPE_r RSP2SQL_dateref_return ++ ++ pANTLR3_COMMON_TOKEN o; ++ #undef RETURN_TYPE_o ++ #define RETURN_TYPE_o pANTLR3_COMMON_TOKEN ++ ++ RSP2SQL_dateintval_return i; ++ #undef RETURN_TYPE_i ++ #define RETURN_TYPE_i RSP2SQL_dateintval_return ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ retval.date= 0; retval.valid= 1; ++ m = NULL; ++ o = NULL; ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ { ++ { ++ // RSP2SQL.g:387:2: (r= dateref | ^(o= dateop r= dateref m= INT i= dateintval ) ) ++ ++ ANTLR3_UINT32 alt5; ++ ++ alt5=2; ++ ++ switch ( LA(1) ) ++ { ++ case DATE: ++ case TODAY: ++ { ++ alt5=1; ++ } ++ break; ++ case BEFORE: ++ case AFTER: ++ { ++ alt5=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 5; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruledatespecEx; ++ } ++ ++ switch (alt5) ++ { ++ case 1: ++ // RSP2SQL.g:387:4: r= dateref ++ { ++ FOLLOWPUSH(FOLLOW_dateref_in_datespec546); ++ r=dateref(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatespecEx; ++ } ++ ++ { ++ ++ if (!r.valid) ++ retval.valid= 0; ++ else ++ retval.date= r.date; ++ ++ } ++ ++ } ++ break; ++ case 2: ++ // RSP2SQL.g:394:4: ^(o= dateop r= dateref m= INT i= dateintval ) ++ { ++ FOLLOWPUSH(FOLLOW_dateop_in_datespec560); ++ o=dateop(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatespecEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_DOWN, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatespecEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_dateref_in_datespec566); ++ r=dateref(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatespecEx; ++ } ++ ++ m = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_datespec572); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatespecEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_dateintval_in_datespec578); ++ i=dateintval(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatespecEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_UP, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatespecEx; ++ } ++ ++ { ++ ++ int32_t val; ++ int ret; ++ ++ if (!r.valid || !i.valid) ++ { ++ retval.valid= 0; ++ goto datespec_valid_0; /* ABORT */ ++ } ++ ++ ret = safe_atoi32((char *)m->getText(m)->chars, &val); ++ if (ret < 0) ++ { ++ DPRINTF(E_LOG, L_RSP, "Could not convert '%s' to integer\n", (char *)m->getText(m)); ++ retval.valid= 0; ++ goto datespec_valid_0; /* ABORT */ ++ } ++ ++ switch (o->getType(o)) ++ { ++ case BEFORE: ++ retval.date= r.date - (val * i.period); ++ break; ++ ++ case AFTER: ++ retval.date= r.date + (val * i.period); ++ break; ++ } ++ ++ datespec_valid_0: ++ ; ++ ++ } ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruledatespecEx; /* Prevent compiler warnings */ ++ ruledatespecEx: ; ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end datespec */ ++ ++/** ++ * $ANTLR start dateref ++ * RSP2SQL.g:429:1: dateref returns [ time_t date, int valid ] : (n= DATE | TODAY ); ++ */ ++static RSP2SQL_dateref_return ++dateref(pRSP2SQL ctx) ++{ ++ RSP2SQL_dateref_return retval; ++ ++ pANTLR3_BASE_TREE n; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ retval.date= 0; retval.valid= 1; ++ n = NULL; ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ { ++ { ++ // RSP2SQL.g:431:2: (n= DATE | TODAY ) ++ ++ ANTLR3_UINT32 alt6; ++ ++ alt6=2; ++ ++ switch ( LA(1) ) ++ { ++ case DATE: ++ { ++ alt6=1; ++ } ++ break; ++ case TODAY: ++ { ++ alt6=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 6; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruledaterefEx; ++ } ++ ++ switch (alt6) ++ { ++ case 1: ++ // RSP2SQL.g:431:4: n= DATE ++ { ++ n = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateref607); ++ if (HASEXCEPTION()) ++ { ++ goto ruledaterefEx; ++ } ++ ++ { ++ ++ struct tm tm; ++ char *ret; ++ ++ ret = strptime((char *)n->getText(n), "%Y-%m-%d", &tm); ++ if (!ret) ++ { ++ DPRINTF(E_LOG, L_RSP, "Date '%s' could not be interpreted\n", (char *)n->getText(n)); ++ retval.valid= 0; ++ goto dateref_valid_0; /* ABORT */ ++ } ++ else ++ { ++ if (*ret != '\0') ++ DPRINTF(E_LOG, L_RSP, "Garbage at end of date '%s' ?!\n", (char *)n->getText(n)); ++ ++ retval.date= mktime(&tm); ++ if (retval.date == (time_t) -1) ++ { ++ DPRINTF(E_LOG, L_RSP, "Date '%s' could not be converted to an epoch\n", (char *)n->getText(n)); ++ retval.valid= 0; ++ goto dateref_valid_0; /* ABORT */ ++ } ++ } ++ ++ dateref_valid_0: ++ ; ++ ++ } ++ ++ } ++ break; ++ case 2: ++ // RSP2SQL.g:460:4: TODAY ++ { ++ MATCHT(TODAY, &FOLLOW_TODAY_in_dateref616); ++ if (HASEXCEPTION()) ++ { ++ goto ruledaterefEx; ++ } ++ ++ { ++ retval.date= time(NULL); ++ } ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruledaterefEx; /* Prevent compiler warnings */ ++ ruledaterefEx: ; ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end dateref */ ++ ++/** ++ * $ANTLR start dateintval ++ * RSP2SQL.g:464:1: dateintval returns [ time_t period, int valid ] : ( DAY | WEEK | MONTH | YEAR ); ++ */ ++static RSP2SQL_dateintval_return ++dateintval(pRSP2SQL ctx) ++{ ++ RSP2SQL_dateintval_return retval; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ retval.period= 0; retval.valid= 1; ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ { ++ { ++ // RSP2SQL.g:466:2: ( DAY | WEEK | MONTH | YEAR ) ++ ++ ANTLR3_UINT32 alt7; ++ ++ alt7=4; ++ ++ switch ( LA(1) ) ++ { ++ case DAY: ++ { ++ alt7=1; ++ } ++ break; ++ case WEEK: ++ { ++ alt7=2; ++ } ++ break; ++ case MONTH: ++ { ++ alt7=3; ++ } ++ break; ++ case YEAR: ++ { ++ alt7=4; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 7; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruledateintvalEx; ++ } ++ ++ switch (alt7) ++ { ++ case 1: ++ // RSP2SQL.g:466:4: DAY ++ { ++ MATCHT(DAY, &FOLLOW_DAY_in_dateintval640); ++ if (HASEXCEPTION()) ++ { ++ goto ruledateintvalEx; ++ } ++ ++ { ++ retval.period= 24 * 60 * 60; ++ } ++ ++ } ++ break; ++ case 2: ++ // RSP2SQL.g:468:4: WEEK ++ { ++ MATCHT(WEEK, &FOLLOW_WEEK_in_dateintval649); ++ if (HASEXCEPTION()) ++ { ++ goto ruledateintvalEx; ++ } ++ ++ { ++ retval.period= 7 * 24 * 60 * 60; ++ } ++ ++ } ++ break; ++ case 3: ++ // RSP2SQL.g:470:4: MONTH ++ { ++ MATCHT(MONTH, &FOLLOW_MONTH_in_dateintval658); ++ if (HASEXCEPTION()) ++ { ++ goto ruledateintvalEx; ++ } ++ ++ { ++ retval.period= 30 * 24 * 60 * 60; ++ } ++ ++ } ++ break; ++ case 4: ++ // RSP2SQL.g:472:4: YEAR ++ { ++ MATCHT(YEAR, &FOLLOW_YEAR_in_dateintval667); ++ if (HASEXCEPTION()) ++ { ++ goto ruledateintvalEx; ++ } ++ ++ { ++ retval.period= 365 * 24 * 60 * 60; ++ } ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruledateintvalEx; /* Prevent compiler warnings */ ++ ruledateintvalEx: ; ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end dateintval */ ++/* End of parsing rules ++ * ============================================== ++ */ ++ ++/* ============================================== ++ * Syntactic predicates ++ */ ++/* End of syntactic predicates ++ * ============================================== ++ */ ++ ++ ++ ++ ++ ++ ++/* End of code ++ * ============================================================================= ++ */ +diff --git a/src/pregen/RSP2SQL.h b/src/pregen/RSP2SQL.h +new file mode 100644 +index 0000000..08ac7bb +--- /dev/null ++++ b/src/pregen/RSP2SQL.h +@@ -0,0 +1,291 @@ ++/** \file ++ * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : RSP2SQL.g ++ * - On : 2016-01-01 12:23:43 ++ * - for the tree parser : RSP2SQLTreeParser * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++ * The tree parser RSP2SQL has the callable functions (rules) shown below, ++ * which will invoke the code for the associated rule in the source grammar ++ * assuming that the input stream is pointing to a token/text stream that could begin ++ * this rule. ++ * ++ * For instance if you call the first (topmost) rule in a parser grammar, you will ++ * get the results of a full parse, but calling a rule half way through the grammar will ++ * allow you to pass part of a full token stream to the parser, such as for syntax checking ++ * in editors and so on. ++ * ++ * The parser entry points are called indirectly (by function pointer to function) via ++ * a parser context typedef pRSP2SQL, which is returned from a call to RSP2SQLNew(). ++ * ++ * The methods in pRSP2SQL are as follows: ++ * ++ * - pANTLR3_STRING pRSP2SQL->query(pRSP2SQL) ++ * - RSP2SQL_expr_return pRSP2SQL->expr(pRSP2SQL) ++ * - RSP2SQL_strcrit_return pRSP2SQL->strcrit(pRSP2SQL) ++ * - pANTLR3_COMMON_TOKEN pRSP2SQL->strop(pRSP2SQL) ++ * - RSP2SQL_intcrit_return pRSP2SQL->intcrit(pRSP2SQL) ++ * - pANTLR3_COMMON_TOKEN pRSP2SQL->intop(pRSP2SQL) ++ * - RSP2SQL_datecrit_return pRSP2SQL->datecrit(pRSP2SQL) ++ * - pANTLR3_COMMON_TOKEN pRSP2SQL->dateop(pRSP2SQL) ++ * - RSP2SQL_datespec_return pRSP2SQL->datespec(pRSP2SQL) ++ * - RSP2SQL_dateref_return pRSP2SQL->dateref(pRSP2SQL) ++ * - RSP2SQL_dateintval_return pRSP2SQL->dateintval(pRSP2SQL) ++ * ++ * The return type for any particular rule is of course determined by the source ++ * grammar file. ++ */ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++#ifndef _RSP2SQL_H ++#define _RSP2SQL_H ++/* ============================================================================= ++ * Standard antlr3 C runtime definitions ++ */ ++#include ++ ++/* End of standard antlr 3 runtime definitions ++ * ============================================================================= ++ */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++// Forward declare the context typedef so that we can use it before it is ++// properly defined. Delegators and delegates (from import statements) are ++// interdependent and their context structures contain pointers to each other ++// C only allows such things to be declared if you pre-declare the typedef. ++// ++typedef struct RSP2SQL_Ctx_struct RSP2SQL, * pRSP2SQL; ++ ++ ++ ++ /* Needs #define _GNU_SOURCE for strptime() */ ++ ++ #include ++ #include ++ #include ++ #include ++ ++ #include "logger.h" ++ #include "db.h" ++ #include "misc.h" ++ #include "rsp_query.h" ++ ++ ++#ifdef ANTLR3_WINDOWS ++// Disable: Unreferenced parameter, - Rules with parameters that are not used ++// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually) ++// initialized but unused variable - tree rewrite variables declared but not needed ++// Unreferenced local variable - lexer rule declares but does not always use _type ++// potentially unitialized variable used - retval always returned from a rule ++// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns ++// ++// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at ++// and the codegen must generate some of these warnings by necessity, apart from 4100, which is ++// usually generated when a parser rule is given a parameter that it does not use. Mostly though ++// this is a matter of orthogonality hence I disable that one. ++// ++#pragma warning( disable : 4100 ) ++#pragma warning( disable : 4101 ) ++#pragma warning( disable : 4127 ) ++#pragma warning( disable : 4189 ) ++#pragma warning( disable : 4505 ) ++#pragma warning( disable : 4701 ) ++#endif ++typedef struct RSP2SQL_expr_return_struct ++{ ++ pANTLR3_BASE_TREE start; ++ pANTLR3_BASE_TREE stop; ++ pANTLR3_STRING result; ++ int valid; ++} ++ RSP2SQL_expr_return; ++ ++typedef struct RSP2SQL_strcrit_return_struct ++{ ++ pANTLR3_BASE_TREE start; ++ pANTLR3_BASE_TREE stop; ++ pANTLR3_STRING result; ++ int valid; ++} ++ RSP2SQL_strcrit_return; ++ ++typedef struct RSP2SQL_intcrit_return_struct ++{ ++ pANTLR3_BASE_TREE start; ++ pANTLR3_BASE_TREE stop; ++ pANTLR3_STRING result; ++ int valid; ++} ++ RSP2SQL_intcrit_return; ++ ++typedef struct RSP2SQL_datecrit_return_struct ++{ ++ pANTLR3_BASE_TREE start; ++ pANTLR3_BASE_TREE stop; ++ pANTLR3_STRING result; ++ int valid; ++} ++ RSP2SQL_datecrit_return; ++ ++typedef struct RSP2SQL_datespec_return_struct ++{ ++ pANTLR3_BASE_TREE start; ++ pANTLR3_BASE_TREE stop; ++ time_t date; ++ int valid; ++} ++ RSP2SQL_datespec_return; ++ ++typedef struct RSP2SQL_dateref_return_struct ++{ ++ pANTLR3_BASE_TREE start; ++ pANTLR3_BASE_TREE stop; ++ time_t date; ++ int valid; ++} ++ RSP2SQL_dateref_return; ++ ++typedef struct RSP2SQL_dateintval_return_struct ++{ ++ pANTLR3_BASE_TREE start; ++ pANTLR3_BASE_TREE stop; ++ time_t period; ++ int valid; ++} ++ RSP2SQL_dateintval_return; ++ ++ ++ ++/** Context tracking structure for RSP2SQL ++ */ ++struct RSP2SQL_Ctx_struct ++{ ++ /** Built in ANTLR3 context tracker contains all the generic elements ++ * required for context tracking. ++ */ ++ pANTLR3_TREE_PARSER pTreeParser; ++ ++ ++ pANTLR3_STRING (*query) (struct RSP2SQL_Ctx_struct * ctx); ++ RSP2SQL_expr_return (*expr) (struct RSP2SQL_Ctx_struct * ctx); ++ RSP2SQL_strcrit_return (*strcrit) (struct RSP2SQL_Ctx_struct * ctx); ++ pANTLR3_COMMON_TOKEN (*strop) (struct RSP2SQL_Ctx_struct * ctx); ++ RSP2SQL_intcrit_return (*intcrit) (struct RSP2SQL_Ctx_struct * ctx); ++ pANTLR3_COMMON_TOKEN (*intop) (struct RSP2SQL_Ctx_struct * ctx); ++ RSP2SQL_datecrit_return (*datecrit) (struct RSP2SQL_Ctx_struct * ctx); ++ pANTLR3_COMMON_TOKEN (*dateop) (struct RSP2SQL_Ctx_struct * ctx); ++ RSP2SQL_datespec_return (*datespec) (struct RSP2SQL_Ctx_struct * ctx); ++ RSP2SQL_dateref_return (*dateref) (struct RSP2SQL_Ctx_struct * ctx); ++ RSP2SQL_dateintval_return (*dateintval) (struct RSP2SQL_Ctx_struct * ctx); ++ // Delegated rules ++ const char * (*getGrammarFileName)(); ++ void (*free) (struct RSP2SQL_Ctx_struct * ctx); ++ ++}; ++ ++// Function protoypes for the constructor functions that external translation units ++// such as delegators and delegates may wish to call. ++// ++ANTLR3_API pRSP2SQL RSP2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream); ++ANTLR3_API pRSP2SQL RSP2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state); ++ ++/** Symbolic definitions of all the tokens that the tree parser will work with. ++ * \{ ++ * ++ * Antlr will define EOF, but we can't use that as it it is too common in ++ * in C header files and that would be confusing. There is no way to filter this out at the moment ++ * so we just undef it here for now. That isn't the value we get back from C recognizers ++ * anyway. We are looking for ANTLR3_TOKEN_EOF. ++ */ ++#ifdef EOF ++#undef EOF ++#endif ++#ifdef Tokens ++#undef Tokens ++#endif ++#define STARTSW 14 ++#define WEEK 26 ++#define TODAY 24 ++#define YEAR 28 ++#define ENDSW 15 ++#define GTE 20 ++#define BEFORE 21 ++#define DAY 25 ++#define INT 16 ++#define NOT 11 ++#define AFTER 22 ++#define AND 6 ++#define EOF -1 ++#define LTE 19 ++#define MONTH 27 ++#define DIGIT19 31 ++#define INCLUDES 13 ++#define STR 10 ++#define QUOTE 29 ++#define GREATER 18 ++#define WS 30 ++#define LPAR 7 ++#define NEWLINE 4 ++#define EQUAL 12 ++#define OR 5 ++#define LESS 17 ++#define FIELD 9 ++#define RPAR 8 ++#define ESCAPED 33 ++#define DATE 23 ++#define DIGIT09 32 ++#ifdef EOF ++#undef EOF ++#define EOF ANTLR3_TOKEN_EOF ++#endif ++ ++#ifndef TOKENSOURCE ++#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource ++#endif ++ ++/* End of token definitions for RSP2SQL ++ * ============================================================================= ++ */ ++/** \} */ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif ++ ++/* END - Note:Keep extra line feed to satisfy UNIX systems */ +diff --git a/src/pregen/RSP2SQL.u b/src/pregen/RSP2SQL.u +new file mode 100644 +index 0000000..53d8cda +--- /dev/null ++++ b/src/pregen/RSP2SQL.u +@@ -0,0 +1,5 @@ ++RSP2SQL.g: RSP.tokens ++RSP2SQL.c : RSP2SQL.g ++./RSP2SQL.tokens : RSP2SQL.g ++RSP2SQL.h : RSP2SQL.g ++ANTLR_PRODUCTS += RSP2SQL.c ./RSP2SQL.tokens RSP2SQL.h +\ No newline at end of file +diff --git a/src/pregen/RSPLexer.c b/src/pregen/RSPLexer.c +new file mode 100644 +index 0000000..2e3faae +--- /dev/null ++++ b/src/pregen/RSPLexer.c +@@ -0,0 +1,4867 @@ ++/** \file ++ * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : RSP.g ++ * - On : 2016-01-01 12:23:42 ++ * - for the lexer : RSPLexerLexer * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++*/ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++/* ----------------------------------------- ++ * Include the ANTLR3 generated header file. ++ */ ++#include "RSPLexer.h" ++/* ----------------------------------------- */ ++ ++ ++/** String literals used by RSPLexer that we must do things like MATCHS() with. ++ * C will normally just lay down 8 bit characters, and you can use L"xxx" to ++ * get wchar_t, but wchar_t is 16 bits on Windows, which is not UTF32 and so ++ * we perform this little trick of defining the literals as arrays of UINT32 ++ * and passing in the address of these. ++ */ ++static ANTLR3_UCHAR lit_1[] = { 0x61, 0x6E, 0x64, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_2[] = { 0x6F, 0x72, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_3[] = { 0x69, 0x6E, 0x63, 0x6C, 0x75, 0x64, 0x65, 0x73, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_4[] = { 0x73, 0x74, 0x61, 0x72, 0x74, 0x73, 0x77, 0x69, 0x74, 0x68, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_5[] = { 0x65, 0x6E, 0x64, 0x73, 0x77, 0x69, 0x74, 0x68, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_6[] = { 0x3E, 0x3D, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_7[] = { 0x3C, 0x3D, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_8[] = { 0x62, 0x65, 0x66, 0x6F, 0x72, 0x65, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_9[] = { 0x61, 0x66, 0x74, 0x65, 0x72, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_10[] = { 0x64, 0x61, 0x79, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_11[] = { 0x64, 0x61, 0x79, 0x73, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_12[] = { 0x77, 0x65, 0x65, 0x6B, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_13[] = { 0x77, 0x65, 0x65, 0x6B, 0x73, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_14[] = { 0x6D, 0x6F, 0x6E, 0x74, 0x68, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_15[] = { 0x6D, 0x6F, 0x6E, 0x74, 0x68, 0x73, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_16[] = { 0x79, 0x65, 0x61, 0x72, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_17[] = { 0x79, 0x65, 0x61, 0x72, 0x73, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_18[] = { 0x74, 0x6F, 0x64, 0x61, 0x79, ANTLR3_STRING_TERMINATOR}; ++ ++ ++ ++ ++/* MACROS that hide the C interface implementations from the ++ * generated code, which makes it a little more understandable to the human eye. ++ * I am very much against using C pre-processor macros for function calls and bits ++ * of code as you cannot see what is happening when single stepping in debuggers ++ * and so on. The exception (in my book at least) is for generated code, where you are ++ * not maintaining it, but may wish to read and understand it. If you single step it, you know that input() ++ * hides some indirect calls, but is always referring to the input stream. This is ++ * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig ++ * the runtime interfaces without changing the generated code too often, without ++ * confusing the reader of the generated output, who may not wish to know the gory ++ * details of the interface inheritance. ++ */ ++ ++#define CTX ctx ++ ++/* Aids in accessing scopes for grammar programmers ++ */ ++#undef SCOPE_TYPE ++#undef SCOPE_STACK ++#undef SCOPE_TOP ++#define SCOPE_TYPE(scope) pRSPLexer_##scope##_SCOPE ++#define SCOPE_STACK(scope) pRSPLexer_##scope##Stack ++#define SCOPE_TOP(scope) ctx->pRSPLexer_##scope##Top ++#define SCOPE_SIZE(scope) ctx->pRSPLexer_##scope##Stack_limit ++#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i)) ++ ++ ++/* Macros for accessing things in a lexer ++ */ ++#undef LEXER ++#undef RECOGNIZER ++#undef RULEMEMO ++#undef GETCHARINDEX ++#undef GETLINE ++#undef GETCHARPOSITIONINLINE ++#undef EMIT ++#undef EMITNEW ++#undef MATCHC ++#undef MATCHS ++#undef MATCHRANGE ++#undef LTOKEN ++#undef HASFAILED ++#undef FAILEDFLAG ++#undef INPUT ++#undef STRSTREAM ++#undef LA ++#undef HASEXCEPTION ++#undef EXCEPTION ++#undef CONSTRUCTEX ++#undef CONSUME ++#undef LRECOVER ++#undef MARK ++#undef REWIND ++#undef REWINDLAST ++#undef BACKTRACKING ++#undef MATCHANY ++#undef MEMOIZE ++#undef HAVEPARSEDRULE ++#undef GETTEXT ++#undef INDEX ++#undef SEEK ++#undef PUSHSTREAM ++#undef POPSTREAM ++#undef SETTEXT ++#undef SETTEXT8 ++ ++#define LEXER ctx->pLexer ++#define RECOGNIZER LEXER->rec ++#define LEXSTATE RECOGNIZER->state ++#define TOKSOURCE LEXSTATE->tokSource ++#define GETCHARINDEX() LEXER->getCharIndex(LEXER) ++#define GETLINE() LEXER->getLine(LEXER) ++#define GETTEXT() LEXER->getText(LEXER) ++#define GETCHARPOSITIONINLINE() LEXER->getCharPositionInLine(LEXER) ++#define EMIT() LEXSTATE->type = _type; LEXER->emit(LEXER) ++#define EMITNEW(t) LEXER->emitNew(LEXER, t) ++#define MATCHC(c) LEXER->matchc(LEXER, c) ++#define MATCHS(s) LEXER->matchs(LEXER, s) ++#define MATCHRANGE(c1,c2) LEXER->matchRange(LEXER, c1, c2) ++#define MATCHANY() LEXER->matchAny(LEXER) ++#define LTOKEN LEXSTATE->token ++#define HASFAILED() (LEXSTATE->failed == ANTLR3_TRUE) ++#define BACKTRACKING LEXSTATE->backtracking ++#define FAILEDFLAG LEXSTATE->failed ++#define INPUT LEXER->input ++#define STRSTREAM INPUT ++#define ISTREAM INPUT->istream ++#define INDEX() ISTREAM->index(ISTREAM) ++#define SEEK(n) ISTREAM->seek(ISTREAM, n) ++#define EOF_TOKEN &(LEXSTATE->tokSource->eofToken) ++#define HASEXCEPTION() (LEXSTATE->error == ANTLR3_TRUE) ++#define EXCEPTION LEXSTATE->exception ++#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER) ++#define LRECOVER() LEXER->recover(LEXER) ++#define MARK() ISTREAM->mark(ISTREAM) ++#define REWIND(m) ISTREAM->rewind(ISTREAM, m) ++#define REWINDLAST() ISTREAM->rewindLast(ISTREAM) ++#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si) ++#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r) ++#define PUSHSTREAM(str) LEXER->pushCharStream(LEXER, str) ++#define POPSTREAM() LEXER->popCharStream(LEXER) ++#define SETTEXT(str) LEXSTATE->text = str ++#define SKIP() LEXSTATE->token = &(TOKSOURCE->skipToken) ++#define USER1 LEXSTATE->user1 ++#define USER2 LEXSTATE->user2 ++#define USER3 LEXSTATE->user3 ++#define CUSTOM LEXSTATE->custom ++#define RULEMEMO LEXSTATE->ruleMemo ++#define DBG RECOGNIZER->debugger ++ ++/* If we have been told we can rely on the standard 8 bit or 16 bit input ++ * stream, then we can define our macros to use the direct pointers ++ * in the input object, which is much faster than indirect calls. This ++ * is really only significant to lexers with a lot of fragment rules (which ++ * do not place LA(1) in a temporary at the moment) and even then ++ * only if there is a lot of input (order of say 1M or so). ++ */ ++#if defined(ANTLR3_INLINE_INPUT_ASCII) || defined(ANTLR3_INLINE_INPUT_UTF16) ++ ++# ifdef ANTLR3_INLINE_INPUT_ASCII ++ ++/* 8 bit "ASCII" (actually any 8 bit character set) */ ++ ++# define NEXTCHAR ((pANTLR3_UINT8)(INPUT->nextChar)) ++# define DATAP ((pANTLR3_UINT8)(INPUT->data)) ++ ++# else ++ ++# define NEXTCHAR ((pANTLR3_UINT16)(INPUT->nextChar)) ++# define DATAP ((pANTLR3_UINT16)(INPUT->data)) ++ ++# endif ++ ++# define LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1))) ++# define CONSUME() \ ++{ \ ++ if (NEXTCHAR < (DATAP + INPUT->sizeBuf)) \ ++ { \ ++ INPUT->charPositionInLine++; \ ++ if ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar) \ ++ { \ ++ INPUT->line++; \ ++ INPUT->charPositionInLine = 0; \ ++ INPUT->currentLine = (void *)(NEXTCHAR + 1); \ ++ } \ ++ INPUT->nextChar = (void *)(NEXTCHAR + 1); \ ++ } \ ++} ++ ++#else ++ ++// Pick up the input character by calling the input stream implementation. ++// ++#define CONSUME() INPUT->istream->consume(INPUT->istream) ++#define LA(n) INPUT->istream->_LA(INPUT->istream, n) ++ ++#endif ++#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt ++ ++/* The 4 tokens defined below may well clash with your own #defines or token types. If so ++ * then for the present you must use different names for your defines as these are hard coded ++ * in the code generator. It would be better not to use such names internally, and maybe ++ * we can change this in a forthcoming release. I deliberately do not #undef these ++ * here as this will at least give you a redefined error somewhere if they clash. ++ */ ++#define UP ANTLR3_TOKEN_UP ++#define DOWN ANTLR3_TOKEN_DOWN ++#define EOR ANTLR3_TOKEN_EOR ++#define INVALID ANTLR3_TOKEN_INVALID ++ ++ ++/* ============================================================================= ++ * Functions to create and destroy scopes. First come the rule scopes, followed ++ * by the global declared scopes. ++ */ ++ ++ ++ ++/* ============================================================================= */ ++ ++/* ============================================================================= ++ * Start of recognizer ++ */ ++ ++ ++/* Forward declare the locally static matching functions we have generated and any predicate functions. ++ */ ++static ANTLR3_INLINE void mQUOTE (pRSPLexer ctx); ++static ANTLR3_INLINE void mLPAR (pRSPLexer ctx); ++static ANTLR3_INLINE void mRPAR (pRSPLexer ctx); ++static ANTLR3_INLINE void mAND (pRSPLexer ctx); ++static ANTLR3_INLINE void mOR (pRSPLexer ctx); ++static ANTLR3_INLINE void mNOT (pRSPLexer ctx); ++static ANTLR3_INLINE void mEQUAL (pRSPLexer ctx); ++static ANTLR3_INLINE void mINCLUDES (pRSPLexer ctx); ++static ANTLR3_INLINE void mSTARTSW (pRSPLexer ctx); ++static ANTLR3_INLINE void mENDSW (pRSPLexer ctx); ++static ANTLR3_INLINE void mGREATER (pRSPLexer ctx); ++static ANTLR3_INLINE void mLESS (pRSPLexer ctx); ++static ANTLR3_INLINE void mGTE (pRSPLexer ctx); ++static ANTLR3_INLINE void mLTE (pRSPLexer ctx); ++static ANTLR3_INLINE void mBEFORE (pRSPLexer ctx); ++static ANTLR3_INLINE void mAFTER (pRSPLexer ctx); ++static ANTLR3_INLINE void mDAY (pRSPLexer ctx); ++static ANTLR3_INLINE void mWEEK (pRSPLexer ctx); ++static ANTLR3_INLINE void mMONTH (pRSPLexer ctx); ++static ANTLR3_INLINE void mYEAR (pRSPLexer ctx); ++static ANTLR3_INLINE void mTODAY (pRSPLexer ctx); ++static ANTLR3_INLINE void mNEWLINE (pRSPLexer ctx); ++static ANTLR3_INLINE void mWS (pRSPLexer ctx); ++static ANTLR3_INLINE void mFIELD (pRSPLexer ctx); ++static ANTLR3_INLINE void mINT (pRSPLexer ctx); ++static ANTLR3_INLINE void mDATE (pRSPLexer ctx); ++static ANTLR3_INLINE void mSTR (pRSPLexer ctx); ++static ANTLR3_INLINE void mESCAPED (pRSPLexer ctx); ++static ANTLR3_INLINE void mDIGIT09 (pRSPLexer ctx); ++static ANTLR3_INLINE void mDIGIT19 (pRSPLexer ctx); ++static ANTLR3_INLINE void mTokens (pRSPLexer ctx); ++static void RSPLexerFree(pRSPLexer ctx); ++ ++/* ========================================================================= ++ * Lexer matching rules end. ++ * ========================================================================= ++ */ ++ ++ ++ ++static void ++RSPLexerFree (pRSPLexer ctx) ++{ ++ LEXER->free(LEXER); ++ ++ ANTLR3_FREE(ctx); ++} ++ ++/** \brief Name of the grammar file that generated this code ++ */ ++static const char fileName[] = "RSP.g"; ++ ++/** \brief Return the name of the grammar file that generated this code. ++ */ ++static const char * getGrammarFileName() ++{ ++ return fileName; ++} ++ ++/** \brief Create a new lexer called RSPLexer ++ * ++ * \param[in] instream Pointer to an initialized input stream ++ * \return ++ * - Success pRSPLexer initialized for the lex start ++ * - Fail NULL ++ */ ++ANTLR3_API pRSPLexer RSPLexerNew ++(pANTLR3_INPUT_STREAM instream) ++{ ++ // See if we can create a new lexer with the standard constructor ++ // ++ return RSPLexerNewSSD(instream, NULL); ++} ++ ++/** \brief Create a new lexer called RSPLexer ++ * ++ * \param[in] instream Pointer to an initialized input stream ++ * \param[state] state Previously created shared recognizer stat ++ * \return ++ * - Success pRSPLexer initialized for the lex start ++ * - Fail NULL ++ */ ++ANTLR3_API pRSPLexer RSPLexerNewSSD ++(pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state) ++{ ++ pRSPLexer ctx; // Context structure we will build and return ++ ++ ctx = (pRSPLexer) ANTLR3_CALLOC(1, sizeof(RSPLexer)); ++ ++ if (ctx == NULL) ++ { ++ // Failed to allocate memory for lexer context ++ return NULL; ++ } ++ ++ /* ------------------------------------------------------------------- ++ * Memory for basic structure is allocated, now to fill in ++ * in base ANTLR3 structures. We initialize the function pointers ++ * for the standard ANTLR3 lexer function set, but upon return ++ * from here, the programmer may set the pointers to provide custom ++ * implementations of each function. ++ * ++ * We don't use the macros defined in RSPLexer.h here so you can get a sense ++ * of what goes where. ++ */ ++ ++ /* Create a base lexer, using the supplied input stream ++ */ ++ ctx->pLexer = antlr3LexerNewStream(ANTLR3_SIZE_HINT, instream, state); ++ ++ /* Check that we allocated the memory correctly ++ */ ++ if (ctx->pLexer == NULL) ++ { ++ ANTLR3_FREE(ctx); ++ return NULL; ++ } ++ /* Install the implementation of our RSPLexer interface ++ */ ++ ctx->mQUOTE = mQUOTE; ++ ctx->mLPAR = mLPAR; ++ ctx->mRPAR = mRPAR; ++ ctx->mAND = mAND; ++ ctx->mOR = mOR; ++ ctx->mNOT = mNOT; ++ ctx->mEQUAL = mEQUAL; ++ ctx->mINCLUDES = mINCLUDES; ++ ctx->mSTARTSW = mSTARTSW; ++ ctx->mENDSW = mENDSW; ++ ctx->mGREATER = mGREATER; ++ ctx->mLESS = mLESS; ++ ctx->mGTE = mGTE; ++ ctx->mLTE = mLTE; ++ ctx->mBEFORE = mBEFORE; ++ ctx->mAFTER = mAFTER; ++ ctx->mDAY = mDAY; ++ ctx->mWEEK = mWEEK; ++ ctx->mMONTH = mMONTH; ++ ctx->mYEAR = mYEAR; ++ ctx->mTODAY = mTODAY; ++ ctx->mNEWLINE = mNEWLINE; ++ ctx->mWS = mWS; ++ ctx->mFIELD = mFIELD; ++ ctx->mINT = mINT; ++ ctx->mDATE = mDATE; ++ ctx->mSTR = mSTR; ++ ctx->mESCAPED = mESCAPED; ++ ctx->mDIGIT09 = mDIGIT09; ++ ctx->mDIGIT19 = mDIGIT19; ++ ctx->mTokens = mTokens; ++ ++ /** When the nextToken() call is made to this lexer's pANTLR3_TOKEN_SOURCE ++ * it will call mTokens() in this generated code, and will pass it the ctx ++ * pointer of this lexer, not the context of the base lexer, so store that now. ++ */ ++ ctx->pLexer->ctx = ctx; ++ ++ /**Install the token matching function ++ */ ++ ctx->pLexer->mTokens = (void (*) (void *))(mTokens); ++ ++ ctx->getGrammarFileName = getGrammarFileName; ++ ctx->free = RSPLexerFree; ++ ++ ++ ++ ++ ++ /* Return the newly built lexer to the caller ++ */ ++ return ctx; ++} ++ ++ ++/* ========================================================================= ++ * Functions to match the lexer grammar defined tokens from the input stream ++ */ ++ ++// Comes from: 85:7: ( '\"' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start QUOTE ++ * ++ * Looks to match the characters the constitute the token QUOTE ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mQUOTE(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = QUOTE; ++ ++ ++ // RSP.g:85:7: ( '\"' ) ++ // RSP.g:85:9: '\"' ++ { ++ MATCHC('"'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleQUOTEEx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleQUOTEEx; /* Prevent compiler warnings */ ++ ruleQUOTEEx: ; ++ ++} ++// $ANTLR end QUOTE ++ ++// Comes from: 86:6: ( '(' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start LPAR ++ * ++ * Looks to match the characters the constitute the token LPAR ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mLPAR(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = LPAR; ++ ++ ++ // RSP.g:86:6: ( '(' ) ++ // RSP.g:86:8: '(' ++ { ++ MATCHC('('); ++ if (HASEXCEPTION()) ++ { ++ goto ruleLPAREx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleLPAREx; /* Prevent compiler warnings */ ++ ruleLPAREx: ; ++ ++} ++// $ANTLR end LPAR ++ ++// Comes from: 87:6: ( ')' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start RPAR ++ * ++ * Looks to match the characters the constitute the token RPAR ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mRPAR(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = RPAR; ++ ++ ++ // RSP.g:87:6: ( ')' ) ++ // RSP.g:87:8: ')' ++ { ++ MATCHC(')'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleRPAREx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleRPAREx; /* Prevent compiler warnings */ ++ ruleRPAREx: ; ++ ++} ++// $ANTLR end RPAR ++ ++// Comes from: 89:5: ( 'and' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start AND ++ * ++ * Looks to match the characters the constitute the token AND ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mAND(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = AND; ++ ++ ++ // RSP.g:89:5: ( 'and' ) ++ // RSP.g:89:7: 'and' ++ { ++ MATCHS(lit_1); ++ if (HASEXCEPTION()) ++ { ++ goto ruleANDEx; ++ } ++ ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleANDEx; /* Prevent compiler warnings */ ++ ruleANDEx: ; ++ ++} ++// $ANTLR end AND ++ ++// Comes from: 90:4: ( 'or' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start OR ++ * ++ * Looks to match the characters the constitute the token OR ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mOR(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = OR; ++ ++ ++ // RSP.g:90:4: ( 'or' ) ++ // RSP.g:90:6: 'or' ++ { ++ MATCHS(lit_2); ++ if (HASEXCEPTION()) ++ { ++ goto ruleOREx; ++ } ++ ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleOREx; /* Prevent compiler warnings */ ++ ruleOREx: ; ++ ++} ++// $ANTLR end OR ++ ++// Comes from: 91:5: ( '!' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start NOT ++ * ++ * Looks to match the characters the constitute the token NOT ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mNOT(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = NOT; ++ ++ ++ // RSP.g:91:5: ( '!' ) ++ // RSP.g:91:7: '!' ++ { ++ MATCHC('!'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleNOTEx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleNOTEx; /* Prevent compiler warnings */ ++ ruleNOTEx: ; ++ ++} ++// $ANTLR end NOT ++ ++// Comes from: 94:7: ( '=' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start EQUAL ++ * ++ * Looks to match the characters the constitute the token EQUAL ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mEQUAL(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = EQUAL; ++ ++ ++ // RSP.g:94:7: ( '=' ) ++ // RSP.g:94:9: '=' ++ { ++ MATCHC('='); ++ if (HASEXCEPTION()) ++ { ++ goto ruleEQUALEx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleEQUALEx; /* Prevent compiler warnings */ ++ ruleEQUALEx: ; ++ ++} ++// $ANTLR end EQUAL ++ ++// Comes from: 97:9: ( 'includes' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start INCLUDES ++ * ++ * Looks to match the characters the constitute the token INCLUDES ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mINCLUDES(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = INCLUDES; ++ ++ ++ // RSP.g:97:9: ( 'includes' ) ++ // RSP.g:97:11: 'includes' ++ { ++ MATCHS(lit_3); ++ if (HASEXCEPTION()) ++ { ++ goto ruleINCLUDESEx; ++ } ++ ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleINCLUDESEx; /* Prevent compiler warnings */ ++ ruleINCLUDESEx: ; ++ ++} ++// $ANTLR end INCLUDES ++ ++// Comes from: 98:9: ( 'startswith' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start STARTSW ++ * ++ * Looks to match the characters the constitute the token STARTSW ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mSTARTSW(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = STARTSW; ++ ++ ++ // RSP.g:98:9: ( 'startswith' ) ++ // RSP.g:98:11: 'startswith' ++ { ++ MATCHS(lit_4); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTARTSWEx; ++ } ++ ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleSTARTSWEx; /* Prevent compiler warnings */ ++ ruleSTARTSWEx: ; ++ ++} ++// $ANTLR end STARTSW ++ ++// Comes from: 99:7: ( 'endswith' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start ENDSW ++ * ++ * Looks to match the characters the constitute the token ENDSW ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mENDSW(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = ENDSW; ++ ++ ++ // RSP.g:99:7: ( 'endswith' ) ++ // RSP.g:99:9: 'endswith' ++ { ++ MATCHS(lit_5); ++ if (HASEXCEPTION()) ++ { ++ goto ruleENDSWEx; ++ } ++ ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleENDSWEx; /* Prevent compiler warnings */ ++ ruleENDSWEx: ; ++ ++} ++// $ANTLR end ENDSW ++ ++// Comes from: 102:9: ( '>' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start GREATER ++ * ++ * Looks to match the characters the constitute the token GREATER ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mGREATER(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = GREATER; ++ ++ ++ // RSP.g:102:9: ( '>' ) ++ // RSP.g:102:11: '>' ++ { ++ MATCHC('>'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleGREATEREx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleGREATEREx; /* Prevent compiler warnings */ ++ ruleGREATEREx: ; ++ ++} ++// $ANTLR end GREATER ++ ++// Comes from: 103:6: ( '<' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start LESS ++ * ++ * Looks to match the characters the constitute the token LESS ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mLESS(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = LESS; ++ ++ ++ // RSP.g:103:6: ( '<' ) ++ // RSP.g:103:8: '<' ++ { ++ MATCHC('<'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleLESSEx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleLESSEx; /* Prevent compiler warnings */ ++ ruleLESSEx: ; ++ ++} ++// $ANTLR end LESS ++ ++// Comes from: 104:5: ( '>=' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start GTE ++ * ++ * Looks to match the characters the constitute the token GTE ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mGTE(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = GTE; ++ ++ ++ // RSP.g:104:5: ( '>=' ) ++ // RSP.g:104:7: '>=' ++ { ++ MATCHS(lit_6); ++ if (HASEXCEPTION()) ++ { ++ goto ruleGTEEx; ++ } ++ ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleGTEEx; /* Prevent compiler warnings */ ++ ruleGTEEx: ; ++ ++} ++// $ANTLR end GTE ++ ++// Comes from: 105:5: ( '<=' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start LTE ++ * ++ * Looks to match the characters the constitute the token LTE ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mLTE(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = LTE; ++ ++ ++ // RSP.g:105:5: ( '<=' ) ++ // RSP.g:105:7: '<=' ++ { ++ MATCHS(lit_7); ++ if (HASEXCEPTION()) ++ { ++ goto ruleLTEEx; ++ } ++ ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleLTEEx; /* Prevent compiler warnings */ ++ ruleLTEEx: ; ++ ++} ++// $ANTLR end LTE ++ ++// Comes from: 108:8: ( 'before' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start BEFORE ++ * ++ * Looks to match the characters the constitute the token BEFORE ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mBEFORE(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = BEFORE; ++ ++ ++ // RSP.g:108:8: ( 'before' ) ++ // RSP.g:108:10: 'before' ++ { ++ MATCHS(lit_8); ++ if (HASEXCEPTION()) ++ { ++ goto ruleBEFOREEx; ++ } ++ ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleBEFOREEx; /* Prevent compiler warnings */ ++ ruleBEFOREEx: ; ++ ++} ++// $ANTLR end BEFORE ++ ++// Comes from: 109:7: ( 'after' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start AFTER ++ * ++ * Looks to match the characters the constitute the token AFTER ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mAFTER(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = AFTER; ++ ++ ++ // RSP.g:109:7: ( 'after' ) ++ // RSP.g:109:9: 'after' ++ { ++ MATCHS(lit_9); ++ if (HASEXCEPTION()) ++ { ++ goto ruleAFTEREx; ++ } ++ ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleAFTEREx; /* Prevent compiler warnings */ ++ ruleAFTEREx: ; ++ ++} ++// $ANTLR end AFTER ++ ++// Comes from: 110:5: ( 'day' | 'days' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start DAY ++ * ++ * Looks to match the characters the constitute the token DAY ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mDAY(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = DAY; ++ ++ ++ { ++ // RSP.g:110:5: ( 'day' | 'days' ) ++ ++ ANTLR3_UINT32 alt1; ++ ++ alt1=2; ++ ++ switch ( LA(1) ) ++ { ++ case 'd': ++ { ++ switch ( LA(2) ) ++ { ++ case 'a': ++ { ++ switch ( LA(3) ) ++ { ++ case 'y': ++ { ++ switch ( LA(4) ) ++ { ++ case 's': ++ { ++ alt1=2; ++ } ++ break; ++ ++ default: ++ alt1=1;} ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 2; ++ ++ ++ goto ruleDAYEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 1; ++ ++ ++ goto ruleDAYEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleDAYEx; ++ } ++ ++ switch (alt1) ++ { ++ case 1: ++ // RSP.g:110:7: 'day' ++ { ++ MATCHS(lit_10); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDAYEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 2: ++ // RSP.g:110:15: 'days' ++ { ++ MATCHS(lit_11); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDAYEx; ++ } ++ ++ ++ ++ } ++ break; ++ ++ } ++ } ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleDAYEx; /* Prevent compiler warnings */ ++ ruleDAYEx: ; ++ ++} ++// $ANTLR end DAY ++ ++// Comes from: 111:6: ( 'week' | 'weeks' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start WEEK ++ * ++ * Looks to match the characters the constitute the token WEEK ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mWEEK(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = WEEK; ++ ++ ++ { ++ // RSP.g:111:6: ( 'week' | 'weeks' ) ++ ++ ANTLR3_UINT32 alt2; ++ ++ alt2=2; ++ ++ switch ( LA(1) ) ++ { ++ case 'w': ++ { ++ switch ( LA(2) ) ++ { ++ case 'e': ++ { ++ switch ( LA(3) ) ++ { ++ case 'e': ++ { ++ switch ( LA(4) ) ++ { ++ case 'k': ++ { ++ switch ( LA(5) ) ++ { ++ case 's': ++ { ++ alt2=2; ++ } ++ break; ++ ++ default: ++ alt2=1;} ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 2; ++ EXCEPTION->state = 3; ++ ++ ++ goto ruleWEEKEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 2; ++ EXCEPTION->state = 2; ++ ++ ++ goto ruleWEEKEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 2; ++ EXCEPTION->state = 1; ++ ++ ++ goto ruleWEEKEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 2; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleWEEKEx; ++ } ++ ++ switch (alt2) ++ { ++ case 1: ++ // RSP.g:111:8: 'week' ++ { ++ MATCHS(lit_12); ++ if (HASEXCEPTION()) ++ { ++ goto ruleWEEKEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 2: ++ // RSP.g:111:17: 'weeks' ++ { ++ MATCHS(lit_13); ++ if (HASEXCEPTION()) ++ { ++ goto ruleWEEKEx; ++ } ++ ++ ++ ++ } ++ break; ++ ++ } ++ } ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleWEEKEx; /* Prevent compiler warnings */ ++ ruleWEEKEx: ; ++ ++} ++// $ANTLR end WEEK ++ ++// Comes from: 112:7: ( 'month' | 'months' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start MONTH ++ * ++ * Looks to match the characters the constitute the token MONTH ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mMONTH(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = MONTH; ++ ++ ++ { ++ // RSP.g:112:7: ( 'month' | 'months' ) ++ ++ ANTLR3_UINT32 alt3; ++ ++ alt3=2; ++ ++ switch ( LA(1) ) ++ { ++ case 'm': ++ { ++ switch ( LA(2) ) ++ { ++ case 'o': ++ { ++ switch ( LA(3) ) ++ { ++ case 'n': ++ { ++ switch ( LA(4) ) ++ { ++ case 't': ++ { ++ switch ( LA(5) ) ++ { ++ case 'h': ++ { ++ switch ( LA(6) ) ++ { ++ case 's': ++ { ++ alt3=2; ++ } ++ break; ++ ++ default: ++ alt3=1;} ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 3; ++ EXCEPTION->state = 4; ++ ++ ++ goto ruleMONTHEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 3; ++ EXCEPTION->state = 3; ++ ++ ++ goto ruleMONTHEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 3; ++ EXCEPTION->state = 2; ++ ++ ++ goto ruleMONTHEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 3; ++ EXCEPTION->state = 1; ++ ++ ++ goto ruleMONTHEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 3; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleMONTHEx; ++ } ++ ++ switch (alt3) ++ { ++ case 1: ++ // RSP.g:112:9: 'month' ++ { ++ MATCHS(lit_14); ++ if (HASEXCEPTION()) ++ { ++ goto ruleMONTHEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 2: ++ // RSP.g:112:19: 'months' ++ { ++ MATCHS(lit_15); ++ if (HASEXCEPTION()) ++ { ++ goto ruleMONTHEx; ++ } ++ ++ ++ ++ } ++ break; ++ ++ } ++ } ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleMONTHEx; /* Prevent compiler warnings */ ++ ruleMONTHEx: ; ++ ++} ++// $ANTLR end MONTH ++ ++// Comes from: 113:6: ( 'year' | 'years' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start YEAR ++ * ++ * Looks to match the characters the constitute the token YEAR ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mYEAR(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = YEAR; ++ ++ ++ { ++ // RSP.g:113:6: ( 'year' | 'years' ) ++ ++ ANTLR3_UINT32 alt4; ++ ++ alt4=2; ++ ++ switch ( LA(1) ) ++ { ++ case 'y': ++ { ++ switch ( LA(2) ) ++ { ++ case 'e': ++ { ++ switch ( LA(3) ) ++ { ++ case 'a': ++ { ++ switch ( LA(4) ) ++ { ++ case 'r': ++ { ++ switch ( LA(5) ) ++ { ++ case 's': ++ { ++ alt4=2; ++ } ++ break; ++ ++ default: ++ alt4=1;} ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 4; ++ EXCEPTION->state = 3; ++ ++ ++ goto ruleYEAREx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 4; ++ EXCEPTION->state = 2; ++ ++ ++ goto ruleYEAREx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 4; ++ EXCEPTION->state = 1; ++ ++ ++ goto ruleYEAREx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 4; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleYEAREx; ++ } ++ ++ switch (alt4) ++ { ++ case 1: ++ // RSP.g:113:8: 'year' ++ { ++ MATCHS(lit_16); ++ if (HASEXCEPTION()) ++ { ++ goto ruleYEAREx; ++ } ++ ++ ++ ++ } ++ break; ++ case 2: ++ // RSP.g:113:17: 'years' ++ { ++ MATCHS(lit_17); ++ if (HASEXCEPTION()) ++ { ++ goto ruleYEAREx; ++ } ++ ++ ++ ++ } ++ break; ++ ++ } ++ } ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleYEAREx; /* Prevent compiler warnings */ ++ ruleYEAREx: ; ++ ++} ++// $ANTLR end YEAR ++ ++// Comes from: 114:7: ( 'today' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start TODAY ++ * ++ * Looks to match the characters the constitute the token TODAY ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mTODAY(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = TODAY; ++ ++ ++ // RSP.g:114:7: ( 'today' ) ++ // RSP.g:114:9: 'today' ++ { ++ MATCHS(lit_18); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTODAYEx; ++ } ++ ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleTODAYEx; /* Prevent compiler warnings */ ++ ruleTODAYEx: ; ++ ++} ++// $ANTLR end TODAY ++ ++// Comes from: 116:9: ( ( '\\r' )? '\\n' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start NEWLINE ++ * ++ * Looks to match the characters the constitute the token NEWLINE ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mNEWLINE(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = NEWLINE; ++ ++ ++ // RSP.g:116:9: ( ( '\\r' )? '\\n' ) ++ // RSP.g:116:11: ( '\\r' )? '\\n' ++ { ++ ++ // RSP.g:116:11: ( '\\r' )? ++ { ++ int alt5=2; ++ switch ( LA(1) ) ++ { ++ case '\r': ++ { ++ alt5=1; ++ } ++ break; ++ } ++ ++ switch (alt5) ++ { ++ case 1: ++ // RSP.g:116:11: '\\r' ++ { ++ MATCHC('\r'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleNEWLINEEx; ++ } ++ ++ ++ } ++ break; ++ ++ } ++ } ++ MATCHC('\n'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleNEWLINEEx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleNEWLINEEx; /* Prevent compiler warnings */ ++ ruleNEWLINEEx: ; ++ ++} ++// $ANTLR end NEWLINE ++ ++// Comes from: 118:4: ( ( ' ' | '\\t' ) ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start WS ++ * ++ * Looks to match the characters the constitute the token WS ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mWS(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = WS; ++ ++ ++ // RSP.g:118:4: ( ( ' ' | '\\t' ) ) ++ // RSP.g:118:6: ( ' ' | '\\t' ) ++ { ++ if ( LA(1) == '\t' || LA(1) == ' ' ) ++ { ++ CONSUME(); ++ ++ } ++ else ++ { ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION; ++ EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME; ++ ++ LRECOVER(); goto ruleWSEx; ++ } ++ ++ { ++ LEXSTATE->channel = HIDDEN; ++ } ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleWSEx; /* Prevent compiler warnings */ ++ ruleWSEx: ; ++ ++} ++// $ANTLR end WS ++ ++// Comes from: 120:7: ( 'a' .. 'z' ( 'a' .. 'z' | '_' )* 'a' .. 'z' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start FIELD ++ * ++ * Looks to match the characters the constitute the token FIELD ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mFIELD(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = FIELD; ++ ++ ++ // RSP.g:120:7: ( 'a' .. 'z' ( 'a' .. 'z' | '_' )* 'a' .. 'z' ) ++ // RSP.g:120:9: 'a' .. 'z' ( 'a' .. 'z' | '_' )* 'a' .. 'z' ++ { ++ MATCHRANGE('a', 'z'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleFIELDEx; ++ } ++ ++ ++ // RSP.g:120:18: ( 'a' .. 'z' | '_' )* ++ ++ for (;;) ++ { ++ int alt6=2; ++ switch ( LA(1) ) ++ { ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ switch ( LA(2) ) ++ { ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt6=1; ++ } ++ break; ++ ++ } ++ ++ } ++ break; ++ case '_': ++ { ++ alt6=1; ++ } ++ break; ++ ++ } ++ ++ switch (alt6) ++ { ++ case 1: ++ // RSP.g: ++ { ++ if ( LA(1) == '_' || ((LA(1) >= 'a') && (LA(1) <= 'z')) ) ++ { ++ CONSUME(); ++ ++ } ++ else ++ { ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION; ++ EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME; ++ ++ LRECOVER(); goto ruleFIELDEx; ++ } ++ ++ ++ } ++ break; ++ ++ default: ++ goto loop6; /* break out of the loop */ ++ break; ++ } ++ } ++ loop6: ; /* Jump out to here if this rule does not match */ ++ ++ MATCHRANGE('a', 'z'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleFIELDEx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleFIELDEx; /* Prevent compiler warnings */ ++ ruleFIELDEx: ; ++ ++} ++// $ANTLR end FIELD ++ ++// Comes from: 122:5: ( DIGIT19 ( DIGIT09 )* ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start INT ++ * ++ * Looks to match the characters the constitute the token INT ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mINT(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = INT; ++ ++ ++ // RSP.g:122:5: ( DIGIT19 ( DIGIT09 )* ) ++ // RSP.g:122:7: DIGIT19 ( DIGIT09 )* ++ { ++ /* 122:7: DIGIT19 ( DIGIT09 )* */ ++ mDIGIT19(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleINTEx; ++ } ++ ++ ++ // RSP.g:122:15: ( DIGIT09 )* ++ ++ for (;;) ++ { ++ int alt7=2; ++ switch ( LA(1) ) ++ { ++ case '0': ++ case '1': ++ case '2': ++ case '3': ++ case '4': ++ case '5': ++ case '6': ++ case '7': ++ case '8': ++ case '9': ++ { ++ alt7=1; ++ } ++ break; ++ ++ } ++ ++ switch (alt7) ++ { ++ case 1: ++ // RSP.g:122:15: DIGIT09 ++ { ++ /* 122:15: DIGIT09 */ ++ mDIGIT09(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleINTEx; ++ } ++ ++ ++ } ++ break; ++ ++ default: ++ goto loop7; /* break out of the loop */ ++ break; ++ } ++ } ++ loop7: ; /* Jump out to here if this rule does not match */ ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleINTEx; /* Prevent compiler warnings */ ++ ruleINTEx: ; ++ ++} ++// $ANTLR end INT ++ ++// Comes from: 125:6: ( DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start DATE ++ * ++ * Looks to match the characters the constitute the token DATE ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mDATE(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = DATE; ++ ++ ++ // RSP.g:125:6: ( DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) ) ++ // RSP.g:125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) ++ { ++ /* 125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) */ ++ mDIGIT19(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ /* 125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) */ ++ mDIGIT09(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ /* 125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) */ ++ mDIGIT09(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ /* 125:8: DIGIT19 DIGIT09 DIGIT09 DIGIT09 '-' ( '0' DIGIT19 | '1' '0' .. '2' ) '-' ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) */ ++ mDIGIT09(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ MATCHC('-'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ // RSP.g:125:44: ( '0' DIGIT19 | '1' '0' .. '2' ) ++ { ++ int alt8=2; ++ switch ( LA(1) ) ++ { ++ case '0': ++ { ++ alt8=1; ++ } ++ break; ++ case '1': ++ { ++ alt8=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 8; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleDATEEx; ++ } ++ ++ switch (alt8) ++ { ++ case 1: ++ // RSP.g:125:45: '0' DIGIT19 ++ { ++ MATCHC('0'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ /* 125:45: '0' DIGIT19 */ ++ mDIGIT19(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ } ++ break; ++ case 2: ++ // RSP.g:125:59: '1' '0' .. '2' ++ { ++ MATCHC('1'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ MATCHRANGE('0', '2'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ } ++ break; ++ ++ } ++ } ++ MATCHC('-'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ // RSP.g:125:77: ( '0' DIGIT19 | '1' .. '2' DIGIT09 | '3' '0' .. '1' ) ++ { ++ int alt9=3; ++ switch ( LA(1) ) ++ { ++ case '0': ++ { ++ alt9=1; ++ } ++ break; ++ case '1': ++ case '2': ++ { ++ alt9=2; ++ } ++ break; ++ case '3': ++ { ++ alt9=3; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 9; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleDATEEx; ++ } ++ ++ switch (alt9) ++ { ++ case 1: ++ // RSP.g:125:78: '0' DIGIT19 ++ { ++ MATCHC('0'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ /* 125:78: '0' DIGIT19 */ ++ mDIGIT19(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ } ++ break; ++ case 2: ++ // RSP.g:125:92: '1' .. '2' DIGIT09 ++ { ++ MATCHRANGE('1', '2'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ /* 125:92: '1' .. '2' DIGIT09 */ ++ mDIGIT09(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ } ++ break; ++ case 3: ++ // RSP.g:125:111: '3' '0' .. '1' ++ { ++ MATCHC('3'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ MATCHRANGE('0', '1'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ } ++ break; ++ ++ } ++ } ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleDATEEx; /* Prevent compiler warnings */ ++ ruleDATEEx: ; ++ ++} ++// $ANTLR end DATE ++ ++// Comes from: 133:2: ( QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start STR ++ * ++ * Looks to match the characters the constitute the token STR ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mSTR(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ pANTLR3_COMMON_TOKEN esc; ++ ANTLR3_UINT32 reg; ++ ++ ++ esc = NULL; ++ ++ _type = STR; ++ ++ pANTLR3_STRING unesc = GETTEXT()->factory->newRaw(GETTEXT()->factory); ++ ++ // RSP.g:133:2: ( QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE ) ++ // RSP.g:133:4: QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE ++ { ++ /* 133:4: QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE */ ++ mQUOTE(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTREx; ++ } ++ ++ // RSP.g:133:10: (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ ++ { ++ int cnt10=0; ++ ++ for (;;) ++ { ++ int alt10=3; ++ { ++ /* dfaLoopbackState(k,edges,eotPredictsAlt,description,stateNumber,semPredState) ++ */ ++ int LA10_0 = LA(1); ++ if ( (((LA10_0 >= 0x0000) && (LA10_0 <= '!')) || ((LA10_0 >= '#') && (LA10_0 <= '[')) || ((LA10_0 >= ']') && (LA10_0 <= 0xFFFF))) ) ++ { ++ alt10=1; ++ } ++ else if ( (LA10_0 == '\\') ) ++ { ++ alt10=2; ++ } ++ ++ } ++ switch (alt10) ++ { ++ case 1: ++ // RSP.g:133:12: reg=~ ( '\\\\' | '\"' ) ++ { ++ reg= LA(1); ++ if ( ((LA(1) >= 0x0000) && (LA(1) <= '!')) || ((LA(1) >= '#') && (LA(1) <= '[')) || ((LA(1) >= ']') && (LA(1) <= 0xFFFF)) ) ++ { ++ CONSUME(); ++ ++ } ++ else ++ { ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION; ++ EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME; ++ ++ LRECOVER(); goto ruleSTREx; ++ } ++ ++ { ++ unesc->addc(unesc, reg); ++ } ++ ++ } ++ break; ++ case 2: ++ // RSP.g:134:6: esc= ESCAPED ++ { ++ /* 134:6: esc= ESCAPED */ ++ { ++ ANTLR3_MARKER escStart381 = GETCHARINDEX(); ++ mESCAPED(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTREx; ++ } ++ ++ esc = LEXSTATE->tokFactory->newToken(LEXSTATE->tokFactory); ++ esc->setType(esc, ANTLR3_TOKEN_INVALID); ++ esc->setStartIndex(esc, escStart381); ++ esc->setStopIndex(esc, GETCHARINDEX()-1); ++ esc->input = INPUT; ++ } ++ { ++ unesc->appendS(unesc, GETTEXT()); ++ } ++ ++ } ++ break; ++ ++ default: ++ ++ if ( cnt10 >= 1 ) ++ { ++ goto loop10; ++ } ++ /* mismatchedSetEx() ++ */ ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION; ++ EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME; ++ ++ ++ goto ruleSTREx; ++ } ++ cnt10++; ++ } ++ loop10: ; /* Jump to here if this rule does not match */ ++ } ++ /* 133:4: QUOTE (reg=~ ( '\\\\' | '\"' ) | esc= ESCAPED )+ QUOTE */ ++ mQUOTE(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTREx; ++ } ++ ++ { ++ SETTEXT(unesc); ++ } ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleSTREx; /* Prevent compiler warnings */ ++ ruleSTREx: ; ++ ++ esc = NULL; ++ ++} ++// $ANTLR end STR ++ ++// Comes from: 138:9: ( '\\\\' ( '\\\\' | '\"' ) ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start ESCAPED ++ * ++ * Looks to match the characters the constitute the token ESCAPED ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mESCAPED(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ ++ // RSP.g:138:9: ( '\\\\' ( '\\\\' | '\"' ) ) ++ // RSP.g:138:11: '\\\\' ( '\\\\' | '\"' ) ++ { ++ MATCHC('\\'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleESCAPEDEx; ++ } ++ ++ ++ // RSP.g:139:3: ( '\\\\' | '\"' ) ++ { ++ int alt11=2; ++ switch ( LA(1) ) ++ { ++ case '\\': ++ { ++ alt11=1; ++ } ++ break; ++ case '"': ++ { ++ alt11=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 11; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleESCAPEDEx; ++ } ++ ++ switch (alt11) ++ { ++ case 1: ++ // RSP.g:139:5: '\\\\' ++ { ++ MATCHC('\\'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleESCAPEDEx; ++ } ++ ++ { ++ SETTEXT(GETTEXT()->factory->newStr8(GETTEXT()->factory, (pANTLR3_UINT8)"\\")); ++ } ++ ++ } ++ break; ++ case 2: ++ // RSP.g:140:5: '\"' ++ { ++ MATCHC('"'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleESCAPEDEx; ++ } ++ ++ { ++ SETTEXT(GETTEXT()->factory->newStr8(GETTEXT()->factory, (pANTLR3_UINT8)"\"")); ++ } ++ ++ } ++ break; ++ ++ } ++ } ++ ++ } ++ ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleESCAPEDEx; /* Prevent compiler warnings */ ++ ruleESCAPEDEx: ; ++ ++} ++// $ANTLR end ESCAPED ++ ++// Comes from: 145:9: ( '0' .. '9' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start DIGIT09 ++ * ++ * Looks to match the characters the constitute the token DIGIT09 ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mDIGIT09(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ ++ // RSP.g:145:9: ( '0' .. '9' ) ++ // RSP.g:145:11: '0' .. '9' ++ { ++ MATCHRANGE('0', '9'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDIGIT09Ex; ++ } ++ ++ ++ } ++ ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleDIGIT09Ex; /* Prevent compiler warnings */ ++ ruleDIGIT09Ex: ; ++ ++} ++// $ANTLR end DIGIT09 ++ ++// Comes from: 148:9: ( '1' .. '9' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start DIGIT19 ++ * ++ * Looks to match the characters the constitute the token DIGIT19 ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mDIGIT19(pRSPLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ ++ // RSP.g:148:9: ( '1' .. '9' ) ++ // RSP.g:148:11: '1' .. '9' ++ { ++ MATCHRANGE('1', '9'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDIGIT19Ex; ++ } ++ ++ ++ } ++ ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleDIGIT19Ex; /* Prevent compiler warnings */ ++ ruleDIGIT19Ex: ; ++ ++} ++// $ANTLR end DIGIT19 ++ ++/** This is the entry point in to the lexer from an object that ++ * wants to generate the next token, such as a pCOMMON_TOKEN_STREAM ++ */ ++static void ++mTokens(pRSPLexer ctx) ++{ ++ { ++ // RSP.g:1:8: ( QUOTE | LPAR | RPAR | AND | OR | NOT | EQUAL | INCLUDES | STARTSW | ENDSW | GREATER | LESS | GTE | LTE | BEFORE | AFTER | DAY | WEEK | MONTH | YEAR | TODAY | NEWLINE | WS | FIELD | INT | DATE | STR ) ++ ++ ANTLR3_UINT32 alt12; ++ ++ alt12=27; ++ ++ switch ( LA(1) ) ++ { ++ case '"': ++ { ++ ++ { ++ int LA12_1 = LA(2); ++ if ( (((LA12_1 >= 0x0000) && (LA12_1 <= '!')) || ((LA12_1 >= '#') && (LA12_1 <= 0xFFFF))) ) ++ { ++ alt12=27; ++ } ++ else ++ { ++ alt12=1; } ++ } ++ } ++ break; ++ case '(': ++ { ++ alt12=2; ++ } ++ break; ++ case ')': ++ { ++ alt12=3; ++ } ++ break; ++ case 'a': ++ { ++ switch ( LA(2) ) ++ { ++ case 'n': ++ { ++ switch ( LA(3) ) ++ { ++ case 'd': ++ { ++ switch ( LA(4) ) ++ { ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ alt12=4;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ case 'f': ++ { ++ switch ( LA(3) ) ++ { ++ case 't': ++ { ++ switch ( LA(4) ) ++ { ++ case 'e': ++ { ++ switch ( LA(5) ) ++ { ++ case 'r': ++ { ++ switch ( LA(6) ) ++ { ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ alt12=16;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 12; ++ EXCEPTION->state = 4; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 'o': ++ { ++ switch ( LA(2) ) ++ { ++ case 'r': ++ { ++ switch ( LA(3) ) ++ { ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ alt12=5;} ++ ++ } ++ break; ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 12; ++ EXCEPTION->state = 5; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case '!': ++ { ++ alt12=6; ++ } ++ break; ++ case '=': ++ { ++ alt12=7; ++ } ++ break; ++ case 'i': ++ { ++ switch ( LA(2) ) ++ { ++ case 'n': ++ { ++ switch ( LA(3) ) ++ { ++ case 'c': ++ { ++ switch ( LA(4) ) ++ { ++ case 'l': ++ { ++ switch ( LA(5) ) ++ { ++ case 'u': ++ { ++ switch ( LA(6) ) ++ { ++ case 'd': ++ { ++ switch ( LA(7) ) ++ { ++ case 'e': ++ { ++ switch ( LA(8) ) ++ { ++ case 's': ++ { ++ switch ( LA(9) ) ++ { ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ alt12=8;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 12; ++ EXCEPTION->state = 8; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 's': ++ { ++ switch ( LA(2) ) ++ { ++ case 't': ++ { ++ switch ( LA(3) ) ++ { ++ case 'a': ++ { ++ switch ( LA(4) ) ++ { ++ case 'r': ++ { ++ switch ( LA(5) ) ++ { ++ case 't': ++ { ++ switch ( LA(6) ) ++ { ++ case 's': ++ { ++ switch ( LA(7) ) ++ { ++ case 'w': ++ { ++ switch ( LA(8) ) ++ { ++ case 'i': ++ { ++ switch ( LA(9) ) ++ { ++ case 't': ++ { ++ switch ( LA(10) ) ++ { ++ case 'h': ++ { ++ switch ( LA(11) ) ++ { ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ alt12=9;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 12; ++ EXCEPTION->state = 9; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 'e': ++ { ++ switch ( LA(2) ) ++ { ++ case 'n': ++ { ++ switch ( LA(3) ) ++ { ++ case 'd': ++ { ++ switch ( LA(4) ) ++ { ++ case 's': ++ { ++ switch ( LA(5) ) ++ { ++ case 'w': ++ { ++ switch ( LA(6) ) ++ { ++ case 'i': ++ { ++ switch ( LA(7) ) ++ { ++ case 't': ++ { ++ switch ( LA(8) ) ++ { ++ case 'h': ++ { ++ switch ( LA(9) ) ++ { ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ alt12=10;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 12; ++ EXCEPTION->state = 10; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case '>': ++ { ++ switch ( LA(2) ) ++ { ++ case '=': ++ { ++ alt12=13; ++ } ++ break; ++ ++ default: ++ alt12=11;} ++ ++ } ++ break; ++ case '<': ++ { ++ switch ( LA(2) ) ++ { ++ case '=': ++ { ++ alt12=14; ++ } ++ break; ++ ++ default: ++ alt12=12;} ++ ++ } ++ break; ++ case 'b': ++ { ++ switch ( LA(2) ) ++ { ++ case 'e': ++ { ++ switch ( LA(3) ) ++ { ++ case 'f': ++ { ++ switch ( LA(4) ) ++ { ++ case 'o': ++ { ++ switch ( LA(5) ) ++ { ++ case 'r': ++ { ++ switch ( LA(6) ) ++ { ++ case 'e': ++ { ++ switch ( LA(7) ) ++ { ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ alt12=15;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 12; ++ EXCEPTION->state = 13; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 'd': ++ { ++ switch ( LA(2) ) ++ { ++ case 'a': ++ { ++ switch ( LA(3) ) ++ { ++ case 'y': ++ { ++ switch ( LA(4) ) ++ { ++ case 's': ++ { ++ switch ( LA(5) ) ++ { ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ alt12=17;} ++ ++ } ++ break; ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ alt12=17;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ case '_': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 12; ++ EXCEPTION->state = 14; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 'w': ++ { ++ switch ( LA(2) ) ++ { ++ case 'e': ++ { ++ switch ( LA(3) ) ++ { ++ case 'e': ++ { ++ switch ( LA(4) ) ++ { ++ case 'k': ++ { ++ switch ( LA(5) ) ++ { ++ case 's': ++ { ++ switch ( LA(6) ) ++ { ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ alt12=18;} ++ ++ } ++ break; ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ alt12=18;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 12; ++ EXCEPTION->state = 15; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 'm': ++ { ++ switch ( LA(2) ) ++ { ++ case 'o': ++ { ++ switch ( LA(3) ) ++ { ++ case 'n': ++ { ++ switch ( LA(4) ) ++ { ++ case 't': ++ { ++ switch ( LA(5) ) ++ { ++ case 'h': ++ { ++ switch ( LA(6) ) ++ { ++ case 's': ++ { ++ switch ( LA(7) ) ++ { ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ alt12=19;} ++ ++ } ++ break; ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ alt12=19;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 12; ++ EXCEPTION->state = 16; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 'y': ++ { ++ switch ( LA(2) ) ++ { ++ case 'e': ++ { ++ switch ( LA(3) ) ++ { ++ case 'a': ++ { ++ switch ( LA(4) ) ++ { ++ case 'r': ++ { ++ switch ( LA(5) ) ++ { ++ case 's': ++ { ++ switch ( LA(6) ) ++ { ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ alt12=20;} ++ ++ } ++ break; ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ alt12=20;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 12; ++ EXCEPTION->state = 17; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 't': ++ { ++ switch ( LA(2) ) ++ { ++ case 'o': ++ { ++ switch ( LA(3) ) ++ { ++ case 'd': ++ { ++ switch ( LA(4) ) ++ { ++ case 'a': ++ { ++ switch ( LA(5) ) ++ { ++ case 'y': ++ { ++ switch ( LA(6) ) ++ { ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'o': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ alt12=21;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ ++ default: ++ alt12=24;} ++ ++ } ++ break; ++ case '_': ++ case 'a': ++ case 'b': ++ case 'c': ++ case 'd': ++ case 'e': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'i': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'm': ++ case 'n': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 's': ++ case 't': ++ case 'u': ++ case 'v': ++ case 'w': ++ case 'x': ++ case 'y': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 12; ++ EXCEPTION->state = 18; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case '\n': ++ case '\r': ++ { ++ alt12=22; ++ } ++ break; ++ case '\t': ++ case ' ': ++ { ++ alt12=23; ++ } ++ break; ++ case 'c': ++ case 'f': ++ case 'g': ++ case 'h': ++ case 'j': ++ case 'k': ++ case 'l': ++ case 'n': ++ case 'p': ++ case 'q': ++ case 'r': ++ case 'u': ++ case 'v': ++ case 'x': ++ case 'z': ++ { ++ alt12=24; ++ } ++ break; ++ case '1': ++ case '2': ++ case '3': ++ case '4': ++ case '5': ++ case '6': ++ case '7': ++ case '8': ++ case '9': ++ { ++ switch ( LA(2) ) ++ { ++ case '0': ++ case '1': ++ case '2': ++ case '3': ++ case '4': ++ case '5': ++ case '6': ++ case '7': ++ case '8': ++ case '9': ++ { ++ switch ( LA(3) ) ++ { ++ case '0': ++ case '1': ++ case '2': ++ case '3': ++ case '4': ++ case '5': ++ case '6': ++ case '7': ++ case '8': ++ case '9': ++ { ++ switch ( LA(4) ) ++ { ++ case '0': ++ case '1': ++ case '2': ++ case '3': ++ case '4': ++ case '5': ++ case '6': ++ case '7': ++ case '8': ++ case '9': ++ { ++ switch ( LA(5) ) ++ { ++ case '-': ++ { ++ alt12=26; ++ } ++ break; ++ ++ default: ++ alt12=25;} ++ ++ } ++ break; ++ ++ default: ++ alt12=25;} ++ ++ } ++ break; ++ ++ default: ++ alt12=25;} ++ ++ } ++ break; ++ ++ default: ++ alt12=25;} ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 12; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ switch (alt12) ++ { ++ case 1: ++ // RSP.g:1:10: QUOTE ++ { ++ /* 1:10: QUOTE */ ++ mQUOTE(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 2: ++ // RSP.g:1:16: LPAR ++ { ++ /* 1:16: LPAR */ ++ mLPAR(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 3: ++ // RSP.g:1:21: RPAR ++ { ++ /* 1:21: RPAR */ ++ mRPAR(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 4: ++ // RSP.g:1:26: AND ++ { ++ /* 1:26: AND */ ++ mAND(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 5: ++ // RSP.g:1:30: OR ++ { ++ /* 1:30: OR */ ++ mOR(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 6: ++ // RSP.g:1:33: NOT ++ { ++ /* 1:33: NOT */ ++ mNOT(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 7: ++ // RSP.g:1:37: EQUAL ++ { ++ /* 1:37: EQUAL */ ++ mEQUAL(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 8: ++ // RSP.g:1:43: INCLUDES ++ { ++ /* 1:43: INCLUDES */ ++ mINCLUDES(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 9: ++ // RSP.g:1:52: STARTSW ++ { ++ /* 1:52: STARTSW */ ++ mSTARTSW(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 10: ++ // RSP.g:1:60: ENDSW ++ { ++ /* 1:60: ENDSW */ ++ mENDSW(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 11: ++ // RSP.g:1:66: GREATER ++ { ++ /* 1:66: GREATER */ ++ mGREATER(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 12: ++ // RSP.g:1:74: LESS ++ { ++ /* 1:74: LESS */ ++ mLESS(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 13: ++ // RSP.g:1:79: GTE ++ { ++ /* 1:79: GTE */ ++ mGTE(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 14: ++ // RSP.g:1:83: LTE ++ { ++ /* 1:83: LTE */ ++ mLTE(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 15: ++ // RSP.g:1:87: BEFORE ++ { ++ /* 1:87: BEFORE */ ++ mBEFORE(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 16: ++ // RSP.g:1:94: AFTER ++ { ++ /* 1:94: AFTER */ ++ mAFTER(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 17: ++ // RSP.g:1:100: DAY ++ { ++ /* 1:100: DAY */ ++ mDAY(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 18: ++ // RSP.g:1:104: WEEK ++ { ++ /* 1:104: WEEK */ ++ mWEEK(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 19: ++ // RSP.g:1:109: MONTH ++ { ++ /* 1:109: MONTH */ ++ mMONTH(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 20: ++ // RSP.g:1:115: YEAR ++ { ++ /* 1:115: YEAR */ ++ mYEAR(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 21: ++ // RSP.g:1:120: TODAY ++ { ++ /* 1:120: TODAY */ ++ mTODAY(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 22: ++ // RSP.g:1:126: NEWLINE ++ { ++ /* 1:126: NEWLINE */ ++ mNEWLINE(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 23: ++ // RSP.g:1:134: WS ++ { ++ /* 1:134: WS */ ++ mWS(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 24: ++ // RSP.g:1:137: FIELD ++ { ++ /* 1:137: FIELD */ ++ mFIELD(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 25: ++ // RSP.g:1:143: INT ++ { ++ /* 1:143: INT */ ++ mINT(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 26: ++ // RSP.g:1:147: DATE ++ { ++ /* 1:147: DATE */ ++ mDATE(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 27: ++ // RSP.g:1:152: STR ++ { ++ /* 1:152: STR */ ++ mSTR(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ ++ } ++ } ++ ++ ++ goto ruleTokensEx; /* Prevent compiler warnings */ ++ruleTokensEx: ; ++} ++ ++/* ========================================================================= ++ * Lexer matching rules end. ++ * ========================================================================= ++ */ ++/* End of Lexer code ++ * ================================================ ++ * ================================================ ++ */ ++ ++ ++/* End of code ++ * ============================================================================= ++ */ +diff --git a/src/pregen/RSPLexer.h b/src/pregen/RSPLexer.h +new file mode 100644 +index 0000000..27bc791 +--- /dev/null ++++ b/src/pregen/RSPLexer.h +@@ -0,0 +1,254 @@ ++/** \file ++ * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : RSP.g ++ * - On : 2016-01-01 12:23:42 ++ * - for the lexer : RSPLexerLexer * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++ * The lexer RSPLexer has the callable functions (rules) shown below, ++ * which will invoke the code for the associated rule in the source grammar ++ * assuming that the input stream is pointing to a token/text stream that could begin ++ * this rule. ++ * ++ * For instance if you call the first (topmost) rule in a parser grammar, you will ++ * get the results of a full parse, but calling a rule half way through the grammar will ++ * allow you to pass part of a full token stream to the parser, such as for syntax checking ++ * in editors and so on. ++ * ++ * The parser entry points are called indirectly (by function pointer to function) via ++ * a parser context typedef pRSPLexer, which is returned from a call to RSPLexerNew(). ++ * ++ * As this is a generated lexer, it is unlikely you will call it 'manually'. However ++ * the methods are provided anyway. ++ * * The methods in pRSPLexer are as follows: ++ * ++ * - void pRSPLexer->QUOTE(pRSPLexer) ++ * - void pRSPLexer->LPAR(pRSPLexer) ++ * - void pRSPLexer->RPAR(pRSPLexer) ++ * - void pRSPLexer->AND(pRSPLexer) ++ * - void pRSPLexer->OR(pRSPLexer) ++ * - void pRSPLexer->NOT(pRSPLexer) ++ * - void pRSPLexer->EQUAL(pRSPLexer) ++ * - void pRSPLexer->INCLUDES(pRSPLexer) ++ * - void pRSPLexer->STARTSW(pRSPLexer) ++ * - void pRSPLexer->ENDSW(pRSPLexer) ++ * - void pRSPLexer->GREATER(pRSPLexer) ++ * - void pRSPLexer->LESS(pRSPLexer) ++ * - void pRSPLexer->GTE(pRSPLexer) ++ * - void pRSPLexer->LTE(pRSPLexer) ++ * - void pRSPLexer->BEFORE(pRSPLexer) ++ * - void pRSPLexer->AFTER(pRSPLexer) ++ * - void pRSPLexer->DAY(pRSPLexer) ++ * - void pRSPLexer->WEEK(pRSPLexer) ++ * - void pRSPLexer->MONTH(pRSPLexer) ++ * - void pRSPLexer->YEAR(pRSPLexer) ++ * - void pRSPLexer->TODAY(pRSPLexer) ++ * - void pRSPLexer->NEWLINE(pRSPLexer) ++ * - void pRSPLexer->WS(pRSPLexer) ++ * - void pRSPLexer->FIELD(pRSPLexer) ++ * - void pRSPLexer->INT(pRSPLexer) ++ * - void pRSPLexer->DATE(pRSPLexer) ++ * - void pRSPLexer->STR(pRSPLexer) ++ * - void pRSPLexer->ESCAPED(pRSPLexer) ++ * - void pRSPLexer->DIGIT09(pRSPLexer) ++ * - void pRSPLexer->DIGIT19(pRSPLexer) ++ * - void pRSPLexer->Tokens(pRSPLexer) ++ * ++ * The return type for any particular rule is of course determined by the source ++ * grammar file. ++ */ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++#ifndef _RSPLexer_H ++#define _RSPLexer_H ++/* ============================================================================= ++ * Standard antlr3 C runtime definitions ++ */ ++#include ++ ++/* End of standard antlr 3 runtime definitions ++ * ============================================================================= ++ */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++// Forward declare the context typedef so that we can use it before it is ++// properly defined. Delegators and delegates (from import statements) are ++// interdependent and their context structures contain pointers to each other ++// C only allows such things to be declared if you pre-declare the typedef. ++// ++typedef struct RSPLexer_Ctx_struct RSPLexer, * pRSPLexer; ++ ++ ++ ++#ifdef ANTLR3_WINDOWS ++// Disable: Unreferenced parameter, - Rules with parameters that are not used ++// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually) ++// initialized but unused variable - tree rewrite variables declared but not needed ++// Unreferenced local variable - lexer rule declares but does not always use _type ++// potentially unitialized variable used - retval always returned from a rule ++// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns ++// ++// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at ++// and the codegen must generate some of these warnings by necessity, apart from 4100, which is ++// usually generated when a parser rule is given a parameter that it does not use. Mostly though ++// this is a matter of orthogonality hence I disable that one. ++// ++#pragma warning( disable : 4100 ) ++#pragma warning( disable : 4101 ) ++#pragma warning( disable : 4127 ) ++#pragma warning( disable : 4189 ) ++#pragma warning( disable : 4505 ) ++#pragma warning( disable : 4701 ) ++#endif ++ ++/** Context tracking structure for RSPLexer ++ */ ++struct RSPLexer_Ctx_struct ++{ ++ /** Built in ANTLR3 context tracker contains all the generic elements ++ * required for context tracking. ++ */ ++ pANTLR3_LEXER pLexer; ++ ++ ++ void (*mQUOTE) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mLPAR) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mRPAR) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mAND) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mOR) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mNOT) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mEQUAL) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mINCLUDES) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mSTARTSW) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mENDSW) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mGREATER) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mLESS) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mGTE) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mLTE) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mBEFORE) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mAFTER) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mDAY) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mWEEK) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mMONTH) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mYEAR) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mTODAY) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mNEWLINE) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mWS) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mFIELD) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mINT) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mDATE) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mSTR) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mESCAPED) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mDIGIT09) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mDIGIT19) (struct RSPLexer_Ctx_struct * ctx); ++ void (*mTokens) (struct RSPLexer_Ctx_struct * ctx); const char * (*getGrammarFileName)(); ++ void (*free) (struct RSPLexer_Ctx_struct * ctx); ++ ++}; ++ ++// Function protoypes for the constructor functions that external translation units ++// such as delegators and delegates may wish to call. ++// ++ANTLR3_API pRSPLexer RSPLexerNew (pANTLR3_INPUT_STREAM instream); ++ANTLR3_API pRSPLexer RSPLexerNewSSD (pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state); ++ ++/** Symbolic definitions of all the tokens that the lexer will work with. ++ * \{ ++ * ++ * Antlr will define EOF, but we can't use that as it it is too common in ++ * in C header files and that would be confusing. There is no way to filter this out at the moment ++ * so we just undef it here for now. That isn't the value we get back from C recognizers ++ * anyway. We are looking for ANTLR3_TOKEN_EOF. ++ */ ++#ifdef EOF ++#undef EOF ++#endif ++#ifdef Tokens ++#undef Tokens ++#endif ++#define STARTSW 14 ++#define WEEK 26 ++#define TODAY 24 ++#define YEAR 28 ++#define ENDSW 15 ++#define GTE 20 ++#define BEFORE 21 ++#define DAY 25 ++#define INT 16 ++#define NOT 11 ++#define AFTER 22 ++#define AND 6 ++#define EOF -1 ++#define LTE 19 ++#define MONTH 27 ++#define DIGIT19 31 ++#define INCLUDES 13 ++#define STR 10 ++#define QUOTE 29 ++#define GREATER 18 ++#define WS 30 ++#define LPAR 7 ++#define NEWLINE 4 ++#define EQUAL 12 ++#define OR 5 ++#define LESS 17 ++#define FIELD 9 ++#define RPAR 8 ++#define ESCAPED 33 ++#define DATE 23 ++#define DIGIT09 32 ++#ifdef EOF ++#undef EOF ++#define EOF ANTLR3_TOKEN_EOF ++#endif ++ ++#ifndef TOKENSOURCE ++#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource ++#endif ++ ++/* End of token definitions for RSPLexer ++ * ============================================================================= ++ */ ++/** \} */ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif ++ ++/* END - Note:Keep extra line feed to satisfy UNIX systems */ +diff --git a/src/pregen/RSPParser.c b/src/pregen/RSPParser.c +new file mode 100644 +index 0000000..ba8a9d2 +--- /dev/null ++++ b/src/pregen/RSPParser.c +@@ -0,0 +1,3152 @@ ++/** \file ++ * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : RSP.g ++ * - On : 2016-01-01 12:23:42 ++ * - for the parser : RSPParserParser * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++*/ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++/* ----------------------------------------- ++ * Include the ANTLR3 generated header file. ++ */ ++#include "RSPParser.h" ++/* ----------------------------------------- */ ++ ++ ++ ++ ++ ++/* MACROS that hide the C interface implementations from the ++ * generated code, which makes it a little more understandable to the human eye. ++ * I am very much against using C pre-processor macros for function calls and bits ++ * of code as you cannot see what is happening when single stepping in debuggers ++ * and so on. The exception (in my book at least) is for generated code, where you are ++ * not maintaining it, but may wish to read and understand it. If you single step it, you know that input() ++ * hides some indirect calls, but is always referring to the input stream. This is ++ * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig ++ * the runtime interfaces without changing the generated code too often, without ++ * confusing the reader of the generated output, who may not wish to know the gory ++ * details of the interface inheritance. ++ */ ++ ++#define CTX ctx ++ ++/* Aids in accessing scopes for grammar programmers ++ */ ++#undef SCOPE_TYPE ++#undef SCOPE_STACK ++#undef SCOPE_TOP ++#define SCOPE_TYPE(scope) pRSPParser_##scope##_SCOPE ++#define SCOPE_STACK(scope) pRSPParser_##scope##Stack ++#define SCOPE_TOP(scope) ctx->pRSPParser_##scope##Top ++#define SCOPE_SIZE(scope) ctx->pRSPParser_##scope##Stack_limit ++#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i)) ++ ++/* Macros for accessing things in the parser ++ */ ++ ++#undef PARSER ++#undef RECOGNIZER ++#undef HAVEPARSEDRULE ++#undef MEMOIZE ++#undef INPUT ++#undef STRSTREAM ++#undef HASEXCEPTION ++#undef EXCEPTION ++#undef MATCHT ++#undef MATCHANYT ++#undef FOLLOWSTACK ++#undef FOLLOWPUSH ++#undef FOLLOWPOP ++#undef PRECOVER ++#undef PREPORTERROR ++#undef LA ++#undef LT ++#undef CONSTRUCTEX ++#undef CONSUME ++#undef MARK ++#undef REWIND ++#undef REWINDLAST ++#undef PERRORRECOVERY ++#undef HASFAILED ++#undef FAILEDFLAG ++#undef RECOVERFROMMISMATCHEDSET ++#undef RECOVERFROMMISMATCHEDELEMENT ++#undef INDEX ++#undef ADAPTOR ++#undef SEEK ++#undef RULEMEMO ++#undef DBG ++ ++#define PARSER ctx->pParser ++#define RECOGNIZER PARSER->rec ++#define PSRSTATE RECOGNIZER->state ++#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r) ++#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si) ++#define INPUT PARSER->tstream ++#define STRSTREAM INPUT ++#define ISTREAM INPUT->istream ++#define INDEX() ISTREAM->index(INPUT->istream) ++#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE) ++#define EXCEPTION PSRSTATE->exception ++#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs) ++#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER) ++#define FOLLOWSTACK PSRSTATE->following ++#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL) ++#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK) ++#define PRECOVER() RECOGNIZER->recover(RECOGNIZER) ++#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER) ++#define LA(n) INPUT->istream->_LA(ISTREAM, n) ++#define LT(n) INPUT->_LT(INPUT, n) ++#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER) ++#define CONSUME() ISTREAM->consume(ISTREAM) ++#define MARK() ISTREAM->mark(ISTREAM) ++#define REWIND(m) ISTREAM->rewind(ISTREAM, m) ++#define REWINDLAST() ISTREAM->rewindLast(ISTREAM) ++#define SEEK(n) ISTREAM->seek(ISTREAM, n) ++#define PERRORRECOVERY PSRSTATE->errorRecovery ++#define FAILEDFLAG PSRSTATE->failed ++#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE) ++#define BACKTRACKING PSRSTATE->backtracking ++#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s) ++#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s) ++#define ADAPTOR ctx->adaptor ++#define RULEMEMO PSRSTATE->ruleMemo ++#define DBG RECOGNIZER->debugger ++ ++#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt ++ ++/* The 4 tokens defined below may well clash with your own #defines or token types. If so ++ * then for the present you must use different names for your defines as these are hard coded ++ * in the code generator. It would be better not to use such names internally, and maybe ++ * we can change this in a forthcoming release. I deliberately do not #undef these ++ * here as this will at least give you a redefined error somewhere if they clash. ++ */ ++#define UP ANTLR3_TOKEN_UP ++#define DOWN ANTLR3_TOKEN_DOWN ++#define EOR ANTLR3_TOKEN_EOR ++#define INVALID ANTLR3_TOKEN_INVALID ++ ++ ++/* ============================================================================= ++ * Functions to create and destroy scopes. First come the rule scopes, followed ++ * by the global declared scopes. ++ */ ++ ++ ++ ++/* ============================================================================= */ ++ ++/* ============================================================================= ++ * Start of recognizer ++ */ ++ ++ ++ ++/** \brief Table of all token names in symbolic order, mainly used for ++ * error reporting. ++ */ ++pANTLR3_UINT8 RSPParserTokenNames[30+4] ++ = { ++ (pANTLR3_UINT8) "", /* String to print to indicate an invalid token */ ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "NEWLINE", ++ (pANTLR3_UINT8) "OR", ++ (pANTLR3_UINT8) "AND", ++ (pANTLR3_UINT8) "LPAR", ++ (pANTLR3_UINT8) "RPAR", ++ (pANTLR3_UINT8) "FIELD", ++ (pANTLR3_UINT8) "STR", ++ (pANTLR3_UINT8) "NOT", ++ (pANTLR3_UINT8) "EQUAL", ++ (pANTLR3_UINT8) "INCLUDES", ++ (pANTLR3_UINT8) "STARTSW", ++ (pANTLR3_UINT8) "ENDSW", ++ (pANTLR3_UINT8) "INT", ++ (pANTLR3_UINT8) "LESS", ++ (pANTLR3_UINT8) "GREATER", ++ (pANTLR3_UINT8) "LTE", ++ (pANTLR3_UINT8) "GTE", ++ (pANTLR3_UINT8) "BEFORE", ++ (pANTLR3_UINT8) "AFTER", ++ (pANTLR3_UINT8) "DATE", ++ (pANTLR3_UINT8) "TODAY", ++ (pANTLR3_UINT8) "DAY", ++ (pANTLR3_UINT8) "WEEK", ++ (pANTLR3_UINT8) "MONTH", ++ (pANTLR3_UINT8) "YEAR", ++ (pANTLR3_UINT8) "QUOTE", ++ (pANTLR3_UINT8) "WS", ++ (pANTLR3_UINT8) "DIGIT19", ++ (pANTLR3_UINT8) "DIGIT09", ++ (pANTLR3_UINT8) "ESCAPED" ++ }; ++ ++ ++ ++// Forward declare the locally static matching functions we have generated. ++// ++static RSPParser_query_return query (pRSPParser ctx); ++static RSPParser_expr_return expr (pRSPParser ctx); ++static RSPParser_aexpr_return aexpr (pRSPParser ctx); ++static RSPParser_crit_return crit (pRSPParser ctx); ++static RSPParser_strcrit_return strcrit (pRSPParser ctx); ++static RSPParser_strop_return strop (pRSPParser ctx); ++static RSPParser_intcrit_return intcrit (pRSPParser ctx); ++static RSPParser_intop_return intop (pRSPParser ctx); ++static RSPParser_datecrit_return datecrit (pRSPParser ctx); ++static RSPParser_dateop_return dateop (pRSPParser ctx); ++static RSPParser_datespec_return datespec (pRSPParser ctx); ++static RSPParser_dateref_return dateref (pRSPParser ctx); ++static RSPParser_dateintval_return dateintval (pRSPParser ctx); ++static void RSPParserFree(pRSPParser ctx); ++/* For use in tree output where we are accumulating rule labels via label += ruleRef ++ * we need a function that knows how to free a return scope when the list is destroyed. ++ * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro. ++ */ ++static void ANTLR3_CDECL freeScope(void * scope) ++{ ++ ANTLR3_FREE(scope); ++} ++ ++/** \brief Name of the grammar file that generated this code ++ */ ++static const char fileName[] = "RSP.g"; ++ ++/** \brief Return the name of the grammar file that generated this code. ++ */ ++static const char * getGrammarFileName() ++{ ++ return fileName; ++} ++/** \brief Create a new RSPParser parser and return a context for it. ++ * ++ * \param[in] instream Pointer to an input stream interface. ++ * ++ * \return Pointer to new parser context upon success. ++ */ ++ANTLR3_API pRSPParser ++RSPParserNew (pANTLR3_COMMON_TOKEN_STREAM instream) ++{ ++ // See if we can create a new parser with the standard constructor ++ // ++ return RSPParserNewSSD(instream, NULL); ++} ++ ++/** \brief Create a new RSPParser parser and return a context for it. ++ * ++ * \param[in] instream Pointer to an input stream interface. ++ * ++ * \return Pointer to new parser context upon success. ++ */ ++ANTLR3_API pRSPParser ++RSPParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state) ++{ ++ pRSPParser ctx; /* Context structure we will build and return */ ++ ++ ctx = (pRSPParser) ANTLR3_CALLOC(1, sizeof(RSPParser)); ++ ++ if (ctx == NULL) ++ { ++ // Failed to allocate memory for parser context ++ // ++ return NULL; ++ } ++ ++ /* ------------------------------------------------------------------- ++ * Memory for basic structure is allocated, now to fill in ++ * the base ANTLR3 structures. We initialize the function pointers ++ * for the standard ANTLR3 parser function set, but upon return ++ * from here, the programmer may set the pointers to provide custom ++ * implementations of each function. ++ * ++ * We don't use the macros defined in RSPParser.h here, in order that you can get a sense ++ * of what goes where. ++ */ ++ ++ /* Create a base parser/recognizer, using the supplied token stream ++ */ ++ ctx->pParser = antlr3ParserNewStream(ANTLR3_SIZE_HINT, instream->tstream, state); ++ /* Install the implementation of our RSPParser interface ++ */ ++ ctx->query = query; ++ ctx->expr = expr; ++ ctx->aexpr = aexpr; ++ ctx->crit = crit; ++ ctx->strcrit = strcrit; ++ ctx->strop = strop; ++ ctx->intcrit = intcrit; ++ ctx->intop = intop; ++ ctx->datecrit = datecrit; ++ ctx->dateop = dateop; ++ ctx->datespec = datespec; ++ ctx->dateref = dateref; ++ ctx->dateintval = dateintval; ++ ctx->free = RSPParserFree; ++ ctx->getGrammarFileName = getGrammarFileName; ++ ++ /* Install the scope pushing methods. ++ */ ++ ADAPTOR = ANTLR3_TREE_ADAPTORNew(instream->tstream->tokenSource->strFactory); ++ ctx->vectors = antlr3VectorFactoryNew(0); ++ ++ ++ ++ /* Install the token table ++ */ ++ PSRSTATE->tokenNames = RSPParserTokenNames; ++ ++ ++ /* Return the newly built parser to the caller ++ */ ++ return ctx; ++} ++ ++/** Free the parser resources ++ */ ++ static void ++ RSPParserFree(pRSPParser ctx) ++ { ++ /* Free any scope memory ++ */ ++ ++ ctx->vectors->close(ctx->vectors); ++ /* We created the adaptor so we must free it ++ */ ++ ADAPTOR->free(ADAPTOR); ++ // Free this parser ++ // ++ ctx->pParser->free(ctx->pParser); ++ ANTLR3_FREE(ctx); ++ ++ /* Everything is released, so we can return ++ */ ++ return; ++ } ++ ++/** Return token names used by this parser ++ * ++ * The returned pointer is used as an index into the token names table (using the token ++ * number as the index). ++ * ++ * \return Pointer to first char * in the table. ++ */ ++static pANTLR3_UINT8 *getTokenNames() ++{ ++ return RSPParserTokenNames; ++} ++ ++ ++/* Declare the bitsets ++ */ ++ ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_query42 */ ++static ANTLR3_BITWORD FOLLOW_expr_in_query42_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) }; ++static ANTLR3_BITSET_LIST FOLLOW_expr_in_query42 = { FOLLOW_expr_in_query42_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_NEWLINE_in_query44 */ ++static ANTLR3_BITWORD FOLLOW_NEWLINE_in_query44_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000000) }; ++static ANTLR3_BITSET_LIST FOLLOW_NEWLINE_in_query44 = { FOLLOW_NEWLINE_in_query44_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_EOF_in_query47 */ ++static ANTLR3_BITWORD FOLLOW_EOF_in_query47_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_EOF_in_query47 = { FOLLOW_EOF_in_query47_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expr63 */ ++static ANTLR3_BITWORD FOLLOW_aexpr_in_expr63_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) }; ++static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expr63 = { FOLLOW_aexpr_in_expr63_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_OR_in_expr66 */ ++static ANTLR3_BITWORD FOLLOW_OR_in_expr66_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) }; ++static ANTLR3_BITSET_LIST FOLLOW_OR_in_expr66 = { FOLLOW_OR_in_expr66_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expr69 */ ++static ANTLR3_BITWORD FOLLOW_aexpr_in_expr69_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) }; ++static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expr69 = { FOLLOW_aexpr_in_expr69_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_aexpr81 */ ++static ANTLR3_BITWORD FOLLOW_crit_in_aexpr81_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) }; ++static ANTLR3_BITSET_LIST FOLLOW_crit_in_aexpr81 = { FOLLOW_crit_in_aexpr81_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AND_in_aexpr84 */ ++static ANTLR3_BITWORD FOLLOW_AND_in_aexpr84_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) }; ++static ANTLR3_BITSET_LIST FOLLOW_AND_in_aexpr84 = { FOLLOW_AND_in_aexpr84_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_aexpr87 */ ++static ANTLR3_BITWORD FOLLOW_crit_in_aexpr87_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) }; ++static ANTLR3_BITSET_LIST FOLLOW_crit_in_aexpr87 = { FOLLOW_crit_in_aexpr87_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_LPAR_in_crit99 */ ++static ANTLR3_BITWORD FOLLOW_LPAR_in_crit99_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000280) }; ++static ANTLR3_BITSET_LIST FOLLOW_LPAR_in_crit99 = { FOLLOW_LPAR_in_crit99_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expr_in_crit101 */ ++static ANTLR3_BITWORD FOLLOW_expr_in_crit101_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000100) }; ++static ANTLR3_BITSET_LIST FOLLOW_expr_in_crit101 = { FOLLOW_expr_in_crit101_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_RPAR_in_crit103 */ ++static ANTLR3_BITWORD FOLLOW_RPAR_in_crit103_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_RPAR_in_crit103 = { FOLLOW_RPAR_in_crit103_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_strcrit_in_crit114 */ ++static ANTLR3_BITWORD FOLLOW_strcrit_in_crit114_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_strcrit_in_crit114 = { FOLLOW_strcrit_in_crit114_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_intcrit_in_crit119 */ ++static ANTLR3_BITWORD FOLLOW_intcrit_in_crit119_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_intcrit_in_crit119 = { FOLLOW_intcrit_in_crit119_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_datecrit_in_crit124 */ ++static ANTLR3_BITWORD FOLLOW_datecrit_in_crit124_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_datecrit_in_crit124 = { FOLLOW_datecrit_in_crit124_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_strcrit134 */ ++static ANTLR3_BITWORD FOLLOW_FIELD_in_strcrit134_bits[] = { ANTLR3_UINT64_LIT(0x000000000000F000) }; ++static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_strcrit134 = { FOLLOW_FIELD_in_strcrit134_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_strop_in_strcrit136 */ ++static ANTLR3_BITWORD FOLLOW_strop_in_strcrit136_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000400) }; ++static ANTLR3_BITSET_LIST FOLLOW_strop_in_strcrit136 = { FOLLOW_strop_in_strcrit136_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_strcrit138 */ ++static ANTLR3_BITWORD FOLLOW_STR_in_strcrit138_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_STR_in_strcrit138 = { FOLLOW_STR_in_strcrit138_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_strcrit155 */ ++static ANTLR3_BITWORD FOLLOW_FIELD_in_strcrit155_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000800) }; ++static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_strcrit155 = { FOLLOW_FIELD_in_strcrit155_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_strcrit157 */ ++static ANTLR3_BITWORD FOLLOW_NOT_in_strcrit157_bits[] = { ANTLR3_UINT64_LIT(0x000000000000F000) }; ++static ANTLR3_BITSET_LIST FOLLOW_NOT_in_strcrit157 = { FOLLOW_NOT_in_strcrit157_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_strop_in_strcrit159 */ ++static ANTLR3_BITWORD FOLLOW_strop_in_strcrit159_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000400) }; ++static ANTLR3_BITSET_LIST FOLLOW_strop_in_strcrit159 = { FOLLOW_strop_in_strcrit159_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_strcrit161 */ ++static ANTLR3_BITWORD FOLLOW_STR_in_strcrit161_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_STR_in_strcrit161 = { FOLLOW_STR_in_strcrit161_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_EQUAL_in_strop188 */ ++static ANTLR3_BITWORD FOLLOW_EQUAL_in_strop188_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_EQUAL_in_strop188 = { FOLLOW_EQUAL_in_strop188_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INCLUDES_in_strop195 */ ++static ANTLR3_BITWORD FOLLOW_INCLUDES_in_strop195_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_INCLUDES_in_strop195 = { FOLLOW_INCLUDES_in_strop195_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STARTSW_in_strop202 */ ++static ANTLR3_BITWORD FOLLOW_STARTSW_in_strop202_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_STARTSW_in_strop202 = { FOLLOW_STARTSW_in_strop202_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENDSW_in_strop209 */ ++static ANTLR3_BITWORD FOLLOW_ENDSW_in_strop209_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_ENDSW_in_strop209 = { FOLLOW_ENDSW_in_strop209_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_intcrit219 */ ++static ANTLR3_BITWORD FOLLOW_FIELD_in_intcrit219_bits[] = { ANTLR3_UINT64_LIT(0x00000000001E1000) }; ++static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_intcrit219 = { FOLLOW_FIELD_in_intcrit219_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_intop_in_intcrit221 */ ++static ANTLR3_BITWORD FOLLOW_intop_in_intcrit221_bits[] = { ANTLR3_UINT64_LIT(0x0000000000010000) }; ++static ANTLR3_BITSET_LIST FOLLOW_intop_in_intcrit221 = { FOLLOW_intop_in_intcrit221_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_intcrit223 */ ++static ANTLR3_BITWORD FOLLOW_INT_in_intcrit223_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_INT_in_intcrit223 = { FOLLOW_INT_in_intcrit223_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_intcrit240 */ ++static ANTLR3_BITWORD FOLLOW_FIELD_in_intcrit240_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000800) }; ++static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_intcrit240 = { FOLLOW_FIELD_in_intcrit240_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_intcrit242 */ ++static ANTLR3_BITWORD FOLLOW_NOT_in_intcrit242_bits[] = { ANTLR3_UINT64_LIT(0x00000000001E1000) }; ++static ANTLR3_BITSET_LIST FOLLOW_NOT_in_intcrit242 = { FOLLOW_NOT_in_intcrit242_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_intop_in_intcrit244 */ ++static ANTLR3_BITWORD FOLLOW_intop_in_intcrit244_bits[] = { ANTLR3_UINT64_LIT(0x0000000000010000) }; ++static ANTLR3_BITSET_LIST FOLLOW_intop_in_intcrit244 = { FOLLOW_intop_in_intcrit244_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_intcrit246 */ ++static ANTLR3_BITWORD FOLLOW_INT_in_intcrit246_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_INT_in_intcrit246 = { FOLLOW_INT_in_intcrit246_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_EQUAL_in_intop273 */ ++static ANTLR3_BITWORD FOLLOW_EQUAL_in_intop273_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_EQUAL_in_intop273 = { FOLLOW_EQUAL_in_intop273_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_LESS_in_intop280 */ ++static ANTLR3_BITWORD FOLLOW_LESS_in_intop280_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_LESS_in_intop280 = { FOLLOW_LESS_in_intop280_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_GREATER_in_intop287 */ ++static ANTLR3_BITWORD FOLLOW_GREATER_in_intop287_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_GREATER_in_intop287 = { FOLLOW_GREATER_in_intop287_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_LTE_in_intop294 */ ++static ANTLR3_BITWORD FOLLOW_LTE_in_intop294_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_LTE_in_intop294 = { FOLLOW_LTE_in_intop294_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_GTE_in_intop301 */ ++static ANTLR3_BITWORD FOLLOW_GTE_in_intop301_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_GTE_in_intop301 = { FOLLOW_GTE_in_intop301_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_FIELD_in_datecrit310 */ ++static ANTLR3_BITWORD FOLLOW_FIELD_in_datecrit310_bits[] = { ANTLR3_UINT64_LIT(0x0000000000600000) }; ++static ANTLR3_BITSET_LIST FOLLOW_FIELD_in_datecrit310 = { FOLLOW_FIELD_in_datecrit310_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateop_in_datecrit312 */ ++static ANTLR3_BITWORD FOLLOW_dateop_in_datecrit312_bits[] = { ANTLR3_UINT64_LIT(0x0000000001810000) }; ++static ANTLR3_BITSET_LIST FOLLOW_dateop_in_datecrit312 = { FOLLOW_dateop_in_datecrit312_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_datespec_in_datecrit314 */ ++static ANTLR3_BITWORD FOLLOW_datespec_in_datecrit314_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_datespec_in_datecrit314 = { FOLLOW_datespec_in_datecrit314_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_dateop337 */ ++static ANTLR3_BITWORD FOLLOW_BEFORE_in_dateop337_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_dateop337 = { FOLLOW_BEFORE_in_dateop337_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_dateop344 */ ++static ANTLR3_BITWORD FOLLOW_AFTER_in_dateop344_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_dateop344 = { FOLLOW_AFTER_in_dateop344_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateref_in_datespec353 */ ++static ANTLR3_BITWORD FOLLOW_dateref_in_datespec353_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_dateref_in_datespec353 = { FOLLOW_dateref_in_datespec353_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_datespec358 */ ++static ANTLR3_BITWORD FOLLOW_INT_in_datespec358_bits[] = { ANTLR3_UINT64_LIT(0x000000001E000000) }; ++static ANTLR3_BITSET_LIST FOLLOW_INT_in_datespec358 = { FOLLOW_INT_in_datespec358_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateintval_in_datespec360 */ ++static ANTLR3_BITWORD FOLLOW_dateintval_in_datespec360_bits[] = { ANTLR3_UINT64_LIT(0x0000000000600000) }; ++static ANTLR3_BITSET_LIST FOLLOW_dateintval_in_datespec360 = { FOLLOW_dateintval_in_datespec360_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateop_in_datespec362 */ ++static ANTLR3_BITWORD FOLLOW_dateop_in_datespec362_bits[] = { ANTLR3_UINT64_LIT(0x0000000001800000) }; ++static ANTLR3_BITSET_LIST FOLLOW_dateop_in_datespec362 = { FOLLOW_dateop_in_datespec362_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateref_in_datespec364 */ ++static ANTLR3_BITWORD FOLLOW_dateref_in_datespec364_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_dateref_in_datespec364 = { FOLLOW_dateref_in_datespec364_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateref388 */ ++static ANTLR3_BITWORD FOLLOW_DATE_in_dateref388_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateref388 = { FOLLOW_DATE_in_dateref388_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_TODAY_in_dateref395 */ ++static ANTLR3_BITWORD FOLLOW_TODAY_in_dateref395_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_TODAY_in_dateref395 = { FOLLOW_TODAY_in_dateref395_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DAY_in_dateintval408 */ ++static ANTLR3_BITWORD FOLLOW_DAY_in_dateintval408_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_DAY_in_dateintval408 = { FOLLOW_DAY_in_dateintval408_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_WEEK_in_dateintval415 */ ++static ANTLR3_BITWORD FOLLOW_WEEK_in_dateintval415_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_WEEK_in_dateintval415 = { FOLLOW_WEEK_in_dateintval415_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_MONTH_in_dateintval422 */ ++static ANTLR3_BITWORD FOLLOW_MONTH_in_dateintval422_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_MONTH_in_dateintval422 = { FOLLOW_MONTH_in_dateintval422_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_YEAR_in_dateintval429 */ ++static ANTLR3_BITWORD FOLLOW_YEAR_in_dateintval429_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_YEAR_in_dateintval429 = { FOLLOW_YEAR_in_dateintval429_bits, 1 }; ++ ++ ++ ++ ++/* ============================================== ++ * Parsing rules ++ */ ++/** ++ * $ANTLR start query ++ * RSP.g:27:1: query : expr ( NEWLINE )? EOF -> expr ; ++ */ ++static RSPParser_query_return ++query(pRSPParser ctx) ++{ ++ RSPParser_query_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN NEWLINE2; ++ pANTLR3_COMMON_TOKEN EOF3; ++ RSPParser_expr_return expr1; ++ #undef RETURN_TYPE_expr1 ++ #define RETURN_TYPE_expr1 RSPParser_expr_return ++ ++ pANTLR3_BASE_TREE NEWLINE2_tree; ++ pANTLR3_BASE_TREE EOF3_tree; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NEWLINE; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_EOF; ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expr; ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ NEWLINE2 = NULL; ++ EOF3 = NULL; ++ expr1.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ NEWLINE2_tree = NULL; ++ EOF3_tree = NULL; ++ ++ stream_NEWLINE = NULL; ++ #define CREATE_stream_NEWLINE if (stream_NEWLINE == NULL) {stream_NEWLINE = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NEWLINE"); } ++ stream_EOF = NULL; ++ #define CREATE_stream_EOF if (stream_EOF == NULL) {stream_EOF = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token EOF"); } ++ stream_expr = NULL; ++ #define CREATE_stream_expr if (stream_expr == NULL) {stream_expr = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expr"); } ++ ++ retval.tree = NULL; ++ { ++ // RSP.g:27:7: ( expr ( NEWLINE )? EOF -> expr ) ++ // RSP.g:27:9: expr ( NEWLINE )? EOF ++ { ++ FOLLOWPUSH(FOLLOW_expr_in_query42); ++ expr1=expr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto rulequeryEx; ++ } ++ ++ CREATE_stream_expr; stream_expr->add(stream_expr, expr1.tree, NULL); ++ ++ // RSP.g:27:14: ( NEWLINE )? ++ { ++ int alt1=2; ++ switch ( LA(1) ) ++ { ++ case NEWLINE: ++ { ++ alt1=1; ++ } ++ break; ++ } ++ ++ switch (alt1) ++ { ++ case 1: ++ // RSP.g:27:14: NEWLINE ++ { ++ NEWLINE2 = (pANTLR3_COMMON_TOKEN) MATCHT(NEWLINE, &FOLLOW_NEWLINE_in_query44); ++ if (HASEXCEPTION()) ++ { ++ goto rulequeryEx; ++ } ++ ++ CREATE_stream_NEWLINE; stream_NEWLINE->add(stream_NEWLINE, NEWLINE2, NULL); ++ ++ ++ } ++ break; ++ ++ } ++ } ++ EOF3 = (pANTLR3_COMMON_TOKEN) MATCHT(EOF, &FOLLOW_EOF_in_query47); ++ if (HASEXCEPTION()) ++ { ++ goto rulequeryEx; ++ } ++ ++ CREATE_stream_EOF; stream_EOF->add(stream_EOF, EOF3, NULL); ++ ++ ++ ++ /* AST REWRITE ++ * elements : expr ++ * token labels : ++ * rule labels : retval ++ * token list labels : ++ * rule list labels : ++ */ ++ { ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval; ++ ++ stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL); ++ ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ retval.tree = root_0; ++ // 27:28: -> expr ++ { ++ ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr)); ++ ++ } ++ ++ retval.tree = root_0; // set result root ++ if (stream_retval != NULL) stream_retval->free(stream_retval); ++ ++ ++ } ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto rulequeryEx; /* Prevent compiler warnings */ ++ rulequeryEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ if (stream_NEWLINE != NULL) stream_NEWLINE->free(stream_NEWLINE); ++ if (stream_EOF != NULL) stream_EOF->free(stream_EOF); ++ if (stream_expr != NULL) stream_expr->free(stream_expr); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end query */ ++ ++/** ++ * $ANTLR start expr ++ * RSP.g:30:1: expr : aexpr ( OR aexpr )* ; ++ */ ++static RSPParser_expr_return ++expr(pRSPParser ctx) ++{ ++ RSPParser_expr_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN OR5; ++ RSPParser_aexpr_return aexpr4; ++ #undef RETURN_TYPE_aexpr4 ++ #define RETURN_TYPE_aexpr4 RSPParser_aexpr_return ++ ++ RSPParser_aexpr_return aexpr6; ++ #undef RETURN_TYPE_aexpr6 ++ #define RETURN_TYPE_aexpr6 RSPParser_aexpr_return ++ ++ pANTLR3_BASE_TREE OR5_tree; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ OR5 = NULL; ++ aexpr4.tree = NULL; ++ ++ aexpr6.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ OR5_tree = NULL; ++ ++ ++ retval.tree = NULL; ++ { ++ // RSP.g:30:6: ( aexpr ( OR aexpr )* ) ++ // RSP.g:30:8: aexpr ( OR aexpr )* ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ FOLLOWPUSH(FOLLOW_aexpr_in_expr63); ++ aexpr4=aexpr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, aexpr4.tree); ++ ++ // RSP.g:30:14: ( OR aexpr )* ++ ++ for (;;) ++ { ++ int alt2=2; ++ switch ( LA(1) ) ++ { ++ case OR: ++ { ++ alt2=1; ++ } ++ break; ++ ++ } ++ ++ switch (alt2) ++ { ++ case 1: ++ // RSP.g:30:15: OR aexpr ++ { ++ OR5 = (pANTLR3_COMMON_TOKEN) MATCHT(OR, &FOLLOW_OR_in_expr66); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ OR5_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OR5)); ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OR5_tree, root_0)); ++ ++ FOLLOWPUSH(FOLLOW_aexpr_in_expr69); ++ aexpr6=aexpr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexprEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, aexpr6.tree); ++ ++ } ++ break; ++ ++ default: ++ goto loop2; /* break out of the loop */ ++ break; ++ } ++ } ++ loop2: ; /* Jump out to here if this rule does not match */ ++ ++ ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleexprEx; /* Prevent compiler warnings */ ++ ruleexprEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end expr */ ++ ++/** ++ * $ANTLR start aexpr ++ * RSP.g:33:1: aexpr : crit ( AND crit )* ; ++ */ ++static RSPParser_aexpr_return ++aexpr(pRSPParser ctx) ++{ ++ RSPParser_aexpr_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN AND8; ++ RSPParser_crit_return crit7; ++ #undef RETURN_TYPE_crit7 ++ #define RETURN_TYPE_crit7 RSPParser_crit_return ++ ++ RSPParser_crit_return crit9; ++ #undef RETURN_TYPE_crit9 ++ #define RETURN_TYPE_crit9 RSPParser_crit_return ++ ++ pANTLR3_BASE_TREE AND8_tree; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ AND8 = NULL; ++ crit7.tree = NULL; ++ ++ crit9.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ AND8_tree = NULL; ++ ++ ++ retval.tree = NULL; ++ { ++ // RSP.g:33:7: ( crit ( AND crit )* ) ++ // RSP.g:33:9: crit ( AND crit )* ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ FOLLOWPUSH(FOLLOW_crit_in_aexpr81); ++ crit7=crit(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleaexprEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, crit7.tree); ++ ++ // RSP.g:33:14: ( AND crit )* ++ ++ for (;;) ++ { ++ int alt3=2; ++ switch ( LA(1) ) ++ { ++ case AND: ++ { ++ alt3=1; ++ } ++ break; ++ ++ } ++ ++ switch (alt3) ++ { ++ case 1: ++ // RSP.g:33:15: AND crit ++ { ++ AND8 = (pANTLR3_COMMON_TOKEN) MATCHT(AND, &FOLLOW_AND_in_aexpr84); ++ if (HASEXCEPTION()) ++ { ++ goto ruleaexprEx; ++ } ++ ++ AND8_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AND8)); ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, AND8_tree, root_0)); ++ ++ FOLLOWPUSH(FOLLOW_crit_in_aexpr87); ++ crit9=crit(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleaexprEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, crit9.tree); ++ ++ } ++ break; ++ ++ default: ++ goto loop3; /* break out of the loop */ ++ break; ++ } ++ } ++ loop3: ; /* Jump out to here if this rule does not match */ ++ ++ ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleaexprEx; /* Prevent compiler warnings */ ++ ruleaexprEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end aexpr */ ++ ++/** ++ * $ANTLR start crit ++ * RSP.g:36:1: crit : ( LPAR expr RPAR -> expr | strcrit | intcrit | datecrit ); ++ */ ++static RSPParser_crit_return ++crit(pRSPParser ctx) ++{ ++ RSPParser_crit_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN LPAR10; ++ pANTLR3_COMMON_TOKEN RPAR12; ++ RSPParser_expr_return expr11; ++ #undef RETURN_TYPE_expr11 ++ #define RETURN_TYPE_expr11 RSPParser_expr_return ++ ++ RSPParser_strcrit_return strcrit13; ++ #undef RETURN_TYPE_strcrit13 ++ #define RETURN_TYPE_strcrit13 RSPParser_strcrit_return ++ ++ RSPParser_intcrit_return intcrit14; ++ #undef RETURN_TYPE_intcrit14 ++ #define RETURN_TYPE_intcrit14 RSPParser_intcrit_return ++ ++ RSPParser_datecrit_return datecrit15; ++ #undef RETURN_TYPE_datecrit15 ++ #define RETURN_TYPE_datecrit15 RSPParser_datecrit_return ++ ++ pANTLR3_BASE_TREE LPAR10_tree; ++ pANTLR3_BASE_TREE RPAR12_tree; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_RPAR; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_LPAR; ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expr; ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ LPAR10 = NULL; ++ RPAR12 = NULL; ++ expr11.tree = NULL; ++ ++ strcrit13.tree = NULL; ++ ++ intcrit14.tree = NULL; ++ ++ datecrit15.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ LPAR10_tree = NULL; ++ RPAR12_tree = NULL; ++ ++ stream_RPAR = NULL; ++ #define CREATE_stream_RPAR if (stream_RPAR == NULL) {stream_RPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token RPAR"); } ++ stream_LPAR = NULL; ++ #define CREATE_stream_LPAR if (stream_LPAR == NULL) {stream_LPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token LPAR"); } ++ stream_expr = NULL; ++ #define CREATE_stream_expr if (stream_expr == NULL) {stream_expr = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expr"); } ++ ++ retval.tree = NULL; ++ { ++ { ++ // RSP.g:36:6: ( LPAR expr RPAR -> expr | strcrit | intcrit | datecrit ) ++ ++ ANTLR3_UINT32 alt4; ++ ++ alt4=4; ++ ++ switch ( LA(1) ) ++ { ++ case LPAR: ++ { ++ alt4=1; ++ } ++ break; ++ case FIELD: ++ { ++ switch ( LA(2) ) ++ { ++ case NOT: ++ { ++ switch ( LA(3) ) ++ { ++ case EQUAL: ++ { ++ switch ( LA(4) ) ++ { ++ case STR: ++ { ++ alt4=2; ++ } ++ break; ++ case INT: ++ { ++ alt4=3; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 4; ++ EXCEPTION->state = 8; ++ ++ ++ goto rulecritEx; ++ } ++ ++ } ++ break; ++ case LESS: ++ case GREATER: ++ case LTE: ++ case GTE: ++ { ++ alt4=3; ++ } ++ break; ++ case INCLUDES: ++ case STARTSW: ++ case ENDSW: ++ { ++ alt4=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 4; ++ EXCEPTION->state = 3; ++ ++ ++ goto rulecritEx; ++ } ++ ++ } ++ break; ++ case BEFORE: ++ case AFTER: ++ { ++ alt4=4; ++ } ++ break; ++ case EQUAL: ++ { ++ switch ( LA(3) ) ++ { ++ case INT: ++ { ++ alt4=3; ++ } ++ break; ++ case STR: ++ { ++ alt4=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 4; ++ EXCEPTION->state = 5; ++ ++ ++ goto rulecritEx; ++ } ++ ++ } ++ break; ++ case LESS: ++ case GREATER: ++ case LTE: ++ case GTE: ++ { ++ alt4=3; ++ } ++ break; ++ case INCLUDES: ++ case STARTSW: ++ case ENDSW: ++ { ++ alt4=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 4; ++ EXCEPTION->state = 2; ++ ++ ++ goto rulecritEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 4; ++ EXCEPTION->state = 0; ++ ++ ++ goto rulecritEx; ++ } ++ ++ switch (alt4) ++ { ++ case 1: ++ // RSP.g:36:8: LPAR expr RPAR ++ { ++ LPAR10 = (pANTLR3_COMMON_TOKEN) MATCHT(LPAR, &FOLLOW_LPAR_in_crit99); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ CREATE_stream_LPAR; stream_LPAR->add(stream_LPAR, LPAR10, NULL); ++ ++ FOLLOWPUSH(FOLLOW_expr_in_crit101); ++ expr11=expr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ CREATE_stream_expr; stream_expr->add(stream_expr, expr11.tree, NULL); ++ RPAR12 = (pANTLR3_COMMON_TOKEN) MATCHT(RPAR, &FOLLOW_RPAR_in_crit103); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ CREATE_stream_RPAR; stream_RPAR->add(stream_RPAR, RPAR12, NULL); ++ ++ ++ ++ /* AST REWRITE ++ * elements : expr ++ * token labels : ++ * rule labels : retval ++ * token list labels : ++ * rule list labels : ++ */ ++ { ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval; ++ ++ stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL); ++ ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ retval.tree = root_0; ++ // 36:25: -> expr ++ { ++ ADAPTOR->addChild(ADAPTOR, root_0, stream_expr == NULL ? NULL : stream_expr->nextTree(stream_expr)); ++ ++ } ++ ++ retval.tree = root_0; // set result root ++ if (stream_retval != NULL) stream_retval->free(stream_retval); ++ ++ ++ } ++ } ++ break; ++ case 2: ++ // RSP.g:37:4: strcrit ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ FOLLOWPUSH(FOLLOW_strcrit_in_crit114); ++ strcrit13=strcrit(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, strcrit13.tree); ++ ++ } ++ break; ++ case 3: ++ // RSP.g:38:4: intcrit ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ FOLLOWPUSH(FOLLOW_intcrit_in_crit119); ++ intcrit14=intcrit(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, intcrit14.tree); ++ ++ } ++ break; ++ case 4: ++ // RSP.g:39:4: datecrit ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ FOLLOWPUSH(FOLLOW_datecrit_in_crit124); ++ datecrit15=datecrit(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, datecrit15.tree); ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto rulecritEx; /* Prevent compiler warnings */ ++ rulecritEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ if (stream_RPAR != NULL) stream_RPAR->free(stream_RPAR); ++ if (stream_LPAR != NULL) stream_LPAR->free(stream_LPAR); ++ if (stream_expr != NULL) stream_expr->free(stream_expr); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end crit */ ++ ++/** ++ * $ANTLR start strcrit ++ * RSP.g:42:1: strcrit : ( FIELD strop STR -> ^( strop FIELD STR ) | FIELD NOT strop STR -> ^( NOT ^( strop FIELD STR ) ) ); ++ */ ++static RSPParser_strcrit_return ++strcrit(pRSPParser ctx) ++{ ++ RSPParser_strcrit_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN FIELD16; ++ pANTLR3_COMMON_TOKEN STR18; ++ pANTLR3_COMMON_TOKEN FIELD19; ++ pANTLR3_COMMON_TOKEN NOT20; ++ pANTLR3_COMMON_TOKEN STR22; ++ RSPParser_strop_return strop17; ++ #undef RETURN_TYPE_strop17 ++ #define RETURN_TYPE_strop17 RSPParser_strop_return ++ ++ RSPParser_strop_return strop21; ++ #undef RETURN_TYPE_strop21 ++ #define RETURN_TYPE_strop21 RSPParser_strop_return ++ ++ pANTLR3_BASE_TREE FIELD16_tree; ++ pANTLR3_BASE_TREE STR18_tree; ++ pANTLR3_BASE_TREE FIELD19_tree; ++ pANTLR3_BASE_TREE NOT20_tree; ++ pANTLR3_BASE_TREE STR22_tree; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_STR; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_FIELD; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NOT; ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_strop; ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ FIELD16 = NULL; ++ STR18 = NULL; ++ FIELD19 = NULL; ++ NOT20 = NULL; ++ STR22 = NULL; ++ strop17.tree = NULL; ++ ++ strop21.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ FIELD16_tree = NULL; ++ STR18_tree = NULL; ++ FIELD19_tree = NULL; ++ NOT20_tree = NULL; ++ STR22_tree = NULL; ++ ++ stream_STR = NULL; ++ #define CREATE_stream_STR if (stream_STR == NULL) {stream_STR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token STR"); } ++ stream_FIELD = NULL; ++ #define CREATE_stream_FIELD if (stream_FIELD == NULL) {stream_FIELD = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token FIELD"); } ++ stream_NOT = NULL; ++ #define CREATE_stream_NOT if (stream_NOT == NULL) {stream_NOT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NOT"); } ++ stream_strop = NULL; ++ #define CREATE_stream_strop if (stream_strop == NULL) {stream_strop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule strop"); } ++ ++ retval.tree = NULL; ++ { ++ { ++ // RSP.g:42:9: ( FIELD strop STR -> ^( strop FIELD STR ) | FIELD NOT strop STR -> ^( NOT ^( strop FIELD STR ) ) ) ++ ++ ANTLR3_UINT32 alt5; ++ ++ alt5=2; ++ ++ switch ( LA(1) ) ++ { ++ case FIELD: ++ { ++ switch ( LA(2) ) ++ { ++ case NOT: ++ { ++ alt5=2; ++ } ++ break; ++ case EQUAL: ++ case INCLUDES: ++ case STARTSW: ++ case ENDSW: ++ { ++ alt5=1; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 5; ++ EXCEPTION->state = 1; ++ ++ ++ goto rulestrcritEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 5; ++ EXCEPTION->state = 0; ++ ++ ++ goto rulestrcritEx; ++ } ++ ++ switch (alt5) ++ { ++ case 1: ++ // RSP.g:42:11: FIELD strop STR ++ { ++ FIELD16 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_strcrit134); ++ if (HASEXCEPTION()) ++ { ++ goto rulestrcritEx; ++ } ++ ++ CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD16, NULL); ++ ++ FOLLOWPUSH(FOLLOW_strop_in_strcrit136); ++ strop17=strop(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto rulestrcritEx; ++ } ++ ++ CREATE_stream_strop; stream_strop->add(stream_strop, strop17.tree, NULL); ++ STR18 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_strcrit138); ++ if (HASEXCEPTION()) ++ { ++ goto rulestrcritEx; ++ } ++ ++ CREATE_stream_STR; stream_STR->add(stream_STR, STR18, NULL); ++ ++ ++ ++ /* AST REWRITE ++ * elements : FIELD, STR, strop ++ * token labels : ++ * rule labels : retval ++ * token list labels : ++ * rule list labels : ++ */ ++ { ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval; ++ ++ stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL); ++ ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ retval.tree = root_0; ++ // 42:29: -> ^( strop FIELD STR ) ++ { ++ // RSP.g:42:32: ^( strop FIELD STR ) ++ { ++ pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_strop == NULL ? NULL : stream_strop->nextNode(stream_strop), root_1)); ++ ++ ADAPTOR->addChild(ADAPTOR, root_1, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD)); ++ ADAPTOR->addChild(ADAPTOR, root_1, stream_STR == NULL ? NULL : stream_STR->nextNode(stream_STR)); ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, root_1); ++ } ++ ++ } ++ ++ retval.tree = root_0; // set result root ++ if (stream_retval != NULL) stream_retval->free(stream_retval); ++ ++ ++ } ++ } ++ break; ++ case 2: ++ // RSP.g:43:4: FIELD NOT strop STR ++ { ++ FIELD19 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_strcrit155); ++ if (HASEXCEPTION()) ++ { ++ goto rulestrcritEx; ++ } ++ ++ CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD19, NULL); ++ ++ NOT20 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_strcrit157); ++ if (HASEXCEPTION()) ++ { ++ goto rulestrcritEx; ++ } ++ ++ CREATE_stream_NOT; stream_NOT->add(stream_NOT, NOT20, NULL); ++ ++ FOLLOWPUSH(FOLLOW_strop_in_strcrit159); ++ strop21=strop(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto rulestrcritEx; ++ } ++ ++ CREATE_stream_strop; stream_strop->add(stream_strop, strop21.tree, NULL); ++ STR22 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_strcrit161); ++ if (HASEXCEPTION()) ++ { ++ goto rulestrcritEx; ++ } ++ ++ CREATE_stream_STR; stream_STR->add(stream_STR, STR22, NULL); ++ ++ ++ ++ /* AST REWRITE ++ * elements : STR, FIELD, strop, NOT ++ * token labels : ++ * rule labels : retval ++ * token list labels : ++ * rule list labels : ++ */ ++ { ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval; ++ ++ stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL); ++ ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ retval.tree = root_0; ++ // 43:25: -> ^( NOT ^( strop FIELD STR ) ) ++ { ++ // RSP.g:43:28: ^( NOT ^( strop FIELD STR ) ) ++ { ++ pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_NOT == NULL ? NULL : stream_NOT->nextNode(stream_NOT), root_1)); ++ ++ // RSP.g:43:34: ^( strop FIELD STR ) ++ { ++ pANTLR3_BASE_TREE root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_strop == NULL ? NULL : stream_strop->nextNode(stream_strop), root_2)); ++ ++ ADAPTOR->addChild(ADAPTOR, root_2, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD)); ++ ADAPTOR->addChild(ADAPTOR, root_2, stream_STR == NULL ? NULL : stream_STR->nextNode(stream_STR)); ++ ++ ADAPTOR->addChild(ADAPTOR, root_1, root_2); ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, root_1); ++ } ++ ++ } ++ ++ retval.tree = root_0; // set result root ++ if (stream_retval != NULL) stream_retval->free(stream_retval); ++ ++ ++ } ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto rulestrcritEx; /* Prevent compiler warnings */ ++ rulestrcritEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ if (stream_STR != NULL) stream_STR->free(stream_STR); ++ if (stream_FIELD != NULL) stream_FIELD->free(stream_FIELD); ++ if (stream_NOT != NULL) stream_NOT->free(stream_NOT); ++ if (stream_strop != NULL) stream_strop->free(stream_strop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end strcrit */ ++ ++/** ++ * $ANTLR start strop ++ * RSP.g:46:1: strop : (equal= EQUAL | includes= INCLUDES | startsw= STARTSW | endsw= ENDSW ); ++ */ ++static RSPParser_strop_return ++strop(pRSPParser ctx) ++{ ++ RSPParser_strop_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN equal; ++ pANTLR3_COMMON_TOKEN includes; ++ pANTLR3_COMMON_TOKEN startsw; ++ pANTLR3_COMMON_TOKEN endsw; ++ ++ pANTLR3_BASE_TREE equal_tree; ++ pANTLR3_BASE_TREE includes_tree; ++ pANTLR3_BASE_TREE startsw_tree; ++ pANTLR3_BASE_TREE endsw_tree; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ equal = NULL; ++ includes = NULL; ++ startsw = NULL; ++ endsw = NULL; ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ equal_tree = NULL; ++ includes_tree = NULL; ++ startsw_tree = NULL; ++ endsw_tree = NULL; ++ ++ ++ retval.tree = NULL; ++ { ++ { ++ // RSP.g:46:7: (equal= EQUAL | includes= INCLUDES | startsw= STARTSW | endsw= ENDSW ) ++ ++ ANTLR3_UINT32 alt6; ++ ++ alt6=4; ++ ++ switch ( LA(1) ) ++ { ++ case EQUAL: ++ { ++ alt6=1; ++ } ++ break; ++ case INCLUDES: ++ { ++ alt6=2; ++ } ++ break; ++ case STARTSW: ++ { ++ alt6=3; ++ } ++ break; ++ case ENDSW: ++ { ++ alt6=4; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 6; ++ EXCEPTION->state = 0; ++ ++ ++ goto rulestropEx; ++ } ++ ++ switch (alt6) ++ { ++ case 1: ++ // RSP.g:46:9: equal= EQUAL ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ equal = (pANTLR3_COMMON_TOKEN) MATCHT(EQUAL, &FOLLOW_EQUAL_in_strop188); ++ if (HASEXCEPTION()) ++ { ++ goto rulestropEx; ++ } ++ ++ equal_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, equal)); ++ ADAPTOR->addChild(ADAPTOR, root_0, equal_tree); ++ ++ ++ } ++ break; ++ case 2: ++ // RSP.g:47:4: includes= INCLUDES ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ includes = (pANTLR3_COMMON_TOKEN) MATCHT(INCLUDES, &FOLLOW_INCLUDES_in_strop195); ++ if (HASEXCEPTION()) ++ { ++ goto rulestropEx; ++ } ++ ++ includes_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, includes)); ++ ADAPTOR->addChild(ADAPTOR, root_0, includes_tree); ++ ++ ++ } ++ break; ++ case 3: ++ // RSP.g:48:4: startsw= STARTSW ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ startsw = (pANTLR3_COMMON_TOKEN) MATCHT(STARTSW, &FOLLOW_STARTSW_in_strop202); ++ if (HASEXCEPTION()) ++ { ++ goto rulestropEx; ++ } ++ ++ startsw_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, startsw)); ++ ADAPTOR->addChild(ADAPTOR, root_0, startsw_tree); ++ ++ ++ } ++ break; ++ case 4: ++ // RSP.g:49:4: endsw= ENDSW ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ endsw = (pANTLR3_COMMON_TOKEN) MATCHT(ENDSW, &FOLLOW_ENDSW_in_strop209); ++ if (HASEXCEPTION()) ++ { ++ goto rulestropEx; ++ } ++ ++ endsw_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, endsw)); ++ ADAPTOR->addChild(ADAPTOR, root_0, endsw_tree); ++ ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto rulestropEx; /* Prevent compiler warnings */ ++ rulestropEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end strop */ ++ ++/** ++ * $ANTLR start intcrit ++ * RSP.g:52:1: intcrit : ( FIELD intop INT -> ^( intop FIELD INT ) | FIELD NOT intop INT -> ^( NOT ^( intop FIELD INT ) ) ); ++ */ ++static RSPParser_intcrit_return ++intcrit(pRSPParser ctx) ++{ ++ RSPParser_intcrit_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN FIELD23; ++ pANTLR3_COMMON_TOKEN INT25; ++ pANTLR3_COMMON_TOKEN FIELD26; ++ pANTLR3_COMMON_TOKEN NOT27; ++ pANTLR3_COMMON_TOKEN INT29; ++ RSPParser_intop_return intop24; ++ #undef RETURN_TYPE_intop24 ++ #define RETURN_TYPE_intop24 RSPParser_intop_return ++ ++ RSPParser_intop_return intop28; ++ #undef RETURN_TYPE_intop28 ++ #define RETURN_TYPE_intop28 RSPParser_intop_return ++ ++ pANTLR3_BASE_TREE FIELD23_tree; ++ pANTLR3_BASE_TREE INT25_tree; ++ pANTLR3_BASE_TREE FIELD26_tree; ++ pANTLR3_BASE_TREE NOT27_tree; ++ pANTLR3_BASE_TREE INT29_tree; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_FIELD; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_INT; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_NOT; ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_intop; ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ FIELD23 = NULL; ++ INT25 = NULL; ++ FIELD26 = NULL; ++ NOT27 = NULL; ++ INT29 = NULL; ++ intop24.tree = NULL; ++ ++ intop28.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ FIELD23_tree = NULL; ++ INT25_tree = NULL; ++ FIELD26_tree = NULL; ++ NOT27_tree = NULL; ++ INT29_tree = NULL; ++ ++ stream_FIELD = NULL; ++ #define CREATE_stream_FIELD if (stream_FIELD == NULL) {stream_FIELD = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token FIELD"); } ++ stream_INT = NULL; ++ #define CREATE_stream_INT if (stream_INT == NULL) {stream_INT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token INT"); } ++ stream_NOT = NULL; ++ #define CREATE_stream_NOT if (stream_NOT == NULL) {stream_NOT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token NOT"); } ++ stream_intop = NULL; ++ #define CREATE_stream_intop if (stream_intop == NULL) {stream_intop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule intop"); } ++ ++ retval.tree = NULL; ++ { ++ { ++ // RSP.g:52:9: ( FIELD intop INT -> ^( intop FIELD INT ) | FIELD NOT intop INT -> ^( NOT ^( intop FIELD INT ) ) ) ++ ++ ANTLR3_UINT32 alt7; ++ ++ alt7=2; ++ ++ switch ( LA(1) ) ++ { ++ case FIELD: ++ { ++ switch ( LA(2) ) ++ { ++ case NOT: ++ { ++ alt7=2; ++ } ++ break; ++ case EQUAL: ++ case LESS: ++ case GREATER: ++ case LTE: ++ case GTE: ++ { ++ alt7=1; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 7; ++ EXCEPTION->state = 1; ++ ++ ++ goto ruleintcritEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 7; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleintcritEx; ++ } ++ ++ switch (alt7) ++ { ++ case 1: ++ // RSP.g:52:11: FIELD intop INT ++ { ++ FIELD23 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_intcrit219); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintcritEx; ++ } ++ ++ CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD23, NULL); ++ ++ FOLLOWPUSH(FOLLOW_intop_in_intcrit221); ++ intop24=intop(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintcritEx; ++ } ++ ++ CREATE_stream_intop; stream_intop->add(stream_intop, intop24.tree, NULL); ++ INT25 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_intcrit223); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintcritEx; ++ } ++ ++ CREATE_stream_INT; stream_INT->add(stream_INT, INT25, NULL); ++ ++ ++ ++ /* AST REWRITE ++ * elements : FIELD, INT, intop ++ * token labels : ++ * rule labels : retval ++ * token list labels : ++ * rule list labels : ++ */ ++ { ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval; ++ ++ stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL); ++ ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ retval.tree = root_0; ++ // 52:29: -> ^( intop FIELD INT ) ++ { ++ // RSP.g:52:32: ^( intop FIELD INT ) ++ { ++ pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_intop == NULL ? NULL : stream_intop->nextNode(stream_intop), root_1)); ++ ++ ADAPTOR->addChild(ADAPTOR, root_1, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD)); ++ ADAPTOR->addChild(ADAPTOR, root_1, stream_INT == NULL ? NULL : stream_INT->nextNode(stream_INT)); ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, root_1); ++ } ++ ++ } ++ ++ retval.tree = root_0; // set result root ++ if (stream_retval != NULL) stream_retval->free(stream_retval); ++ ++ ++ } ++ } ++ break; ++ case 2: ++ // RSP.g:53:4: FIELD NOT intop INT ++ { ++ FIELD26 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_intcrit240); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintcritEx; ++ } ++ ++ CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD26, NULL); ++ ++ NOT27 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_intcrit242); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintcritEx; ++ } ++ ++ CREATE_stream_NOT; stream_NOT->add(stream_NOT, NOT27, NULL); ++ ++ FOLLOWPUSH(FOLLOW_intop_in_intcrit244); ++ intop28=intop(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintcritEx; ++ } ++ ++ CREATE_stream_intop; stream_intop->add(stream_intop, intop28.tree, NULL); ++ INT29 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_intcrit246); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintcritEx; ++ } ++ ++ CREATE_stream_INT; stream_INT->add(stream_INT, INT29, NULL); ++ ++ ++ ++ /* AST REWRITE ++ * elements : intop, NOT, INT, FIELD ++ * token labels : ++ * rule labels : retval ++ * token list labels : ++ * rule list labels : ++ */ ++ { ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval; ++ ++ stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL); ++ ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ retval.tree = root_0; ++ // 53:25: -> ^( NOT ^( intop FIELD INT ) ) ++ { ++ // RSP.g:53:28: ^( NOT ^( intop FIELD INT ) ) ++ { ++ pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_NOT == NULL ? NULL : stream_NOT->nextNode(stream_NOT), root_1)); ++ ++ // RSP.g:53:34: ^( intop FIELD INT ) ++ { ++ pANTLR3_BASE_TREE root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ root_2 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_intop == NULL ? NULL : stream_intop->nextNode(stream_intop), root_2)); ++ ++ ADAPTOR->addChild(ADAPTOR, root_2, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD)); ++ ADAPTOR->addChild(ADAPTOR, root_2, stream_INT == NULL ? NULL : stream_INT->nextNode(stream_INT)); ++ ++ ADAPTOR->addChild(ADAPTOR, root_1, root_2); ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, root_1); ++ } ++ ++ } ++ ++ retval.tree = root_0; // set result root ++ if (stream_retval != NULL) stream_retval->free(stream_retval); ++ ++ ++ } ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleintcritEx; /* Prevent compiler warnings */ ++ ruleintcritEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ if (stream_FIELD != NULL) stream_FIELD->free(stream_FIELD); ++ if (stream_INT != NULL) stream_INT->free(stream_INT); ++ if (stream_NOT != NULL) stream_NOT->free(stream_NOT); ++ if (stream_intop != NULL) stream_intop->free(stream_intop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end intcrit */ ++ ++/** ++ * $ANTLR start intop ++ * RSP.g:56:1: intop : (equal= EQUAL | less= LESS | greater= GREATER | lte= LTE | gte= GTE ); ++ */ ++static RSPParser_intop_return ++intop(pRSPParser ctx) ++{ ++ RSPParser_intop_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN equal; ++ pANTLR3_COMMON_TOKEN less; ++ pANTLR3_COMMON_TOKEN greater; ++ pANTLR3_COMMON_TOKEN lte; ++ pANTLR3_COMMON_TOKEN gte; ++ ++ pANTLR3_BASE_TREE equal_tree; ++ pANTLR3_BASE_TREE less_tree; ++ pANTLR3_BASE_TREE greater_tree; ++ pANTLR3_BASE_TREE lte_tree; ++ pANTLR3_BASE_TREE gte_tree; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ equal = NULL; ++ less = NULL; ++ greater = NULL; ++ lte = NULL; ++ gte = NULL; ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ equal_tree = NULL; ++ less_tree = NULL; ++ greater_tree = NULL; ++ lte_tree = NULL; ++ gte_tree = NULL; ++ ++ ++ retval.tree = NULL; ++ { ++ { ++ // RSP.g:56:7: (equal= EQUAL | less= LESS | greater= GREATER | lte= LTE | gte= GTE ) ++ ++ ANTLR3_UINT32 alt8; ++ ++ alt8=5; ++ ++ switch ( LA(1) ) ++ { ++ case EQUAL: ++ { ++ alt8=1; ++ } ++ break; ++ case LESS: ++ { ++ alt8=2; ++ } ++ break; ++ case GREATER: ++ { ++ alt8=3; ++ } ++ break; ++ case LTE: ++ { ++ alt8=4; ++ } ++ break; ++ case GTE: ++ { ++ alt8=5; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 8; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleintopEx; ++ } ++ ++ switch (alt8) ++ { ++ case 1: ++ // RSP.g:56:9: equal= EQUAL ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ equal = (pANTLR3_COMMON_TOKEN) MATCHT(EQUAL, &FOLLOW_EQUAL_in_intop273); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintopEx; ++ } ++ ++ equal_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, equal)); ++ ADAPTOR->addChild(ADAPTOR, root_0, equal_tree); ++ ++ ++ } ++ break; ++ case 2: ++ // RSP.g:57:4: less= LESS ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ less = (pANTLR3_COMMON_TOKEN) MATCHT(LESS, &FOLLOW_LESS_in_intop280); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintopEx; ++ } ++ ++ less_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, less)); ++ ADAPTOR->addChild(ADAPTOR, root_0, less_tree); ++ ++ ++ } ++ break; ++ case 3: ++ // RSP.g:58:4: greater= GREATER ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ greater = (pANTLR3_COMMON_TOKEN) MATCHT(GREATER, &FOLLOW_GREATER_in_intop287); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintopEx; ++ } ++ ++ greater_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, greater)); ++ ADAPTOR->addChild(ADAPTOR, root_0, greater_tree); ++ ++ ++ } ++ break; ++ case 4: ++ // RSP.g:59:4: lte= LTE ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ lte = (pANTLR3_COMMON_TOKEN) MATCHT(LTE, &FOLLOW_LTE_in_intop294); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintopEx; ++ } ++ ++ lte_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, lte)); ++ ADAPTOR->addChild(ADAPTOR, root_0, lte_tree); ++ ++ ++ } ++ break; ++ case 5: ++ // RSP.g:60:4: gte= GTE ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ gte = (pANTLR3_COMMON_TOKEN) MATCHT(GTE, &FOLLOW_GTE_in_intop301); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintopEx; ++ } ++ ++ gte_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, gte)); ++ ADAPTOR->addChild(ADAPTOR, root_0, gte_tree); ++ ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleintopEx; /* Prevent compiler warnings */ ++ ruleintopEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end intop */ ++ ++/** ++ * $ANTLR start datecrit ++ * RSP.g:63:1: datecrit : FIELD dateop datespec -> ^( dateop FIELD datespec ) ; ++ */ ++static RSPParser_datecrit_return ++datecrit(pRSPParser ctx) ++{ ++ RSPParser_datecrit_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN FIELD30; ++ RSPParser_dateop_return dateop31; ++ #undef RETURN_TYPE_dateop31 ++ #define RETURN_TYPE_dateop31 RSPParser_dateop_return ++ ++ RSPParser_datespec_return datespec32; ++ #undef RETURN_TYPE_datespec32 ++ #define RETURN_TYPE_datespec32 RSPParser_datespec_return ++ ++ pANTLR3_BASE_TREE FIELD30_tree; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_FIELD; ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_datespec; ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateop; ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ FIELD30 = NULL; ++ dateop31.tree = NULL; ++ ++ datespec32.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ FIELD30_tree = NULL; ++ ++ stream_FIELD = NULL; ++ #define CREATE_stream_FIELD if (stream_FIELD == NULL) {stream_FIELD = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token FIELD"); } ++ stream_datespec = NULL; ++ #define CREATE_stream_datespec if (stream_datespec == NULL) {stream_datespec = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule datespec"); } ++ stream_dateop = NULL; ++ #define CREATE_stream_dateop if (stream_dateop == NULL) {stream_dateop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateop"); } ++ ++ retval.tree = NULL; ++ { ++ // RSP.g:63:9: ( FIELD dateop datespec -> ^( dateop FIELD datespec ) ) ++ // RSP.g:63:11: FIELD dateop datespec ++ { ++ FIELD30 = (pANTLR3_COMMON_TOKEN) MATCHT(FIELD, &FOLLOW_FIELD_in_datecrit310); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatecritEx; ++ } ++ ++ CREATE_stream_FIELD; stream_FIELD->add(stream_FIELD, FIELD30, NULL); ++ ++ FOLLOWPUSH(FOLLOW_dateop_in_datecrit312); ++ dateop31=dateop(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatecritEx; ++ } ++ ++ CREATE_stream_dateop; stream_dateop->add(stream_dateop, dateop31.tree, NULL); ++ FOLLOWPUSH(FOLLOW_datespec_in_datecrit314); ++ datespec32=datespec(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatecritEx; ++ } ++ ++ CREATE_stream_datespec; stream_datespec->add(stream_datespec, datespec32.tree, NULL); ++ ++ ++ /* AST REWRITE ++ * elements : FIELD, dateop, datespec ++ * token labels : ++ * rule labels : retval ++ * token list labels : ++ * rule list labels : ++ */ ++ { ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval; ++ ++ stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL); ++ ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ retval.tree = root_0; ++ // 63:34: -> ^( dateop FIELD datespec ) ++ { ++ // RSP.g:63:37: ^( dateop FIELD datespec ) ++ { ++ pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_dateop == NULL ? NULL : stream_dateop->nextNode(stream_dateop), root_1)); ++ ++ ADAPTOR->addChild(ADAPTOR, root_1, stream_FIELD == NULL ? NULL : stream_FIELD->nextNode(stream_FIELD)); ++ ADAPTOR->addChild(ADAPTOR, root_1, stream_datespec == NULL ? NULL : stream_datespec->nextTree(stream_datespec)); ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, root_1); ++ } ++ ++ } ++ ++ retval.tree = root_0; // set result root ++ if (stream_retval != NULL) stream_retval->free(stream_retval); ++ ++ ++ } ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruledatecritEx; /* Prevent compiler warnings */ ++ ruledatecritEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ if (stream_FIELD != NULL) stream_FIELD->free(stream_FIELD); ++ if (stream_datespec != NULL) stream_datespec->free(stream_datespec); ++ if (stream_dateop != NULL) stream_dateop->free(stream_dateop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end datecrit */ ++ ++/** ++ * $ANTLR start dateop ++ * RSP.g:66:1: dateop : (before= BEFORE | after= AFTER ); ++ */ ++static RSPParser_dateop_return ++dateop(pRSPParser ctx) ++{ ++ RSPParser_dateop_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN before; ++ pANTLR3_COMMON_TOKEN after; ++ ++ pANTLR3_BASE_TREE before_tree; ++ pANTLR3_BASE_TREE after_tree; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ before = NULL; ++ after = NULL; ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ before_tree = NULL; ++ after_tree = NULL; ++ ++ ++ retval.tree = NULL; ++ { ++ { ++ // RSP.g:66:8: (before= BEFORE | after= AFTER ) ++ ++ ANTLR3_UINT32 alt9; ++ ++ alt9=2; ++ ++ switch ( LA(1) ) ++ { ++ case BEFORE: ++ { ++ alt9=1; ++ } ++ break; ++ case AFTER: ++ { ++ alt9=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 9; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruledateopEx; ++ } ++ ++ switch (alt9) ++ { ++ case 1: ++ // RSP.g:66:10: before= BEFORE ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ before = (pANTLR3_COMMON_TOKEN) MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateop337); ++ if (HASEXCEPTION()) ++ { ++ goto ruledateopEx; ++ } ++ ++ before_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, before)); ++ ADAPTOR->addChild(ADAPTOR, root_0, before_tree); ++ ++ ++ } ++ break; ++ case 2: ++ // RSP.g:67:4: after= AFTER ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ after = (pANTLR3_COMMON_TOKEN) MATCHT(AFTER, &FOLLOW_AFTER_in_dateop344); ++ if (HASEXCEPTION()) ++ { ++ goto ruledateopEx; ++ } ++ ++ after_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, after)); ++ ADAPTOR->addChild(ADAPTOR, root_0, after_tree); ++ ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruledateopEx; /* Prevent compiler warnings */ ++ ruledateopEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end dateop */ ++ ++/** ++ * $ANTLR start datespec ++ * RSP.g:70:1: datespec : ( dateref | INT dateintval dateop dateref -> ^( dateop dateref INT dateintval ) ); ++ */ ++static RSPParser_datespec_return ++datespec(pRSPParser ctx) ++{ ++ RSPParser_datespec_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN INT34; ++ RSPParser_dateref_return dateref33; ++ #undef RETURN_TYPE_dateref33 ++ #define RETURN_TYPE_dateref33 RSPParser_dateref_return ++ ++ RSPParser_dateintval_return dateintval35; ++ #undef RETURN_TYPE_dateintval35 ++ #define RETURN_TYPE_dateintval35 RSPParser_dateintval_return ++ ++ RSPParser_dateop_return dateop36; ++ #undef RETURN_TYPE_dateop36 ++ #define RETURN_TYPE_dateop36 RSPParser_dateop_return ++ ++ RSPParser_dateref_return dateref37; ++ #undef RETURN_TYPE_dateref37 ++ #define RETURN_TYPE_dateref37 RSPParser_dateref_return ++ ++ pANTLR3_BASE_TREE INT34_tree; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_INT; ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateintval; ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateref; ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_dateop; ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ INT34 = NULL; ++ dateref33.tree = NULL; ++ ++ dateintval35.tree = NULL; ++ ++ dateop36.tree = NULL; ++ ++ dateref37.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ INT34_tree = NULL; ++ ++ stream_INT = NULL; ++ #define CREATE_stream_INT if (stream_INT == NULL) {stream_INT = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token INT"); } ++ stream_dateintval = NULL; ++ #define CREATE_stream_dateintval if (stream_dateintval == NULL) {stream_dateintval = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateintval"); } ++ stream_dateref = NULL; ++ #define CREATE_stream_dateref if (stream_dateref == NULL) {stream_dateref = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateref"); } ++ stream_dateop = NULL; ++ #define CREATE_stream_dateop if (stream_dateop == NULL) {stream_dateop = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule dateop"); } ++ ++ retval.tree = NULL; ++ { ++ { ++ // RSP.g:70:9: ( dateref | INT dateintval dateop dateref -> ^( dateop dateref INT dateintval ) ) ++ ++ ANTLR3_UINT32 alt10; ++ ++ alt10=2; ++ ++ switch ( LA(1) ) ++ { ++ case DATE: ++ case TODAY: ++ { ++ alt10=1; ++ } ++ break; ++ case INT: ++ { ++ alt10=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 10; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruledatespecEx; ++ } ++ ++ switch (alt10) ++ { ++ case 1: ++ // RSP.g:70:11: dateref ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ FOLLOWPUSH(FOLLOW_dateref_in_datespec353); ++ dateref33=dateref(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatespecEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, dateref33.tree); ++ ++ } ++ break; ++ case 2: ++ // RSP.g:71:4: INT dateintval dateop dateref ++ { ++ INT34 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_datespec358); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatespecEx; ++ } ++ ++ CREATE_stream_INT; stream_INT->add(stream_INT, INT34, NULL); ++ ++ FOLLOWPUSH(FOLLOW_dateintval_in_datespec360); ++ dateintval35=dateintval(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatespecEx; ++ } ++ ++ CREATE_stream_dateintval; stream_dateintval->add(stream_dateintval, dateintval35.tree, NULL); ++ FOLLOWPUSH(FOLLOW_dateop_in_datespec362); ++ dateop36=dateop(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatespecEx; ++ } ++ ++ CREATE_stream_dateop; stream_dateop->add(stream_dateop, dateop36.tree, NULL); ++ FOLLOWPUSH(FOLLOW_dateref_in_datespec364); ++ dateref37=dateref(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatespecEx; ++ } ++ ++ CREATE_stream_dateref; stream_dateref->add(stream_dateref, dateref37.tree, NULL); ++ ++ ++ /* AST REWRITE ++ * elements : dateop, INT, dateintval, dateref ++ * token labels : ++ * rule labels : retval ++ * token list labels : ++ * rule list labels : ++ */ ++ { ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval; ++ ++ stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL); ++ ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ retval.tree = root_0; ++ // 71:34: -> ^( dateop dateref INT dateintval ) ++ { ++ // RSP.g:71:37: ^( dateop dateref INT dateintval ) ++ { ++ pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, stream_dateop == NULL ? NULL : stream_dateop->nextNode(stream_dateop), root_1)); ++ ++ ADAPTOR->addChild(ADAPTOR, root_1, stream_dateref == NULL ? NULL : stream_dateref->nextTree(stream_dateref)); ++ ADAPTOR->addChild(ADAPTOR, root_1, stream_INT == NULL ? NULL : stream_INT->nextNode(stream_INT)); ++ ADAPTOR->addChild(ADAPTOR, root_1, stream_dateintval == NULL ? NULL : stream_dateintval->nextTree(stream_dateintval)); ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, root_1); ++ } ++ ++ } ++ ++ retval.tree = root_0; // set result root ++ if (stream_retval != NULL) stream_retval->free(stream_retval); ++ ++ ++ } ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruledatespecEx; /* Prevent compiler warnings */ ++ ruledatespecEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ if (stream_INT != NULL) stream_INT->free(stream_INT); ++ if (stream_dateintval != NULL) stream_dateintval->free(stream_dateintval); ++ if (stream_dateref != NULL) stream_dateref->free(stream_dateref); ++ if (stream_dateop != NULL) stream_dateop->free(stream_dateop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end datespec */ ++ ++/** ++ * $ANTLR start dateref ++ * RSP.g:74:1: dateref : (date= DATE | today= TODAY ); ++ */ ++static RSPParser_dateref_return ++dateref(pRSPParser ctx) ++{ ++ RSPParser_dateref_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN date; ++ pANTLR3_COMMON_TOKEN today; ++ ++ pANTLR3_BASE_TREE date_tree; ++ pANTLR3_BASE_TREE today_tree; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ date = NULL; ++ today = NULL; ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ date_tree = NULL; ++ today_tree = NULL; ++ ++ ++ retval.tree = NULL; ++ { ++ { ++ // RSP.g:74:9: (date= DATE | today= TODAY ) ++ ++ ANTLR3_UINT32 alt11; ++ ++ alt11=2; ++ ++ switch ( LA(1) ) ++ { ++ case DATE: ++ { ++ alt11=1; ++ } ++ break; ++ case TODAY: ++ { ++ alt11=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 11; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruledaterefEx; ++ } ++ ++ switch (alt11) ++ { ++ case 1: ++ // RSP.g:74:11: date= DATE ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ date = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateref388); ++ if (HASEXCEPTION()) ++ { ++ goto ruledaterefEx; ++ } ++ ++ date_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, date)); ++ ADAPTOR->addChild(ADAPTOR, root_0, date_tree); ++ ++ ++ } ++ break; ++ case 2: ++ // RSP.g:75:4: today= TODAY ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ today = (pANTLR3_COMMON_TOKEN) MATCHT(TODAY, &FOLLOW_TODAY_in_dateref395); ++ if (HASEXCEPTION()) ++ { ++ goto ruledaterefEx; ++ } ++ ++ today_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, today)); ++ ADAPTOR->addChild(ADAPTOR, root_0, today_tree); ++ ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruledaterefEx; /* Prevent compiler warnings */ ++ ruledaterefEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end dateref */ ++ ++/** ++ * $ANTLR start dateintval ++ * RSP.g:78:1: dateintval : (day= DAY | week= WEEK | month= MONTH | year= YEAR ); ++ */ ++static RSPParser_dateintval_return ++dateintval(pRSPParser ctx) ++{ ++ RSPParser_dateintval_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN day; ++ pANTLR3_COMMON_TOKEN week; ++ pANTLR3_COMMON_TOKEN month; ++ pANTLR3_COMMON_TOKEN year; ++ ++ pANTLR3_BASE_TREE day_tree; ++ pANTLR3_BASE_TREE week_tree; ++ pANTLR3_BASE_TREE month_tree; ++ pANTLR3_BASE_TREE year_tree; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ day = NULL; ++ week = NULL; ++ month = NULL; ++ year = NULL; ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ day_tree = NULL; ++ week_tree = NULL; ++ month_tree = NULL; ++ year_tree = NULL; ++ ++ ++ retval.tree = NULL; ++ { ++ { ++ // RSP.g:79:2: (day= DAY | week= WEEK | month= MONTH | year= YEAR ) ++ ++ ANTLR3_UINT32 alt12; ++ ++ alt12=4; ++ ++ switch ( LA(1) ) ++ { ++ case DAY: ++ { ++ alt12=1; ++ } ++ break; ++ case WEEK: ++ { ++ alt12=2; ++ } ++ break; ++ case MONTH: ++ { ++ alt12=3; ++ } ++ break; ++ case YEAR: ++ { ++ alt12=4; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 12; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruledateintvalEx; ++ } ++ ++ switch (alt12) ++ { ++ case 1: ++ // RSP.g:79:4: day= DAY ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ day = (pANTLR3_COMMON_TOKEN) MATCHT(DAY, &FOLLOW_DAY_in_dateintval408); ++ if (HASEXCEPTION()) ++ { ++ goto ruledateintvalEx; ++ } ++ ++ day_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, day)); ++ ADAPTOR->addChild(ADAPTOR, root_0, day_tree); ++ ++ ++ } ++ break; ++ case 2: ++ // RSP.g:80:4: week= WEEK ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ week = (pANTLR3_COMMON_TOKEN) MATCHT(WEEK, &FOLLOW_WEEK_in_dateintval415); ++ if (HASEXCEPTION()) ++ { ++ goto ruledateintvalEx; ++ } ++ ++ week_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, week)); ++ ADAPTOR->addChild(ADAPTOR, root_0, week_tree); ++ ++ ++ } ++ break; ++ case 3: ++ // RSP.g:81:4: month= MONTH ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ month = (pANTLR3_COMMON_TOKEN) MATCHT(MONTH, &FOLLOW_MONTH_in_dateintval422); ++ if (HASEXCEPTION()) ++ { ++ goto ruledateintvalEx; ++ } ++ ++ month_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, month)); ++ ADAPTOR->addChild(ADAPTOR, root_0, month_tree); ++ ++ ++ } ++ break; ++ case 4: ++ // RSP.g:82:4: year= YEAR ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ year = (pANTLR3_COMMON_TOKEN) MATCHT(YEAR, &FOLLOW_YEAR_in_dateintval429); ++ if (HASEXCEPTION()) ++ { ++ goto ruledateintvalEx; ++ } ++ ++ year_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, year)); ++ ADAPTOR->addChild(ADAPTOR, root_0, year_tree); ++ ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruledateintvalEx; /* Prevent compiler warnings */ ++ ruledateintvalEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end dateintval */ ++/* End of parsing rules ++ * ============================================== ++ */ ++ ++/* ============================================== ++ * Syntactic predicates ++ */ ++/* End of syntactic predicates ++ * ============================================== ++ */ ++ ++ ++ ++ ++ ++ ++/* End of code ++ * ============================================================================= ++ */ +diff --git a/src/pregen/RSPParser.h b/src/pregen/RSPParser.h +new file mode 100644 +index 0000000..1796c0a +--- /dev/null ++++ b/src/pregen/RSPParser.h +@@ -0,0 +1,365 @@ ++/** \file ++ * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : RSP.g ++ * - On : 2016-01-01 12:23:42 ++ * - for the parser : RSPParserParser * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++ * The parser RSPParser has the callable functions (rules) shown below, ++ * which will invoke the code for the associated rule in the source grammar ++ * assuming that the input stream is pointing to a token/text stream that could begin ++ * this rule. ++ * ++ * For instance if you call the first (topmost) rule in a parser grammar, you will ++ * get the results of a full parse, but calling a rule half way through the grammar will ++ * allow you to pass part of a full token stream to the parser, such as for syntax checking ++ * in editors and so on. ++ * ++ * The parser entry points are called indirectly (by function pointer to function) via ++ * a parser context typedef pRSPParser, which is returned from a call to RSPParserNew(). ++ * ++ * The methods in pRSPParser are as follows: ++ * ++ * - RSPParser_query_return pRSPParser->query(pRSPParser) ++ * - RSPParser_expr_return pRSPParser->expr(pRSPParser) ++ * - RSPParser_aexpr_return pRSPParser->aexpr(pRSPParser) ++ * - RSPParser_crit_return pRSPParser->crit(pRSPParser) ++ * - RSPParser_strcrit_return pRSPParser->strcrit(pRSPParser) ++ * - RSPParser_strop_return pRSPParser->strop(pRSPParser) ++ * - RSPParser_intcrit_return pRSPParser->intcrit(pRSPParser) ++ * - RSPParser_intop_return pRSPParser->intop(pRSPParser) ++ * - RSPParser_datecrit_return pRSPParser->datecrit(pRSPParser) ++ * - RSPParser_dateop_return pRSPParser->dateop(pRSPParser) ++ * - RSPParser_datespec_return pRSPParser->datespec(pRSPParser) ++ * - RSPParser_dateref_return pRSPParser->dateref(pRSPParser) ++ * - RSPParser_dateintval_return pRSPParser->dateintval(pRSPParser) ++ * ++ * The return type for any particular rule is of course determined by the source ++ * grammar file. ++ */ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++#ifndef _RSPParser_H ++#define _RSPParser_H ++/* ============================================================================= ++ * Standard antlr3 C runtime definitions ++ */ ++#include ++ ++/* End of standard antlr 3 runtime definitions ++ * ============================================================================= ++ */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++// Forward declare the context typedef so that we can use it before it is ++// properly defined. Delegators and delegates (from import statements) are ++// interdependent and their context structures contain pointers to each other ++// C only allows such things to be declared if you pre-declare the typedef. ++// ++typedef struct RSPParser_Ctx_struct RSPParser, * pRSPParser; ++ ++ ++ ++#ifdef ANTLR3_WINDOWS ++// Disable: Unreferenced parameter, - Rules with parameters that are not used ++// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually) ++// initialized but unused variable - tree rewrite variables declared but not needed ++// Unreferenced local variable - lexer rule declares but does not always use _type ++// potentially unitialized variable used - retval always returned from a rule ++// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns ++// ++// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at ++// and the codegen must generate some of these warnings by necessity, apart from 4100, which is ++// usually generated when a parser rule is given a parameter that it does not use. Mostly though ++// this is a matter of orthogonality hence I disable that one. ++// ++#pragma warning( disable : 4100 ) ++#pragma warning( disable : 4101 ) ++#pragma warning( disable : 4127 ) ++#pragma warning( disable : 4189 ) ++#pragma warning( disable : 4505 ) ++#pragma warning( disable : 4701 ) ++#endif ++typedef struct RSPParser_query_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ RSPParser_query_return; ++ ++typedef struct RSPParser_expr_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ RSPParser_expr_return; ++ ++typedef struct RSPParser_aexpr_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ RSPParser_aexpr_return; ++ ++typedef struct RSPParser_crit_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ RSPParser_crit_return; ++ ++typedef struct RSPParser_strcrit_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ RSPParser_strcrit_return; ++ ++typedef struct RSPParser_strop_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ RSPParser_strop_return; ++ ++typedef struct RSPParser_intcrit_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ RSPParser_intcrit_return; ++ ++typedef struct RSPParser_intop_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ RSPParser_intop_return; ++ ++typedef struct RSPParser_datecrit_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ RSPParser_datecrit_return; ++ ++typedef struct RSPParser_dateop_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ RSPParser_dateop_return; ++ ++typedef struct RSPParser_datespec_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ RSPParser_datespec_return; ++ ++typedef struct RSPParser_dateref_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ RSPParser_dateref_return; ++ ++typedef struct RSPParser_dateintval_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ RSPParser_dateintval_return; ++ ++ ++ ++/** Context tracking structure for RSPParser ++ */ ++struct RSPParser_Ctx_struct ++{ ++ /** Built in ANTLR3 context tracker contains all the generic elements ++ * required for context tracking. ++ */ ++ pANTLR3_PARSER pParser; ++ ++ ++ RSPParser_query_return (*query) (struct RSPParser_Ctx_struct * ctx); ++ RSPParser_expr_return (*expr) (struct RSPParser_Ctx_struct * ctx); ++ RSPParser_aexpr_return (*aexpr) (struct RSPParser_Ctx_struct * ctx); ++ RSPParser_crit_return (*crit) (struct RSPParser_Ctx_struct * ctx); ++ RSPParser_strcrit_return (*strcrit) (struct RSPParser_Ctx_struct * ctx); ++ RSPParser_strop_return (*strop) (struct RSPParser_Ctx_struct * ctx); ++ RSPParser_intcrit_return (*intcrit) (struct RSPParser_Ctx_struct * ctx); ++ RSPParser_intop_return (*intop) (struct RSPParser_Ctx_struct * ctx); ++ RSPParser_datecrit_return (*datecrit) (struct RSPParser_Ctx_struct * ctx); ++ RSPParser_dateop_return (*dateop) (struct RSPParser_Ctx_struct * ctx); ++ RSPParser_datespec_return (*datespec) (struct RSPParser_Ctx_struct * ctx); ++ RSPParser_dateref_return (*dateref) (struct RSPParser_Ctx_struct * ctx); ++ RSPParser_dateintval_return (*dateintval) (struct RSPParser_Ctx_struct * ctx); ++ // Delegated rules ++ const char * (*getGrammarFileName)(); ++ void (*free) (struct RSPParser_Ctx_struct * ctx); ++ /* @headerFile.members() */ ++ pANTLR3_BASE_TREE_ADAPTOR adaptor; ++ pANTLR3_VECTOR_FACTORY vectors; ++ /* End @headerFile.members() */ ++}; ++ ++// Function protoypes for the constructor functions that external translation units ++// such as delegators and delegates may wish to call. ++// ++ANTLR3_API pRSPParser RSPParserNew (pANTLR3_COMMON_TOKEN_STREAM instream); ++ANTLR3_API pRSPParser RSPParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state); ++ ++/** Symbolic definitions of all the tokens that the parser will work with. ++ * \{ ++ * ++ * Antlr will define EOF, but we can't use that as it it is too common in ++ * in C header files and that would be confusing. There is no way to filter this out at the moment ++ * so we just undef it here for now. That isn't the value we get back from C recognizers ++ * anyway. We are looking for ANTLR3_TOKEN_EOF. ++ */ ++#ifdef EOF ++#undef EOF ++#endif ++#ifdef Tokens ++#undef Tokens ++#endif ++#define STARTSW 14 ++#define WEEK 26 ++#define TODAY 24 ++#define YEAR 28 ++#define ENDSW 15 ++#define GTE 20 ++#define BEFORE 21 ++#define DAY 25 ++#define INT 16 ++#define NOT 11 ++#define AFTER 22 ++#define AND 6 ++#define EOF -1 ++#define LTE 19 ++#define MONTH 27 ++#define DIGIT19 31 ++#define INCLUDES 13 ++#define STR 10 ++#define QUOTE 29 ++#define WS 30 ++#define GREATER 18 ++#define NEWLINE 4 ++#define LPAR 7 ++#define EQUAL 12 ++#define OR 5 ++#define LESS 17 ++#define RPAR 8 ++#define FIELD 9 ++#define ESCAPED 33 ++#define DATE 23 ++#define DIGIT09 32 ++#ifdef EOF ++#undef EOF ++#define EOF ANTLR3_TOKEN_EOF ++#endif ++ ++#ifndef TOKENSOURCE ++#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource ++#endif ++ ++/* End of token definitions for RSPParser ++ * ============================================================================= ++ */ ++/** \} */ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif ++ ++/* END - Note:Keep extra line feed to satisfy UNIX systems */ +diff --git a/src/pregen/SMARTPL.u b/src/pregen/SMARTPL.u +new file mode 100644 +index 0000000..2a66bf3 +--- /dev/null ++++ b/src/pregen/SMARTPL.u +@@ -0,0 +1,6 @@ ++SMARTPLParser.c : SMARTPL.g ++./SMARTPL.tokens : SMARTPL.g ++SMARTPLParser.h : SMARTPL.g ++SMARTPLLexer.c : SMARTPL.g ++SMARTPLLexer.h : SMARTPL.g ++ANTLR_PRODUCTS += SMARTPLParser.c ./SMARTPL.tokens SMARTPLParser.h SMARTPLLexer.c SMARTPLLexer.h +\ No newline at end of file +diff --git a/src/pregen/SMARTPL2SQL.c b/src/pregen/SMARTPL2SQL.c +new file mode 100644 +index 0000000..bd93752 +--- /dev/null ++++ b/src/pregen/SMARTPL2SQL.c +@@ -0,0 +1,1649 @@ ++/** \file ++ * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : SMARTPL2SQL.g ++ * - On : 2016-01-01 12:23:44 ++ * - for the tree parser : SMARTPL2SQLTreeParser * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++*/ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++ ++/* ============================================================================= ++ * This is what the grammar programmer asked us to put at the top of every file. ++ */ ++ ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ ++ #include "logger.h" ++ #include "db.h" ++ ++/* End of Header action. ++ * ============================================================================= ++ */ ++/* ----------------------------------------- ++ * Include the ANTLR3 generated header file. ++ */ ++#include "SMARTPL2SQL.h" ++/* ----------------------------------------- */ ++ ++ ++ ++ ++ ++/* MACROS that hide the C interface implementations from the ++ * generated code, which makes it a little more understandable to the human eye. ++ * I am very much against using C pre-processor macros for function calls and bits ++ * of code as you cannot see what is happening when single stepping in debuggers ++ * and so on. The exception (in my book at least) is for generated code, where you are ++ * not maintaining it, but may wish to read and understand it. If you single step it, you know that input() ++ * hides some indirect calls, but is always referring to the input stream. This is ++ * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig ++ * the runtime interfaces without changing the generated code too often, without ++ * confusing the reader of the generated output, who may not wish to know the gory ++ * details of the interface inheritance. ++ */ ++ ++#define CTX ctx ++ ++/* Aids in accessing scopes for grammar programmers ++ */ ++#undef SCOPE_TYPE ++#undef SCOPE_STACK ++#undef SCOPE_TOP ++#define SCOPE_TYPE(scope) pSMARTPL2SQL_##scope##_SCOPE ++#define SCOPE_STACK(scope) pSMARTPL2SQL_##scope##Stack ++#define SCOPE_TOP(scope) ctx->pSMARTPL2SQL_##scope##Top ++#define SCOPE_SIZE(scope) ctx->pSMARTPL2SQL_##scope##Stack_limit ++#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i)) ++ ++/* Macros for accessing things in the parser ++ */ ++ ++#undef PARSER ++#undef RECOGNIZER ++#undef HAVEPARSEDRULE ++#undef INPUT ++#undef STRSTREAM ++#undef HASEXCEPTION ++#undef EXCEPTION ++#undef MATCHT ++#undef MATCHANYT ++#undef FOLLOWSTACK ++#undef FOLLOWPUSH ++#undef FOLLOWPOP ++#undef PRECOVER ++#undef PREPORTERROR ++#undef LA ++#undef LT ++#undef CONSTRUCTEX ++#undef CONSUME ++#undef MARK ++#undef REWIND ++#undef REWINDLAST ++#undef PERRORRECOVERY ++#undef HASFAILED ++#undef FAILEDFLAG ++#undef RECOVERFROMMISMATCHEDSET ++#undef RECOVERFROMMISMATCHEDELEMENT ++#undef BACKTRACKING ++#undef ADAPTOR ++#undef RULEMEMO ++#undef SEEK ++#undef INDEX ++#undef DBG ++ ++#define PARSER ctx->pTreeParser ++#define RECOGNIZER PARSER->rec ++#define PSRSTATE RECOGNIZER->state ++#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r) ++#define INPUT PARSER->ctnstream ++#define ISTREAM INPUT->tnstream->istream ++#define STRSTREAM INPUT->tnstream ++#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE) ++#define EXCEPTION PSRSTATE->exception ++#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs) ++#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER) ++#define FOLLOWSTACK PSRSTATE->following ++#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL) ++#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK) ++#define PRECOVER() RECOGNIZER->recover(RECOGNIZER) ++#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER) ++#define LA(n) ISTREAM->_LA(ISTREAM, n) ++#define LT(n) INPUT->tnstream->_LT(INPUT->tnstream, n) ++#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER) ++#define CONSUME() ISTREAM->consume(ISTREAM) ++#define MARK() ISTREAM->mark(ISTREAM) ++#define REWIND(m) ISTREAM->rewind(ISTREAM, m) ++#define REWINDLAST() ISTREAM->rewindLast(ISTREAM) ++#define PERRORRECOVERY PSRSTATE->errorRecovery ++#define FAILEDFLAG PSRSTATE->failed ++#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE) ++#define BACKTRACKING PSRSTATE->backtracking ++#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s) ++#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s) ++#define ADAPTOR INPUT->adaptor ++#define RULEMEMO PSRSTATE->ruleMemo ++#define SEEK(n) ISTREAM->seek(ISTREAM, n) ++#define INDEX() ISTREAM->index(ISTREAM) ++#define DBG RECOGNIZER->debugger ++ ++ ++#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt ++ ++/* The 4 tokens defined below may well clash with your own #defines or token types. If so ++ * then for the present you must use different names for your defines as these are hard coded ++ * in the code generator. It would be better not to use such names internally, and maybe ++ * we can change this in a forthcoming release. I deliberately do not #undef these ++ * here as this will at least give you a redefined error somewhere if they clash. ++ */ ++#define UP ANTLR3_TOKEN_UP ++#define DOWN ANTLR3_TOKEN_DOWN ++#define EOR ANTLR3_TOKEN_EOR ++#define INVALID ANTLR3_TOKEN_INVALID ++ ++ ++/* ============================================================================= ++ * Functions to create and destroy scopes. First come the rule scopes, followed ++ * by the global declared scopes. ++ */ ++ ++ ++ ++/* ============================================================================= */ ++ ++/* ============================================================================= ++ * Start of recognizer ++ */ ++ ++ ++ ++/** \brief Table of all token names in symbolic order, mainly used for ++ * error reporting. ++ */ ++pANTLR3_UINT8 SMARTPL2SQLTokenNames[28+4] ++ = { ++ (pANTLR3_UINT8) "", /* String to print to indicate an invalid token */ ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "STR", ++ (pANTLR3_UINT8) "OR", ++ (pANTLR3_UINT8) "AND", ++ (pANTLR3_UINT8) "NOT", ++ (pANTLR3_UINT8) "LPAR", ++ (pANTLR3_UINT8) "RPAR", ++ (pANTLR3_UINT8) "STRTAG", ++ (pANTLR3_UINT8) "INCLUDES", ++ (pANTLR3_UINT8) "IS", ++ (pANTLR3_UINT8) "INTTAG", ++ (pANTLR3_UINT8) "INTBOOL", ++ (pANTLR3_UINT8) "INT", ++ (pANTLR3_UINT8) "DATETAG", ++ (pANTLR3_UINT8) "AFTER", ++ (pANTLR3_UINT8) "BEFORE", ++ (pANTLR3_UINT8) "ENUMTAG", ++ (pANTLR3_UINT8) "ENUMVAL", ++ (pANTLR3_UINT8) "DATE", ++ (pANTLR3_UINT8) "AGO", ++ (pANTLR3_UINT8) "DATINTERVAL", ++ (pANTLR3_UINT8) "GREATER", ++ (pANTLR3_UINT8) "GREATEREQUAL", ++ (pANTLR3_UINT8) "LESS", ++ (pANTLR3_UINT8) "LESSEQUAL", ++ (pANTLR3_UINT8) "EQUAL", ++ (pANTLR3_UINT8) "WHITESPACE", ++ (pANTLR3_UINT8) "'{'", ++ (pANTLR3_UINT8) "'}'" ++ }; ++ ++ ++ ++// Forward declare the locally static matching functions we have generated. ++// ++static SMARTPL2SQL_playlist_return playlist (pSMARTPL2SQL ctx); ++static pANTLR3_STRING expression (pSMARTPL2SQL ctx); ++static int dateval (pSMARTPL2SQL ctx); ++static int interval (pSMARTPL2SQL ctx); ++static void SMARTPL2SQLFree(pSMARTPL2SQL ctx); ++/* For use in tree output where we are accumulating rule labels via label += ruleRef ++ * we need a function that knows how to free a return scope when the list is destroyed. ++ * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro. ++ */ ++static void ANTLR3_CDECL freeScope(void * scope) ++{ ++ ANTLR3_FREE(scope); ++} ++ ++/** \brief Name of the grammar file that generated this code ++ */ ++static const char fileName[] = "SMARTPL2SQL.g"; ++ ++/** \brief Return the name of the grammar file that generated this code. ++ */ ++static const char * getGrammarFileName() ++{ ++ return fileName; ++} ++/** \brief Create a new SMARTPL2SQL parser and return a context for it. ++ * ++ * \param[in] instream Pointer to an input stream interface. ++ * ++ * \return Pointer to new parser context upon success. ++ */ ++ANTLR3_API pSMARTPL2SQL ++SMARTPL2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream) ++{ ++ // See if we can create a new parser with the standard constructor ++ // ++ return SMARTPL2SQLNewSSD(instream, NULL); ++} ++ ++/** \brief Create a new SMARTPL2SQL parser and return a context for it. ++ * ++ * \param[in] instream Pointer to an input stream interface. ++ * ++ * \return Pointer to new parser context upon success. ++ */ ++ANTLR3_API pSMARTPL2SQL ++SMARTPL2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state) ++{ ++ pSMARTPL2SQL ctx; /* Context structure we will build and return */ ++ ++ ctx = (pSMARTPL2SQL) ANTLR3_CALLOC(1, sizeof(SMARTPL2SQL)); ++ ++ if (ctx == NULL) ++ { ++ // Failed to allocate memory for parser context ++ // ++ return NULL; ++ } ++ ++ /* ------------------------------------------------------------------- ++ * Memory for basic structure is allocated, now to fill in ++ * the base ANTLR3 structures. We initialize the function pointers ++ * for the standard ANTLR3 parser function set, but upon return ++ * from here, the programmer may set the pointers to provide custom ++ * implementations of each function. ++ * ++ * We don't use the macros defined in SMARTPL2SQL.h here, in order that you can get a sense ++ * of what goes where. ++ */ ++ ++ /* Create a base Tree parser/recognizer, using the supplied tree node stream ++ */ ++ ctx->pTreeParser = antlr3TreeParserNewStream(ANTLR3_SIZE_HINT, instream, state); ++ /* Install the implementation of our SMARTPL2SQL interface ++ */ ++ ctx->playlist = playlist; ++ ctx->expression = expression; ++ ctx->dateval = dateval; ++ ctx->interval = interval; ++ ctx->free = SMARTPL2SQLFree; ++ ctx->getGrammarFileName = getGrammarFileName; ++ ++ /* Install the scope pushing methods. ++ */ ++ ++ ++ ++ ++ ++ /* Install the token table ++ */ ++ PSRSTATE->tokenNames = SMARTPL2SQLTokenNames; ++ ++ ++ /* Return the newly built parser to the caller ++ */ ++ return ctx; ++} ++ ++/** Free the parser resources ++ */ ++ static void ++ SMARTPL2SQLFree(pSMARTPL2SQL ctx) ++ { ++ /* Free any scope memory ++ */ ++ ++ ++ // Free this parser ++ // ++ ctx->pTreeParser->free(ctx->pTreeParser); ++ ANTLR3_FREE(ctx); ++ ++ /* Everything is released, so we can return ++ */ ++ return; ++ } ++ ++/** Return token names used by this tree parser ++ * ++ * The returned pointer is used as an index into the token names table (using the token ++ * number as the index). ++ * ++ * \return Pointer to first char * in the table. ++ */ ++static pANTLR3_UINT8 *getTokenNames() ++{ ++ return SMARTPL2SQLTokenNames; ++} ++ ++ ++ ++ ++/* Declare the bitsets ++ */ ++ ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_playlist66 */ ++static ANTLR3_BITWORD FOLLOW_STR_in_playlist66_bits[] = { ANTLR3_UINT64_LIT(0x0000000040000000) }; ++static ANTLR3_BITSET_LIST FOLLOW_STR_in_playlist66 = { FOLLOW_STR_in_playlist66_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_30_in_playlist68 */ ++static ANTLR3_BITWORD FOLLOW_30_in_playlist68_bits[] = { ANTLR3_UINT64_LIT(0x00000000000924E0) }; ++static ANTLR3_BITSET_LIST FOLLOW_30_in_playlist68 = { FOLLOW_30_in_playlist68_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_playlist74 */ ++static ANTLR3_BITWORD FOLLOW_expression_in_playlist74_bits[] = { ANTLR3_UINT64_LIT(0x0000000080000000) }; ++static ANTLR3_BITSET_LIST FOLLOW_expression_in_playlist74 = { FOLLOW_expression_in_playlist74_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_31_in_playlist76 */ ++static ANTLR3_BITWORD FOLLOW_31_in_playlist76_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_31_in_playlist76 = { FOLLOW_31_in_playlist76_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_expression101 */ ++static ANTLR3_BITWORD FOLLOW_NOT_in_expression101_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) }; ++static ANTLR3_BITSET_LIST FOLLOW_NOT_in_expression101 = { FOLLOW_NOT_in_expression101_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression107 */ ++static ANTLR3_BITWORD FOLLOW_expression_in_expression107_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) }; ++static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression107 = { FOLLOW_expression_in_expression107_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AND_in_expression118 */ ++static ANTLR3_BITWORD FOLLOW_AND_in_expression118_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) }; ++static ANTLR3_BITSET_LIST FOLLOW_AND_in_expression118 = { FOLLOW_AND_in_expression118_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression124 */ ++static ANTLR3_BITWORD FOLLOW_expression_in_expression124_bits[] = { ANTLR3_UINT64_LIT(0x00000000000924E0) }; ++static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression124 = { FOLLOW_expression_in_expression124_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression130 */ ++static ANTLR3_BITWORD FOLLOW_expression_in_expression130_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) }; ++static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression130 = { FOLLOW_expression_in_expression130_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_OR_in_expression141 */ ++static ANTLR3_BITWORD FOLLOW_OR_in_expression141_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000004) }; ++static ANTLR3_BITSET_LIST FOLLOW_OR_in_expression141 = { FOLLOW_OR_in_expression141_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression147 */ ++static ANTLR3_BITWORD FOLLOW_expression_in_expression147_bits[] = { ANTLR3_UINT64_LIT(0x00000000000924E0) }; ++static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression147 = { FOLLOW_expression_in_expression147_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression153 */ ++static ANTLR3_BITWORD FOLLOW_expression_in_expression153_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000008) }; ++static ANTLR3_BITSET_LIST FOLLOW_expression_in_expression153 = { FOLLOW_expression_in_expression153_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STRTAG_in_expression163 */ ++static ANTLR3_BITWORD FOLLOW_STRTAG_in_expression163_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000800) }; ++static ANTLR3_BITSET_LIST FOLLOW_STRTAG_in_expression163 = { FOLLOW_STRTAG_in_expression163_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INCLUDES_in_expression165 */ ++static ANTLR3_BITWORD FOLLOW_INCLUDES_in_expression165_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) }; ++static ANTLR3_BITSET_LIST FOLLOW_INCLUDES_in_expression165 = { FOLLOW_INCLUDES_in_expression165_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_expression167 */ ++static ANTLR3_BITWORD FOLLOW_STR_in_expression167_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_STR_in_expression167 = { FOLLOW_STR_in_expression167_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STRTAG_in_expression176 */ ++static ANTLR3_BITWORD FOLLOW_STRTAG_in_expression176_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001000) }; ++static ANTLR3_BITSET_LIST FOLLOW_STRTAG_in_expression176 = { FOLLOW_STRTAG_in_expression176_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_IS_in_expression178 */ ++static ANTLR3_BITWORD FOLLOW_IS_in_expression178_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) }; ++static ANTLR3_BITSET_LIST FOLLOW_IS_in_expression178 = { FOLLOW_IS_in_expression178_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_expression180 */ ++static ANTLR3_BITWORD FOLLOW_STR_in_expression180_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_STR_in_expression180 = { FOLLOW_STR_in_expression180_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTTAG_in_expression189 */ ++static ANTLR3_BITWORD FOLLOW_INTTAG_in_expression189_bits[] = { ANTLR3_UINT64_LIT(0x0000000000004000) }; ++static ANTLR3_BITSET_LIST FOLLOW_INTTAG_in_expression189 = { FOLLOW_INTTAG_in_expression189_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTBOOL_in_expression191 */ ++static ANTLR3_BITWORD FOLLOW_INTBOOL_in_expression191_bits[] = { ANTLR3_UINT64_LIT(0x0000000000008000) }; ++static ANTLR3_BITSET_LIST FOLLOW_INTBOOL_in_expression191 = { FOLLOW_INTBOOL_in_expression191_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_expression193 */ ++static ANTLR3_BITWORD FOLLOW_INT_in_expression193_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_INT_in_expression193 = { FOLLOW_INT_in_expression193_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATETAG_in_expression202 */ ++static ANTLR3_BITWORD FOLLOW_DATETAG_in_expression202_bits[] = { ANTLR3_UINT64_LIT(0x0000000000020000) }; ++static ANTLR3_BITSET_LIST FOLLOW_DATETAG_in_expression202 = { FOLLOW_DATETAG_in_expression202_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_expression204 */ ++static ANTLR3_BITWORD FOLLOW_AFTER_in_expression204_bits[] = { ANTLR3_UINT64_LIT(0x0000000000208000) }; ++static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_expression204 = { FOLLOW_AFTER_in_expression204_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateval_in_expression206 */ ++static ANTLR3_BITWORD FOLLOW_dateval_in_expression206_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_dateval_in_expression206 = { FOLLOW_dateval_in_expression206_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATETAG_in_expression215 */ ++static ANTLR3_BITWORD FOLLOW_DATETAG_in_expression215_bits[] = { ANTLR3_UINT64_LIT(0x0000000000040000) }; ++static ANTLR3_BITSET_LIST FOLLOW_DATETAG_in_expression215 = { FOLLOW_DATETAG_in_expression215_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_expression217 */ ++static ANTLR3_BITWORD FOLLOW_BEFORE_in_expression217_bits[] = { ANTLR3_UINT64_LIT(0x0000000000208000) }; ++static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_expression217 = { FOLLOW_BEFORE_in_expression217_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateval_in_expression219 */ ++static ANTLR3_BITWORD FOLLOW_dateval_in_expression219_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_dateval_in_expression219 = { FOLLOW_dateval_in_expression219_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMTAG_in_expression228 */ ++static ANTLR3_BITWORD FOLLOW_ENUMTAG_in_expression228_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001000) }; ++static ANTLR3_BITSET_LIST FOLLOW_ENUMTAG_in_expression228 = { FOLLOW_ENUMTAG_in_expression228_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_IS_in_expression230 */ ++static ANTLR3_BITWORD FOLLOW_IS_in_expression230_bits[] = { ANTLR3_UINT64_LIT(0x0000000000100000) }; ++static ANTLR3_BITSET_LIST FOLLOW_IS_in_expression230 = { FOLLOW_IS_in_expression230_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMVAL_in_expression232 */ ++static ANTLR3_BITWORD FOLLOW_ENUMVAL_in_expression232_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_ENUMVAL_in_expression232 = { FOLLOW_ENUMVAL_in_expression232_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval257 */ ++static ANTLR3_BITWORD FOLLOW_DATE_in_dateval257_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval257 = { FOLLOW_DATE_in_dateval257_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval266 */ ++static ANTLR3_BITWORD FOLLOW_interval_in_dateval266_bits[] = { ANTLR3_UINT64_LIT(0x0000000000040000) }; ++static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval266 = { FOLLOW_interval_in_dateval266_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_dateval268 */ ++static ANTLR3_BITWORD FOLLOW_BEFORE_in_dateval268_bits[] = { ANTLR3_UINT64_LIT(0x0000000000200000) }; ++static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_dateval268 = { FOLLOW_BEFORE_in_dateval268_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval270 */ ++static ANTLR3_BITWORD FOLLOW_DATE_in_dateval270_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval270 = { FOLLOW_DATE_in_dateval270_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval279 */ ++static ANTLR3_BITWORD FOLLOW_interval_in_dateval279_bits[] = { ANTLR3_UINT64_LIT(0x0000000000020000) }; ++static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval279 = { FOLLOW_interval_in_dateval279_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_dateval281 */ ++static ANTLR3_BITWORD FOLLOW_AFTER_in_dateval281_bits[] = { ANTLR3_UINT64_LIT(0x0000000000200000) }; ++static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_dateval281 = { FOLLOW_AFTER_in_dateval281_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval283 */ ++static ANTLR3_BITWORD FOLLOW_DATE_in_dateval283_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval283 = { FOLLOW_DATE_in_dateval283_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval292 */ ++static ANTLR3_BITWORD FOLLOW_interval_in_dateval292_bits[] = { ANTLR3_UINT64_LIT(0x0000000000400000) }; ++static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval292 = { FOLLOW_interval_in_dateval292_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AGO_in_dateval294 */ ++static ANTLR3_BITWORD FOLLOW_AGO_in_dateval294_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_AGO_in_dateval294 = { FOLLOW_AGO_in_dateval294_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_interval318 */ ++static ANTLR3_BITWORD FOLLOW_INT_in_interval318_bits[] = { ANTLR3_UINT64_LIT(0x0000000000800000) }; ++static ANTLR3_BITSET_LIST FOLLOW_INT_in_interval318 = { FOLLOW_INT_in_interval318_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATINTERVAL_in_interval320 */ ++static ANTLR3_BITWORD FOLLOW_DATINTERVAL_in_interval320_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_DATINTERVAL_in_interval320 = { FOLLOW_DATINTERVAL_in_interval320_bits, 1 }; ++ ++ ++ ++ ++/* ============================================== ++ * Parsing rules ++ */ ++/** ++ * $ANTLR start playlist ++ * SMARTPL2SQL.g:43:1: playlist returns [ pANTLR3_STRING title, pANTLR3_STRING query ] : STR '{' e= expression '}' ; ++ */ ++static SMARTPL2SQL_playlist_return ++playlist(pSMARTPL2SQL ctx) ++{ ++ SMARTPL2SQL_playlist_return retval; ++ ++ pANTLR3_BASE_TREE STR1; ++ pANTLR3_STRING e; ++ #undef RETURN_TYPE_e ++ #define RETURN_TYPE_e pANTLR3_STRING ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ retval.title= NULL; retval.query= NULL; ++ STR1 = NULL; ++ e = NULL; ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ { ++ // SMARTPL2SQL.g:45:2: ( STR '{' e= expression '}' ) ++ // SMARTPL2SQL.g:45:4: STR '{' e= expression '}' ++ { ++ STR1 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_playlist66); ++ if (HASEXCEPTION()) ++ { ++ goto ruleplaylistEx; ++ } ++ ++ MATCHT(30, &FOLLOW_30_in_playlist68); ++ if (HASEXCEPTION()) ++ { ++ goto ruleplaylistEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_expression_in_playlist74); ++ e=expression(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleplaylistEx; ++ } ++ ++ MATCHT(31, &FOLLOW_31_in_playlist76); ++ if (HASEXCEPTION()) ++ { ++ goto ruleplaylistEx; ++ } ++ ++ { ++ ++ pANTLR3_UINT8 val; ++ val = (STR1->getText(STR1))->toUTF8((STR1->getText(STR1)))->chars; ++ val++; ++ val[strlen((const char *)val) - 1] = '\0'; ++ ++ retval.title= (STR1->getText(STR1))->factory->newRaw((STR1->getText(STR1))->factory); ++ retval.title->append8(retval.title, (const char *)val); ++ ++ retval.query= e->factory->newRaw(e->factory); ++ retval.query->append8(retval.query, "("); ++ retval.query->appendS(retval.query, e); ++ retval.query->append8(retval.query, ")"); ++ ++ } ++ ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleplaylistEx; /* Prevent compiler warnings */ ++ ruleplaylistEx: ; ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end playlist */ ++ ++/** ++ * $ANTLR start expression ++ * SMARTPL2SQL.g:62:1: expression returns [ pANTLR3_STRING result ] : ( ^( NOT a= expression ) | ^( AND a= expression b= expression ) | ^( OR a= expression b= expression ) | STRTAG INCLUDES STR | STRTAG IS STR | INTTAG INTBOOL INT | DATETAG AFTER dateval | DATETAG BEFORE dateval | ENUMTAG IS ENUMVAL ); ++ */ ++static pANTLR3_STRING ++expression(pSMARTPL2SQL ctx) ++{ ++ pANTLR3_STRING result = NULL; ++ ++ pANTLR3_BASE_TREE STR2; ++ pANTLR3_BASE_TREE STRTAG3; ++ pANTLR3_BASE_TREE STR4; ++ pANTLR3_BASE_TREE STRTAG5; ++ pANTLR3_BASE_TREE INTTAG6; ++ pANTLR3_BASE_TREE INTBOOL7; ++ pANTLR3_BASE_TREE INT8; ++ pANTLR3_BASE_TREE DATETAG10; ++ pANTLR3_BASE_TREE DATETAG12; ++ pANTLR3_BASE_TREE ENUMTAG13; ++ pANTLR3_BASE_TREE ENUMVAL14; ++ pANTLR3_STRING a; ++ #undef RETURN_TYPE_a ++ #define RETURN_TYPE_a pANTLR3_STRING ++ ++ pANTLR3_STRING b; ++ #undef RETURN_TYPE_b ++ #define RETURN_TYPE_b pANTLR3_STRING ++ ++ int dateval9; ++ #undef RETURN_TYPE_dateval9 ++ #define RETURN_TYPE_dateval9 int ++ ++ int dateval11; ++ #undef RETURN_TYPE_dateval11 ++ #define RETURN_TYPE_dateval11 int ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ result= NULL; ++ STR2 = NULL; ++ STRTAG3 = NULL; ++ STR4 = NULL; ++ STRTAG5 = NULL; ++ INTTAG6 = NULL; ++ INTBOOL7 = NULL; ++ INT8 = NULL; ++ DATETAG10 = NULL; ++ DATETAG12 = NULL; ++ ENUMTAG13 = NULL; ++ ENUMVAL14 = NULL; ++ a = NULL; ++ b = NULL; ++ dateval9 = 0; ++ dateval11 = 0; ++ ++ { ++ { ++ // SMARTPL2SQL.g:64:2: ( ^( NOT a= expression ) | ^( AND a= expression b= expression ) | ^( OR a= expression b= expression ) | STRTAG INCLUDES STR | STRTAG IS STR | INTTAG INTBOOL INT | DATETAG AFTER dateval | DATETAG BEFORE dateval | ENUMTAG IS ENUMVAL ) ++ ++ ANTLR3_UINT32 alt1; ++ ++ alt1=9; ++ ++ switch ( LA(1) ) ++ { ++ case NOT: ++ { ++ alt1=1; ++ } ++ break; ++ case AND: ++ { ++ alt1=2; ++ } ++ break; ++ case OR: ++ { ++ alt1=3; ++ } ++ break; ++ case STRTAG: ++ { ++ switch ( LA(2) ) ++ { ++ case INCLUDES: ++ { ++ alt1=4; ++ } ++ break; ++ case IS: ++ { ++ alt1=5; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 4; ++ ++ ++ goto ruleexpressionEx; ++ } ++ ++ } ++ break; ++ case INTTAG: ++ { ++ alt1=6; ++ } ++ break; ++ case DATETAG: ++ { ++ switch ( LA(2) ) ++ { ++ case AFTER: ++ { ++ alt1=7; ++ } ++ break; ++ case BEFORE: ++ { ++ alt1=8; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 6; ++ ++ ++ goto ruleexpressionEx; ++ } ++ ++ } ++ break; ++ case ENUMTAG: ++ { ++ alt1=9; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleexpressionEx; ++ } ++ ++ switch (alt1) ++ { ++ case 1: ++ // SMARTPL2SQL.g:64:4: ^( NOT a= expression ) ++ { ++ MATCHT(NOT, &FOLLOW_NOT_in_expression101); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_DOWN, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_expression_in_expression107); ++ a=expression(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_UP, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ { ++ ++ result= a->factory->newRaw(a->factory); ++ result->append8(result, "NOT("); ++ result->appendS(result, a); ++ result->append8(result, ")"); ++ ++ } ++ ++ } ++ break; ++ case 2: ++ // SMARTPL2SQL.g:71:4: ^( AND a= expression b= expression ) ++ { ++ MATCHT(AND, &FOLLOW_AND_in_expression118); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_DOWN, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_expression_in_expression124); ++ a=expression(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_expression_in_expression130); ++ b=expression(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_UP, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ { ++ ++ result= a->factory->newRaw(a->factory); ++ result->append8(result, "("); ++ result->appendS(result, a); ++ result->append8(result, " AND "); ++ result->appendS(result, b); ++ result->append8(result, ")"); ++ ++ } ++ ++ } ++ break; ++ case 3: ++ // SMARTPL2SQL.g:80:4: ^( OR a= expression b= expression ) ++ { ++ MATCHT(OR, &FOLLOW_OR_in_expression141); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_DOWN, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_expression_in_expression147); ++ a=expression(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_expression_in_expression153); ++ b=expression(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ ++ MATCHT(ANTLR3_TOKEN_UP, NULL); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ { ++ ++ result= a->factory->newRaw(a->factory); ++ result->append8(result, "("); ++ result->appendS(result, a); ++ result->append8(result, " OR "); ++ result->appendS(result, b); ++ result->append8(result, ")"); ++ ++ } ++ ++ } ++ break; ++ case 4: ++ // SMARTPL2SQL.g:89:4: STRTAG INCLUDES STR ++ { ++ STRTAG3 = (pANTLR3_BASE_TREE) MATCHT(STRTAG, &FOLLOW_STRTAG_in_expression163); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ MATCHT(INCLUDES, &FOLLOW_INCLUDES_in_expression165); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ STR2 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expression167); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ { ++ ++ pANTLR3_UINT8 val; ++ val = (STR2->getText(STR2))->toUTF8((STR2->getText(STR2)))->chars; ++ val++; ++ val[strlen((const char *)val) - 1] = '\0'; ++ ++ result= (STR2->getText(STR2))->factory->newRaw((STR2->getText(STR2))->factory); ++ result->append8(result, "f."); ++ result->appendS(result, (STRTAG3->getText(STRTAG3))->toUTF8((STRTAG3->getText(STRTAG3)))); ++ result->append8(result, " LIKE '%"); ++ result->append8(result, sqlite3_mprintf("%q", (const char *)val)); ++ result->append8(result, "%'"); ++ ++ } ++ ++ } ++ break; ++ case 5: ++ // SMARTPL2SQL.g:103:4: STRTAG IS STR ++ { ++ STRTAG5 = (pANTLR3_BASE_TREE) MATCHT(STRTAG, &FOLLOW_STRTAG_in_expression176); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ MATCHT(IS, &FOLLOW_IS_in_expression178); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ STR4 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expression180); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ { ++ ++ pANTLR3_UINT8 val; ++ val = (STR4->getText(STR4))->toUTF8((STR4->getText(STR4)))->chars; ++ val++; ++ val[strlen((const char *)val) - 1] = '\0'; ++ ++ result= (STR4->getText(STR4))->factory->newRaw((STR4->getText(STR4))->factory); ++ result->append8(result, "f."); ++ result->appendS(result, (STRTAG5->getText(STRTAG5))->toUTF8((STRTAG5->getText(STRTAG5)))); ++ result->append8(result, " LIKE '"); ++ result->append8(result, sqlite3_mprintf("%q", (const char *)val)); ++ result->append8(result, "'"); ++ ++ } ++ ++ } ++ break; ++ case 6: ++ // SMARTPL2SQL.g:117:4: INTTAG INTBOOL INT ++ { ++ INTTAG6 = (pANTLR3_BASE_TREE) MATCHT(INTTAG, &FOLLOW_INTTAG_in_expression189); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ INTBOOL7 = (pANTLR3_BASE_TREE) MATCHT(INTBOOL, &FOLLOW_INTBOOL_in_expression191); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ INT8 = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_expression193); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ { ++ ++ result= (INTTAG6->getText(INTTAG6))->factory->newRaw((INTTAG6->getText(INTTAG6))->factory); ++ result->append8(result, "f."); ++ result->appendS(result, (INTTAG6->getText(INTTAG6))->toUTF8((INTTAG6->getText(INTTAG6)))); ++ result->append8(result, " "); ++ result->appendS(result, (INTBOOL7->getText(INTBOOL7))->toUTF8((INTBOOL7->getText(INTBOOL7)))); ++ result->append8(result, " "); ++ result->appendS(result, (INT8->getText(INT8))->toUTF8((INT8->getText(INT8)))); ++ ++ } ++ ++ } ++ break; ++ case 7: ++ // SMARTPL2SQL.g:127:4: DATETAG AFTER dateval ++ { ++ DATETAG10 = (pANTLR3_BASE_TREE) MATCHT(DATETAG, &FOLLOW_DATETAG_in_expression202); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ MATCHT(AFTER, &FOLLOW_AFTER_in_expression204); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_dateval_in_expression206); ++ dateval9=dateval(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ { ++ ++ char str[15]; ++ sprintf(str, "%d", dateval9); ++ ++ result= (DATETAG10->getText(DATETAG10))->factory->newRaw((DATETAG10->getText(DATETAG10))->factory); ++ result->append8(result, "f."); ++ result->appendS(result, (DATETAG10->getText(DATETAG10))->toUTF8((DATETAG10->getText(DATETAG10)))); ++ result->append8(result, " > "); ++ result->append8(result, str); ++ ++ } ++ ++ } ++ break; ++ case 8: ++ // SMARTPL2SQL.g:138:4: DATETAG BEFORE dateval ++ { ++ DATETAG12 = (pANTLR3_BASE_TREE) MATCHT(DATETAG, &FOLLOW_DATETAG_in_expression215); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ MATCHT(BEFORE, &FOLLOW_BEFORE_in_expression217); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_dateval_in_expression219); ++ dateval11=dateval(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ { ++ ++ char str[15]; ++ sprintf(str, "%d", dateval11); ++ ++ result= (DATETAG12->getText(DATETAG12))->factory->newRaw((DATETAG12->getText(DATETAG12))->factory); ++ result->append8(result, "f."); ++ result->appendS(result, (DATETAG12->getText(DATETAG12))->toUTF8((DATETAG12->getText(DATETAG12)))); ++ result->append8(result, " > "); ++ result->append8(result, str); ++ ++ } ++ ++ } ++ break; ++ case 9: ++ // SMARTPL2SQL.g:149:4: ENUMTAG IS ENUMVAL ++ { ++ ENUMTAG13 = (pANTLR3_BASE_TREE) MATCHT(ENUMTAG, &FOLLOW_ENUMTAG_in_expression228); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ MATCHT(IS, &FOLLOW_IS_in_expression230); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ ENUMVAL14 = (pANTLR3_BASE_TREE) MATCHT(ENUMVAL, &FOLLOW_ENUMVAL_in_expression232); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ { ++ ++ pANTLR3_UINT8 tag; ++ pANTLR3_UINT8 val; ++ char str[20]; ++ ++ sprintf(str, "1=1"); ++ ++ tag = (ENUMTAG13->getText(ENUMTAG13))->chars; ++ val = (ENUMVAL14->getText(ENUMVAL14))->chars; ++ if (strcmp((char *)tag, "media_kind") == 0) ++ { ++ if (strcmp((char *)val, "music") == 0) ++ { ++ sprintf(str, "f.media_kind = %d", MEDIA_KIND_MUSIC); ++ } ++ else if (strcmp((char *)val, "movie") == 0) ++ { ++ sprintf(str, "f.media_kind = %d", MEDIA_KIND_MOVIE); ++ } ++ else if (strcmp((char *)val, "podcast") == 0) ++ { ++ sprintf(str, "f.media_kind = %d", MEDIA_KIND_PODCAST); ++ } ++ else if (strcmp((char *)val, "audiobook") == 0) ++ { ++ sprintf(str, "f.media_kind = %d", MEDIA_KIND_AUDIOBOOK); ++ } ++ else if (strcmp((char *)val, "tvshow") == 0) ++ { ++ sprintf(str, "f.media_kind = %d", MEDIA_KIND_TVSHOW); ++ } ++ } ++ else if (strcmp((char *)tag, "data_kind") == 0) ++ { ++ if (strcmp((char *)val, "file") == 0) ++ { ++ sprintf(str, "f.data_kind = %d", DATA_KIND_FILE); ++ } ++ else if (strcmp((char *)val, "url") == 0) ++ { ++ sprintf(str, "f.data_kind = %d", DATA_KIND_HTTP); ++ } ++ else if (strcmp((char *)val, "spotify") == 0) ++ { ++ sprintf(str, "f.data_kind = %d", DATA_KIND_SPOTIFY); ++ } ++ else if (strcmp((char *)val, "pipe") == 0) ++ { ++ sprintf(str, "f.data_kind = %d", DATA_KIND_PIPE); ++ } ++ } ++ ++ result= (ENUMTAG13->getText(ENUMTAG13))->factory->newRaw((ENUMTAG13->getText(ENUMTAG13))->factory); ++ result->append8(result, str); ++ ++ } ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleexpressionEx; /* Prevent compiler warnings */ ++ ruleexpressionEx: ; ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ } ++ ++ ++ return result; ++} ++/* $ANTLR end expression */ ++ ++/** ++ * $ANTLR start dateval ++ * SMARTPL2SQL.g:207:1: dateval returns [ int result ] : ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO ); ++ */ ++static int ++dateval(pSMARTPL2SQL ctx) ++{ ++ int result = 0; ++ ++ pANTLR3_BASE_TREE DATE15; ++ pANTLR3_BASE_TREE DATE16; ++ pANTLR3_BASE_TREE DATE18; ++ int interval17; ++ #undef RETURN_TYPE_interval17 ++ #define RETURN_TYPE_interval17 int ++ ++ int interval19; ++ #undef RETURN_TYPE_interval19 ++ #define RETURN_TYPE_interval19 int ++ ++ int interval20; ++ #undef RETURN_TYPE_interval20 ++ #define RETURN_TYPE_interval20 int ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ result= 0; ++ DATE15 = NULL; ++ DATE16 = NULL; ++ DATE18 = NULL; ++ interval17 = 0; ++ interval19 = 0; ++ interval20 = 0; ++ ++ { ++ { ++ // SMARTPL2SQL.g:209:2: ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO ) ++ ++ ANTLR3_UINT32 alt2; ++ ++ alt2=4; ++ ++ switch ( LA(1) ) ++ { ++ case DATE: ++ { ++ alt2=1; ++ } ++ break; ++ case INT: ++ { ++ switch ( LA(2) ) ++ { ++ case DATINTERVAL: ++ { ++ switch ( LA(3) ) ++ { ++ case AGO: ++ { ++ alt2=4; ++ } ++ break; ++ case BEFORE: ++ { ++ alt2=2; ++ } ++ break; ++ case AFTER: ++ { ++ alt2=3; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 2; ++ EXCEPTION->state = 3; ++ ++ ++ goto ruledatevalEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 2; ++ EXCEPTION->state = 2; ++ ++ ++ goto ruledatevalEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 2; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruledatevalEx; ++ } ++ ++ switch (alt2) ++ { ++ case 1: ++ // SMARTPL2SQL.g:209:4: DATE ++ { ++ DATE15 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval257); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ { ++ ++ pANTLR3_UINT8 datval; ++ ++ datval = (DATE15->getText(DATE15))->chars; ++ ++ if (strcmp((char *)datval, "today") == 0) ++ { ++ result= time(NULL); ++ } ++ else if (strcmp((char *)datval, "yesterday") == 0) ++ { ++ result= time(NULL) - 24 * 3600; ++ } ++ else if (strcmp((char *)datval, "last week") == 0) ++ { ++ result= time(NULL) - 24 * 3600 * 7; ++ } ++ else if (strcmp((char *)datval, "last month") == 0) ++ { ++ result= time(NULL) - 24 * 3600 * 30; ++ } ++ else if (strcmp((char *)datval, "last year") == 0) ++ { ++ result= time(NULL) - 24 * 3600 * 365; ++ } ++ else ++ { ++ struct tm tm; ++ char year[5]; ++ char month[3]; ++ char day[3]; ++ ++ memset((void*)&tm,0,sizeof(tm)); ++ memset(year, 0, sizeof(year)); ++ memset(month, 0, sizeof(month)); ++ memset(day, 0, sizeof(day)); ++ ++ strncpy(year, (const char *)datval, 4); ++ strncpy(month, (const char *)datval + 5, 2); ++ strncpy(day, (const char *)datval + 8, 2); ++ ++ tm.tm_year = atoi(year) - 1900; ++ tm.tm_mon = atoi(month) - 1; ++ tm.tm_mday = atoi(day); ++ ++ result= mktime(&tm); ++ } ++ ++ } ++ ++ } ++ break; ++ case 2: ++ // SMARTPL2SQL.g:258:4: interval BEFORE DATE ++ { ++ FOLLOWPUSH(FOLLOW_interval_in_dateval266); ++ interval17=interval(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateval268); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ DATE16 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval270); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ { ++ ++ pANTLR3_UINT8 datval; ++ ++ datval = (DATE16->getText(DATE16))->chars; ++ ++ if (strcmp((char *)datval, "yesterday") == 0) ++ { ++ result= time(NULL) - 24 * 3600; ++ } ++ else if (strcmp((char *)datval, "last week") == 0) ++ { ++ result= time(NULL) - 24 * 3600 * 7; ++ } ++ else if (strcmp((char *)datval, "last month") == 0) ++ { ++ result= time(NULL) - 24 * 3600 * 30; ++ } ++ else if (strcmp((char *)datval, "last year") == 0) ++ { ++ result= time(NULL) - 24 * 3600 * 365; ++ } ++ else ++ { ++ result= time(NULL); ++ } ++ ++ result= result - interval17; ++ ++ } ++ ++ } ++ break; ++ case 3: ++ // SMARTPL2SQL.g:287:4: interval AFTER DATE ++ { ++ FOLLOWPUSH(FOLLOW_interval_in_dateval279); ++ interval19=interval(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ MATCHT(AFTER, &FOLLOW_AFTER_in_dateval281); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ DATE18 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval283); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ { ++ ++ pANTLR3_UINT8 datval; ++ ++ datval = (DATE18->getText(DATE18))->chars; ++ ++ if (strcmp((char *)datval, "yesterday") == 0) ++ { ++ result= time(NULL) - 24 * 3600; ++ } ++ else if (strcmp((char *)datval, "last week") == 0) ++ { ++ result= time(NULL) - 24 * 3600 * 7; ++ } ++ else if (strcmp((char *)datval, "last month") == 0) ++ { ++ result= time(NULL) - 24 * 3600 * 30; ++ } ++ else if (strcmp((char *)datval, "last year") == 0) ++ { ++ result= time(NULL) - 24 * 3600 * 365; ++ } ++ else ++ { ++ result= time(NULL); ++ } ++ ++ result= result + interval19; ++ ++ } ++ ++ } ++ break; ++ case 4: ++ // SMARTPL2SQL.g:316:4: interval AGO ++ { ++ FOLLOWPUSH(FOLLOW_interval_in_dateval292); ++ interval20=interval(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ MATCHT(AGO, &FOLLOW_AGO_in_dateval294); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ { ++ ++ result= time(NULL) - interval20; ++ ++ } ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruledatevalEx; /* Prevent compiler warnings */ ++ ruledatevalEx: ; ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ } ++ ++ ++ return result; ++} ++/* $ANTLR end dateval */ ++ ++/** ++ * $ANTLR start interval ++ * SMARTPL2SQL.g:322:1: interval returns [ int result ] : INT DATINTERVAL ; ++ */ ++static int ++interval(pSMARTPL2SQL ctx) ++{ ++ int result = 0; ++ ++ pANTLR3_BASE_TREE INT21; ++ pANTLR3_BASE_TREE DATINTERVAL22; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ result= 0; ++ INT21 = NULL; ++ DATINTERVAL22 = NULL; ++ ++ { ++ // SMARTPL2SQL.g:324:2: ( INT DATINTERVAL ) ++ // SMARTPL2SQL.g:324:4: INT DATINTERVAL ++ { ++ INT21 = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_interval318); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintervalEx; ++ } ++ ++ DATINTERVAL22 = (pANTLR3_BASE_TREE) MATCHT(DATINTERVAL, &FOLLOW_DATINTERVAL_in_interval320); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintervalEx; ++ } ++ ++ { ++ ++ pANTLR3_UINT8 interval; ++ ++ result= atoi((const char *)(INT21->getText(INT21))->chars); ++ interval = (DATINTERVAL22->getText(DATINTERVAL22))->chars; ++ ++ if (strcmp((char *)interval, "days") == 0) ++ { ++ result= result * 24 * 3600; ++ } ++ else if (strcmp((char *)interval, "weeks") == 0) ++ { ++ result= result * 24 * 3600 * 7; ++ } ++ else if (strcmp((char *)interval, "months") == 0) ++ { ++ result= result * 24 * 3600 * 30; ++ } ++ else if (strcmp((char *)interval, "weeks") == 0) ++ { ++ result= result * 24 * 3600 * 365; ++ } ++ else ++ { ++ result= 0; ++ } ++ ++ } ++ ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleintervalEx; /* Prevent compiler warnings */ ++ ruleintervalEx: ; ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ } ++ ++ ++ return result; ++} ++/* $ANTLR end interval */ ++/* End of parsing rules ++ * ============================================== ++ */ ++ ++/* ============================================== ++ * Syntactic predicates ++ */ ++/* End of syntactic predicates ++ * ============================================== ++ */ ++ ++ ++ ++ ++ ++ ++/* End of code ++ * ============================================================================= ++ */ +diff --git a/src/pregen/SMARTPL2SQL.h b/src/pregen/SMARTPL2SQL.h +new file mode 100644 +index 0000000..8e06de7 +--- /dev/null ++++ b/src/pregen/SMARTPL2SQL.h +@@ -0,0 +1,220 @@ ++/** \file ++ * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : SMARTPL2SQL.g ++ * - On : 2016-01-01 12:23:44 ++ * - for the tree parser : SMARTPL2SQLTreeParser * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++ * The tree parser SMARTPL2SQL has the callable functions (rules) shown below, ++ * which will invoke the code for the associated rule in the source grammar ++ * assuming that the input stream is pointing to a token/text stream that could begin ++ * this rule. ++ * ++ * For instance if you call the first (topmost) rule in a parser grammar, you will ++ * get the results of a full parse, but calling a rule half way through the grammar will ++ * allow you to pass part of a full token stream to the parser, such as for syntax checking ++ * in editors and so on. ++ * ++ * The parser entry points are called indirectly (by function pointer to function) via ++ * a parser context typedef pSMARTPL2SQL, which is returned from a call to SMARTPL2SQLNew(). ++ * ++ * The methods in pSMARTPL2SQL are as follows: ++ * ++ * - SMARTPL2SQL_playlist_return pSMARTPL2SQL->playlist(pSMARTPL2SQL) ++ * - pANTLR3_STRING pSMARTPL2SQL->expression(pSMARTPL2SQL) ++ * - int pSMARTPL2SQL->dateval(pSMARTPL2SQL) ++ * - int pSMARTPL2SQL->interval(pSMARTPL2SQL) ++ * ++ * The return type for any particular rule is of course determined by the source ++ * grammar file. ++ */ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++#ifndef _SMARTPL2SQL_H ++#define _SMARTPL2SQL_H ++/* ============================================================================= ++ * Standard antlr3 C runtime definitions ++ */ ++#include ++ ++/* End of standard antlr 3 runtime definitions ++ * ============================================================================= ++ */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++// Forward declare the context typedef so that we can use it before it is ++// properly defined. Delegators and delegates (from import statements) are ++// interdependent and their context structures contain pointers to each other ++// C only allows such things to be declared if you pre-declare the typedef. ++// ++typedef struct SMARTPL2SQL_Ctx_struct SMARTPL2SQL, * pSMARTPL2SQL; ++ ++ ++ ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ ++ #include "logger.h" ++ #include "db.h" ++ ++ ++#ifdef ANTLR3_WINDOWS ++// Disable: Unreferenced parameter, - Rules with parameters that are not used ++// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually) ++// initialized but unused variable - tree rewrite variables declared but not needed ++// Unreferenced local variable - lexer rule declares but does not always use _type ++// potentially unitialized variable used - retval always returned from a rule ++// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns ++// ++// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at ++// and the codegen must generate some of these warnings by necessity, apart from 4100, which is ++// usually generated when a parser rule is given a parameter that it does not use. Mostly though ++// this is a matter of orthogonality hence I disable that one. ++// ++#pragma warning( disable : 4100 ) ++#pragma warning( disable : 4101 ) ++#pragma warning( disable : 4127 ) ++#pragma warning( disable : 4189 ) ++#pragma warning( disable : 4505 ) ++#pragma warning( disable : 4701 ) ++#endif ++typedef struct SMARTPL2SQL_playlist_return_struct ++{ ++ pANTLR3_BASE_TREE start; ++ pANTLR3_BASE_TREE stop; ++ pANTLR3_STRING title; ++ pANTLR3_STRING query; ++} ++ SMARTPL2SQL_playlist_return; ++ ++ ++ ++/** Context tracking structure for SMARTPL2SQL ++ */ ++struct SMARTPL2SQL_Ctx_struct ++{ ++ /** Built in ANTLR3 context tracker contains all the generic elements ++ * required for context tracking. ++ */ ++ pANTLR3_TREE_PARSER pTreeParser; ++ ++ ++ SMARTPL2SQL_playlist_return (*playlist) (struct SMARTPL2SQL_Ctx_struct * ctx); ++ pANTLR3_STRING (*expression) (struct SMARTPL2SQL_Ctx_struct * ctx); ++ int (*dateval) (struct SMARTPL2SQL_Ctx_struct * ctx); ++ int (*interval) (struct SMARTPL2SQL_Ctx_struct * ctx); ++ // Delegated rules ++ const char * (*getGrammarFileName)(); ++ void (*free) (struct SMARTPL2SQL_Ctx_struct * ctx); ++ ++}; ++ ++// Function protoypes for the constructor functions that external translation units ++// such as delegators and delegates may wish to call. ++// ++ANTLR3_API pSMARTPL2SQL SMARTPL2SQLNew (pANTLR3_COMMON_TREE_NODE_STREAM instream); ++ANTLR3_API pSMARTPL2SQL SMARTPL2SQLNewSSD (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state); ++ ++/** Symbolic definitions of all the tokens that the tree parser will work with. ++ * \{ ++ * ++ * Antlr will define EOF, but we can't use that as it it is too common in ++ * in C header files and that would be confusing. There is no way to filter this out at the moment ++ * so we just undef it here for now. That isn't the value we get back from C recognizers ++ * anyway. We are looking for ANTLR3_TOKEN_EOF. ++ */ ++#ifdef EOF ++#undef EOF ++#endif ++#ifdef Tokens ++#undef Tokens ++#endif ++#define INTBOOL 14 ++#define STRTAG 10 ++#define AGO 22 ++#define WHITESPACE 29 ++#define GREATEREQUAL 25 ++#define BEFORE 18 ++#define DATETAG 16 ++#define INT 15 ++#define NOT 7 ++#define AFTER 17 ++#define AND 6 ++#define EOF -1 ++#define INCLUDES 11 ++#define STR 4 ++#define T__30 30 ++#define T__31 31 ++#define GREATER 24 ++#define LPAR 8 ++#define ENUMTAG 19 ++#define IS 12 ++#define ENUMVAL 20 ++#define EQUAL 28 ++#define OR 5 ++#define LESS 26 ++#define RPAR 9 ++#define DATE 21 ++#define LESSEQUAL 27 ++#define INTTAG 13 ++#define DATINTERVAL 23 ++#ifdef EOF ++#undef EOF ++#define EOF ANTLR3_TOKEN_EOF ++#endif ++ ++#ifndef TOKENSOURCE ++#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource ++#endif ++ ++/* End of token definitions for SMARTPL2SQL ++ * ============================================================================= ++ */ ++/** \} */ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif ++ ++/* END - Note:Keep extra line feed to satisfy UNIX systems */ +diff --git a/src/pregen/SMARTPL2SQL.u b/src/pregen/SMARTPL2SQL.u +new file mode 100644 +index 0000000..85567d1 +--- /dev/null ++++ b/src/pregen/SMARTPL2SQL.u +@@ -0,0 +1,5 @@ ++SMARTPL2SQL.g: SMARTPL.tokens ++SMARTPL2SQL.c : SMARTPL2SQL.g ++./SMARTPL2SQL.tokens : SMARTPL2SQL.g ++SMARTPL2SQL.h : SMARTPL2SQL.g ++ANTLR_PRODUCTS += SMARTPL2SQL.c ./SMARTPL2SQL.tokens SMARTPL2SQL.h +\ No newline at end of file +diff --git a/src/pregen/SMARTPLLexer.c b/src/pregen/SMARTPLLexer.c +new file mode 100644 +index 0000000..91d6e99 +--- /dev/null ++++ b/src/pregen/SMARTPLLexer.c +@@ -0,0 +1,4168 @@ ++/** \file ++ * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : SMARTPL.g ++ * - On : 2016-01-01 12:23:40 ++ * - for the lexer : SMARTPLLexerLexer * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++*/ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++/* ----------------------------------------- ++ * Include the ANTLR3 generated header file. ++ */ ++#include "SMARTPLLexer.h" ++/* ----------------------------------------- */ ++ ++ ++/** String literals used by SMARTPLLexer that we must do things like MATCHS() with. ++ * C will normally just lay down 8 bit characters, and you can use L"xxx" to ++ * get wchar_t, but wchar_t is 16 bits on Windows, which is not UTF32 and so ++ * we perform this little trick of defining the literals as arrays of UINT32 ++ * and passing in the address of these. ++ */ ++static ANTLR3_UCHAR lit_1[] = { 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_2[] = { 0x61, 0x6C, 0x62, 0x75, 0x6D, 0x5F, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_3[] = { 0x61, 0x6C, 0x62, 0x75, 0x6D, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_4[] = { 0x74, 0x69, 0x74, 0x6C, 0x65, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_5[] = { 0x67, 0x65, 0x6E, 0x72, 0x65, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_6[] = { 0x63, 0x6F, 0x6D, 0x70, 0x6F, 0x73, 0x65, 0x72, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_7[] = { 0x70, 0x61, 0x74, 0x68, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_8[] = { 0x74, 0x79, 0x70, 0x65, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_9[] = { 0x67, 0x72, 0x6F, 0x75, 0x70, 0x69, 0x6E, 0x67, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_10[] = { 0x70, 0x6C, 0x61, 0x79, 0x5F, 0x63, 0x6F, 0x75, 0x6E, 0x74, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_11[] = { 0x72, 0x61, 0x74, 0x69, 0x6E, 0x67, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_12[] = { 0x79, 0x65, 0x61, 0x72, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_13[] = { 0x63, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x61, 0x74, 0x69, 0x6F, 0x6E, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_14[] = { 0x74, 0x69, 0x6D, 0x65, 0x5F, 0x61, 0x64, 0x64, 0x65, 0x64, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_15[] = { 0x74, 0x69, 0x6D, 0x65, 0x5F, 0x70, 0x6C, 0x61, 0x79, 0x65, 0x64, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_16[] = { 0x64, 0x61, 0x74, 0x61, 0x5F, 0x6B, 0x69, 0x6E, 0x64, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_17[] = { 0x6D, 0x65, 0x64, 0x69, 0x61, 0x5F, 0x6B, 0x69, 0x6E, 0x64, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_18[] = { 0x69, 0x6E, 0x63, 0x6C, 0x75, 0x64, 0x65, 0x73, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_19[] = { 0x69, 0x73, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_20[] = { 0x3E, 0x3D, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_21[] = { 0x3C, 0x3D, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_22[] = { 0x61, 0x66, 0x74, 0x65, 0x72, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_23[] = { 0x62, 0x65, 0x66, 0x6F, 0x72, 0x65, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_24[] = { 0x61, 0x67, 0x6F, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_25[] = { 0x41, 0x4E, 0x44, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_26[] = { 0x61, 0x6E, 0x64, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_27[] = { 0x4F, 0x52, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_28[] = { 0x6F, 0x72, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_29[] = { 0x4E, 0x4F, 0x54, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_30[] = { 0x6E, 0x6F, 0x74, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_31[] = { 0x74, 0x6F, 0x64, 0x61, 0x79, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_32[] = { 0x79, 0x65, 0x73, 0x74, 0x65, 0x72, 0x64, 0x61, 0x79, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_33[] = { 0x6C, 0x61, 0x73, 0x74, 0x20, 0x77, 0x65, 0x65, 0x6B, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_34[] = { 0x6C, 0x61, 0x73, 0x74, 0x20, 0x6D, 0x6F, 0x6E, 0x74, 0x68, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_35[] = { 0x6C, 0x61, 0x73, 0x74, 0x20, 0x79, 0x65, 0x61, 0x72, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_36[] = { 0x64, 0x61, 0x79, 0x73, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_37[] = { 0x77, 0x65, 0x65, 0x6B, 0x73, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_38[] = { 0x6D, 0x6F, 0x6E, 0x74, 0x68, 0x73, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_39[] = { 0x79, 0x65, 0x61, 0x72, 0x73, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_40[] = { 0x6D, 0x75, 0x73, 0x69, 0x63, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_41[] = { 0x6D, 0x6F, 0x76, 0x69, 0x65, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_42[] = { 0x70, 0x6F, 0x64, 0x63, 0x61, 0x73, 0x74, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_43[] = { 0x61, 0x75, 0x64, 0x69, 0x6F, 0x62, 0x6F, 0x6F, 0x6B, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_44[] = { 0x74, 0x76, 0x73, 0x68, 0x6F, 0x77, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_45[] = { 0x66, 0x69, 0x6C, 0x65, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_46[] = { 0x75, 0x72, 0x6C, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_47[] = { 0x73, 0x70, 0x6F, 0x74, 0x69, 0x66, 0x79, ANTLR3_STRING_TERMINATOR}; ++static ANTLR3_UCHAR lit_48[] = { 0x70, 0x69, 0x70, 0x65, ANTLR3_STRING_TERMINATOR}; ++ ++ ++ ++ ++/* MACROS that hide the C interface implementations from the ++ * generated code, which makes it a little more understandable to the human eye. ++ * I am very much against using C pre-processor macros for function calls and bits ++ * of code as you cannot see what is happening when single stepping in debuggers ++ * and so on. The exception (in my book at least) is for generated code, where you are ++ * not maintaining it, but may wish to read and understand it. If you single step it, you know that input() ++ * hides some indirect calls, but is always referring to the input stream. This is ++ * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig ++ * the runtime interfaces without changing the generated code too often, without ++ * confusing the reader of the generated output, who may not wish to know the gory ++ * details of the interface inheritance. ++ */ ++ ++#define CTX ctx ++ ++/* Aids in accessing scopes for grammar programmers ++ */ ++#undef SCOPE_TYPE ++#undef SCOPE_STACK ++#undef SCOPE_TOP ++#define SCOPE_TYPE(scope) pSMARTPLLexer_##scope##_SCOPE ++#define SCOPE_STACK(scope) pSMARTPLLexer_##scope##Stack ++#define SCOPE_TOP(scope) ctx->pSMARTPLLexer_##scope##Top ++#define SCOPE_SIZE(scope) ctx->pSMARTPLLexer_##scope##Stack_limit ++#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i)) ++ ++ ++/* Macros for accessing things in a lexer ++ */ ++#undef LEXER ++#undef RECOGNIZER ++#undef RULEMEMO ++#undef GETCHARINDEX ++#undef GETLINE ++#undef GETCHARPOSITIONINLINE ++#undef EMIT ++#undef EMITNEW ++#undef MATCHC ++#undef MATCHS ++#undef MATCHRANGE ++#undef LTOKEN ++#undef HASFAILED ++#undef FAILEDFLAG ++#undef INPUT ++#undef STRSTREAM ++#undef LA ++#undef HASEXCEPTION ++#undef EXCEPTION ++#undef CONSTRUCTEX ++#undef CONSUME ++#undef LRECOVER ++#undef MARK ++#undef REWIND ++#undef REWINDLAST ++#undef BACKTRACKING ++#undef MATCHANY ++#undef MEMOIZE ++#undef HAVEPARSEDRULE ++#undef GETTEXT ++#undef INDEX ++#undef SEEK ++#undef PUSHSTREAM ++#undef POPSTREAM ++#undef SETTEXT ++#undef SETTEXT8 ++ ++#define LEXER ctx->pLexer ++#define RECOGNIZER LEXER->rec ++#define LEXSTATE RECOGNIZER->state ++#define TOKSOURCE LEXSTATE->tokSource ++#define GETCHARINDEX() LEXER->getCharIndex(LEXER) ++#define GETLINE() LEXER->getLine(LEXER) ++#define GETTEXT() LEXER->getText(LEXER) ++#define GETCHARPOSITIONINLINE() LEXER->getCharPositionInLine(LEXER) ++#define EMIT() LEXSTATE->type = _type; LEXER->emit(LEXER) ++#define EMITNEW(t) LEXER->emitNew(LEXER, t) ++#define MATCHC(c) LEXER->matchc(LEXER, c) ++#define MATCHS(s) LEXER->matchs(LEXER, s) ++#define MATCHRANGE(c1,c2) LEXER->matchRange(LEXER, c1, c2) ++#define MATCHANY() LEXER->matchAny(LEXER) ++#define LTOKEN LEXSTATE->token ++#define HASFAILED() (LEXSTATE->failed == ANTLR3_TRUE) ++#define BACKTRACKING LEXSTATE->backtracking ++#define FAILEDFLAG LEXSTATE->failed ++#define INPUT LEXER->input ++#define STRSTREAM INPUT ++#define ISTREAM INPUT->istream ++#define INDEX() ISTREAM->index(ISTREAM) ++#define SEEK(n) ISTREAM->seek(ISTREAM, n) ++#define EOF_TOKEN &(LEXSTATE->tokSource->eofToken) ++#define HASEXCEPTION() (LEXSTATE->error == ANTLR3_TRUE) ++#define EXCEPTION LEXSTATE->exception ++#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER) ++#define LRECOVER() LEXER->recover(LEXER) ++#define MARK() ISTREAM->mark(ISTREAM) ++#define REWIND(m) ISTREAM->rewind(ISTREAM, m) ++#define REWINDLAST() ISTREAM->rewindLast(ISTREAM) ++#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si) ++#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r) ++#define PUSHSTREAM(str) LEXER->pushCharStream(LEXER, str) ++#define POPSTREAM() LEXER->popCharStream(LEXER) ++#define SETTEXT(str) LEXSTATE->text = str ++#define SKIP() LEXSTATE->token = &(TOKSOURCE->skipToken) ++#define USER1 LEXSTATE->user1 ++#define USER2 LEXSTATE->user2 ++#define USER3 LEXSTATE->user3 ++#define CUSTOM LEXSTATE->custom ++#define RULEMEMO LEXSTATE->ruleMemo ++#define DBG RECOGNIZER->debugger ++ ++/* If we have been told we can rely on the standard 8 bit or 16 bit input ++ * stream, then we can define our macros to use the direct pointers ++ * in the input object, which is much faster than indirect calls. This ++ * is really only significant to lexers with a lot of fragment rules (which ++ * do not place LA(1) in a temporary at the moment) and even then ++ * only if there is a lot of input (order of say 1M or so). ++ */ ++#if defined(ANTLR3_INLINE_INPUT_ASCII) || defined(ANTLR3_INLINE_INPUT_UTF16) ++ ++# ifdef ANTLR3_INLINE_INPUT_ASCII ++ ++/* 8 bit "ASCII" (actually any 8 bit character set) */ ++ ++# define NEXTCHAR ((pANTLR3_UINT8)(INPUT->nextChar)) ++# define DATAP ((pANTLR3_UINT8)(INPUT->data)) ++ ++# else ++ ++# define NEXTCHAR ((pANTLR3_UINT16)(INPUT->nextChar)) ++# define DATAP ((pANTLR3_UINT16)(INPUT->data)) ++ ++# endif ++ ++# define LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1))) ++# define CONSUME() \ ++{ \ ++ if (NEXTCHAR < (DATAP + INPUT->sizeBuf)) \ ++ { \ ++ INPUT->charPositionInLine++; \ ++ if ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar) \ ++ { \ ++ INPUT->line++; \ ++ INPUT->charPositionInLine = 0; \ ++ INPUT->currentLine = (void *)(NEXTCHAR + 1); \ ++ } \ ++ INPUT->nextChar = (void *)(NEXTCHAR + 1); \ ++ } \ ++} ++ ++#else ++ ++// Pick up the input character by calling the input stream implementation. ++// ++#define CONSUME() INPUT->istream->consume(INPUT->istream) ++#define LA(n) INPUT->istream->_LA(INPUT->istream, n) ++ ++#endif ++#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt ++ ++/* The 4 tokens defined below may well clash with your own #defines or token types. If so ++ * then for the present you must use different names for your defines as these are hard coded ++ * in the code generator. It would be better not to use such names internally, and maybe ++ * we can change this in a forthcoming release. I deliberately do not #undef these ++ * here as this will at least give you a redefined error somewhere if they clash. ++ */ ++#define UP ANTLR3_TOKEN_UP ++#define DOWN ANTLR3_TOKEN_DOWN ++#define EOR ANTLR3_TOKEN_EOR ++#define INVALID ANTLR3_TOKEN_INVALID ++ ++ ++/* ============================================================================= ++ * Functions to create and destroy scopes. First come the rule scopes, followed ++ * by the global declared scopes. ++ */ ++ ++ ++ ++/* ============================================================================= */ ++ ++/* ============================================================================= ++ * Start of recognizer ++ */ ++ ++ ++/* Forward declare the locally static matching functions we have generated and any predicate functions. ++ */ ++static ANTLR3_INLINE void mT__30 (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mT__31 (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mSTRTAG (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mINTTAG (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mDATETAG (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mENUMTAG (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mINCLUDES (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mIS (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mINTBOOL (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mGREATER (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mGREATEREQUAL (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mLESS (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mLESSEQUAL (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mEQUAL (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mAFTER (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mBEFORE (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mAGO (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mAND (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mOR (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mNOT (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mLPAR (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mRPAR (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mDATE (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mDATINTERVAL (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mENUMVAL (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mSTR (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mINT (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mWHITESPACE (pSMARTPLLexer ctx); ++static ANTLR3_INLINE void mTokens (pSMARTPLLexer ctx); ++static void SMARTPLLexerFree(pSMARTPLLexer ctx); ++ ++/* ========================================================================= ++ * Lexer matching rules end. ++ * ========================================================================= ++ */ ++ ++ ++ ++static void ++SMARTPLLexerFree (pSMARTPLLexer ctx) ++{ ++ LEXER->free(LEXER); ++ ++ ANTLR3_FREE(ctx); ++} ++ ++/** \brief Name of the grammar file that generated this code ++ */ ++static const char fileName[] = "SMARTPL.g"; ++ ++/** \brief Return the name of the grammar file that generated this code. ++ */ ++static const char * getGrammarFileName() ++{ ++ return fileName; ++} ++ ++/** \brief Create a new lexer called SMARTPLLexer ++ * ++ * \param[in] instream Pointer to an initialized input stream ++ * \return ++ * - Success pSMARTPLLexer initialized for the lex start ++ * - Fail NULL ++ */ ++ANTLR3_API pSMARTPLLexer SMARTPLLexerNew ++(pANTLR3_INPUT_STREAM instream) ++{ ++ // See if we can create a new lexer with the standard constructor ++ // ++ return SMARTPLLexerNewSSD(instream, NULL); ++} ++ ++/** \brief Create a new lexer called SMARTPLLexer ++ * ++ * \param[in] instream Pointer to an initialized input stream ++ * \param[state] state Previously created shared recognizer stat ++ * \return ++ * - Success pSMARTPLLexer initialized for the lex start ++ * - Fail NULL ++ */ ++ANTLR3_API pSMARTPLLexer SMARTPLLexerNewSSD ++(pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state) ++{ ++ pSMARTPLLexer ctx; // Context structure we will build and return ++ ++ ctx = (pSMARTPLLexer) ANTLR3_CALLOC(1, sizeof(SMARTPLLexer)); ++ ++ if (ctx == NULL) ++ { ++ // Failed to allocate memory for lexer context ++ return NULL; ++ } ++ ++ /* ------------------------------------------------------------------- ++ * Memory for basic structure is allocated, now to fill in ++ * in base ANTLR3 structures. We initialize the function pointers ++ * for the standard ANTLR3 lexer function set, but upon return ++ * from here, the programmer may set the pointers to provide custom ++ * implementations of each function. ++ * ++ * We don't use the macros defined in SMARTPLLexer.h here so you can get a sense ++ * of what goes where. ++ */ ++ ++ /* Create a base lexer, using the supplied input stream ++ */ ++ ctx->pLexer = antlr3LexerNewStream(ANTLR3_SIZE_HINT, instream, state); ++ ++ /* Check that we allocated the memory correctly ++ */ ++ if (ctx->pLexer == NULL) ++ { ++ ANTLR3_FREE(ctx); ++ return NULL; ++ } ++ /* Install the implementation of our SMARTPLLexer interface ++ */ ++ ctx->mT__30 = mT__30; ++ ctx->mT__31 = mT__31; ++ ctx->mSTRTAG = mSTRTAG; ++ ctx->mINTTAG = mINTTAG; ++ ctx->mDATETAG = mDATETAG; ++ ctx->mENUMTAG = mENUMTAG; ++ ctx->mINCLUDES = mINCLUDES; ++ ctx->mIS = mIS; ++ ctx->mINTBOOL = mINTBOOL; ++ ctx->mGREATER = mGREATER; ++ ctx->mGREATEREQUAL = mGREATEREQUAL; ++ ctx->mLESS = mLESS; ++ ctx->mLESSEQUAL = mLESSEQUAL; ++ ctx->mEQUAL = mEQUAL; ++ ctx->mAFTER = mAFTER; ++ ctx->mBEFORE = mBEFORE; ++ ctx->mAGO = mAGO; ++ ctx->mAND = mAND; ++ ctx->mOR = mOR; ++ ctx->mNOT = mNOT; ++ ctx->mLPAR = mLPAR; ++ ctx->mRPAR = mRPAR; ++ ctx->mDATE = mDATE; ++ ctx->mDATINTERVAL = mDATINTERVAL; ++ ctx->mENUMVAL = mENUMVAL; ++ ctx->mSTR = mSTR; ++ ctx->mINT = mINT; ++ ctx->mWHITESPACE = mWHITESPACE; ++ ctx->mTokens = mTokens; ++ ++ /** When the nextToken() call is made to this lexer's pANTLR3_TOKEN_SOURCE ++ * it will call mTokens() in this generated code, and will pass it the ctx ++ * pointer of this lexer, not the context of the base lexer, so store that now. ++ */ ++ ctx->pLexer->ctx = ctx; ++ ++ /**Install the token matching function ++ */ ++ ctx->pLexer->mTokens = (void (*) (void *))(mTokens); ++ ++ ctx->getGrammarFileName = getGrammarFileName; ++ ctx->free = SMARTPLLexerFree; ++ ++ ++ ++ ++ ++ /* Return the newly built lexer to the caller ++ */ ++ return ctx; ++} ++ ++ ++/* ========================================================================= ++ * Functions to match the lexer grammar defined tokens from the input stream ++ */ ++ ++// Comes from: 7:7: ( '{' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start T__30 ++ * ++ * Looks to match the characters the constitute the token T__30 ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mT__30(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = T__30; ++ ++ ++ // SMARTPL.g:7:7: ( '{' ) ++ // SMARTPL.g:7:9: '{' ++ { ++ MATCHC('{'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleT__30Ex; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleT__30Ex; /* Prevent compiler warnings */ ++ ruleT__30Ex: ; ++ ++} ++// $ANTLR end T__30 ++ ++// Comes from: 8:7: ( '}' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start T__31 ++ * ++ * Looks to match the characters the constitute the token T__31 ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mT__31(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = T__31; ++ ++ ++ // SMARTPL.g:8:7: ( '}' ) ++ // SMARTPL.g:8:9: '}' ++ { ++ MATCHC('}'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleT__31Ex; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleT__31Ex; /* Prevent compiler warnings */ ++ ruleT__31Ex: ; ++ ++} ++// $ANTLR end T__31 ++ ++// Comes from: 56:9: ( 'artist' | 'album_artist' | 'album' | 'title' | 'genre' | 'composer' | 'path' | 'type' | 'grouping' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start STRTAG ++ * ++ * Looks to match the characters the constitute the token STRTAG ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mSTRTAG(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = STRTAG; ++ ++ ++ { ++ // SMARTPL.g:56:9: ( 'artist' | 'album_artist' | 'album' | 'title' | 'genre' | 'composer' | 'path' | 'type' | 'grouping' ) ++ ++ ANTLR3_UINT32 alt1; ++ ++ alt1=9; ++ ++ switch ( LA(1) ) ++ { ++ case 'a': ++ { ++ switch ( LA(2) ) ++ { ++ case 'r': ++ { ++ alt1=1; ++ } ++ break; ++ case 'l': ++ { ++ switch ( LA(3) ) ++ { ++ case 'b': ++ { ++ switch ( LA(4) ) ++ { ++ case 'u': ++ { ++ switch ( LA(5) ) ++ { ++ case 'm': ++ { ++ switch ( LA(6) ) ++ { ++ case '_': ++ { ++ alt1=2; ++ } ++ break; ++ ++ default: ++ alt1=3;} ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 13; ++ ++ ++ goto ruleSTRTAGEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 12; ++ ++ ++ goto ruleSTRTAGEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 7; ++ ++ ++ goto ruleSTRTAGEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 1; ++ ++ ++ goto ruleSTRTAGEx; ++ } ++ ++ } ++ break; ++ case 't': ++ { ++ switch ( LA(2) ) ++ { ++ case 'i': ++ { ++ alt1=4; ++ } ++ break; ++ case 'y': ++ { ++ alt1=8; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 2; ++ ++ ++ goto ruleSTRTAGEx; ++ } ++ ++ } ++ break; ++ case 'g': ++ { ++ switch ( LA(2) ) ++ { ++ case 'e': ++ { ++ alt1=5; ++ } ++ break; ++ case 'r': ++ { ++ alt1=9; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 3; ++ ++ ++ goto ruleSTRTAGEx; ++ } ++ ++ } ++ break; ++ case 'c': ++ { ++ alt1=6; ++ } ++ break; ++ case 'p': ++ { ++ alt1=7; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 1; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleSTRTAGEx; ++ } ++ ++ switch (alt1) ++ { ++ case 1: ++ // SMARTPL.g:56:11: 'artist' ++ { ++ MATCHS(lit_1); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTRTAGEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 2: ++ // SMARTPL.g:57:6: 'album_artist' ++ { ++ MATCHS(lit_2); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTRTAGEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 3: ++ // SMARTPL.g:58:6: 'album' ++ { ++ MATCHS(lit_3); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTRTAGEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 4: ++ // SMARTPL.g:59:6: 'title' ++ { ++ MATCHS(lit_4); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTRTAGEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 5: ++ // SMARTPL.g:60:6: 'genre' ++ { ++ MATCHS(lit_5); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTRTAGEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 6: ++ // SMARTPL.g:61:6: 'composer' ++ { ++ MATCHS(lit_6); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTRTAGEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 7: ++ // SMARTPL.g:62:6: 'path' ++ { ++ MATCHS(lit_7); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTRTAGEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 8: ++ // SMARTPL.g:63:6: 'type' ++ { ++ MATCHS(lit_8); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTRTAGEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 9: ++ // SMARTPL.g:64:6: 'grouping' ++ { ++ MATCHS(lit_9); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTRTAGEx; ++ } ++ ++ ++ ++ } ++ break; ++ ++ } ++ } ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleSTRTAGEx; /* Prevent compiler warnings */ ++ ruleSTRTAGEx: ; ++ ++} ++// $ANTLR end STRTAG ++ ++// Comes from: 67:9: ( 'play_count' | 'rating' | 'year' | 'compilation' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start INTTAG ++ * ++ * Looks to match the characters the constitute the token INTTAG ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mINTTAG(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = INTTAG; ++ ++ ++ { ++ // SMARTPL.g:67:9: ( 'play_count' | 'rating' | 'year' | 'compilation' ) ++ ++ ANTLR3_UINT32 alt2; ++ ++ alt2=4; ++ ++ switch ( LA(1) ) ++ { ++ case 'p': ++ { ++ alt2=1; ++ } ++ break; ++ case 'r': ++ { ++ alt2=2; ++ } ++ break; ++ case 'y': ++ { ++ alt2=3; ++ } ++ break; ++ case 'c': ++ { ++ alt2=4; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 2; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleINTTAGEx; ++ } ++ ++ switch (alt2) ++ { ++ case 1: ++ // SMARTPL.g:67:11: 'play_count' ++ { ++ MATCHS(lit_10); ++ if (HASEXCEPTION()) ++ { ++ goto ruleINTTAGEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 2: ++ // SMARTPL.g:68:6: 'rating' ++ { ++ MATCHS(lit_11); ++ if (HASEXCEPTION()) ++ { ++ goto ruleINTTAGEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 3: ++ // SMARTPL.g:69:6: 'year' ++ { ++ MATCHS(lit_12); ++ if (HASEXCEPTION()) ++ { ++ goto ruleINTTAGEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 4: ++ // SMARTPL.g:70:6: 'compilation' ++ { ++ MATCHS(lit_13); ++ if (HASEXCEPTION()) ++ { ++ goto ruleINTTAGEx; ++ } ++ ++ ++ ++ } ++ break; ++ ++ } ++ } ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleINTTAGEx; /* Prevent compiler warnings */ ++ ruleINTTAGEx: ; ++ ++} ++// $ANTLR end INTTAG ++ ++// Comes from: 73:10: ( 'time_added' | 'time_played' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start DATETAG ++ * ++ * Looks to match the characters the constitute the token DATETAG ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mDATETAG(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = DATETAG; ++ ++ ++ { ++ // SMARTPL.g:73:10: ( 'time_added' | 'time_played' ) ++ ++ ANTLR3_UINT32 alt3; ++ ++ alt3=2; ++ ++ switch ( LA(1) ) ++ { ++ case 't': ++ { ++ switch ( LA(2) ) ++ { ++ case 'i': ++ { ++ switch ( LA(3) ) ++ { ++ case 'm': ++ { ++ switch ( LA(4) ) ++ { ++ case 'e': ++ { ++ switch ( LA(5) ) ++ { ++ case '_': ++ { ++ switch ( LA(6) ) ++ { ++ case 'a': ++ { ++ alt3=1; ++ } ++ break; ++ case 'p': ++ { ++ alt3=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 3; ++ EXCEPTION->state = 5; ++ ++ ++ goto ruleDATETAGEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 3; ++ EXCEPTION->state = 4; ++ ++ ++ goto ruleDATETAGEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 3; ++ EXCEPTION->state = 3; ++ ++ ++ goto ruleDATETAGEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 3; ++ EXCEPTION->state = 2; ++ ++ ++ goto ruleDATETAGEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 3; ++ EXCEPTION->state = 1; ++ ++ ++ goto ruleDATETAGEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 3; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleDATETAGEx; ++ } ++ ++ switch (alt3) ++ { ++ case 1: ++ // SMARTPL.g:73:12: 'time_added' ++ { ++ MATCHS(lit_14); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATETAGEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 2: ++ // SMARTPL.g:74:6: 'time_played' ++ { ++ MATCHS(lit_15); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATETAGEx; ++ } ++ ++ ++ ++ } ++ break; ++ ++ } ++ } ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleDATETAGEx; /* Prevent compiler warnings */ ++ ruleDATETAGEx: ; ++ ++} ++// $ANTLR end DATETAG ++ ++// Comes from: 77:10: ( 'data_kind' | 'media_kind' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start ENUMTAG ++ * ++ * Looks to match the characters the constitute the token ENUMTAG ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mENUMTAG(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = ENUMTAG; ++ ++ ++ { ++ // SMARTPL.g:77:10: ( 'data_kind' | 'media_kind' ) ++ ++ ANTLR3_UINT32 alt4; ++ ++ alt4=2; ++ ++ switch ( LA(1) ) ++ { ++ case 'd': ++ { ++ alt4=1; ++ } ++ break; ++ case 'm': ++ { ++ alt4=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 4; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleENUMTAGEx; ++ } ++ ++ switch (alt4) ++ { ++ case 1: ++ // SMARTPL.g:77:12: 'data_kind' ++ { ++ MATCHS(lit_16); ++ if (HASEXCEPTION()) ++ { ++ goto ruleENUMTAGEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 2: ++ // SMARTPL.g:78:6: 'media_kind' ++ { ++ MATCHS(lit_17); ++ if (HASEXCEPTION()) ++ { ++ goto ruleENUMTAGEx; ++ } ++ ++ ++ ++ } ++ break; ++ ++ } ++ } ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleENUMTAGEx; /* Prevent compiler warnings */ ++ ruleENUMTAGEx: ; ++ ++} ++// $ANTLR end ENUMTAG ++ ++// Comes from: 81:10: ( 'includes' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start INCLUDES ++ * ++ * Looks to match the characters the constitute the token INCLUDES ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mINCLUDES(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = INCLUDES; ++ ++ ++ // SMARTPL.g:81:10: ( 'includes' ) ++ // SMARTPL.g:81:12: 'includes' ++ { ++ MATCHS(lit_18); ++ if (HASEXCEPTION()) ++ { ++ goto ruleINCLUDESEx; ++ } ++ ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleINCLUDESEx; /* Prevent compiler warnings */ ++ ruleINCLUDESEx: ; ++ ++} ++// $ANTLR end INCLUDES ++ ++// Comes from: 84:6: ( 'is' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start IS ++ * ++ * Looks to match the characters the constitute the token IS ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mIS(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = IS; ++ ++ ++ // SMARTPL.g:84:6: ( 'is' ) ++ // SMARTPL.g:84:8: 'is' ++ { ++ MATCHS(lit_19); ++ if (HASEXCEPTION()) ++ { ++ goto ruleISEx; ++ } ++ ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleISEx; /* Prevent compiler warnings */ ++ ruleISEx: ; ++ ++} ++// $ANTLR end IS ++ ++// Comes from: 87:10: ( ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL ) ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start INTBOOL ++ * ++ * Looks to match the characters the constitute the token INTBOOL ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mINTBOOL(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = INTBOOL; ++ ++ ++ // SMARTPL.g:87:10: ( ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL ) ) ++ // SMARTPL.g:87:12: ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL ) ++ { ++ ++ // SMARTPL.g:87:12: ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL ) ++ { ++ int alt5=5; ++ switch ( LA(1) ) ++ { ++ case '>': ++ { ++ switch ( LA(2) ) ++ { ++ case '=': ++ { ++ alt5=2; ++ } ++ break; ++ ++ default: ++ alt5=1;} ++ ++ } ++ break; ++ case '<': ++ { ++ switch ( LA(2) ) ++ { ++ case '=': ++ { ++ alt5=4; ++ } ++ break; ++ ++ default: ++ alt5=3;} ++ ++ } ++ break; ++ case '=': ++ { ++ alt5=5; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 5; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleINTBOOLEx; ++ } ++ ++ switch (alt5) ++ { ++ case 1: ++ // SMARTPL.g:87:13: GREATER ++ { ++ /* 87:13: GREATER */ ++ mGREATER(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleINTBOOLEx; ++ } ++ ++ ++ } ++ break; ++ case 2: ++ // SMARTPL.g:87:21: GREATEREQUAL ++ { ++ /* 87:21: GREATEREQUAL */ ++ mGREATEREQUAL(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleINTBOOLEx; ++ } ++ ++ ++ } ++ break; ++ case 3: ++ // SMARTPL.g:87:34: LESS ++ { ++ /* 87:34: LESS */ ++ mLESS(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleINTBOOLEx; ++ } ++ ++ ++ } ++ break; ++ case 4: ++ // SMARTPL.g:87:39: LESSEQUAL ++ { ++ /* 87:39: LESSEQUAL */ ++ mLESSEQUAL(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleINTBOOLEx; ++ } ++ ++ ++ } ++ break; ++ case 5: ++ // SMARTPL.g:87:49: EQUAL ++ { ++ /* 87:49: EQUAL */ ++ mEQUAL(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleINTBOOLEx; ++ } ++ ++ ++ } ++ break; ++ ++ } ++ } ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleINTBOOLEx; /* Prevent compiler warnings */ ++ ruleINTBOOLEx: ; ++ ++} ++// $ANTLR end INTBOOL ++ ++// Comes from: 91:10: ( '>' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start GREATER ++ * ++ * Looks to match the characters the constitute the token GREATER ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mGREATER(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ ++ // SMARTPL.g:91:10: ( '>' ) ++ // SMARTPL.g:91:12: '>' ++ { ++ MATCHC('>'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleGREATEREx; ++ } ++ ++ ++ } ++ ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleGREATEREx; /* Prevent compiler warnings */ ++ ruleGREATEREx: ; ++ ++} ++// $ANTLR end GREATER ++ ++// Comes from: 95:13: ( '>=' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start GREATEREQUAL ++ * ++ * Looks to match the characters the constitute the token GREATEREQUAL ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mGREATEREQUAL(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ ++ // SMARTPL.g:95:13: ( '>=' ) ++ // SMARTPL.g:95:15: '>=' ++ { ++ MATCHS(lit_20); ++ if (HASEXCEPTION()) ++ { ++ goto ruleGREATEREQUALEx; ++ } ++ ++ ++ ++ } ++ ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleGREATEREQUALEx; /* Prevent compiler warnings */ ++ ruleGREATEREQUALEx: ; ++ ++} ++// $ANTLR end GREATEREQUAL ++ ++// Comes from: 99:7: ( '<' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start LESS ++ * ++ * Looks to match the characters the constitute the token LESS ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mLESS(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ ++ // SMARTPL.g:99:7: ( '<' ) ++ // SMARTPL.g:99:9: '<' ++ { ++ MATCHC('<'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleLESSEx; ++ } ++ ++ ++ } ++ ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleLESSEx; /* Prevent compiler warnings */ ++ ruleLESSEx: ; ++ ++} ++// $ANTLR end LESS ++ ++// Comes from: 103:11: ( '<=' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start LESSEQUAL ++ * ++ * Looks to match the characters the constitute the token LESSEQUAL ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mLESSEQUAL(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ ++ // SMARTPL.g:103:11: ( '<=' ) ++ // SMARTPL.g:103:13: '<=' ++ { ++ MATCHS(lit_21); ++ if (HASEXCEPTION()) ++ { ++ goto ruleLESSEQUALEx; ++ } ++ ++ ++ ++ } ++ ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleLESSEQUALEx; /* Prevent compiler warnings */ ++ ruleLESSEQUALEx: ; ++ ++} ++// $ANTLR end LESSEQUAL ++ ++// Comes from: 107:8: ( '=' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start EQUAL ++ * ++ * Looks to match the characters the constitute the token EQUAL ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mEQUAL(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ ++ // SMARTPL.g:107:8: ( '=' ) ++ // SMARTPL.g:107:10: '=' ++ { ++ MATCHC('='); ++ if (HASEXCEPTION()) ++ { ++ goto ruleEQUALEx; ++ } ++ ++ ++ } ++ ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleEQUALEx; /* Prevent compiler warnings */ ++ ruleEQUALEx: ; ++ ++} ++// $ANTLR end EQUAL ++ ++// Comes from: 110:8: ( 'after' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start AFTER ++ * ++ * Looks to match the characters the constitute the token AFTER ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mAFTER(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = AFTER; ++ ++ ++ // SMARTPL.g:110:8: ( 'after' ) ++ // SMARTPL.g:110:10: 'after' ++ { ++ MATCHS(lit_22); ++ if (HASEXCEPTION()) ++ { ++ goto ruleAFTEREx; ++ } ++ ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleAFTEREx; /* Prevent compiler warnings */ ++ ruleAFTEREx: ; ++ ++} ++// $ANTLR end AFTER ++ ++// Comes from: 113:9: ( 'before' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start BEFORE ++ * ++ * Looks to match the characters the constitute the token BEFORE ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mBEFORE(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = BEFORE; ++ ++ ++ // SMARTPL.g:113:9: ( 'before' ) ++ // SMARTPL.g:113:11: 'before' ++ { ++ MATCHS(lit_23); ++ if (HASEXCEPTION()) ++ { ++ goto ruleBEFOREEx; ++ } ++ ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleBEFOREEx; /* Prevent compiler warnings */ ++ ruleBEFOREEx: ; ++ ++} ++// $ANTLR end BEFORE ++ ++// Comes from: 116:7: ( 'ago' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start AGO ++ * ++ * Looks to match the characters the constitute the token AGO ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mAGO(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = AGO; ++ ++ ++ // SMARTPL.g:116:7: ( 'ago' ) ++ // SMARTPL.g:116:9: 'ago' ++ { ++ MATCHS(lit_24); ++ if (HASEXCEPTION()) ++ { ++ goto ruleAGOEx; ++ } ++ ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleAGOEx; /* Prevent compiler warnings */ ++ ruleAGOEx: ; ++ ++} ++// $ANTLR end AGO ++ ++// Comes from: 119:7: ( 'AND' | 'and' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start AND ++ * ++ * Looks to match the characters the constitute the token AND ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mAND(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = AND; ++ ++ ++ { ++ // SMARTPL.g:119:7: ( 'AND' | 'and' ) ++ ++ ANTLR3_UINT32 alt6; ++ ++ alt6=2; ++ ++ switch ( LA(1) ) ++ { ++ case 'A': ++ { ++ alt6=1; ++ } ++ break; ++ case 'a': ++ { ++ alt6=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 6; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleANDEx; ++ } ++ ++ switch (alt6) ++ { ++ case 1: ++ // SMARTPL.g:119:9: 'AND' ++ { ++ MATCHS(lit_25); ++ if (HASEXCEPTION()) ++ { ++ goto ruleANDEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 2: ++ // SMARTPL.g:120:6: 'and' ++ { ++ MATCHS(lit_26); ++ if (HASEXCEPTION()) ++ { ++ goto ruleANDEx; ++ } ++ ++ ++ ++ } ++ break; ++ ++ } ++ } ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleANDEx; /* Prevent compiler warnings */ ++ ruleANDEx: ; ++ ++} ++// $ANTLR end AND ++ ++// Comes from: 123:6: ( 'OR' | 'or' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start OR ++ * ++ * Looks to match the characters the constitute the token OR ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mOR(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = OR; ++ ++ ++ { ++ // SMARTPL.g:123:6: ( 'OR' | 'or' ) ++ ++ ANTLR3_UINT32 alt7; ++ ++ alt7=2; ++ ++ switch ( LA(1) ) ++ { ++ case 'O': ++ { ++ alt7=1; ++ } ++ break; ++ case 'o': ++ { ++ alt7=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 7; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleOREx; ++ } ++ ++ switch (alt7) ++ { ++ case 1: ++ // SMARTPL.g:123:8: 'OR' ++ { ++ MATCHS(lit_27); ++ if (HASEXCEPTION()) ++ { ++ goto ruleOREx; ++ } ++ ++ ++ ++ } ++ break; ++ case 2: ++ // SMARTPL.g:124:6: 'or' ++ { ++ MATCHS(lit_28); ++ if (HASEXCEPTION()) ++ { ++ goto ruleOREx; ++ } ++ ++ ++ ++ } ++ break; ++ ++ } ++ } ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleOREx; /* Prevent compiler warnings */ ++ ruleOREx: ; ++ ++} ++// $ANTLR end OR ++ ++// Comes from: 127:7: ( 'NOT' | 'not' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start NOT ++ * ++ * Looks to match the characters the constitute the token NOT ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mNOT(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = NOT; ++ ++ ++ { ++ // SMARTPL.g:127:7: ( 'NOT' | 'not' ) ++ ++ ANTLR3_UINT32 alt8; ++ ++ alt8=2; ++ ++ switch ( LA(1) ) ++ { ++ case 'N': ++ { ++ alt8=1; ++ } ++ break; ++ case 'n': ++ { ++ alt8=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 8; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleNOTEx; ++ } ++ ++ switch (alt8) ++ { ++ case 1: ++ // SMARTPL.g:127:9: 'NOT' ++ { ++ MATCHS(lit_29); ++ if (HASEXCEPTION()) ++ { ++ goto ruleNOTEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 2: ++ // SMARTPL.g:128:6: 'not' ++ { ++ MATCHS(lit_30); ++ if (HASEXCEPTION()) ++ { ++ goto ruleNOTEx; ++ } ++ ++ ++ ++ } ++ break; ++ ++ } ++ } ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleNOTEx; /* Prevent compiler warnings */ ++ ruleNOTEx: ; ++ ++} ++// $ANTLR end NOT ++ ++// Comes from: 131:7: ( '(' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start LPAR ++ * ++ * Looks to match the characters the constitute the token LPAR ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mLPAR(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = LPAR; ++ ++ ++ // SMARTPL.g:131:7: ( '(' ) ++ // SMARTPL.g:131:9: '(' ++ { ++ MATCHC('('); ++ if (HASEXCEPTION()) ++ { ++ goto ruleLPAREx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleLPAREx; /* Prevent compiler warnings */ ++ ruleLPAREx: ; ++ ++} ++// $ANTLR end LPAR ++ ++// Comes from: 134:7: ( ')' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start RPAR ++ * ++ * Looks to match the characters the constitute the token RPAR ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mRPAR(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = RPAR; ++ ++ ++ // SMARTPL.g:134:7: ( ')' ) ++ // SMARTPL.g:134:9: ')' ++ { ++ MATCHC(')'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleRPAREx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleRPAREx; /* Prevent compiler warnings */ ++ ruleRPAREx: ; ++ ++} ++// $ANTLR end RPAR ++ ++// Comes from: 137:7: ( ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) '-' ( '0' .. '1' ) ( '0' .. '9' ) '-' ( '0' .. '3' ) ( '0' .. '9' ) | 'today' | 'yesterday' | 'last week' | 'last month' | 'last year' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start DATE ++ * ++ * Looks to match the characters the constitute the token DATE ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mDATE(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = DATE; ++ ++ ++ { ++ // SMARTPL.g:137:7: ( ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) '-' ( '0' .. '1' ) ( '0' .. '9' ) '-' ( '0' .. '3' ) ( '0' .. '9' ) | 'today' | 'yesterday' | 'last week' | 'last month' | 'last year' ) ++ ++ ANTLR3_UINT32 alt9; ++ ++ alt9=6; ++ ++ switch ( LA(1) ) ++ { ++ case '0': ++ case '1': ++ case '2': ++ case '3': ++ case '4': ++ case '5': ++ case '6': ++ case '7': ++ case '8': ++ case '9': ++ { ++ alt9=1; ++ } ++ break; ++ case 't': ++ { ++ alt9=2; ++ } ++ break; ++ case 'y': ++ { ++ alt9=3; ++ } ++ break; ++ case 'l': ++ { ++ switch ( LA(2) ) ++ { ++ case 'a': ++ { ++ switch ( LA(3) ) ++ { ++ case 's': ++ { ++ switch ( LA(4) ) ++ { ++ case 't': ++ { ++ switch ( LA(5) ) ++ { ++ case ' ': ++ { ++ switch ( LA(6) ) ++ { ++ case 'w': ++ { ++ alt9=4; ++ } ++ break; ++ case 'm': ++ { ++ alt9=5; ++ } ++ break; ++ case 'y': ++ { ++ alt9=6; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 9; ++ EXCEPTION->state = 8; ++ ++ ++ goto ruleDATEEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 9; ++ EXCEPTION->state = 7; ++ ++ ++ goto ruleDATEEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 9; ++ EXCEPTION->state = 6; ++ ++ ++ goto ruleDATEEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 9; ++ EXCEPTION->state = 5; ++ ++ ++ goto ruleDATEEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 9; ++ EXCEPTION->state = 4; ++ ++ ++ goto ruleDATEEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 9; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleDATEEx; ++ } ++ ++ switch (alt9) ++ { ++ case 1: ++ // SMARTPL.g:137:9: ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) '-' ( '0' .. '1' ) ( '0' .. '9' ) '-' ( '0' .. '3' ) ( '0' .. '9' ) ++ { ++ // SMARTPL.g:137:9: ( '0' .. '9' ) ++ // SMARTPL.g:137:10: '0' .. '9' ++ { ++ MATCHRANGE('0', '9'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ } ++ ++ // SMARTPL.g:137:19: ( '0' .. '9' ) ++ // SMARTPL.g:137:20: '0' .. '9' ++ { ++ MATCHRANGE('0', '9'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ } ++ ++ // SMARTPL.g:137:29: ( '0' .. '9' ) ++ // SMARTPL.g:137:30: '0' .. '9' ++ { ++ MATCHRANGE('0', '9'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ } ++ ++ // SMARTPL.g:137:39: ( '0' .. '9' ) ++ // SMARTPL.g:137:40: '0' .. '9' ++ { ++ MATCHRANGE('0', '9'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ } ++ ++ MATCHC('-'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ // SMARTPL.g:137:52: ( '0' .. '1' ) ++ // SMARTPL.g:137:53: '0' .. '1' ++ { ++ MATCHRANGE('0', '1'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ } ++ ++ // SMARTPL.g:137:62: ( '0' .. '9' ) ++ // SMARTPL.g:137:63: '0' .. '9' ++ { ++ MATCHRANGE('0', '9'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ } ++ ++ MATCHC('-'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ // SMARTPL.g:137:75: ( '0' .. '3' ) ++ // SMARTPL.g:137:76: '0' .. '3' ++ { ++ MATCHRANGE('0', '3'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ } ++ ++ // SMARTPL.g:137:85: ( '0' .. '9' ) ++ // SMARTPL.g:137:86: '0' .. '9' ++ { ++ MATCHRANGE('0', '9'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ } ++ ++ ++ } ++ break; ++ case 2: ++ // SMARTPL.g:138:6: 'today' ++ { ++ MATCHS(lit_31); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 3: ++ // SMARTPL.g:139:6: 'yesterday' ++ { ++ MATCHS(lit_32); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 4: ++ // SMARTPL.g:140:6: 'last week' ++ { ++ MATCHS(lit_33); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 5: ++ // SMARTPL.g:141:6: 'last month' ++ { ++ MATCHS(lit_34); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 6: ++ // SMARTPL.g:142:6: 'last year' ++ { ++ MATCHS(lit_35); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATEEx; ++ } ++ ++ ++ ++ } ++ break; ++ ++ } ++ } ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleDATEEx; /* Prevent compiler warnings */ ++ ruleDATEEx: ; ++ ++} ++// $ANTLR end DATE ++ ++// Comes from: 145:13: ( 'days' | 'weeks' | 'months' | 'years' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start DATINTERVAL ++ * ++ * Looks to match the characters the constitute the token DATINTERVAL ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mDATINTERVAL(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = DATINTERVAL; ++ ++ ++ { ++ // SMARTPL.g:145:13: ( 'days' | 'weeks' | 'months' | 'years' ) ++ ++ ANTLR3_UINT32 alt10; ++ ++ alt10=4; ++ ++ switch ( LA(1) ) ++ { ++ case 'd': ++ { ++ alt10=1; ++ } ++ break; ++ case 'w': ++ { ++ alt10=2; ++ } ++ break; ++ case 'm': ++ { ++ alt10=3; ++ } ++ break; ++ case 'y': ++ { ++ alt10=4; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 10; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleDATINTERVALEx; ++ } ++ ++ switch (alt10) ++ { ++ case 1: ++ // SMARTPL.g:145:15: 'days' ++ { ++ MATCHS(lit_36); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATINTERVALEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 2: ++ // SMARTPL.g:146:6: 'weeks' ++ { ++ MATCHS(lit_37); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATINTERVALEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 3: ++ // SMARTPL.g:147:6: 'months' ++ { ++ MATCHS(lit_38); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATINTERVALEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 4: ++ // SMARTPL.g:148:6: 'years' ++ { ++ MATCHS(lit_39); ++ if (HASEXCEPTION()) ++ { ++ goto ruleDATINTERVALEx; ++ } ++ ++ ++ ++ } ++ break; ++ ++ } ++ } ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleDATINTERVALEx; /* Prevent compiler warnings */ ++ ruleDATINTERVALEx: ; ++ ++} ++// $ANTLR end DATINTERVAL ++ ++// Comes from: 151:10: ( 'music' | 'movie' | 'podcast' | 'audiobook' | 'tvshow' | 'file' | 'url' | 'spotify' | 'pipe' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start ENUMVAL ++ * ++ * Looks to match the characters the constitute the token ENUMVAL ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mENUMVAL(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = ENUMVAL; ++ ++ ++ { ++ // SMARTPL.g:151:10: ( 'music' | 'movie' | 'podcast' | 'audiobook' | 'tvshow' | 'file' | 'url' | 'spotify' | 'pipe' ) ++ ++ ANTLR3_UINT32 alt11; ++ ++ alt11=9; ++ ++ switch ( LA(1) ) ++ { ++ case 'm': ++ { ++ switch ( LA(2) ) ++ { ++ case 'u': ++ { ++ alt11=1; ++ } ++ break; ++ case 'o': ++ { ++ alt11=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 11; ++ EXCEPTION->state = 1; ++ ++ ++ goto ruleENUMVALEx; ++ } ++ ++ } ++ break; ++ case 'p': ++ { ++ switch ( LA(2) ) ++ { ++ case 'o': ++ { ++ alt11=3; ++ } ++ break; ++ case 'i': ++ { ++ alt11=9; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 11; ++ EXCEPTION->state = 2; ++ ++ ++ goto ruleENUMVALEx; ++ } ++ ++ } ++ break; ++ case 'a': ++ { ++ alt11=4; ++ } ++ break; ++ case 't': ++ { ++ alt11=5; ++ } ++ break; ++ case 'f': ++ { ++ alt11=6; ++ } ++ break; ++ case 'u': ++ { ++ alt11=7; ++ } ++ break; ++ case 's': ++ { ++ alt11=8; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 11; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleENUMVALEx; ++ } ++ ++ switch (alt11) ++ { ++ case 1: ++ // SMARTPL.g:151:12: 'music' ++ { ++ MATCHS(lit_40); ++ if (HASEXCEPTION()) ++ { ++ goto ruleENUMVALEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 2: ++ // SMARTPL.g:152:6: 'movie' ++ { ++ MATCHS(lit_41); ++ if (HASEXCEPTION()) ++ { ++ goto ruleENUMVALEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 3: ++ // SMARTPL.g:153:6: 'podcast' ++ { ++ MATCHS(lit_42); ++ if (HASEXCEPTION()) ++ { ++ goto ruleENUMVALEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 4: ++ // SMARTPL.g:154:6: 'audiobook' ++ { ++ MATCHS(lit_43); ++ if (HASEXCEPTION()) ++ { ++ goto ruleENUMVALEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 5: ++ // SMARTPL.g:155:6: 'tvshow' ++ { ++ MATCHS(lit_44); ++ if (HASEXCEPTION()) ++ { ++ goto ruleENUMVALEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 6: ++ // SMARTPL.g:156:6: 'file' ++ { ++ MATCHS(lit_45); ++ if (HASEXCEPTION()) ++ { ++ goto ruleENUMVALEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 7: ++ // SMARTPL.g:157:6: 'url' ++ { ++ MATCHS(lit_46); ++ if (HASEXCEPTION()) ++ { ++ goto ruleENUMVALEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 8: ++ // SMARTPL.g:158:6: 'spotify' ++ { ++ MATCHS(lit_47); ++ if (HASEXCEPTION()) ++ { ++ goto ruleENUMVALEx; ++ } ++ ++ ++ ++ } ++ break; ++ case 9: ++ // SMARTPL.g:159:6: 'pipe' ++ { ++ MATCHS(lit_48); ++ if (HASEXCEPTION()) ++ { ++ goto ruleENUMVALEx; ++ } ++ ++ ++ ++ } ++ break; ++ ++ } ++ } ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleENUMVALEx; /* Prevent compiler warnings */ ++ ruleENUMVALEx: ; ++ ++} ++// $ANTLR end ENUMVAL ++ ++// Comes from: 162:7: ( '\"' (~ ( '\"' ) )+ '\"' ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start STR ++ * ++ * Looks to match the characters the constitute the token STR ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mSTR(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = STR; ++ ++ ++ // SMARTPL.g:162:7: ( '\"' (~ ( '\"' ) )+ '\"' ) ++ // SMARTPL.g:162:9: '\"' (~ ( '\"' ) )+ '\"' ++ { ++ MATCHC('"'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTREx; ++ } ++ ++ // SMARTPL.g:162:13: (~ ( '\"' ) )+ ++ { ++ int cnt12=0; ++ ++ for (;;) ++ { ++ int alt12=2; ++ { ++ /* dfaLoopbackState(k,edges,eotPredictsAlt,description,stateNumber,semPredState) ++ */ ++ int LA12_0 = LA(1); ++ if ( (((LA12_0 >= 0x0000) && (LA12_0 <= '!')) || ((LA12_0 >= '#') && (LA12_0 <= 0xFFFF))) ) ++ { ++ alt12=1; ++ } ++ ++ } ++ switch (alt12) ++ { ++ case 1: ++ // SMARTPL.g:162:13: ~ ( '\"' ) ++ { ++ if ( ((LA(1) >= 0x0000) && (LA(1) <= '!')) || ((LA(1) >= '#') && (LA(1) <= 0xFFFF)) ) ++ { ++ CONSUME(); ++ ++ } ++ else ++ { ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION; ++ EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME; ++ ++ LRECOVER(); goto ruleSTREx; ++ } ++ ++ ++ } ++ break; ++ ++ default: ++ ++ if ( cnt12 >= 1 ) ++ { ++ goto loop12; ++ } ++ /* mismatchedSetEx() ++ */ ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION; ++ EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME; ++ ++ ++ goto ruleSTREx; ++ } ++ cnt12++; ++ } ++ loop12: ; /* Jump to here if this rule does not match */ ++ } ++ MATCHC('"'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleSTREx; ++ } ++ ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleSTREx; /* Prevent compiler warnings */ ++ ruleSTREx: ; ++ ++} ++// $ANTLR end STR ++ ++// Comes from: 165:7: ( ( '0' .. '9' )+ ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start INT ++ * ++ * Looks to match the characters the constitute the token INT ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mINT(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = INT; ++ ++ ++ // SMARTPL.g:165:7: ( ( '0' .. '9' )+ ) ++ // SMARTPL.g:165:9: ( '0' .. '9' )+ ++ { ++ // SMARTPL.g:165:9: ( '0' .. '9' )+ ++ { ++ int cnt13=0; ++ ++ for (;;) ++ { ++ int alt13=2; ++ switch ( LA(1) ) ++ { ++ case '0': ++ case '1': ++ case '2': ++ case '3': ++ case '4': ++ case '5': ++ case '6': ++ case '7': ++ case '8': ++ case '9': ++ { ++ alt13=1; ++ } ++ break; ++ ++ } ++ ++ switch (alt13) ++ { ++ case 1: ++ // SMARTPL.g:165:10: '0' .. '9' ++ { ++ MATCHRANGE('0', '9'); ++ if (HASEXCEPTION()) ++ { ++ goto ruleINTEx; ++ } ++ ++ ++ } ++ break; ++ ++ default: ++ ++ if ( cnt13 >= 1 ) ++ { ++ goto loop13; ++ } ++ /* mismatchedSetEx() ++ */ ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION; ++ EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME; ++ ++ ++ goto ruleINTEx; ++ } ++ cnt13++; ++ } ++ loop13: ; /* Jump to here if this rule does not match */ ++ } ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleINTEx; /* Prevent compiler warnings */ ++ ruleINTEx: ; ++ ++} ++// $ANTLR end INT ++ ++// Comes from: 168:12: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' ) ) ++/** \brief Lexer rule generated by ANTLR3 ++ * ++ * $ANTLR start WHITESPACE ++ * ++ * Looks to match the characters the constitute the token WHITESPACE ++ * from the attached input stream. ++ * ++ * ++ * \remark ++ * - lexer->error == ANTLR3_TRUE if an exception was thrown. ++ */ ++static ANTLR3_INLINE ++void mWHITESPACE(pSMARTPLLexer ctx) ++{ ++ ANTLR3_UINT32 _type; ++ ++ _type = WHITESPACE; ++ ++ ++ // SMARTPL.g:168:12: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' ) ) ++ // SMARTPL.g:168:14: ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' ) ++ { ++ if ( ((LA(1) >= '\t') && (LA(1) <= '\n')) || ((LA(1) >= '\f') && (LA(1) <= '\r')) || LA(1) == ' ' ) ++ { ++ CONSUME(); ++ ++ } ++ else ++ { ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION; ++ EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME; ++ ++ LRECOVER(); goto ruleWHITESPACEEx; ++ } ++ ++ { ++ LEXSTATE->channel = HIDDEN; ++ } ++ ++ } ++ ++ LEXSTATE->type = _type; ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleWHITESPACEEx; /* Prevent compiler warnings */ ++ ruleWHITESPACEEx: ; ++ ++} ++// $ANTLR end WHITESPACE ++ ++/** This is the entry point in to the lexer from an object that ++ * wants to generate the next token, such as a pCOMMON_TOKEN_STREAM ++ */ ++static void ++mTokens(pSMARTPLLexer ctx) ++{ ++ { ++ // SMARTPL.g:1:8: ( T__30 | T__31 | STRTAG | INTTAG | DATETAG | ENUMTAG | INCLUDES | IS | INTBOOL | AFTER | BEFORE | AGO | AND | OR | NOT | LPAR | RPAR | DATE | DATINTERVAL | ENUMVAL | STR | INT | WHITESPACE ) ++ ++ ANTLR3_UINT32 alt14; ++ ++ alt14=23; ++ ++ switch ( LA(1) ) ++ { ++ case '{': ++ { ++ alt14=1; ++ } ++ break; ++ case '}': ++ { ++ alt14=2; ++ } ++ break; ++ case 'a': ++ { ++ switch ( LA(2) ) ++ { ++ case 'l': ++ case 'r': ++ { ++ alt14=3; ++ } ++ break; ++ case 'f': ++ { ++ alt14=10; ++ } ++ break; ++ case 'g': ++ { ++ alt14=12; ++ } ++ break; ++ case 'n': ++ { ++ alt14=13; ++ } ++ break; ++ case 'u': ++ { ++ alt14=20; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 14; ++ EXCEPTION->state = 3; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 't': ++ { ++ switch ( LA(2) ) ++ { ++ case 'i': ++ { ++ switch ( LA(3) ) ++ { ++ case 't': ++ { ++ alt14=3; ++ } ++ break; ++ case 'm': ++ { ++ alt14=5; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 14; ++ EXCEPTION->state = 28; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 'y': ++ { ++ alt14=3; ++ } ++ break; ++ case 'o': ++ { ++ alt14=18; ++ } ++ break; ++ case 'v': ++ { ++ alt14=20; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 14; ++ EXCEPTION->state = 4; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 'g': ++ { ++ alt14=3; ++ } ++ break; ++ case 'c': ++ { ++ switch ( LA(2) ) ++ { ++ case 'o': ++ { ++ switch ( LA(3) ) ++ { ++ case 'm': ++ { ++ switch ( LA(4) ) ++ { ++ case 'p': ++ { ++ switch ( LA(5) ) ++ { ++ case 'o': ++ { ++ alt14=3; ++ } ++ break; ++ case 'i': ++ { ++ alt14=4; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 14; ++ EXCEPTION->state = 42; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 14; ++ EXCEPTION->state = 39; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 14; ++ EXCEPTION->state = 29; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 14; ++ EXCEPTION->state = 6; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 'p': ++ { ++ switch ( LA(2) ) ++ { ++ case 'a': ++ { ++ alt14=3; ++ } ++ break; ++ case 'l': ++ { ++ alt14=4; ++ } ++ break; ++ case 'i': ++ case 'o': ++ { ++ alt14=20; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 14; ++ EXCEPTION->state = 7; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 'r': ++ { ++ alt14=4; ++ } ++ break; ++ case 'y': ++ { ++ switch ( LA(2) ) ++ { ++ case 'e': ++ { ++ switch ( LA(3) ) ++ { ++ case 'a': ++ { ++ switch ( LA(4) ) ++ { ++ case 'r': ++ { ++ switch ( LA(5) ) ++ { ++ case 's': ++ { ++ alt14=19; ++ } ++ break; ++ ++ default: ++ alt14=4;} ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 14; ++ EXCEPTION->state = 40; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 's': ++ { ++ alt14=18; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 14; ++ EXCEPTION->state = 30; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 14; ++ EXCEPTION->state = 9; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 'd': ++ { ++ switch ( LA(2) ) ++ { ++ case 'a': ++ { ++ switch ( LA(3) ) ++ { ++ case 't': ++ { ++ alt14=6; ++ } ++ break; ++ case 'y': ++ { ++ alt14=19; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 14; ++ EXCEPTION->state = 31; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 14; ++ EXCEPTION->state = 10; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 'm': ++ { ++ switch ( LA(2) ) ++ { ++ case 'e': ++ { ++ alt14=6; ++ } ++ break; ++ case 'o': ++ { ++ switch ( LA(3) ) ++ { ++ case 'n': ++ { ++ alt14=19; ++ } ++ break; ++ case 'v': ++ { ++ alt14=20; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 14; ++ EXCEPTION->state = 33; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 'u': ++ { ++ alt14=20; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 14; ++ EXCEPTION->state = 11; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case 'i': ++ { ++ switch ( LA(2) ) ++ { ++ case 'n': ++ { ++ alt14=7; ++ } ++ break; ++ case 's': ++ { ++ alt14=8; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 14; ++ EXCEPTION->state = 12; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ } ++ break; ++ case '<': ++ case '=': ++ case '>': ++ { ++ alt14=9; ++ } ++ break; ++ case 'b': ++ { ++ alt14=11; ++ } ++ break; ++ case 'A': ++ { ++ alt14=13; ++ } ++ break; ++ case 'O': ++ case 'o': ++ { ++ alt14=14; ++ } ++ break; ++ case 'N': ++ case 'n': ++ { ++ alt14=15; ++ } ++ break; ++ case '(': ++ { ++ alt14=16; ++ } ++ break; ++ case ')': ++ { ++ alt14=17; ++ } ++ break; ++ case '0': ++ case '1': ++ case '2': ++ case '3': ++ case '4': ++ case '5': ++ case '6': ++ case '7': ++ case '8': ++ case '9': ++ { ++ switch ( LA(2) ) ++ { ++ case '0': ++ case '1': ++ case '2': ++ case '3': ++ case '4': ++ case '5': ++ case '6': ++ case '7': ++ case '8': ++ case '9': ++ { ++ switch ( LA(3) ) ++ { ++ case '0': ++ case '1': ++ case '2': ++ case '3': ++ case '4': ++ case '5': ++ case '6': ++ case '7': ++ case '8': ++ case '9': ++ { ++ switch ( LA(4) ) ++ { ++ case '0': ++ case '1': ++ case '2': ++ case '3': ++ case '4': ++ case '5': ++ case '6': ++ case '7': ++ case '8': ++ case '9': ++ { ++ switch ( LA(5) ) ++ { ++ case '-': ++ { ++ alt14=18; ++ } ++ break; ++ ++ default: ++ alt14=22;} ++ ++ } ++ break; ++ ++ default: ++ alt14=22;} ++ ++ } ++ break; ++ ++ default: ++ alt14=22;} ++ ++ } ++ break; ++ ++ default: ++ alt14=22;} ++ ++ } ++ break; ++ case 'l': ++ { ++ alt14=18; ++ } ++ break; ++ case 'w': ++ { ++ alt14=19; ++ } ++ break; ++ case 'f': ++ case 's': ++ case 'u': ++ { ++ alt14=20; ++ } ++ break; ++ case '"': ++ { ++ alt14=21; ++ } ++ break; ++ case '\t': ++ case '\n': ++ case '\f': ++ case '\r': ++ case ' ': ++ { ++ alt14=23; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 14; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruleTokensEx; ++ } ++ ++ switch (alt14) ++ { ++ case 1: ++ // SMARTPL.g:1:10: T__30 ++ { ++ /* 1:10: T__30 */ ++ mT__30(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 2: ++ // SMARTPL.g:1:16: T__31 ++ { ++ /* 1:16: T__31 */ ++ mT__31(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 3: ++ // SMARTPL.g:1:22: STRTAG ++ { ++ /* 1:22: STRTAG */ ++ mSTRTAG(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 4: ++ // SMARTPL.g:1:29: INTTAG ++ { ++ /* 1:29: INTTAG */ ++ mINTTAG(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 5: ++ // SMARTPL.g:1:36: DATETAG ++ { ++ /* 1:36: DATETAG */ ++ mDATETAG(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 6: ++ // SMARTPL.g:1:44: ENUMTAG ++ { ++ /* 1:44: ENUMTAG */ ++ mENUMTAG(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 7: ++ // SMARTPL.g:1:52: INCLUDES ++ { ++ /* 1:52: INCLUDES */ ++ mINCLUDES(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 8: ++ // SMARTPL.g:1:61: IS ++ { ++ /* 1:61: IS */ ++ mIS(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 9: ++ // SMARTPL.g:1:64: INTBOOL ++ { ++ /* 1:64: INTBOOL */ ++ mINTBOOL(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 10: ++ // SMARTPL.g:1:72: AFTER ++ { ++ /* 1:72: AFTER */ ++ mAFTER(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 11: ++ // SMARTPL.g:1:78: BEFORE ++ { ++ /* 1:78: BEFORE */ ++ mBEFORE(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 12: ++ // SMARTPL.g:1:85: AGO ++ { ++ /* 1:85: AGO */ ++ mAGO(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 13: ++ // SMARTPL.g:1:89: AND ++ { ++ /* 1:89: AND */ ++ mAND(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 14: ++ // SMARTPL.g:1:93: OR ++ { ++ /* 1:93: OR */ ++ mOR(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 15: ++ // SMARTPL.g:1:96: NOT ++ { ++ /* 1:96: NOT */ ++ mNOT(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 16: ++ // SMARTPL.g:1:100: LPAR ++ { ++ /* 1:100: LPAR */ ++ mLPAR(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 17: ++ // SMARTPL.g:1:105: RPAR ++ { ++ /* 1:105: RPAR */ ++ mRPAR(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 18: ++ // SMARTPL.g:1:110: DATE ++ { ++ /* 1:110: DATE */ ++ mDATE(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 19: ++ // SMARTPL.g:1:115: DATINTERVAL ++ { ++ /* 1:115: DATINTERVAL */ ++ mDATINTERVAL(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 20: ++ // SMARTPL.g:1:127: ENUMVAL ++ { ++ /* 1:127: ENUMVAL */ ++ mENUMVAL(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 21: ++ // SMARTPL.g:1:135: STR ++ { ++ /* 1:135: STR */ ++ mSTR(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 22: ++ // SMARTPL.g:1:139: INT ++ { ++ /* 1:139: INT */ ++ mINT(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ case 23: ++ // SMARTPL.g:1:143: WHITESPACE ++ { ++ /* 1:143: WHITESPACE */ ++ mWHITESPACE(ctx ); ++ if (HASEXCEPTION()) ++ { ++ goto ruleTokensEx; ++ } ++ ++ ++ } ++ break; ++ ++ } ++ } ++ ++ ++ goto ruleTokensEx; /* Prevent compiler warnings */ ++ruleTokensEx: ; ++} ++ ++/* ========================================================================= ++ * Lexer matching rules end. ++ * ========================================================================= ++ */ ++/* End of Lexer code ++ * ================================================ ++ * ================================================ ++ */ ++ ++ ++/* End of code ++ * ============================================================================= ++ */ +diff --git a/src/pregen/SMARTPLLexer.h b/src/pregen/SMARTPLLexer.h +new file mode 100644 +index 0000000..87e8c7e +--- /dev/null ++++ b/src/pregen/SMARTPLLexer.h +@@ -0,0 +1,248 @@ ++/** \file ++ * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : SMARTPL.g ++ * - On : 2016-01-01 12:23:40 ++ * - for the lexer : SMARTPLLexerLexer * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++ * The lexer SMARTPLLexer has the callable functions (rules) shown below, ++ * which will invoke the code for the associated rule in the source grammar ++ * assuming that the input stream is pointing to a token/text stream that could begin ++ * this rule. ++ * ++ * For instance if you call the first (topmost) rule in a parser grammar, you will ++ * get the results of a full parse, but calling a rule half way through the grammar will ++ * allow you to pass part of a full token stream to the parser, such as for syntax checking ++ * in editors and so on. ++ * ++ * The parser entry points are called indirectly (by function pointer to function) via ++ * a parser context typedef pSMARTPLLexer, which is returned from a call to SMARTPLLexerNew(). ++ * ++ * As this is a generated lexer, it is unlikely you will call it 'manually'. However ++ * the methods are provided anyway. ++ * * The methods in pSMARTPLLexer are as follows: ++ * ++ * - void pSMARTPLLexer->T__30(pSMARTPLLexer) ++ * - void pSMARTPLLexer->T__31(pSMARTPLLexer) ++ * - void pSMARTPLLexer->STRTAG(pSMARTPLLexer) ++ * - void pSMARTPLLexer->INTTAG(pSMARTPLLexer) ++ * - void pSMARTPLLexer->DATETAG(pSMARTPLLexer) ++ * - void pSMARTPLLexer->ENUMTAG(pSMARTPLLexer) ++ * - void pSMARTPLLexer->INCLUDES(pSMARTPLLexer) ++ * - void pSMARTPLLexer->IS(pSMARTPLLexer) ++ * - void pSMARTPLLexer->INTBOOL(pSMARTPLLexer) ++ * - void pSMARTPLLexer->GREATER(pSMARTPLLexer) ++ * - void pSMARTPLLexer->GREATEREQUAL(pSMARTPLLexer) ++ * - void pSMARTPLLexer->LESS(pSMARTPLLexer) ++ * - void pSMARTPLLexer->LESSEQUAL(pSMARTPLLexer) ++ * - void pSMARTPLLexer->EQUAL(pSMARTPLLexer) ++ * - void pSMARTPLLexer->AFTER(pSMARTPLLexer) ++ * - void pSMARTPLLexer->BEFORE(pSMARTPLLexer) ++ * - void pSMARTPLLexer->AGO(pSMARTPLLexer) ++ * - void pSMARTPLLexer->AND(pSMARTPLLexer) ++ * - void pSMARTPLLexer->OR(pSMARTPLLexer) ++ * - void pSMARTPLLexer->NOT(pSMARTPLLexer) ++ * - void pSMARTPLLexer->LPAR(pSMARTPLLexer) ++ * - void pSMARTPLLexer->RPAR(pSMARTPLLexer) ++ * - void pSMARTPLLexer->DATE(pSMARTPLLexer) ++ * - void pSMARTPLLexer->DATINTERVAL(pSMARTPLLexer) ++ * - void pSMARTPLLexer->ENUMVAL(pSMARTPLLexer) ++ * - void pSMARTPLLexer->STR(pSMARTPLLexer) ++ * - void pSMARTPLLexer->INT(pSMARTPLLexer) ++ * - void pSMARTPLLexer->WHITESPACE(pSMARTPLLexer) ++ * - void pSMARTPLLexer->Tokens(pSMARTPLLexer) ++ * ++ * The return type for any particular rule is of course determined by the source ++ * grammar file. ++ */ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++#ifndef _SMARTPLLexer_H ++#define _SMARTPLLexer_H ++/* ============================================================================= ++ * Standard antlr3 C runtime definitions ++ */ ++#include ++ ++/* End of standard antlr 3 runtime definitions ++ * ============================================================================= ++ */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++// Forward declare the context typedef so that we can use it before it is ++// properly defined. Delegators and delegates (from import statements) are ++// interdependent and their context structures contain pointers to each other ++// C only allows such things to be declared if you pre-declare the typedef. ++// ++typedef struct SMARTPLLexer_Ctx_struct SMARTPLLexer, * pSMARTPLLexer; ++ ++ ++ ++#ifdef ANTLR3_WINDOWS ++// Disable: Unreferenced parameter, - Rules with parameters that are not used ++// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually) ++// initialized but unused variable - tree rewrite variables declared but not needed ++// Unreferenced local variable - lexer rule declares but does not always use _type ++// potentially unitialized variable used - retval always returned from a rule ++// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns ++// ++// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at ++// and the codegen must generate some of these warnings by necessity, apart from 4100, which is ++// usually generated when a parser rule is given a parameter that it does not use. Mostly though ++// this is a matter of orthogonality hence I disable that one. ++// ++#pragma warning( disable : 4100 ) ++#pragma warning( disable : 4101 ) ++#pragma warning( disable : 4127 ) ++#pragma warning( disable : 4189 ) ++#pragma warning( disable : 4505 ) ++#pragma warning( disable : 4701 ) ++#endif ++ ++/** Context tracking structure for SMARTPLLexer ++ */ ++struct SMARTPLLexer_Ctx_struct ++{ ++ /** Built in ANTLR3 context tracker contains all the generic elements ++ * required for context tracking. ++ */ ++ pANTLR3_LEXER pLexer; ++ ++ ++ void (*mT__30) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mT__31) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mSTRTAG) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mINTTAG) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mDATETAG) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mENUMTAG) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mINCLUDES) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mIS) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mINTBOOL) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mGREATER) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mGREATEREQUAL) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mLESS) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mLESSEQUAL) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mEQUAL) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mAFTER) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mBEFORE) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mAGO) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mAND) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mOR) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mNOT) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mLPAR) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mRPAR) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mDATE) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mDATINTERVAL) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mENUMVAL) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mSTR) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mINT) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mWHITESPACE) (struct SMARTPLLexer_Ctx_struct * ctx); ++ void (*mTokens) (struct SMARTPLLexer_Ctx_struct * ctx); const char * (*getGrammarFileName)(); ++ void (*free) (struct SMARTPLLexer_Ctx_struct * ctx); ++ ++}; ++ ++// Function protoypes for the constructor functions that external translation units ++// such as delegators and delegates may wish to call. ++// ++ANTLR3_API pSMARTPLLexer SMARTPLLexerNew (pANTLR3_INPUT_STREAM instream); ++ANTLR3_API pSMARTPLLexer SMARTPLLexerNewSSD (pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state); ++ ++/** Symbolic definitions of all the tokens that the lexer will work with. ++ * \{ ++ * ++ * Antlr will define EOF, but we can't use that as it it is too common in ++ * in C header files and that would be confusing. There is no way to filter this out at the moment ++ * so we just undef it here for now. That isn't the value we get back from C recognizers ++ * anyway. We are looking for ANTLR3_TOKEN_EOF. ++ */ ++#ifdef EOF ++#undef EOF ++#endif ++#ifdef Tokens ++#undef Tokens ++#endif ++#define INTBOOL 14 ++#define STRTAG 10 ++#define AGO 22 ++#define WHITESPACE 29 ++#define GREATEREQUAL 25 ++#define BEFORE 18 ++#define DATETAG 16 ++#define INT 15 ++#define NOT 7 ++#define AFTER 17 ++#define AND 6 ++#define EOF -1 ++#define INCLUDES 11 ++#define STR 4 ++#define T__30 30 ++#define T__31 31 ++#define GREATER 24 ++#define LPAR 8 ++#define ENUMTAG 19 ++#define IS 12 ++#define ENUMVAL 20 ++#define EQUAL 28 ++#define OR 5 ++#define LESS 26 ++#define RPAR 9 ++#define DATE 21 ++#define LESSEQUAL 27 ++#define INTTAG 13 ++#define DATINTERVAL 23 ++#ifdef EOF ++#undef EOF ++#define EOF ANTLR3_TOKEN_EOF ++#endif ++ ++#ifndef TOKENSOURCE ++#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource ++#endif ++ ++/* End of token definitions for SMARTPLLexer ++ * ============================================================================= ++ */ ++/** \} */ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif ++ ++/* END - Note:Keep extra line feed to satisfy UNIX systems */ +diff --git a/src/pregen/SMARTPLParser.c b/src/pregen/SMARTPLParser.c +new file mode 100644 +index 0000000..f39e5ae +--- /dev/null ++++ b/src/pregen/SMARTPLParser.c +@@ -0,0 +1,1812 @@ ++/** \file ++ * This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : SMARTPL.g ++ * - On : 2016-01-01 12:23:40 ++ * - for the parser : SMARTPLParserParser * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++*/ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++/* ----------------------------------------- ++ * Include the ANTLR3 generated header file. ++ */ ++#include "SMARTPLParser.h" ++/* ----------------------------------------- */ ++ ++ ++ ++ ++ ++/* MACROS that hide the C interface implementations from the ++ * generated code, which makes it a little more understandable to the human eye. ++ * I am very much against using C pre-processor macros for function calls and bits ++ * of code as you cannot see what is happening when single stepping in debuggers ++ * and so on. The exception (in my book at least) is for generated code, where you are ++ * not maintaining it, but may wish to read and understand it. If you single step it, you know that input() ++ * hides some indirect calls, but is always referring to the input stream. This is ++ * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig ++ * the runtime interfaces without changing the generated code too often, without ++ * confusing the reader of the generated output, who may not wish to know the gory ++ * details of the interface inheritance. ++ */ ++ ++#define CTX ctx ++ ++/* Aids in accessing scopes for grammar programmers ++ */ ++#undef SCOPE_TYPE ++#undef SCOPE_STACK ++#undef SCOPE_TOP ++#define SCOPE_TYPE(scope) pSMARTPLParser_##scope##_SCOPE ++#define SCOPE_STACK(scope) pSMARTPLParser_##scope##Stack ++#define SCOPE_TOP(scope) ctx->pSMARTPLParser_##scope##Top ++#define SCOPE_SIZE(scope) ctx->pSMARTPLParser_##scope##Stack_limit ++#define SCOPE_INSTANCE(scope, i) (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i)) ++ ++/* Macros for accessing things in the parser ++ */ ++ ++#undef PARSER ++#undef RECOGNIZER ++#undef HAVEPARSEDRULE ++#undef MEMOIZE ++#undef INPUT ++#undef STRSTREAM ++#undef HASEXCEPTION ++#undef EXCEPTION ++#undef MATCHT ++#undef MATCHANYT ++#undef FOLLOWSTACK ++#undef FOLLOWPUSH ++#undef FOLLOWPOP ++#undef PRECOVER ++#undef PREPORTERROR ++#undef LA ++#undef LT ++#undef CONSTRUCTEX ++#undef CONSUME ++#undef MARK ++#undef REWIND ++#undef REWINDLAST ++#undef PERRORRECOVERY ++#undef HASFAILED ++#undef FAILEDFLAG ++#undef RECOVERFROMMISMATCHEDSET ++#undef RECOVERFROMMISMATCHEDELEMENT ++#undef INDEX ++#undef ADAPTOR ++#undef SEEK ++#undef RULEMEMO ++#undef DBG ++ ++#define PARSER ctx->pParser ++#define RECOGNIZER PARSER->rec ++#define PSRSTATE RECOGNIZER->state ++#define HAVEPARSEDRULE(r) RECOGNIZER->alreadyParsedRule(RECOGNIZER, r) ++#define MEMOIZE(ri,si) RECOGNIZER->memoize(RECOGNIZER, ri, si) ++#define INPUT PARSER->tstream ++#define STRSTREAM INPUT ++#define ISTREAM INPUT->istream ++#define INDEX() ISTREAM->index(INPUT->istream) ++#define HASEXCEPTION() (PSRSTATE->error == ANTLR3_TRUE) ++#define EXCEPTION PSRSTATE->exception ++#define MATCHT(t, fs) RECOGNIZER->match(RECOGNIZER, t, fs) ++#define MATCHANYT() RECOGNIZER->matchAny(RECOGNIZER) ++#define FOLLOWSTACK PSRSTATE->following ++#define FOLLOWPUSH(x) FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL) ++#define FOLLOWPOP() FOLLOWSTACK->pop(FOLLOWSTACK) ++#define PRECOVER() RECOGNIZER->recover(RECOGNIZER) ++#define PREPORTERROR() RECOGNIZER->reportError(RECOGNIZER) ++#define LA(n) INPUT->istream->_LA(ISTREAM, n) ++#define LT(n) INPUT->_LT(INPUT, n) ++#define CONSTRUCTEX() RECOGNIZER->exConstruct(RECOGNIZER) ++#define CONSUME() ISTREAM->consume(ISTREAM) ++#define MARK() ISTREAM->mark(ISTREAM) ++#define REWIND(m) ISTREAM->rewind(ISTREAM, m) ++#define REWINDLAST() ISTREAM->rewindLast(ISTREAM) ++#define SEEK(n) ISTREAM->seek(ISTREAM, n) ++#define PERRORRECOVERY PSRSTATE->errorRecovery ++#define FAILEDFLAG PSRSTATE->failed ++#define HASFAILED() (FAILEDFLAG == ANTLR3_TRUE) ++#define BACKTRACKING PSRSTATE->backtracking ++#define RECOVERFROMMISMATCHEDSET(s) RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s) ++#define RECOVERFROMMISMATCHEDELEMENT(e) RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s) ++#define ADAPTOR ctx->adaptor ++#define RULEMEMO PSRSTATE->ruleMemo ++#define DBG RECOGNIZER->debugger ++ ++#define TOKTEXT(tok, txt) tok, (pANTLR3_UINT8)txt ++ ++/* The 4 tokens defined below may well clash with your own #defines or token types. If so ++ * then for the present you must use different names for your defines as these are hard coded ++ * in the code generator. It would be better not to use such names internally, and maybe ++ * we can change this in a forthcoming release. I deliberately do not #undef these ++ * here as this will at least give you a redefined error somewhere if they clash. ++ */ ++#define UP ANTLR3_TOKEN_UP ++#define DOWN ANTLR3_TOKEN_DOWN ++#define EOR ANTLR3_TOKEN_EOR ++#define INVALID ANTLR3_TOKEN_INVALID ++ ++ ++/* ============================================================================= ++ * Functions to create and destroy scopes. First come the rule scopes, followed ++ * by the global declared scopes. ++ */ ++ ++ ++ ++/* ============================================================================= */ ++ ++/* ============================================================================= ++ * Start of recognizer ++ */ ++ ++ ++ ++/** \brief Table of all token names in symbolic order, mainly used for ++ * error reporting. ++ */ ++pANTLR3_UINT8 SMARTPLParserTokenNames[28+4] ++ = { ++ (pANTLR3_UINT8) "", /* String to print to indicate an invalid token */ ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "", ++ (pANTLR3_UINT8) "STR", ++ (pANTLR3_UINT8) "OR", ++ (pANTLR3_UINT8) "AND", ++ (pANTLR3_UINT8) "NOT", ++ (pANTLR3_UINT8) "LPAR", ++ (pANTLR3_UINT8) "RPAR", ++ (pANTLR3_UINT8) "STRTAG", ++ (pANTLR3_UINT8) "INCLUDES", ++ (pANTLR3_UINT8) "IS", ++ (pANTLR3_UINT8) "INTTAG", ++ (pANTLR3_UINT8) "INTBOOL", ++ (pANTLR3_UINT8) "INT", ++ (pANTLR3_UINT8) "DATETAG", ++ (pANTLR3_UINT8) "AFTER", ++ (pANTLR3_UINT8) "BEFORE", ++ (pANTLR3_UINT8) "ENUMTAG", ++ (pANTLR3_UINT8) "ENUMVAL", ++ (pANTLR3_UINT8) "DATE", ++ (pANTLR3_UINT8) "AGO", ++ (pANTLR3_UINT8) "DATINTERVAL", ++ (pANTLR3_UINT8) "GREATER", ++ (pANTLR3_UINT8) "GREATEREQUAL", ++ (pANTLR3_UINT8) "LESS", ++ (pANTLR3_UINT8) "LESSEQUAL", ++ (pANTLR3_UINT8) "EQUAL", ++ (pANTLR3_UINT8) "WHITESPACE", ++ (pANTLR3_UINT8) "'{'", ++ (pANTLR3_UINT8) "'}'" ++ }; ++ ++ ++ ++// Forward declare the locally static matching functions we have generated. ++// ++static SMARTPLParser_playlist_return playlist (pSMARTPLParser ctx); ++static SMARTPLParser_expression_return expression (pSMARTPLParser ctx); ++static SMARTPLParser_aexpr_return aexpr (pSMARTPLParser ctx); ++static SMARTPLParser_nexpr_return nexpr (pSMARTPLParser ctx); ++static SMARTPLParser_crit_return crit (pSMARTPLParser ctx); ++static SMARTPLParser_dateval_return dateval (pSMARTPLParser ctx); ++static SMARTPLParser_interval_return interval (pSMARTPLParser ctx); ++static void SMARTPLParserFree(pSMARTPLParser ctx); ++/* For use in tree output where we are accumulating rule labels via label += ruleRef ++ * we need a function that knows how to free a return scope when the list is destroyed. ++ * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro. ++ */ ++static void ANTLR3_CDECL freeScope(void * scope) ++{ ++ ANTLR3_FREE(scope); ++} ++ ++/** \brief Name of the grammar file that generated this code ++ */ ++static const char fileName[] = "SMARTPL.g"; ++ ++/** \brief Return the name of the grammar file that generated this code. ++ */ ++static const char * getGrammarFileName() ++{ ++ return fileName; ++} ++/** \brief Create a new SMARTPLParser parser and return a context for it. ++ * ++ * \param[in] instream Pointer to an input stream interface. ++ * ++ * \return Pointer to new parser context upon success. ++ */ ++ANTLR3_API pSMARTPLParser ++SMARTPLParserNew (pANTLR3_COMMON_TOKEN_STREAM instream) ++{ ++ // See if we can create a new parser with the standard constructor ++ // ++ return SMARTPLParserNewSSD(instream, NULL); ++} ++ ++/** \brief Create a new SMARTPLParser parser and return a context for it. ++ * ++ * \param[in] instream Pointer to an input stream interface. ++ * ++ * \return Pointer to new parser context upon success. ++ */ ++ANTLR3_API pSMARTPLParser ++SMARTPLParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state) ++{ ++ pSMARTPLParser ctx; /* Context structure we will build and return */ ++ ++ ctx = (pSMARTPLParser) ANTLR3_CALLOC(1, sizeof(SMARTPLParser)); ++ ++ if (ctx == NULL) ++ { ++ // Failed to allocate memory for parser context ++ // ++ return NULL; ++ } ++ ++ /* ------------------------------------------------------------------- ++ * Memory for basic structure is allocated, now to fill in ++ * the base ANTLR3 structures. We initialize the function pointers ++ * for the standard ANTLR3 parser function set, but upon return ++ * from here, the programmer may set the pointers to provide custom ++ * implementations of each function. ++ * ++ * We don't use the macros defined in SMARTPLParser.h here, in order that you can get a sense ++ * of what goes where. ++ */ ++ ++ /* Create a base parser/recognizer, using the supplied token stream ++ */ ++ ctx->pParser = antlr3ParserNewStream(ANTLR3_SIZE_HINT, instream->tstream, state); ++ /* Install the implementation of our SMARTPLParser interface ++ */ ++ ctx->playlist = playlist; ++ ctx->expression = expression; ++ ctx->aexpr = aexpr; ++ ctx->nexpr = nexpr; ++ ctx->crit = crit; ++ ctx->dateval = dateval; ++ ctx->interval = interval; ++ ctx->free = SMARTPLParserFree; ++ ctx->getGrammarFileName = getGrammarFileName; ++ ++ /* Install the scope pushing methods. ++ */ ++ ADAPTOR = ANTLR3_TREE_ADAPTORNew(instream->tstream->tokenSource->strFactory); ++ ctx->vectors = antlr3VectorFactoryNew(0); ++ ++ ++ ++ /* Install the token table ++ */ ++ PSRSTATE->tokenNames = SMARTPLParserTokenNames; ++ ++ ++ /* Return the newly built parser to the caller ++ */ ++ return ctx; ++} ++ ++/** Free the parser resources ++ */ ++ static void ++ SMARTPLParserFree(pSMARTPLParser ctx) ++ { ++ /* Free any scope memory ++ */ ++ ++ ctx->vectors->close(ctx->vectors); ++ /* We created the adaptor so we must free it ++ */ ++ ADAPTOR->free(ADAPTOR); ++ // Free this parser ++ // ++ ctx->pParser->free(ctx->pParser); ++ ANTLR3_FREE(ctx); ++ ++ /* Everything is released, so we can return ++ */ ++ return; ++ } ++ ++/** Return token names used by this parser ++ * ++ * The returned pointer is used as an index into the token names table (using the token ++ * number as the index). ++ * ++ * \return Pointer to first char * in the table. ++ */ ++static pANTLR3_UINT8 *getTokenNames() ++{ ++ return SMARTPLParserTokenNames; ++} ++ ++ ++/* Declare the bitsets ++ */ ++ ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_playlist42 */ ++static ANTLR3_BITWORD FOLLOW_STR_in_playlist42_bits[] = { ANTLR3_UINT64_LIT(0x0000000040000000) }; ++static ANTLR3_BITSET_LIST FOLLOW_STR_in_playlist42 = { FOLLOW_STR_in_playlist42_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_30_in_playlist44 */ ++static ANTLR3_BITWORD FOLLOW_30_in_playlist44_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) }; ++static ANTLR3_BITSET_LIST FOLLOW_30_in_playlist44 = { FOLLOW_30_in_playlist44_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_playlist46 */ ++static ANTLR3_BITWORD FOLLOW_expression_in_playlist46_bits[] = { ANTLR3_UINT64_LIT(0x0000000080000000) }; ++static ANTLR3_BITSET_LIST FOLLOW_expression_in_playlist46 = { FOLLOW_expression_in_playlist46_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_31_in_playlist48 */ ++static ANTLR3_BITWORD FOLLOW_31_in_playlist48_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000000) }; ++static ANTLR3_BITSET_LIST FOLLOW_31_in_playlist48 = { FOLLOW_31_in_playlist48_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_EOF_in_playlist50 */ ++static ANTLR3_BITWORD FOLLOW_EOF_in_playlist50_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_EOF_in_playlist50 = { FOLLOW_EOF_in_playlist50_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expression62 */ ++static ANTLR3_BITWORD FOLLOW_aexpr_in_expression62_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) }; ++static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expression62 = { FOLLOW_aexpr_in_expression62_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_OR_in_expression65 */ ++static ANTLR3_BITWORD FOLLOW_OR_in_expression65_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) }; ++static ANTLR3_BITSET_LIST FOLLOW_OR_in_expression65 = { FOLLOW_OR_in_expression65_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expression68 */ ++static ANTLR3_BITWORD FOLLOW_aexpr_in_expression68_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000022) }; ++static ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expression68 = { FOLLOW_aexpr_in_expression68_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_nexpr_in_aexpr83 */ ++static ANTLR3_BITWORD FOLLOW_nexpr_in_aexpr83_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) }; ++static ANTLR3_BITSET_LIST FOLLOW_nexpr_in_aexpr83 = { FOLLOW_nexpr_in_aexpr83_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AND_in_aexpr86 */ ++static ANTLR3_BITWORD FOLLOW_AND_in_aexpr86_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) }; ++static ANTLR3_BITSET_LIST FOLLOW_AND_in_aexpr86 = { FOLLOW_AND_in_aexpr86_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_nexpr_in_aexpr89 */ ++static ANTLR3_BITWORD FOLLOW_nexpr_in_aexpr89_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000042) }; ++static ANTLR3_BITSET_LIST FOLLOW_nexpr_in_aexpr89 = { FOLLOW_nexpr_in_aexpr89_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_nexpr104 */ ++static ANTLR3_BITWORD FOLLOW_NOT_in_nexpr104_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) }; ++static ANTLR3_BITSET_LIST FOLLOW_NOT_in_nexpr104 = { FOLLOW_NOT_in_nexpr104_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_nexpr107 */ ++static ANTLR3_BITWORD FOLLOW_crit_in_nexpr107_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_crit_in_nexpr107 = { FOLLOW_crit_in_nexpr107_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_nexpr114 */ ++static ANTLR3_BITWORD FOLLOW_crit_in_nexpr114_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_crit_in_nexpr114 = { FOLLOW_crit_in_nexpr114_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_LPAR_in_crit127 */ ++static ANTLR3_BITWORD FOLLOW_LPAR_in_crit127_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) }; ++static ANTLR3_BITSET_LIST FOLLOW_LPAR_in_crit127 = { FOLLOW_LPAR_in_crit127_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_crit129 */ ++static ANTLR3_BITWORD FOLLOW_expression_in_crit129_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000200) }; ++static ANTLR3_BITSET_LIST FOLLOW_expression_in_crit129 = { FOLLOW_expression_in_crit129_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_RPAR_in_crit131 */ ++static ANTLR3_BITWORD FOLLOW_RPAR_in_crit131_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_RPAR_in_crit131 = { FOLLOW_RPAR_in_crit131_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STRTAG_in_crit142 */ ++static ANTLR3_BITWORD FOLLOW_STRTAG_in_crit142_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001800) }; ++static ANTLR3_BITSET_LIST FOLLOW_STRTAG_in_crit142 = { FOLLOW_STRTAG_in_crit142_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_crit144 */ ++static ANTLR3_BITWORD FOLLOW_set_in_crit144_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000010) }; ++static ANTLR3_BITSET_LIST FOLLOW_set_in_crit144 = { FOLLOW_set_in_crit144_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_crit150 */ ++static ANTLR3_BITWORD FOLLOW_STR_in_crit150_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_STR_in_crit150 = { FOLLOW_STR_in_crit150_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTTAG_in_crit157 */ ++static ANTLR3_BITWORD FOLLOW_INTTAG_in_crit157_bits[] = { ANTLR3_UINT64_LIT(0x0000000000004000) }; ++static ANTLR3_BITSET_LIST FOLLOW_INTTAG_in_crit157 = { FOLLOW_INTTAG_in_crit157_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTBOOL_in_crit159 */ ++static ANTLR3_BITWORD FOLLOW_INTBOOL_in_crit159_bits[] = { ANTLR3_UINT64_LIT(0x0000000000008000) }; ++static ANTLR3_BITSET_LIST FOLLOW_INTBOOL_in_crit159 = { FOLLOW_INTBOOL_in_crit159_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_crit161 */ ++static ANTLR3_BITWORD FOLLOW_INT_in_crit161_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_INT_in_crit161 = { FOLLOW_INT_in_crit161_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATETAG_in_crit168 */ ++static ANTLR3_BITWORD FOLLOW_DATETAG_in_crit168_bits[] = { ANTLR3_UINT64_LIT(0x0000000000060000) }; ++static ANTLR3_BITSET_LIST FOLLOW_DATETAG_in_crit168 = { FOLLOW_DATETAG_in_crit168_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_crit170 */ ++static ANTLR3_BITWORD FOLLOW_set_in_crit170_bits[] = { ANTLR3_UINT64_LIT(0x0000000000208000) }; ++static ANTLR3_BITSET_LIST FOLLOW_set_in_crit170 = { FOLLOW_set_in_crit170_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateval_in_crit176 */ ++static ANTLR3_BITWORD FOLLOW_dateval_in_crit176_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_dateval_in_crit176 = { FOLLOW_dateval_in_crit176_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMTAG_in_crit183 */ ++static ANTLR3_BITWORD FOLLOW_ENUMTAG_in_crit183_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001000) }; ++static ANTLR3_BITSET_LIST FOLLOW_ENUMTAG_in_crit183 = { FOLLOW_ENUMTAG_in_crit183_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_IS_in_crit185 */ ++static ANTLR3_BITWORD FOLLOW_IS_in_crit185_bits[] = { ANTLR3_UINT64_LIT(0x0000000000100000) }; ++static ANTLR3_BITSET_LIST FOLLOW_IS_in_crit185 = { FOLLOW_IS_in_crit185_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMVAL_in_crit187 */ ++static ANTLR3_BITWORD FOLLOW_ENUMVAL_in_crit187_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_ENUMVAL_in_crit187 = { FOLLOW_ENUMVAL_in_crit187_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval200 */ ++static ANTLR3_BITWORD FOLLOW_DATE_in_dateval200_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval200 = { FOLLOW_DATE_in_dateval200_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval207 */ ++static ANTLR3_BITWORD FOLLOW_interval_in_dateval207_bits[] = { ANTLR3_UINT64_LIT(0x0000000000040000) }; ++static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval207 = { FOLLOW_interval_in_dateval207_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_dateval209 */ ++static ANTLR3_BITWORD FOLLOW_BEFORE_in_dateval209_bits[] = { ANTLR3_UINT64_LIT(0x0000000000200000) }; ++static ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_dateval209 = { FOLLOW_BEFORE_in_dateval209_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval211 */ ++static ANTLR3_BITWORD FOLLOW_DATE_in_dateval211_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval211 = { FOLLOW_DATE_in_dateval211_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval218 */ ++static ANTLR3_BITWORD FOLLOW_interval_in_dateval218_bits[] = { ANTLR3_UINT64_LIT(0x0000000000020000) }; ++static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval218 = { FOLLOW_interval_in_dateval218_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_dateval220 */ ++static ANTLR3_BITWORD FOLLOW_AFTER_in_dateval220_bits[] = { ANTLR3_UINT64_LIT(0x0000000000200000) }; ++static ANTLR3_BITSET_LIST FOLLOW_AFTER_in_dateval220 = { FOLLOW_AFTER_in_dateval220_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval222 */ ++static ANTLR3_BITWORD FOLLOW_DATE_in_dateval222_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval222 = { FOLLOW_DATE_in_dateval222_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval229 */ ++static ANTLR3_BITWORD FOLLOW_interval_in_dateval229_bits[] = { ANTLR3_UINT64_LIT(0x0000000000400000) }; ++static ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval229 = { FOLLOW_interval_in_dateval229_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AGO_in_dateval231 */ ++static ANTLR3_BITWORD FOLLOW_AGO_in_dateval231_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_AGO_in_dateval231 = { FOLLOW_AGO_in_dateval231_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_interval243 */ ++static ANTLR3_BITWORD FOLLOW_INT_in_interval243_bits[] = { ANTLR3_UINT64_LIT(0x0000000000800000) }; ++static ANTLR3_BITSET_LIST FOLLOW_INT_in_interval243 = { FOLLOW_INT_in_interval243_bits, 1 }; ++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATINTERVAL_in_interval245 */ ++static ANTLR3_BITWORD FOLLOW_DATINTERVAL_in_interval245_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) }; ++static ANTLR3_BITSET_LIST FOLLOW_DATINTERVAL_in_interval245 = { FOLLOW_DATINTERVAL_in_interval245_bits, 1 }; ++ ++ ++ ++ ++/* ============================================== ++ * Parsing rules ++ */ ++/** ++ * $ANTLR start playlist ++ * SMARTPL.g:27:1: playlist : STR '{' expression '}' EOF ; ++ */ ++static SMARTPLParser_playlist_return ++playlist(pSMARTPLParser ctx) ++{ ++ SMARTPLParser_playlist_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN STR1; ++ pANTLR3_COMMON_TOKEN char_literal2; ++ pANTLR3_COMMON_TOKEN char_literal4; ++ pANTLR3_COMMON_TOKEN EOF5; ++ SMARTPLParser_expression_return expression3; ++ #undef RETURN_TYPE_expression3 ++ #define RETURN_TYPE_expression3 SMARTPLParser_expression_return ++ ++ pANTLR3_BASE_TREE STR1_tree; ++ pANTLR3_BASE_TREE char_literal2_tree; ++ pANTLR3_BASE_TREE char_literal4_tree; ++ pANTLR3_BASE_TREE EOF5_tree; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ STR1 = NULL; ++ char_literal2 = NULL; ++ char_literal4 = NULL; ++ EOF5 = NULL; ++ expression3.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ STR1_tree = NULL; ++ char_literal2_tree = NULL; ++ char_literal4_tree = NULL; ++ EOF5_tree = NULL; ++ ++ ++ retval.tree = NULL; ++ { ++ // SMARTPL.g:27:10: ( STR '{' expression '}' EOF ) ++ // SMARTPL.g:27:12: STR '{' expression '}' EOF ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ STR1 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_playlist42); ++ if (HASEXCEPTION()) ++ { ++ goto ruleplaylistEx; ++ } ++ ++ STR1_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STR1)); ++ ADAPTOR->addChild(ADAPTOR, root_0, STR1_tree); ++ ++ char_literal2 = (pANTLR3_COMMON_TOKEN) MATCHT(30, &FOLLOW_30_in_playlist44); ++ if (HASEXCEPTION()) ++ { ++ goto ruleplaylistEx; ++ } ++ ++ char_literal2_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, char_literal2)); ++ ADAPTOR->addChild(ADAPTOR, root_0, char_literal2_tree); ++ ++ FOLLOWPUSH(FOLLOW_expression_in_playlist46); ++ expression3=expression(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleplaylistEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, expression3.tree); ++ char_literal4 = (pANTLR3_COMMON_TOKEN) MATCHT(31, &FOLLOW_31_in_playlist48); ++ if (HASEXCEPTION()) ++ { ++ goto ruleplaylistEx; ++ } ++ ++ char_literal4_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, char_literal4)); ++ ADAPTOR->addChild(ADAPTOR, root_0, char_literal4_tree); ++ ++ EOF5 = (pANTLR3_COMMON_TOKEN) MATCHT(EOF, &FOLLOW_EOF_in_playlist50); ++ if (HASEXCEPTION()) ++ { ++ goto ruleplaylistEx; ++ } ++ ++ EOF5_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, EOF5)); ++ ADAPTOR->addChild(ADAPTOR, root_0, EOF5_tree); ++ ++ ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleplaylistEx; /* Prevent compiler warnings */ ++ ruleplaylistEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end playlist */ ++ ++/** ++ * $ANTLR start expression ++ * SMARTPL.g:30:1: expression : aexpr ( OR aexpr )* ; ++ */ ++static SMARTPLParser_expression_return ++expression(pSMARTPLParser ctx) ++{ ++ SMARTPLParser_expression_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN OR7; ++ SMARTPLParser_aexpr_return aexpr6; ++ #undef RETURN_TYPE_aexpr6 ++ #define RETURN_TYPE_aexpr6 SMARTPLParser_aexpr_return ++ ++ SMARTPLParser_aexpr_return aexpr8; ++ #undef RETURN_TYPE_aexpr8 ++ #define RETURN_TYPE_aexpr8 SMARTPLParser_aexpr_return ++ ++ pANTLR3_BASE_TREE OR7_tree; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ OR7 = NULL; ++ aexpr6.tree = NULL; ++ ++ aexpr8.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ OR7_tree = NULL; ++ ++ ++ retval.tree = NULL; ++ { ++ // SMARTPL.g:30:12: ( aexpr ( OR aexpr )* ) ++ // SMARTPL.g:30:14: aexpr ( OR aexpr )* ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ FOLLOWPUSH(FOLLOW_aexpr_in_expression62); ++ aexpr6=aexpr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, aexpr6.tree); ++ ++ // SMARTPL.g:30:20: ( OR aexpr )* ++ ++ for (;;) ++ { ++ int alt1=2; ++ switch ( LA(1) ) ++ { ++ case OR: ++ { ++ alt1=1; ++ } ++ break; ++ ++ } ++ ++ switch (alt1) ++ { ++ case 1: ++ // SMARTPL.g:30:21: OR aexpr ++ { ++ OR7 = (pANTLR3_COMMON_TOKEN) MATCHT(OR, &FOLLOW_OR_in_expression65); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ OR7_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OR7)); ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OR7_tree, root_0)); ++ ++ FOLLOWPUSH(FOLLOW_aexpr_in_expression68); ++ aexpr8=aexpr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleexpressionEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, aexpr8.tree); ++ ++ } ++ break; ++ ++ default: ++ goto loop1; /* break out of the loop */ ++ break; ++ } ++ } ++ loop1: ; /* Jump out to here if this rule does not match */ ++ ++ ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleexpressionEx; /* Prevent compiler warnings */ ++ ruleexpressionEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end expression */ ++ ++/** ++ * $ANTLR start aexpr ++ * SMARTPL.g:33:1: aexpr : nexpr ( AND nexpr )* ; ++ */ ++static SMARTPLParser_aexpr_return ++aexpr(pSMARTPLParser ctx) ++{ ++ SMARTPLParser_aexpr_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN AND10; ++ SMARTPLParser_nexpr_return nexpr9; ++ #undef RETURN_TYPE_nexpr9 ++ #define RETURN_TYPE_nexpr9 SMARTPLParser_nexpr_return ++ ++ SMARTPLParser_nexpr_return nexpr11; ++ #undef RETURN_TYPE_nexpr11 ++ #define RETURN_TYPE_nexpr11 SMARTPLParser_nexpr_return ++ ++ pANTLR3_BASE_TREE AND10_tree; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ AND10 = NULL; ++ nexpr9.tree = NULL; ++ ++ nexpr11.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ AND10_tree = NULL; ++ ++ ++ retval.tree = NULL; ++ { ++ // SMARTPL.g:33:8: ( nexpr ( AND nexpr )* ) ++ // SMARTPL.g:33:10: nexpr ( AND nexpr )* ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ FOLLOWPUSH(FOLLOW_nexpr_in_aexpr83); ++ nexpr9=nexpr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleaexprEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, nexpr9.tree); ++ ++ // SMARTPL.g:33:16: ( AND nexpr )* ++ ++ for (;;) ++ { ++ int alt2=2; ++ switch ( LA(1) ) ++ { ++ case AND: ++ { ++ alt2=1; ++ } ++ break; ++ ++ } ++ ++ switch (alt2) ++ { ++ case 1: ++ // SMARTPL.g:33:17: AND nexpr ++ { ++ AND10 = (pANTLR3_COMMON_TOKEN) MATCHT(AND, &FOLLOW_AND_in_aexpr86); ++ if (HASEXCEPTION()) ++ { ++ goto ruleaexprEx; ++ } ++ ++ AND10_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AND10)); ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, AND10_tree, root_0)); ++ ++ FOLLOWPUSH(FOLLOW_nexpr_in_aexpr89); ++ nexpr11=nexpr(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruleaexprEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, nexpr11.tree); ++ ++ } ++ break; ++ ++ default: ++ goto loop2; /* break out of the loop */ ++ break; ++ } ++ } ++ loop2: ; /* Jump out to here if this rule does not match */ ++ ++ ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleaexprEx; /* Prevent compiler warnings */ ++ ruleaexprEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end aexpr */ ++ ++/** ++ * $ANTLR start nexpr ++ * SMARTPL.g:36:1: nexpr : ( NOT crit | crit ); ++ */ ++static SMARTPLParser_nexpr_return ++nexpr(pSMARTPLParser ctx) ++{ ++ SMARTPLParser_nexpr_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN NOT12; ++ SMARTPLParser_crit_return crit13; ++ #undef RETURN_TYPE_crit13 ++ #define RETURN_TYPE_crit13 SMARTPLParser_crit_return ++ ++ SMARTPLParser_crit_return crit14; ++ #undef RETURN_TYPE_crit14 ++ #define RETURN_TYPE_crit14 SMARTPLParser_crit_return ++ ++ pANTLR3_BASE_TREE NOT12_tree; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ NOT12 = NULL; ++ crit13.tree = NULL; ++ ++ crit14.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ NOT12_tree = NULL; ++ ++ ++ retval.tree = NULL; ++ { ++ { ++ // SMARTPL.g:36:8: ( NOT crit | crit ) ++ ++ ANTLR3_UINT32 alt3; ++ ++ alt3=2; ++ ++ switch ( LA(1) ) ++ { ++ case NOT: ++ { ++ alt3=1; ++ } ++ break; ++ case LPAR: ++ case STRTAG: ++ case INTTAG: ++ case DATETAG: ++ case ENUMTAG: ++ { ++ alt3=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 3; ++ EXCEPTION->state = 0; ++ ++ ++ goto rulenexprEx; ++ } ++ ++ switch (alt3) ++ { ++ case 1: ++ // SMARTPL.g:36:10: NOT crit ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ NOT12 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_nexpr104); ++ if (HASEXCEPTION()) ++ { ++ goto rulenexprEx; ++ } ++ ++ NOT12_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, NOT12)); ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, NOT12_tree, root_0)); ++ ++ FOLLOWPUSH(FOLLOW_crit_in_nexpr107); ++ crit13=crit(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto rulenexprEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, crit13.tree); ++ ++ } ++ break; ++ case 2: ++ // SMARTPL.g:37:6: crit ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ FOLLOWPUSH(FOLLOW_crit_in_nexpr114); ++ crit14=crit(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto rulenexprEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, crit14.tree); ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto rulenexprEx; /* Prevent compiler warnings */ ++ rulenexprEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end nexpr */ ++ ++/** ++ * $ANTLR start crit ++ * SMARTPL.g:40:1: crit : ( LPAR expression RPAR -> expression | STRTAG ( INCLUDES | IS ) STR | INTTAG INTBOOL INT | DATETAG ( AFTER | BEFORE ) dateval | ENUMTAG IS ENUMVAL ); ++ */ ++static SMARTPLParser_crit_return ++crit(pSMARTPLParser ctx) ++{ ++ SMARTPLParser_crit_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN LPAR15; ++ pANTLR3_COMMON_TOKEN RPAR17; ++ pANTLR3_COMMON_TOKEN STRTAG18; ++ pANTLR3_COMMON_TOKEN set19; ++ pANTLR3_COMMON_TOKEN STR20; ++ pANTLR3_COMMON_TOKEN INTTAG21; ++ pANTLR3_COMMON_TOKEN INTBOOL22; ++ pANTLR3_COMMON_TOKEN INT23; ++ pANTLR3_COMMON_TOKEN DATETAG24; ++ pANTLR3_COMMON_TOKEN set25; ++ pANTLR3_COMMON_TOKEN ENUMTAG27; ++ pANTLR3_COMMON_TOKEN IS28; ++ pANTLR3_COMMON_TOKEN ENUMVAL29; ++ SMARTPLParser_expression_return expression16; ++ #undef RETURN_TYPE_expression16 ++ #define RETURN_TYPE_expression16 SMARTPLParser_expression_return ++ ++ SMARTPLParser_dateval_return dateval26; ++ #undef RETURN_TYPE_dateval26 ++ #define RETURN_TYPE_dateval26 SMARTPLParser_dateval_return ++ ++ pANTLR3_BASE_TREE LPAR15_tree; ++ pANTLR3_BASE_TREE RPAR17_tree; ++ pANTLR3_BASE_TREE STRTAG18_tree; ++ pANTLR3_BASE_TREE set19_tree; ++ pANTLR3_BASE_TREE STR20_tree; ++ pANTLR3_BASE_TREE INTTAG21_tree; ++ pANTLR3_BASE_TREE INTBOOL22_tree; ++ pANTLR3_BASE_TREE INT23_tree; ++ pANTLR3_BASE_TREE DATETAG24_tree; ++ pANTLR3_BASE_TREE set25_tree; ++ pANTLR3_BASE_TREE ENUMTAG27_tree; ++ pANTLR3_BASE_TREE IS28_tree; ++ pANTLR3_BASE_TREE ENUMVAL29_tree; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_RPAR; ++ pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_LPAR; ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expression; ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ LPAR15 = NULL; ++ RPAR17 = NULL; ++ STRTAG18 = NULL; ++ set19 = NULL; ++ STR20 = NULL; ++ INTTAG21 = NULL; ++ INTBOOL22 = NULL; ++ INT23 = NULL; ++ DATETAG24 = NULL; ++ set25 = NULL; ++ ENUMTAG27 = NULL; ++ IS28 = NULL; ++ ENUMVAL29 = NULL; ++ expression16.tree = NULL; ++ ++ dateval26.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ LPAR15_tree = NULL; ++ RPAR17_tree = NULL; ++ STRTAG18_tree = NULL; ++ set19_tree = NULL; ++ STR20_tree = NULL; ++ INTTAG21_tree = NULL; ++ INTBOOL22_tree = NULL; ++ INT23_tree = NULL; ++ DATETAG24_tree = NULL; ++ set25_tree = NULL; ++ ENUMTAG27_tree = NULL; ++ IS28_tree = NULL; ++ ENUMVAL29_tree = NULL; ++ ++ stream_RPAR = NULL; ++ #define CREATE_stream_RPAR if (stream_RPAR == NULL) {stream_RPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token RPAR"); } ++ stream_LPAR = NULL; ++ #define CREATE_stream_LPAR if (stream_LPAR == NULL) {stream_LPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token LPAR"); } ++ stream_expression = NULL; ++ #define CREATE_stream_expression if (stream_expression == NULL) {stream_expression = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expression"); } ++ ++ retval.tree = NULL; ++ { ++ { ++ // SMARTPL.g:40:7: ( LPAR expression RPAR -> expression | STRTAG ( INCLUDES | IS ) STR | INTTAG INTBOOL INT | DATETAG ( AFTER | BEFORE ) dateval | ENUMTAG IS ENUMVAL ) ++ ++ ANTLR3_UINT32 alt4; ++ ++ alt4=5; ++ ++ switch ( LA(1) ) ++ { ++ case LPAR: ++ { ++ alt4=1; ++ } ++ break; ++ case STRTAG: ++ { ++ alt4=2; ++ } ++ break; ++ case INTTAG: ++ { ++ alt4=3; ++ } ++ break; ++ case DATETAG: ++ { ++ alt4=4; ++ } ++ break; ++ case ENUMTAG: ++ { ++ alt4=5; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 4; ++ EXCEPTION->state = 0; ++ ++ ++ goto rulecritEx; ++ } ++ ++ switch (alt4) ++ { ++ case 1: ++ // SMARTPL.g:40:9: LPAR expression RPAR ++ { ++ LPAR15 = (pANTLR3_COMMON_TOKEN) MATCHT(LPAR, &FOLLOW_LPAR_in_crit127); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ CREATE_stream_LPAR; stream_LPAR->add(stream_LPAR, LPAR15, NULL); ++ ++ FOLLOWPUSH(FOLLOW_expression_in_crit129); ++ expression16=expression(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ CREATE_stream_expression; stream_expression->add(stream_expression, expression16.tree, NULL); ++ RPAR17 = (pANTLR3_COMMON_TOKEN) MATCHT(RPAR, &FOLLOW_RPAR_in_crit131); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ CREATE_stream_RPAR; stream_RPAR->add(stream_RPAR, RPAR17, NULL); ++ ++ ++ ++ /* AST REWRITE ++ * elements : expression ++ * token labels : ++ * rule labels : retval ++ * token list labels : ++ * rule list labels : ++ */ ++ { ++ pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval; ++ ++ stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL); ++ ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ retval.tree = root_0; ++ // 40:30: -> expression ++ { ++ ADAPTOR->addChild(ADAPTOR, root_0, stream_expression == NULL ? NULL : stream_expression->nextTree(stream_expression)); ++ ++ } ++ ++ retval.tree = root_0; // set result root ++ if (stream_retval != NULL) stream_retval->free(stream_retval); ++ ++ ++ } ++ } ++ break; ++ case 2: ++ // SMARTPL.g:41:6: STRTAG ( INCLUDES | IS ) STR ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ STRTAG18 = (pANTLR3_COMMON_TOKEN) MATCHT(STRTAG, &FOLLOW_STRTAG_in_crit142); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ STRTAG18_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STRTAG18)); ++ ADAPTOR->addChild(ADAPTOR, root_0, STRTAG18_tree); ++ ++ set19=(pANTLR3_COMMON_TOKEN)LT(1); ++ if ( ((LA(1) >= INCLUDES) && (LA(1) <= IS)) ) ++ { ++ CONSUME(); ++ ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set19))); ++ PERRORRECOVERY=ANTLR3_FALSE; ++ } ++ else ++ { ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION; ++ EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME; ++ EXCEPTION->expectingSet = &FOLLOW_set_in_crit144; ++ RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_crit144); goto rulecritEx; ++ } ++ ++ STR20 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_crit150); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ STR20_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STR20)); ++ ADAPTOR->addChild(ADAPTOR, root_0, STR20_tree); ++ ++ ++ } ++ break; ++ case 3: ++ // SMARTPL.g:42:6: INTTAG INTBOOL INT ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ INTTAG21 = (pANTLR3_COMMON_TOKEN) MATCHT(INTTAG, &FOLLOW_INTTAG_in_crit157); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ INTTAG21_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INTTAG21)); ++ ADAPTOR->addChild(ADAPTOR, root_0, INTTAG21_tree); ++ ++ INTBOOL22 = (pANTLR3_COMMON_TOKEN) MATCHT(INTBOOL, &FOLLOW_INTBOOL_in_crit159); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ INTBOOL22_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INTBOOL22)); ++ ADAPTOR->addChild(ADAPTOR, root_0, INTBOOL22_tree); ++ ++ INT23 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_crit161); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ INT23_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INT23)); ++ ADAPTOR->addChild(ADAPTOR, root_0, INT23_tree); ++ ++ ++ } ++ break; ++ case 4: ++ // SMARTPL.g:43:6: DATETAG ( AFTER | BEFORE ) dateval ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ DATETAG24 = (pANTLR3_COMMON_TOKEN) MATCHT(DATETAG, &FOLLOW_DATETAG_in_crit168); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ DATETAG24_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATETAG24)); ++ ADAPTOR->addChild(ADAPTOR, root_0, DATETAG24_tree); ++ ++ set25=(pANTLR3_COMMON_TOKEN)LT(1); ++ if ( ((LA(1) >= AFTER) && (LA(1) <= BEFORE)) ) ++ { ++ CONSUME(); ++ ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set25))); ++ PERRORRECOVERY=ANTLR3_FALSE; ++ } ++ else ++ { ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_MISMATCHED_SET_EXCEPTION; ++ EXCEPTION->name = (void *)ANTLR3_MISMATCHED_SET_NAME; ++ EXCEPTION->expectingSet = &FOLLOW_set_in_crit170; ++ RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_crit170); goto rulecritEx; ++ } ++ ++ FOLLOWPUSH(FOLLOW_dateval_in_crit176); ++ dateval26=dateval(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, dateval26.tree); ++ ++ } ++ break; ++ case 5: ++ // SMARTPL.g:44:6: ENUMTAG IS ENUMVAL ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ ENUMTAG27 = (pANTLR3_COMMON_TOKEN) MATCHT(ENUMTAG, &FOLLOW_ENUMTAG_in_crit183); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ ENUMTAG27_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, ENUMTAG27)); ++ ADAPTOR->addChild(ADAPTOR, root_0, ENUMTAG27_tree); ++ ++ IS28 = (pANTLR3_COMMON_TOKEN) MATCHT(IS, &FOLLOW_IS_in_crit185); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ IS28_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, IS28)); ++ ADAPTOR->addChild(ADAPTOR, root_0, IS28_tree); ++ ++ ENUMVAL29 = (pANTLR3_COMMON_TOKEN) MATCHT(ENUMVAL, &FOLLOW_ENUMVAL_in_crit187); ++ if (HASEXCEPTION()) ++ { ++ goto rulecritEx; ++ } ++ ++ ENUMVAL29_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, ENUMVAL29)); ++ ADAPTOR->addChild(ADAPTOR, root_0, ENUMVAL29_tree); ++ ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto rulecritEx; /* Prevent compiler warnings */ ++ rulecritEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ if (stream_RPAR != NULL) stream_RPAR->free(stream_RPAR); ++ if (stream_LPAR != NULL) stream_LPAR->free(stream_LPAR); ++ if (stream_expression != NULL) stream_expression->free(stream_expression); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end crit */ ++ ++/** ++ * $ANTLR start dateval ++ * SMARTPL.g:47:1: dateval : ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO ); ++ */ ++static SMARTPLParser_dateval_return ++dateval(pSMARTPLParser ctx) ++{ ++ SMARTPLParser_dateval_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN DATE30; ++ pANTLR3_COMMON_TOKEN BEFORE32; ++ pANTLR3_COMMON_TOKEN DATE33; ++ pANTLR3_COMMON_TOKEN AFTER35; ++ pANTLR3_COMMON_TOKEN DATE36; ++ pANTLR3_COMMON_TOKEN AGO38; ++ SMARTPLParser_interval_return interval31; ++ #undef RETURN_TYPE_interval31 ++ #define RETURN_TYPE_interval31 SMARTPLParser_interval_return ++ ++ SMARTPLParser_interval_return interval34; ++ #undef RETURN_TYPE_interval34 ++ #define RETURN_TYPE_interval34 SMARTPLParser_interval_return ++ ++ SMARTPLParser_interval_return interval37; ++ #undef RETURN_TYPE_interval37 ++ #define RETURN_TYPE_interval37 SMARTPLParser_interval_return ++ ++ pANTLR3_BASE_TREE DATE30_tree; ++ pANTLR3_BASE_TREE BEFORE32_tree; ++ pANTLR3_BASE_TREE DATE33_tree; ++ pANTLR3_BASE_TREE AFTER35_tree; ++ pANTLR3_BASE_TREE DATE36_tree; ++ pANTLR3_BASE_TREE AGO38_tree; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ DATE30 = NULL; ++ BEFORE32 = NULL; ++ DATE33 = NULL; ++ AFTER35 = NULL; ++ DATE36 = NULL; ++ AGO38 = NULL; ++ interval31.tree = NULL; ++ ++ interval34.tree = NULL; ++ ++ interval37.tree = NULL; ++ ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ DATE30_tree = NULL; ++ BEFORE32_tree = NULL; ++ DATE33_tree = NULL; ++ AFTER35_tree = NULL; ++ DATE36_tree = NULL; ++ AGO38_tree = NULL; ++ ++ ++ retval.tree = NULL; ++ { ++ { ++ // SMARTPL.g:47:10: ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO ) ++ ++ ANTLR3_UINT32 alt5; ++ ++ alt5=4; ++ ++ switch ( LA(1) ) ++ { ++ case DATE: ++ { ++ alt5=1; ++ } ++ break; ++ case INT: ++ { ++ switch ( LA(2) ) ++ { ++ case DATINTERVAL: ++ { ++ switch ( LA(3) ) ++ { ++ case AGO: ++ { ++ alt5=4; ++ } ++ break; ++ case AFTER: ++ { ++ alt5=3; ++ } ++ break; ++ case BEFORE: ++ { ++ alt5=2; ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 5; ++ EXCEPTION->state = 3; ++ ++ ++ goto ruledatevalEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 5; ++ EXCEPTION->state = 2; ++ ++ ++ goto ruledatevalEx; ++ } ++ ++ } ++ break; ++ ++ default: ++ CONSTRUCTEX(); ++ EXCEPTION->type = ANTLR3_NO_VIABLE_ALT_EXCEPTION; ++ EXCEPTION->message = (void *)""; ++ EXCEPTION->decisionNum = 5; ++ EXCEPTION->state = 0; ++ ++ ++ goto ruledatevalEx; ++ } ++ ++ switch (alt5) ++ { ++ case 1: ++ // SMARTPL.g:47:12: DATE ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ DATE30 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval200); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ DATE30_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE30)); ++ ADAPTOR->addChild(ADAPTOR, root_0, DATE30_tree); ++ ++ ++ } ++ break; ++ case 2: ++ // SMARTPL.g:48:6: interval BEFORE DATE ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ FOLLOWPUSH(FOLLOW_interval_in_dateval207); ++ interval31=interval(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, interval31.tree); ++ BEFORE32 = (pANTLR3_COMMON_TOKEN) MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateval209); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ BEFORE32_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, BEFORE32)); ++ ADAPTOR->addChild(ADAPTOR, root_0, BEFORE32_tree); ++ ++ DATE33 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval211); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ DATE33_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE33)); ++ ADAPTOR->addChild(ADAPTOR, root_0, DATE33_tree); ++ ++ ++ } ++ break; ++ case 3: ++ // SMARTPL.g:49:6: interval AFTER DATE ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ FOLLOWPUSH(FOLLOW_interval_in_dateval218); ++ interval34=interval(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, interval34.tree); ++ AFTER35 = (pANTLR3_COMMON_TOKEN) MATCHT(AFTER, &FOLLOW_AFTER_in_dateval220); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ AFTER35_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AFTER35)); ++ ADAPTOR->addChild(ADAPTOR, root_0, AFTER35_tree); ++ ++ DATE36 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval222); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ DATE36_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE36)); ++ ADAPTOR->addChild(ADAPTOR, root_0, DATE36_tree); ++ ++ ++ } ++ break; ++ case 4: ++ // SMARTPL.g:50:6: interval AGO ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ FOLLOWPUSH(FOLLOW_interval_in_dateval229); ++ interval37=interval(ctx); ++ ++ FOLLOWPOP(); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ ADAPTOR->addChild(ADAPTOR, root_0, interval37.tree); ++ AGO38 = (pANTLR3_COMMON_TOKEN) MATCHT(AGO, &FOLLOW_AGO_in_dateval231); ++ if (HASEXCEPTION()) ++ { ++ goto ruledatevalEx; ++ } ++ ++ AGO38_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AGO38)); ++ ADAPTOR->addChild(ADAPTOR, root_0, AGO38_tree); ++ ++ ++ } ++ break; ++ ++ } ++ } ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruledatevalEx; /* Prevent compiler warnings */ ++ ruledatevalEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end dateval */ ++ ++/** ++ * $ANTLR start interval ++ * SMARTPL.g:53:1: interval : INT DATINTERVAL ; ++ */ ++static SMARTPLParser_interval_return ++interval(pSMARTPLParser ctx) ++{ ++ SMARTPLParser_interval_return retval; ++ ++ pANTLR3_BASE_TREE root_0; ++ ++ pANTLR3_COMMON_TOKEN INT39; ++ pANTLR3_COMMON_TOKEN DATINTERVAL40; ++ ++ pANTLR3_BASE_TREE INT39_tree; ++ pANTLR3_BASE_TREE DATINTERVAL40_tree; ++ ++ /* Initialize rule variables ++ */ ++ ++ ++ root_0 = NULL; ++ ++ INT39 = NULL; ++ DATINTERVAL40 = NULL; ++ retval.start = LT(1); retval.stop = retval.start; ++ ++ INT39_tree = NULL; ++ DATINTERVAL40_tree = NULL; ++ ++ ++ retval.tree = NULL; ++ { ++ // SMARTPL.g:53:10: ( INT DATINTERVAL ) ++ // SMARTPL.g:53:12: INT DATINTERVAL ++ { ++ root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR)); ++ ++ INT39 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_interval243); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintervalEx; ++ } ++ ++ INT39_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INT39)); ++ ADAPTOR->addChild(ADAPTOR, root_0, INT39_tree); ++ ++ DATINTERVAL40 = (pANTLR3_COMMON_TOKEN) MATCHT(DATINTERVAL, &FOLLOW_DATINTERVAL_in_interval245); ++ if (HASEXCEPTION()) ++ { ++ goto ruleintervalEx; ++ } ++ ++ DATINTERVAL40_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATINTERVAL40)); ++ ADAPTOR->addChild(ADAPTOR, root_0, DATINTERVAL40_tree); ++ ++ ++ } ++ ++ } ++ ++ ++ // This is where rules clean up and exit ++ // ++ goto ruleintervalEx; /* Prevent compiler warnings */ ++ ruleintervalEx: ; ++ retval.stop = LT(-1); ++ ++ retval.stop = LT(-1); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0)); ++ ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); ++ ++ if (HASEXCEPTION()) ++ { ++ PREPORTERROR(); ++ PRECOVER(); ++ retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION)); ++ } ++ ++ ++ return retval; ++} ++/* $ANTLR end interval */ ++/* End of parsing rules ++ * ============================================== ++ */ ++ ++/* ============================================== ++ * Syntactic predicates ++ */ ++/* End of syntactic predicates ++ * ============================================== ++ */ ++ ++ ++ ++ ++ ++ ++/* End of code ++ * ============================================================================= ++ */ +diff --git a/src/pregen/SMARTPLParser.h b/src/pregen/SMARTPLParser.h +new file mode 100644 +index 0000000..38ef500 +--- /dev/null ++++ b/src/pregen/SMARTPLParser.h +@@ -0,0 +1,285 @@ ++/** \file ++ * This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3 ++ * ++ * - From the grammar source file : SMARTPL.g ++ * - On : 2016-01-01 12:23:40 ++ * - for the parser : SMARTPLParserParser * ++ * Editing it, at least manually, is not wise. ++ * ++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws. ++ * ++ * ++ * The parser SMARTPLParser has the callable functions (rules) shown below, ++ * which will invoke the code for the associated rule in the source grammar ++ * assuming that the input stream is pointing to a token/text stream that could begin ++ * this rule. ++ * ++ * For instance if you call the first (topmost) rule in a parser grammar, you will ++ * get the results of a full parse, but calling a rule half way through the grammar will ++ * allow you to pass part of a full token stream to the parser, such as for syntax checking ++ * in editors and so on. ++ * ++ * The parser entry points are called indirectly (by function pointer to function) via ++ * a parser context typedef pSMARTPLParser, which is returned from a call to SMARTPLParserNew(). ++ * ++ * The methods in pSMARTPLParser are as follows: ++ * ++ * - SMARTPLParser_playlist_return pSMARTPLParser->playlist(pSMARTPLParser) ++ * - SMARTPLParser_expression_return pSMARTPLParser->expression(pSMARTPLParser) ++ * - SMARTPLParser_aexpr_return pSMARTPLParser->aexpr(pSMARTPLParser) ++ * - SMARTPLParser_nexpr_return pSMARTPLParser->nexpr(pSMARTPLParser) ++ * - SMARTPLParser_crit_return pSMARTPLParser->crit(pSMARTPLParser) ++ * - SMARTPLParser_dateval_return pSMARTPLParser->dateval(pSMARTPLParser) ++ * - SMARTPLParser_interval_return pSMARTPLParser->interval(pSMARTPLParser) ++ * ++ * The return type for any particular rule is of course determined by the source ++ * grammar file. ++ */ ++// [The "BSD licence"] ++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC ++// http://www.temporal-wave.com ++// http://www.linkedin.com/in/jimidle ++// ++// All rights reserved. ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions ++// are met: ++// 1. Redistributions of source code must retain the above copyright ++// notice, this list of conditions and the following disclaimer. ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// 3. The name of the author may not be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++#ifndef _SMARTPLParser_H ++#define _SMARTPLParser_H ++/* ============================================================================= ++ * Standard antlr3 C runtime definitions ++ */ ++#include ++ ++/* End of standard antlr 3 runtime definitions ++ * ============================================================================= ++ */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++// Forward declare the context typedef so that we can use it before it is ++// properly defined. Delegators and delegates (from import statements) are ++// interdependent and their context structures contain pointers to each other ++// C only allows such things to be declared if you pre-declare the typedef. ++// ++typedef struct SMARTPLParser_Ctx_struct SMARTPLParser, * pSMARTPLParser; ++ ++ ++ ++#ifdef ANTLR3_WINDOWS ++// Disable: Unreferenced parameter, - Rules with parameters that are not used ++// constant conditional, - ANTLR realizes that a prediction is always true (synpred usually) ++// initialized but unused variable - tree rewrite variables declared but not needed ++// Unreferenced local variable - lexer rule declares but does not always use _type ++// potentially unitialized variable used - retval always returned from a rule ++// unreferenced local function has been removed - susually getTokenNames or freeScope, they can go without warnigns ++// ++// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at ++// and the codegen must generate some of these warnings by necessity, apart from 4100, which is ++// usually generated when a parser rule is given a parameter that it does not use. Mostly though ++// this is a matter of orthogonality hence I disable that one. ++// ++#pragma warning( disable : 4100 ) ++#pragma warning( disable : 4101 ) ++#pragma warning( disable : 4127 ) ++#pragma warning( disable : 4189 ) ++#pragma warning( disable : 4505 ) ++#pragma warning( disable : 4701 ) ++#endif ++typedef struct SMARTPLParser_playlist_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ SMARTPLParser_playlist_return; ++ ++typedef struct SMARTPLParser_expression_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ SMARTPLParser_expression_return; ++ ++typedef struct SMARTPLParser_aexpr_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ SMARTPLParser_aexpr_return; ++ ++typedef struct SMARTPLParser_nexpr_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ SMARTPLParser_nexpr_return; ++ ++typedef struct SMARTPLParser_crit_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ SMARTPLParser_crit_return; ++ ++typedef struct SMARTPLParser_dateval_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ SMARTPLParser_dateval_return; ++ ++typedef struct SMARTPLParser_interval_return_struct ++{ ++ /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees ++ */ ++ pANTLR3_COMMON_TOKEN start; ++ pANTLR3_COMMON_TOKEN stop; ++ pANTLR3_BASE_TREE tree; ++ ++} ++ SMARTPLParser_interval_return; ++ ++ ++ ++/** Context tracking structure for SMARTPLParser ++ */ ++struct SMARTPLParser_Ctx_struct ++{ ++ /** Built in ANTLR3 context tracker contains all the generic elements ++ * required for context tracking. ++ */ ++ pANTLR3_PARSER pParser; ++ ++ ++ SMARTPLParser_playlist_return (*playlist) (struct SMARTPLParser_Ctx_struct * ctx); ++ SMARTPLParser_expression_return (*expression) (struct SMARTPLParser_Ctx_struct * ctx); ++ SMARTPLParser_aexpr_return (*aexpr) (struct SMARTPLParser_Ctx_struct * ctx); ++ SMARTPLParser_nexpr_return (*nexpr) (struct SMARTPLParser_Ctx_struct * ctx); ++ SMARTPLParser_crit_return (*crit) (struct SMARTPLParser_Ctx_struct * ctx); ++ SMARTPLParser_dateval_return (*dateval) (struct SMARTPLParser_Ctx_struct * ctx); ++ SMARTPLParser_interval_return (*interval) (struct SMARTPLParser_Ctx_struct * ctx); ++ // Delegated rules ++ const char * (*getGrammarFileName)(); ++ void (*free) (struct SMARTPLParser_Ctx_struct * ctx); ++ /* @headerFile.members() */ ++ pANTLR3_BASE_TREE_ADAPTOR adaptor; ++ pANTLR3_VECTOR_FACTORY vectors; ++ /* End @headerFile.members() */ ++}; ++ ++// Function protoypes for the constructor functions that external translation units ++// such as delegators and delegates may wish to call. ++// ++ANTLR3_API pSMARTPLParser SMARTPLParserNew (pANTLR3_COMMON_TOKEN_STREAM instream); ++ANTLR3_API pSMARTPLParser SMARTPLParserNewSSD (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state); ++ ++/** Symbolic definitions of all the tokens that the parser will work with. ++ * \{ ++ * ++ * Antlr will define EOF, but we can't use that as it it is too common in ++ * in C header files and that would be confusing. There is no way to filter this out at the moment ++ * so we just undef it here for now. That isn't the value we get back from C recognizers ++ * anyway. We are looking for ANTLR3_TOKEN_EOF. ++ */ ++#ifdef EOF ++#undef EOF ++#endif ++#ifdef Tokens ++#undef Tokens ++#endif ++#define INTBOOL 14 ++#define STRTAG 10 ++#define AGO 22 ++#define WHITESPACE 29 ++#define GREATEREQUAL 25 ++#define BEFORE 18 ++#define DATETAG 16 ++#define INT 15 ++#define NOT 7 ++#define AFTER 17 ++#define AND 6 ++#define EOF -1 ++#define INCLUDES 11 ++#define STR 4 ++#define T__30 30 ++#define T__31 31 ++#define GREATER 24 ++#define LPAR 8 ++#define ENUMTAG 19 ++#define IS 12 ++#define ENUMVAL 20 ++#define EQUAL 28 ++#define OR 5 ++#define LESS 26 ++#define RPAR 9 ++#define DATE 21 ++#define LESSEQUAL 27 ++#define DATINTERVAL 23 ++#define INTTAG 13 ++#ifdef EOF ++#undef EOF ++#define EOF ANTLR3_TOKEN_EOF ++#endif ++ ++#ifndef TOKENSOURCE ++#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource ++#endif ++ ++/* End of token definitions for SMARTPLParser ++ * ============================================================================= ++ */ ++/** \} */ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif ++ ++/* END - Note:Keep extra line feed to satisfy UNIX systems */ diff --git a/sound/lame/Makefile b/sound/lame/Makefile new file mode 100644 index 0000000..41a90f7 --- /dev/null +++ b/sound/lame/Makefile @@ -0,0 +1,84 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# blogic@openwrt.org + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lame +PKG_VERSION:=3.99.5 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/lame +PKG_MD5SUM:=84835b313d4a8b68f5349816d33e07ce +PKG_FIXUP:=autoreconf + +PKG_MAINTAINER:=Ted Hess + +PKG_LICENSE:=LGPL-2.0 +PKG_LICENSE_FILES:=COPYING LICENSE + +include $(INCLUDE_DIR)/package.mk + +PKG_INSTALL=1 + +define Package/lame/Default + SECTION:=sound + CATEGORY:=Sound + URL:=http://sourceforge.net/projects/lame + DEPENDS:=@BUILD_PATENTED +endef + +define Package/lame +$(call Package/lame/Default) + TITLE:=lame + MENU:=1 + DEPENDS += +libncurses +endef + +define Package/lame/description +lame mp3 encoder +endef + +define Package/lame-lib +$(call Package/lame/Default) + TITLE:=lame-lib +endef + +define Package/lame-lib/description +lame mp3 encoder libs +endef + +CONFIG_VARS+=NASM=no + +ifeq ($(ARCH),i386) +TARGET_CFLAGS+=-msse +endif + +define Package/lame/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lame $(1)/usr/bin/ +endef + +define Package/lame-lib/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*so* $(1)/usr/lib/ +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include/lame + $(INSTALL_DATA) \ + $(PKG_INSTALL_DIR)/usr/include/lame/*.h \ + $(1)/usr/include/lame/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/*.{la,so*} \ + $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,lame-lib)) +$(eval $(call BuildPackage,lame)) diff --git a/sound/lame/patches/001-automake-compat.patch b/sound/lame/patches/001-automake-compat.patch new file mode 100644 index 0000000..8857ad7 --- /dev/null +++ b/sound/lame/patches/001-automake-compat.patch @@ -0,0 +1,33 @@ +--- a/configure.in ++++ b/configure.in +@@ -393,7 +393,7 @@ CONFIG_MATH_LIB="${USE_LIBM}" + + dnl configure use of features + +-AM_PATH_GTK(1.2.0, HAVE_GTK="yes", HAVE_GTK="no") ++HAVE_GTK="no" + + dnl ElectricFence malloc debugging + AC_MSG_CHECKING(use of ElectricFence malloc debugging) +--- a/frontend/Makefile.am ++++ b/frontend/Makefile.am +@@ -35,7 +35,7 @@ lame_SOURCES = lame_main.c $(common_sour + mp3rtp_SOURCES = mp3rtp.c rtp.c $(common_sources) + mp3x_SOURCES = mp3x.c gtkanal.c gpkplotting.c $(common_sources) + +-CFLAGS = @CFLAGS@ @GTK_CFLAGS@ @FRONTEND_CFLAGS@ @SNDFILE_CFLAGS@ ++CFLAGS = @CFLAGS@ @FRONTEND_CFLAGS@ @SNDFILE_CFLAGS@ + LDFLAGS = @LDFLAGS@ @FRONTEND_LDFLAGS@ @SNDFILE_LIBS@ + + INCLUDES = -I$(top_srcdir)/libmp3lame -I$(top_srcdir)/include -I$(top_builddir) +--- a/frontend/Makefile.in ++++ b/frontend/Makefile.in +@@ -99,7 +99,7 @@ AUTOMAKE = @AUTOMAKE@ + AWK = @AWK@ + CC = @CC@ + CCDEPMODE = @CCDEPMODE@ +-CFLAGS = @CFLAGS@ @GTK_CFLAGS@ @FRONTEND_CFLAGS@ @SNDFILE_CFLAGS@ ++CFLAGS = @CFLAGS@ @FRONTEND_CFLAGS@ @SNDFILE_CFLAGS@ + CONFIG_DEFS = @CONFIG_DEFS@ + CONFIG_MATH_LIB = @CONFIG_MATH_LIB@ + CPP = @CPP@ diff --git a/sound/madplay/Makefile b/sound/madplay/Makefile new file mode 100644 index 0000000..00a1b49 --- /dev/null +++ b/sound/madplay/Makefile @@ -0,0 +1,85 @@ +# +# Copyright (C) 2006-2015 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:=madplay +PKG_VERSION:=0.15.2b +PKG_RELEASE:=6 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/mad \ + ftp://ftp.mars.org/pub/mpeg/ +PKG_MD5SUM:=6814b47ceaa99880c754c5195aa1aac1 +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Simon Peter + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/madplay/default + SECTION:=sound + CATEGORY:=Sound + DEPENDS:=+libid3tag +libmad $(INTL_DEPENDS) $(2) + TITLE:=MPEG audio player in fixed point - $(1) + VARIANT:=$(1) + URL:=http://sourceforge.net/projects/mad +endef + +Package/madplay-alsa=$(call Package/madplay/default,alsa,+alsa-lib) +Package/madplay=$(call Package/madplay/default,oss) + +define Package/madplay/description + MAD is an MPEG audio decoder. It currently only supports the MPEG 1 + standard, but fully implements all three audio layers (Layer I, Layer II, + and Layer III, the latter often colloquially known as MP3.). There is also + full support for ID3 tags. +endef + +define Build/Configure + $(call Build/Configure/Default, \ + --enable-shared \ + --disable-static \ + --disable-debugging \ + --disable-profiling \ + --disable-experimental \ + --without-libiconv-prefix \ + --without-libintl-prefix \ + --without-esd \ + , \ + LIBS="-lz" \ + ) +endef + +ifeq ($(BUILD_VARIANT),alsa) + CONFIGURE_ARGS += \ + --without-oss \ + --with-alsa +endif + +ifeq ($(BUILD_VARIANT),oss) + CONFIGURE_ARGS += \ + --without-alsa +endif + +define Package/madplay/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/madplay $(1)/usr/bin/ +endef + +define Package/madplay-alsa/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/madplay $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,madplay-alsa)) +$(eval $(call BuildPackage,madplay)) diff --git a/sound/madplay/patches/0001-switch-to-new-alsa-api.patch b/sound/madplay/patches/0001-switch-to-new-alsa-api.patch new file mode 100644 index 0000000..60d7bd3 --- /dev/null +++ b/sound/madplay/patches/0001-switch-to-new-alsa-api.patch @@ -0,0 +1,173 @@ +Switch madplay to the new API. This is done thanks to a patch written +by Micha Nelissen and available at +http://article.gmane.org/gmane.comp.audio.mad.devel/729. + +--- madplay-0.15.2b/audio_alsa.c 2008-10-18 15:10:16.000000000 +0200 ++++ madplay-0.15.2b/audio_alsa.c.new 2008-10-18 15:03:27.000000000 +0200 +@@ -28,31 +28,30 @@ + + #include + +-#define ALSA_PCM_OLD_HW_PARAMS_API +-#define ALSA_PCM_OLD_SW_PARAMS_API + #include + + #include + + #include "audio.h" + +-char *buf = NULL; +-int paused = 0; ++#define BUFFER_TIME_MAX 500000 + +-int rate = -1; +-int channels = -1; +-int bitdepth = -1; +-int sample_size = -1; +- +-int buffer_time = 500000; +-int period_time = 100000; +-char *defaultdev = "plughw:0,0"; ++unsigned char *buf = NULL; ++int paused = 0; ++ ++unsigned int rate = 0; ++unsigned int channels = -1; ++unsigned int bitdepth = -1; ++unsigned int sample_size = -1; ++ ++unsigned int buffer_time; ++unsigned int period_time; ++char *defaultdev = "plughw:0,0"; + + snd_pcm_hw_params_t *alsa_hwparams; + snd_pcm_sw_params_t *alsa_swparams; + +-snd_pcm_sframes_t buffer_size; +-snd_pcm_sframes_t period_size; ++snd_pcm_uframes_t buffer_size; + + snd_pcm_format_t alsa_format = -1; + snd_pcm_access_t alsa_access = SND_PCM_ACCESS_MMAP_INTERLEAVED; +@@ -66,14 +65,20 @@ + snd_pcm_hw_params_t *params, + snd_pcm_access_t access) + { +- int err, dir; +- ++ int err; ++ + /* choose all parameters */ + err = snd_pcm_hw_params_any(handle,params); + if (err < 0) { + printf("Access type not available for playback: %s\n", snd_strerror(err)); + return err; + } ++ /* set the access type */ ++ err = snd_pcm_hw_params_set_access(handle, params, alsa_access); ++ if (err < 0) { ++ printf("Sample format not available for playback: %s\n", snd_strerror(err)); ++ return err; ++ } + /* set the sample format */ + err = snd_pcm_hw_params_set_format(handle, params, alsa_format); + if (err < 0) { +@@ -87,29 +92,38 @@ + return err; + } + /* set the stream rate */ +- err = snd_pcm_hw_params_set_rate_near(handle, params, rate, 0); ++ err = snd_pcm_hw_params_set_rate(handle, params, rate, 0); + if (err < 0) { + printf("Rate %iHz not available for playback: %s\n", rate, snd_strerror(err)); + return err; + } +- if (err != rate) { +- printf("Rate doesn't match (requested %iHz, get %iHz)\n", rate, err); +- return -EINVAL; +- } ++ err = snd_pcm_hw_params_get_buffer_time_max(params, &buffer_time, NULL); ++ if (err < 0) { ++ printf("Unable to retrieve buffer time: %s\n", snd_strerror(err)); ++ return err; ++ } ++ if (buffer_time > BUFFER_TIME_MAX) ++ buffer_time = BUFFER_TIME_MAX; + /* set buffer time */ +- err = snd_pcm_hw_params_set_buffer_time_near(handle, params, buffer_time, &dir); ++ err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, 0); + if (err < 0) { + printf("Unable to set buffer time %i for playback: %s\n", buffer_time, snd_strerror(err)); + return err; + } +- buffer_size = snd_pcm_hw_params_get_buffer_size(params); ++ if (period_time * 4 > buffer_time) ++ period_time = buffer_time / 4; + /* set period time */ +- err = snd_pcm_hw_params_set_period_time_near(handle, params, period_time, &dir); ++ err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, NULL); + if (err < 0) { + printf("Unable to set period time %i for playback: %s\n", period_time, snd_strerror(err)); + return err; + } +- period_size = snd_pcm_hw_params_get_period_size(params, &dir); ++ /* retrieve buffer size */ ++ err = snd_pcm_hw_params_get_buffer_size(params, &buffer_size); ++ if (err < 0) { ++ printf("Unable to retrieve buffer size: %s\n", snd_strerror(err)); ++ return err; ++ } + /* write the parameters to device */ + err = snd_pcm_hw_params(handle, params); + if (err < 0) { +@@ -123,6 +137,7 @@ + int set_swparams(snd_pcm_t *handle, + snd_pcm_sw_params_t *params) + { ++ unsigned int start_threshold; + int err; + + /* get current swparams */ +@@ -136,13 +151,7 @@ + if (err < 0) { + printf("Unable to set start threshold mode for playback: %s\n", snd_strerror(err)); + return err; +- } +- /* allow transfer when at least period_size samples can be processed */ +- err = snd_pcm_sw_params_set_avail_min(handle, params, period_size); +- if (err < 0) { +- printf("Unable to set avail min for playback: %s\n", snd_strerror(err)); +- return err; +- } ++ } + /* align all transfers to 1 samples */ + err = snd_pcm_sw_params_set_xfer_align(handle, params, 1); + if (err < 0) { +@@ -190,7 +199,7 @@ + rate = config->speed; + + if ( bitdepth == 0 ) +- config->precision = bitdepth = 32; ++ config->precision = bitdepth = 16; + + switch (bitdepth) + { +@@ -241,7 +250,7 @@ + return -1; + } + +- buf = malloc(buffer_size); ++ buf = malloc(buffer_size * sample_size); + if (buf == NULL) { + audio_error="unable to allocate output buffer table"; + return -1; +@@ -279,7 +288,7 @@ + int play(struct audio_play *play) + { + int err, len; +- char *ptr; ++ unsigned char *ptr; + + ptr = buf; + len = play->nsamples; + diff --git a/sound/madplay/patches/010-use_correct_shell.patch b/sound/madplay/patches/010-use_correct_shell.patch new file mode 100644 index 0000000..c8eb2a3 --- /dev/null +++ b/sound/madplay/patches/010-use_correct_shell.patch @@ -0,0 +1,30 @@ +--- a/intl/Makefile.in ++++ b/intl/Makefile.in +@@ -19,7 +19,7 @@ + PACKAGE = @PACKAGE@ + VERSION = @VERSION@ + +-SHELL = /bin/sh ++SHELL = @SHELL@ + + srcdir = @srcdir@ + top_srcdir = @top_srcdir@ +@@ -56,6 +56,7 @@ DEFS = -DLOCALEDIR=\"$(localedir)\" -DLO + -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"$(libdir)\" -DNO_XMALLOC \ + -Dset_relocation_prefix=libintl_set_relocation_prefix \ + -Drelocate=libintl_relocate \ ++-DINSTALLPREFIX=\"$(prefix)\" \ + -DDEPENDS_ON_LIBICONV=1 @DEFS@ + CPPFLAGS = @CPPFLAGS@ + CFLAGS = @CFLAGS@ +--- a/po/Makefile.in.in ++++ b/po/Makefile.in.in +@@ -13,7 +13,7 @@ + PACKAGE = @PACKAGE@ + VERSION = @VERSION@ + +-SHELL = /bin/sh ++SHELL = @SHELL@ + @SET_MAKE@ + + srcdir = @srcdir@ diff --git a/sound/mocp/Makefile b/sound/mocp/Makefile new file mode 100644 index 0000000..0c446fc --- /dev/null +++ b/sound/mocp/Makefile @@ -0,0 +1,66 @@ +# +# Copyright (C) 2011-2015 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:=moc +PKG_VERSION:=2.5.0 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://ftp.daper.net/pub/soft/moc/stable/ +PKG_MD5SUM:=18e3a979b67091bfee4b62217908c473 + +PKG_MAINTAINER:=Ted Hess + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/moc + SECTION:=sound + CATEGORY:=Sound + DEPENDS:=+libcurl +BUILD_PATENTED:libmad +libvorbis $(ICONV_DEPENDS) +alsa-lib +libid3tag +libflac +libsamplerate +libncursesw +libffmpeg +libltdl +libmagic +faad2 +libdb47 + TITLE:=Music On Console + URL:=http://moc.daper.net/ +endef + +define Package/moc/description + MOC (music on console) is a console audio player for LINUX/UNIX designed to be powerful and easy to use. +endef + +TARGET_CFLAGS+=-D_GNU_SOURCE + +TARGET_CPPFLAGS+=-P + +CONFIGURE_ARGS+= \ + $(if $(CONFIG_BUILD_PATENTED),,--without-mp3) \ + --enable-shared \ + --disable-static \ + --disable-debug \ + --without-speex \ + --without-samplerate \ + --without-curl \ + --without-flac \ + --without-musepack \ + --without-rcc \ + $(if $(CONFIG_PACKAGE_libncursesw),--with-ncursesw --without-ncurses,--with-ncurses --without-ncursesw) \ + --with-bdb-dir="$(STAGING_DIR)/usr" + +define Package/moc/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mocp $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib/moc/decoder_plugins + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/moc/decoder_plugins/*.so $(1)/usr/lib/moc/decoder_plugins +endef + +$(eval $(call BuildPackage,moc)) diff --git a/sound/mpc/Makefile b/sound/mpc/Makefile new file mode 100644 index 0000000..3109b1c --- /dev/null +++ b/sound/mpc/Makefile @@ -0,0 +1,58 @@ +# +# 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:=mpc +PKG_VERSION:=0.27 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=http://www.musicpd.org/download/mpc/0 +PKG_MD5SUM:=d9430db9b9d7fb1eadbe4d13e8d97c66 +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Ted Hess + +include $(INCLUDE_DIR)/package.mk + +define Package/mpc + SECTION:=sound + CATEGORY:=Sound + DEPENDS:=+libmpdclient + TITLE:=Music Player Daemon Console Client + URL:=http://www.musicpd.org/ +endef + +define Package/mpc/description + MPD is a music player supporting flac, mp3 and ogg files. + It is typically controlled over a network using one of it's many + clients including mpc(console), gmpc(gnome), phpmp(php) etc. + this is MPC +endef + +define Build/Configure +$(call Build/Configure/Default, \ + --disable-iconv \ +) +endef + +define Build/Compile +$(call Build/Compile/Default,\ + CFLAGS="$(TARGET_CFLAGS) -std=gnu99" \ + prefix="/usr" \ + all \ +) +endef + +define Package/mpc/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mpc $(1)/usr/bin/ + $(INSTALL_BIN) ./files/pls-handler.sh $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,mpc)) diff --git a/sound/mpc/files/pls-handler.sh b/sound/mpc/files/pls-handler.sh new file mode 100644 index 0000000..9394417 --- /dev/null +++ b/sound/mpc/files/pls-handler.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh +echo parameter: file.pls +mpc clear +grep '^File[0-9]*' $1 | sed -e 's/^File[0-9]*=//' | mpc add +mpc play \ No newline at end of file diff --git a/sound/mpd/Makefile b/sound/mpd/Makefile new file mode 100644 index 0000000..162660a --- /dev/null +++ b/sound/mpd/Makefile @@ -0,0 +1,229 @@ +# +# Copyright (C) 2015-2016 Ted Hess +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=mpd +PKG_VERSION:=0.19.19 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=http://www.musicpd.org/download/mpd/0.19/ +PKG_MD5SUM:=6e4fca9a9c26dad08b61bac9a91802db +PKG_MAINTAINER:=Ted Hess + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) +PKG_BUILD_PARALLEL:=1 + +PKG_CONFIG_DEPENDS:= \ + CONFIG_IPV6 \ + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/mpd/Default + SECTION:=sound + CATEGORY:=Sound + TITLE:=Music Player Daemon + URL:=http://www.musicpd.org/ + DEPENDS:= +glib2 +libcurl +libpthread +libmpdclient +libstdcpp $(ICONV_DEPENDS) \ + +libflac +BUILD_PATENTED:libmad +libvorbisidec +AUDIO_SUPPORT:alsa-lib \ + +boost +boost-container +libexpat +endef + +define Package/mpd/Default/description + Music Player Daemon (MPD) is a flexible, powerful, server-side + application for playing music. It is typically controlled over a + network using one of it's many clients including mpc (console), + gmpc (gnome), phpmp (php), etc... +endef + +define Package/mpd-full +$(call Package/mpd/Default) + TITLE+= (full) + DEPENDS+= \ + +libaudiofile +BUILD_PATENTED:libfaad2 +libffmpeg +libid3tag \ + +libmms +libogg +libsndfile +libvorbis +libupnp + PROVIDES:=mpd + VARIANT:=full +endef + +define Package/mpd-full/description +$(call Package/mpd/Default/description) + . + This package contains a full-blown Music Player Daemon. +endef + +define Package/mpd-full/conffiles +/etc/mpd.conf +endef + +define Package/mpd-mini +$(call Package/mpd/Default) + TITLE+= (mini) + PROVIDES:=mpd + VARIANT:=mini +endef + +define Package/mpd-mini/description +$(call Package/mpd/Default/description) + . + This package contains a minimal Music Player Daemon, with support for + only Flac, MP3 & OGG media types & only file: & http: protocols. +endef + +define Package/mpd-mini/conffiles +/etc/mpd.conf +endef + +define Package/mpd-avahi-service +$(call Package/mpd/Default) + TITLE+= (Avahi service) + DEPENDS+=+avahi-daemon +endef + +define Package/mpd-avahi-service/description +$(call Package/mpd/Default/description) + . + This package contains the service definition for announcing the + Music Player Daemon service via mDNS/DNS-SD. +endef + +define Package/mpd-avahi-service/conffiles +/etc/avahi/services/mpd.service +endef + +CONFIGURE_ARGS += \ + $(call autoconf_bool,CONFIG_IPV6,ipv6) \ + --disable-debug \ + --disable-documentation \ + --disable-test \ + --disable-werror \ + \ + --disable-ao \ + --disable-bzip2 \ + --disable-fluidsynth \ + --disable-wildmidi \ + --disable-gme \ + --enable-inotify \ + --disable-icu \ + --disable-eventfd \ + --disable-iso9660 \ + --disable-jack \ + --disable-roar \ + --disable-libwrap \ + --disable-lsr \ + --disable-mikmod \ + --disable-modplug \ + --disable-mpc \ + --disable-mpg123 \ + --disable-openal \ + --disable-opus \ + --disable-pulse \ + --disable-sidplay \ + --disable-solaris-output \ + --disable-sqlite \ + --disable-lame-encoder \ + --disable-twolame-encoder \ + --disable-shine-encoder \ + --enable-wave-encoder \ + --disable-wavpack \ + --disable-wildmidi \ + --disable-zzip \ + --with-zeroconf=no \ + --disable-soxr \ + \ + --enable-curl \ + --enable-flac \ + --enable-httpd-output \ + $(call autoconf_bool,CONFIG_BUILD_PATENTED,mad) \ + $(call autoconf_bool,CONFIG_AUDIO_SUPPORT,alsa) \ + --enable-tcp \ + --enable-un \ + +CONFIGURE_VARS += \ + FLAC_CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/FLAC" \ + FLAC_LIBS="$(TARGET_LDFLAGS) -lFLAC" \ + $(if $(CONFIG_BUILD_PATENTED),MAD_CFLAGS="$(TARGET_CFLAGS)") \ + $(if $(CONFIG_BUILD_PATENTED),MAD_LIBS="$(TARGET_LDFLAGS) -lmad") \ + +TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib $(if $(ICONV_FULL),-liconv) + +ifeq ($(BUILD_VARIANT),full) + + CONFIGURE_ARGS += \ + --enable-upnp \ + $(call autoconf_bool,CONFIG_BUILD_PATENTED,aac) \ + --enable-audiofile \ + --enable-fifo \ + --enable-ffmpeg \ + --enable-id3 \ + --enable-lastfm \ + --enable-mms \ + --enable-oggflac \ + --enable-pipe-output \ + --enable-recorder-output \ + --disable-shout \ + --enable-sndfile \ + --enable-vorbis \ + --disable-vorbis-encoder \ + --with-faad="$(STAGING_DIR)/usr" \ + --with-tremor=yes \ + +endif + +ifeq ($(BUILD_VARIANT),mini) + + # oggflac is not compatible with tremor + CONFIGURE_ARGS += \ + --disable-upnp \ + --disable-aac \ + --disable-audiofile \ + --disable-fifo \ + --disable-ffmpeg \ + --disable-id3 \ + --disable-mms \ + --disable-pipe-output \ + --disable-recorder-output \ + --disable-shout \ + --disable-sndfile \ + --disable-vorbis \ + --disable-vorbis-encoder \ + --with-tremor=yes \ + +endif + +define Package/mpd/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mpd $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_BUILD_DIR)/doc/mpdconf.example $(1)/etc/mpd.conf + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/mpd.init $(1)/etc/init.d/mpd +endef + +define Package/mpd-full/install +$(call Package/mpd/install,$1) +endef + +define Package/mpd-mini/install +$(call Package/mpd/install,$1) +endef + +define Package/mpd-avahi-service/install + $(INSTALL_DIR) $(1)/etc/avahi/services + $(INSTALL_DATA) ./files/mpd.service $(1)/etc/avahi/services/ +endef + +$(eval $(call BuildPackage,mpd-full)) +$(eval $(call BuildPackage,mpd-mini)) +$(eval $(call BuildPackage,mpd-avahi-service)) diff --git a/sound/mpd/files/mpd.init b/sound/mpd/files/mpd.init new file mode 100644 index 0000000..ac8f1fc --- /dev/null +++ b/sound/mpd/files/mpd.init @@ -0,0 +1,30 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2007-2014 OpenWrt.org + +START=93 + +USE_PROCD=1 + +PROG=/usr/bin/mpd +CONFIGFILE=/etc/mpd.conf +NICEPRIO=-10 + +#TODO: Add uci config - nice, config + +start_service() { + #create mpd directories from config + local pld=`grep ^playlist_directory "$CONFIGFILE" | cut -d "\"" -f 2 | sed "s/~/\/root/g"` + if [ ! -d $pld ]; then + mkdir -m 0755 -p $pld + fi + + local lport=`grep ^port "$CONFIGFILE" | cut -d "\"" -f 2` + [ -z $lport ] && lport=6600 + + procd_open_instance + procd_add_mdns "mpd" "tcp" "$lport" + procd_set_param command "$PROG" --no-daemon "$CONFIGFILE" + # Give MPD some real-time priority + procd_set_param nice "$NICEPRIO" + procd_close_instance +} diff --git a/sound/mpd/files/mpd.service b/sound/mpd/files/mpd.service new file mode 100644 index 0000000..a545f24 --- /dev/null +++ b/sound/mpd/files/mpd.service @@ -0,0 +1,9 @@ + + + + %h + + _mpd._tcp + 6600 + + diff --git a/sound/mpd/patches/210-support_raw_pcm_streams.patch b/sound/mpd/patches/210-support_raw_pcm_streams.patch new file mode 100644 index 0000000..2756570 --- /dev/null +++ b/sound/mpd/patches/210-support_raw_pcm_streams.patch @@ -0,0 +1,10 @@ +--- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx ++++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx +@@ -777,6 +777,7 @@ static const char *const ffmpeg_mime_typ + "audio/qcelp", + "audio/vorbis", + "audio/vorbis+ogg", ++ "audio/wav", + "audio/x-8svx", + "audio/x-16sv", + "audio/x-aac", diff --git a/sound/mpd/patches/220-handle_slow_server_stream_startup.patch b/sound/mpd/patches/220-handle_slow_server_stream_startup.patch new file mode 100644 index 0000000..2ebb91c --- /dev/null +++ b/sound/mpd/patches/220-handle_slow_server_stream_startup.patch @@ -0,0 +1,16 @@ +--- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx ++++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx +@@ -465,6 +465,13 @@ ffmpeg_probe(Decoder *decoder, InputStre + + unsigned char buffer[BUFFER_SIZE]; + size_t nbytes = decoder_read(decoder, is, buffer, BUFFER_SIZE); ++ ++ if ((nbytes > 0) && (nbytes < 1024)) ++ { ++ // Gobble some more data if header is small ++ nbytes += decoder_read(decoder, is, buffer + nbytes, BUFFER_SIZE - nbytes); ++ } ++ + if (nbytes <= PADDING || !is.LockRewind(IgnoreError())) + return nullptr; + diff --git a/sound/mpg123/Makefile b/sound/mpg123/Makefile new file mode 100644 index 0000000..8495ed2 --- /dev/null +++ b/sound/mpg123/Makefile @@ -0,0 +1,102 @@ +# +# Copyright (C) 2007-2015 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:=mpg123 +PKG_VERSION:=1.22.3 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://www.mpg123.de/download/ +PKG_MD5SUM:=fca857bc5ad0d2070cd38bd5f0f85f1c +PKG_MAINTAINER:=Zoltan HERPAI + +PKG_FIXUP:=libtool + +PKG_LICENSE:=LGPL-2.1 GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/mpg123/Default + URL:=http://www.mpg123.de + DEPENDS:=@BUILD_PATENTED +endef + +define Package/libmpg123 + $(call Package/mpg123/Default) + SECTION:=libs + CATEGORY:=Libraries + TITLE:=fast console mpeg audio decoder library + DEPENDS:=+libltdl +endef + +define Package/mpg123 + $(call Package/mpg123/Default) + SECTION:=sound + CATEGORY:=Sound + TITLE:=fast console mpeg audio player + DEPENDS+=+libmpg123 +alsa-lib +endef + +define Build/Configure + $(call Build/Configure/Default, \ + --enable-shared \ + --enable-static \ + --with-cpu=generic_nofpu \ + --with-audio=alsa \ + --with-default-audio=alsa \ + ) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(INSTALL_DATA) \ + $(PKG_INSTALL_DIR)/usr/include/mpg123.h \ + $(1)/usr/include/ + + $(INSTALL_DIR) $(1)/usr/lib + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/libmpg123.{la,a,so*} \ + $(1)/usr/lib/ + + $(INSTALL_DIR) $(1)/usr/lib/mpg123 + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/mpg123/* \ + $(1)/usr/lib/mpg123 + + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libmpg123.pc \ + $(1)/usr/lib/pkgconfig +endef + +define Package/libmpg123/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/libmpg123.so* \ + $(1)/usr/lib/ +endef + +define Package/mpg123/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/mpg123{,-id3dump,-strip} \ + $(PKG_INSTALL_DIR)/usr/bin/out123 \ + $(1)/usr/bin + + $(INSTALL_DIR) $(1)/usr/lib/mpg123 + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/mpg123/* \ + $(1)/usr/lib/mpg123 +endef + +$(eval $(call BuildPackage,libmpg123)) +$(eval $(call BuildPackage,mpg123)) diff --git a/sound/pianod/Makefile b/sound/pianod/Makefile new file mode 100644 index 0000000..7fb48a9 --- /dev/null +++ b/sound/pianod/Makefile @@ -0,0 +1,110 @@ +# +# Copyright (C) 2015 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:=pianod +PKG_VERSION:=174 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://deviousfish.com/Downloads/pianod/ +PKG_MD5SUM:=cca2143e4a5301dea8c0cb9fcbd20881 + +PKG_MAINTAINER:=Ted Hess + +PKG_LICENSE:=MIT VARIOUS +PKG_LICENSE_FILES:=COPYING + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/pianod + SECTION:=sound + CATEGORY:=Sound + DEPENDS:=+libao +libfaad2 +libmad +libpolarssl +libjson-c +libgcrypt +libpthread + TITLE:=Pandora radio daemon + USERID:=pianod=88:pianod=88 + URL:=http://deviousfish.com/pianod/ +endef + +define Package/pianod/description + pianod is a Pandora music player client with line-oriented and Websocket control interfaces. + A simple protocol makes for easy clients, mix scripting, integration with a + home automation system, use as multiple-user music system for home or office. + Documentation and configuration information can be found at: + http://deviousfish.com/pianod/ +endef + +define Package/pianod-client + SECTION:=sound + CATEGORY:=Sound + DEPENDS:=+pianod + TITLE:=Pandora radio daemon WebUI + URL:=http://deviousfish.com/pianod/ +endef + +define Package/pianod-client/description + Web client UI and remote player viewer for pianod + Examples --- (Note: The viewer.* files need not be on the pianod host) + Main interface: http://pianod-host:4446/pianod + Remote viewer: file:////viewer.html?server=pianod-host:4446 --or-- + http://pianod-host:4446/pianod/viewer.html?server=pianod-host:4446 +endef + +CONFIGURE_ARGS+= --with-polarssl + +PIANOD_CLIENT:=pianod-client-compiled-51.tar.gz + +define Download/pianod-client + URL:=$(PKG_SOURCE_URL) + FILE:=$(PIANOD_CLIENT) + MD5SUM:=abbdee5627bcee6a00c8304da8b4e2e7 +endef + +define Package/pianod/conffiles +/etc/pianod/startscript +/etc/pianod/users +endef + +define Build/Prepare + $(call Build/Prepare/Default) + ifneq ($(CONFIG_PACKAGE_pianod-client),) + $(eval $(call Download,pianod-client)) + mkdir -p $(PKG_BUILD_DIR)/pianod-client + $(TAR) -xf $(DL_DIR)/$(PIANOD_CLIENT) --strip=1 -C $(PKG_BUILD_DIR)/pianod-client + endif +endef + +define Package/pianod-client/Configure +endef + +define Package/pianod-client/Compile +endef + +define Package/pianod/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pianod $(1)/usr/bin/ +# These scripts need ksh (install mksh and link) +# $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/piano $(1)/usr/bin/ +# $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/runmix $(1)/usr/bin/ + + $(INSTALL_DIR) $(1)/etc/pianod + $(INSTALL_DATA) $(PKG_BUILD_DIR)/contrib/startscript-example $(1)/etc/pianod/startscript + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/pianod.init $(1)/etc/init.d/pianod +endef + +define Package/pianod-client/install + $(INSTALL_DIR) $(1)/www/pianod + $(INSTALL_DATA) $(PKG_BUILD_DIR)/pianod-client/*.{html,js,gif,jpeg,css} $(1)/www/pianod/ +endef + +$(eval $(call BuildPackage,pianod)) +$(eval $(call BuildPackage,pianod-client)) diff --git a/sound/pianod/files/pianod.init b/sound/pianod/files/pianod.init new file mode 100644 index 0000000..b232944 --- /dev/null +++ b/sound/pianod/files/pianod.init @@ -0,0 +1,42 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 OpenWrt.org + +NAME=pianod +START=95 + +USE_PROCD=1 + +PD_USER=$NAME +PD_STARTSCRIPT=/etc/$NAME/startscript +PD_PASSWDFILE=/etc/$NAME/users +PD_WEBUI=/www/$NAME + +start_service() { + # Take group ownership of audio devices + chown root:$NAME /dev/snd/* /dev/mixer /dev/dsp + chmod 664 /dev/snd/* /dev/mixer /dev/dsp + + procd_open_instance + + procd_set_param command "/usr/bin/$NAME" + + procd_append_param command -n $PD_USER + procd_append_param command -i "$PD_STARTSCRIPT" + procd_append_param command -u "$PD_PASSWDFILE" + [ -d "$PD_WEBUI" ] && procd_append_param command -c "$PD_WEBUI" + # No HTTPS support without certificates + procd_append_param command -s 0 + + procd_close_instance +} + +# Wait for service to exit and release sockets +reload_service() { + stop + sleep 2 + start +} + +restart() { + reload_service +} diff --git a/sound/pianod/patches/005-Remove_svn_version_query.patch b/sound/pianod/patches/005-Remove_svn_version_query.patch new file mode 100644 index 0000000..0ffd3a6 --- /dev/null +++ b/sound/pianod/patches/005-Remove_svn_version_query.patch @@ -0,0 +1,11 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -3,7 +3,7 @@ + + AC_PREREQ([2.69]) + AC_INIT([pianod], +- m4_esyscmd([svn info http://svn.deviousfish.com/pianod | grep Revision: | awk '{print $2}' | tr -d '\n']), ++ 174-OpenWrt, + [pianod@lists.deviousfish.com], + ,[http://deviousfish.com/pianod]) + AM_INIT_AUTOMAKE([foreign -Wall -Werror]) diff --git a/sound/pianod/patches/010-Configure_add_SSL_options.patch b/sound/pianod/patches/010-Configure_add_SSL_options.patch new file mode 100644 index 0000000..2c26779 --- /dev/null +++ b/sound/pianod/patches/010-Configure_add_SSL_options.patch @@ -0,0 +1,42 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -31,8 +31,6 @@ AC_CHECK_LIB([pthread], [pthread_create] + # with it, but don't consider it an error. + # PKG_CHECK_MODULES only validates that pkg-config returns stuff; it doesn't + # validate that these are correct, so check lib to make sure they're right. +-PKG_CHECK_MODULES([gnutls], [gnutls],, +- [AC_MSG_WARN([No pkg-config for libgnutls])]) + PKG_CHECK_MODULES([ao], [ao],, + [AC_MSG_WARN([No pkg-config for libao])]) + PKG_CHECK_MODULES([mad], [mad],, +@@ -42,12 +40,28 @@ PKG_CHECK_MODULES([json], [json-c],, + [PKG_CHECK_MODULES([json], [json0],, + [AC_MSG_WARN([No pkg-config for json-c (aka libjson0, libjson)])])])]) + ++ + # Network communication stuff: + AC_CHECK_LIB([gcrypt], [gcry_cipher_open],, + [AC_MSG_ERROR([Cannot find required library: libgcrypt],1)]) +-AC_CHECK_LIB([gnutls], [gnutls_record_recv],, ++# Check for SSL option ++AC_ARG_WITH(polarssl, [ --with-polarssl Build waitress with PolarSSL (default GNUTLS)], [ ++ AC_MSG_RESULT(>>Using PolarSSL) ++ HAS_POLARSSL=1 ++ AC_DEFINE([USE_POLARSSL], 1, [Build for PolarSSL]) ++ PKG_CHECK_MODULES([polarssl], [polarssl],, ++ [AC_MSG_WARN([No pkg-config for libpolarssl])]) ++ AC_CHECK_LIB([polarssl], [ssl_set_session],, ++ [AC_MSG_ERROR([Cannot find required library: libpolarssl (aka polarssl)],1)])] ) ++AM_CONDITIONAL([USE_POLARSSL],[test "x$HAS_POLARSSL" = "x1"]) ++ ++if test "x$HAS_POLARSSL" != x1 ; then ++ PKG_CHECK_MODULES([gnutls], [gnutls],, ++ [AC_MSG_WARN([No pkg-config for libgnutls])]) ++ AC_CHECK_LIB([gnutls], [gnutls_record_recv],, + [AC_MSG_ERROR([Cannot find required library: libgnutls (aka gnutls)],1)]) +-AC_CHECK_FUNCS(gnutls_transport_set_int2 gnutls_sec_param_to_pk_bits) ++ AC_CHECK_FUNCS(gnutls_transport_set_int2 gnutls_sec_param_to_pk_bits) ++fi + + # Bloody json library may be linked via -ljson, or -ljson-c depending on + # the platform. Try both. diff --git a/sound/pianod/patches/020-Use_package_config_h_for_all_modules.patch b/sound/pianod/patches/020-Use_package_config_h_for_all_modules.patch new file mode 100644 index 0000000..25569cc --- /dev/null +++ b/sound/pianod/patches/020-Use_package_config_h_for_all_modules.patch @@ -0,0 +1,59 @@ +--- a/src/libpiano/config.h ++++ /dev/null +@@ -1 +0,0 @@ +-#define PACKAGE "libpiano" +--- a/src/libwaitress/config.h ++++ /dev/null +@@ -1 +0,0 @@ +-#define PACKAGE "libwaitress" +--- a/src/libpiano/piano.h ++++ b/src/libpiano/piano.h +@@ -39,6 +39,8 @@ THE SOFTWARE. + * http://pan-do-ra-api.wikia.com + */ + ++#define LIBPIANO_NAME "libpiano" ++ + #define PIANO_RPC_HOST "tuner.pandora.com" + #define PIANO_RPC_PATH "/services/json/?" + +--- a/src/libwaitress/waitress.c ++++ b/src/libwaitress/waitress.c +@@ -922,14 +922,14 @@ static WaitressReturn_t WaitressSendRequ + if (WaitressProxyEnabled (waith) && !waith->url.tls) { + snprintf (buf, WAITRESS_BUFFER_SIZE, + "%s http://%s:%s/%s HTTP/" WAITRESS_HTTP_VERSION "\r\n" +- "Host: %s\r\nUser-Agent: " PACKAGE "\r\nConnection: Close\r\n", ++ "Host: %s\r\nUser-Agent: " LIBWAITRESS_NAME "\r\nConnection: Close\r\n", + (waith->method == WAITRESS_METHOD_GET ? "GET" : "POST"), + waith->url.host, + WaitressDefaultPort (&waith->url), path, waith->url.host); + } else { + snprintf (buf, WAITRESS_BUFFER_SIZE, + "%s /%s HTTP/" WAITRESS_HTTP_VERSION "\r\n" +- "Host: %s\r\nUser-Agent: " PACKAGE "\r\nConnection: Close\r\n", ++ "Host: %s\r\nUser-Agent: " LIBWAITRESS_NAME "\r\nConnection: Close\r\n", + (waith->method == WAITRESS_METHOD_GET ? "GET" : "POST"), + path, waith->url.host); + } +--- a/src/libwaitress/waitress.h ++++ b/src/libwaitress/waitress.h +@@ -29,6 +29,8 @@ THE SOFTWARE. + #include + #include + ++#define LIBWAITRESS_NAME "libwaitress" ++ + #define WAITRESS_BUFFER_SIZE 10*1024 + + typedef enum { +--- a/src/libpiano/request.c ++++ b/src/libpiano/request.c +@@ -40,6 +40,7 @@ THE SOFTWARE. + #include + #include + /* needed for urlencode */ ++#include + #include + + #include "piano.h" diff --git a/sound/pianod/patches/030-Waitress_add_polarssl_variant.patch b/sound/pianod/patches/030-Waitress_add_polarssl_variant.patch new file mode 100644 index 0000000..ad27e9b --- /dev/null +++ b/sound/pianod/patches/030-Waitress_add_polarssl_variant.patch @@ -0,0 +1,333 @@ +--- a/src/libwaitress/waitress.h ++++ b/src/libwaitress/waitress.h +@@ -27,7 +27,12 @@ THE SOFTWARE. + #include + #include + #include ++ ++#if defined(USE_POLARSSL) ++typedef struct _polarssl_ctx polarssl_ctx; ++#else + #include ++#endif + + #define LIBWAITRESS_NAME "libwaitress" + +@@ -102,8 +107,9 @@ typedef struct { + WaitressUrl_t url; + WaitressUrl_t proxy; + ++#if !defined(USE_POLARSSL) + gnutls_certificate_credentials_t tlsCred; +- ++#endif + /* per-request data */ + struct { + int sockfd; +@@ -121,7 +127,11 @@ typedef struct { + WaitressReturn_t (*read) (void *, char *, const size_t, size_t *); + WaitressReturn_t (*write) (void *, const char *, const size_t); + ++#if defined(USE_POLARSSL) ++ polarssl_ctx* sslCtx; ++#else + gnutls_session_t tlsSession; ++#endif + } request; + } WaitressHandle_t; + +--- a/src/pianod.c ++++ b/src/pianod.c +@@ -531,8 +531,11 @@ static bool initialize_libraries (APPSTA + gcry_check_version (NULL); + gcry_control (GCRYCTL_DISABLE_SECMEM, 0); + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); ++ ++#if !defined(USE_POLARSSL) + int crystatus = gnutls_global_init (); + if (crystatus == GNUTLS_E_SUCCESS) { ++#endif + PianoReturn_t status = PianoInit (&app->ph, app->settings.partnerUser, app->settings.partnerPassword, + app->settings.device, app->settings.inkey, app->settings.outkey); + if (status == PIANO_RET_OK) { +@@ -545,11 +548,13 @@ static bool initialize_libraries (APPSTA + } else { + flog (LOG_ERROR, "initialize_libraries: PianoInit: %s", PianoErrorToStr (status)); + } ++#if !defined(USE_POLARSSL) + gnutls_global_deinit (); + } else { + flog (LOG_ERROR, "initialize_libraries: gnutls_global_init: %s", gcry_strerror (crystatus)); + + } ++#endif + return false; + } + +@@ -728,7 +733,9 @@ int main (int argc, char **argv) { + PianoDestroyPlaylist (app.song_history); + PianoDestroyPlaylist (app.playlist); + WaitressFree (&app.waith); ++#if !defined(USE_POLARSSL) + gnutls_global_deinit (); ++#endif + settings_destroy (&app.settings); + } + +--- a/src/libwaitress/waitress.c ++++ b/src/libwaitress/waitress.c +@@ -41,11 +41,33 @@ THE SOFTWARE. + #include + #include + +-#include + + #include "config.h" + #include "waitress.h" + ++#if defined(USE_POLARSSL) ++ ++#include ++#include ++#include ++#include ++#include ++ ++struct _polarssl_ctx ++{ ++ ssl_context ssl; ++ ssl_session session; ++ entropy_context entrophy; ++ ctr_drbg_context rnd; ++}; ++ ++#else ++ ++// Use gnutls by default (USE_POLARSSL not defined) ++#include ++ ++#endif ++ + #define strcaseeq(a,b) (strcasecmp(a,b) == 0) + #define WAITRESS_HTTP_VERSION "1.1" + +@@ -56,6 +78,13 @@ typedef struct { + + static WaitressReturn_t WaitressReceiveHeaders (WaitressHandle_t *, size_t *); + ++// gnutls wants (void *) and polarssl want (unsigned char *) ++#if defined(USE_POLARSSL) ++#define BUFFER_CAST unsigned char ++#else ++#define BUFFER_CAST void ++#endif ++ + #define READ_RET(buf, count, size) \ + if ((wRet = waith->request.read (waith, buf, count, size)) != \ + WAITRESS_RET_OK) { \ +@@ -444,7 +473,7 @@ static int WaitressPollLoop (int fd, sho + * @param write count bytes + * @return number of written bytes or -1 on error + */ +-static ssize_t WaitressPollWrite (void *data, const void *buf, size_t count) { ++static ssize_t WaitressPollWrite (void *data, const BUFFER_CAST *buf, size_t count) { + int pollres = -1; + ssize_t retSize; + WaitressHandle_t *waith = data; +@@ -478,13 +507,20 @@ static WaitressReturn_t WaitressOrdinary + return waith->request.readWriteRet; + } + +-static WaitressReturn_t WaitressGnutlsWrite (void *data, const char *buf, ++static WaitressReturn_t WaitressTlsWrite (void *data, const char *buf, + const size_t size) { + WaitressHandle_t *waith = data; ++#if defined(USE_POLARSSL) ++ ++ if (ssl_write (&waith->request.sslCtx->ssl, buf, size) < 0) { ++ return WAITRESS_RET_TLS_WRITE_ERR; ++ } ++#else + + if (gnutls_record_send (waith->request.tlsSession, buf, size) < 0) { + return WAITRESS_RET_TLS_WRITE_ERR; + } ++#endif + return waith->request.readWriteRet; + } + +@@ -494,7 +530,7 @@ static WaitressReturn_t WaitressGnutlsWr + * @param buffer size + * @return number of read bytes or -1 on error + */ +-static ssize_t WaitressPollRead (void *data, void *buf, size_t count) { ++static ssize_t WaitressPollRead (void *data, BUFFER_CAST *buf, size_t count) { + int pollres = -1; + ssize_t retSize; + WaitressHandle_t *waith = data; +@@ -531,16 +567,34 @@ static WaitressReturn_t WaitressOrdinary + return waith->request.readWriteRet; + } + +-static WaitressReturn_t WaitressGnutlsRead (void *data, char *buf, ++static WaitressReturn_t WaitressTlsRead (void *data, char *buf, + const size_t size, size_t *retSize) { + WaitressHandle_t *waith = data; + ++#if defined(USE_POLARSSL) ++ int ret; ++ ++ *retSize = 0; ++ waith->request.readWriteRet = WAITRESS_RET_OK; ++ ret = ssl_read (&waith->request.sslCtx->ssl, buf, size); ++ ++ if (ret < 0) { ++ if (ret != POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY) { ++ waith->request.readWriteRet = WAITRESS_RET_TLS_READ_ERR; ++ } ++ ++ return waith->request.readWriteRet; ++ } ++ ++ *retSize = ret; ++#else + ssize_t ret = gnutls_record_recv (waith->request.tlsSession, buf, size); + if (ret < 0) { + return WAITRESS_RET_TLS_READ_ERR; + } else { + *retSize = ret; + } ++#endif + return waith->request.readWriteRet; + } + +@@ -727,10 +781,28 @@ static int WaitressParseStatusline (cons + /* verify server certificate + */ + static WaitressReturn_t WaitressTlsVerify (const WaitressHandle_t *waith) { ++ ++#if defined(USE_POLARSSL) ++ unsigned char fingerprint[20]; ++ ++ const x509_crt* cert = ssl_get_peer_cert (&waith->request.sslCtx->ssl); ++ ++ if (NULL == cert) { ++ return WAITRESS_RET_TLS_HANDSHAKE_ERR; ++ } ++ ++ sha1 (cert->raw.p, cert->raw.len, fingerprint); ++ ++ if (memcmp (fingerprint, waith->tlsFingerprint, sizeof (fingerprint)) != 0) { ++ return WAITRESS_RET_TLS_FINGERPRINT_MISMATCH; ++ } ++ ++#else + gnutls_session_t session = waith->request.tlsSession; + unsigned int certListSize; + const gnutls_datum_t *certList; + gnutls_x509_crt_t cert; ++ char fingerprint[20]; + + if (gnutls_certificate_type_get (session) != GNUTLS_CRT_X509) { + return WAITRESS_RET_TLS_HANDSHAKE_ERR; +@@ -750,7 +822,6 @@ static WaitressReturn_t WaitressTlsVerif + return WAITRESS_RET_TLS_HANDSHAKE_ERR; + } + +- char fingerprint[20]; + size_t fingerprintSize = sizeof (fingerprint); + if (gnutls_x509_crt_get_fingerprint (cert, GNUTLS_DIG_SHA1, fingerprint, + &fingerprintSize) != 0) { +@@ -763,7 +834,7 @@ static WaitressReturn_t WaitressTlsVerif + } + + gnutls_x509_crt_deinit (cert); +- ++#endif + return WAITRESS_RET_OK; + } + +@@ -880,6 +951,12 @@ static WaitressReturn_t WaitressConnect + } + } + ++#if defined(USE_POLARSSL) ++ ssl_set_hostname (&waith->request.sslCtx->ssl, waith->url.host); ++ if (ssl_handshake (&waith->request.sslCtx->ssl) != 0) { ++ return WAITRESS_RET_TLS_HANDSHAKE_ERR; ++ } ++#else + /* Ignore return code as connection will likely still succeed */ + gnutls_server_name_set (waith->request.tlsSession, GNUTLS_NAME_DNS, + waith->url.host, strlen (waith->url.host)); +@@ -887,14 +964,15 @@ static WaitressReturn_t WaitressConnect + if (gnutls_handshake (waith->request.tlsSession) != GNUTLS_E_SUCCESS) { + return WAITRESS_RET_TLS_HANDSHAKE_ERR; + } ++#endif + + if ((wRet = WaitressTlsVerify (waith)) != WAITRESS_RET_OK) { + return wRet; + } + + /* now we can talk encrypted */ +- waith->request.read = WaitressGnutlsRead; +- waith->request.write = WaitressGnutlsWrite; ++ waith->request.read = WaitressTlsRead; ++ waith->request.write = WaitressTlsWrite; + } + + return WAITRESS_RET_OK; +@@ -1120,6 +1198,21 @@ WaitressReturn_t WaitressFetchCall (Wait + waith->request.contentLengthKnown = false; + + if (waith->url.tls) { ++#if defined(USE_POLARSSL) ++ waith->request.sslCtx = calloc (1, sizeof(polarssl_ctx)); ++ ++ entropy_init (&waith->request.sslCtx->entrophy); ++ ctr_drbg_init (&waith->request.sslCtx->rnd, entropy_func, &waith->request.sslCtx->entrophy, "libwaitress", 11); ++ ssl_init (&waith->request.sslCtx->ssl); ++ ++ ssl_set_endpoint (&waith->request.sslCtx->ssl, SSL_IS_CLIENT); ++ ssl_set_authmode (&waith->request.sslCtx->ssl, SSL_VERIFY_NONE); ++ ssl_set_rng (&waith->request.sslCtx->ssl, ctr_drbg_random, &waith->request.sslCtx->rnd); ++ ssl_set_session (&waith->request.sslCtx->ssl, &waith->request.sslCtx->session); ++ ssl_set_bio (&waith->request.sslCtx->ssl, ++ WaitressPollRead, waith, ++ WaitressPollWrite, waith); ++#else + gnutls_init (&waith->request.tlsSession, GNUTLS_CLIENT); + gnutls_set_default_priority (waith->request.tlsSession); + +@@ -1137,6 +1230,7 @@ WaitressReturn_t WaitressFetchCall (Wait + WaitressPollRead); + gnutls_transport_set_push_function (waith->request.tlsSession, + WaitressPollWrite); ++#endif + } + + /* buffer is required for connect already */ +@@ -1148,15 +1242,22 @@ WaitressReturn_t WaitressFetchCall (Wait + if ((wRet = WaitressSendRequest (waith)) == WAITRESS_RET_OK) { + wRet = WaitressReceiveResponse (waith); + } ++#if !defined(USE_POLARSSL) + if (waith->url.tls) { + gnutls_bye (waith->request.tlsSession, GNUTLS_SHUT_RDWR); + } ++#endif + } + + /* cleanup */ + if (waith->url.tls) { ++#if defined(USE_POLARSSL) ++ ssl_free (&waith->request.sslCtx->ssl); ++ free (waith->request.sslCtx); ++#else + gnutls_deinit (waith->request.tlsSession); + gnutls_certificate_free_credentials (waith->tlsCred); ++#endif + } + if (waith->request.sockfd != -1) { + close (waith->request.sockfd); diff --git a/sound/portaudio/Makefile b/sound/portaudio/Makefile new file mode 100644 index 0000000..ffa5cfb --- /dev/null +++ b/sound/portaudio/Makefile @@ -0,0 +1,70 @@ +# +# 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:=portaudio +PKG_VERSION:=19_20140130 +PKG_RELEASE:=1 + +PKG_SOURCE:=pa_stable_v$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://www.portaudio.com/archives/ +PKG_MD5SUM:=7f220406902af9dca009668e198cbd23 + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE.txt +PKG_MAINTAINER:=Nicolas Thill + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/portaudio + SECTION:=sound + CATEGORY:=Sound + DEPENDS:=+alsa-lib +libpthread +librt + TITLE:=Portable cross-platform audio I/O + URL:=http://www.portaudio.com/ +endef + +define Package/portaudio/description + PortAudio is a free, cross-platform, open-source, audio I/O library. It lets + you write simple audio programs in 'C' or C++ that will compile and run on many + platforms including Windows, Macintosh OS X, and Unix (OSS/ALSA). It is + intended to promote the exchange of audio software between developers on + different platforms. Many applications use PortAudio for Audio I/O. +endef + +CONFIGURE_ARGS+= \ + --with-alsa \ + --without-asihpi \ + --without-jack \ + --with-oss \ + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) \ + $(PKG_INSTALL_DIR)/usr/include/portaudio.h \ + $(PKG_INSTALL_DIR)/usr/include/pa_linux_alsa.h \ + $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/libportaudio.{a,so*} \ + $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/portaudio-*.pc \ + $(1)/usr/lib/pkgconfig/ +endef + +define Package/portaudio/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libportaudio.so.* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,portaudio)) diff --git a/sound/pulseaudio/Makefile b/sound/pulseaudio/Makefile new file mode 100644 index 0000000..788111b --- /dev/null +++ b/sound/pulseaudio/Makefile @@ -0,0 +1,195 @@ +# +# Copyright (C) 2011-2016 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:=pulseaudio +PKG_VERSION:=9.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=http://freedesktop.org/software/pulseaudio/releases/ +PKG_MD5SUM:=da7162541b3a9bc20576dbd0d7d1489a +PKG_LICENSE:=LGPL-2.1+ +PKG_LICENSE_FILES:=GPL LICENSE + +PKG_BUILD_DEPENDS:=intltool/host + +PKG_FIXUP:=autoreconf +PKG_USE_MIPS16:=0 + +PKG_INSTALL = 1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/pulseaudio/Default + SECTION:=sound + CATEGORY:=Sound + DEPENDS:=+libspeexdsp +libsndfile +libltdl +libpthread \ + +librt +alsa-lib +libopenssl +libwrap +libcap $(ICONV_DEPENDS) $(INTL_DEPENDS) + TITLE:=Network sound server + MAINTAINER:=Peter Wagner + URL:=http://www.pulseaudio.org + PROVIDES:=pulseaudio + USERID:=pulse=51:pulse=51 +endef + +define Package/pulseaudio-daemon + $(call Package/pulseaudio/Default) + DEPENDS+= +libjson-c +endef + +define Package/pulseaudio/Default/description + PulseAudio (formerly Polypaudio) is a cross-platform, networked sound server. +endef + +define Package/pulseaudio-daemon/description + $(call Package/pulseaudio/Default/description) +endef + +define Package/pulseaudio-daemon/conffiles +/etc/pulse/client.conf +/etc/pulse/daemon.conf +/etc/pulse/default.pa +/etc/pulse/system.pa +endef + +define Package/pulseaudio-tools + SECTION:=sound + CATEGORY:=Sound + DEPENDS:=+libsndfile +pulseaudio + TITLE:=Tools for Pulseaudio + URL:=http://www.pulseaudio.org +endef + +define Package/pulseaudio-profiles + SECTION:=sound + CATEGORY:=Sound + DEPENDS:=+pulseaudio + TITLE:=Profiles for Pulseaudio + URL:=http://www.pulseaudio.org +endef + +CONFIGURE_ARGS += \ + --with-system-user=pulse \ + --with-system-group=pulse \ + --with-access-group=audio \ + --with-database=simple \ + --enable-alsa \ + --disable-hal \ + --disable-gconf \ + --disable-nls \ + --disable-manpages \ + --enable-oss-output \ + --disable-oss-wrapper \ + --disable-samplerate \ + --disable-per-user-esound-socket \ + --disable-solaris \ + --disable-gtk2 \ + --disable-glib2 \ + --disable-jack \ + --disable-asyncns \ + --disable-lirc \ + --disable-bluez \ + --disable-udev \ + --without-fftw \ + --disable-avahi \ + --disable-dbus \ + --without-soxr + +CONFIGURE_VARS += \ + PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" + +#SUPP_LIBS:=-L$(INTL_PREFIX)/lib -L$(ICONV_PREFIX)/lib +TARGET_CFLAGS += -std=gnu99 + +define Build/InstallDev + $(INSTALL_DIR) \ + $(1)/usr/lib/pkgconfig \ + $(1)/usr/include/pulse \ + $(1)/usr/lib \ + $(1)/usr/lib/pulseaudio + $(CP) \ + $(PKG_INSTALL_DIR)/usr/include/pulse/* \ + $(1)/usr/include/pulse + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc \ + $(1)/usr/lib/pkgconfig + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/*.so* \ + $(1)/usr/lib/ + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/pulseaudio/* \ + $(1)/usr/lib/pulseaudio/ +endef + +define Package/pulseaudio-daemon/install + $(INSTALL_DIR) \ + $(1)/etc/pulse \ + $(1)/etc/init.d \ + $(1)/usr/bin \ + $(1)/usr/lib \ + $(1)/usr/lib/pulseaudio \ + $(1)/usr/lib/pulse-$(PKG_VERSION)/modules + + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/pulseaudio \ + $(1)/usr/bin/pulseaudio + + $(INSTALL_BIN) \ + ./files/pulseaudio.init \ + $(1)/etc/init.d/pulseaudio + + $(INSTALL_DATA) \ + $(PKG_INSTALL_DIR)/etc/pulse/* \ + $(1)/etc/pulse + + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/*.so* \ + $(1)/usr/lib/ + + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/pulseaudio/* \ + $(1)/usr/lib/pulseaudio/ + + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/pulse-$(PKG_VERSION)/modules/lib*.so \ + $(1)/usr/lib/ + + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/pulse-$(PKG_VERSION)/modules/module*.so \ + $(1)/usr/lib/pulse-$(PKG_VERSION)/modules/ + +endef + +define Package/pulseaudio-tools/install + $(INSTALL_DIR) \ + $(1)/usr/bin + + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/pa* \ + $(1)/usr/bin/ +endef + +define Package/pulseaudio-profiles/install + $(INSTALL_DIR) \ + $(1)/usr/share/pulseaudio/alsa-mixer/paths \ + $(1)/usr/share/pulseaudio/alsa-mixer/profile-sets + + $(INSTALL_DATA) \ + $(PKG_INSTALL_DIR)/usr/share/pulseaudio/alsa-mixer/paths/* \ + $(1)/usr/share/pulseaudio/alsa-mixer/paths + + $(INSTALL_DATA) \ + $(PKG_INSTALL_DIR)/usr/share/pulseaudio/alsa-mixer/profile-sets/* \ + $(1)/usr/share/pulseaudio/alsa-mixer/profile-sets +endef + +$(eval $(call BuildPackage,pulseaudio-daemon)) +$(eval $(call BuildPackage,pulseaudio-tools)) +$(eval $(call BuildPackage,pulseaudio-profiles)) diff --git a/sound/pulseaudio/files/pulseaudio.init b/sound/pulseaudio/files/pulseaudio.init new file mode 100644 index 0000000..005d21f --- /dev/null +++ b/sound/pulseaudio/files/pulseaudio.init @@ -0,0 +1,29 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2011 OpenWrt.org + +START=99 +STOP=65 + +USE_PROCD=1 +PROG=/usr/bin/pulseaudio + +start_service() { + [ -d /var/run/pulse ] || { + mkdir -m 0755 -p /var/run/pulse + chmod 0750 /var/run/pulse + chown pulse:pulse /var/run/pulse + } + [ -d /var/lib/pulse ] || { + mkdir -m 0755 -p /var/lib/pulse + chmod 0750 /var/lib/pulse + chown pulse:pulse /var/lib/pulse + } + + chown root:pulse /dev/snd/* /dev/mixer /dev/dsp + chmod 664 /dev/snd/* /dev/mixer /dev/dsp + + procd_open_instance + procd_set_param command $PROG --system --disallow-exit --disallow-module-loading --disable-shm --exit-idle-time=-1 --realtime=false + procd_close_instance +} + diff --git a/sound/pulseaudio/patches/001-no_default_64mb_alloc.patch b/sound/pulseaudio/patches/001-no_default_64mb_alloc.patch new file mode 100644 index 0000000..8dd000b --- /dev/null +++ b/sound/pulseaudio/patches/001-no_default_64mb_alloc.patch @@ -0,0 +1,11 @@ +--- a/src/pulsecore/memblock.c ++++ b/src/pulsecore/memblock.c +@@ -55,7 +55,7 @@ + * stored in SHM and our OS does not commit the memory before we use + * it for the first time. */ + #define PA_MEMPOOL_SLOTS_MAX 1024 +-#define PA_MEMPOOL_SLOT_SIZE (64*1024) ++#define PA_MEMPOOL_SLOT_SIZE 64 + + #define PA_MEMEXPORT_SLOTS_MAX 128 + diff --git a/sound/shairplay/Makefile b/sound/shairplay/Makefile new file mode 100644 index 0000000..191647c --- /dev/null +++ b/sound/shairplay/Makefile @@ -0,0 +1,50 @@ +# +# Copyright (C) 2014-2016 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:=shairplay +PKG_VERSION:=2016-01-01 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://github.com/juhovh/shairplay.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=ce80e005908f41d0e6fde1c4a21e9cb8ee54007b +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz +PKG_MAINTAINER:=Álvaro Fernández Rojas + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/shairplay + SECTION:=sound + CATEGORY:=Sound + DEPENDS:=+libao +libavahi-compat-libdnssd +libltdl +libpthread + TITLE:=Shairplay +endef + +define Package/shairplay/description + Free portable AirPlay server implementation similar to ShairPort. +endef + +define Package/shairplay/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/shairplay $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/share/shairplay + $(INSTALL_DATA) $(PKG_BUILD_DIR)/airport.key $(1)/usr/share/shairplay/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) files/shairplay.init $(1)/etc/init.d/shairplay + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) files/shairplay.config $(1)/etc/config/shairplay +endef + +$(eval $(call BuildPackage,shairplay)) diff --git a/sound/shairplay/files/shairplay.config b/sound/shairplay/files/shairplay.config new file mode 100644 index 0000000..6e1f939 --- /dev/null +++ b/sound/shairplay/files/shairplay.config @@ -0,0 +1,10 @@ +config shairplay main + option disabled '1' + option respawn '1' + option apname 'AirPlay' + option port '5000' + option password '' + option hwaddr '' + option ao_driver 'oss' + option ao_devicename '' + option ao_deviceid '' diff --git a/sound/shairplay/files/shairplay.init b/sound/shairplay/files/shairplay.init new file mode 100644 index 0000000..093a168 --- /dev/null +++ b/sound/shairplay/files/shairplay.init @@ -0,0 +1,51 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014 OpenWrt.org + +START=90 +USE_PROCD=1 + +append_arg() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param command $opt="${val:-$def}" +} + +start_instance() { + local cfg="$1" + local aux + + config_get_bool aux "$cfg" 'disabled' '0' + [ "$aux" = 1 ] && return 1 + + procd_open_instance + + procd_set_param command /usr/bin/shairplay + + append_arg "$cfg" apname "--apname" "AirPlay" + append_arg "$cfg" port "--server_port" + append_arg "$cfg" password "--password" + append_arg "$cfg" hwaddr "--hwaddr" + + append_arg "$cfg" ao_driver "--ao_driver" + append_arg "$cfg" ao_devicename "--ao_devicename" + append_arg "$cfg" ao_deviceid "--ao_deviceid" + + config_get_bool aux "$cfg" 'respawn' '0' + [ "$aux" = 1 ] && procd_set_param respawn + + procd_close_instance +} + +service_triggers() { + procd_add_reload_trigger "shairplay" +} + +start_service() { + config_load shairplay + config_foreach start_instance shairplay +} diff --git a/sound/shairplay/patches/001-key_file_dir.patch b/sound/shairplay/patches/001-key_file_dir.patch new file mode 100644 index 0000000..af9bd84 --- /dev/null +++ b/sound/shairplay/patches/001-key_file_dir.patch @@ -0,0 +1,11 @@ +--- a/src/shairplay.c ++++ b/src/shairplay.c +@@ -350,7 +350,7 @@ main(int argc, char *argv[]) + raop_cbs.audio_destroy = audio_destroy; + raop_cbs.audio_set_volume = audio_set_volume; + +- raop = raop_init_from_keyfile(10, &raop_cbs, "airport.key", NULL); ++ raop = raop_init_from_keyfile(10, &raop_cbs, "/usr/share/shairplay/airport.key", NULL); + if (raop == NULL) { + fprintf(stderr, "Could not initialize the RAOP service\n"); + fprintf(stderr, "Please make sure the airport.key file is in the current directory.\n"); diff --git a/sound/shairplay/patches/002-libavahi-compat-dnssd.patch b/sound/shairplay/patches/002-libavahi-compat-dnssd.patch new file mode 100644 index 0000000..ff70e24 --- /dev/null +++ b/sound/shairplay/patches/002-libavahi-compat-dnssd.patch @@ -0,0 +1,11 @@ +--- a/src/lib/dnssd.c ++++ b/src/lib/dnssd.c +@@ -167,7 +167,7 @@ dnssd_init(int *error) + return NULL; + } + #elif USE_LIBDL +- dnssd->module = dlopen("libdns_sd.so", RTLD_LAZY); ++ dnssd->module = dlopen("libdns_sd.so.1", RTLD_LAZY); + if (!dnssd->module) { + if (error) *error = DNSSD_ERROR_LIBNOTFOUND; + free(dnssd); diff --git a/sound/shairplay/patches/003-fix_big-endian.patch b/sound/shairplay/patches/003-fix_big-endian.patch new file mode 100644 index 0000000..4db204e --- /dev/null +++ b/sound/shairplay/patches/003-fix_big-endian.patch @@ -0,0 +1,11 @@ +--- a/src/lib/alac/alac.c ++++ b/src/lib/alac/alac.c +@@ -29,7 +29,7 @@ + * + */ + +-static const int host_bigendian = 0; ++#define host_bigendian (htonl(42) == 42) + + #include + #include diff --git a/sound/shairport-sync/Makefile b/sound/shairport-sync/Makefile new file mode 100644 index 0000000..40e357b --- /dev/null +++ b/sound/shairport-sync/Makefile @@ -0,0 +1,126 @@ +# +# Copyright (C) 2015-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# updated to work with latest source from abrasive +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=shairport-sync +PKG_VERSION:=2.8.6 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://github.com/mikebrady/shairport-sync.git +PKG_SOURCE_VERSION:=$(PKG_VERSION) +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_MAINTAINER:=Ted Hess , \ + Mike Brady + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR) + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=COPYING LICENSES shairport.c + +PKG_BUILD_PARALLEL:=1 +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/shairport-sync/default + SECTION:=sound + CATEGORY:=Sound + TITLE:=AirPlay compatible audio player + DEPENDS:=@AUDIO_SUPPORT +libpthread +alsa-lib +libconfig +libdaemon +libpopt + PROVIDES:=shairport-sync + URL:=http://github.com/mikebrady/shairport-sync +endef + +define Package/shairport-sync-openssl + $(Package/shairport-sync/default) + TITLE+= (openssl) + DEPENDS+= +libopenssl +libavahi-client +libsoxr + VARIANT:=openssl +endef + +define Package/shairport-sync-polarssl + $(Package/shairport-sync/default) + TITLE+= (polarssl) + DEPENDS+= +libpolarssl +libavahi-client +libsoxr + VARIANT:=polarssl + DEFAULT_VARIANT:=1 +endef + +define Package/shairport-sync-mini + $(Package/shairport-sync/default) + TITLE+= (minimal) + DEPENDS+= +libpolarssl + VARIANT:=mini +endef + +define Package/shairport-sync/default/description + Shairport Sync plays audio from iTunes and AirPlay sources, including + iOS devices, Quicktime Player and third party sources such as forkedDaapd. + Audio played by a Shairport Sync-powered device stays synchronised with the source + and hence with similar devices playing the same source. + + Shairport Sync does not support AirPlay video or photo streaming. + Ensure Kernel Modules > Sound Support > kmod-sound-core is selected. + Also select kmod-usb-audio if you want to use USB-connected sound cards. +endef +Package/shairport-sync-openssl/description = $(Package/shairport-sync/default/description) +Package/shairport-sync-polarssl/description = $(Package/shairport-sync/default/description) + +define Package/shairport-sync-mini/description + $(Package/shairport-sync/default/description) + + Minimal version uses PolarSSL and does not include libsoxr and avahi support. +endef + +CONFIGURE_ARGS+= \ + --with-alsa \ + --with-metadata + +ifeq ($(BUILD_VARIANT),openssl) + CONFIGURE_ARGS+= --with-ssl=openssl +endif + +ifeq ($(BUILD_VARIANT),polarssl) + CONFIGURE_ARGS+= --with-ssl=polarssl +endif + +ifeq ($(BUILD_VARIANT),mini) + CONFIGURE_ARGS+= --with-ssl=polarssl --with-tinysvcmdns +else + CONFIGURE_ARGS+= --with-avahi --with-soxr +endif + +define Package/shairport-sync/default/conffiles +/etc/shairport-sync.conf +endef + +Package/shairport-sync-openssl/conffiles = $(Package/shairport-sync/default/conffiles) +Package/shairport-sync-polarssl/conffiles = $(Package/shairport-sync/default/conffiles) +Package/shairport-sync-mini/conffiles = $(Package/shairport-sync/default/conffiles) + +define Package/shairport-sync/default/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/shairport-sync $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) $(PKG_BUILD_DIR)/scripts/shairport-sync.conf $(1)/etc/shairport-sync.conf + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/shairport-sync.init $(1)/etc/init.d/shairport-sync + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/shairport-sync.config $(1)/etc/config/shairport-sync +endef + +Package/shairport-sync-openssl/install = $(Package/shairport-sync/default/install) +Package/shairport-sync-polarssl/install = $(Package/shairport-sync/default/install) +Package/shairport-sync-mini/install = $(Package/shairport-sync/default/install) + +$(eval $(call BuildPackage,shairport-sync-openssl)) +$(eval $(call BuildPackage,shairport-sync-polarssl)) +$(eval $(call BuildPackage,shairport-sync-mini)) diff --git a/sound/shairport-sync/files/shairport-sync.config b/sound/shairport-sync/files/shairport-sync.config new file mode 100644 index 0000000..96917af --- /dev/null +++ b/sound/shairport-sync/files/shairport-sync.config @@ -0,0 +1,61 @@ +# Use your own config file +config shairport-sync 'shairport_sync_file' + option disabled '1' + option respawn '1' + option conf_custom '1' + option conf_file '/etc/shairport-sync.conf' + +# Use OpenWrt UCI config +config shairport-sync 'shairport_sync' + option disabled '1' + option respawn '1' + # General + option name 'Shairport-Sync-%v-%h' + option password '' + option interpolation '' # basic/soxr + option output_backend '' # alsa/pipe/stdout/ao/dummy/pulse/sndio + option mdns_backend '' # avahi/external-avahi/dns-sd/external-dns-sd/tinysvcmdns + option port '' # 5000 + option udp_port_base '' # 6001 + option udp_port_range '' # 100 + option statistics '' # no/yes + option drift '' # 88 + option resync_threshold '' # 2205 + option log_verbosity '' # 0/1/2/3 + option ignore_volume_control '' # no/yes + option volume_range_db '' # 30 to 150 + option regtype '' # _raop._tcp + option playback_mode '' # stereo/mono + # Metadata + option metadata_enabled '' # no/yes + option metadata_cover_art '' # no/yes + option metadata_pipe_name '' # /tmp/shairport-sync-metadata + option metadata_pipe_timeout '' # 5000 + option metadata_socket_address '' # 226.0.0.1 + option metadata_socket_port '' # 5555 + option metadata_socket_msglength # 65000 + # Session Control + option sesctl_run_before_play_begins '' # /etc/shairport-sync-start.sh + option sesctl_run_after_play_ends '' # /etc/shairport-sync-stop.sh + option sesctl_wait_for_completion '' # no/yes + option sesctl_session_interruption '' # no/yes + option sesctl_session_timeout '' # 120 + # ALSA + option alsa_output_device '' # default + option alsa_mixer_control_name '' # PCM + option alsa_mixer_device '' # default + option alsa_latency_offset '' # 0 + option alsa_buffer_length '' # 6615 + option alsa_disable_synchronization '' # no/yes + option alsa_period_size '' # number + option alsa_buffer_size '' # number + # Pipe + option pipe_name '' # /tmp/shairport-sync-audio + option pipe_latency_offset '' # 0 + option pipe_buffer_length '' # 44100 + # Stdout + option stdout_latency_offset '' # 0 + option stdout_buffer_length '' # 44100 + # AO + option ao_latency_offset '' # 0 + option ao_buffer_length '' # 44100 diff --git a/sound/shairport-sync/files/shairport-sync.init b/sound/shairport-sync/files/shairport-sync.init new file mode 100644 index 0000000..afda520 --- /dev/null +++ b/sound/shairport-sync/files/shairport-sync.init @@ -0,0 +1,142 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015-2016 OpenWrt.org + +START=99 +USE_PROCD=1 + +append_num() { + local cfg="$1" + local file="$2" + local var="$3" + local opt="$4" + local def="$5" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && echo -e "\t$opt = ${val:-$def};" >> $file +} +append_str() { + local cfg="$1" + local file="$2" + local var="$3" + local opt="$4" + local def="$5" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && echo -e "\t$opt = \"${val:-$def}\";" >> $file +} + +start_instance() { + local cfg=$1 + local conf_custom conf_file aux + + config_get_bool aux "$cfg" 'disabled' '0' + [ "$aux" = 1 ] && return 1 + + config_get_bool conf_custom "$cfg" 'conf_custom' '0' + config_get conf_file "$cfg" "conf_file" + if [ $conf_custom -ne 1 ] && [ ! -n "$conf_file" ]; then + mkdir -p /var/etc + conf_file="/var/etc/shairport-sync-${cfg}.conf" + + echo -e "// Automatically generated from UCI config\n" > $conf_file + + # General + echo -e "general =" >> $conf_file + echo -e "{" >> $conf_file + append_str "$cfg" "$conf_file" name "name" + append_str "$cfg" "$conf_file" password "password" + append_str "$cfg" "$conf_file" interpolation "interpolation" + append_str "$cfg" "$conf_file" output_backend "output_backend" + append_str "$cfg" "$conf_file" mdns_backend "mdns_backend" + append_num "$cfg" "$conf_file" port "port" + append_num "$cfg" "$conf_file" udp_port_base "udp_port_base" + append_num "$cfg" "$conf_file" udp_port_range "udp_port_range" + append_str "$cfg" "$conf_file" statistics "statistics" + append_num "$cfg" "$conf_file" drift "drift" + append_num "$cfg" "$conf_file" resync_threshold "resync_threshold" + append_num "$cfg" "$conf_file" log_verbosity "log_verbosity" + append_str "$cfg" "$conf_file" ignore_volume_control "ignore_volume_control" + append_num "$cfg" "$conf_file" volume_range_db "volume_range_db" + append_str "$cfg" "$conf_file" regtype "regtype" + append_str "$cfg" "$conf_file" playback_mode "playback_mode" + echo -e "};\n" >> $conf_file + + # Metadata + echo -e "metadata =" >> $conf_file + echo -e "{" >> $conf_file + append_str "$cfg" "$conf_file" metadata_enabled "enabled" + append_str "$cfg" "$conf_file" metadata_cover_art "include_cover_art" + append_str "$cfg" "$conf_file" metadata_pipe_name "pipe_name" + append_num "$cfg" "$conf_file" metadata_pipe_timeout "pipe_timeout" + append_str "$cfg" "$conf_file" metadata_socket_address "socket_address" + append_num "$cfg" "$conf_file" metadata_socket_port "socket_port" + append_num "$cfg" "$conf_file" metadata_socket_msglength "socket_msglength" + echo -e "};\n" >> $conf_file + + # Session control + echo -e "sessioncontrol =" >> $conf_file + echo -e "{" >> $conf_file + append_str "$cfg" "$conf_file" sesctl_run_before_play_begins "run_this_before_play_begins" + append_str "$cfg" "$conf_file" sesctl_run_after_play_ends "run_this_after_play_ends" + append_str "$cfg" "$conf_file" sesctl_wait_for_completion "wait_for_completion" + append_str "$cfg" "$conf_file" sesctl_session_interruption "allow_session_interruption" + append_num "$cfg" "$conf_file" sesctl_session_timeout "session_timeout" + echo -e "};\n" >> $conf_file + + # Alsa audio back end + echo -e "alsa =" >> $conf_file + echo -e "{" >> $conf_file + append_str "$cfg" "$conf_file" alsa_output_device "output_device" + append_str "$cfg" "$conf_file" alsa_mixer_control_name "mixer_control_name" + append_str "$cfg" "$conf_file" alsa_mixer_device "mixer_device" + append_num "$cfg" "$conf_file" alsa_latency_offset "audio_backend_latency_offset" + append_num "$cfg" "$conf_file" alsa_buffer_length "audio_backend_buffer_desired_length" + append_str "$cfg" "$conf_file" alsa_disable_synchronization "disable_synchronization" + append_num "$cfg" "$conf_file" alsa_period_size "period_size" + append_num "$cfg" "$conf_file" alsa_buffer_size "buffer_size" + echo -e "};\n" >> $conf_file + + # Pipe audio back end + echo -e "pipe =" >> $conf_file + echo -e "{" >> $conf_file + append_str "$cfg" "$conf_file" pipe_name "name" + append_num "$cfg" "$conf_file" pipe_latency_offset "audio_backend_latency_offset" + append_num "$cfg" "$conf_file" pipe_buffer_length "audio_backend_buffer_desired_length" + echo -e "};\n" >> $conf_file + + # Stdout audio back end + echo -e "stdout =" >> $conf_file + echo -e "{" >> $conf_file + append_num "$cfg" "$conf_file" stdout_latency_offset "audio_backend_latency_offset" + append_num "$cfg" "$conf_file" stdout_buffer_length "audio_backend_buffer_desired_length" + echo -e "};\n" >> $conf_file + + # AO audio back end + echo -e "ao =" >> $conf_file + echo -e "{" >> $conf_file + append_num "$cfg" "$conf_file" ao_latency_offset "audio_backend_latency_offset" + append_num "$cfg" "$conf_file" ao_buffer_length "audio_backend_buffer_desired_length" + echo -e "};\n" >> $conf_file + fi + + procd_open_instance + + procd_set_param command /usr/bin/shairport-sync + procd_append_param command -c $conf_file + + config_get_bool aux "$cfg" 'respawn' '0' + [ "$aux" = 1 ] && procd_set_param respawn + + procd_close_instance +} + +service_triggers() { + procd_add_reload_trigger "shairport-sync" +} + +start_service() { + config_load shairport-sync + config_foreach start_instance shairport-sync +} diff --git a/sound/shairport/Makefile b/sound/shairport/Makefile new file mode 100644 index 0000000..aeb63f7 --- /dev/null +++ b/sound/shairport/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2013-2015 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:=shairport +PKG_VERSION:=2014-10-28 +PKG_RELEASE:=2 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://github.com/abrasive/shairport.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=d679d19a4bd66cc220dabfd23ad748c34e95995c +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz +PKG_MAINTAINER:=Ted Hess + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSES + +include $(INCLUDE_DIR)/package.mk + +define Package/shairport + SECTION:=sound + CATEGORY:=Sound + DEPENDS:=+libpthread +libopenssl +libavahi-client +alsa-lib + TITLE:=ShairPort AirPort Express emulator (un-maintained) +endef + +define Package/shairport/description + This program emulates an AirPort Express for the purpose of streaming + music from iTunes and compatible iPods. It implements a server for the + Apple RAOP protocol. + ShairPort does not support AirPlay v2 (video and photo streaming). + + It supports multiple simultaneous streams, if your audio output chain + (as detected by libao) does so. +endef + +TARGET_CFLAGS += $(FPIC) + +LIBS:=-lm -lcrypto -lpthread -lavahi-common -lavahi-client -lasound + +MAKE_FLAGS += \ + CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS) $(LIBS)" + +define Package/shairport/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/shairport $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) files/shairport.init $(1)/etc/init.d/shairport + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) files/shairport.config $(1)/etc/config/shairport +endef + +$(eval $(call BuildPackage,shairport)) diff --git a/sound/shairport/files/shairport.config b/sound/shairport/files/shairport.config new file mode 100644 index 0000000..9b2165a --- /dev/null +++ b/sound/shairport/files/shairport.config @@ -0,0 +1,36 @@ +config shairport main + option disabled '1' + option respawn '1' + option bname 'AirPort' + option password '' + option port '5002' + option buffer '' + option log_file '' + option err_file '' + option meta_dir '' + option cmd_start '' + option cmd_stop '' + option cmd_wait '0' + option audio_output 'alsa' + option mdns 'avahi' + + # options for alsa output + option output_dev '' + option mixer_dev '' + option mixer_type '' + option mixer_control '' + option mixer_index '' + + # options for ao output + option ao_driver '' + option ao_name '' + option ao_id '' + option ao_options '' + + # options for pipe output + option output_fifo '' + + # options for pulse output + option pulse_server '' + option pulse_sink '' + option pulse_appname '' diff --git a/sound/shairport/files/shairport.init b/sound/shairport/files/shairport.init new file mode 100644 index 0000000..341ff6f --- /dev/null +++ b/sound/shairport/files/shairport.init @@ -0,0 +1,104 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2013-2014 OpenWrt.org + +START=94 +USE_PROCD=1 + +append_arg() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}" +} + +append_bool() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get_bool val "$cfg" "$var" "$def" + [ "$val" = 1 ] && procd_append_param command "$opt" +} + +start_instance() { + local cfg="$1" + local ao dev aux + + config_get_bool aux "$cfg" 'disabled' '0' + [ "$aux" = 1 ] && return 1 + + procd_open_instance + + procd_set_param command /usr/bin/shairport + + append_arg "$cfg" bname "-a" "AirPort" + append_arg "$cfg" log_file "-l" + append_arg "$cfg" err_file "-e" + append_arg "$cfg" meta_dir "-M" + append_arg "$cfg" buffer "-b" + append_arg "$cfg" port "-p" + append_arg "$cfg" password "-k" + append_arg "$cfg" mdns "-m" + + append_arg "$cfg" cmd_start "-B" + append_arg "$cfg" cmd_stop "-E" + append_bool "$cfg" cmd_wait "-w" + + append_arg "$cfg" audio_output "-o" + + config_get ao "$cfg" audio_output "" + if [ "$ao" = "alsa" ]; then + config_get dev "$cfg" output_dev "" + if [ -n "$dev" ]; then + procd_append_param command "--" + append_arg "$cfg" output_dev "-d" + append_arg "$cfg" mixer_dev "-m" + append_arg "$cfg" mixer_type "-t" + append_arg "$cfg" mixer_control "-c" + append_arg "$cfg" mixer_index "-i" + fi + elif [ "$ao" = "ao" ]; then + config_get dev "$cfg" ao_driver "" + if [ -n "$dev" ]; then + procd_append_param command "--" + append_arg "$cfg" ao_driver "-d" + append_arg "$cfg" ao_id "-i" + append_arg "$cfg" ao_name "-n" + append_arg "$cfg" ao_options "-o" + fi + elif [ "$ao" = "pipe" ]; then + config_get dev "$cfg" output_fifo "" + if [ -n "$dev" ]; then + procd_append_param command "--" + append_arg "$cfg" output_fifo "" + fi + elif [ "$ao" = "pulse" ]; then + config_get dev "$cfg" pulse_server "" + if [ -n "$dev" ]; then + procd_append_param command "--" + append_arg "$cfg" pulse_server "-a" + append_arg "$cfg" pulse_sink "-s" + append_arg "$cfg" pulse_appname "-n" + fi + fi + + config_get_bool aux "$cfg" 'respawn' '0' + [ "$aux" = 1 ] && procd_set_param respawn + + procd_close_instance +} + +service_triggers() { + procd_add_reload_trigger "shairport" +} + +start_service() { + config_load shairport + config_foreach start_instance shairport +} diff --git a/sound/shairport/patches/001-disable_pulseaudio.patch b/sound/shairport/patches/001-disable_pulseaudio.patch new file mode 100644 index 0000000..7f0407e --- /dev/null +++ b/sound/shairport/patches/001-disable_pulseaudio.patch @@ -0,0 +1,12 @@ +--- a/configure ++++ b/configure +@@ -59,7 +59,7 @@ do_pkg_config() + + do_pkg_config OpenSSL openssl +-do_pkg_config libao ao CONFIG_AO +-do_pkg_config PulseAudio libpulse-simple CONFIG_PULSE ++#do_pkg_config libao ao CONFIG_AO ++#do_pkg_config PulseAudio libpulse-simple CONFIG_PULSE + do_pkg_config ALSA alsa CONFIG_ALSA + do_pkg_config Avahi\ client avahi-client CONFIG_AVAHI + diff --git a/sound/shine/Makefile b/sound/shine/Makefile new file mode 100644 index 0000000..d13cff6 --- /dev/null +++ b/sound/shine/Makefile @@ -0,0 +1,64 @@ +# +# Copyright (C) 2015 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:=shine +PKG_VERSION:=3.1.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/savonet/shine/releases/download/$(PKG_VERSION)/ +PKG_MD5SUM:=fcad8108335f4b051b303fbdf3fca3fe + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Nicolas Thill + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 +PKG_USE_MIPS16:=0 + +include $(INCLUDE_DIR)/package.mk + +define Package/shine + SECTION:=sound + CATEGORY:=Sound + TITLE:=Super fast fixed-point MP3 encoder + URL:=https://github.com/savonet/shine +endef + +define Package/shine/description + savonet/shine is a blazing fast mp3 encoding library implemented in fixed-point + arithmetic. The library can thus be used to perform super fast mp3 encoding on + architectures without a FPU, such as armel, etc.. It is also, however, also + super fast on architectures with a FPU! +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) \ + $(PKG_INSTALL_DIR)/usr/include/shine \ + $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/libshine.{a,so*} \ + $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/shine.pc \ + $(1)/usr/lib/pkgconfig/ +endef + +define Package/shine/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/shineenc $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libshine.so.* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,shine)) diff --git a/sound/shine/patches/001-fix_mips64_bswap.patch b/sound/shine/patches/001-fix_mips64_bswap.patch new file mode 100644 index 0000000..8c42297 --- /dev/null +++ b/sound/shine/patches/001-fix_mips64_bswap.patch @@ -0,0 +1,11 @@ +--- a/src/bin/wave.c ++++ b/src/bin/wave.c +@@ -168,7 +168,7 @@ unsigned char wave_open(const char *fnam + } + + #ifdef SHINE_BIG_ENDIAN +-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) ++#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) + #define bswap_16(x) __builtin_bswap16(x) + #else + #define bswap_16(x) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) diff --git a/sound/sox/Makefile b/sound/sox/Makefile new file mode 100644 index 0000000..eda080f --- /dev/null +++ b/sound/sox/Makefile @@ -0,0 +1,89 @@ +# +# Copyright (C) 2008 David Cooper +# 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:=sox +PKG_VERSION:=14.4.1 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=@SF/sox +PKG_MD5SUM:=ff9ca6aca972549de0e80e8e30ed379c + +PKG_MAINTAINER:=Ted Hess +PKG_LICENSE:=LGPL-2.1 GPL-2.0 +PKG_LICENSE_FILES:=COPYING LICENSE.LGPL LICENSE.GPL + + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +TARGET_LDFLAGS+= \ + -Wl,-rpath-link=$(STAGING_DIR)/usr/lib + +define Package/sox + SECTION:=sound + CATEGORY:=Sound + DEPENDS:=+BUILD_PATENTED:lame-lib +BUILD_PATENTED:libmad +BUILD_PATENTED:libid3tag \ + +libvorbis +libvorbisidec +alsa-lib +libsndfile +libflac \ + +libmagic +libpng +libffmpeg + TITLE:=Sox is a general purpose sound converter/player/recorder + URL:=http://sox.sourceforge.net/ +endef + +define Package/sox/description + SoX is a command line utility that can convert various formats + of computer audio files in to other formats. It can also apply + various effects to these sound files during the conversion. + As an added bonus, SoX can play and record audio files on + several unix-style platforms. +endef + +define Build/Configure + $(call Build/Configure/Default, \ + --without-oss \ + --without-ao \ + --with-alsa \ + --without-libltdl \ + --with-ogg \ + --with-flac \ + --with-ffmpeg \ + --without-amr-wb \ + --without-amr-nb \ + --without-samplerate \ + --without-ladspa \ + --$(if $(CONFIG_BUILD_PATENTED),with-mad,without-mad) \ + --$(if $(CONFIG_BUILD_PATENTED),with-lame,without-lame) \ + --$(if $(CONFIG_BUILD_PATENTED),with-id3tag,without-id3tag) \ + ) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) \ + $(PKG_INSTALL_DIR)/usr/include \ + $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/libsox.{a,so*,la} \ + $(1)/usr/lib/ + $(INSTALL_DATA) \ + $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \ + $(1)/usr/lib/pkgconfig/ +endef + +define Package/sox/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/bin/{play,rec,sox} $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsox.so* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,sox)) diff --git a/sound/sox/patches/001-cross_compile.patch b/sound/sox/patches/001-cross_compile.patch new file mode 100644 index 0000000..7996ece --- /dev/null +++ b/sound/sox/patches/001-cross_compile.patch @@ -0,0 +1,22 @@ +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -144,7 +144,7 @@ EXTRA_DIST = monkey.wav optional-fmts.am + CMakeLists.txt soxconfig.h.cmake \ + tests.sh testall.sh tests.bat testall.bat test-comments + +-all: sox$(EXEEXT) play rec soxi sox_sample_test$(EXEEXT) example0$(EXEEXT) example1$(EXEEXT) example2$(EXEEXT) example3$(EXEEXT) example4$(EXEEXT) example5$(EXEEXT) ++all: sox$(EXEEXT) play rec + + play rec: sox$(EXEEXT) + if test "$(PLAYRECLINKS)" = "yes"; then \ +--- sox-14.4.1/src/Makefile.in ++++ sox-14.4.1/src/Makefile.in +@@ -2904,7 +2904,7 @@ + uninstall-libLTLIBRARIES uninstall-pkglibLTLIBRARIES + + +-all: sox$(EXEEXT) play rec soxi sox_sample_test$(EXEEXT) example0$(EXEEXT) example1$(EXEEXT) example2$(EXEEXT) example3$(EXEEXT) example4$(EXEEXT) example5$(EXEEXT) ++all: sox$(EXEEXT) play rec + + play rec: sox$(EXEEXT) + if test "$(PLAYRECLINKS)" = "yes"; then \ diff --git a/sound/sox/patches/010-fix_uclibc_build_issue.patch b/sound/sox/patches/010-fix_uclibc_build_issue.patch new file mode 100644 index 0000000..06454cd --- /dev/null +++ b/sound/sox/patches/010-fix_uclibc_build_issue.patch @@ -0,0 +1,19 @@ +--- sox-14.4.1.orig/src/formats.c ++++ sox-14.4.1/src/formats.c +@@ -409,7 +409,7 @@ static void UNUSED rewind_pipe(FILE * fp + #if defined _FSTDIO || defined _NEWLIB_VERSION || defined __APPLE__ + fp->_p -= PIPE_AUTO_DETECT_SIZE; + fp->_r += PIPE_AUTO_DETECT_SIZE; +-#elif defined __GLIBC__ ++#elif defined __GLIBC__ && ! defined __UCLIBC__ + fp->_IO_read_ptr = fp->_IO_read_base; + #elif defined _MSC_VER || defined _WIN32 || defined _WIN64 || defined _ISO_STDIO_ISO_H + fp->_ptr = fp->_base; +@@ -417,7 +417,6 @@ static void UNUSED rewind_pipe(FILE * fp + /* To fix this #error, either simply remove the #error line and live without + * file-type detection with pipes, or add support for your compiler in the + * lines above. Test with cat monkey.wav | ./sox --info - */ +- #error FIX NEEDED HERE + #define NO_REWIND_PIPE + (void)fp; + #endif diff --git a/sound/sox/patches/020-ffmpeg-0.11.patch b/sound/sox/patches/020-ffmpeg-0.11.patch new file mode 100644 index 0000000..61f6e23 --- /dev/null +++ b/sound/sox/patches/020-ffmpeg-0.11.patch @@ -0,0 +1,129 @@ +--- a/configure ++++ b/configure +@@ -15825,9 +15825,9 @@ + cat >>confdefs.h <<_ACEOF + #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 + _ACEOF +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for av_open_input_file in -lavformat" >&5 +-$as_echo_n "checking for av_open_input_file in -lavformat... " >&6; } +-if ${ac_cv_lib_avformat_av_open_input_file+:} false; then : ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for avformat_open_input in -lavformat" >&5 ++$as_echo_n "checking for avformat_open_input in -lavformat... " >&6; } ++if ${ac_cv_lib_avformat_avformat_open_input+:} false; then : + $as_echo_n "(cached) " >&6 + else + ac_check_lib_save_LIBS=$LIBS +@@ -15841,27 +15841,27 @@ + #ifdef __cplusplus + extern "C" + #endif +-char av_open_input_file (); ++char avformat_open_input (); + int + main () + { +-return av_open_input_file (); ++return avformat_open_input (); + ; + return 0; + } + _ACEOF + if ac_fn_c_try_link "$LINENO"; then : +- ac_cv_lib_avformat_av_open_input_file=yes ++ ac_cv_lib_avformat_avformat_open_input=yes + else +- ac_cv_lib_avformat_av_open_input_file=no ++ ac_cv_lib_avformat_avformat_open_input=no + fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_lib_save_LIBS + fi +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avformat_av_open_input_file" >&5 +-$as_echo "$ac_cv_lib_avformat_av_open_input_file" >&6; } +-if test "x$ac_cv_lib_avformat_av_open_input_file" = xyes; then : ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avformat_avformat_open_input" >&5 ++$as_echo "$ac_cv_lib_avformat_avformat_open_input" >&6; } ++if test "x$ac_cv_lib_avformat_avformat_open_input" = xyes; then : + for ac_header in libavcodec/avcodec.h ffmpeg/avcodec.h + do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +diff -Naur sox-14.4.0-orig/src/ffmpeg.c sox-14.4.0/src/ffmpeg.c +--- sox-14.4.0-orig/src/ffmpeg.c 2012-06-12 00:35:53.459027469 -0400 ++++ sox-14.4.0/src/ffmpeg.c 2012-06-12 00:36:26.539028545 -0400 +@@ -93,7 +93,7 @@ + #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) + enc->error_resilience = 1; + #else +- enc->error_recognition = 1; ++ enc->err_recognition = 1; + #endif + + if (!codec || avcodec_open(enc, codec) < 0) +@@ -157,7 +157,7 @@ + static int startread(sox_format_t * ft) + { + priv_t * ffmpeg = (priv_t *)ft->priv; +- AVFormatParameters params; ++ AVDictionary *params; + int ret; + int i; + +@@ -172,7 +172,7 @@ + + /* Open file and get format */ + memset(¶ms, 0, sizeof(params)); +- if ((ret = av_open_input_file(&ffmpeg->ctxt, ft->filename, NULL, 0, ¶ms)) < 0) { ++ if ((ret = avformat_open_input(&ffmpeg->ctxt, ft->filename, NULL, ¶ms)) < 0) { + lsx_fail("ffmpeg cannot open file for reading: %s (code %d)", ft->filename, ret); + return SOX_EOF; + } +@@ -231,7 +231,7 @@ + /* If input buffer empty, read more data */ + if (ffmpeg->audio_buf_index * 2 >= ffmpeg->audio_buf_size) { + if ((ret = av_read_frame(ffmpeg->ctxt, pkt)) < 0 && +- (ret == AVERROR_EOF || url_ferror(ffmpeg->ctxt->pb))) ++ (ret == AVERROR_EOF || ffmpeg->ctxt->pb->error)) + break; + ffmpeg->audio_buf_size = audio_decode_frame(ffmpeg, ffmpeg->audio_buf_aligned, AVCODEC_MAX_AUDIO_FRAME_SIZE); + ffmpeg->audio_buf_index = 0; +@@ -373,13 +373,6 @@ + return SOX_EOF; + } + +- /* set the output parameters (must be done even if no +- parameters). */ +- if (av_set_parameters(ffmpeg->ctxt, NULL) < 0) { +- lsx_fail("ffmpeg invalid output format parameters"); +- return SOX_EOF; +- } +- + /* Next line for debugging */ + /* dump_format(ffmpeg->ctxt, 0, ft->filename, 1); */ + +@@ -391,14 +384,14 @@ + + /* open the output file, if needed */ + if (!(ffmpeg->fmt->flags & AVFMT_NOFILE)) { +- if (url_fopen(&ffmpeg->ctxt->pb, ft->filename, URL_WRONLY) < 0) { ++ if (avio_open(&ffmpeg->ctxt->pb, ft->filename, AVIO_FLAG_WRITE) < 0) { + lsx_fail("ffmpeg could not open `%s'", ft->filename); + return SOX_EOF; + } + } + + /* write the stream header, if any */ +- av_write_header(ffmpeg->ctxt); ++ avformat_write_header(ffmpeg->ctxt, NULL); + + return SOX_SUCCESS; + } +@@ -478,7 +471,7 @@ + #if (LIBAVFORMAT_VERSION_INT < 0x340000) + url_fclose(&ffmpeg->ctxt->pb); + #else +- url_fclose(ffmpeg->ctxt->pb); ++ avio_close(ffmpeg->ctxt->pb); + #endif + } + diff --git a/sound/sox/patches/020-ffmpeg-2.x.patch b/sound/sox/patches/020-ffmpeg-2.x.patch new file mode 100644 index 0000000..44e7ebb --- /dev/null +++ b/sound/sox/patches/020-ffmpeg-2.x.patch @@ -0,0 +1,72 @@ +--- a/src/ffmpeg.c ++++ b/src/ffmpeg.c +@@ -50,6 +50,10 @@ + #include + #include "ffmpeg.h" + ++#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE ++#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 ++#endif ++ + #ifndef CODEC_TYPE_AUDIO + #define CODEC_TYPE_AUDIO AVMEDIA_TYPE_AUDIO + #endif +@@ -96,7 +100,7 @@ static int stream_component_open(priv_t + enc->err_recognition = 1; + #endif + +- if (!codec || avcodec_open(enc, codec) < 0) ++ if (!codec || avcodec_open2(enc, codec, NULL) < 0) + return -1; + if (enc->codec_type != AVMEDIA_TYPE_AUDIO) { + lsx_fail("ffmpeg CODEC %x is not an audio CODEC", enc->codec_type); +@@ -178,7 +182,7 @@ static int startread(sox_format_t * ft) + } + + /* Get CODEC parameters */ +- if ((ret = av_find_stream_info(ffmpeg->ctxt)) < 0) { ++ if ((ret = avformat_find_stream_info(ffmpeg->ctxt, NULL)) < 0) { + lsx_fail("ffmpeg could not find CODEC parameters for %s", ft->filename); + return SOX_EOF; + } +@@ -256,7 +260,7 @@ static int stopread(sox_format_t * ft) + if (ffmpeg->audio_stream >= 0) + stream_component_close(ffmpeg, ffmpeg->audio_stream); + if (ffmpeg->ctxt) { +- av_close_input_file(ffmpeg->ctxt); ++ avformat_close_input(&ffmpeg->ctxt); + ffmpeg->ctxt = NULL; /* safety */ + } + +@@ -267,16 +271,21 @@ static int stopread(sox_format_t * ft) + /* + * add an audio output stream + */ ++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 28, 0) ++static AVStream *add_audio_stream(sox_format_t * ft, AVFormatContext *oc, enum AVCodecID codec_id) ++#else + static AVStream *add_audio_stream(sox_format_t * ft, AVFormatContext *oc, enum CodecID codec_id) ++#endif + { + AVCodecContext *c; + AVStream *st; + +- st = av_new_stream(oc, 1); ++ st = avformat_new_stream(oc, NULL); + if (!st) { + lsx_fail("ffmpeg could not alloc stream"); + return NULL; + } ++ st->id = 1; + + c = st->codec; + c->codec_id = codec_id; +@@ -306,7 +315,7 @@ static int open_audio(priv_t * ffmpeg, A + } + + /* open it */ +- if (avcodec_open(c, codec) < 0) { ++ if (avcodec_open2(c, codec, NULL) < 0) { + lsx_fail("ffmpeg could not open CODEC"); + return SOX_EOF; + } diff --git a/sound/squeezelite/Makefile b/sound/squeezelite/Makefile new file mode 100644 index 0000000..6c1b489 --- /dev/null +++ b/sound/squeezelite/Makefile @@ -0,0 +1,146 @@ +# +# Copyright (C) 2015-2016 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:=squeezelite +PKG_VERSION:=1.8.4-743 +PKG_RELEASE=1 + +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=LICENSE.txt +PKG_MAINTAINER:= Ted Hess + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/ralph-irving/squeezelite.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=e37ed17fed9e11a7346cbe9f1e1deeccc051f42e +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +PKG_BUILD_DEPENDS:=libflac libvorbis libmad libfaad2 SQUEEZELITE_WMA:libffmpeg-audio-dec + +include $(INCLUDE_DIR)/package.mk + +define Package/squeezelite/default + SECTION:=sound + CATEGORY:=Sound + TITLE:=Headless squeezebox emulator + PROVIDES:=squeezelite + URL:=https://github.com/ralph-irving/squeezelite + DEPENDS:= +alsa-lib +SQUEEZELITE_RESAMPLE:libsoxr + MENU:=1 +endef + +define Package/squeezelite-full + $(call Package/squeezelite/default) + TITLE+= (full) + DEPENDS+= +libflac +libvorbis +libmad +libfaad2 \ + +SQUEEZELITE_WMA:libffmpeg-audio-dec + VARIANT:=full +endef + +define Package/squeezelite-mini + $(call Package/squeezelite/default) + TITLE+= (minimal) + VARIANT:=mini +endef + +define Package/squeezelite/config/default + + config SQUEEZELITE_WMA + bool "WMA/ALAC decode support" + help + Include WMA and ALAC decoding using ffmpeg + default n + + config SQUEEZELITE_RESAMPLE + bool "Resample support" + help + Include support for resampling using libsoxr + default n + + config SQUEEZELITE_DSD + bool "DSD playback over PCM (DoP)" + help + Include support for DSD over PCM for compatible DAC" + default n +endef + +define Package/squeezelite-full/config + if PACKAGE_squeezelite-full + $(call Package/squeezelite/config/default) + endif +endef + +define Package/squeezelite-mini/config + if PACKAGE_squeezelite-mini + $(call Package/squeezelite/config/default) + endif +endef + +define Package/squeezelite/description/default + Squeezelite is a small headless squeezebox emulator for linux using alsa audio output + It is aimed at supporting high quality audio at multiple sample rates including + 44.1/48/88.2/96/176.4/192k/352.8/384kHz + Supported codecs: mp3, flac, ogg, aac, (wma and alac via ffmpeg) + Native support for PCM builtin + Optional support of DSD playback via PCM for DoP capable DAC + Optional resampling to match sound device +endef + +define Package/squeezelite/description + $(call Package/squeezelite/description/default) + . + This package has all the audio codecs compiled in. +endef + +define Package/squeezelite-mini/description + $(call Package/squeezelite/description/default) + . + This package will dynamically load installed codecs. +endef + +#ifeq ($(CONFIG_SQUEEZELITE_WMA),y) +# PKG_BUILD_DEPENDS+= libffmpeg-audio-dec +#endif + +TARGET_CFLAGS+= -Wall -fPIC -O2 -DSELFPIPE + +ifeq ($(CONFIG_SQUEEZELITE_WMA),y) + TARGET_CFLAGS+= -DFFMPEG +endif + +ifeq ($(CONFIG_SQUEEZELITE_DSD),y) + TARGET_CFLAGS+= -DDSD +endif + +ifeq ($(CONFIG_SQUEEZELITE_RESAMPLE),y) + TARGET_CFLAGS+= -DRESAMPLE +endif + +TARGET_LDFLAGS+= -lasound -lpthread -lm -lrt + +ifeq ($(BUILD_VARIANT),full) + TARGET_CFLAGS+= -DLINKALL +endif + +define Package/squeezelite/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/squeezelite $(1)/usr/bin + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/squeezelite.init $(1)/etc/init.d/squeezelite + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/squeezelite.conf $(1)/etc/config/squeezelite +endef + +Package/squeezelite-mini/install=$(Package/squeezelite/install) +Package/squeezelite-full/install=$(Package/squeezelite/install) + +$(eval $(call BuildPackage,squeezelite-mini)) +$(eval $(call BuildPackage,squeezelite-full)) diff --git a/sound/squeezelite/files/squeezelite.conf b/sound/squeezelite/files/squeezelite.conf new file mode 100644 index 0000000..6bfcaab --- /dev/null +++ b/sound/squeezelite/files/squeezelite.conf @@ -0,0 +1,13 @@ + +config options 'options' + option name 'SqueezeWrt' + option model_name 'SqueezeLite' + option close_delay '0' + option priority '0' + option max_sr '0' + option device 'hw:0,0' + option decoder_auto_conf '1' + option dsd_over_pcm '0' + option ircontrol '0' + option interface '' + option enabled '1' diff --git a/sound/squeezelite/files/squeezelite.init b/sound/squeezelite/files/squeezelite.init new file mode 100644 index 0000000..d574625 --- /dev/null +++ b/sound/squeezelite/files/squeezelite.init @@ -0,0 +1,142 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 OpenWrt.org + +START=99 +STOP=1 + +USE_PROCD=1 +PROG=/usr/bin/squeezelite + +# +# Auto config checks for existing codec installations if not specified in config +# Explicit disable (override) by setting appropriate "decode_xxx" in config +# +checkcodec() { + config_get_bool auto_conf options "decoder_auto_conf" 1 + config_get_bool codec options "$1" $auto_conf + + if [ $codec -ne 0 ] ; then + if [ $auto_conf -eq 0 ] ; then + #force use requested + echo "$4" + else + if [ -e "/usr/lib/${2}" ] ; then + # Use codec (it exists) + echo "$4" + else + #exclude non-existant + if [ -z "$4" ] ; then + echo "-e $3" + else + echo "$4,$3" + fi + fi + fi + else + # explicitly excluded + if [ -z "$4" ] ; then + echo "-e $3" + else + echo "$4,$3" + fi + fi +} + +make_cmdline() { + cmdline="" + + config_get name options name "SqueezeWrt" + cmdline="$cmdline -n $name" + + config_get model_name options model_name "SqueezeLite" + cmdline="$cmdline -M $model_name" + + config_get interface options interface "" + [ -n "$interface" ] && cmdline="$cmdline -I $interface" + + config_get device options device "" + [ -n "$device" ] && cmdline="$cmdline -o $device" + + config_get alsa_buffer options alsa_buffer 200 + [ $alsa_buffer -eq 0 ] && alsa_buffer="200" + + config_get alsa_period options alsa_period 4 + [ $alsa_period -eq 0 ] && alsa_period="4" + + config_get alsa_format options alsa_format 16 + [ $alsa_format = "0" ] && alsa_format="16" + + config_get alsa_mmap options alsa_mmap 0 + cmdline="$cmdline -a $alsa_buffer:$alsa_period:$alsa_format:$alsa_mmap" + + config_get stream_bufsiz options stream_bufsiz 2048 + config_get out_bufsiz options out_bufsiz 3763 + cmdline="$cmdline -b $stream_bufsiz:$out_bufsiz" + + config_get max_sr options max_sr 0 + if [ $max_sr -ne 0 ] ; then + max_sr="-r $max_sr" + + config_get sr_delay options sr_delay 0 + [ $sr_delay -ne 0 ] && max_sr="$max_sr:$sr_delay" + cmdline="$cmdline $max_sr" + fi + + + config_get close_delay options close_delay 0 + [ $close_delay -ne 0 ] && cmdline="$cmdline -C $close_delay" + + config_get server_addr options server_addr "" + if [ -n "$server_addr" ] ; then + config_get server_port options server_port 3483 + cmdline="$cmdline -s $server_addr:$server_port" + fi + + config_get priority options priority 0 + [ $priority -ne 0 ] && cmdline="$cmdline -p $priority" + + # + # ***NOTE: codec lib names are in squeezelite.h (set decode_auto_conf to 0 to ignore) + # + local excl_codecs="" + local vorbis_lib="libvorbisidec.so.1" + + excl_codecs=`checkcodec decode_flac "libFLAC.so.8" flac "$excl_codecs"` + excl_codecs=`checkcodec decode_mp3 "libmad.so.0" mp3 "$excl_codecs"` + excl_codecs=`checkcodec decode_aac "libfaad.so.2" aac "$excl_codecs"` + + [ -e "/usr/lib/$vorbis_lib" ] || vorbis_lib="libvorbisfile.so.3" + + excl_codecs=`checkcodec decode_ogg "$vorbis_lib" ogg "$excl_codecs"` + excl_codecs=`checkcodec decode_wma_alac "libavcodec.so.56" wma,alac "$excl_codecs"` + cmdline="$cmdline $excl_codecs" + + config_get dop options dsd_over_pcm 0 + [ $dop -eq 1 ] && cmdline="$cmdline -D" +} + +start_service() { + config_load squeezelite + + config_get_bool enabled options 'enabled' 0 + [ $enabled -eq 0 ] && return + + # Build command params + make_cmdline + + procd_open_instance + logger -t 'squeezelite' "$cmdline" + procd_set_param command "$PROG" $cmdline + procd_close_instance +} + +# Wait for service to exit and release sockets +reload_service() { + stop + sleep 2 + start +} + +restart() { + reload_service +} diff --git a/sound/squeezelite/patches/005-respect_LDFLAGS.patch b/sound/squeezelite/patches/005-respect_LDFLAGS.patch new file mode 100644 index 0000000..d8df7ca --- /dev/null +++ b/sound/squeezelite/patches/005-respect_LDFLAGS.patch @@ -0,0 +1,56 @@ +From 1c53ed7db5b49ebf347efe65dbf9b740f9d54557 Mon Sep 17 00:00:00 2001 +From: Carlo Landmeter +Date: Tue, 31 Mar 2015 09:52:53 +0000 +Subject: [PATCH] respect LDFLAGS + +--- + Makefile | 17 +++++++++-------- + 1 file changed, 9 insertions(+), 8 deletions(-) + +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,7 @@ + # Cross compile support - create a Makefile which defines these three variables and then includes this Makefile... +-CFLAGS ?= -Wall -fPIC -O2 $(OPTS) +-LDFLAGS ?= -lasound -lpthread -lm -lrt ++CFLAGS ?= -Wall -O2 ++CFLAGS += -fPIC $(OPTS) ++LIBS ?= -lasound -lpthread -lm -lrt + EXECUTABLE ?= squeezelite + + # passing one or more of these in $(OPTS) enables optional feature inclusion +@@ -52,20 +53,20 @@ endif + + # add optional link options + ifneq (,$(findstring $(OPT_LINKALL), $(CFLAGS))) +- LDFLAGS += $(LINKALL) ++ LIBS += $(LINKALL) + ifneq (,$(findstring $(OPT_FF), $(CFLAGS))) +- LDFLAGS += $(LINKALL_FF) ++ LIBS += $(LINKALL_FF) + endif + ifneq (,$(findstring $(OPT_RESAMPLE), $(CFLAGS))) +- LDFLAGS += $(LINKALL_RESAMPLE) ++ LIBS += $(LINKALL_RESAMPLE) + endif + ifneq (,$(findstring $(OPT_IR), $(CFLAGS))) +- LDFLAGS += $(LINKALL_IR) ++ LIBS += $(LINKALL_IR) + endif + else + # if not LINKALL and linux add LINK_LINUX + ifeq ($(UNAME), Linux) +- LDFLAGS += $(LINK_LINUX) ++ LIBS += $(LINK_LINUX) + endif + endif + +@@ -74,7 +75,7 @@ OBJECTS = $(SOURCES:.c=.o) + all: $(EXECUTABLE) + + $(EXECUTABLE): $(OBJECTS) +- $(CC) $(OBJECTS) $(LDFLAGS) -o $@ ++ $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@ + + $(OBJECTS): $(DEPS) + diff --git a/sound/squeezelite/patches/010-select_broadcast_interface.patch b/sound/squeezelite/patches/010-select_broadcast_interface.patch new file mode 100644 index 0000000..465f61a --- /dev/null +++ b/sound/squeezelite/patches/010-select_broadcast_interface.patch @@ -0,0 +1,356 @@ +--- a/main.c ++++ b/main.c +@@ -78,6 +78,7 @@ static void usage(const char *argv0) { + #if IR + " -i []\tEnable lirc remote control support (lirc config file ~/.lircrc used if filename not specified)\n" + #endif ++ " -I \t\tNetwork interface used to send discovery\n" + " -m \t\tSet mac address, format: ab:cd:ef:12:34:56\n" + " -M \tSet the squeezelite player model name sent to the server (default: " MODEL_NAME_STRING ")\n" + " -n \t\tSet the player name\n" +@@ -233,6 +234,8 @@ int main(int argc, char **argv) { + extern bool pcm_check_header; + char *logfile = NULL; + u8_t mac[6]; ++ char *iface = NULL; ++ in_addr_t bcast_addr = 0; + unsigned stream_buf_size = STREAMBUF_SIZE; + unsigned output_buf_size = 0; // set later + unsigned rates[MAX_SUPPORTED_SAMPLERATES] = { 0 }; +@@ -271,6 +274,7 @@ int main(int argc, char **argv) { + + int maxSampleRate = 0; + ++ memset(mac, 0, sizeof(mac)); + char *optarg = NULL; + int optind = 1; + int i; +@@ -278,8 +282,6 @@ int main(int argc, char **argv) { + #define MAXCMDLINE 512 + char cmdline[MAXCMDLINE] = ""; + +- get_mac(mac); +- + for (i = 0; i < argc && (strlen(argv[i]) + strlen(cmdline) + 2 < MAXCMDLINE); i++) { + strcat(cmdline, argv[i]); + strcat(cmdline, " "); +@@ -287,7 +289,7 @@ int main(int argc, char **argv) { + + while (optind < argc && strlen(argv[optind]) >= 2 && argv[optind][0] == '-') { + char *opt = argv[optind] + 1; +- if (strstr("oabcCdefmMnNpPrs" ++ if (strstr("oabcCdefImMnNpPrs" + #if ALSA + "UV" + #endif +@@ -382,6 +384,9 @@ int main(int argc, char **argv) { + case 'f': + logfile = optarg; + break; ++ case 'I': ++ iface = optarg; ++ break; + case 'm': + { + int byte = 0; +@@ -667,6 +672,11 @@ int main(int argc, char **argv) { + winsock_init(); + #endif + ++ if (!(bcast_addr = get_iface_info(log_slimproto, iface, mac))) { ++ fprintf(stderr, "Error binding to network or none given\n"); ++ exit(1); ++ } ++ + stream_init(log_stream, stream_buf_size); + + if (!strcmp(output_device, "-")) { +@@ -710,7 +720,7 @@ int main(int argc, char **argv) { + exit(1); + } + +- slimproto(log_slimproto, server, mac, name, namefile, modelname, maxSampleRate); ++ slimproto(log_slimproto, server, bcast_addr, mac, name, namefile, modelname, maxSampleRate); + + decode_close(); + stream_close(); +--- a/squeezelite.h ++++ b/squeezelite.h +@@ -403,7 +403,7 @@ typedef enum { EVENT_TIMEOUT = 0, EVENT_ + + char *next_param(char *src, char c); + u32_t gettime_ms(void); +-void get_mac(u8_t *mac); ++in_addr_t get_iface_info(log_level level, char *iface, u8_t *mac); + void set_nonblock(sockfd s); + int connect_timeout(sockfd sock, const struct sockaddr *addr, socklen_t addrlen, int timeout); + void server_addr(char *server, in_addr_t *ip_ptr, unsigned *port_ptr); +@@ -459,7 +459,7 @@ void buf_init(struct buffer *buf, size_t + void buf_destroy(struct buffer *buf); + + // slimproto.c +-void slimproto(log_level level, char *server, u8_t mac[6], const char *name, const char *namefile, const char *modelname, int maxSampleRate); ++void slimproto(log_level level, char *server, in_addr_t bcast_addr, u8_t mac[6], const char *name, const char *namefile, const char *modelname, int maxSampleRate); + void slimproto_stop(void); + void wake_controller(void); + +--- a/slimproto.c ++++ b/slimproto.c +@@ -119,7 +119,7 @@ void send_packet(u8_t *packet, size_t le + } + } + +-static void sendHELO(bool reconnect, const char *fixed_cap, const char *var_cap, u8_t mac[6]) { ++static void sendHELO(bool reconnect, const char *fixed_cap, const char *var_cap, u8_t *mac) { + const char *base_cap = "Model=squeezelite,AccuratePlayPoints=1,HasDigitalOut=1,HasPolarityInversion=1,Firmware=" VERSION; + struct HELO_packet pkt; + +@@ -782,7 +782,7 @@ void wake_controller(void) { + wake_signal(wake_e); + } + +-in_addr_t discover_server(void) { ++in_addr_t discover_server(in_addr_t bcast_addr) { + struct sockaddr_in d; + struct sockaddr_in s; + char *buf; +@@ -798,7 +798,7 @@ in_addr_t discover_server(void) { + memset(&d, 0, sizeof(d)); + d.sin_family = AF_INET; + d.sin_port = htons(PORT); +- d.sin_addr.s_addr = htonl(INADDR_BROADCAST); ++ d.sin_addr.s_addr = bcast_addr; + + pollinfo.fd = disc_sock; + pollinfo.events = POLLIN; +@@ -829,7 +829,7 @@ in_addr_t discover_server(void) { + #define FIXED_CAP_LEN 256 + #define VAR_CAP_LEN 128 + +-void slimproto(log_level level, char *server, u8_t mac[6], const char *name, const char *namefile, const char *modelname, int maxSampleRate) { ++void slimproto(log_level level, char *server, in_addr_t bcast_addr, u8_t mac[6], const char *name, const char *namefile, const char *modelname, int maxSampleRate) { + struct sockaddr_in serv_addr; + static char fixed_cap[FIXED_CAP_LEN], var_cap[VAR_CAP_LEN] = ""; + bool reconnect = false; +@@ -849,7 +849,7 @@ void slimproto(log_level level, char *se + } + + if (!slimproto_ip) { +- slimproto_ip = discover_server(); ++ slimproto_ip = discover_server(bcast_addr); + } + + if (!slimproto_port) { +@@ -924,7 +924,7 @@ void slimproto(log_level level, char *se + + // rediscover server if it was not set at startup + if (!server && ++failed_connect > 5) { +- slimproto_ip = serv_addr.sin_addr.s_addr = discover_server(); ++ slimproto_ip = serv_addr.sin_addr.s_addr = discover_server(bcast_addr); + } + + } else { +--- a/utils.c ++++ b/utils.c +@@ -22,11 +22,11 @@ + #include "squeezelite.h" + + #if LINUX || OSX || FREEBSD +-#include ++#include + #include +-#include +-#if FREEBSD + #include ++#include ++#if FREEBSD || OSX + #include + #include + #endif +@@ -44,15 +44,11 @@ + #if WIN + #include + #endif +-#if OSX +-#include +-#include +-#include +-#include +-#endif + + #include + ++static log_level loglevel; ++ + // logging functions + const char *logtime(void) { + static char buf[100]; +@@ -114,58 +110,101 @@ u32_t gettime_ms(void) { + #endif + } + +-// mac address +-#if LINUX && !defined(SUN) +-// search first 4 interfaces returned by IFCONF +-void get_mac(u8_t mac[]) { +- char *utmac; +- struct ifconf ifc; +- struct ifreq *ifr, *ifend; +- struct ifreq ifreq; +- struct ifreq ifs[4]; ++// Get broadcast address for interface (given or first available) ++// Return MAC address if none given ++#if LINUX || OSX || FREEBSD + +- utmac = getenv("UTMAC"); +- if (utmac) +- { +- if ( strlen(utmac) == 17 ) +- { +- if (sscanf(utmac,"%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx", +- &mac[0],&mac[1],&mac[2],&mac[3],&mac[4],&mac[5]) == 6) +- { +- return; +- } +- } ++in_addr_t get_iface_info(log_level level, char *iface, u8_t *mac) { ++ struct ifaddrs *addrs, *ifa; ++ struct sockaddr *sdl; ++ char ifname[16]; ++ unsigned char *ptr; ++ in_addr_t bcast_addr = 0; ++ int have_mac = 0, have_ifname = 0; ++ ++ loglevel = level; ++ ++ // Check for non-zero MAC ++ if ((mac[0] | mac[1] | mac[2]) != 0) ++ have_mac = 1; ++ ++ // Copy interface name, if it was provided. ++ if (iface != NULL) ++ { ++ if( strlen(iface) > sizeof(ifname) ) ++ return -1; + ++ strncpy(ifname, iface, sizeof(ifname)); ++ have_ifname = 1; + } + +- mac[0] = mac[1] = mac[2] = mac[3] = mac[4] = mac[5] = 0; ++ if (getifaddrs(&addrs) == 0) { ++ //iterate to find corresponding ethernet address ++ for (ifa = addrs; ifa; ifa = ifa->ifa_next) { ++ // Skip LOOPBACK interfaces, DOWN interfaces and interfaces that ++ // don't support BROADCAST. ++ if ((ifa->ifa_flags & IFF_LOOPBACK) ++ || !(ifa->ifa_flags & IFF_UP) ++ || !(ifa->ifa_flags & IFF_BROADCAST)) ++ { ++ continue; ++ } + +- int s = socket(AF_INET, SOCK_DGRAM, 0); ++ if (!have_ifname) ++ { ++ // We have found a valid interface name. Keep it. ++ strncpy(ifname, ifa->ifa_name, sizeof(ifname)); ++ have_ifname = 1; ++ } else { ++ if (strncmp(ifname, ifa->ifa_name, sizeof(ifname)) != 0) ++ { ++ // This is not the interface we're looking for. ++ continue; ++ } ++ } + +- ifc.ifc_len = sizeof(ifs); +- ifc.ifc_req = ifs; + +- if (ioctl(s, SIOCGIFCONF, &ifc) == 0) { +- ifend = ifs + (ifc.ifc_len / sizeof(struct ifreq)); ++ // Check address family. ++ if ((ifa->ifa_addr->sa_family == AF_INET) && ++ (((struct sockaddr_in *)ifa->ifa_broadaddr)->sin_addr.s_addr != 0)) ++ { ++ // Get broadcast address and MAC address ++ bcast_addr = ((struct sockaddr_in *)ifa->ifa_broadaddr)->sin_addr.s_addr; ++ break; ++ } ++ else ++ { ++ // Address is not IPv4 ++ if (iface == NULL) ++ have_ifname = 0; ++ } ++ ++ } + +- for (ifr = ifc.ifc_req; ifr < ifend; ifr++) { +- if (ifr->ifr_addr.sa_family == AF_INET) { +- +- strncpy(ifreq.ifr_name, ifr->ifr_name, sizeof(ifreq.ifr_name)); +- if (ioctl (s, SIOCGIFHWADDR, &ifreq) == 0) { +- memcpy(mac, ifreq.ifr_hwaddr.sa_data, 6); +- if (mac[0]+mac[1]+mac[2] != 0) { +- break; +- } ++ // Find MAC address matching interface ++ if (!have_mac && (bcast_addr != 0)) { ++ for (ifa = addrs; ifa; ifa = ifa->ifa_next) { ++ if ((ifa->ifa_addr->sa_family == PF_PACKET) && ++ (strncmp(ifname, ifa->ifa_name, sizeof(ifname)) == 0)) { ++ sdl = (struct sockaddr *)(ifa->ifa_addr); ++ ptr = (unsigned char *)sdl->sa_data; ++ memcpy(mac, ptr + 10, 6); ++ have_mac = 1; + } + } + } ++ ++ freeifaddrs(addrs); + } + +- close(s); ++ LOG_INFO("Interface: %s, broadcast: %08X, macaddr = %02x:%02x:%02x:%02x:%02x:%02x", ++ ifname, bcast_addr, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); ++ ++ return bcast_addr; + } + #endif + ++ + #if SUN + void get_mac(u8_t mac[]) { + struct arpreq parpreq; +@@ -232,30 +271,6 @@ void get_mac(u8_t mac[]) { + } + #endif + +-#if OSX || FREEBSD +-void get_mac(u8_t mac[]) { +- struct ifaddrs *addrs, *ptr; +- const struct sockaddr_dl *dlAddr; +- const unsigned char *base; +- +- mac[0] = mac[1] = mac[2] = mac[3] = mac[4] = mac[5] = 0; +- +- if (getifaddrs(&addrs) == 0) { +- ptr = addrs; +- while (ptr) { +- if (ptr->ifa_addr->sa_family == AF_LINK && ((const struct sockaddr_dl *) ptr->ifa_addr)->sdl_type == IFT_ETHER) { +- dlAddr = (const struct sockaddr_dl *)ptr->ifa_addr; +- base = (const unsigned char*) &dlAddr->sdl_data[dlAddr->sdl_nlen]; +- memcpy(mac, base, min(dlAddr->sdl_alen, 6)); +- break; +- } +- ptr = ptr->ifa_next; +- } +- freeifaddrs(addrs); +- } +-} +-#endif +- + #if WIN + #pragma comment(lib, "IPHLPAPI.lib") + void get_mac(u8_t mac[]) { diff --git a/sound/squeezelite/patches/020-no_mpg123.patch b/sound/squeezelite/patches/020-no_mpg123.patch new file mode 100644 index 0000000..bc0547a --- /dev/null +++ b/sound/squeezelite/patches/020-no_mpg123.patch @@ -0,0 +1,83 @@ +--- a/Makefile ++++ b/Makefile +@@ -15,7 +15,7 @@ OPT_IR = -DIR + SOURCES = \ + main.c slimproto.c buffer.c stream.c utils.c \ + output.c output_alsa.c output_pa.c output_stdout.c output_pack.c decode.c \ +- flac.c pcm.c mad.c vorbis.c faad.c mpg.c ++ flac.c pcm.c mad.c vorbis.c faad.c + + SOURCES_DSD = dsd.c dop.c dsd2pcm/dsd2pcm.c + SOURCES_FF = ffmpeg.c +@@ -25,7 +25,7 @@ SOURCES_IR = ir.c + + LINK_LINUX = -ldl + +-LINKALL = -lFLAC -lmad -lvorbisfile -lfaad -lmpg123 ++LINKALL = -lFLAC -lmad -lvorbisfile -lfaad + LINKALL_FF = -lavcodec -lavformat -lavutil + LINKALL_RESAMPLE = -lsoxr + LINKALL_IR = -llirc_client +--- a/decode.c ++++ b/decode.c +@@ -147,8 +147,8 @@ void decode_init(log_level level, const + // try mad then mpg for mp3 unless command line option passed + if (!(strstr(exclude_codecs, "mp3") || strstr(exclude_codecs, "mad")) && + (!include_codecs || strstr(include_codecs, "mp3") || strstr(include_codecs, "mad"))) codecs[i] = register_mad(); +- if (!(strstr(exclude_codecs, "mp3") || strstr(exclude_codecs, "mpg")) && !codecs[i] && +- (!include_codecs || strstr(include_codecs, "mp3") || strstr(include_codecs, "mpg"))) codecs[i] = register_mpg(); ++// if (!(strstr(exclude_codecs, "mp3") || strstr(exclude_codecs, "mpg")) && !codecs[i] && ++// (!include_codecs || strstr(include_codecs, "mp3") || strstr(include_codecs, "mpg"))) codecs[i] = register_mpg(); + + mutex_create(decode.mutex); + +--- a/main.c ++++ b/main.c +@@ -39,7 +39,8 @@ + #else + #define CODECS_DSD "" + #endif +-#define CODECS_MP3 " (mad,mpg for specific mp3 codec)" ++//#define CODECS_MP3 " (mad,mpg for specific mp3 codec)" ++#define CODECS_MP3 " (mad for specific mp3 codec)" + + #define CODECS CODECS_BASE CODECS_FF CODECS_DSD CODECS_MP3 + +--- a/squeezelite.h ++++ b/squeezelite.h +@@ -155,7 +155,7 @@ + #if LINUX + #define LIBFLAC "libFLAC.so.8" + #define LIBMAD "libmad.so.0" +-#define LIBMPG "libmpg123.so.0" ++//#define LIBMPG "libmpg123.so.0" + #define LIBVORBIS "libvorbisfile.so.3" + #define LIBTREMOR "libvorbisidec.so.1" + #define LIBFAAD "libfaad.so.2" +@@ -169,7 +169,7 @@ + #if OSX + #define LIBFLAC "libFLAC.8.dylib" + #define LIBMAD "libmad.0.dylib" +-#define LIBMPG "libmpg123.0.dylib" ++//#define LIBMPG "libmpg123.0.dylib" + #define LIBVORBIS "libvorbisfile.3.dylib" + #define LIBTREMOR "libvorbisidec.1.dylib" + #define LIBFAAD "libfaad.2.dylib" +@@ -182,7 +182,7 @@ + #if WIN + #define LIBFLAC "libFLAC.dll" + #define LIBMAD "libmad-0.dll" +-#define LIBMPG "libmpg123-0.dll" ++//#define LIBMPG "libmpg123-0.dll" + #define LIBVORBIS "libvorbisfile.dll" + #define LIBTREMOR "libvorbisidec.dll" + #define LIBFAAD "libfaad2.dll" +@@ -195,7 +195,7 @@ + #if FREEBSD + #define LIBFLAC "libFLAC.so.11" + #define LIBMAD "libmad.so.2" +-#define LIBMPG "libmpg123.so.0" ++//#define LIBMPG "libmpg123.so.0" + #define LIBVORBIS "libvorbisfile.so.6" + #define LIBTREMOR "libvorbisidec.so.1" + #define LIBFAAD "libfaad.so.2" diff --git a/sound/squeezelite/patches/030-fix_musl_compatibilty.patch b/sound/squeezelite/patches/030-fix_musl_compatibilty.patch new file mode 100644 index 0000000..24f00e0 --- /dev/null +++ b/sound/squeezelite/patches/030-fix_musl_compatibilty.patch @@ -0,0 +1,14 @@ +--- a/output_alsa.c ++++ b/output_alsa.c +@@ -911,8 +911,11 @@ void output_init_alsa(log_level level, c + LOG_INFO("memory locked"); + } + ++#ifdef M_TRIM_THRESHOLD ++ // mallopt is not defined in musl libc + mallopt(M_TRIM_THRESHOLD, -1); + mallopt(M_MMAP_MAX, 0); ++#endif + + touch_memory(silencebuf, MAX_SILENCE_FRAMES * BYTES_PER_FRAME); + touch_memory(outputbuf->buf, outputbuf->size); diff --git a/sound/squeezelite/patches/040-clear_dynlink_errors.patch b/sound/squeezelite/patches/040-clear_dynlink_errors.patch new file mode 100644 index 0000000..b534a2b --- /dev/null +++ b/sound/squeezelite/patches/040-clear_dynlink_errors.patch @@ -0,0 +1,105 @@ +--- a/faad.c ++++ b/faad.c +@@ -594,6 +594,8 @@ static bool load_faad() { + return false; + } + ++ err = dlerror(); // Reset previous dynamic linking error string (if there was) ++ + a->NeAACDecGetCurrentConfiguration = dlsym(handle, "NeAACDecGetCurrentConfiguration"); + a->NeAACDecSetConfiguration = dlsym(handle, "NeAACDecSetConfiguration"); + a->NeAACDecOpen = dlsym(handle, "NeAACDecOpen"); +--- a/ffmpeg.c ++++ b/ffmpeg.c +@@ -620,6 +620,8 @@ static bool load_ff() { + return false; + } + ++ err = dlerror(); // Reset previous dynamic linking error string (if there was) ++ + sprintf(name, LIBAVFORMAT, LIBAVFORMAT_VERSION_MAJOR); + handle_format = dlopen(name, RTLD_NOW); + if (!handle_format) { +--- a/flac.c ++++ b/flac.c +@@ -241,6 +241,8 @@ static bool load_flac() { + return false; + } + ++ err = dlerror(); // Reset previous dynamic linking error string (if there was) ++ + f->FLAC__StreamDecoderErrorStatusString = dlsym(handle, "FLAC__StreamDecoderErrorStatusString"); + f->FLAC__StreamDecoderStateString = dlsym(handle, "FLAC__StreamDecoderStateString"); + f->FLAC__stream_decoder_new = dlsym(handle, "FLAC__stream_decoder_new"); +--- a/ir.c ++++ b/ir.c +@@ -168,10 +168,10 @@ static void *ir_thread() { + UNLOCK_I; + wake_controller(); + } +- ++ + free(code); + } +- ++ + return 0; + } + +@@ -185,6 +185,8 @@ static bool load_lirc() { + return false; + } + ++ err = dlerror(); // Reset previous dynamic linking error string (if there was) ++ + i->lirc_init = dlsym(handle, "lirc_init"); + i->lirc_deinit = dlsym(handle, "lirc_deinit"); + i->lirc_readconfig = dlsym(handle, "lirc_readconfig"); +--- a/mad.c ++++ b/mad.c +@@ -365,7 +365,9 @@ static bool load_mad() { + LOG_INFO("dlerror: %s", dlerror()); + return false; + } +- ++ ++ err = dlerror(); // Reset previous dynamic linking error string (if there was) ++ + m->mad_stream_init = dlsym(handle, "mad_stream_init"); + m->mad_frame_init = dlsym(handle, "mad_frame_init"); + m->mad_synth_init = dlsym(handle, "mad_synth_init"); +--- a/mpg.c ++++ b/mpg.c +@@ -222,7 +222,9 @@ static bool load_mpg() { + LOG_INFO("dlerror: %s", dlerror()); + return false; + } +- ++ ++ err = dlerror(); // Reset previous dynamic linking error string (if there was) ++ + m->mpg123_init = dlsym(handle, "mpg123_init"); + m->mpg123_feature = dlsym(handle, "mpg123_feature"); + m->mpg123_rates = dlsym(handle, "mpg123_rates"); +--- a/resample.c ++++ b/resample.c +@@ -251,6 +251,8 @@ static bool load_soxr(void) { + return false; + } + ++ err = dlerror(); // Reset previous dynamic linking error string (if there was) ++ + r->soxr_io_spec = dlsym(handle, "soxr_io_spec"); + r->soxr_quality_spec = dlsym(handle, "soxr_quality_spec"); + r->soxr_create = dlsym(handle, "soxr_create"); +--- a/vorbis.c ++++ b/vorbis.c +@@ -287,6 +287,8 @@ static bool load_vorbis() { + } + } + ++ err = dlerror(); // Reset previous dynamic linking error string (if there was) ++ + v->ov_read = tremor ? NULL : dlsym(handle, "ov_read"); + v->ov_read_tremor = tremor ? dlsym(handle, "ov_read") : NULL; + v->ov_info = dlsym(handle, "ov_info"); diff --git a/sound/svox/Makefile b/sound/svox/Makefile new file mode 100644 index 0000000..43c2b13 --- /dev/null +++ b/sound/svox/Makefile @@ -0,0 +1,61 @@ +# +# Copyright (C) 2015 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:=svox +PKG_VERSION:=1.0+git20130326 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz +PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/non-free/s/svox +PKG_MD5SUM:=df4bf610ff4273b420e80ff64af93130 + +PKG_MAINTAINER:=Alessandro Di Marco +PKG_LICENSE:=Apache-2.0 +PKG_LICENSE_FILES:= + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/svox + TITLE:=SVOX PicoTTS text-to-speech engine + SECTION:=sound + CATEGORY:=Sound + URL:=https://android.googlesource.com/platform/external/svox/ + DEPENDS:=+libpopt +endef + +define Package/svox/description + SVOX is an embedded speech technology company founded in 2000 and + headquartered in Zurich, Switzerland. SVOX was acquired by Nuance + Communications in 2011. Company's products included Automated Speech + Recognition (ASR), Text-to-Speech (TTS) and Speech Dialog systems, + with customers mostly being manufacturers and system integrators in + automotive and mobile device industries. + SVOX TTS technology is characterized by natural and clear sound as well + as unique polyglot capability - the same voice can speak multiple + languages like a native speaker. +endef + +define Build/Prepare + $(call Build/Prepare/Default) + mv $(PKG_BUILD_DIR)/pico/* $(PKG_BUILD_DIR) +endef + +define Package/svox/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pico2wave $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libttspico.so* $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/share/pico/lang + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/pico/lang/* $(1)/usr/share/pico/lang/ +endef + +$(eval $(call BuildPackage,svox)) diff --git a/sound/svox/patches/0001-autoconf-building-of-library-using-libtool.patch b/sound/svox/patches/0001-autoconf-building-of-library-using-libtool.patch new file mode 100644 index 0000000..73c76bb --- /dev/null +++ b/sound/svox/patches/0001-autoconf-building-of-library-using-libtool.patch @@ -0,0 +1,113 @@ +From 9fe1aa475b2667446b081623abc5c6f6083a76e6 Mon Sep 17 00:00:00 2001 +From: Mathieu Parent +Date: Sat, 24 Oct 2009 17:03:37 +0200 +Subject: [PATCH 1/7] autoconf building of library (using libtool) + +--- + pico/Makefile.am | 36 ++++++++++++++++++++++++++++++++++++ + pico/autogen.sh | 36 ++++++++++++++++++++++++++++++++++++ + pico/configure.in | 16 ++++++++++++++++ + 3 files changed, 88 insertions(+), 0 deletions(-) + create mode 100644 pico/Makefile.am + create mode 100755 pico/autogen.sh + create mode 100644 pico/configure.in + +--- /dev/null ++++ b/pico/Makefile.am +@@ -0,0 +1,36 @@ ++## Makefile.am -- Process this file with automake to produce Makefile.in ++ ++ACLOCAL_AMFLAGS = -I m4 ++ ++lib_LTLIBRARIES = libttspico.la ++libttspico_la_SOURCES = \ ++ lib/picoacph.c \ ++ lib/picoapi.c \ ++ lib/picobase.c \ ++ lib/picocep.c \ ++ lib/picoctrl.c \ ++ lib/picodata.c \ ++ lib/picodbg.c \ ++ lib/picoextapi.c \ ++ lib/picofftsg.c \ ++ lib/picokdbg.c \ ++ lib/picokdt.c \ ++ lib/picokfst.c \ ++ lib/picoklex.c \ ++ lib/picoknow.c \ ++ lib/picokpdf.c \ ++ lib/picokpr.c \ ++ lib/picoktab.c \ ++ lib/picoos.c \ ++ lib/picopal.c \ ++ lib/picopam.c \ ++ lib/picopr.c \ ++ lib/picorsrc.c \ ++ lib/picosa.c \ ++ lib/picosig.c \ ++ lib/picosig2.c \ ++ lib/picospho.c \ ++ lib/picotok.c \ ++ lib/picotrns.c \ ++ lib/picowa.c ++ +--- /dev/null ++++ b/pico/autogen.sh +@@ -0,0 +1,38 @@ ++#!/bin/sh ++ ++#created by aclocal ++rm -rf autom4te.cache ++rm -f aclocal.m4 ++ ++#created by libtoolize ++rm -rf m4 ++mkdir m4 ++rm -f ltmain.sh ++ ++#created by autoconf ++rm -f configure ++ ++#created by automake ++rm -f install-sh missing depcomp Makefile.in config.guess config.sub ++rm -f INSTALL COPYING compile ++ ++#created by ./configure ++rm -rf .deps ++rm -f Makefile config.log config.status libtool ++ ++if [ "$1" = "clean" ]; then ++ exit ++fi ++ ++IPATHS="-I lib" ++ ++libtoolize ++aclocal $IPATHS ++automake --add-missing ++autoconf $IPATHS ++ ++rm -rf autom4te.cache ++ ++echo "Now run ./configure and then make." ++exit 0 ++ +--- /dev/null ++++ b/pico/configure.in +@@ -0,0 +1,16 @@ ++dnl Process this file with autoconf to produce a configure script. ++ ++AC_PREREQ(2.59) ++ ++AC_INIT([svox], [1.0], [math.parent@gmail.com]) ++ ++AM_INIT_AUTOMAKE([1.9 foreign]) ++ ++AC_PROG_CC ++LT_INIT ++AC_PROG_LIBTOOL ++ ++AC_CONFIG_FILES([Makefile]) ++AC_OUTPUT ++ ++AC_CONFIG_MACRO_DIR([m4]) diff --git a/sound/svox/patches/0002-gitignore-for-autotools-files.patch b/sound/svox/patches/0002-gitignore-for-autotools-files.patch new file mode 100644 index 0000000..df57df7 --- /dev/null +++ b/sound/svox/patches/0002-gitignore-for-autotools-files.patch @@ -0,0 +1,51 @@ +From b56b0a4bdf3e11271caab744f532cb055c517b51 Mon Sep 17 00:00:00 2001 +From: Mathieu Parent +Date: Sat, 24 Oct 2009 17:12:42 +0200 +Subject: [PATCH 2/7] gitignore for autotools files + +--- + pico/.gitignore | 32 ++++++++++++++++++++++++++++++++ + 1 files changed, 32 insertions(+), 0 deletions(-) + create mode 100644 pico/.gitignore + +diff --git a/pico/.gitignore b/pico/.gitignore +new file mode 100644 +index 0000000..4235569 +--- /dev/null ++++ b/pico/.gitignore +@@ -0,0 +1,32 @@ ++#created by aclocal ++autom4te.cache ++aclocal.m4 ++ ++#created by libtoolize ++m4 ++ltmain.sh ++ ++#created by autoconf ++configure ++ ++#created by automake ++install-sh ++missing ++depcomp ++Makefile.in ++config.guess ++config.sub ++ ++#created by ./configure ++.deps ++Makefile ++config.log ++config.status ++libtool ++ ++#created by make ++*.o ++*.lo ++.libs ++libttspico.la ++ +-- +1.7.1 + diff --git a/sound/svox/patches/0003-pico2wave-Convert-text-to-.wav-using-svox-text-to-sp.patch b/sound/svox/patches/0003-pico2wave-Convert-text-to-.wav-using-svox-text-to-sp.patch new file mode 100644 index 0000000..c8a2e83 --- /dev/null +++ b/sound/svox/patches/0003-pico2wave-Convert-text-to-.wav-using-svox-text-to-sp.patch @@ -0,0 +1,399 @@ +From 8bec80dccc9f4fe147a500486813f4e89a0d56d8 Mon Sep 17 00:00:00 2001 +From: Mathieu Parent +Date: Sun, 25 Oct 2009 15:19:01 +0100 +Subject: [PATCH 3/7] pico2wave: Convert text to .wav using svox text-to-speech system. + +--- + pico/.gitignore | 1 + + pico/Makefile.am | 7 + + pico/bin/pico2wave.c | 341 ++++++++++++++++++++++++++++++++++++++++++++++++++ + pico/configure.in | 3 + + 4 files changed, 352 insertions(+), 0 deletions(-) + create mode 100644 pico/bin/pico2wave.c + +diff --git a/pico/.gitignore b/pico/.gitignore +index 4235569..a110298 100644 +--- a/pico/.gitignore ++++ b/pico/.gitignore +@@ -29,4 +29,5 @@ libtool + *.lo + .libs + libttspico.la ++pico2wave + +diff --git a/pico/Makefile.am b/pico/Makefile.am +index 6d8a10c..0d9472d 100644 +--- a/pico/Makefile.am ++++ b/pico/Makefile.am +@@ -34,3 +34,10 @@ libttspico_la_SOURCES = \ + lib/picotrns.c \ + lib/picowa.c + ++bin_PROGRAMS = pico2wave ++pico2wave_SOURCES = \ ++ bin/pico2wave.c ++pico2wave_LDADD = \ ++ libttspico.la -lm -lpopt ++pico2wave_CFLAGS = -Wall -I lib ++ +diff --git a/pico/bin/pico2wave.c b/pico/bin/pico2wave.c +new file mode 100644 +index 0000000..0c035a7 +--- /dev/null ++++ b/pico/bin/pico2wave.c +@@ -0,0 +1,341 @@ ++/* pico2wave.c ++ ++ * Copyright (C) 2009 Mathieu Parent ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ * ++ * Convert text to .wav using svox text-to-speech system. ++ * ++ */ ++ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++ ++/* adaptation layer defines */ ++#define PICO_MEM_SIZE 2500000 ++#define DummyLen 100000000 ++ ++/* string constants */ ++#define MAX_OUTBUF_SIZE 128 ++const char * PICO_LINGWARE_PATH = "./lang/"; ++const char * PICO_VOICE_NAME = "PicoVoice"; ++ ++/* supported voices ++ Pico does not separately specify the voice and locale. */ ++const char * picoSupportedLangIso3[] = { "eng", "eng", "deu", "spa", "fra", "ita" }; ++const char * picoSupportedCountryIso3[] = { "USA", "GBR", "DEU", "ESP", "FRA", "ITA" }; ++const char * picoSupportedLang[] = { "en-US", "en-GB", "de-DE", "es-ES", "fr-FR", "it-IT" }; ++const char * picoInternalLang[] = { "en-US", "en-GB", "de-DE", "es-ES", "fr-FR", "it-IT" }; ++const char * picoInternalTaLingware[] = { "en-US_ta.bin", "en-GB_ta.bin", "de-DE_ta.bin", "es-ES_ta.bin", "fr-FR_ta.bin", "it-IT_ta.bin" }; ++const char * picoInternalSgLingware[] = { "en-US_lh0_sg.bin", "en-GB_kh0_sg.bin", "de-DE_gl0_sg.bin", "es-ES_zl0_sg.bin", "fr-FR_nk0_sg.bin", "it-IT_cm0_sg.bin" }; ++const char * picoInternalUtppLingware[] = { "en-US_utpp.bin", "en-GB_utpp.bin", "de-DE_utpp.bin", "es-ES_utpp.bin", "fr-FR_utpp.bin", "it-IT_utpp.bin" }; ++const int picoNumSupportedVocs = 6; ++ ++/* adapation layer global variables */ ++void * picoMemArea = NULL; ++pico_System picoSystem = NULL; ++pico_Resource picoTaResource = NULL; ++pico_Resource picoSgResource = NULL; ++pico_Resource picoUtppResource = NULL; ++pico_Engine picoEngine = NULL; ++pico_Char * picoTaFileName = NULL; ++pico_Char * picoSgFileName = NULL; ++pico_Char * picoUtppFileName = NULL; ++pico_Char * picoTaResourceName = NULL; ++pico_Char * picoSgResourceName = NULL; ++pico_Char * picoUtppResourceName = NULL; ++int picoSynthAbort = 0; ++ ++ ++int main(int argc, const char *argv[]) { ++ char * wavefile = NULL; ++ char * lang = "en-US"; ++ int langIndex = -1, langIndexTmp = -1; ++ char * text; ++ int8_t * buffer; ++ size_t bufferSize = 256; ++ ++ /* Parsing options */ ++ poptContext optCon; /* context for parsing command-line options */ ++ int opt; /* used for argument parsing */ ++ ++ struct poptOption optionsTable[] = { ++ { "wave", 'w', POPT_ARG_STRING, &wavefile, 0, ++ "Write output to this WAV file (extension SHOULD be .wav)", "filename.wav" }, ++ { "lang", 'l', POPT_ARG_STRING | POPT_ARGFLAG_SHOW_DEFAULT, &lang, 0, ++ "Language", "lang" }, ++ POPT_AUTOHELP ++ POPT_TABLEEND ++ }; ++ optCon = poptGetContext(NULL, argc, argv, optionsTable, POPT_CONTEXT_POSIXMEHARDER); ++ poptSetOtherOptionHelp(optCon, ""); ++ ++ /* Reporting about invalid extra options */ ++ while ((opt = poptGetNextOpt(optCon)) != -1) { ++ switch (opt) { ++ default: ++ fprintf(stderr, "Invalid option %s: %s\n", ++ poptBadOption(optCon, 0), poptStrerror(opt)); ++ poptPrintHelp(optCon, stderr, 0); ++ exit(1); ++ } ++ } ++ ++ /* Mandatory option: --wave */ ++ if(!wavefile) { ++ fprintf(stderr, "Mandatory option: %s\n\n", ++ "--wave=filename.wav"); ++ poptPrintHelp(optCon, stderr, 0); ++ exit(1); ++ } ++ /* option: --lang */ ++ for(langIndexTmp =0; langIndexTmp */ ++ const char **extra_argv; ++ extra_argv = poptGetArgs(optCon); ++ if(extra_argv) { ++ text = (char *) &(*extra_argv)[0]; ++ } else { ++ //TODO: stdin not supported yet. ++ fprintf(stderr, "Missing argument: %s\n\n", ++ ""); ++ poptPrintHelp(optCon, stderr, 0); ++ exit(1); ++ } ++ ++ poptFreeContext(optCon); ++ ++ buffer = malloc( bufferSize ); ++ ++ int ret, getstatus; ++ pico_Char * inp = NULL; ++ pico_Char * local_text = NULL; ++ short outbuf[MAX_OUTBUF_SIZE/2]; ++ pico_Int16 bytes_sent, bytes_recv, text_remaining, out_data_type; ++ pico_Retstring outMessage; ++ ++ picoSynthAbort = 0; ++ ++ picoMemArea = malloc( PICO_MEM_SIZE ); ++ if((ret = pico_initialize( picoMemArea, PICO_MEM_SIZE, &picoSystem ))) { ++ pico_getSystemStatusMessage(picoSystem, ret, outMessage); ++ fprintf(stderr, "Cannot initialize pico (%i): %s\n", ret, outMessage); ++ goto terminate; ++ } ++ ++ /* Load the text analysis Lingware resource file. */ ++ picoTaFileName = (pico_Char *) malloc( PICO_MAX_DATAPATH_NAME_SIZE + PICO_MAX_FILE_NAME_SIZE ); ++ strcpy((char *) picoTaFileName, PICO_LINGWARE_PATH); ++ strcat((char *) picoTaFileName, (const char *) picoInternalTaLingware[langIndex]); ++ if((ret = pico_loadResource( picoSystem, picoTaFileName, &picoTaResource ))) { ++ pico_getSystemStatusMessage(picoSystem, ret, outMessage); ++ fprintf(stderr, "Cannot load text analysis resource file (%i): %s\n", ret, outMessage); ++ goto unloadTaResource; ++ } ++ ++ /* Load the signal generation Lingware resource file. */ ++ picoSgFileName = (pico_Char *) malloc( PICO_MAX_DATAPATH_NAME_SIZE + PICO_MAX_FILE_NAME_SIZE ); ++ strcpy((char *) picoSgFileName, PICO_LINGWARE_PATH); ++ strcat((char *) picoSgFileName, (const char *) picoInternalSgLingware[langIndex]); ++ if((ret = pico_loadResource( picoSystem, picoSgFileName, &picoSgResource ))) { ++ pico_getSystemStatusMessage(picoSystem, ret, outMessage); ++ fprintf(stderr, "Cannot load signal generation Lingware resource file (%i): %s\n", ret, outMessage); ++ goto unloadSgResource; ++ } ++ ++ /* Load the utpp Lingware resource file if exists - NOTE: this file is optional ++ and is currently not used. Loading is only attempted for future compatibility. ++ If this file is not present the loading will still succeed. // ++ picoUtppFileName = (pico_Char *) malloc( PICO_MAX_DATAPATH_NAME_SIZE + PICO_MAX_FILE_NAME_SIZE ); ++ strcpy((char *) picoUtppFileName, PICO_LINGWARE_PATH); ++ strcat((char *) picoUtppFileName, (const char *) picoInternalUtppLingware[langIndex]); ++ ret = pico_loadResource( picoSystem, picoUtppFileName, &picoUtppResource ); ++ pico_getSystemStatusMessage(picoSystem, ret, outMessage); ++ printf("pico_loadResource: %i: %s\n", ret, outMessage); ++ */ ++ ++ /* Get the text analysis resource name. */ ++ picoTaResourceName = (pico_Char *) malloc( PICO_MAX_RESOURCE_NAME_SIZE ); ++ if((ret = pico_getResourceName( picoSystem, picoTaResource, (char *) picoTaResourceName ))) { ++ pico_getSystemStatusMessage(picoSystem, ret, outMessage); ++ fprintf(stderr, "Cannot get the text analysis resource name (%i): %s\n", ret, outMessage); ++ goto unloadUtppResource; ++ } ++ ++ /* Get the signal generation resource name. */ ++ picoSgResourceName = (pico_Char *) malloc( PICO_MAX_RESOURCE_NAME_SIZE ); ++ if((ret = pico_getResourceName( picoSystem, picoSgResource, (char *) picoSgResourceName ))) { ++ pico_getSystemStatusMessage(picoSystem, ret, outMessage); ++ fprintf(stderr, "Cannot get the signal generation resource name (%i): %s\n", ret, outMessage); ++ goto unloadUtppResource; ++ } ++ ++ ++ /* Create a voice definition. */ ++ if((ret = pico_createVoiceDefinition( picoSystem, (const pico_Char *) PICO_VOICE_NAME ))) { ++ pico_getSystemStatusMessage(picoSystem, ret, outMessage); ++ fprintf(stderr, "Cannot create voice definition (%i): %s\n", ret, outMessage); ++ goto unloadUtppResource; ++ } ++ ++ /* Add the text analysis resource to the voice. */ ++ if((ret = pico_addResourceToVoiceDefinition( picoSystem, (const pico_Char *) PICO_VOICE_NAME, picoTaResourceName ))) { ++ pico_getSystemStatusMessage(picoSystem, ret, outMessage); ++ fprintf(stderr, "Cannot add the text analysis resource to the voice (%i): %s\n", ret, outMessage); ++ goto unloadUtppResource; ++ } ++ ++ /* Add the signal generation resource to the voice. */ ++ if((ret = pico_addResourceToVoiceDefinition( picoSystem, (const pico_Char *) PICO_VOICE_NAME, picoSgResourceName ))) { ++ pico_getSystemStatusMessage(picoSystem, ret, outMessage); ++ fprintf(stderr, "Cannot add the signal generation resource to the voice (%i): %s\n", ret, outMessage); ++ goto unloadUtppResource; ++ } ++ ++ /* Create a new Pico engine. */ ++ if((ret = pico_newEngine( picoSystem, (const pico_Char *) PICO_VOICE_NAME, &picoEngine ))) { ++ pico_getSystemStatusMessage(picoSystem, ret, outMessage); ++ fprintf(stderr, "Cannot create a new pico engine (%i): %s\n", ret, outMessage); ++ goto disposeEngine; ++ } ++ ++ local_text = (pico_Char *) text ; ++ text_remaining = strlen((const char *) local_text) + 1; ++ ++ inp = (pico_Char *) local_text; ++ ++ size_t bufused = 0; ++ ++ picoos_Common common = (picoos_Common) pico_sysGetCommon(picoSystem); ++ ++ picoos_SDFile sdOutFile = NULL; ++ ++ picoos_bool done = TRUE; ++ if(TRUE != (done = picoos_sdfOpenOut(common, &sdOutFile, ++ (picoos_char *) wavefile, SAMPLE_FREQ_16KHZ, PICOOS_ENC_LIN))) ++ { ++ fprintf(stderr, "Cannot open output wave file\n"); ++ ret = 1; ++ goto disposeEngine; ++ } ++ ++ /* synthesis loop */ ++ while (text_remaining) { ++ /* Feed the text into the engine. */ ++ if((ret = pico_putTextUtf8( picoEngine, inp, text_remaining, &bytes_sent ))) { ++ pico_getSystemStatusMessage(picoSystem, ret, outMessage); ++ fprintf(stderr, "Cannot put Text (%i): %s\n", ret, outMessage); ++ goto disposeEngine; ++ } ++ ++ text_remaining -= bytes_sent; ++ inp += bytes_sent; ++ ++ do { ++ if (picoSynthAbort) { ++ goto disposeEngine; ++ } ++ /* Retrieve the samples and add them to the buffer. */ ++ getstatus = pico_getData( picoEngine, (void *) outbuf, ++ MAX_OUTBUF_SIZE, &bytes_recv, &out_data_type ); ++ if((getstatus !=PICO_STEP_BUSY) && (getstatus !=PICO_STEP_IDLE)){ ++ pico_getSystemStatusMessage(picoSystem, getstatus, outMessage); ++ fprintf(stderr, "Cannot get Data (%i): %s\n", getstatus, outMessage); ++ goto disposeEngine; ++ } ++ if (bytes_recv) { ++ if ((bufused + bytes_recv) <= bufferSize) { ++ memcpy(buffer+bufused, (int8_t *) outbuf, bytes_recv); ++ bufused += bytes_recv; ++ } else { ++ done = picoos_sdfPutSamples( ++ sdOutFile, ++ bufused / 2, ++ (picoos_int16*) (buffer)); ++ bufused = 0; ++ memcpy(buffer, (int8_t *) outbuf, bytes_recv); ++ bufused += bytes_recv; ++ } ++ } ++ } while (PICO_STEP_BUSY == getstatus); ++ /* This chunk of synthesis is finished; pass the remaining samples. */ ++ if (!picoSynthAbort) { ++ done = picoos_sdfPutSamples( ++ sdOutFile, ++ bufused / 2, ++ (picoos_int16*) (buffer)); ++ } ++ picoSynthAbort = 0; ++ } ++ ++ if(TRUE != (done = picoos_sdfCloseOut(common, &sdOutFile))) ++ { ++ fprintf(stderr, "Cannot close output wave file\n"); ++ ret = 1; ++ goto disposeEngine; ++ } ++ ++disposeEngine: ++ if (picoEngine) { ++ pico_disposeEngine( picoSystem, &picoEngine ); ++ pico_releaseVoiceDefinition( picoSystem, (pico_Char *) PICO_VOICE_NAME ); ++ picoEngine = NULL; ++ } ++unloadUtppResource: ++ if (picoUtppResource) { ++ pico_unloadResource( picoSystem, &picoUtppResource ); ++ picoUtppResource = NULL; ++ } ++unloadSgResource: ++ if (picoSgResource) { ++ pico_unloadResource( picoSystem, &picoSgResource ); ++ picoSgResource = NULL; ++ } ++unloadTaResource: ++ if (picoTaResource) { ++ pico_unloadResource( picoSystem, &picoTaResource ); ++ picoTaResource = NULL; ++ } ++terminate: ++ if (picoSystem) { ++ pico_terminate(&picoSystem); ++ picoSystem = NULL; ++ } ++ exit(ret); ++} ++ +diff --git a/pico/configure.in b/pico/configure.in +index 0afb56d..349eb1d 100644 +--- a/pico/configure.in ++++ b/pico/configure.in +@@ -14,3 +14,6 @@ AC_CONFIG_FILES([Makefile]) + AC_OUTPUT + + AC_CONFIG_MACRO_DIR([m4]) ++ ++AC_CHECK_LIB(popt, poptGetContext) ++ +-- +1.7.1 + diff --git a/sound/svox/patches/0004-add-header-files.patch b/sound/svox/patches/0004-add-header-files.patch new file mode 100644 index 0000000..f057308 --- /dev/null +++ b/sound/svox/patches/0004-add-header-files.patch @@ -0,0 +1,59 @@ +From 0866cb3f7cfe4b8bae1edc8d0dbf18c85e9ca74f Mon Sep 17 00:00:00 2001 +From: Mathieu Parent +Date: Tue, 27 Oct 2009 18:29:45 +0100 +Subject: [PATCH 4/7] add header files + +--- + pico/Makefile.am | 36 ++++++++++++++++++++++++++++++++++++ + 1 files changed, 36 insertions(+), 0 deletions(-) + +diff --git a/pico/Makefile.am b/pico/Makefile.am +index 0d9472d..9151042 100644 +--- a/pico/Makefile.am ++++ b/pico/Makefile.am +@@ -34,6 +34,42 @@ libttspico_la_SOURCES = \ + lib/picotrns.c \ + lib/picowa.c + ++libttspico_ladir = $(includedir) ++libttspico_la_HEADERS = \ ++ lib/picoacph.h \ ++ lib/picoapid.h \ ++ lib/picoapi.h \ ++ lib/picobase.h \ ++ lib/picocep.h \ ++ lib/picoctrl.h \ ++ lib/picodata.h \ ++ lib/picodbg.h \ ++ lib/picodefs.h \ ++ lib/picodsp.h \ ++ lib/picoextapi.h \ ++ lib/picofftsg.h \ ++ lib/picokdbg.h \ ++ lib/picokdt.h \ ++ lib/picokfst.h \ ++ lib/picoklex.h \ ++ lib/picoknow.h \ ++ lib/picokpdf.h \ ++ lib/picokpr.h \ ++ lib/picoktab.h \ ++ lib/picoos.h \ ++ lib/picopal.h \ ++ lib/picopam.h \ ++ lib/picopltf.h \ ++ lib/picopr.h \ ++ lib/picorsrc.h \ ++ lib/picosa.h \ ++ lib/picosig2.h \ ++ lib/picosig.h \ ++ lib/picospho.h \ ++ lib/picotok.h \ ++ lib/picotrns.h \ ++ lib/picowa.h ++ + bin_PROGRAMS = pico2wave + pico2wave_SOURCES = \ + bin/pico2wave.c +-- +1.7.1 + diff --git a/sound/svox/patches/0005-Install-lang-files.patch b/sound/svox/patches/0005-Install-lang-files.patch new file mode 100644 index 0000000..95344e3 --- /dev/null +++ b/sound/svox/patches/0005-Install-lang-files.patch @@ -0,0 +1,32 @@ +From 486b9f924bdf38f5f213feed2631060b44024c11 Mon Sep 17 00:00:00 2001 +From: Mathieu Parent +Date: Tue, 27 Oct 2009 23:06:46 +0100 +Subject: [PATCH 5/7] Install lang files + +--- + pico/Makefile.am | 9 +++++++++ + 1 files changed, 9 insertions(+), 0 deletions(-) + +diff --git a/pico/Makefile.am b/pico/Makefile.am +index 9151042..8898050 100644 +--- a/pico/Makefile.am ++++ b/pico/Makefile.am +@@ -70,6 +70,15 @@ libttspico_la_HEADERS = \ + lib/picotrns.h \ + lib/picowa.h + ++picolangdir = $(datadir)/pico/lang ++picolang_DATA = \ ++ lang/de-DE*.bin \ ++ lang/en-GB*.bin \ ++ lang/en-US*.bin \ ++ lang/es-ES*.bin \ ++ lang/fr-FR*.bin \ ++ lang/it-IT*.bin ++ + bin_PROGRAMS = pico2wave + pico2wave_SOURCES = \ + bin/pico2wave.c +-- +1.7.1 + diff --git a/sound/svox/patches/0006-Set-picolangdir.patch b/sound/svox/patches/0006-Set-picolangdir.patch new file mode 100644 index 0000000..1ec646d --- /dev/null +++ b/sound/svox/patches/0006-Set-picolangdir.patch @@ -0,0 +1,40 @@ +From 0102d423b79de7af982c8d4619d816f95a9b9278 Mon Sep 17 00:00:00 2001 +From: Mathieu Parent +Date: Thu, 29 Oct 2009 23:55:19 +0100 +Subject: [PATCH 6/7] Set picolangdir + +--- + pico/Makefile.am | 2 +- + pico/bin/pico2wave.c | 4 ++++ + 2 files changed, 5 insertions(+), 1 deletions(-) + +diff --git a/pico/Makefile.am b/pico/Makefile.am +index 8898050..a19c42a 100644 +--- a/pico/Makefile.am ++++ b/pico/Makefile.am +@@ -84,5 +84,5 @@ pico2wave_SOURCES = \ + bin/pico2wave.c + pico2wave_LDADD = \ + libttspico.la -lm -lpopt +-pico2wave_CFLAGS = -Wall -I lib ++pico2wave_CFLAGS = -Wall -Dpicolangdir=\"$(picolangdir)\" -I lib + +diff --git a/pico/bin/pico2wave.c b/pico/bin/pico2wave.c +index 0c035a7..ec7ab79 100644 +--- a/pico/bin/pico2wave.c ++++ b/pico/bin/pico2wave.c +@@ -35,7 +35,11 @@ + + /* string constants */ + #define MAX_OUTBUF_SIZE 128 ++#ifdef picolangdir ++const char * PICO_LINGWARE_PATH = picolangdir "/"; ++#else + const char * PICO_LINGWARE_PATH = "./lang/"; ++#endif + const char * PICO_VOICE_NAME = "PicoVoice"; + + /* supported voices +-- +1.7.1 + diff --git a/sound/svox/patches/0008-64bits.patch b/sound/svox/patches/0008-64bits.patch new file mode 100644 index 0000000..883a42e --- /dev/null +++ b/sound/svox/patches/0008-64bits.patch @@ -0,0 +1,26 @@ +Description: fix execution on 64bit archs +Bug: http://code.google.com/p/android/issues/detail?id=12224 +Author: Samuel Thibault + +--- svox/pico/lib/picoapi.c.original 2010-10-25 19:06:57.000000000 +0200 ++++ svox/pico/lib/picoapi.c 2010-10-25 19:07:18.000000000 +0200 +@@ -90,7 +90,7 @@ + status = PICO_ERR_NULLPTR_ACCESS; + } else { + byte_ptr_t rest_mem; +- picoos_uint32 rest_mem_size; ++ picoos_objsize_t rest_mem_size; + pico_System sys; + picoos_MemoryManager sysMM; + picoos_ExceptionManager sysEM; +--- svox/pico/lib/picosig2.c.original 2010-10-26 00:17:18.000000000 +0200 ++++ svox/pico/lib/picosig2.c 2010-10-26 00:17:19.000000000 +0200 +@@ -568,7 +568,7 @@ + for (nI = 1; nI < m1; nI++) { + XXr[nI] = c1[nI] << shift; + } +- i = sizeof(picoos_int32) * (PICODSP_FFTSIZE + 1 - m1); ++ i = sizeof(picoos_int32) * (PICODSP_FFTSIZE - m1); + picoos_mem_set(XXr + m1, 0, i); + dfct_nmf(m4, XXr); /* DFCT directly in fixed point */ + diff --git a/sound/svox/patches/0009-Fix-link-order.patch b/sound/svox/patches/0009-Fix-link-order.patch new file mode 100644 index 0000000..bcf3870 --- /dev/null +++ b/sound/svox/patches/0009-Fix-link-order.patch @@ -0,0 +1,21 @@ +Index: svox-1.0+git20130326/pico/Makefile.am +=================================================================== +--- svox-1.0+git20130326.orig/pico/Makefile.am 2013-11-12 12:37:05.939979854 -0500 ++++ svox-1.0+git20130326/pico/Makefile.am 2013-11-12 13:00:52.336945041 -0500 +@@ -70,6 +70,8 @@ + lib/picotrns.h \ + lib/picowa.h + ++libttspico_la_LIBADD = -lm ++ + picolangdir = $(datadir)/pico/lang + picolang_DATA = \ + lang/de-DE*.bin \ +@@ -83,6 +85,6 @@ + pico2wave_SOURCES = \ + bin/pico2wave.c + pico2wave_LDADD = \ +- libttspico.la -lm -lpopt ++ libttspico.la -lpopt + pico2wave_CFLAGS = -Wall -Dpicolangdir=\"$(picolangdir)\" -I lib + diff --git a/sound/svox/patches/0010-platform.patch b/sound/svox/patches/0010-platform.patch new file mode 100644 index 0000000..ff76f75 --- /dev/null +++ b/sound/svox/patches/0010-platform.patch @@ -0,0 +1,30 @@ +--- a/pico/lib/picopltf.h ++++ b/pico/lib/picopltf.h +@@ -39,6 +39,8 @@ + #define PICO_MacOSX 5 /* Macintosh OS X */ + #define PICO_Linux 7 /* Linux */ + ++#define PICO_GENERIC 99 /* Generic */ ++ + /* * definition of current platform ***/ + #if !defined(PICO_PLATFORM) + #if defined(_WIN32) +@@ -48,7 +50,7 @@ + #elif defined(linux) || defined(__linux__) || defined(__linux) + #define PICO_PLATFORM PICO_Linux + #else +-#error PICO_PLATFORM not defined ++#define PICO_PLATFORM PICO_GENERIC + #endif + #endif /* !defined(PICO_PLATFORM) */ + +@@ -64,7 +66,8 @@ + #define PICO_PLATFORM_STRING "UnknownPlatform" + #endif + +-#if (PICO_PLATFORM == PICO_MacOSX) ++#include ++#if __BYTE_ORDER == __BIG_ENDIAN + #define PICO_ENDIANNESS ENDIANNESS_BIG + #else + #define PICO_ENDIANNESS ENDIANNESS_LITTLE diff --git a/sound/svox/patches/0011-subdir.patch b/sound/svox/patches/0011-subdir.patch new file mode 100644 index 0000000..fa9e91f --- /dev/null +++ b/sound/svox/patches/0011-subdir.patch @@ -0,0 +1,12 @@ +diff -urN a/pico/configure.in b/pico/configure.in +--- a/pico/configure.in 2015-01-21 18:59:39.604452795 +0100 ++++ b/pico/configure.in 2015-01-21 19:00:53.288777298 +0100 +@@ -4,7 +4,7 @@ + + AC_INIT([svox], [1.0], [math.parent@gmail.com]) + +-AM_INIT_AUTOMAKE([1.9 foreign]) ++AM_INIT_AUTOMAKE([1.9 foreign subdir-objects]) + + AC_PROG_CC + LT_INIT diff --git a/sound/svox/patches/0012-no-headers.patch b/sound/svox/patches/0012-no-headers.patch new file mode 100644 index 0000000..edf4d04 --- /dev/null +++ b/sound/svox/patches/0012-no-headers.patch @@ -0,0 +1,46 @@ +diff -urN a/pico/Makefile.am b/pico/Makefile.am +--- a/pico/Makefile.am 2015-01-22 01:33:21.470895431 +0100 ++++ b/pico/Makefile.am 2015-01-22 01:36:03.042228475 +0100 +@@ -34,42 +34,6 @@ + lib/picotrns.c \ + lib/picowa.c + +-libttspico_ladir = $(includedir) +-libttspico_la_HEADERS = \ +- lib/picoacph.h \ +- lib/picoapid.h \ +- lib/picoapi.h \ +- lib/picobase.h \ +- lib/picocep.h \ +- lib/picoctrl.h \ +- lib/picodata.h \ +- lib/picodbg.h \ +- lib/picodefs.h \ +- lib/picodsp.h \ +- lib/picoextapi.h \ +- lib/picofftsg.h \ +- lib/picokdbg.h \ +- lib/picokdt.h \ +- lib/picokfst.h \ +- lib/picoklex.h \ +- lib/picoknow.h \ +- lib/picokpdf.h \ +- lib/picokpr.h \ +- lib/picoktab.h \ +- lib/picoos.h \ +- lib/picopal.h \ +- lib/picopam.h \ +- lib/picopltf.h \ +- lib/picopr.h \ +- lib/picorsrc.h \ +- lib/picosa.h \ +- lib/picosig2.h \ +- lib/picosig.h \ +- lib/picospho.h \ +- lib/picotok.h \ +- lib/picotrns.h \ +- lib/picowa.h +- + libttspico_la_LIBADD = -lm + + picolangdir = $(datadir)/pico/lang diff --git a/sound/upmpdcli/Config.in b/sound/upmpdcli/Config.in new file mode 100644 index 0000000..fe32722 --- /dev/null +++ b/sound/upmpdcli/Config.in @@ -0,0 +1,17 @@ +config PACKAGE_UPMPDCLI_SCCTL + bool "scctl command for configuring SongCast receivers" + default no + depends on PACKAGE_upmpdcli + help + Installs the scctl command. See the following link for more info: + http://www.lesbonscomptes.com/upmpdcli/scmulti.html + +config PACKAGE_UPMPDCLI_SC_WEB_INTERFACE + bool "SongCast web server and associated files (depends on python)" + default no + depends on PACKAGE_upmpdcli + select PACKAGE_python + select PACKAGE_UPMPDCLI_SCCTL + help + Installs the SongCast web interface and web server. See the following + link for more info: http://www.lesbonscomptes.com/upmpdcli/scmulti.html diff --git a/sound/upmpdcli/Makefile b/sound/upmpdcli/Makefile new file mode 100644 index 0000000..27bbee8 --- /dev/null +++ b/sound/upmpdcli/Makefile @@ -0,0 +1,63 @@ +# +# Copyright (C) 2016 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:=upmpdcli +PKG_VERSION:=1.1.3 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.lesbonscomptes.com/upmpdcli/downloads +PKG_MD5SUM:=de9f232d6d5f746ec81ec239e11bdda4 +PKG_MAINTAINER:=Petko Bordjukov +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/upmpdcli + SECTION:=sound + CATEGORY:=Sound + URL:=http://www.lesbonscomptes.com/upmpdcli + DEPENDS+= +libupnpp +libmpdclient + TITLE:=A UPnP front-end to MPD, the Music Player Daemon + USERID:=upmpdcli=89:upmpdcli=89 + MENU:=1 +endef + +define Package/upmpdcli/description +upmpdcli implements an UPnP Media Renderer, using MPD to perform the real work. +endef + +define Package/upmpdcli/config + source "$(SOURCE)/Config.in" +endef + +define Package/upmpdcli/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/upmpdcli.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/upmpdcli.config $(1)/etc/config/upmpdcli + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/upmpdcli $(1)/usr/bin/ +ifeq ($(CONFIG_PACKAGE_UPMPDCLI_SCCTL),y) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scctl $(1)/usr/bin/ +endif + $(INSTALL_DIR) $(1)/usr/share/upmpdcli +ifneq ($(CONFIG_PACKAGE_UPMPDCLI_SC_WEB_INTERFACE),y) + $(RM) -rf $(PKG_INSTALL_DIR)/usr/share/upmpdcli/web +endif + $(CP) $(PKG_INSTALL_DIR)/usr/share/upmpdcli $(1)/usr/share/ + $(INSTALL_DATA) ./files/upmpdcli.png $(1)/usr/share/upmpdcli/icon.png + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/upmpdcli.init $(1)/etc/init.d/upmpdcli +endef + +$(eval $(call BuildPackage,upmpdcli)) diff --git a/sound/upmpdcli/files/upmpdcli.config b/sound/upmpdcli/files/upmpdcli.config new file mode 100644 index 0000000..56b0ba3 --- /dev/null +++ b/sound/upmpdcli/files/upmpdcli.config @@ -0,0 +1,15 @@ +config upmpdcli lan + option interface 'br-lan' +# option friendly_name 'upmpdcli' +# option mpd_host '127.0.0.1' +# option mpd_port '6600' +# option upmpd_port '0' +# option config '/etc/upmpdcli.conf' + +# Add additional interfaces +# +#config upmpdcli wifi +# option interface 'wlan0' + +#config upmpdcli wan +# option interface 'eth0' diff --git a/sound/upmpdcli/files/upmpdcli.init b/sound/upmpdcli/files/upmpdcli.init new file mode 100644 index 0000000..6c69209 --- /dev/null +++ b/sound/upmpdcli/files/upmpdcli.init @@ -0,0 +1,51 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014 OpenWrt.org + +NAME=upmpdcli +START=95 + +UPMPD_BIN=/usr/bin/${NAME} + +USE_PROCD=1 + +append_arg() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}" +} + +start_instance() { + local cfg="$1" + local interface + + procd_open_instance + + procd_set_param command "${UPMPD_BIN}" + +# config_get interface "$cfg" interface +# procd_add_reload_interface_trigger $interface + + append_arg "$cfg" interface "-i" + append_arg "$cfg" mpd_host "-h" + append_arg "$cfg" mpd_port "-p" + append_arg "$cfg" upmpd_port "-P" + + append_arg "$cfg" config "-c" + append_arg "$cfg" friendly_name "-f" + + procd_close_instance +} + +service_triggers() { + procd_add_reload_trigger "${NAME}" +} + +start_service() { + config_load ${NAME} + config_foreach start_instance ${NAME} +} diff --git a/sound/upmpdcli/files/upmpdcli.png b/sound/upmpdcli/files/upmpdcli.png new file mode 100644 index 0000000000000000000000000000000000000000..ba50c644635a16c0e6de170ca53052f7928cd3d4 GIT binary patch literal 1640 zcmV-u2ABDXP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyk& z6%#vq2&+N>00rntL_t(|+U=XkZyZGw#(zCC-s0G?J@(kfVO7|{k%+}2-~dR#0XVV+ zi5o&ff(w5H+&BjbiCZMZasUAWu}I+%ViLp}Ls*g+5**tzwqrZvS(?LqEtiUJPft&e z2aV@RE!)+tuBxxT_uf~p+K%hG>|{%@!>tWK8-O+dZ2;N;>|{%Yd1z{CDz5(a16Keg z{p|oh0e>`Na?{h(@c4q_y))VUBJFp z1K=9qQG@p8>i-B_6f0&lj&T9e5&(1nk1N0xt$PmegYoyQ+V%j0b@b`z`dAaH{M zoE;N#z?{)`4k&2y0}=b{2c86;Zio=7(Ix~yDWJc9ba{3WSXLH@0>CKnJa8Sb2z;oY zO<{loJRv$41NzHaL2(&aQCb{|(C3PN7Jy!0s+lfuFL0|5^*t*A7p%5*T|@+64LB|U zQ^57j0$>by%#gW$>?i`~t@cX>0DTerKCX8ZwbvML1^|x$!vWMc88C0P6}5`Ub)t;v zoUxb40GBli07o=4FM!*CJ1w;r1i(T-JHW1xV@k;1Ju6FFc;nfpj1y}X7*K9cTM@o& zAnsNHucV-7+p?H2q=6T!ME!^L>>I$6+JDyqB!H{rPPsS%xEr`HAixy^(w+@KF5tOU z0a@*kq7QgkAb4u?gnpmbH45yNJLTeXff3*y4K(j_m1=OgJptf&_Xnz^ygv=Ft~Ks0 zD#a$Wu;X#YfGahyavedkBv*M(%FSkwtMT+ydCxH;qugS!xS;sr0WcCL0GG$48VkUU z@?osiD}{(70Dp<33cLior~r(?ka;7BXDm@wZUh6mqHHw-%+&zLsyvrh z+$jnya{=a!mELV_tjZc|B2EC}K0{ARHEv}&`Mcx8z@V71Yy@gIP5_!^MT6>2h?vo^ zijWiY#QgRIezr?1xo)lKpuq@pY`wKEYS@SKF}i^#iO+|~Jf4`Dv*huB04PhG;j@`? z;sjtZM%pFht1}^<%?bFEmIxcudy0w^o^@2&b41`}uEWxL;$*R>?L6D(8tOfNl%O2{ELk)n9Fd5_HvR z(O9ij;2lvn5h4zx1KPdKj2qIG)+}u?DS#Z{RF%buT?(H9J~r}jEqj2JSmd!RO3|es zxLUt2S+22ddx1}>eDBk_1$$CHyTERv3Y3f3_w9-!DG8%9%>ZB>cw4TJ+=2lkK9Rjg z%*jURHzE3aU!a_tqqg6Dih2Drel zz-vUPTQ;g7G7G#L(1%NL2(24r4<2Kq4F(Y&SFA=%5nO$M*g2^MF603mUo!Vdc7A1 zywY_y@HLwsNo=ca*T>RFrPK~e_L?6{p9Q|4Nw%F|i+@Jt=*s?F{@bv{i$<8!{=dN; mZfyYC0JH&U1JDLwC)>XXn|!C3HjwuK0000 + +PKG_LICENSE:=LGPL-2.1 GPL-2.0 +PKG_LICENSE_FILES:=doc/COPYING doc/COPYING.LGPL + +PKG_INSTALL:=1 +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/acl/Default + TITLE:=Access control list (ACL) manipulation + URL:=http://savannah.nongnu.org/projects/acl + SUBMENU:=Filesystem +endef + +define Package/acl/Default/description + Access control list support +endef + +define Package/acl +$(call Package/acl/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE+=utils + DEPENDS:=+libacl +endef + +define Package/libacl +$(call Package/acl/Default) + SECTION:=libs + CATEGORY:=Libraries + TITLE+=library + DEPENDS:=+libattr +endef + +define Package/libacl/description +$(call Package/acl/Default/description) + This package provides libacl +endef + +define Package/acl/description +$(call Package/acl/Default/description) + This package provides ACL manipulation utilities + - chacl + - getfacl + - setfacl +endef + +CONFIGURE_ARGS += --enable-static --enable-shared + +define Package/acl/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ +endef + +define Package/libacl/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/ +endef + +define Build/InstallDev + mkdir -p $(1)/usr/include + mkdir -p $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/{include,lib} $(1)/usr/ +endef + +$(eval $(call BuildPackage,acl)) +$(eval $(call BuildPackage,libacl)) diff --git a/utils/acl/patches/100-no-gettext_configure.patch b/utils/acl/patches/100-no-gettext_configure.patch new file mode 100644 index 0000000..676e32c --- /dev/null +++ b/utils/acl/patches/100-no-gettext_configure.patch @@ -0,0 +1,21 @@ +diff --git a/configure.ac b/configure.ac +index cd3c680..3d3771b 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -32,9 +32,6 @@ AC_FUNC_GCC_VISIBILITY + AM_PROG_AR + LT_INIT + +-AM_GNU_GETTEXT_VERSION([0.18.2]) +-AM_GNU_GETTEXT([external]) +- + AC_ARG_ENABLE([debug], + [AS_HELP_STRING([--enable-debug], [Enable extra debugging])]) + AS_IF([test "x$enable_debug" = "xyes"], +@@ -61,6 +58,5 @@ AC_CONFIG_COMMANDS([include/sys], + AC_CONFIG_FILES([ + libacl.pc + Makefile +- po/Makefile.in + ]) + AC_OUTPUT diff --git a/utils/acl/patches/101-no-gettext_autogen.patch b/utils/acl/patches/101-no-gettext_autogen.patch new file mode 100644 index 0000000..1fad67a --- /dev/null +++ b/utils/acl/patches/101-no-gettext_autogen.patch @@ -0,0 +1,9 @@ +diff --git a/autogen.sh b/autogen.sh +index a98a3c5..982aff1 100755 +--- a/autogen.sh ++++ b/autogen.sh +@@ -1,4 +1,2 @@ + #!/bin/sh -ex +-po/update-potfiles +-autopoint --force + exec autoreconf -f -i diff --git a/utils/acl/patches/102-no-gettext_Makefile.patch b/utils/acl/patches/102-no-gettext_Makefile.patch new file mode 100644 index 0000000..d7e7377 --- /dev/null +++ b/utils/acl/patches/102-no-gettext_Makefile.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.am b/Makefile.am +index 47d2a4e..d02ee91 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -3,8 +3,6 @@ ACLOCAL_AMFLAGS = -I m4 + EXTRA_DIST = \ + exports + +-SUBDIRS = po +- + AM_CPPFLAGS = \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ diff --git a/utils/acpid/Makefile b/utils/acpid/Makefile new file mode 100644 index 0000000..f1d1d9c --- /dev/null +++ b/utils/acpid/Makefile @@ -0,0 +1,68 @@ +# +# Copyright (C) 2012-2015 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:=acpid +PKG_VERSION:=2.0.27 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@SF/acpid2 +PKG_MD5SUM:=e41bdf628e122edb4342fca432ea7db9 +PKG_MAINTAINER:=Thomas Heil +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +include $(INCLUDE_DIR)/package.mk + +define Package/acpid + SECTION:=utils + CATEGORY:=Utilities + TITLE:=The ACPI Daemon (acpid) With Netlink Support + URL:=http://tedfelix.com/linux/acpid-netlink.html + DEPENDS:=@(TARGET_x86||TARGET_x86_64) +kmod-input-evdev +endef + +define Package/acpid/description + The ACPI Daemon (acpid) With Netlink Support +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + CC="$(TARGET_CC)" \ + LD="$(TARGET_CC)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + all +endef + +define Package/acpid/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/acpid $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/acpi_listen $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/acpi/events + $(INSTALL_CONF) ./files/default $(1)/etc/acpi/events/default + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_CONF) ./files/acpid.init $(1)/etc/init.d/acpid + chmod 0750 $(1)/etc/init.d/acpid + $(INSTALL_DIR) $(1)/etc/hotplug.d/input/ + $(INSTALL_CONF) ./files/acpid.hotplug $(1)/etc/hotplug.d/input/ +endef + +define Package/acpid/postinst +#!/bin/sh +[ -n "$${IPKG_INSTROOT}" ] || { + echo "waiting for input devices to come up" + /etc/init.d/acpid enable + sleep 5 + /etc/init.d/acpid start + echo "please try the power button" + exit 0 +} +endef + +$(eval $(call BuildPackage,acpid)) diff --git a/utils/acpid/files/acpid.hotplug b/utils/acpid/files/acpid.hotplug new file mode 100644 index 0000000..6e08d01 --- /dev/null +++ b/utils/acpid/files/acpid.hotplug @@ -0,0 +1,7 @@ +#!/bin/sh + +. /lib/functions.sh + +if [ "$ACTION" = add ] && [ "$DEVICENAME" = event0 ]; then + ( /etc/init.d/acpid/stop; sleep 3; /usr/sbin/acpid )& +fi diff --git a/utils/acpid/files/acpid.init b/utils/acpid/files/acpid.init new file mode 100644 index 0000000..3365aa0 --- /dev/null +++ b/utils/acpid/files/acpid.init @@ -0,0 +1,25 @@ +#!/bin/ash /etc/rc.common +# Copyright (C) 2009-2010 OpenWrt.org + +START=99 +STOP=80 + +ACPID_BIN="/usr/sbin/acpid" +ACPID_PID="/var/run/acpid.pid" + +start() { + [ -x "$ACPID_BIN" ] || return 1 + start-stop-daemon -S -x $ACPID_BIN -p $ACPID_PID +} + +boot() { + # Do nothing on boot + [ -x "$ACPID_BIN" ] || return 1 + start-stop-daemon -S -x $ACPID_BIN -p $ACPID_PID + exit 0 +} + +stop() { + service_kill ${ACPID_BIN##*/} $ACPID_PID + rm -f $ACPID_PID +} diff --git a/utils/acpid/files/default b/utils/acpid/files/default new file mode 100644 index 0000000..cf8d9a3 --- /dev/null +++ b/utils/acpid/files/default @@ -0,0 +1,5 @@ +# This is a sample ACPID configuration + +event=button/power.* +action=/sbin/poweroff + diff --git a/utils/acpid/patches/002-dont-use-isfdtype.patch b/utils/acpid/patches/002-dont-use-isfdtype.patch new file mode 100644 index 0000000..cd4e062 --- /dev/null +++ b/utils/acpid/patches/002-dont-use-isfdtype.patch @@ -0,0 +1,21 @@ +Partially roll back upstream commit 4711119089e1ad08dad206f4fded68f1972fdeed +since released versions of uClibc don't support isfdtype(). + +Signed-off-by: Gustavo Zaarias + +Index: acpid-2.0.23/sock.c +=================================================================== +--- acpid-2.0.23.orig/sock.c ++++ acpid-2.0.23/sock.c +@@ -53,7 +53,10 @@ int non_root_clients; + int + is_socket(int fd) + { +- return (isfdtype(fd, S_IFSOCK) == 1); ++ int v; ++ socklen_t l = sizeof(int); ++ ++ return (getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&v, &l) == 0); + } + + /* accept a new client connection */ diff --git a/utils/ap51-flash/Makefile b/utils/ap51-flash/Makefile new file mode 100644 index 0000000..a30fa5d --- /dev/null +++ b/utils/ap51-flash/Makefile @@ -0,0 +1,58 @@ +# +# Copyright (C) 2010-2011 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:=ap51-flash +PKG_VERSION:=2016-10-16 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://dev.cloudtrax.com/ap51-flash.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=48b3fbac1c30c5968b2608eb09b53ea37c310a24 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz +PKG_MAINTAINER:=Russell Senior + +include $(INCLUDE_DIR)/package.mk + +ifeq ($(CONFIG_BIG_ENDIAN),y) + STAMP_BUILT:=$(STAMP_BUILT)_big +endif + +define Package/ap51-flash + SECTION:=utils + CATEGORY:=Utilities + TITLE:=A tool for flashing (nearly) all ap51/ap61 based routers + URL:=http://dev.cloudtrax.com/wiki/ap51-flash-station +endef + +TARGET_EXTRA_CFLAGS:=-DFLASH_FROM_FILE -DNO_LIBPCAP -D_GNU_SOURCE -DIPPORT_TFTP=69 +ifeq ($(CONFIG_BIG_ENDIAN),y) + TARGET_EXTRA_CFLAGS:=$(TARGET_EXTRA_CFLAGS) -DUIP_CONF_BYTE_ORDER=1234 +endif + +# pass optimization flags +MAKE_FLAGS += \ + OFLAGS="$(TARGET_CFLAGS)" \ + EXTRA_CFLAGS="$(TARGET_EXTRA_CFLAGS)" \ + REVISION="$(PKG_VERSION)" \ + ap51-flash + +define Package/ap51-flash/install + $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d $(1)/usr/sbin \ + $(1)/usr/lib/ap51-flash + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ap51-flash $(1)/usr/sbin/ + $(INSTALL_BIN) ./files/ap51-flash.init $(1)/etc/init.d/ap51-flash + $(INSTALL_BIN) ./files/ap51-flash.sh $(1)/usr/lib/ap51-flash/ap51-flash.sh + $(INSTALL_DATA) ./files/ap51-flash.config $(1)/etc/config/ap51-flash +endef + +define Package/ap51-flash/conffiles +/etc/config/ap51-flash +endef + +$(eval $(call BuildPackage,ap51-flash)) diff --git a/utils/ap51-flash/files/ap51-flash.config b/utils/ap51-flash/files/ap51-flash.config new file mode 100644 index 0000000..f66973f --- /dev/null +++ b/utils/ap51-flash/files/ap51-flash.config @@ -0,0 +1,6 @@ +#config flash +# option ifname eth0.1 +# option rootfs /tmp/images/openwrt-atheros-root.squashfs +# option kernel /tmp/images/openwrt-atheros-vmlinux.lzma +# option ubnt /tmp/images/openwrt-atheros-ubnt5-squashfs.bin +## option loop '1' diff --git a/utils/ap51-flash/files/ap51-flash.init b/utils/ap51-flash/files/ap51-flash.init new file mode 100644 index 0000000..1633ac4 --- /dev/null +++ b/utils/ap51-flash/files/ap51-flash.init @@ -0,0 +1,50 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2010 OpenWrt.org + +START=20 + +NAME=ap51-flash + +start_daemon() { + local cfg="$1" + + config_get_bool loop "$cfg" loop + config_get ifname "$cfg" ifname + config_get rootfs "$cfg" rootfs + config_get kernel "$cfg" kernel + config_get ubnt "$cfg" ubnt + [ "$loop" != "1" ] && loop=0 + if [ -n "$ifname" -a -n "$rootfs" -a -n "$kernel" ] || \ + [ -n "$ifname" -a -n "$ubnt" ]; then + PID="`cat /var/run/$NAME.sh-$ifname.pid 2> /dev/null`" + [ -z "`ps | grep "^.[ ]*$PID "`" ] && \ + rm /var/run/$NAME.sh-$ifname.pid + [ -n "`ls /var/run/$NAME.sh-$ifname.pid 2> /dev/null`" ] && { + echo "Can't start more than one ap51-flash for interface $ifname!" + return 0 + } + start-stop-daemon -S -b -m -p /var/run/$NAME.sh-$ifname.pid -n $NAME.sh \ + -x /usr/lib/ap51-flash/$NAME.sh -- "$loop" "$ifname" "$rootfs" "$kernel" "$ubnt" + fi +} + +start() { + config_load ap51-flash + config_foreach start_daemon flash +} + +stop() { + # Terminating all ap51-flash processes + echo "WARNING: Going to teminate all ap51-flash processes! (hope you made sure that they're not flashing right now)" + echo "OR you can stop this with Ctrl+c within 10 seconds" + sleep 10 + local pidfile + for pidfile in `ls /var/run/${NAME}.sh-*.pid 2> /dev/null`; do + start-stop-daemon -K -s TERM -p "${pidfile}" -n "${NAME}.sh" >/dev/null + rm -f "${pidfile}" + done + for pidfile in `ls /var/run/${NAME}-*.pid 2> /dev/null`; do + start-stop-daemon -K -s TERM -p "${pidfile}" -n "${NAME}" >/dev/null + rm -f "${pidfile}" + done +} diff --git a/utils/ap51-flash/files/ap51-flash.sh b/utils/ap51-flash/files/ap51-flash.sh new file mode 100755 index 0000000..9ac33ee --- /dev/null +++ b/utils/ap51-flash/files/ap51-flash.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +NAME=ap51-flash +rootfs="" +kernel="" +ubnt="" + +[ $1 -eq "1" ] && loop="1" +ifname="$2" +[ -n "$3" ] && rootfs="--rootfs $3" +[ -n "$4" ] && kernel="--kernel $4" +[ -n "$5" ] && ubnt="--ubnt $5" + +while [ 1 ]; do + start-stop-daemon -S -m -p /var/run/$NAME-$ifname.pid -n $NAME \ + -x /usr/sbin/$NAME -- --flash-from-file $rootfs $kernel $ubnt $ifname + + rm /var/run/$NAME-$ifname.pid + [ "$loop" != "1" ] && break + sleep 15 +done diff --git a/utils/at/Makefile b/utils/at/Makefile new file mode 100644 index 0000000..b9a4ef8 --- /dev/null +++ b/utils/at/Makefile @@ -0,0 +1,59 @@ +# +# Copyright (C) 2008-2015 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:=at +PKG_VERSION:=3.1.16 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz +PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/a/at +PKG_MD5SUM:=d05da75d9b75d93917ffb16ab48b1e19 + +PKG_LICENSE:=GPL-2.0+ GPL-3.0+ ISC +PKG_LICENSE_FILES:=COPYING Copyright +PKG_MAINTAINER:=Phil Eichinger + +include $(INCLUDE_DIR)/package.mk + +define Package/at + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libelf1 + TITLE:=Delayed job execution and batch processing + URL:=http://packages.debian.org/stable/at +endef + +define Package/at/description + At and batch read shell commands from standard input storing them as a job to + be scheduled for execution in the future. +endef + +export SENDMAIL=/bin/true +EXTRA_CFLAGS:=-DNEED_YYWRAP -I$(PKG_BUILD_DIR) \ + $(TARGET_LDFLAGS) + +CONFIGURE_ARGS+=--prefix=/usr \ + --with-daemon_username=nobody \ + --with-daemon_groupname=nogroup \ + --with-jobdir=/var/spool/cron/atjobs \ + --with-atspool=/var/spool/cron/atspool + +CONFIGURE_VARS += \ + ac_cv_header_security_pam_appl_h=no + +define Package/at/install + $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/sbin $(1)/etc/init.d/ + $(INSTALL_BIN) ./files/atd.init $(1)/etc/init.d/atd + $(INSTALL_BIN) $(PKG_BUILD_DIR)/at $(1)/usr/bin + ln -sf at $(1)/usr/bin/atq + ln -sf at $(1)/usr/bin/atrm + $(INSTALL_BIN) $(PKG_BUILD_DIR)/atd $(1)/usr/sbin +endef + +$(eval $(call BuildPackage,at)) diff --git a/utils/at/files/atd.init b/utils/at/files/atd.init new file mode 100755 index 0000000..f293b1c --- /dev/null +++ b/utils/at/files/atd.init @@ -0,0 +1,26 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 OpenWrt.org + +START=50 + +USE_PROCD=1 + +start_service() { + [ -d /var/spool/cron/atjobs ] || { + mkdir -m 0755 -p /var/spool/cron/atjobs + touch /var/spool/cron/atjobs/.SEQ + chown -R nobody:nogroup /var/spool/cron/atjobs + } + [ -d /var/spool/cron/atspool ] || { + mkdir -m 0755 -p /var/spool/cron/atspool + chown -R nobody:nogroup /var/spool/cron/atspool + } + procd_open_instance + + procd_set_param command /usr/sbin/atd -f + procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5} + procd_set_param stdout 1 # forward stdout of the command to logd + procd_set_param stderr 1 # same for stderr + + procd_close_instance +} diff --git a/utils/at/patches/100-remove-glibc-assumption.patch b/utils/at/patches/100-remove-glibc-assumption.patch new file mode 100644 index 0000000..a18a007 --- /dev/null +++ b/utils/at/patches/100-remove-glibc-assumption.patch @@ -0,0 +1,59 @@ +From 7f811d9c4ebc9444e613e251c31d6bf537a24dc1 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 13 Apr 2015 16:35:30 -0700 +Subject: [PATCH] remove glibc assumption + +glibc time.h header has an undocumented __isleap macro +that we are using anf musl is missing it. +Since it is undocumented & does not appear +on any other libc, stop using it and just define the macro in +locally instead. + +Upstream-Status: Pending + +Signed-off-by: Khem Raj +[patch from: http://patchwork.openembedded.org/patch/91893/ ] +Signed-off-by: Phil Eichinger +--- + parsetime.y | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/parsetime.y b/parsetime.y +index 7005e88..324e6d3 100644 +--- a/parsetime.y ++++ b/parsetime.y +@@ -8,6 +8,9 @@ + + #define YYDEBUG 1 + ++#define is_leap_year(y) \ ++ ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0)) ++ + struct tm exectm; + static int isgmt; + static int yearspec; +@@ -217,8 +220,8 @@ date : month_name day_number + mnum == 12) && dnum > 31) + || ((mnum == 4 || mnum == 6 || mnum == 9 || + mnum == 11) && dnum > 30) +- || (mnum == 2 && dnum > 29 && __isleap(ynum+1900)) +- || (mnum == 2 && dnum > 28 && !__isleap(ynum+1900)) ++ || (mnum == 2 && dnum > 29 && is_leap_year(ynum+1900)) ++ || (mnum == 2 && dnum > 28 && !is_leap_year(ynum+1900)) + ) + { + yyerror("Error in day of month"); +@@ -261,8 +264,8 @@ date : month_name day_number + mnum == 12) && dnum > 31) + || ((mnum == 4 || mnum == 6 || mnum == 9 || + mnum == 11) && dnum > 30) +- || (mnum == 2 && dnum > 29 && __isleap(ynum+1900)) +- || (mnum == 2 && dnum > 28 && !__isleap(ynum+1900)) ++ || (mnum == 2 && dnum > 29 && is_leap_year(ynum+1900)) ++ || (mnum == 2 && dnum > 28 && !is_leap_year(ynum+1900)) + ) + { + yyerror("Error in day of month"); +-- +2.1.4 + diff --git a/utils/at/patches/110-getloadavg.patch b/utils/at/patches/110-getloadavg.patch new file mode 100644 index 0000000..0faef97 --- /dev/null +++ b/utils/at/patches/110-getloadavg.patch @@ -0,0 +1,14 @@ +--- a/getloadavg.c ++++ b/getloadavg.c +@@ -69,8 +69,9 @@ Boston, MA 02110-1301 USA */ + #include + #endif + +-#include "lisp.h" +-#include "sysfile.h" /* for encapsulated open, close, read, write */ ++#include ++#include ++#include + + #ifndef HAVE_GETLOADAVG + diff --git a/utils/attr/Makefile b/utils/attr/Makefile new file mode 100644 index 0000000..9eb978f --- /dev/null +++ b/utils/attr/Makefile @@ -0,0 +1,93 @@ +# +# Copyright (C) 2014-2016 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:=attr +PKG_REV:=315af30d0c1a198dc662a90e6e6ae2456abf2489 +PKG_VERSION:=20160302 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://git.savannah.gnu.org/r/attr.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=$(PKG_REV) +PKG_MAINTAINER:=Maxim Storchak + +PKG_LICENSE:=LGPL-2.1 GPL-2.0 +PKG_LICENSE_FILES:=doc/COPYING doc/COPYING.LGPL + +PKG_INSTALL:=1 +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/attr/Default + TITLE:=Extended attributes (xattr) manipulation + URL:=http://savannah.nongnu.org/projects/attr + SUBMENU:=Filesystem +endef + +define Package/attr/Default/description + Extended attributes support +endef + +define Package/attr +$(call Package/attr/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE+=utils + DEPENDS:=+libattr +endef + +define Package/libattr +$(call Package/attr/Default) + SECTION:=libs + CATEGORY:=Libraries + TITLE+=library +endef + +define Package/libattr/description +$(call Package/attr/Default/description) + This package provides libattr +endef + +define Package/attr/description +$(call Package/attr/Default/description) + This package provides xattr manipulation utilities + - attr + - getfattr + - setfattr +endef + +CONFIGURE_ARGS += --enable-static --enable-shared + +define Package/attr/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ +endef + +define Package/libattr/install + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_DIR) $(1)/etc + $(CP) $(PKG_INSTALL_DIR)/etc $(1)/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/ +endef + +define Package/attr/conffiles +/etc/xattr.conf +endef + +define Build/InstallDev + mkdir -p $(1)/usr/include + mkdir -p $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/{include,lib} $(1)/usr/ +endef + +$(eval $(call BuildPackage,attr)) +$(eval $(call BuildPackage,libattr)) diff --git a/utils/attr/patches/100-no-gettext_configure.patch b/utils/attr/patches/100-no-gettext_configure.patch new file mode 100644 index 0000000..c1d5b51 --- /dev/null +++ b/utils/attr/patches/100-no-gettext_configure.patch @@ -0,0 +1,21 @@ +diff --git a/configure.ac b/configure.ac +index a5f9de5..4c77e97 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -34,9 +34,6 @@ AC_FUNC_ALLOCA + AM_PROG_AR + LT_INIT + +-AM_GNU_GETTEXT_VERSION([0.18.2]) +-AM_GNU_GETTEXT([external]) +- + AC_ARG_ENABLE([debug], + [AS_HELP_STRING([--enable-debug], [Enable extra debugging])]) + AS_IF([test "x$enable_debug" = "xyes"], +@@ -55,6 +52,5 @@ AC_CONFIG_COMMANDS([include/attr], + AC_CONFIG_FILES([ + libattr.pc + Makefile +- po/Makefile.in + ]) + AC_OUTPUT diff --git a/utils/attr/patches/101-no-gettext_autogen.patch b/utils/attr/patches/101-no-gettext_autogen.patch new file mode 100644 index 0000000..1fad67a --- /dev/null +++ b/utils/attr/patches/101-no-gettext_autogen.patch @@ -0,0 +1,9 @@ +diff --git a/autogen.sh b/autogen.sh +index a98a3c5..982aff1 100755 +--- a/autogen.sh ++++ b/autogen.sh +@@ -1,4 +1,2 @@ + #!/bin/sh -ex +-po/update-potfiles +-autopoint --force + exec autoreconf -f -i diff --git a/utils/attr/patches/102-no-gettext_Makefile.patch b/utils/attr/patches/102-no-gettext_Makefile.patch new file mode 100644 index 0000000..76c8dcd --- /dev/null +++ b/utils/attr/patches/102-no-gettext_Makefile.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.am b/Makefile.am +index a3e8353..381bb55 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -3,8 +3,6 @@ ACLOCAL_AMFLAGS = -I m4 + EXTRA_DIST = \ + exports + +-SUBDIRS = po +- + AM_CPPFLAGS = \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ diff --git a/utils/avrdude/Makefile b/utils/avrdude/Makefile new file mode 100644 index 0000000..ca27a85 --- /dev/null +++ b/utils/avrdude/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2008-2015 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:=avrdude +PKG_VERSION:=6.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SAVANNAH/$(PKG_NAME) +PKG_MD5SUM:=58bb42049122cf80fe4f4d0ce36d92ee + +PKG_MAINTAINER:=Ted Hess +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/avrdude + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Microcontroller programming + TITLE:=AVR Downloader/UploaDEr + URL:=http://www.nongnu.org/avrdude/ + DEPENDS:=+libncurses +libreadline +libusb-compat +libftdi1 +libelf1 +endef + +define Package/avrdude/description + AVRDUDE is a full featured program for programming Atmel's AVR CPU's. +endef + +CONFIGURE_ARGS+= \ + --disable-doc \ + --disable-parport \ + --enable-linuxgpio \ + +TARGET_CFLAGS+= \ + -D_GNU_SOURCE \ + +define Package/avrdude/conffiles +/etc/avrdude.conf +endef + +define Package/avrdude/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/avrdude.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/avrdude $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,avrdude)) diff --git a/utils/avrdude/patches/010-configure-fixups.patch b/utils/avrdude/patches/010-configure-fixups.patch new file mode 100644 index 0000000..11ddad7 --- /dev/null +++ b/utils/avrdude/patches/010-configure-fixups.patch @@ -0,0 +1,18 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -38,6 +38,7 @@ LT_INIT() + + # Checks for programs. + AC_PROG_CC ++AC_PROG_CPP + AC_PROG_INSTALL + AC_PROG_SED + AC_PROG_YACC +@@ -182,6 +183,7 @@ fi + AC_SUBST(LIBPTHREAD, $LIBPTHREAD) + # Checks for header files. + AC_CHECK_HEADERS([limits.h stdlib.h string.h]) ++AC_CHECK_HEADERS([inttypes.h stdint.h]) + AC_CHECK_HEADERS([fcntl.h sys/ioctl.h sys/time.h termios.h unistd.h]) + AC_CHECK_HEADERS([ddk/hidsdi.h],,,[#include + #include ]) diff --git a/utils/avrdude/patches/100-musl-compat.patch b/utils/avrdude/patches/100-musl-compat.patch new file mode 100644 index 0000000..cef5fe4 --- /dev/null +++ b/utils/avrdude/patches/100-musl-compat.patch @@ -0,0 +1,60 @@ +--- a/dfu.h ++++ b/dfu.h +@@ -25,6 +25,7 @@ + + #ifdef HAVE_LIBUSB + #if defined(HAVE_USB_H) ++# include + # include + #elif defined(HAVE_LUSB0_USB_H) + # include +--- a/pickit2.c ++++ b/pickit2.c +@@ -50,6 +50,7 @@ + #include + #include + #include ++#include + + #include "avrdude.h" + #include "libavrdude.h" +--- a/ser_avrdoper.c ++++ b/ser_avrdoper.c +@@ -248,6 +248,7 @@ static int usbGetReport(union filedescri + /* ------------------------------------------------------------------------ */ + + #if defined(HAVE_USB_H) ++# include + # include + #elif defined(HAVE_LUSB0_USB_H) + # include +--- a/usbtiny.c ++++ b/usbtiny.c +@@ -40,6 +40,7 @@ + + #if defined(HAVE_LIBUSB) // we use LIBUSB to talk to the board + #if defined(HAVE_USB_H) ++# include + # include + #elif defined(HAVE_LUSB0_USB_H) + # include +--- a/usbasp.c ++++ b/usbasp.c +@@ -54,6 +54,7 @@ + # endif + #else + # if defined(HAVE_USB_H) ++# include + # include + # elif defined(HAVE_LUSB0_USB_H) + # include +--- a/usb_libusb.c ++++ b/usb_libusb.c +@@ -36,6 +36,7 @@ + #include + + #if defined(HAVE_USB_H) ++# include + # include + #elif defined(HAVE_LUSB0_USB_H) + # include diff --git a/utils/bandwidthd-php/Makefile b/utils/bandwidthd-php/Makefile new file mode 100644 index 0000000..c71d798 --- /dev/null +++ b/utils/bandwidthd-php/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2006-2016 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:=bandwidthd-php +PKG_VERSION:=2.0.1 +PKG_RELEASE:=2 + +PKG_MAINTAINER:=Jean-Michel Lacroix + +PKG_LICENSE:=GPL-2.0 + +include $(INCLUDE_DIR)/package.mk + +define Package/bandwidthd-php + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libpcre +libxml2 +php7 +php7-cgi +php7-mod-pgsql +php7-mod-gd + TITLE:=PHP files to graph bandwidthd data in a postgresql database + URL:=http://bandwidthd.sourceforge.net/ +endef + +define Package/bandwidthd-php/description + PHP files to graph bandwidthd data in a postgresql database +endef + +define Build/Compile +endef + +define Package/bandwidthd-php/install + $(INSTALL_DIR) $(1)/www/phphtdocs + $(INSTALL_DATA) ./files/legend.gif $(1)/www/phphtdocs/ + $(INSTALL_DATA) ./files/logo.gif $(1)/www/phphtdocs/ + $(INSTALL_DATA) ./files/details.php $(1)/www/phphtdocs/ + $(INSTALL_DATA) ./files/footer.php $(1)/www/phphtdocs/ + $(INSTALL_DATA) ./files/graph.php $(1)/www/phphtdocs/ + $(INSTALL_DATA) ./files/include.php $(1)/www/phphtdocs/ + $(INSTALL_DATA) ./files/index.php $(1)/www/phphtdocs/ + ln -s /var/etc/bandwidthd-php.conf $(1)/www/phphtdocs/config.conf + $(INSTALL_DIR) $(1)//etc/config + $(INSTALL_CONF) ./files/bandwidthd-php.config $(1)/etc/config/bandwidthd-php + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/bandwidthd-php.init $(1)/etc/init.d/bandwidthd-php +endef + +$(eval $(call BuildPackage,bandwidthd-php)) diff --git a/utils/bandwidthd-php/files/bandwidthd-php.config b/utils/bandwidthd-php/files/bandwidthd-php.config new file mode 100644 index 0000000..3bad494 --- /dev/null +++ b/utils/bandwidthd-php/files/bandwidthd-php.config @@ -0,0 +1,7 @@ +config bandwidthd-php + option dflt_width '900' + option dflt_height '256' + option dflt_interval 'INT_DAILY' + option host '127.0.0.1' + option user 'postgres' + option dbname 'bandwidthd' diff --git a/utils/bandwidthd-php/files/bandwidthd-php.init b/utils/bandwidthd-php/files/bandwidthd-php.init new file mode 100755 index 0000000..f3a7c67 --- /dev/null +++ b/utils/bandwidthd-php/files/bandwidthd-php.init @@ -0,0 +1,75 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2016 OpenWrt.org + +START=99 + +USE_PROCD=1 + +CONFIGNAME="bandwidthd-php" +CONFIGFILE="/var/etc/bandwidthd-php.conf" + +config_cb() { + local cfg_type="$1" + local cfg_name="$2" + case "$cfg_type" in + $CONFIGNAME) + append cfgs "$cfg_name" + ;; + esac +} + +export_number() { + local option="$1" + local section="$2" + local _loctmp + paramstr="" + config_get _loctmp "$section" "$option" + if [ -n "$_loctmp" ]; then + paramstr="${_loctmp}" + fi +} + +export_string() { + local option="$1" + local section="$2" + local _loctmp + paramstr="" + config_get _loctmp "$section" "$option" + if [ -n "$_loctmp" ]; then + paramstr="${_loctmp}" + fi +} + +service_triggers() +{ + procd_add_reload_trigger $CONFIGNAME +} + + +start_service() { + local conffile="" + [ -n "$conffile" ] && echo -e "$conffile" >>$CONFIGFILE + done +} diff --git a/utils/bandwidthd-php/files/details.php b/utils/bandwidthd-php/files/details.php new file mode 100644 index 0000000..d2f0786 --- /dev/null +++ b/utils/bandwidthd-php/files/details.php @@ -0,0 +1,102 @@ + + +
+ +Please provide a sensor_name"; + exit(1); + } + +if (isset($_GET['ip'])) + $ip = $_GET['ip']; +else + { + echo "
Please provide an ip address"; + exit(1); + } + +echo "

"; +if (strpos($ip, "/") === FALSE) + echo "$ip - ".gethostbyaddr($ip)."

"; +else + echo "Total - $ip"; + +$db = ConnectDb(); + +if ($ip == "0.0.0.0/0") + { + $rxtable = "bd_rx_total_log"; + $txtable = "bd_tx_total_log"; + } +else + { + $rxtable = "bd_rx_log"; + $txtable = "bd_tx_log"; + } + +$sql = "select rx.scale as rxscale, tx.scale as txscale, tx.total+rx.total as total, tx.total as sent, +rx.total as received, tx.tcp+rx.tcp as tcp, tx.udp+rx.udp as udp, +tx.icmp+rx.icmp as icmp, tx.http+rx.http as http, +tx.p2p+rx.p2p as p2p, tx.ftp+rx.ftp as ftp +from + +(SELECT ip, max(total/sample_duration)*8 as scale, sum(total) as total, sum(tcp) as tcp, sum(udp) as udp, sum(icmp) as icmp, +sum(http) as http, sum(p2p) as p2p, sum(ftp) as ftp +from sensors, $txtable +where sensor_name = '$sensor_name' +and sensors.sensor_id = ".$txtable.".sensor_id +and ip <<= '$ip' +group by ip) as tx, + +(SELECT ip, max(total/sample_duration)*8 as scale, sum(total) as total, sum(tcp) as tcp, sum(udp) as udp, sum(icmp) as icmp, +sum(http) as http, sum(p2p) as p2p, sum(ftp) as ftp +from sensors, $rxtable +where sensor_name = '$sensor_name' +and sensors.sensor_id = ".$rxtable.".sensor_id +and ip <<= '$ip' +group by ip) as rx + +where tx.ip = rx.ip;"; +//echo "
$sql
";exit(0); +$result = pg_query($sql); +echo "
IpNameTotalSentReceivedtcpudpicmphttpp2pftp"; +$r = pg_fetch_array($result); +echo "
"; +if (strpos($ip, "/") === FALSE) + echo "$ip".gethostbyaddr($ip); +else + echo "Total$ip"; +echo fmtb($r['total']).fmtb($r['sent']).fmtb($r['received']). + fmtb($r['tcp']).fmtb($r['udp']).fmtb($r['icmp']).fmtb($r['http']). + fmtb($r['p2p']).fmtb($r['ftp']); +echo "
"; + +echo "

Daily

"; +echo "Send:

"; +echo "
"; +echo "Receive:

"; +echo "
"; + +echo "

Weekly

"; +echo "Send:

"; +echo "
"; +echo "Receive:

"; +echo "
"; + +echo "

Monthly

"; +echo "Send:

"; +echo "
"; +echo "Receive:

"; +echo "
"; + +echo "

Yearly

"; +echo "Send:

"; +echo "
"; +echo "Receive:

"; +echo "
"; diff --git a/utils/bandwidthd-php/files/footer.php b/utils/bandwidthd-php/files/footer.php new file mode 100644 index 0000000..b342825 --- /dev/null +++ b/utils/bandwidthd-php/files/footer.php @@ -0,0 +1,3 @@ + diff --git a/utils/bandwidthd-php/files/graph.php b/utils/bandwidthd-php/files/graph.php new file mode 100644 index 0000000..b978177 --- /dev/null +++ b/utils/bandwidthd-php/files/graph.php @@ -0,0 +1,457 @@ + $number) + { + $total[$key] /= $number; + $icmp[$key] /= $number; + $udp[$key] /= $number; + $tcp[$key] /= $number; + $ftp[$key] /= $number; + $http[$key] /= $number; + $p2p[$key] /= $number; + } + + foreach ($Count as $key => $number) + { + $a_total[$key] += $total[$key]; + $a_icmp[$key] += $icmp[$key]; + $a_udp[$key] += $udp[$key]; + $a_tcp[$key] += $tcp[$key]; + $a_ftp[$key] += $ftp[$key]; + $a_http[$key] += $http[$key]; + $a_p2p[$key] += $p2p[$key]; + + if ($a_total[$key] > $YMax) + $YMax = $a_total[$key]; + } + + unset($GLOBALS['total'], $GLOBALS['icmp'], $GLOBALS['udp'], $GLOBALS['tcp'], $GLOBALS['ftp'], $GLOBALS['http'], $GLOBALS['p2p'], $GLOBALS['Count']); + + $total = array(); + $icmp = array(); + $udp = array(); + $tcp = array(); + $ftp = array(); + $http = array(); + $p2p = array(); + $Count = array(); + } + + +$db = ConnectDb(); + +// Get parameters + +if (isset($_GET['width'])) + $width = $_GET['width']; +else + $width = DFLT_WIDTH; + +if (isset($_GET['height'])) + $height = $_GET['height']; +else + $height = DFLT_HEIGHT; + +if (isset($_GET['interval'])) + $interval = $_GET['interval']; +else + $interval = DFLT_INTERVAL; + +if (isset($_GET['ip'])) + $ip = $_GET['ip']; +else + exit(1); + +if (isset($_GET['sensor_name'])) + $sensor_name = $_GET['sensor_name']; +else + exit(1); + +if (isset($_GET['timestamp'])) + $timestamp = $_GET['timestamp']; +else + $timestamp = time() - $interval + (0.05*$interval); + +if (isset($_GET['table'])) + $table = $_GET['table']; +else + $table = "bd_rx_log"; + +if (isset($_GET['yscale'])) + $yscale = $_GET['yscale']; + +$total = array(); +$icmp = array(); +$udp = array(); +$tcp = array(); +$ftp = array(); +$http = array(); +$p2p = array(); +$Count = array(); + +// Accumulator +$a_total = array(); +$a_icmp = array(); +$a_udp = array(); +$a_tcp = array(); +$a_ftp = array(); +$a_http = array(); +$a_p2p = array(); + +$sql = "select *, extract(epoch from timestamp) as ts from sensors, $table where sensors.sensor_id = ".$table.".sensor_id and ip <<= '$ip' and sensor_name = '$sensor_name' and timestamp > $timestamp::abstime and timestamp < ".($timestamp+$interval)."::abstime order by ip;"; +//echo $sql."
"; exit(1); +$result = pg_query($sql); + +// The SQL statement pulls the data out of the database ordered by IP address, that way we can average each +// datapoint for each IP address to provide smoothing and then toss the smoothed value into the accumulator +// to provide accurate total traffic rate. + +while ($row = pg_fetch_array($result)) + { + if ($row['ip'] != $last_ip) + { + AverageAndAccumulate(); + $last_ip = $row['ip']; + } + + $x = ($row['ts']-$timestamp)*(($width-XOFFSET)/$interval)+XOFFSET; + $xint = (int) $x; + + //echo "xint: ".$xint."
"; + $Count[$xint]++; + + if ($row['total']/$row['sample_duration'] > $SentPeak) + $SentPeak = $row['total']/$row['sample_duration']; + $TotalSent += $row['total']; + $total[$xint] += $row['total']/$row['sample_duration']; + $icmp[$xint] += $row['icmp']/$row['sample_duration']; + $udp[$xint] += $row['udp']/$row['sample_duration']; + $tcp[$xint] += $row['tcp']/$row['sample_duration']; + $ftp[$xint] += $row['ftp']/$row['sample_duration']; + $http[$xint] += $row['http']/$row['sample_duration']; + $p2p[$xint] += $row['p2p']/$row['sample_duration']; + } + +// One more time for the last IP +AverageAndAccumulate(); + +// Pull the data out of Accumulator +$total = $a_total; +$icmp = $a_icmp; +$udp = $a_udp; +$tcp = $a_tcp; +$ftp = $a_ftp; +$http = $a_http; +$p2p = $a_p2p; + +$YMax += $YMax*0.05; // Add an extra 5% + +// if a y scale was specified override YMax +if (isset($yscale)) + $YMax = $yscale/8; + +// Plot the data + +header("Content-type: image/png"); + +$im = imagecreate($width, $height); +$white = imagecolorallocate($im, 255, 255, 255); +$yellow = ImageColorAllocate($im, 255, 255, 0); +$purple = ImageColorAllocate($im, 255, 0, 255); +$green = ImageColorAllocate($im, 0, 255, 0); +$blue = ImageColorAllocate($im, 0, 0, 255); +$lblue = ImageColorAllocate($im, 128, 128, 255); +$brown = ImageColorAllocate($im, 128, 0, 0); +$red = ImageColorAllocate($im, 255, 0, 0); +$black = ImageColorAllocate($im, 0, 0, 0); + +for($Counter=XOFFSET+1; $Counter < $width; $Counter++) + { + if (isset($total[$Counter])) + { + // Convert the bytes/sec to y coords + $total[$Counter] = ($total[$Counter]*($height-YOFFSET))/$YMax; + $tcp[$Counter] = ($tcp[$Counter]*($height-YOFFSET))/$YMax; + $ftp[$Counter] = ($ftp[$Counter]*($height-YOFFSET))/$YMax; + $http[$Counter] = ($http[$Counter]*($height-YOFFSET))/$YMax; + $p2p[$Counter] = ($p2p[$Counter]*($height-YOFFSET))/$YMax; + $udp[$Counter] = ($udp[$Counter]*($height-YOFFSET))/$YMax; + $icmp[$Counter] = ($icmp[$Counter]*($height-YOFFSET))/$YMax; + + // Stack 'em up! + // Total is stacked from the bottom + // Icmp is on the bottom too + // Udp is stacked on top of icmp + $udp[$Counter] += $icmp[$Counter]; + // TCP and p2p are stacked on top of Udp + $tcp[$Counter] += $udp[$Counter]; + $p2p[$Counter] += $udp[$Counter]; + // Http is stacked on top of p2p + $http[$Counter] += $p2p[$Counter]; + // Ftp is stacked on top of http + $ftp[$Counter] += $http[$Counter]; + + // Plot them! + //echo "$Counter:".$Counter." (h-y)-t:".($height-YOFFSET) - $total[$Counter]." h-YO-1:".$height-YOFFSET-1; + ImageLine($im, $Counter, ($height-YOFFSET) - $total[$Counter], $Counter, $height-YOFFSET-1, $yellow); + ImageLine($im, $Counter, ($height-YOFFSET) - $icmp[$Counter], $Counter, $height-YOFFSET-1, $red); + ImageLine($im, $Counter, ($height-YOFFSET) - $udp[$Counter], $Counter, ($height-YOFFSET) - $icmp[$Counter] - 1, $brown); + ImageLine($im, $Counter, ($height-YOFFSET) - $tcp[$Counter], $Counter, ($height-YOFFSET) - $udp[$Counter] - 1, $green); + ImageLine($im, $Counter, ($height-YOFFSET) - $p2p[$Counter], $Counter, ($height-YOFFSET) - $udp[$Counter] - 1, $purple); + ImageLine($im, $Counter, ($height-YOFFSET) - $http[$Counter], $Counter, ($height-YOFFSET) - $p2p[$Counter] - 1, $blue); + ImageLine($im, $Counter, ($height-YOFFSET) - $ftp[$Counter], $Counter, ($height-YOFFSET) - $http[$Counter] - 1, $lblue); + } +// else +// echo $Counter." not set
"; + } + +// Margin Text +if ($SentPeak < 1024/8) + $txtPeakSendRate = sprintf("Peak Send Rate: %.1f KBits/sec", $SentPeak*8); +else if ($SentPeak < (1024*1024)/8) + $txtPeakSendRate = sprintf("Peak Send Rate: %.1f MBits/sec", ($SentPeak*8.0)/1024.0); +else + $txtPeakSendRate = sprintf("Peak Send Rate: %.1f GBits/sec", ($SentPeak*8.0)/(1024.0*1024.0)); + +if ($TotalSent < 1024) + $txtTotalSent = sprintf("Sent %.1f KBytes", $TotalSent); +else if ($TotalSent < 1024*1024) + $txtTotalSent = sprintf("Sent %.1f MBytes", $TotalSent/1024.0); +else + $txtTotalSent = sprintf("Sent %.1f GBytes", $TotalSent/(1024.0*1024.0)); + +ImageString($im, 2, XOFFSET+5, $height-20, $txtTotalSent, $black); +ImageString($im, 2, $width/2+XOFFSET/2, $height-20, $txtPeakSendRate, $black); + +// Draw X Axis + +ImageLine($im, 0, $height-YOFFSET, $width, $height-YOFFSET, $black); + +// Day/Month Seperator bars + +if ((24*60*60*($width-XOFFSET))/$interval > ($width-XOFFSET)/10) + { + $ts = getdate($timestamp); + $MarkTime = mktime(0, 0, 0, $ts['mon'], $ts['mday'], $ts['year']); + + $x = ts2x($MarkTime); + while ($x < XOFFSET) + { + $MarkTime += (24*60*60); + $x = ts2x($MarkTime); + } + + while ($x < ($width-10)) + { + // Day Lines + ImageLine($im, $x, 0, $x, $height-YOFFSET, $black); + ImageLine($im, $x+1, 0, $x+1, $height-YOFFSET, $black); + + $txtDate = strftime("%a, %b %d", $MarkTime); + ImageString($im, 2, $x-30, $height-YOFFSET+10, $txtDate, $black); + + // Calculate Next x + $MarkTime += (24*60*60); + $x = ts2x($MarkTime); + } + } +else if ((24*60*60*30*($width-XOFFSET))/$interval > ($width-XOFFSET)/10) + { + // Monthly Bars + $ts = getdate($timestamp); + $month = $ts['mon']; + $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); + + $x = ts2x($MarkTime); + while ($x < XOFFSET) + { + $month++; + $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); + $x = ts2x($MarkTime); + } + + while ($x < ($width-10)) + { + // Day Lines + ImageLine($im, $x, 0, $x, $height-YOFFSET, $black); + ImageLine($im, $x+1, 0, $x+1, $height-YOFFSET, $black); + + $txtDate = strftime("%b, %Y", $MarkTime); + ImageString($im, 2, $x-25, $height-YOFFSET+10, $txtDate, $black); + + // Calculate Next x + $month++; + $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); + $x = ts2x($MarkTime); + } + } +else + { + // Year Bars + $ts = getdate($timestamp); + $year = $ts['year']; + $MarkTime = mktime(0, 0, 0, 1, 1, $year); + + $x = ts2x($MarkTime); + while ($x < XOFFSET) + { + $year++; + $MarkTime = mktime(0, 0, 0, 1, 1, $year); + $x = ts2x($MarkTime); + } + + while ($x < ($width-10)) + { + // Day Lines + ImageLine($im, $x, 0, $x, $height-YOFFSET, $black); + ImageLine($im, $x+1, 0, $x+1, $height-YOFFSET, $black); + + $txtDate = strftime("%b, %Y", $MarkTime); + ImageString($im, 2, $x-25, $height-YOFFSET+10, $txtDate, $black); + + // Calculate Next x + $year++; + $MarkTime = mktime(0, 0, 0, 1, 1, $year); + $x = ts2x($MarkTime); + } + } + +// Draw Major Tick Marks +if ((6*60*60*($width-XOFFSET))/$interval > 10) // pixels per 6 hours is more than 2 + $MarkTimeStep = 6*60*60; // Major ticks are 6 hours +else if ((24*60*60*($width-XOFFSET))/$interval > 10) + $MarkTimeStep = 24*60*60; // Major ticks are 24 hours; +else if ((24*60*60*30*($width-XOFFSET))/$interval > 10) + { + // Major tick marks are months + $MarkTimeStep = 0; // Skip the standard way of drawing major tick marks below + + $ts = getdate($timestamp); + $month = $ts['mon']; + $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); + + $x = ts2x($MarkTime); + while ($x < XOFFSET) + { + $month++; + $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); + $x = ts2x($MarkTime); + } + + while ($x < ($width-10)) + { + // Day Lines + $date = getdate($MarkTime); + if ($date['mon'] != 1) + { + ImageLine($im, $x, $height-YOFFSET-5, $x, $height-YOFFSET+5, $black); + $txtDate = strftime("%b", $MarkTime); + ImageString($im, 2, $x-5, $height-YOFFSET+10, $txtDate, $black); + } + + // Calculate Next x + $month++; + $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); + $x = ts2x($MarkTime); + } + } +else + $MarkTimeStep = 0; // Skip Major Tick Marks + +if ($MarkTimeStep) + { + $ts = getdate($timestamp); + $MarkTime = mktime(0, 0, 0, $ts['mon'], $ts['mday'], $ts['year']); + $x = ts2x($MarkTime); + + while ($x < ($width-10)) + { + if ($x > XOFFSET) + { + ImageLine($im, $x, $height-YOFFSET-5, $x, $height-YOFFSET+5, $black); + } + $MarkTime += $MarkTimeStep; + $x = ts2x($MarkTime); + } + } + +// Draw Minor Tick marks +if ((60*60*($width-XOFFSET))/$interval > 4) // pixels per hour is more than 2 + $MarkTimeStep = 60*60; // Minor ticks are 1 hour +else if ((6*60*60*($width-XOFFSET))/$interval > 4) + $MarkTimeStep = 6*60*60; // Minor ticks are 6 hours +else if ((24*60*60*($width-XOFFSET))/$interval > 4) + $MarkTimeStep = 24*60*60; +else + $MarkTimeStep = 0; // Skip minor tick marks + +if ($MarkTimeStep) + { + $ts = getdate($timestamp); + $MarkTime = mktime(0, 0, 0, $ts['mon'], $ts['mday'], $ts['year']); + $x = ts2x($MarkTime); + + while ($x < ($width-10)) + { + if ($x > XOFFSET) + { + ImageLine($im, $x, $height-YOFFSET, $x, $height-YOFFSET+5, $black); + } + $MarkTime += $MarkTimeStep; + $x = ts2x($MarkTime); + } + } + +// Draw Y Axis +ImageLine($im, XOFFSET, 0, XOFFSET, $height, $black); + +$YLegend = 'k'; +$Divisor = 1; +if ($YMax*8 > 1024*2) + { + $Divisor = 1024; // Display in m + $YLegend = 'm'; + } + +if ($YMax*8 > 1024*1024*2) + { + $Divisor = 1024*1024; // Display in g + $YLegend = 'g'; + } + +if ($YMax*8 > 1024*1024*1024*2) + { + $Divisor = 1024*1024*1024; // Display in t + $YLegend = 't'; + } + +$YStep = $YMax/10; +if ($YStep < 1) + $YStep=1; +$YTic=$YStep; + +while ($YTic <= ($YMax - $YMax/10)) + { + $y = ($height-YOFFSET)-(($YTic*($height-YOFFSET))/$YMax); + ImageLine($im, XOFFSET, $y, $width, $y, $black); + $txtYLegend = sprintf("%4.1f %sbits/s", (8.0*$YTic)/$Divisor, $YLegend); + ImageString($im, 2, 3, $y-7, $txtYLegend, $black); + $YTic += $YStep; + } + +imagepng($im); +imagedestroy($im); diff --git a/utils/bandwidthd-php/files/include.php b/utils/bandwidthd-php/files/include.php new file mode 100644 index 0000000..6b435d1 --- /dev/null +++ b/utils/bandwidthd-php/files/include.php @@ -0,0 +1,54 @@ + $Max) + { + $Output /= 1024; + $Suffix = 'M'; + } + + if ($Output > $Max) + { + $Output /= 1024; + $Suffix = 'G'; + } + + if ($Output > $Max) + { + $Output /= 1024; + $Suffix = 'T'; + } + + return(sprintf("%.1f%s", $Output, $Suffix)); + } + +$starttime = time(); +set_time_limit(300); +?> diff --git a/utils/bandwidthd-php/files/index.php b/utils/bandwidthd-php/files/index.php new file mode 100644 index 0000000..5159f85 --- /dev/null +++ b/utils/bandwidthd-php/files/index.php @@ -0,0 +1,197 @@ + + +
+ + +
> + + +
+ + + + +Subnet Filter:"> + +
+
+Top $limit - $sensor_name"; +else + echo "

All Records - $sensor_name

"; + +// Sqlize the incomming variables +if (isset($subnet)) + $sql_subnet = "and ip <<= '$subnet'"; + +// Sql Statement +$sql = "select tx.ip, rx.scale as rxscale, tx.scale as txscale, tx.total+rx.total as total, tx.total as sent, +rx.total as received, tx.tcp+rx.tcp as tcp, tx.udp+rx.udp as udp, +tx.icmp+rx.icmp as icmp, tx.http+rx.http as http, +tx.p2p+rx.p2p as p2p, tx.ftp+rx.ftp as ftp +from + +(SELECT ip, max(total/sample_duration)*8 as scale, sum(total) as total, sum(tcp) as tcp, sum(udp) as udp, sum(icmp) as icmp, +sum(http) as http, sum(p2p) as p2p, sum(ftp) as ftp +from sensors, bd_tx_log +where sensor_name = '$sensor_name' +and sensors.sensor_id = bd_tx_log.sensor_id +$sql_subnet +and timestamp > $timestamp::abstime and timestamp < ".($timestamp+$interval)."::abstime +group by ip) as tx, + +(SELECT ip, max(total/sample_duration)*8 as scale, sum(total) as total, sum(tcp) as tcp, sum(udp) as udp, sum(icmp) as icmp, +sum(http) as http, sum(p2p) as p2p, sum(ftp) as ftp +from sensors, bd_rx_log +where sensor_name = '$sensor_name' +and sensors.sensor_id = bd_rx_log.sensor_id +$sql_subnet +and timestamp > $timestamp::abstime and timestamp < ".($timestamp+$interval)."::abstime +group by ip) as rx + +where tx.ip = rx.ip +order by total desc;"; + +//echo "
$sql
"; exit(0); +pg_query("SET sort_mem TO 30000;"); +$result = pg_query($sql); +pg_query("set sort_mem to default;"); + +if ($limit == "all") + $limit = pg_num_rows($result); + +echo "
IpNameTotalSentReceivedtcpudpicmphttpp2pftp"; + +if (!isset($subnet)) // Set this now for total graphs + $subnet = "0.0.0.0/0"; + +// Output Total Line +echo "
Total$subnet"; +foreach (array("total", "sent", "received", "tcp", "udp", "icmp", "http", "p2p", "ftp") as $key) + { + for($Counter=0, $Total = 0; $Counter < pg_num_rows($result); $Counter++) + { + $r = pg_fetch_array($result, $Counter); + $Total += $r[$key]; + } + echo fmtb($Total); + } +echo "\n"; + +// Output Other Lines +for($Counter=0; $Counter < pg_num_rows($result) && $Counter < $limit; $Counter++) + { + $r = pg_fetch_array($result, $Counter); + echo "
"; + echo $r['ip']."".gethostbyaddr($r['ip']); + echo ""; + echo fmtb($r['total']).fmtb($r['sent']).fmtb($r['received']). + fmtb($r['tcp']).fmtb($r['udp']).fmtb($r['icmp']).fmtb($r['http']). + fmtb($r['p2p']).fmtb($r['ftp'])."\n"; + } +echo "
"; + +// Output Total Graph +for($Counter=0, $Total = 0; $Counter < pg_num_rows($result); $Counter++) + { + $r = pg_fetch_array($result, $Counter); + $scale = max($r['txscale'], $scale); + $scale = max($r['rxscale'], $scale); + } + +if ($subnet == "0.0.0.0/0") + $total_table = "bd_tx_total_log"; +else + $total_table = "bd_tx_log"; +echo "

"; +echo "Total - Total of $subnet

"; +echo ""; +echo "Send:

"; +echo "
\n"; +if ($subnet == "0.0.0.0/0") + $total_table = "bd_rx_total_log"; +else + $total_table = "bd_rx_log"; +echo "Receive:

"; +echo "
\n"; + + +// Output Other Graphs +for($Counter=0; $Counter < pg_num_rows($result) && $Counter < $limit; $Counter++) + { + $r = pg_fetch_array($result, $Counter); + echo "

"; + if ($r['ip'] == "0.0.0.0") + echo "Total - Total of all subnets

"; + else + echo $r['ip']." - ".gethostbyaddr($r['ip']).""; + echo ""; + echo "Send:

"; + echo "
\n"; + echo "Receive:

"; + echo "
\n"; + } + +include('footer.php'); diff --git a/utils/bandwidthd-php/files/legend.gif b/utils/bandwidthd-php/files/legend.gif new file mode 100644 index 0000000000000000000000000000000000000000..3df909037fadf8df608efdb3cdc389aea779053c GIT binary patch literal 1649 zcmb_bi&NB96uyEXiesiyK0tC1k>w$JO&1*(4`lzIb3Nn=lgTcVzcaFI9fG7L~0l)o!fe|7IQG}S-1R2H%6ND+k3}G&c z1S3Kap@=XPjVSOXZ4hDo3WJYX?k12h*W65UXS9D>8e zz(~*sYawIOOD24k?k$Sa35CtlRYb33v~XSWPK-)+h$Bb}1(HNs+(hCbfF)>n9pFk} z9%zD9UgB*Q{|m^TBNuz8^;N|`r`S)IDUDU9ucuFSRjAijpZPU=CXVeiR%@Gb-u2IN z3alwH9b5RRUTLa1+j7D;s#zUad#<%W{>@;gsaAJWvnFMdv!br_mUjIyS!i=zS(|Q) zR#B*^*WW4syf(J0xxV~f<-&0p&KvT-YN?57D%zC2-+Ozl*TeiHp26OKUQT#E*yW%~ zdU#Fs+D3l4xXOGzbwbl_Lqm1cZ&|@MTh?5v+1Z@C)kfuChNI=htD>hA6xR*3on7}d zw6(GR%aTOfmY~FGsJp`0To@?2TGc~XGbWiBJty!euH(Fb~bxuyt z-ukg9VZ`r+a-YtzK@-_OvfO$9jG&l#;T>;Wn44%DU^J({nHwAyX%{f_eviauyxDNc@sxUDDYip)4zG`h;6{LqCo&*6r}<`o4={Y0;?40*f3vwA4RQcyb(7wb~1 zv5BpuC09M%-R`!Bd|c$;XdOIKnpghpm&qw#RHTjgY@4bbTCFEHvYQo}pZ3Yh_GU8K z(aPg4AF)TKukD-$3>_;L?y9ja^LoyfE}z{K-k7YYPQGTdp)%dlZCZR~+5#`vtMAM) zhMVjZZ}eRcG-6_u=!P!g~Y{2Np%K=X@1&W`jv zt99rkxKO=l4=TTS`Dd&Oj|rtpSPl^(L+2u z>E+F>BMYBgT=rU8>>_KpsoXdmZYwM6VzuMW&JL9-=R$Q+bxJ?l*=cO;8Jb*?lcSmk zK9!@&^-q1G+hP?K7G7CdSs)OGNF>edpvaPLr^s@1Vqs0s)CdSlyS&8IT)RcRH9tRJ z*gQ5w9hzL)ETxtPZoS<7{)?3&x3cwZl}P+KG9uqh7?P6<2ncvwlP^jYjW2Bcy|6%~ z@__5S{T5H;w=jT=ZL(lfqNIWnZOvT~KWx>H$+b;)9y zI(sWLp|hu-R5Jvp!Zo&x2sLr$f#o7Kx7pdLBr1uY%D?jb`TEP3f<1bZ)X5V{Vs=pODp^ebKmT;t_=mC9UOMry|FMC^zt7bH9AF4& z{)h8lPWnlb?g{r{mktqFLa@a50215Z!%(-7U0$){5P)yVwc zm>WeC_~%RfgZ+CK05}yu!B6Ruv)cpVtYQ{@Qgf!9Mue}~O?!DY#> z0>dOfWb)w~%AkULMxymLS~84|=I%*^_6FI{eHdkF?dv33yLU+yWN9=?GfAvim-Ei> ztx{CCHd`$K$<<<{uQa~y|KOT`;-pheq_&ZO2Sa_g9_N1i%E2wu*fVx|RcH1-Ed5*FmE)*W|@oF%0;cGle$sAh?kCrZJHq|7#ndOBrLCFhk9$ zGn3oquV|YY8~I(%@0l_CDJp%1{!7k#3QOhnYaM1J^K*-#Lhnr%{E?!V9QDh!yH@I# zoBNC+FyJ!1*d%+AKsdAxu%usQ(!_+w-Ra|nON5$zio+Lbo{ptWBxrJ+pFiky=d&f< zW7jqvgD~=$qUN4AT+g{jKgK0<=EYd;l$}D1WkW$IJ35~jAhCPX$Zi5P-jO`s@O#zQ z`j0hCK?1J+20IUv-o3Te$8e-I!*? z^c0SPW(-mX z)j{8e*fgYO+&|mmjZ&dJ7~;v_?Yv3C(u_!O9}v9Nr~hEYc1j|Q0y#Er#n5c?=KISPb=l5bSBYGKdo2@2@hCdgh z-e4Ns5dF30O#PixHUmur?ln*B+7)LNC+ue8Bnq}nbf1&_@_TwT!b(r9q}{5BYddV?$q$w+D072NYR`e^x;2$?&fUED z=X!4a>7pM$@L}_SG=PoSb;Kw)F+*>~XoKo&5iML&7?q&7EvI*Ig+J|4>Y-defQJEmwPzHlzu58w zcu)3_;_Fy5!ktRoGLQT&T{*fbft%Zod@`3VsNW1n7+qdR0n9s@Cv zLfm`~sDO^tMP~faHTpx~gYwRYz z#aNgM-P6|5%L_%t#cvg8TJ-jBmdCl;nOuc&PM+d*v~%|xi-J1JCC~1L2A)3ccse?`)O(=RU$ zTuy^qSnXVzLg`h())zns$Fh5n(EQAD1MW-z_j5ZzLfkFh#g}=6lvBa*ZI4=%2Vqv)>cB82H@@F5#F&qMsAq6 z`bd5C)abF=vxS_bkdn*ffHTp3?Qi!q;!y*B^2dcu;a`Bcgg5 zUsn9iR~1Cn7iEMuWn6#91-$xE z&;vIe*hRfd?tq>B-C=fa;qOlJxd4%+)8UqN63ll?k$iM_Dyaoyio?IMKg;^f8C>*y z1+|s`e!9wa%Y=fvl5YIDVq9odwFJlX2C2E0WLRRRyZJ69aKnabcuQcdF}bkO_H|bz zodTU}4RlwOcjIZ8DaFAdiOoIroR^rv7sr?3zpgnR9<`a2X^%IyxaY_@YL`0VXcZpT z&fu4}-m5TtkBI#nGd;OFRlgTs>hZLMHn3lvccrHzqG5^wiWwCv)GK|iGB2-uDx8}?#SF?TEE7d+5 za6cbAw{!fndGpDxUsnGDBS?#mwBHR%KG#}=^%>~o`WBYl|B2BE)=LBb7W=4Z0)qTA z)NA`aegCN^_KdG}v|4ldMOD0!6_F?VtwQ-Dzw=gEpyYuqy-EMuEi3iI>4g^Q#*eDP zJ}<$A{bi)F-tn%b$iBer; zy}FA!yGSRwM5Iq)MKlm?bNr|1{hiOD*ri!|g$pi)S@B0$(uXCUMV;D3H^B8u6<;LM zMWFV=pJaQ%_abUV(DiHV1H}&w5!*%U-mDtGPKY{n$tyqQVeQAR}Uuw<|~3`2Y>{G zF1U|=do7y59|Fq`c%%5z)Eli4LxrzQp#1u-%DD&7SXCI#J-M}}(fd1x?$UF^t zV?e=D*6pcmdPGiaamup;6gM$P+V>exQ`jjnw6J6L?{!evH%~Dq`zLn}3r{XBB$GP_ zCgYp`#V2CjhlB4AO65=Tr6yLDCe$1$j}Dj5wFKqjp;gDgqzE~j%6U2VAR9JAS&t5e zrLisn*|KSPU4WxHh=X$ILqt)mP!Sg;pVheV5l@lBpM3Qu(72TK+CbsBLs5)S(Ue&M zmg-xe$_?|_D5~fK31aCA*$@~GiX`T!^Yi}gOXTp6lP4BSX#+;*Q1aN6#2#8@X^@Q! zA@h_~iho&A; z!3)5c_R8cgdOR}^9pNdSfo&$kQM&Y0gEQ3YXlP%+r)FK~))3FEiHS4QdHRfK`kaYLWDc!BcjZw6I~7=2M$k zn3nvz)}V~u&gX19W`S;bINf3k#Op1|hRGUN`tSVr{4~NG$8hD1id7d+4RTKfX&sYh+$-OgW zBd|%9ooWnb^rV-r_DQayH*P-iXilW7cJ^xWPkYlT4*sQvl^~2us9~9JFOl#0wER`h zZHlI&W!Ft&QSs!Ah^T)86bv0P2KHg*H%B zJl&?W<*qMynfMkxYqRyFeX;2(M|u04BCXGtfI#KkS^IdzXx-n5@K*bXs4LMWW6^nhyX(lK)caEAr3P?)pmTMzo7o&3j_A>_=ysB*dN9;8NY^#Pm;ps) z*kfCLZjxa+G=%-=Rye(*MDI~u_i^{zAPH3{b@Ww-UIHV8q-dPD46n5X=m?8+MowL{ z?XAHL^huHZj%n?#60g#bwV6md>6m^ll~(81jX16##h7l%!q#YIx63u@t=_PL@|q&# z0QNy&$7YW`ejvgrGrAm%abk6iHOVS6Ld+!VMB zMS-8wP^c!+A@w0|ee!QwrQ4xaSWa0=C6fzDIJ-uBrt)?frxoR$WFe=yW$0~ZlI2{b zM{M2gNlvEh`kQ5(54UX`=IT?;Iqzq9c~x*ea8C2csnvRtM(~^Pkon+rh0|FyU22!q zu9WFJ!-+BW*>y}ltAv^vYGS}uC0;18m25&(jm(_{LF*0ZyQt+=DW+>9)_Z7T~( z^85?n$y}x1#c>+4dkg&-EOt7!cA9>4I%;65Y$)F6<}^K|TFZF|nKLd|HFVed4QJKx z4=3>PZ0^UoR+HuyP5dwe)qlo05}4YynXm+}MJBBwJ#8?c@BvNa;oHxAdK}{5w{$P0 zD7d$6wG!n%>zCy}JuG!&m=-eMXFnd*PlP&Ws-DuDiUeCSim3=srf1-i!~o&u7!Cj6 zEHXE^7|Lk8#6Rcx00Tk~rjZ8Vr!O82>0Woq6=x2Y`1NO#dUECVJE1vCOMly1NS%yT zo#4|R(`K;4(t%s@v$4c7+W8g2dYSj#a-8jS`*ybCR~U3OBE7t3=MCkU{i@DE#2IPO zkQtAZS^l=RK<~Iz*0j9i)0wossU((oJBNs5blI7IDuYw!1#x=1kQD-%&boinY}MS9)}+NY0us!a3Bh} z_0{HLBN%AtHpk>y5)G<&ZAjMB`|E+5N?=*bk`2jA{RRCO%c^3FSimsP_c(I~Nrw~zX$O{W zAm(8~^s*283G|%!p z2>9|2)cm+BnM{A2>9?*3s_}fim$~G8Kg=8Ro{fB~LUBCJ0Ng)r{jJu1_^=>RDn}Br z$xL-zj1q03GtQ|wWUa@=B}<~1E`u!3_hhWT=Dp3Ae4Y7aK7tlfOrN?*V?+WMB^06*Xo1&yOz#1dPxkTp)yGSPJQ*xAX63 zER*j1lh+I;{j3gBD*;!Roacl|cT|rL@014$?TfB_eraw|Y96=nQ<80oN;3s)4+&tR4KOaI1ZliLDX_Jr7=PA|=2LZy-jT63-smUG3uN45p z8`_%hE)JwX_nXTdr1^(aK%I^upP0^$bST53UMQQWdbWawjmSXUkO@q|M|m8DTE8C7 z0J;{eeZyQ2GZqYxF+e+MWC^78AkCLQTQr@yHs76gv$DUA_F~F7%A*Z;(U_W~dE3<5 zD!^Hz<(?=TZYh_yPwYyHqJ5WW0AE1PfZ~0yLetGx*oljOYRKU>XF+y-G4*q3jA%%+ z+0EBq-@f&uN{QaWaK_7+3Q{cMz4f54?!P*nwGmeTcibltU8 ze<&F~?K`?Mt>wCKq+G->rR0#jeOjjT;jyPbm7aWY2^JoezZ35I8N&k;cgd$om#Zi| zM900#2{bXYX)kWl6+!NUzS5V2BWWHru%L=}YhyxqcIkrTgSIg&8VH#d&b-uJ@wI0G z()^8oW{N}RphDGs@pPv!ba4Togg9H8g$cRa(_OscoQZA~MgVOC_2)(rs(S;o#U2x3 zt>vXdkh5^T0Qg<8Kv5ACmsqZ}mWs%r{}8W3+o|tt-!bTCuxg?JwVvy}t`=$l2Z22^ z!up>&*7yd*^+lB6+9miH#`-*Szg5+`kOhZx$+~a`Sd&WM*o^u{IiBan6?=c#FNE!E z#Jnv-bP(*bTyTsPjwAZOZ;vjJCN$?sci1 z05qEj?xn8ZD~8SNf_Ehw@m4M$@&xX9Ke_mN$4=Q+$IZU|mcFWBU~SN%xTB3Ugo@+u z*eh=s_$uVW`6<0mSA|w+)?&6Nu$HSv^V}N?#7lG)qxT|&NxP4}t=s67%Fg(yMRJeU zTQecyAObN@K$c6uc42S&!h5Gi+Lw$_X=z9#PsFE$*-ablo!{u9+DCI=O+*q2Ne!Xa zQ3`5iY88B-E2qDisyO(g$_N-?Qi(w0deH|cCx_uJhKaI#}RnZ9C z_gPn`e>_H1BL;#SVSz9PhDd$eSCCISZU~qS$ojF3SN5uqtoWxQcT?3MZ=(REFe@&z zU_j{XDE|Zw`gS7-IOpBNAnR+j)|6ezAr*XGqw2ch0QNkrxRm*Zdw2%nX7*_{nP^;> zAo!w)lfL7f1uW=uS&~RjkQ2&C%NTLp$xM?a*jn2P8gQQ|og{7YUhbl3UZgD>QU1d+ z-Laf^6C*1&Tbpf+ahvw`sq=E3^+%ITS_( zdfQ@~QJ&X@?)~M7XA9n~K5K0ob!oyju$b+;rZ=VNy82DM?L~hxCUYE)J$%HWP$!i( z_{(t0gpT=u8z#CxkY&frFuD+C5~q&MLw}=n?^y<}0R*2(B{W1+{v5BFt!SsiP|&2@ z*#k}8qg$nCWi`>Utv^;?%oh#kt`V|_x;h0mjfVCi3X$WsVG4|?eWDGuXKi;^wb^B9 zpDe-C8}PcP#QY7u{k?|jyLlerbNMd5ubY;P!YmJ2;Rw4 zzE;qDxan4`BGLA&LFk!X4*6Q+WrWC^HaN^}W=ea5(Qw8&fAU6rre%d=XH?kCvrUqC z8?sTtSnA2{joV2n+YiSJLZ@%k&(10DKfoVCVeYpRsxpQf@K2<)eBa#pRnPe-;#1nf z`*2Y3R1o63co-bjrk0d0UqsLs)%r!j_-5XhINRr>K@dCF6FgA)H>jM@IT;M&w1rp_ z7p(bQrwT(xYnUFZ3o9L|vG>4kw$yIj6Ss&Nxbs1k?b&+Q4_|?I6atH-v+fg#KQYXD zc7dO5o%M=A&82n@ei21#DBsp%SD-XEgx~%%E|(kSl(dS$QQEIJkRg0@?4*(+OLN)SBVQmf=A z^RJ=OlS*{3J5hGxF(DY}K_F%;S?$G<1{HpOQSvN0sVxWyvL0|g zmX%hrOvQLBU2=TqUL@moPhMQ?W^3k8*-I*G_P>5ti<|l9usA#2yZD5Hy!R_KZ`;Z4 z?zNE}Ms@Xje^;b+rrS){YxQLRI?GTW&iV}9(Ydr61ZLj~G+G7dQx^NM;-;fBccM~@ z%I$b|rd5v$MeV3ZmO>YFea=HR8+schABu{@>iF(K&=l$KIekyA{|Nb2t#f)Z9Xd8${i>QE$mFEO zsrngCvhgr6*(G=#W}#pBju)tTlpd0%_NB>G zNQg{pDwhcLn!Pz!AT2U8iFxi6F6i_qXJ2(w>qS=I)%-yP`r`#_I;AnuJ03k3=l5Qo zk@@geayOQ7ezWP0Tp}mppejojW? zs;eWfUicmIf2p+{zVt&*rR$t(q#_ecy}N^k1`FU$sh^y*5m`IF z)pX)4M20Y$XWd_Fm3IzScj`B5(6n{okzM#@O~a>WXy9rp;~H1kx(#Q$uCjGs`_W}0 z)UDsub!AKQ8dB3NsQad^)^(xoeG>MnX1Dorr>4YNJqwMtCtdzxB2}yx3dk3<6Y3Pk zy9FdPb~LoBL$hq~YL;$Y&saN3Ts!!YIlNthKxp@4puTEj)V3?s zNrxJ$(i@!K`xvhqEKdVd^k=oF;X}5>3iZdy_s47YCz$pp+V&^8_a_JSrzG@~^7~V3 z`_sDm)5rTWmise*^e5LsIo62G@ZLbhws=MTd^WWNUHy3bfjDpdxX^*v6#dxZfzSs1 zatr+ed|0_Dyb=#5Yr?DK2P%T}Yg7hbX&RJR7?e60lsz4c!59eG4m6DG*L4lL-qNp5 zA8e@|tUMYdBZsO^4OI^r6iMKl$_G0&@jdv#?q&VH$f15Ge1AE9z}BF52tR01@Kyrf zI*xyhywY&$O5@Q`7wpQrS^SX2@ZeMY2evB{kyj>#u1v`fzi&2}feDO^56|WgH_vQc zY3sVObaZ9GefXowyAPW0R?>%;oeWo>8m=U~TPq*_BxJaG#5dn%*m26RearAG(r{*B|@sYpFBhjTJ$1n=OPJswh zp!X`M@)X#03hg}#od< + +PKG_LICENSE:=GPL-2.0 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/bandwidthd/Default + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Bandwidthd + URL:=http://bandwidthd.sourceforge.net/ +endef + +define Package/bandwidthd +$(call Package/bandwidthd/Default) + TITLE += (without postgresql) + VARIANT:=no-pgsql + DEPENDS:=+libgd +libpcap +endef + +define Package/bandwidthd-pgsql +$(call Package/bandwidthd/Default) + TITLE += (with postgresql enabled) + VARIANT:=pgsql + DEPENDS:=+libgd +libpcap +libpq +endef + +define Package/bandwidthd/description + A bandwidthd tracking utility. +endef + +define Package/bandwidthd-pgsql/description +$(call Package/bandwidthd/description) +With the ability to store in a postgresql database. +endef + +define Package/bandwidthd/daemon + This package contains bandwidthd a bandwidth tracking utility. +endef + +define Package/bandwidthd-pgsql/daemon + This package contains bandwidthd a bandwidth tracking utility. +endef + +ifeq ($(BUILD_VARIANT),no-pgsql) +CONFIGURE_ARGS += \ + ac_cv_file__sw_lib=no \ + ac_cv_file__sw_include=no \ + ac_cv_file__usr_pkg_lib=no \ + ac_cv_file__usr_pkg_include=no \ + ac_cv_file__usr_local_pgsql_lib=no \ + ac_cv_file__usr_local_pgsql_include=no \ + ac_cv_lib_pq_PQconnectdb=no +endif + +ifeq ($(BUILD_VARIANT),pgsql) +CONFIGURE_ARGS += \ + ac_cv_file__sw_lib=no \ + ac_cv_file__sw_include=no \ + ac_cv_file__usr_pkg_lib=no \ + ac_cv_file__usr_pkg_include=no \ + ac_cv_file__usr_local_pgsql_lib=no \ + ac_cv_file__usr_local_pgsql_include=no +endif + +EXTRA_CFLAGS+= $(TARGET_CPPFLAGS) -std=gnu89 +EXTRA_LDFLAGS+= $(TARGET_LDFLAGS) -Wl,-rpath-link,$(STAGING_DIR)/usr/lib + +define Package/bandwidthd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/bandwidthd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/bandwidthd.config $(1)/etc/config/bandwidthd + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/bandwidthd.init $(1)/etc/init.d/bandwidthd + $(INSTALL_DIR) $(1)/www + $(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/legend.gif $(1)/www/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/logo.gif $(1)/www/ +endef + +define Package/bandwidthd-pgsql/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/bandwidthd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/bandwidthd-pgsql.config $(1)/etc/config/bandwidthd + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/bandwidthd-pgsql.init $(1)/etc/init.d/bandwidthd + $(INSTALL_DIR) $(1)/www/phphtdocs + $(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/legend.gif $(1)/www/ + $(INSTALL_DATA) ./files/logo.gif $(1)/www/ + $(INSTALL_DIR) $(1)/usr/share/postgresql + $(INSTALL_DATA) $(PKG_BUILD_DIR)/schema.postgresql $(1)/usr/share/postgresql + $(INSTALL_BIN) $(PKG_BUILD_DIR)/phphtdocs/bd_pgsql_purge.sh $(1)/usr/share/postgresql +endef + +define Package/bandwidthd/conffiles +/etc/config/bandwidthd +endef + +define Package/bandwidthd-pgsql/conffiles +/etc/config/bandwidthd +endef + +$(eval $(call BuildPackage,bandwidthd)) +$(eval $(call BuildPackage,bandwidthd-pgsql)) diff --git a/utils/bandwidthd/files/bandwidthd-pgsql.config b/utils/bandwidthd/files/bandwidthd-pgsql.config new file mode 100644 index 0000000..0f87687 --- /dev/null +++ b/utils/bandwidthd/files/bandwidthd-pgsql.config @@ -0,0 +1,13 @@ +config bandwidthd + option dev br-lan + option subnets "192.168.1.0/24" + option skip_intervals 0 + option graph_cutoff 1024 + option promiscuous true + option output_cdf false + option recover_cdf false + option filter ip + option graph true + option meta_refresh 150 + option disabled_pgsql_connect_string "user = postgres dbname = bandwidthd host = 192.168.1.1" + option disabled_sensor_id "openwrt.mydomain.domain" diff --git a/utils/bandwidthd/files/bandwidthd-pgsql.init b/utils/bandwidthd/files/bandwidthd-pgsql.init new file mode 100644 index 0000000..232fa0c --- /dev/null +++ b/utils/bandwidthd/files/bandwidthd-pgsql.init @@ -0,0 +1,90 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008-2015 OpenWrt.org + +START=99 + +config_cb() { + local cfg_type="$1" + local cfg_name="$2" + + case "$cfg_type" in + bandwidthd) + append cfgs "$cfg_name" + ;; + esac +} + +export_bool() { + local option="$1" + local section="$2" + local _loctmp + config_get_bool _loctmp "$section" "$option" + if [ -n "$_loctmp" ]; then + conffile="${conffile}$option " + if [ 1 -eq "$_loctmp" ]; then + conffile="${conffile}true" + else + conffile="${conffile}false" + fi + conffile="${conffile}\n" + fi +} + +export_number() { + local option="$1" + local section="$2" + local _loctmp + config_get _loctmp "$section" "$option" + if [ -n "$_loctmp" ]; then + conffile="${conffile}$option ${_loctmp}\n" + fi +} + +export_string() { + local option="$1" + local section="$2" + local _loctmp + config_get _loctmp "$section" "$option" + if [ -n "$_loctmp" ]; then + conffile="${conffile}$option \"${_loctmp}\"\n" + fi +} + +start() { + local subnet conffile + + [ -d /tmp/bandwidthd ] || mkdir -p /tmp/bandwidthd && cp /www/legend.gif /www/logo.gif /tmp/bandwidthd/ + [ -e /htdocs ] || ln -s /tmp/bandwidthd /htdocs + [ -e /www/bandwidthd ] || ln -s /tmp/bandwidthd /www/bandwidthd + rm -f /tmp/bandwidthd.conf + touch /tmp/bandwidthd.conf + [ -e /etc/bandwidthd.conf ] || ln -s /tmp/bandwidthd.conf /etc/bandwidthd.conf + + + config_load bandwidthd + for cfg in $cfgs; do + config_get subnets $cfg subnets + for subnet in $subnets; do + conffile="${conffile}subnet ${subnet}\n" + done + export_string dev $cfg + export_number skip_intervals $cfg + export_number graph_cutoff $cfg + export_bool promiscuous $cfg + export_bool output_cdf $cfg + export_bool recover_cdf $cfg + export_string filter $cfg + export_bool graph $cfg + export_number meta_refresh $cfg + export_string pgsql_connect_string $cfg + export_string sensor_id $cfg + [ -n "$conffile" ] && echo -e "$conffile" >>/tmp/bandwidthd.conf + unset conffile + done + cd / + service_start /usr/sbin/bandwidthd +} + +stop() { + service_stop /usr/sbin/bandwidthd +} diff --git a/utils/bandwidthd/files/bandwidthd.config b/utils/bandwidthd/files/bandwidthd.config new file mode 100644 index 0000000..0769b1c --- /dev/null +++ b/utils/bandwidthd/files/bandwidthd.config @@ -0,0 +1,11 @@ +config bandwidthd + option dev br-lan + option subnets "192.168.1.0/24" + option skip_intervals 0 + option graph_cutoff 1024 + option promiscuous true + option output_cdf false + option recover_cdf false + option filter ip + option graph true + option meta_refresh 150 diff --git a/utils/bandwidthd/files/bandwidthd.init b/utils/bandwidthd/files/bandwidthd.init new file mode 100644 index 0000000..38d9cb1 --- /dev/null +++ b/utils/bandwidthd/files/bandwidthd.init @@ -0,0 +1,88 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008-2015 OpenWrt.org + +START=99 + +config_cb() { + local cfg_type="$1" + local cfg_name="$2" + + case "$cfg_type" in + bandwidthd) + append cfgs "$cfg_name" + ;; + esac +} + +export_bool() { + local option="$1" + local section="$2" + local _loctmp + config_get_bool _loctmp "$section" "$option" + if [ -n "$_loctmp" ]; then + conffile="${conffile}$option " + if [ 1 -eq "$_loctmp" ]; then + conffile="${conffile}true" + else + conffile="${conffile}false" + fi + conffile="${conffile}\n" + fi +} + +export_number() { + local option="$1" + local section="$2" + local _loctmp + config_get _loctmp "$section" "$option" + if [ -n "$_loctmp" ]; then + conffile="${conffile}$option ${_loctmp}\n" + fi +} + +export_string() { + local option="$1" + local section="$2" + local _loctmp + config_get _loctmp "$section" "$option" + if [ -n "$_loctmp" ]; then + conffile="${conffile}$option \"${_loctmp}\"\n" + fi +} + +start() { + local subnet conffile + + [ -d /tmp/bandwidthd ] || mkdir -p /tmp/bandwidthd && cp /www/legend.gif /www/logo.gif /tmp/bandwidthd/ + [ -e /htdocs ] || ln -s /tmp/bandwidthd /htdocs + [ -e /www/bandwidthd ] || ln -s /tmp/bandwidthd /www/bandwidthd + rm -f /tmp/bandwidthd.conf + touch /tmp/bandwidthd.conf + [ -e /etc/bandwidthd.conf ] || ln -s /tmp/bandwidthd.conf /etc/bandwidthd.conf + + + config_load bandwidthd + for cfg in $cfgs; do + config_get subnets $cfg subnets + for subnet in $subnets; do + conffile="${conffile}subnet ${subnet}\n" + done + export_string dev $cfg + export_number skip_intervals $cfg + export_number graph_cutoff $cfg + export_bool promiscuous $cfg + export_bool output_cdf $cfg + export_bool recover_cdf $cfg + export_string filter $cfg + export_bool graph $cfg + export_number meta_refresh $cfg + [ -n "$conffile" ] && echo -e "$conffile" >>/tmp/bandwidthd.conf + unset conffile + done + cd / + service_start /usr/sbin/bandwidthd +} + +stop() { + service_stop /usr/sbin/bandwidthd +} diff --git a/utils/bandwidthd/files/logo.gif b/utils/bandwidthd/files/logo.gif new file mode 100644 index 0000000000000000000000000000000000000000..2ffec5605b72c48f49d8ee3dc069e80baccd6aa7 GIT binary patch literal 9431 zcmYLO2{=^Y*S|9cV+`($oz&RMp0yB~u`iR5iXuZ2qGYGkShHtm?E5Zb4avSQ8KLY; zA!}%($b9<$zwi0p=Q;PBbIZ}eRcG-6_u=!P!g~Y{2Np%K=X@1&W`jv zt99rkxKO=l4=TTS`Dd&Oj|rtpSPl^(L+2u z>E+F>BMYBgT=rU8>>_KpsoXdmZYwM6VzuMW&JL9-=R$Q+bxJ?l*=cO;8Jb*?lcSmk zK9!@&^-q1G+hP?K7G7CdSs)OGNF>edpvaPLr^s@1Vqs0s)CdSlyS&8IT)RcRH9tRJ z*gQ5w9hzL)ETxtPZoS<7{)?3&x3cwZl}P+KG9uqh7?P6<2ncvwlP^jYjW2Bcy|6%~ z@__5S{T5H;w=jT=ZL(lfqNIWnZOvT~KWx>H$+b;)9y zI(sWLp|hu-R5Jvp!Zo&x2sLr$f#o7Kx7pdLBr1uY%D?jb`TEP3f<1bZ)X5V{Vs=pODp^ebKmT;t_=mC9UOMry|FMC^zt7bH9AF4& z{)h8lPWnlb?g{r{mktqFLa@a50215Z!%(-7U0$){5P)yVwc zm>WeC_~%RfgZ+CK05}yu!B6Ruv)cpVtYQ{@Qgf!9Mue}~O?!DY#> z0>dOfWb)w~%AkULMxymLS~84|=I%*^_6FI{eHdkF?dv33yLU+yWN9=?GfAvim-Ei> ztx{CCHd`$K$<<<{uQa~y|KOT`;-pheq_&ZO2Sa_g9_N1i%E2wu*fVx|RcH1-Ed5*FmE)*W|@oF%0;cGle$sAh?kCrZJHq|7#ndOBrLCFhk9$ zGn3oquV|YY8~I(%@0l_CDJp%1{!7k#3QOhnYaM1J^K*-#Lhnr%{E?!V9QDh!yH@I# zoBNC+FyJ!1*d%+AKsdAxu%usQ(!_+w-Ra|nON5$zio+Lbo{ptWBxrJ+pFiky=d&f< zW7jqvgD~=$qUN4AT+g{jKgK0<=EYd;l$}D1WkW$IJ35~jAhCPX$Zi5P-jO`s@O#zQ z`j0hCK?1J+20IUv-o3Te$8e-I!*? z^c0SPW(-mX z)j{8e*fgYO+&|mmjZ&dJ7~;v_?Yv3C(u_!O9}v9Nr~hEYc1j|Q0y#Er#n5c?=KISPb=l5bSBYGKdo2@2@hCdgh z-e4Ns5dF30O#PixHUmur?ln*B+7)LNC+ue8Bnq}nbf1&_@_TwT!b(r9q}{5BYddV?$q$w+D072NYR`e^x;2$?&fUED z=X!4a>7pM$@L}_SG=PoSb;Kw)F+*>~XoKo&5iML&7?q&7EvI*Ig+J|4>Y-defQJEmwPzHlzu58w zcu)3_;_Fy5!ktRoGLQT&T{*fbft%Zod@`3VsNW1n7+qdR0n9s@Cv zLfm`~sDO^tMP~faHTpx~gYwRYz z#aNgM-P6|5%L_%t#cvg8TJ-jBmdCl;nOuc&PM+d*v~%|xi-J1JCC~1L2A)3ccse?`)O(=RU$ zTuy^qSnXVzLg`h())zns$Fh5n(EQAD1MW-z_j5ZzLfkFh#g}=6lvBa*ZI4=%2Vqv)>cB82H@@F5#F&qMsAq6 z`bd5C)abF=vxS_bkdn*ffHTp3?Qi!q;!y*B^2dcu;a`Bcgg5 zUsn9iR~1Cn7iEMuWn6#91-$xE z&;vIe*hRfd?tq>B-C=fa;qOlJxd4%+)8UqN63ll?k$iM_Dyaoyio?IMKg;^f8C>*y z1+|s`e!9wa%Y=fvl5YIDVq9odwFJlX2C2E0WLRRRyZJ69aKnabcuQcdF}bkO_H|bz zodTU}4RlwOcjIZ8DaFAdiOoIroR^rv7sr?3zpgnR9<`a2X^%IyxaY_@YL`0VXcZpT z&fu4}-m5TtkBI#nGd;OFRlgTs>hZLMHn3lvccrHzqG5^wiWwCv)GK|iGB2-uDx8}?#SF?TEE7d+5 za6cbAw{!fndGpDxUsnGDBS?#mwBHR%KG#}=^%>~o`WBYl|B2BE)=LBb7W=4Z0)qTA z)NA`aegCN^_KdG}v|4ldMOD0!6_F?VtwQ-Dzw=gEpyYuqy-EMuEi3iI>4g^Q#*eDP zJ}<$A{bi)F-tn%b$iBer; zy}FA!yGSRwM5Iq)MKlm?bNr|1{hiOD*ri!|g$pi)S@B0$(uXCUMV;D3H^B8u6<;LM zMWFV=pJaQ%_abUV(DiHV1H}&w5!*%U-mDtGPKY{n$tyqQVeQAR}Uuw<|~3`2Y>{G zF1U|=do7y59|Fq`c%%5z)Eli4LxrzQp#1u-%DD&7SXCI#J-M}}(fd1x?$UF^t zV?e=D*6pcmdPGiaamup;6gM$P+V>exQ`jjnw6J6L?{!evH%~Dq`zLn}3r{XBB$GP_ zCgYp`#V2CjhlB4AO65=Tr6yLDCe$1$j}Dj5wFKqjp;gDgqzE~j%6U2VAR9JAS&t5e zrLisn*|KSPU4WxHh=X$ILqt)mP!Sg;pVheV5l@lBpM3Qu(72TK+CbsBLs5)S(Ue&M zmg-xe$_?|_D5~fK31aCA*$@~GiX`T!^Yi}gOXTp6lP4BSX#+;*Q1aN6#2#8@X^@Q! zA@h_~iho&A; z!3)5c_R8cgdOR}^9pNdSfo&$kQM&Y0gEQ3YXlP%+r)FK~))3FEiHS4QdHRfK`kaYLWDc!BcjZw6I~7=2M$k zn3nvz)}V~u&gX19W`S;bINf3k#Op1|hRGUN`tSVr{4~NG$8hD1id7d+4RTKfX&sYh+$-OgW zBd|%9ooWnb^rV-r_DQayH*P-iXilW7cJ^xWPkYlT4*sQvl^~2us9~9JFOl#0wER`h zZHlI&W!Ft&QSs!Ah^T)86bv0P2KHg*H%B zJl&?W<*qMynfMkxYqRyFeX;2(M|u04BCXGtfI#KkS^IdzXx-n5@K*bXs4LMWW6^nhyX(lK)caEAr3P?)pmTMzo7o&3j_A>_=ysB*dN9;8NY^#Pm;ps) z*kfCLZjxa+G=%-=Rye(*MDI~u_i^{zAPH3{b@Ww-UIHV8q-dPD46n5X=m?8+MowL{ z?XAHL^huHZj%n?#60g#bwV6md>6m^ll~(81jX16##h7l%!q#YIx63u@t=_PL@|q&# z0QNy&$7YW`ejvgrGrAm%abk6iHOVS6Ld+!VMB zMS-8wP^c!+A@w0|ee!QwrQ4xaSWa0=C6fzDIJ-uBrt)?frxoR$WFe=yW$0~ZlI2{b zM{M2gNlvEh`kQ5(54UX`=IT?;Iqzq9c~x*ea8C2csnvRtM(~^Pkon+rh0|FyU22!q zu9WFJ!-+BW*>y}ltAv^vYGS}uC0;18m25&(jm(_{LF*0ZyQt+=DW+>9)_Z7T~( z^85?n$y}x1#c>+4dkg&-EOt7!cA9>4I%;65Y$)F6<}^K|TFZF|nKLd|HFVed4QJKx z4=3>PZ0^UoR+HuyP5dwe)qlo05}4YynXm+}MJBBwJ#8?c@BvNa;oHxAdK}{5w{$P0 zD7d$6wG!n%>zCy}JuG!&m=-eMXFnd*PlP&Ws-DuDiUeCSim3=srf1-i!~o&u7!Cj6 zEHXE^7|Lk8#6Rcx00Tk~rjZ8Vr!O82>0Woq6=x2Y`1NO#dUECVJE1vCOMly1NS%yT zo#4|R(`K;4(t%s@v$4c7+W8g2dYSj#a-8jS`*ybCR~U3OBE7t3=MCkU{i@DE#2IPO zkQtAZS^l=RK<~Iz*0j9i)0wossU((oJBNs5blI7IDuYw!1#x=1kQD-%&boinY}MS9)}+NY0us!a3Bh} z_0{HLBN%AtHpk>y5)G<&ZAjMB`|E+5N?=*bk`2jA{RRCO%c^3FSimsP_c(I~Nrw~zX$O{W zAm(8~^s*283G|%!p z2>9|2)cm+BnM{A2>9?*3s_}fim$~G8Kg=8Ro{fB~LUBCJ0Ng)r{jJu1_^=>RDn}Br z$xL-zj1q03GtQ|wWUa@=B}<~1E`u!3_hhWT=Dp3Ae4Y7aK7tlfOrN?*V?+WMB^06*Xo1&yOz#1dPxkTp)yGSPJQ*xAX63 zER*j1lh+I;{j3gBD*;!Roacl|cT|rL@014$?TfB_eraw|Y96=nQ<80oN;3s)4+&tR4KOaI1ZliLDX_Jr7=PA|=2LZy-jT63-smUG3uN45p z8`_%hE)JwX_nXTdr1^(aK%I^upP0^$bST53UMQQWdbWawjmSXUkO@q|M|m8DTE8C7 z0J;{eeZyQ2GZqYxF+e+MWC^78AkCLQTQr@yHs76gv$DUA_F~F7%A*Z;(U_W~dE3<5 zD!^Hz<(?=TZYh_yPwYyHqJ5WW0AE1PfZ~0yLetGx*oljOYRKU>XF+y-G4*q3jA%%+ z+0EBq-@f&uN{QaWaK_7+3Q{cMz4f54?!P*nwGmeTcibltU8 ze<&F~?K`?Mt>wCKq+G->rR0#jeOjjT;jyPbm7aWY2^JoezZ35I8N&k;cgd$om#Zi| zM900#2{bXYX)kWl6+!NUzS5V2BWWHru%L=}YhyxqcIkrTgSIg&8VH#d&b-uJ@wI0G z()^8oW{N}RphDGs@pPv!ba4Togg9H8g$cRa(_OscoQZA~MgVOC_2)(rs(S;o#U2x3 zt>vXdkh5^T0Qg<8Kv5ACmsqZ}mWs%r{}8W3+o|tt-!bTCuxg?JwVvy}t`=$l2Z22^ z!up>&*7yd*^+lB6+9miH#`-*Szg5+`kOhZx$+~a`Sd&WM*o^u{IiBan6?=c#FNE!E z#Jnv-bP(*bTyTsPjwAZOZ;vjJCN$?sci1 z05qEj?xn8ZD~8SNf_Ehw@m4M$@&xX9Ke_mN$4=Q+$IZU|mcFWBU~SN%xTB3Ugo@+u z*eh=s_$uVW`6<0mSA|w+)?&6Nu$HSv^V}N?#7lG)qxT|&NxP4}t=s67%Fg(yMRJeU zTQecyAObN@K$c6uc42S&!h5Gi+Lw$_X=z9#PsFE$*-ablo!{u9+DCI=O+*q2Ne!Xa zQ3`5iY88B-E2qDisyO(g$_N-?Qi(w0deH|cCx_uJhKaI#}RnZ9C z_gPn`e>_H1BL;#SVSz9PhDd$eSCCISZU~qS$ojF3SN5uqtoWxQcT?3MZ=(REFe@&z zU_j{XDE|Zw`gS7-IOpBNAnR+j)|6ezAr*XGqw2ch0QNkrxRm*Zdw2%nX7*_{nP^;> zAo!w)lfL7f1uW=uS&~RjkQ2&C%NTLp$xM?a*jn2P8gQQ|og{7YUhbl3UZgD>QU1d+ z-Laf^6C*1&Tbpf+ahvw`sq=E3^+%ITS_( zdfQ@~QJ&X@?)~M7XA9n~K5K0ob!oyju$b+;rZ=VNy82DM?L~hxCUYE)J$%HWP$!i( z_{(t0gpT=u8z#CxkY&frFuD+C5~q&MLw}=n?^y<}0R*2(B{W1+{v5BFt!SsiP|&2@ z*#k}8qg$nCWi`>Utv^;?%oh#kt`V|_x;h0mjfVCi3X$WsVG4|?eWDGuXKi;^wb^B9 zpDe-C8}PcP#QY7u{k?|jyLlerbNMd5ubY;P!YmJ2;Rw4 zzE;qDxan4`BGLA&LFk!X4*6Q+WrWC^HaN^}W=ea5(Qw8&fAU6rre%d=XH?kCvrUqC z8?sTtSnA2{joV2n+YiSJLZ@%k&(10DKfoVCVeYpRsxpQf@K2<)eBa#pRnPe-;#1nf z`*2Y3R1o63co-bjrk0d0UqsLs)%r!j_-5XhINRr>K@dCF6FgA)H>jM@IT;M&w1rp_ z7p(bQrwT(xYnUFZ3o9L|vG>4kw$yIj6Ss&Nxbs1k?b&+Q4_|?I6atH-v+fg#KQYXD zc7dO5o%M=A&82n@ei21#DBsp%SD-XEgx~%%E|(kSl(dS$QQEIJkRg0@?4*(+OLN)SBVQmf=A z^RJ=OlS*{3J5hGxF(DY}K_F%;S?$G<1{HpOQSvN0sVxWyvL0|g zmX%hrOvQLBU2=TqUL@moPhMQ?W^3k8*-I*G_P>5ti<|l9usA#2yZD5Hy!R_KZ`;Z4 z?zNE}Ms@Xje^;b+rrS){YxQLRI?GTW&iV}9(Ydr61ZLj~G+G7dQx^NM;-;fBccM~@ z%I$b|rd5v$MeV3ZmO>YFea=HR8+schABu{@>iF(K&=l$KIekyA{|Nb2t#f)Z9Xd8${i>QE$mFEO zsrngCvhgr6*(G=#W}#pBju)tTlpd0%_NB>G zNQg{pDwhcLn!Pz!AT2U8iFxi6F6i_qXJ2(w>qS=I)%-yP`r`#_I;AnuJ03k3=l5Qo zk@@geayOQ7ezWP0Tp}mppejojW? zs;eWfUicmIf2p+{zVt&*rR$t(q#_ecy}N^k1`FU$sh^y*5m`IF z)pX)4M20Y$XWd_Fm3IzScj`B5(6n{okzM#@O~a>WXy9rp;~H1kx(#Q$uCjGs`_W}0 z)UDsub!AKQ8dB3NsQad^)^(xoeG>MnX1Dorr>4YNJqwMtCtdzxB2}yx3dk3<6Y3Pk zy9FdPb~LoBL$hq~YL;$Y&saN3Ts!!YIlNthKxp@4puTEj)V3?s zNrxJ$(i@!K`xvhqEKdVd^k=oF;X}5>3iZdy_s47YCz$pp+V&^8_a_JSrzG@~^7~V3 z`_sDm)5rTWmise*^e5LsIo62G@ZLbhws=MTd^WWNUHy3bfjDpdxX^*v6#dxZfzSs1 zatr+ed|0_Dyb=#5Yr?DK2P%T}Yg7hbX&RJR7?e60lsz4c!59eG4m6DG*L4lL-qNp5 zA8e@|tUMYdBZsO^4OI^r6iMKl$_G0&@jdv#?q&VH$f15Ge1AE9z}BF52tR01@Kyrf zI*xyhywY&$O5@Q`7wpQrS^SX2@ZeMY2evB{kyj>#u1v`fzi&2}feDO^56|WgH_vQc zY3sVObaZ9GefXowyAPW0R?>%;oeWo>8m=U~TPq*_BxJaG#5dn%*m26RearAG(r{*B|@sYpFBhjTJ$1n=OPJswh zp!X`M@)X#03hg}#od<&5 + echo $ECHO_N "checking for /sw/lib... $ECHO_C" >&6 +@@ -2505,9 +2500,6 @@ fi + fi + echo "$as_me:2506: result: $ac_cv_file__usr_pkg_lib" >&5 + echo "${ECHO_T}$ac_cv_file__usr_pkg_lib" >&6 +-if test $ac_cv_file__usr_pkg_lib = yes; then +- LDFLAGS="$LDFLAGS -L/usr/pkg/lib" +-fi + + echo "$as_me:2512: checking for /usr/pkg/include" >&5 + echo $ECHO_N "checking for /usr/pkg/include... $ECHO_C" >&6 +@@ -3092,9 +3084,6 @@ fi + fi + echo "$as_me:3093: result: $ac_cv_file__usr_local_pgsql_lib" >&5 + echo "${ECHO_T}$ac_cv_file__usr_local_pgsql_lib" >&6 +-if test $ac_cv_file__usr_local_pgsql_lib = yes; then +- LDFLAGS="$LDFLAGS -L/usr/local/pgsql/lib" +-fi + + echo "$as_me:3099: checking for /usr/local/pgsql/include" >&5 + echo $ECHO_N "checking for /usr/local/pgsql/include... $ECHO_C" >&6 diff --git a/utils/bandwidthd/patches/100-fix_config_file_location b/utils/bandwidthd/patches/100-fix_config_file_location new file mode 100644 index 0000000..ae44cd2 --- /dev/null +++ b/utils/bandwidthd/patches/100-fix_config_file_location @@ -0,0 +1,31 @@ +--- bandwidthd-2.0.1/bandwidthd.c.orig 2008-05-09 10:06:37.000000000 -0500 ++++ bandwidthd-2.0.1/bandwidthd.c 2008-05-09 10:32:54.000000000 -0500 +@@ -255,22 +255,22 @@ + + openlog("bandwidthd", LOG_CONS, LOG_DAEMON); + +- if (stat("./etc/bandwidthd.conf", &StatBuf)) ++ if (stat("/etc/bandwidthd.conf", &StatBuf)) + { + chdir(INSTALL_DIR); +- if (stat("./etc/bandwidthd.conf", &StatBuf)) ++ if (stat("/etc/bandwidthd.conf", &StatBuf)) + { +- printf("Cannot find ./etc/bandwidthd.conf or %s/etc/bandwidthd.conf\n", INSTALL_DIR); +- syslog(LOG_ERR, "Cannot find ./etc/bandwidthd.conf or %s/etc/bandwidthd.conf", INSTALL_DIR); ++ printf("Cannot find /etc/bandwidthd.conf or %s/etc/bandwidthd.conf\n", INSTALL_DIR); ++ syslog(LOG_ERR, "Cannot find /etc/bandwidthd.conf or %s/etc/bandwidthd.conf", INSTALL_DIR); + exit(1); + } + } + +- bdconfig_in = fopen("./etc/bandwidthd.conf", "rt"); ++ bdconfig_in = fopen("/etc/bandwidthd.conf", "rt"); + if (!bdconfig_in) + { + syslog(LOG_ERR, "Cannot open bandwidthd.conf"); +- printf("Cannot open ./etc/bandwidthd.conf\n"); ++ printf("Cannot open /etc/bandwidthd.conf\n"); + exit(1); + } + bdconfig_parse(); diff --git a/utils/banhosts/Makefile b/utils/banhosts/Makefile new file mode 100644 index 0000000..0087a6f --- /dev/null +++ b/utils/banhosts/Makefile @@ -0,0 +1,40 @@ +# +# Copyright (C) 2015 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:=banhostlist +PKG_VERSION:=1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_MAINTAINER:=Matteo Croce +PKG_LICENCE:=GPL-2.0 + +include $(INCLUDE_DIR)/package.mk + +define Package/banhostlist + SECTION:=utils + CATEGORY:=Utilities + TITLE:=List of advertising domains + URL:=http://winhelp2002.mvps.org/ +endef + +define Package/banhostlist/description +List of domains serving advertising and malicious content to easily block them +endef + + +define Build/Compile/Default +endef + +define Package/banhostlist/install + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) ./files/updatebanhost $(1)/etc/hotplug.d/iface/80-banhosts +endef + +$(eval $(call BuildPackage,banhostlist)) diff --git a/utils/banhosts/files/updatebanhost b/utils/banhosts/files/updatebanhost new file mode 100644 index 0000000..a00d9cb --- /dev/null +++ b/utils/banhosts/files/updatebanhost @@ -0,0 +1,19 @@ +#!/bin/sh + +file=/tmp/banhost + +gethosts() { + logger -t "banhost[$$]" "Update $file" + wget -qO- http://winhelp2002.mvps.org/hosts.txt |awk 'BEGIN{printf "0.0.0.0"}/^0\.0\.0\.0/{printf " "$2}END{exit(!FNR)}' >$file || exit 1 + echo -n $time >$file.time + exec killall -HUP dnsmasq +} + +if [ "$ACTION" = ifup -a "$INTERFACE" = wan ]; then + read time + +PKG_CHECK_FORMAT_SECURITY:=0 +include $(INCLUDE_DIR)/package.mk + +define Package/bash + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Shells + TITLE:=The GNU Bourne Again SHell + DEPENDS:=+libncurses + URL:=http://www.gnu.org/software/bash/ +endef + +define Package/bash/description + Bash is an sh-compatible command language interpreter that executes + commands read from the standard input or from a file. Bash also + incorporates useful features from the Korn and C shells (ksh and csh). +endef + + +define Build/Configure + $(call Build/Configure/Default, \ + --without-bash-malloc \ + --bindir=/bin \ + ) +endef + + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR)/builtins LDFLAGS_FOR_BUILD= mkbuiltins + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + SHELL="/bin/bash" \ + all install +endef + +define Package/bash/postinst +#!/bin/sh +grep bash $${IPKG_INSTROOT}/etc/shells || \ + echo "/bin/bash" >> $${IPKG_INSTROOT}/etc/shells + echo "/bin/rbash" >> $${IPKG_INSTROOT}/etc/shells +endef + +define Package/bash/install + $(INSTALL_DIR) $(1)/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/bash $(1)/bin/ + ln -sf bash $(1)/bin/rbash +endef + + +$(eval $(call BuildPackage,bash)) diff --git a/utils/bash/patches/001-compile-fix.patch b/utils/bash/patches/001-compile-fix.patch new file mode 100644 index 0000000..7efa97b --- /dev/null +++ b/utils/bash/patches/001-compile-fix.patch @@ -0,0 +1,15 @@ +--- a/execute_cmd.c ++++ b/execute_cmd.c +@@ -2369,7 +2369,11 @@ execute_pipeline (command, asynchronous, + /* If the `lastpipe' option is set with shopt, and job control is not + enabled, execute the last element of non-async pipelines in the + current shell environment. */ +- if (lastpipe_opt && job_control == 0 && asynchronous == 0 && pipe_out == NO_PIPE && prev > 0) ++ if (lastpipe_opt && ++#if defined(JOB_CONTROL) ++ job_control == 0 && ++#endif ++ asynchronous == 0 && pipe_out == NO_PIPE && prev > 0) + { + lstdin = move_to_high_fd (0, 1, -1); + if (lstdin > 0) diff --git a/utils/bash/patches/002-force-internal-readline.patch b/utils/bash/patches/002-force-internal-readline.patch new file mode 100644 index 0000000..050e476 --- /dev/null +++ b/utils/bash/patches/002-force-internal-readline.patch @@ -0,0 +1,24 @@ +--- a/configure ++++ b/configure +@@ -5430,8 +5430,7 @@ if test $opt_readline = yes; then + # static version specified as -llibname to override the + # dynamic version + case "${host_os}" in +- darwin[89]*|darwin10*) READLINE_LIB='${READLINE_LIBRARY}' ;; +- *) READLINE_LIB=-lreadline ;; ++ *) READLINE_LIB='${READLINE_LIBRARY}' ;; + esac + fi + else +--- a/configure.ac ++++ b/configure.ac +@@ -578,8 +578,7 @@ if test $opt_readline = yes; then + # static version specified as -llibname to override the + # dynamic version + case "${host_os}" in +- darwin[[89]]*|darwin10*) READLINE_LIB='${READLINE_LIBRARY}' ;; +- *) READLINE_LIB=-lreadline ;; ++ *) READLINE_LIB='${READLINE_LIBRARY}' ;; + esac + fi + else diff --git a/utils/bash/patches/101-upstream-bash43-001.patch b/utils/bash/patches/101-upstream-bash43-001.patch new file mode 100644 index 0000000..3231273 --- /dev/null +++ b/utils/bash/patches/101-upstream-bash43-001.patch @@ -0,0 +1,49 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-001 + +Bug-Reported-by: NBaH +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-02/msg00092.html + +Bug-Description: + +A missing check for a valid option prevented `test -R' from working. There +is another problem that causes bash to look up the wrong variable name when +processing the argument to `test -R'. + +Patch (apply with `patch -p0'): + +--- a/test.c ++++ b/test.c +@@ -646,8 +646,8 @@ unary_test (op, arg) + return (v && invisible_p (v) == 0 && var_isset (v) ? TRUE : FALSE); + + case 'R': +- v = find_variable (arg); +- return (v && invisible_p (v) == 0 && var_isset (v) && nameref_p (v) ? TRUE : FALSE); ++ v = find_variable_noref (arg); ++ return ((v && invisible_p (v) == 0 && var_isset (v) && nameref_p (v)) ? TRUE : FALSE); + } + + /* We can't actually get here, but this shuts up gcc. */ +@@ -723,6 +723,7 @@ test_unop (op) + case 'o': case 'p': case 'r': case 's': case 't': + case 'u': case 'v': case 'w': case 'x': case 'z': + case 'G': case 'L': case 'O': case 'S': case 'N': ++ case 'R': + return (1); + } + +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 0 ++#define PATCHLEVEL 1 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/102-upstream-bash43-002.patch b/utils/bash/patches/102-upstream-bash43-002.patch new file mode 100644 index 0000000..35421e8 --- /dev/null +++ b/utils/bash/patches/102-upstream-bash43-002.patch @@ -0,0 +1,49 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-002 + +Bug-Reported-by: Moe Tunes +Bug-Reference-ID: <53103F49.3070100@gmail.com> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-02/msg00086.html + +Bug-Description: + +A change to save state while running the DEBUG trap caused pipelines to hang +on systems which need process group synchronization while building pipelines. + +Patch (apply with `patch -p0'): + +--- a/trap.c ++++ b/trap.c +@@ -920,7 +920,8 @@ _run_trap_internal (sig, tag) + subst_assign_varlist = 0; + + #if defined (JOB_CONTROL) +- save_pipeline (1); /* XXX only provides one save level */ ++ if (sig != DEBUG_TRAP) /* run_debug_trap does this */ ++ save_pipeline (1); /* XXX only provides one save level */ + #endif + + /* If we're in a function, make sure return longjmps come here, too. */ +@@ -940,7 +941,8 @@ _run_trap_internal (sig, tag) + trap_exit_value = last_command_exit_value; + + #if defined (JOB_CONTROL) +- restore_pipeline (1); ++ if (sig != DEBUG_TRAP) /* run_debug_trap does this */ ++ restore_pipeline (1); + #endif + + subst_assign_varlist = save_subst_varlist; +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 1 ++#define PATCHLEVEL 2 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/103-upstream-bash43-003.patch b/utils/bash/patches/103-upstream-bash43-003.patch new file mode 100644 index 0000000..7c9e56b --- /dev/null +++ b/utils/bash/patches/103-upstream-bash43-003.patch @@ -0,0 +1,39 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-003 + +Bug-Reported-by: Anatol Pomozov +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-readline/2014-03/msg00010.html + +Bug-Description: + +When in callback mode, some readline commands can cause readline to seg +fault by passing invalid contexts to callback functions. + +Patch (apply with `patch -p0'): + +--- a/lib/readline/readline.c ++++ b/lib/readline/readline.c +@@ -744,7 +744,8 @@ _rl_dispatch_callback (cxt) + r = _rl_subseq_result (r, cxt->oldmap, cxt->okey, (cxt->flags & KSEQ_SUBSEQ)); + + RL_CHECK_SIGNALS (); +- if (r == 0) /* success! */ ++ /* We only treat values < 0 specially to simulate recursion. */ ++ if (r >= 0 || (r == -1 && (cxt->flags & KSEQ_SUBSEQ) == 0)) /* success! or failure! */ + { + _rl_keyseq_chain_dispose (); + RL_UNSETSTATE (RL_STATE_MULTIKEY); +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 2 ++#define PATCHLEVEL 3 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/104-upstream-bash43-004.patch b/utils/bash/patches/104-upstream-bash43-004.patch new file mode 100644 index 0000000..40ac35f --- /dev/null +++ b/utils/bash/patches/104-upstream-bash43-004.patch @@ -0,0 +1,38 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-004 + +Bug-Reported-by: Daan van Rossum +Bug-Reference-ID: <20140307072523.GA14250@flash.uchicago.edu> +Bug-Reference-URL: + +Bug-Description: + +The `.' command in vi mode cannot undo multi-key commands beginning with +`c', `d', and `y' (command plus motion specifier). + +Patch (apply with `patch -p0'): + +--- a/lib/readline/readline.c ++++ b/lib/readline/readline.c +@@ -965,7 +965,7 @@ _rl_dispatch_subseq (key, map, got_subse + #if defined (VI_MODE) + if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap && + key != ANYOTHERKEY && +- rl_key_sequence_length == 1 && /* XXX */ ++ _rl_dispatching_keymap == vi_movement_keymap && + _rl_vi_textmod_command (key)) + _rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign); + #endif +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 3 ++#define PATCHLEVEL 4 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/105-upstream-bash43-005.patch b/utils/bash/patches/105-upstream-bash43-005.patch new file mode 100644 index 0000000..1cc5473 --- /dev/null +++ b/utils/bash/patches/105-upstream-bash43-005.patch @@ -0,0 +1,50 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-005 + +Bug-Reported-by: David Sines +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-03/msg00037.html + +Bug-Description: + +When in Posix mode, bash did not correctly interpret the ANSI-C-style +$'...' quoting mechanism when performing pattern substitution word +expansions within double quotes. + +Patch (apply with `patch -p0'): + +--- a/parse.y ++++ b/parse.y +@@ -3398,7 +3398,7 @@ parse_matched_pair (qc, open, close, len + within a double-quoted ${...} construct "an even number of + unescaped double-quotes or single-quotes, if any, shall occur." */ + /* This was changed in Austin Group Interp 221 */ +- if MBTEST(posixly_correct && shell_compatibility_level > 41 && dolbrace_state != DOLBRACE_QUOTE && (flags & P_DQUOTE) && (flags & P_DOLBRACE) && ch == '\'') ++ if MBTEST(posixly_correct && shell_compatibility_level > 41 && dolbrace_state != DOLBRACE_QUOTE && dolbrace_state != DOLBRACE_QUOTE2 && (flags & P_DQUOTE) && (flags & P_DOLBRACE) && ch == '\'') + continue; + + /* Could also check open == '`' if we want to parse grouping constructs +--- a/y.tab.c ++++ b/y.tab.c +@@ -5710,7 +5710,7 @@ parse_matched_pair (qc, open, close, len + within a double-quoted ${...} construct "an even number of + unescaped double-quotes or single-quotes, if any, shall occur." */ + /* This was changed in Austin Group Interp 221 */ +- if MBTEST(posixly_correct && shell_compatibility_level > 41 && dolbrace_state != DOLBRACE_QUOTE && (flags & P_DQUOTE) && (flags & P_DOLBRACE) && ch == '\'') ++ if MBTEST(posixly_correct && shell_compatibility_level > 41 && dolbrace_state != DOLBRACE_QUOTE && dolbrace_state != DOLBRACE_QUOTE2 && (flags & P_DQUOTE) && (flags & P_DOLBRACE) && ch == '\'') + continue; + + /* Could also check open == '`' if we want to parse grouping constructs +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 4 ++#define PATCHLEVEL 5 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/106-upstream-bash43-006.patch b/utils/bash/patches/106-upstream-bash43-006.patch new file mode 100644 index 0000000..c5f52b1 --- /dev/null +++ b/utils/bash/patches/106-upstream-bash43-006.patch @@ -0,0 +1,39 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-006 + +Bug-Reported-by: Eduardo A . Bustamante Lopez +Bug-Reference-ID: <20140228170013.GA16015@dualbus.me> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-02/msg00091.html + +Bug-Description: + +A shell that started with job control active but was not interactive left +the terminal in the wrong process group when exiting, causing its parent +shell to get a stop signal when it attempted to read from the terminal. + +Patch (apply with `patch -p0'): + +--- a/jobs.c ++++ b/jobs.c +@@ -4374,7 +4374,7 @@ without_job_control () + void + end_job_control () + { +- if (interactive_shell) /* XXX - should it be interactive? */ ++ if (interactive_shell || job_control) /* XXX - should it be just job_control? */ + { + terminate_stopped_jobs (); + +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 5 ++#define PATCHLEVEL 6 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/107-upstream-bash43-007.patch b/utils/bash/patches/107-upstream-bash43-007.patch new file mode 100644 index 0000000..8578bd4 --- /dev/null +++ b/utils/bash/patches/107-upstream-bash43-007.patch @@ -0,0 +1,45 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-007 + +Bug-Reported-by: geir.hauge@gmail.com +Bug-Reference-ID: <20140318093650.B181C1C5B0B@gina.itea.ntnu.no> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-03/msg00095.html + +Bug-Description: + +Using compound assignments for associative arrays like + +assoc=( [x]= [y]=bar ) + +left the value corresponding to the key `x' NULL. This caused subsequent +lookups to interpret it as unset. + +Patch (apply with `patch -p0'): + +--- a/arrayfunc.c ++++ b/arrayfunc.c +@@ -597,6 +597,11 @@ assign_compound_array_list (var, nlist, + if (assoc_p (var)) + { + val = expand_assignment_string_to_string (val, 0); ++ if (val == 0) ++ { ++ val = (char *)xmalloc (1); ++ val[0] = '\0'; /* like do_assignment_internal */ ++ } + free_val = 1; + } + +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 6 ++#define PATCHLEVEL 7 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/108-upstream-bash43-008.patch b/utils/bash/patches/108-upstream-bash43-008.patch new file mode 100644 index 0000000..2402021 --- /dev/null +++ b/utils/bash/patches/108-upstream-bash43-008.patch @@ -0,0 +1,148 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-008 + +Bug-Reported-by: Stephane Chazelas +Bug-Reference-ID: <20140318135901.GB22158@chaz.gmail.com> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-03/msg00098.html + +Bug-Description: + +Some extended glob patterns incorrectly matched filenames with a leading +dot, regardless of the setting of the `dotglob' option. + +Patch (apply with `patch -p0'): + +--- a/lib/glob/gmisc.c ++++ b/lib/glob/gmisc.c +@@ -210,6 +210,7 @@ extglob_pattern_p (pat) + case '+': + case '!': + case '@': ++ case '?': + return (pat[1] == LPAREN); + default: + return 0; +--- a/lib/glob/glob.c ++++ b/lib/glob/glob.c +@@ -179,42 +179,50 @@ extglob_skipname (pat, dname, flags) + char *pat, *dname; + int flags; + { +- char *pp, *pe, *t; +- int n, r; ++ char *pp, *pe, *t, *se; ++ int n, r, negate; + ++ negate = *pat == '!'; + pp = pat + 2; +- pe = pp + strlen (pp) - 1; /*(*/ +- if (*pe != ')') +- return 0; +- if ((t = strchr (pp, '|')) == 0) /* easy case first */ ++ se = pp + strlen (pp) - 1; /* end of string */ ++ pe = glob_patscan (pp, se, 0); /* end of extglob pattern (( */ ++ /* we should check for invalid extglob pattern here */ ++ /* if pe != se we have more of the pattern at the end of the extglob ++ pattern. Check the easy case first ( */ ++ if (pe == se && *pe == ')' && (t = strchr (pp, '|')) == 0) + { + *pe = '\0'; ++#if defined (HANDLE_MULTIBYTE) ++ r = mbskipname (pp, dname, flags); ++#else + r = skipname (pp, dname, flags); /*(*/ ++#endif + *pe = ')'; + return r; + } ++ ++ /* check every subpattern */ + while (t = glob_patscan (pp, pe, '|')) + { + n = t[-1]; + t[-1] = '\0'; ++#if defined (HANDLE_MULTIBYTE) ++ r = mbskipname (pp, dname, flags); ++#else + r = skipname (pp, dname, flags); ++#endif + t[-1] = n; + if (r == 0) /* if any pattern says not skip, we don't skip */ + return r; + pp = t; + } /*(*/ + +- if (pp == pe) /* glob_patscan might find end of pattern */ ++ /* glob_patscan might find end of pattern */ ++ if (pp == se) + return r; + +- *pe = '\0'; +-# if defined (HANDLE_MULTIBYTE) +- r = mbskipname (pp, dname, flags); /*(*/ +-# else +- r = skipname (pp, dname, flags); /*(*/ +-# endif +- *pe = ')'; +- return r; ++ /* but if it doesn't then we didn't match a leading dot */ ++ return 0; + } + #endif + +@@ -277,20 +285,23 @@ wextglob_skipname (pat, dname, flags) + int flags; + { + #if EXTENDED_GLOB +- wchar_t *pp, *pe, *t, n; +- int r; ++ wchar_t *pp, *pe, *t, n, *se; ++ int r, negate; + ++ negate = *pat == L'!'; + pp = pat + 2; +- pe = pp + wcslen (pp) - 1; /*(*/ +- if (*pe != L')') +- return 0; +- if ((t = wcschr (pp, L'|')) == 0) ++ se = pp + wcslen (pp) - 1; /*(*/ ++ pe = glob_patscan_wc (pp, se, 0); ++ ++ if (pe == se && *pe == ')' && (t = wcschr (pp, L'|')) == 0) + { + *pe = L'\0'; + r = wchkname (pp, dname); /*(*/ + *pe = L')'; + return r; + } ++ ++ /* check every subpattern */ + while (t = glob_patscan_wc (pp, pe, '|')) + { + n = t[-1]; +@@ -305,10 +316,8 @@ wextglob_skipname (pat, dname, flags) + if (pp == pe) /* glob_patscan_wc might find end of pattern */ + return r; + +- *pe = L'\0'; +- r = wchkname (pp, dname); /*(*/ +- *pe = L')'; +- return r; ++ /* but if it doesn't then we didn't match a leading dot */ ++ return 0; + #else + return (wchkname (pat, dname)); + #endif +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 7 ++#define PATCHLEVEL 8 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/109-upstream-bash43-009.patch b/utils/bash/patches/109-upstream-bash43-009.patch new file mode 100644 index 0000000..f222bd6 --- /dev/null +++ b/utils/bash/patches/109-upstream-bash43-009.patch @@ -0,0 +1,51 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-009 + +Bug-Reported-by: Matthias Klose +Bug-Reference-ID: <53346FC8.6090005@debian.org> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-03/msg00171.html + +Bug-Description: + +There is a problem with unsigned sign extension when attempting to reallocate +the input line when it is fewer than 3 characters long and there has been a +history expansion. The sign extension causes the shell to not reallocate the +line, which results in a segmentation fault when it writes past the end. + +Patch (apply with `patch -p0'): + +--- a/parse.y ++++ b/parse.y +@@ -2424,7 +2424,7 @@ shell_getc (remove_quoted_newline) + not already end in an EOF character. */ + if (shell_input_line_terminator != EOF) + { +- if (shell_input_line_size < SIZE_MAX && shell_input_line_len > shell_input_line_size - 3) ++ if (shell_input_line_size < SIZE_MAX-3 && (shell_input_line_len+3 > shell_input_line_size)) + shell_input_line = (char *)xrealloc (shell_input_line, + 1 + (shell_input_line_size += 2)); + +--- a/y.tab.c ++++ b/y.tab.c +@@ -4736,7 +4736,7 @@ shell_getc (remove_quoted_newline) + not already end in an EOF character. */ + if (shell_input_line_terminator != EOF) + { +- if (shell_input_line_size < SIZE_MAX && shell_input_line_len > shell_input_line_size - 3) ++ if (shell_input_line_size < SIZE_MAX-3 && (shell_input_line_len+3 > shell_input_line_size)) + shell_input_line = (char *)xrealloc (shell_input_line, + 1 + (shell_input_line_size += 2)); + +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 8 ++#define PATCHLEVEL 9 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/110-upstream-bash43-010.patch b/utils/bash/patches/110-upstream-bash43-010.patch new file mode 100644 index 0000000..22d9f1b --- /dev/null +++ b/utils/bash/patches/110-upstream-bash43-010.patch @@ -0,0 +1,145 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-010 + +Bug-Reported-by: Albert Shih +Bug-Reference-ID: Wed, 5 Mar 2014 23:01:40 +0100 +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-03/msg00028.html + +Bug-Description: + +Patch (apply with `patch -p0'): + +This patch changes the behavior of programmable completion to compensate +for two assumptions made by the bash-completion package. Bash-4.3 changed +to dequote the argument to programmable completion only under certain +circumstances, to make the behavior of compgen more consistent when run +from the command line -- closer to the behavior when run by a shell function +run as part of programmable completion. Bash-completion can pass quoted +arguments to compgen when the original word to be completed was not quoted, +expecting programmable completion to dequote the word before attempting +completion. + +This patch fixes two cases: + +1. An empty string that bash-completion passes to compgen as a quoted null + string (''). + +2. An unquoted word that bash-completion quotes using single quotes or + backslashes before passing it to compgen. + +In these cases, since readline did not detect a quote character in the original +word to be completed, bash-4.3 + +--- a/externs.h ++++ b/externs.h +@@ -324,6 +324,7 @@ extern char *sh_un_double_quote __P((cha + extern char *sh_backslash_quote __P((char *, const char *, int)); + extern char *sh_backslash_quote_for_double_quotes __P((char *)); + extern int sh_contains_shell_metas __P((char *)); ++extern int sh_contains_quotes __P((char *)); + + /* declarations for functions defined in lib/sh/spell.c */ + extern int spname __P((char *, char *)); +--- a/lib/sh/shquote.c ++++ b/lib/sh/shquote.c +@@ -311,3 +311,17 @@ sh_contains_shell_metas (string) + + return (0); + } ++ ++int ++sh_contains_quotes (string) ++ char *string; ++{ ++ char *s; ++ ++ for (s = string; s && *s; s++) ++ { ++ if (*s == '\'' || *s == '"' || *s == '\\') ++ return 1; ++ } ++ return 0; ++} +--- a/pcomplete.c ++++ b/pcomplete.c +@@ -183,6 +183,7 @@ ITEMLIST it_variables = { LIST_DYNAMIC, + + COMPSPEC *pcomp_curcs; + const char *pcomp_curcmd; ++const char *pcomp_curtxt; + + #ifdef DEBUG + /* Debugging code */ +@@ -753,6 +754,32 @@ pcomp_filename_completion_function (text + quoted strings. */ + dfn = (*rl_filename_dequoting_function) ((char *)text, rl_completion_quote_character); + } ++ /* Intended to solve a mismatched assumption by bash-completion. If ++ the text to be completed is empty, but bash-completion turns it into ++ a quoted string ('') assuming that this code will dequote it before ++ calling readline, do the dequoting. */ ++ else if (iscompgen && iscompleting && ++ pcomp_curtxt && *pcomp_curtxt == 0 && ++ text && (*text == '\'' || *text == '"') && text[1] == text[0] && text[2] == 0 && ++ rl_filename_dequoting_function) ++ dfn = (*rl_filename_dequoting_function) ((char *)text, rl_completion_quote_character); ++ /* Another mismatched assumption by bash-completion. If compgen is being ++ run as part of bash-completion, and the argument to compgen is not ++ the same as the word originally passed to the programmable completion ++ code, dequote the argument if it has quote characters. It's an ++ attempt to detect when bash-completion is quoting its filename ++ argument before calling compgen. */ ++ /* We could check whether gen_shell_function_matches is in the call ++ stack by checking whether the gen-shell-function-matches tag is in ++ the unwind-protect stack, but there's no function to do that yet. ++ We could simply check whether we're executing in a function by ++ checking variable_context, and may end up doing that. */ ++ else if (iscompgen && iscompleting && rl_filename_dequoting_function && ++ pcomp_curtxt && text && ++ STREQ (pcomp_curtxt, text) == 0 && ++ variable_context && ++ sh_contains_quotes (text)) /* guess */ ++ dfn = (*rl_filename_dequoting_function) ((char *)text, rl_completion_quote_character); + else + dfn = savestring (text); + } +@@ -1522,7 +1549,7 @@ gen_progcomp_completions (ocmd, cmd, wor + COMPSPEC **lastcs; + { + COMPSPEC *cs, *oldcs; +- const char *oldcmd; ++ const char *oldcmd, *oldtxt; + STRINGLIST *ret; + + cs = progcomp_search (ocmd); +@@ -1545,14 +1572,17 @@ gen_progcomp_completions (ocmd, cmd, wor + + oldcs = pcomp_curcs; + oldcmd = pcomp_curcmd; ++ oldtxt = pcomp_curtxt; + + pcomp_curcs = cs; + pcomp_curcmd = cmd; ++ pcomp_curtxt = word; + + ret = gen_compspec_completions (cs, cmd, word, start, end, foundp); + + pcomp_curcs = oldcs; + pcomp_curcmd = oldcmd; ++ pcomp_curtxt = oldtxt; + + /* We need to conditionally handle setting *retryp here */ + if (retryp) +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 9 ++#define PATCHLEVEL 10 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/111-upstream-bash43-011.patch b/utils/bash/patches/111-upstream-bash43-011.patch new file mode 100644 index 0000000..b4c181a --- /dev/null +++ b/utils/bash/patches/111-upstream-bash43-011.patch @@ -0,0 +1,40 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-011 + +Bug-Reported-by: Egmont Koblinger +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-03/msg00153.html + +Bug-Description: + +The signal handling changes to bash and readline (to avoid running any code +in a signal handler context) cause the cursor to be placed on the wrong +line of a multi-line command after a ^C interrupts editing. + +Patch (apply with `patch -p0'): + +--- a/lib/readline/display.c ++++ b/lib/readline/display.c +@@ -2677,7 +2677,8 @@ _rl_clean_up_for_exit () + { + if (_rl_echoing_p) + { +- _rl_move_vert (_rl_vis_botlin); ++ if (_rl_vis_botlin > 0) /* minor optimization plus bug fix */ ++ _rl_move_vert (_rl_vis_botlin); + _rl_vis_botlin = 0; + fflush (rl_outstream); + rl_restart_output (1, 0); +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 10 ++#define PATCHLEVEL 11 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/112-upstream-bash43-012.patch b/utils/bash/patches/112-upstream-bash43-012.patch new file mode 100644 index 0000000..8fd2ea6 --- /dev/null +++ b/utils/bash/patches/112-upstream-bash43-012.patch @@ -0,0 +1,38 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-012 + +Bug-Reported-by: Eduardo A. Bustamante López +Bug-Reference-ID: <5346B54C.4070205@case.edu> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-04/msg00051.html + +Bug-Description: + +When a SIGCHLD trap runs a command containing a shell builtin while +a script is running `wait' to wait for all running children to complete, +the SIGCHLD trap will not be run once for each child that terminates. + +Patch (apply with `patch -p0'): + +--- a/jobs.c ++++ b/jobs.c +@@ -3597,6 +3597,7 @@ run_sigchld_trap (nchild) + unwind_protect_int (jobs_list_frozen); + unwind_protect_pointer (the_pipeline); + unwind_protect_pointer (subst_assign_varlist); ++ unwind_protect_pointer (this_shell_builtin); + + /* We have to add the commands this way because they will be run + in reverse order of adding. We don't want maybe_set_sigchld_trap () +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 11 ++#define PATCHLEVEL 12 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/113-upstream-bash43-013.patch b/utils/bash/patches/113-upstream-bash43-013.patch new file mode 100644 index 0000000..63c6c1e --- /dev/null +++ b/utils/bash/patches/113-upstream-bash43-013.patch @@ -0,0 +1,52 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-013 + +Bug-Reported-by: +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-04/msg00069.html + +Bug-Description: + +Using reverse-i-search when horizontal scrolling is enabled does not redisplay +the entire line containing the successful search results. + +Patch (apply with `patch -p0'): +--- a/lib/readline/display.c ++++ b/lib/readline/display.c +@@ -1637,7 +1637,7 @@ update_line (old, new, current_line, oma + /* If we are changing the number of invisible characters in a line, and + the spot of first difference is before the end of the invisible chars, + lendiff needs to be adjusted. */ +- if (current_line == 0 && !_rl_horizontal_scroll_mode && ++ if (current_line == 0 && /* !_rl_horizontal_scroll_mode && */ + current_invis_chars != visible_wrap_offset) + { + if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) +@@ -1825,8 +1825,13 @@ update_line (old, new, current_line, oma + else + _rl_last_c_pos += bytes_to_insert; + ++ /* XXX - we only want to do this if we are at the end of the line ++ so we move there with _rl_move_cursor_relative */ + if (_rl_horizontal_scroll_mode && ((oe-old) > (ne-new))) +- goto clear_rest_of_line; ++ { ++ _rl_move_cursor_relative (ne-new, new); ++ goto clear_rest_of_line; ++ } + } + } + /* Otherwise, print over the existing material. */ +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 12 ++#define PATCHLEVEL 13 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/114-upstream-bash43-014.patch b/utils/bash/patches/114-upstream-bash43-014.patch new file mode 100644 index 0000000..99e16b9 --- /dev/null +++ b/utils/bash/patches/114-upstream-bash43-014.patch @@ -0,0 +1,95 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-014 + +Bug-Reported-by: Greg Wooledge +Bug-Reference-ID: <20140418202123.GB7660@eeg.ccf.org> +Bug-Reference-URL: http://lists.gnu.org/archive/html/help-bash/2014-04/msg00004.html + +Bug-Description: + +Under certain circumstances, $@ is expanded incorrectly in contexts where +word splitting is not performed. + +Patch (apply with `patch -p0'): +--- a/subst.c ++++ b/subst.c +@@ -3248,8 +3248,10 @@ cond_expand_word (w, special) + if (w->word == 0 || w->word[0] == '\0') + return ((char *)NULL); + ++ expand_no_split_dollar_star = 1; + w->flags |= W_NOSPLIT2; + l = call_expand_word_internal (w, 0, 0, (int *)0, (int *)0); ++ expand_no_split_dollar_star = 0; + if (l) + { + if (special == 0) /* LHS */ +@@ -7847,6 +7849,10 @@ param_expand (string, sindex, quoted, ex + We also want to make sure that splitting is done no matter what -- + according to POSIX.2, this expands to a list of the positional + parameters no matter what IFS is set to. */ ++ /* XXX - what to do when in a context where word splitting is not ++ performed? Even when IFS is not the default, posix seems to imply ++ that we behave like unquoted $* ? Maybe we should use PF_NOSPLIT2 ++ here. */ + temp = string_list_dollar_at (list, (pflags & PF_ASSIGNRHS) ? (quoted|Q_DOUBLE_QUOTES) : quoted); + + tflag |= W_DOLLARAT; +@@ -8816,6 +8822,7 @@ finished_with_string: + else + { + char *ifs_chars; ++ char *tstring; + + ifs_chars = (quoted_dollar_at || has_dollar_at) ? ifs_value : (char *)NULL; + +@@ -8830,11 +8837,36 @@ finished_with_string: + regardless of what else has happened to IFS since the expansion. */ + if (split_on_spaces) + list = list_string (istring, " ", 1); /* XXX quoted == 1? */ ++ /* If we have $@ (has_dollar_at != 0) and we are in a context where we ++ don't want to split the result (W_NOSPLIT2), and we are not quoted, ++ we have already separated the arguments with the first character of ++ $IFS. In this case, we want to return a list with a single word ++ with the separator possibly replaced with a space (it's what other ++ shells seem to do). ++ quoted_dollar_at is internal to this function and is set if we are ++ passed an argument that is unquoted (quoted == 0) but we encounter a ++ double-quoted $@ while expanding it. */ ++ else if (has_dollar_at && quoted_dollar_at == 0 && ifs_chars && quoted == 0 && (word->flags & W_NOSPLIT2)) ++ { ++ /* Only split and rejoin if we have to */ ++ if (*ifs_chars && *ifs_chars != ' ') ++ { ++ list = list_string (istring, *ifs_chars ? ifs_chars : " ", 1); ++ tstring = string_list (list); ++ } ++ else ++ tstring = istring; ++ tword = make_bare_word (tstring); ++ if (tstring != istring) ++ free (tstring); ++ goto set_word_flags; ++ } + else if (has_dollar_at && ifs_chars) + list = list_string (istring, *ifs_chars ? ifs_chars : " ", 1); + else + { + tword = make_bare_word (istring); ++set_word_flags: + if ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) || (quoted_state == WHOLLY_QUOTED)) + tword->flags |= W_QUOTED; + if (word->flags & W_ASSIGNMENT) +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 13 ++#define PATCHLEVEL 14 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/115-upstream-bash43-015.patch b/utils/bash/patches/115-upstream-bash43-015.patch new file mode 100644 index 0000000..ae8be2d --- /dev/null +++ b/utils/bash/patches/115-upstream-bash43-015.patch @@ -0,0 +1,48 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-015 + +Bug-Reported-by: Clark Wang +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-04/msg00095.html + +Bug-Description: + +When completing directory names, the directory name is dequoted twice. +This causes problems for directories with single and double quotes in +their names. + +Patch (apply with `patch -p0'): +--- a/bashline.c ++++ b/bashline.c +@@ -4167,9 +4167,16 @@ bash_directory_completion_matches (text) + int qc; + + qc = rl_dispatching ? rl_completion_quote_character : 0; +- dfn = bash_dequote_filename ((char *)text, qc); ++ /* If rl_completion_found_quote != 0, rl_completion_matches will call the ++ filename dequoting function, causing the directory name to be dequoted ++ twice. */ ++ if (rl_dispatching && rl_completion_found_quote == 0) ++ dfn = bash_dequote_filename ((char *)text, qc); ++ else ++ dfn = (char *)text; + m1 = rl_completion_matches (dfn, rl_filename_completion_function); +- free (dfn); ++ if (dfn != text) ++ free (dfn); + + if (m1 == 0 || m1[0] == 0) + return m1; +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 14 ++#define PATCHLEVEL 15 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/116-upstream-bash43-016.patch b/utils/bash/patches/116-upstream-bash43-016.patch new file mode 100644 index 0000000..3ce37f6 --- /dev/null +++ b/utils/bash/patches/116-upstream-bash43-016.patch @@ -0,0 +1,121 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-016 + +Bug-Reported-by: Pierre Gaston +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-04/msg00100.html + +Bug-Description: + +An extended glob pattern containing a slash (`/') causes the globbing code +to misinterpret it as a directory separator. + +Patch (apply with `patch -p0'): +--- a/lib/glob/glob.c ++++ b/lib/glob/glob.c +@@ -123,6 +123,8 @@ static char **glob_dir_to_array __P((cha + extern char *glob_patscan __P((char *, char *, int)); + extern wchar_t *glob_patscan_wc __P((wchar_t *, wchar_t *, int)); + ++extern char *glob_dirscan __P((char *, int)); ++ + /* Compile `glob_loop.c' for single-byte characters. */ + #define CHAR unsigned char + #define INT int +@@ -187,6 +189,9 @@ extglob_skipname (pat, dname, flags) + se = pp + strlen (pp) - 1; /* end of string */ + pe = glob_patscan (pp, se, 0); /* end of extglob pattern (( */ + /* we should check for invalid extglob pattern here */ ++ if (pe == 0) ++ return 0; ++ + /* if pe != se we have more of the pattern at the end of the extglob + pattern. Check the easy case first ( */ + if (pe == se && *pe == ')' && (t = strchr (pp, '|')) == 0) +@@ -1015,7 +1020,7 @@ glob_filename (pathname, flags) + { + char **result; + unsigned int result_size; +- char *directory_name, *filename, *dname; ++ char *directory_name, *filename, *dname, *fn; + unsigned int directory_len; + int free_dirname; /* flag */ + int dflags; +@@ -1031,6 +1036,18 @@ glob_filename (pathname, flags) + + /* Find the filename. */ + filename = strrchr (pathname, '/'); ++#if defined (EXTENDED_GLOB) ++ if (filename && extended_glob) ++ { ++ fn = glob_dirscan (pathname, '/'); ++#if DEBUG_MATCHING ++ if (fn != filename) ++ fprintf (stderr, "glob_filename: glob_dirscan: fn (%s) != filename (%s)\n", fn ? fn : "(null)", filename); ++#endif ++ filename = fn; ++ } ++#endif ++ + if (filename == NULL) + { + filename = pathname; +--- a/lib/glob/gmisc.c ++++ b/lib/glob/gmisc.c +@@ -42,6 +42,8 @@ + #define WLPAREN L'(' + #define WRPAREN L')' + ++extern char *glob_patscan __P((char *, char *, int)); ++ + /* Return 1 of the first character of WSTRING could match the first + character of pattern WPAT. Wide character version. */ + int +@@ -375,3 +377,34 @@ bad_bracket: + + return matlen; + } ++ ++/* Skip characters in PAT and return the final occurrence of DIRSEP. This ++ is only called when extended_glob is set, so we have to skip over extglob ++ patterns x(...) */ ++char * ++glob_dirscan (pat, dirsep) ++ char *pat; ++ int dirsep; ++{ ++ char *p, *d, *pe, *se; ++ ++ d = pe = se = 0; ++ for (p = pat; p && *p; p++) ++ { ++ if (extglob_pattern_p (p)) ++ { ++ if (se == 0) ++ se = p + strlen (p) - 1; ++ pe = glob_patscan (p + 2, se, 0); ++ if (pe == 0) ++ continue; ++ else if (*pe == 0) ++ break; ++ p = pe - 1; /* will do increment above */ ++ continue; ++ } ++ if (*p == dirsep) ++ d = p; ++ } ++ return d; ++} +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 15 ++#define PATCHLEVEL 16 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/117-upstream-bash43-017.patch b/utils/bash/patches/117-upstream-bash43-017.patch new file mode 100644 index 0000000..9c7eecc --- /dev/null +++ b/utils/bash/patches/117-upstream-bash43-017.patch @@ -0,0 +1,41 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-017 + +Bug-Reported-by: Dan Douglas +Bug-Reference-ID: <7781746.RhfoTROLxF@smorgbox> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-05/msg00026.html + +Bug-Description: + +The code that creates local variables should not clear the `invisible' +attribute when returning an existing local variable. Let the code that +actually assigns a value clear it. + +Patch (apply with `patch -p0'): +--- a/variables.c ++++ b/variables.c +@@ -2197,10 +2197,7 @@ make_local_variable (name) + /* local foo; local foo; is a no-op. */ + old_var = find_variable (name); + if (old_var && local_p (old_var) && old_var->context == variable_context) +- { +- VUNSETATTR (old_var, att_invisible); /* XXX */ +- return (old_var); +- } ++ return (old_var); + + was_tmpvar = old_var && tempvar_p (old_var); + /* If we're making a local variable in a shell function, the temporary env +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 16 ++#define PATCHLEVEL 17 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/118-upstream-bash43-018.patch b/utils/bash/patches/118-upstream-bash43-018.patch new file mode 100644 index 0000000..095ca93 --- /dev/null +++ b/utils/bash/patches/118-upstream-bash43-018.patch @@ -0,0 +1,38 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-018 + +Bug-Reported-by: Geir Hauge +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-05/msg00040.html + +Bug-Description: + +When assigning an array variable using the compound assignment syntax, +but using `declare' with the rhs of the compound assignment quoted, the +shell did not mark the variable as visible after successfully performing +the assignment. + +Patch (apply with `patch -p0'): +--- a/arrayfunc.c ++++ b/arrayfunc.c +@@ -179,6 +179,7 @@ bind_array_var_internal (entry, ind, key + array_insert (array_cell (entry), ind, newval); + FREE (newval); + ++ VUNSETATTR (entry, att_invisible); /* no longer invisible */ + return (entry); + } + +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 17 ++#define PATCHLEVEL 18 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/119-upstream-bash43-019.patch b/utils/bash/patches/119-upstream-bash43-019.patch new file mode 100644 index 0000000..2d0fa44 --- /dev/null +++ b/utils/bash/patches/119-upstream-bash43-019.patch @@ -0,0 +1,75 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-019 + +Bug-Reported-by: John Lenton +Bug-Reference-ID: +Bug-Reference-URL: https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1317476 + +Bug-Description: + +The -t timeout option to `read' does not work when the -e option is used. + +Patch (apply with `patch -p0'): + +--- a/lib/readline/input.c ++++ b/lib/readline/input.c +@@ -534,8 +534,16 @@ rl_getc (stream) + return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF); + else if (_rl_caught_signal == SIGHUP || _rl_caught_signal == SIGTERM) + return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF); ++ /* keyboard-generated signals of interest */ + else if (_rl_caught_signal == SIGINT || _rl_caught_signal == SIGQUIT) + RL_CHECK_SIGNALS (); ++ /* non-keyboard-generated signals of interest */ ++ else if (_rl_caught_signal == SIGALRM ++#if defined (SIGVTALRM) ++ || _rl_caught_signal == SIGVTALRM ++#endif ++ ) ++ RL_CHECK_SIGNALS (); + + if (rl_signal_event_hook) + (*rl_signal_event_hook) (); +--- a/builtins/read.def ++++ b/builtins/read.def +@@ -442,7 +442,10 @@ read_builtin (list) + add_unwind_protect (reset_alarm, (char *)NULL); + #if defined (READLINE) + if (edit) +- add_unwind_protect (reset_attempted_completion_function, (char *)NULL); ++ { ++ add_unwind_protect (reset_attempted_completion_function, (char *)NULL); ++ add_unwind_protect (bashline_reset_event_hook, (char *)NULL); ++ } + #endif + falarm (tmsec, tmusec); + } +@@ -1021,6 +1024,7 @@ edit_line (p, itext) + + old_attempted_completion_function = rl_attempted_completion_function; + rl_attempted_completion_function = (rl_completion_func_t *)NULL; ++ bashline_set_event_hook (); + if (itext) + { + old_startup_hook = rl_startup_hook; +@@ -1032,6 +1036,7 @@ edit_line (p, itext) + + rl_attempted_completion_function = old_attempted_completion_function; + old_attempted_completion_function = (rl_completion_func_t *)NULL; ++ bashline_reset_event_hook (); + + if (ret == 0) + return ret; +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 18 ++#define PATCHLEVEL 19 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/120-upstream-bash43-020.patch b/utils/bash/patches/120-upstream-bash43-020.patch new file mode 100644 index 0000000..abf0c30 --- /dev/null +++ b/utils/bash/patches/120-upstream-bash43-020.patch @@ -0,0 +1,93 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-020 + +Bug-Reported-by: Jared Yanovich +Bug-Reference-ID: <20140417073654.GB26875@nightderanger.psc.edu> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-04/msg00065.html + +Bug-Description: + +When PS2 contains a command substitution, here-documents entered in an +interactive shell can sometimes cause a segmentation fault. + +Patch (apply with `patch -p0'): + +--- a/shell.h ++++ b/shell.h +@@ -168,7 +168,8 @@ typedef struct _sh_parser_state_t { + /* flags state affecting the parser */ + int expand_aliases; + int echo_input_at_read; +- ++ int need_here_doc; ++ + } sh_parser_state_t; + + typedef struct _sh_input_line_state_t { +--- a/parse.y ++++ b/parse.y +@@ -2642,7 +2642,7 @@ gather_here_documents () + int r; + + r = 0; +- while (need_here_doc) ++ while (need_here_doc > 0) + { + parser_state |= PST_HEREDOC; + make_here_document (redir_stack[r++], line_number); +@@ -6075,6 +6075,7 @@ save_parser_state (ps) + + ps->expand_aliases = expand_aliases; + ps->echo_input_at_read = echo_input_at_read; ++ ps->need_here_doc = need_here_doc; + + ps->token = token; + ps->token_buffer_size = token_buffer_size; +@@ -6123,6 +6124,7 @@ restore_parser_state (ps) + + expand_aliases = ps->expand_aliases; + echo_input_at_read = ps->echo_input_at_read; ++ need_here_doc = ps->need_here_doc; + + FREE (token); + token = ps->token; +--- a/y.tab.c ++++ b/y.tab.c +@@ -4954,7 +4954,7 @@ gather_here_documents () + int r; + + r = 0; +- while (need_here_doc) ++ while (need_here_doc > 0) + { + parser_state |= PST_HEREDOC; + make_here_document (redir_stack[r++], line_number); +@@ -8387,6 +8387,7 @@ save_parser_state (ps) + + ps->expand_aliases = expand_aliases; + ps->echo_input_at_read = echo_input_at_read; ++ ps->need_here_doc = need_here_doc; + + ps->token = token; + ps->token_buffer_size = token_buffer_size; +@@ -8435,6 +8436,7 @@ restore_parser_state (ps) + + expand_aliases = ps->expand_aliases; + echo_input_at_read = ps->echo_input_at_read; ++ need_here_doc = ps->need_here_doc; + + FREE (token); + token = ps->token; +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 19 ++#define PATCHLEVEL 20 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/121-upstream-bash43-021.patch b/utils/bash/patches/121-upstream-bash43-021.patch new file mode 100644 index 0000000..b7367a0 --- /dev/null +++ b/utils/bash/patches/121-upstream-bash43-021.patch @@ -0,0 +1,46 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-021 + +Bug-Reported-by: Jared Yanovich +Bug-Reference-ID: <20140625225019.GJ17044@nightderanger.psc.edu> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-06/msg00070.html + +Bug-Description: + +When the readline `revert-all-at-newline' option is set, pressing newline +when the current line is one retrieved from history results in a double free +and a segmentation fault. + +Patch (apply with `patch -p0'): + +--- a/lib/readline/misc.c ++++ b/lib/readline/misc.c +@@ -461,6 +461,7 @@ _rl_revert_all_lines () + saved_undo_list = 0; + /* Set up rl_line_buffer and other variables from history entry */ + rl_replace_from_history (entry, 0); /* entry->line is now current */ ++ entry->data = 0; /* entry->data is now current undo list */ + /* Undo all changes to this history entry */ + while (rl_undo_list) + rl_do_undo (); +@@ -468,7 +469,6 @@ _rl_revert_all_lines () + the timestamp. */ + FREE (entry->line); + entry->line = savestring (rl_line_buffer); +- entry->data = 0; + } + entry = previous_history (); + } +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 20 ++#define PATCHLEVEL 21 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/122-upstream-bash43-022.patch b/utils/bash/patches/122-upstream-bash43-022.patch new file mode 100644 index 0000000..1ee8f13 --- /dev/null +++ b/utils/bash/patches/122-upstream-bash43-022.patch @@ -0,0 +1,47 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-022 + +Bug-Reported-by: scorp.dev.null@gmail.com +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-06/msg00061.html + +Bug-Description: + +Using nested pipelines within loops with the `lastpipe' option set can result +in a segmentation fault. + +Patch (apply with `patch -p0'): + +--- a/execute_cmd.c ++++ b/execute_cmd.c +@@ -2413,7 +2413,16 @@ execute_pipeline (command, asynchronous, + #endif + lstdin = wait_for (lastpid); + #if defined (JOB_CONTROL) +- exec_result = job_exit_status (lastpipe_jid); ++ /* If wait_for removes the job from the jobs table, use result of last ++ command as pipeline's exit status as usual. The jobs list can get ++ frozen and unfrozen at inconvenient times if there are multiple pipelines ++ running simultaneously. */ ++ if (INVALID_JOB (lastpipe_jid) == 0) ++ exec_result = job_exit_status (lastpipe_jid); ++ else if (pipefail_opt) ++ exec_result = exec_result | lstdin; /* XXX */ ++ /* otherwise we use exec_result */ ++ + #endif + unfreeze_jobs_list (); + } +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 21 ++#define PATCHLEVEL 22 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/123-upstream-bash43-023.patch b/utils/bash/patches/123-upstream-bash43-023.patch new file mode 100644 index 0000000..8684c13 --- /dev/null +++ b/utils/bash/patches/123-upstream-bash43-023.patch @@ -0,0 +1,78 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-023 + +Bug-Reported-by: Tim Friske +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-06/msg00056.html + +Bug-Description: + +Bash does not correctly parse process substitution constructs that contain +unbalanced parentheses as part of the contained command. + +Patch (apply with `patch -p0'): + +--- a/subst.h ++++ b/subst.h +@@ -82,7 +82,7 @@ extern char *extract_arithmetic_subst __ + /* Extract the <( or >( construct in STRING, and return a new string. + Start extracting at (SINDEX) as if we had just seen "<(". + Make (SINDEX) get the position just after the matching ")". */ +-extern char *extract_process_subst __P((char *, char *, int *)); ++extern char *extract_process_subst __P((char *, char *, int *, int)); + #endif /* PROCESS_SUBSTITUTION */ + + /* Extract the name of the variable to bind to from the assignment string. */ +--- a/subst.c ++++ b/subst.c +@@ -1192,12 +1192,18 @@ extract_arithmetic_subst (string, sindex + Start extracting at (SINDEX) as if we had just seen "<(". + Make (SINDEX) get the position of the matching ")". */ /*))*/ + char * +-extract_process_subst (string, starter, sindex) ++extract_process_subst (string, starter, sindex, xflags) + char *string; + char *starter; + int *sindex; ++ int xflags; + { ++#if 0 + return (extract_delimited_string (string, sindex, starter, "(", ")", SX_COMMAND)); ++#else ++ xflags |= (no_longjmp_on_fatal_error ? SX_NOLONGJMP : 0); ++ return (xparse_dolparen (string, string+*sindex, sindex, xflags)); ++#endif + } + #endif /* PROCESS_SUBSTITUTION */ + +@@ -1785,7 +1791,7 @@ skip_to_delim (string, start, delims, fl + si = i + 2; + if (string[si] == '\0') + CQ_RETURN(si); +- temp = extract_process_subst (string, (c == '<') ? "<(" : ">(", &si); ++ temp = extract_process_subst (string, (c == '<') ? "<(" : ">(", &si, 0); + free (temp); /* no SX_ALLOC here */ + i = si; + if (string[i] == '\0') +@@ -8249,7 +8255,7 @@ add_string: + else + t_index = sindex + 1; /* skip past both '<' and LPAREN */ + +- temp1 = extract_process_subst (string, (c == '<') ? "<(" : ">(", &t_index); /*))*/ ++ temp1 = extract_process_subst (string, (c == '<') ? "<(" : ">(", &t_index, 0); /*))*/ + sindex = t_index; + + /* If the process substitution specification is `<()', we want to +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 22 ++#define PATCHLEVEL 23 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/124-upstream-bash43-024.patch b/utils/bash/patches/124-upstream-bash43-024.patch new file mode 100644 index 0000000..7941455 --- /dev/null +++ b/utils/bash/patches/124-upstream-bash43-024.patch @@ -0,0 +1,45 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-024 + +Bug-Reported-by: Corentin Peuvrel +Bug-Reference-ID: <53CE9E5D.6050203@pom-monitoring.com> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-07/msg00021.html + +Bug-Description: + +Indirect variable references do not work correctly if the reference +variable expands to an array reference using a subscript other than 0 +(e.g., foo='bar[1]' ; echo ${!foo}). + +Patch (apply with `patch -p0'): + +--- a/subst.c ++++ b/subst.c +@@ -7374,7 +7374,13 @@ parameter_brace_expand (string, indexp, + } + + if (want_indir) +- tdesc = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at); ++ { ++ tdesc = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at); ++ /* Turn off the W_ARRAYIND flag because there is no way for this function ++ to return the index we're supposed to be using. */ ++ if (tdesc && tdesc->flags) ++ tdesc->flags &= ~W_ARRAYIND; ++ } + else + tdesc = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND|(pflags&(PF_NOSPLIT2|PF_ASSIGNRHS)), &ind); + +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 23 ++#define PATCHLEVEL 24 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/125-upstream-bash43-025.patch b/utils/bash/patches/125-upstream-bash43-025.patch new file mode 100644 index 0000000..6b2ef4b --- /dev/null +++ b/utils/bash/patches/125-upstream-bash43-025.patch @@ -0,0 +1,110 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-025 + +Bug-Reported-by: Stephane Chazelas +Bug-Reference-ID: +Bug-Reference-URL: + +Bug-Description: + +Under certain circumstances, bash will execute user code while processing the +environment for exported function definitions. + +Patch (apply with `patch -p0'): + +--- a/builtins/common.h ++++ b/builtins/common.h +@@ -33,6 +33,8 @@ + #define SEVAL_RESETLINE 0x010 + #define SEVAL_PARSEONLY 0x020 + #define SEVAL_NOLONGJMP 0x040 ++#define SEVAL_FUNCDEF 0x080 /* only allow function definitions */ ++#define SEVAL_ONECMD 0x100 /* only allow a single command */ + + /* Flags for describe_command, shared between type.def and command.def */ + #define CDESC_ALL 0x001 /* type -a */ +--- a/builtins/evalstring.c ++++ b/builtins/evalstring.c +@@ -308,6 +308,14 @@ parse_and_execute (string, from_file, fl + { + struct fd_bitmap *bitmap; + ++ if ((flags & SEVAL_FUNCDEF) && command->type != cm_function_def) ++ { ++ internal_warning ("%s: ignoring function definition attempt", from_file); ++ should_jump_to_top_level = 0; ++ last_result = last_command_exit_value = EX_BADUSAGE; ++ break; ++ } ++ + bitmap = new_fd_bitmap (FD_BITMAP_SIZE); + begin_unwind_frame ("pe_dispose"); + add_unwind_protect (dispose_fd_bitmap, bitmap); +@@ -368,6 +376,9 @@ parse_and_execute (string, from_file, fl + dispose_command (command); + dispose_fd_bitmap (bitmap); + discard_unwind_frame ("pe_dispose"); ++ ++ if (flags & SEVAL_ONECMD) ++ break; + } + } + else +--- a/variables.c ++++ b/variables.c +@@ -358,13 +358,11 @@ initialize_shell_variables (env, privmod + temp_string[char_index] = ' '; + strcpy (temp_string + char_index + 1, string); + +- if (posixly_correct == 0 || legal_identifier (name)) +- parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST); +- +- /* Ancient backwards compatibility. Old versions of bash exported +- functions like name()=() {...} */ +- if (name[char_index - 1] == ')' && name[char_index - 2] == '(') +- name[char_index - 2] = '\0'; ++ /* Don't import function names that are invalid identifiers from the ++ environment, though we still allow them to be defined as shell ++ variables. */ ++ if (legal_identifier (name)) ++ parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_FUNCDEF|SEVAL_ONECMD); + + if (temp_var = find_function (name)) + { +@@ -381,10 +379,6 @@ initialize_shell_variables (env, privmod + last_command_exit_value = 1; + report_error (_("error importing function definition for `%s'"), name); + } +- +- /* ( */ +- if (name[char_index - 1] == ')' && name[char_index - 2] == '\0') +- name[char_index - 2] = '('; /* ) */ + } + #if defined (ARRAY_VARS) + # if ARRAY_EXPORT +--- a/subst.c ++++ b/subst.c +@@ -8047,7 +8047,9 @@ comsub: + + goto return0; + } +- else if (var = find_variable_last_nameref (temp1)) ++ else if (var && (invisible_p (var) || var_isset (var) == 0)) ++ temp = (char *)NULL; ++ else if ((var = find_variable_last_nameref (temp1)) && var_isset (var) && invisible_p (var) == 0) + { + temp = nameref_cell (var); + #if defined (ARRAY_VARS) +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 24 ++#define PATCHLEVEL 25 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/126-upstream-bash43-026.patch b/utils/bash/patches/126-upstream-bash43-026.patch new file mode 100644 index 0000000..e9535be --- /dev/null +++ b/utils/bash/patches/126-upstream-bash43-026.patch @@ -0,0 +1,54 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-026 + +Bug-Reported-by: Tavis Ormandy +Bug-Reference-ID: +Bug-Reference-URL: http://twitter.com/taviso/statuses/514887394294652929 + +Bug-Description: + +Under certain circumstances, bash can incorrectly save a lookahead character and +return it on a subsequent call, even when reading a new line. + +Patch (apply with `patch -p0'): + +--- a/parse.y ++++ b/parse.y +@@ -2953,6 +2953,8 @@ reset_parser () + FREE (word_desc_to_read); + word_desc_to_read = (WORD_DESC *)NULL; + ++ eol_ungetc_lookahead = 0; ++ + current_token = '\n'; /* XXX */ + last_read_token = '\n'; + token_to_read = '\n'; +--- a/y.tab.c ++++ b/y.tab.c +@@ -5265,6 +5265,8 @@ reset_parser () + FREE (word_desc_to_read); + word_desc_to_read = (WORD_DESC *)NULL; + ++ eol_ungetc_lookahead = 0; ++ + current_token = '\n'; /* XXX */ + last_read_token = '\n'; + token_to_read = '\n'; +@@ -8539,4 +8541,3 @@ set_line_mbstate () + } + } + #endif /* HANDLE_MULTIBYTE */ +- +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 25 ++#define PATCHLEVEL 26 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/127-upstream-bash43-027.patch b/utils/bash/patches/127-upstream-bash43-027.patch new file mode 100644 index 0000000..6e8a51a --- /dev/null +++ b/utils/bash/patches/127-upstream-bash43-027.patch @@ -0,0 +1,176 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-027 + +Bug-Reported-by: Florian Weimer +Bug-Reference-ID: +Bug-Reference-URL: + +Bug-Description: + +This patch changes the encoding bash uses for exported functions to avoid +clashes with shell variables and to avoid depending only on an environment +variable's contents to determine whether or not to interpret it as a shell +function. + +Patch (apply with `patch -p0'): + +--- a/variables.c ++++ b/variables.c +@@ -83,6 +83,11 @@ + + #define ifsname(s) ((s)[0] == 'I' && (s)[1] == 'F' && (s)[2] == 'S' && (s)[3] == '\0') + ++#define BASHFUNC_PREFIX "BASH_FUNC_" ++#define BASHFUNC_PREFLEN 10 /* == strlen(BASHFUNC_PREFIX */ ++#define BASHFUNC_SUFFIX "%%" ++#define BASHFUNC_SUFFLEN 2 /* == strlen(BASHFUNC_SUFFIX) */ ++ + extern char **environ; + + /* Variables used here and defined in other files. */ +@@ -279,7 +284,7 @@ static void push_temp_var __P((PTR_T)); + static void propagate_temp_var __P((PTR_T)); + static void dispose_temporary_env __P((sh_free_func_t *)); + +-static inline char *mk_env_string __P((const char *, const char *)); ++static inline char *mk_env_string __P((const char *, const char *, int)); + static char **make_env_array_from_var_list __P((SHELL_VAR **)); + static char **make_var_export_array __P((VAR_CONTEXT *)); + static char **make_func_export_array __P((void)); +@@ -349,22 +354,33 @@ initialize_shell_variables (env, privmod + + /* If exported function, define it now. Don't import functions from + the environment in privileged mode. */ +- if (privmode == 0 && read_but_dont_execute == 0 && STREQN ("() {", string, 4)) ++ if (privmode == 0 && read_but_dont_execute == 0 && ++ STREQN (BASHFUNC_PREFIX, name, BASHFUNC_PREFLEN) && ++ STREQ (BASHFUNC_SUFFIX, name + char_index - BASHFUNC_SUFFLEN) && ++ STREQN ("() {", string, 4)) + { ++ size_t namelen; ++ char *tname; /* desired imported function name */ ++ ++ namelen = char_index - BASHFUNC_PREFLEN - BASHFUNC_SUFFLEN; ++ ++ tname = name + BASHFUNC_PREFLEN; /* start of func name */ ++ tname[namelen] = '\0'; /* now tname == func name */ ++ + string_length = strlen (string); +- temp_string = (char *)xmalloc (3 + string_length + char_index); ++ temp_string = (char *)xmalloc (namelen + string_length + 2); + +- strcpy (temp_string, name); +- temp_string[char_index] = ' '; +- strcpy (temp_string + char_index + 1, string); ++ memcpy (temp_string, tname, namelen); ++ temp_string[namelen] = ' '; ++ memcpy (temp_string + namelen + 1, string, string_length + 1); + + /* Don't import function names that are invalid identifiers from the + environment, though we still allow them to be defined as shell + variables. */ +- if (legal_identifier (name)) +- parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_FUNCDEF|SEVAL_ONECMD); ++ if (absolute_program (tname) == 0 && (posixly_correct == 0 || legal_identifier (tname))) ++ parse_and_execute (temp_string, tname, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_FUNCDEF|SEVAL_ONECMD); + +- if (temp_var = find_function (name)) ++ if (temp_var = find_function (tname)) + { + VSETATTR (temp_var, (att_exported|att_imported)); + array_needs_making = 1; +@@ -377,8 +393,11 @@ initialize_shell_variables (env, privmod + array_needs_making = 1; + } + last_command_exit_value = 1; +- report_error (_("error importing function definition for `%s'"), name); ++ report_error (_("error importing function definition for `%s'"), tname); + } ++ ++ /* Restore original suffix */ ++ tname[namelen] = BASHFUNC_SUFFIX[0]; + } + #if defined (ARRAY_VARS) + # if ARRAY_EXPORT +@@ -2954,7 +2973,7 @@ assign_in_env (word, flags) + var->context = variable_context; /* XXX */ + + INVALIDATE_EXPORTSTR (var); +- var->exportstr = mk_env_string (name, value); ++ var->exportstr = mk_env_string (name, value, 0); + + array_needs_making = 1; + +@@ -3852,21 +3871,42 @@ merge_temporary_env () + /* **************************************************************** */ + + static inline char * +-mk_env_string (name, value) ++mk_env_string (name, value, isfunc) + const char *name, *value; ++ int isfunc; + { +- int name_len, value_len; +- char *p; ++ size_t name_len, value_len; ++ char *p, *q; + + name_len = strlen (name); + value_len = STRLEN (value); +- p = (char *)xmalloc (2 + name_len + value_len); +- strcpy (p, name); +- p[name_len] = '='; ++ ++ /* If we are exporting a shell function, construct the encoded function ++ name. */ ++ if (isfunc && value) ++ { ++ p = (char *)xmalloc (BASHFUNC_PREFLEN + name_len + BASHFUNC_SUFFLEN + value_len + 2); ++ q = p; ++ memcpy (q, BASHFUNC_PREFIX, BASHFUNC_PREFLEN); ++ q += BASHFUNC_PREFLEN; ++ memcpy (q, name, name_len); ++ q += name_len; ++ memcpy (q, BASHFUNC_SUFFIX, BASHFUNC_SUFFLEN); ++ q += BASHFUNC_SUFFLEN; ++ } ++ else ++ { ++ p = (char *)xmalloc (2 + name_len + value_len); ++ memcpy (p, name, name_len); ++ q = p + name_len; ++ } ++ ++ q[0] = '='; + if (value && *value) +- strcpy (p + name_len + 1, value); ++ memcpy (q + 1, value, value_len + 1); + else +- p[name_len + 1] = '\0'; ++ q[1] = '\0'; ++ + return (p); + } + +@@ -3952,7 +3992,7 @@ make_env_array_from_var_list (vars) + /* Gee, I'd like to get away with not using savestring() if we're + using the cached exportstr... */ + list[list_index] = USE_EXPORTSTR ? savestring (value) +- : mk_env_string (var->name, value); ++ : mk_env_string (var->name, value, function_p (var)); + + if (USE_EXPORTSTR == 0) + SAVE_EXPORTSTR (var, list[list_index]); +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 26 ++#define PATCHLEVEL 27 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/128-upstream-bash43-028.patch b/utils/bash/patches/128-upstream-bash43-028.patch new file mode 100644 index 0000000..b4b1b6d --- /dev/null +++ b/utils/bash/patches/128-upstream-bash43-028.patch @@ -0,0 +1,1526 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-028 + +Bug-Reported-by: Florian Weimer +Bug-Reference-ID: +Bug-Reference-URL: + +Bug-Description: + +There are two local buffer overflows in parse.y that can cause the shell +to dump core when given many here-documents attached to a single command +or many nested loops. + +Patch (apply with `patch -p0'): + +--- a/parse.y ++++ b/parse.y +@@ -168,6 +168,9 @@ static char *read_a_line __P((int)); + + static int reserved_word_acceptable __P((int)); + static int yylex __P((void)); ++ ++static void push_heredoc __P((REDIRECT *)); ++static char *mk_alexpansion __P((char *)); + static int alias_expand_token __P((char *)); + static int time_command_acceptable __P((void)); + static int special_case_tokens __P((char *)); +@@ -265,7 +268,9 @@ int parser_state; + + /* Variables to manage the task of reading here documents, because we need to + defer the reading until after a complete command has been collected. */ +-static REDIRECT *redir_stack[10]; ++#define HEREDOC_MAX 16 ++ ++static REDIRECT *redir_stack[HEREDOC_MAX]; + int need_here_doc; + + /* Where shell input comes from. History expansion is performed on each +@@ -307,7 +312,7 @@ static int global_extglob; + or `for WORD' begins. This is a nested command maximum, since the array + index is decremented after a case, select, or for command is parsed. */ + #define MAX_CASE_NEST 128 +-static int word_lineno[MAX_CASE_NEST]; ++static int word_lineno[MAX_CASE_NEST+1]; + static int word_top = -1; + + /* If non-zero, it is the token that we want read_token to return +@@ -520,42 +525,42 @@ redirection: '>' WORD + source.dest = 0; + redir.filename = $2; + $$ = make_redirection (source, r_reading_until, redir, 0); +- redir_stack[need_here_doc++] = $$; ++ push_heredoc ($$); + } + | NUMBER LESS_LESS WORD + { + source.dest = $1; + redir.filename = $3; + $$ = make_redirection (source, r_reading_until, redir, 0); +- redir_stack[need_here_doc++] = $$; ++ push_heredoc ($$); + } + | REDIR_WORD LESS_LESS WORD + { + source.filename = $1; + redir.filename = $3; + $$ = make_redirection (source, r_reading_until, redir, REDIR_VARASSIGN); +- redir_stack[need_here_doc++] = $$; ++ push_heredoc ($$); + } + | LESS_LESS_MINUS WORD + { + source.dest = 0; + redir.filename = $2; + $$ = make_redirection (source, r_deblank_reading_until, redir, 0); +- redir_stack[need_here_doc++] = $$; ++ push_heredoc ($$); + } + | NUMBER LESS_LESS_MINUS WORD + { + source.dest = $1; + redir.filename = $3; + $$ = make_redirection (source, r_deblank_reading_until, redir, 0); +- redir_stack[need_here_doc++] = $$; ++ push_heredoc ($$); + } + | REDIR_WORD LESS_LESS_MINUS WORD + { + source.filename = $1; + redir.filename = $3; + $$ = make_redirection (source, r_deblank_reading_until, redir, REDIR_VARASSIGN); +- redir_stack[need_here_doc++] = $$; ++ push_heredoc ($$); + } + | LESS_LESS_LESS WORD + { +@@ -2636,6 +2641,21 @@ yylex () + which allow ESAC to be the next one read. */ + static int esacs_needed_count; + ++static void ++push_heredoc (r) ++ REDIRECT *r; ++{ ++ if (need_here_doc >= HEREDOC_MAX) ++ { ++ last_command_exit_value = EX_BADUSAGE; ++ need_here_doc = 0; ++ report_syntax_error (_("maximum here-document count exceeded")); ++ reset_parser (); ++ exit_shell (last_command_exit_value); ++ } ++ redir_stack[need_here_doc++] = r; ++} ++ + void + gather_here_documents () + { +--- a/y.tab.c ++++ b/y.tab.c +@@ -168,7 +168,7 @@ + + + /* Copy the first part of user declarations. */ +-#line 21 "/usr/homes/chet/src/bash/src/parse.y" ++#line 21 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + + #include "config.h" + +@@ -319,6 +319,9 @@ static char *read_a_line __P((int)); + + static int reserved_word_acceptable __P((int)); + static int yylex __P((void)); ++ ++static void push_heredoc __P((REDIRECT *)); ++static char *mk_alexpansion __P((char *)); + static int alias_expand_token __P((char *)); + static int time_command_acceptable __P((void)); + static int special_case_tokens __P((char *)); +@@ -416,7 +419,9 @@ int parser_state; + + /* Variables to manage the task of reading here documents, because we need to + defer the reading until after a complete command has been collected. */ +-static REDIRECT *redir_stack[10]; ++#define HEREDOC_MAX 16 ++ ++static REDIRECT *redir_stack[HEREDOC_MAX]; + int need_here_doc; + + /* Where shell input comes from. History expansion is performed on each +@@ -458,7 +463,7 @@ static int global_extglob; + or `for WORD' begins. This is a nested command maximum, since the array + index is decremented after a case, select, or for command is parsed. */ + #define MAX_CASE_NEST 128 +-static int word_lineno[MAX_CASE_NEST]; ++static int word_lineno[MAX_CASE_NEST+1]; + static int word_top = -1; + + /* If non-zero, it is the token that we want read_token to return +@@ -492,7 +497,7 @@ static REDIRECTEE redir; + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + typedef union YYSTYPE +-#line 324 "/usr/homes/chet/src/bash/src/parse.y" ++#line 329 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + WORD_DESC *word; /* the word that we read. */ + int number; /* the number that we read. */ +@@ -503,7 +508,7 @@ typedef union YYSTYPE + PATTERN_LIST *pattern; + } + /* Line 193 of yacc.c. */ +-#line 507 "y.tab.c" ++#line 512 "y.tab.c" + YYSTYPE; + # define yystype YYSTYPE /* obsolescent; will be withdrawn */ + # define YYSTYPE_IS_DECLARED 1 +@@ -516,7 +521,7 @@ typedef union YYSTYPE + + + /* Line 216 of yacc.c. */ +-#line 520 "y.tab.c" ++#line 525 "y.tab.c" + + #ifdef short + # undef short +@@ -886,23 +891,23 @@ static const yytype_int8 yyrhs[] = + /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + static const yytype_uint16 yyrline[] = + { +- 0, 377, 377, 388, 397, 412, 422, 424, 428, 434, +- 440, 446, 452, 458, 464, 470, 476, 482, 488, 494, +- 500, 506, 512, 518, 525, 532, 539, 546, 553, 560, +- 566, 572, 578, 584, 590, 596, 602, 608, 614, 620, +- 626, 632, 638, 644, 650, 656, 662, 668, 674, 680, +- 686, 692, 700, 702, 704, 708, 712, 723, 725, 729, +- 731, 733, 749, 751, 755, 757, 759, 761, 763, 765, +- 767, 769, 771, 773, 775, 779, 784, 789, 794, 799, +- 804, 809, 814, 821, 826, 831, 836, 843, 848, 853, +- 858, 863, 868, 875, 880, 885, 892, 895, 898, 902, +- 904, 935, 942, 947, 964, 969, 986, 993, 995, 997, +- 1002, 1006, 1010, 1014, 1016, 1018, 1022, 1023, 1027, 1029, +- 1031, 1033, 1037, 1039, 1041, 1043, 1045, 1047, 1051, 1053, +- 1062, 1070, 1071, 1077, 1078, 1085, 1089, 1091, 1093, 1100, +- 1102, 1104, 1108, 1109, 1112, 1114, 1116, 1120, 1121, 1130, +- 1143, 1159, 1174, 1176, 1178, 1185, 1188, 1192, 1194, 1200, +- 1206, 1223, 1243, 1245, 1268, 1272, 1274, 1276 ++ 0, 382, 382, 393, 402, 417, 427, 429, 433, 439, ++ 445, 451, 457, 463, 469, 475, 481, 487, 493, 499, ++ 505, 511, 517, 523, 530, 537, 544, 551, 558, 565, ++ 571, 577, 583, 589, 595, 601, 607, 613, 619, 625, ++ 631, 637, 643, 649, 655, 661, 667, 673, 679, 685, ++ 691, 697, 705, 707, 709, 713, 717, 728, 730, 734, ++ 736, 738, 754, 756, 760, 762, 764, 766, 768, 770, ++ 772, 774, 776, 778, 780, 784, 789, 794, 799, 804, ++ 809, 814, 819, 826, 831, 836, 841, 848, 853, 858, ++ 863, 868, 873, 880, 885, 890, 897, 900, 903, 907, ++ 909, 940, 947, 952, 969, 974, 991, 998, 1000, 1002, ++ 1007, 1011, 1015, 1019, 1021, 1023, 1027, 1028, 1032, 1034, ++ 1036, 1038, 1042, 1044, 1046, 1048, 1050, 1052, 1056, 1058, ++ 1067, 1075, 1076, 1082, 1083, 1090, 1094, 1096, 1098, 1105, ++ 1107, 1109, 1113, 1114, 1117, 1119, 1121, 1125, 1126, 1135, ++ 1148, 1164, 1179, 1181, 1183, 1190, 1193, 1197, 1199, 1205, ++ 1211, 1228, 1248, 1250, 1273, 1277, 1279, 1281 + }; + #endif + +@@ -2093,7 +2098,7 @@ yyreduce: + switch (yyn) + { + case 2: +-#line 378 "/usr/homes/chet/src/bash/src/parse.y" ++#line 383 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + /* Case of regular command. Discard the error + safety net,and return the command just parsed. */ +@@ -2107,7 +2112,7 @@ yyreduce: + break; + + case 3: +-#line 389 "/usr/homes/chet/src/bash/src/parse.y" ++#line 394 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + /* Case of regular command, but not a very + interesting one. Return a NULL command. */ +@@ -2119,7 +2124,7 @@ yyreduce: + break; + + case 4: +-#line 398 "/usr/homes/chet/src/bash/src/parse.y" ++#line 403 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + /* Error during parsing. Return NULL command. */ + global_command = (COMMAND *)NULL; +@@ -2137,7 +2142,7 @@ yyreduce: + break; + + case 5: +-#line 413 "/usr/homes/chet/src/bash/src/parse.y" ++#line 418 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + /* Case of EOF seen by itself. Do ignoreeof or + not. */ +@@ -2148,17 +2153,17 @@ yyreduce: + break; + + case 6: +-#line 423 "/usr/homes/chet/src/bash/src/parse.y" ++#line 428 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.word_list) = make_word_list ((yyvsp[(1) - (1)].word), (WORD_LIST *)NULL); } + break; + + case 7: +-#line 425 "/usr/homes/chet/src/bash/src/parse.y" ++#line 430 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.word_list) = make_word_list ((yyvsp[(2) - (2)].word), (yyvsp[(1) - (2)].word_list)); } + break; + + case 8: +-#line 429 "/usr/homes/chet/src/bash/src/parse.y" ++#line 434 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = 1; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2167,7 +2172,7 @@ yyreduce: + break; + + case 9: +-#line 435 "/usr/homes/chet/src/bash/src/parse.y" ++#line 440 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = 0; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2176,7 +2181,7 @@ yyreduce: + break; + + case 10: +-#line 441 "/usr/homes/chet/src/bash/src/parse.y" ++#line 446 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2185,7 +2190,7 @@ yyreduce: + break; + + case 11: +-#line 447 "/usr/homes/chet/src/bash/src/parse.y" ++#line 452 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2194,7 +2199,7 @@ yyreduce: + break; + + case 12: +-#line 453 "/usr/homes/chet/src/bash/src/parse.y" ++#line 458 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2203,7 +2208,7 @@ yyreduce: + break; + + case 13: +-#line 459 "/usr/homes/chet/src/bash/src/parse.y" ++#line 464 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2212,7 +2217,7 @@ yyreduce: + break; + + case 14: +-#line 465 "/usr/homes/chet/src/bash/src/parse.y" ++#line 470 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = 1; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2221,7 +2226,7 @@ yyreduce: + break; + + case 15: +-#line 471 "/usr/homes/chet/src/bash/src/parse.y" ++#line 476 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2230,7 +2235,7 @@ yyreduce: + break; + + case 16: +-#line 477 "/usr/homes/chet/src/bash/src/parse.y" ++#line 482 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2239,7 +2244,7 @@ yyreduce: + break; + + case 17: +-#line 483 "/usr/homes/chet/src/bash/src/parse.y" ++#line 488 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = 1; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2248,7 +2253,7 @@ yyreduce: + break; + + case 18: +-#line 489 "/usr/homes/chet/src/bash/src/parse.y" ++#line 494 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2257,7 +2262,7 @@ yyreduce: + break; + + case 19: +-#line 495 "/usr/homes/chet/src/bash/src/parse.y" ++#line 500 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2266,7 +2271,7 @@ yyreduce: + break; + + case 20: +-#line 501 "/usr/homes/chet/src/bash/src/parse.y" ++#line 506 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = 0; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2275,7 +2280,7 @@ yyreduce: + break; + + case 21: +-#line 507 "/usr/homes/chet/src/bash/src/parse.y" ++#line 512 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2284,7 +2289,7 @@ yyreduce: + break; + + case 22: +-#line 513 "/usr/homes/chet/src/bash/src/parse.y" ++#line 518 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2293,67 +2298,67 @@ yyreduce: + break; + + case 23: +-#line 519 "/usr/homes/chet/src/bash/src/parse.y" ++#line 524 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = 0; + redir.filename = (yyvsp[(2) - (2)].word); + (yyval.redirect) = make_redirection (source, r_reading_until, redir, 0); +- redir_stack[need_here_doc++] = (yyval.redirect); ++ push_heredoc ((yyval.redirect)); + } + break; + + case 24: +-#line 526 "/usr/homes/chet/src/bash/src/parse.y" ++#line 531 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); + (yyval.redirect) = make_redirection (source, r_reading_until, redir, 0); +- redir_stack[need_here_doc++] = (yyval.redirect); ++ push_heredoc ((yyval.redirect)); + } + break; + + case 25: +-#line 533 "/usr/homes/chet/src/bash/src/parse.y" ++#line 538 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); + (yyval.redirect) = make_redirection (source, r_reading_until, redir, REDIR_VARASSIGN); +- redir_stack[need_here_doc++] = (yyval.redirect); ++ push_heredoc ((yyval.redirect)); + } + break; + + case 26: +-#line 540 "/usr/homes/chet/src/bash/src/parse.y" ++#line 545 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = 0; + redir.filename = (yyvsp[(2) - (2)].word); + (yyval.redirect) = make_redirection (source, r_deblank_reading_until, redir, 0); +- redir_stack[need_here_doc++] = (yyval.redirect); ++ push_heredoc ((yyval.redirect)); + } + break; + + case 27: +-#line 547 "/usr/homes/chet/src/bash/src/parse.y" ++#line 552 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); + (yyval.redirect) = make_redirection (source, r_deblank_reading_until, redir, 0); +- redir_stack[need_here_doc++] = (yyval.redirect); ++ push_heredoc ((yyval.redirect)); + } + break; + + case 28: +-#line 554 "/usr/homes/chet/src/bash/src/parse.y" ++#line 559 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); + (yyval.redirect) = make_redirection (source, r_deblank_reading_until, redir, REDIR_VARASSIGN); +- redir_stack[need_here_doc++] = (yyval.redirect); ++ push_heredoc ((yyval.redirect)); + } + break; + + case 29: +-#line 561 "/usr/homes/chet/src/bash/src/parse.y" ++#line 566 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = 0; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2362,7 +2367,7 @@ yyreduce: + break; + + case 30: +-#line 567 "/usr/homes/chet/src/bash/src/parse.y" ++#line 572 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2371,7 +2376,7 @@ yyreduce: + break; + + case 31: +-#line 573 "/usr/homes/chet/src/bash/src/parse.y" ++#line 578 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2380,7 +2385,7 @@ yyreduce: + break; + + case 32: +-#line 579 "/usr/homes/chet/src/bash/src/parse.y" ++#line 584 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = 0; + redir.dest = (yyvsp[(2) - (2)].number); +@@ -2389,7 +2394,7 @@ yyreduce: + break; + + case 33: +-#line 585 "/usr/homes/chet/src/bash/src/parse.y" ++#line 590 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.dest = (yyvsp[(3) - (3)].number); +@@ -2398,7 +2403,7 @@ yyreduce: + break; + + case 34: +-#line 591 "/usr/homes/chet/src/bash/src/parse.y" ++#line 596 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.dest = (yyvsp[(3) - (3)].number); +@@ -2407,7 +2412,7 @@ yyreduce: + break; + + case 35: +-#line 597 "/usr/homes/chet/src/bash/src/parse.y" ++#line 602 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = 1; + redir.dest = (yyvsp[(2) - (2)].number); +@@ -2416,7 +2421,7 @@ yyreduce: + break; + + case 36: +-#line 603 "/usr/homes/chet/src/bash/src/parse.y" ++#line 608 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.dest = (yyvsp[(3) - (3)].number); +@@ -2425,7 +2430,7 @@ yyreduce: + break; + + case 37: +-#line 609 "/usr/homes/chet/src/bash/src/parse.y" ++#line 614 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.dest = (yyvsp[(3) - (3)].number); +@@ -2434,7 +2439,7 @@ yyreduce: + break; + + case 38: +-#line 615 "/usr/homes/chet/src/bash/src/parse.y" ++#line 620 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = 0; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2443,7 +2448,7 @@ yyreduce: + break; + + case 39: +-#line 621 "/usr/homes/chet/src/bash/src/parse.y" ++#line 626 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2452,7 +2457,7 @@ yyreduce: + break; + + case 40: +-#line 627 "/usr/homes/chet/src/bash/src/parse.y" ++#line 632 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2461,7 +2466,7 @@ yyreduce: + break; + + case 41: +-#line 633 "/usr/homes/chet/src/bash/src/parse.y" ++#line 638 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = 1; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2470,7 +2475,7 @@ yyreduce: + break; + + case 42: +-#line 639 "/usr/homes/chet/src/bash/src/parse.y" ++#line 644 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2479,7 +2484,7 @@ yyreduce: + break; + + case 43: +-#line 645 "/usr/homes/chet/src/bash/src/parse.y" ++#line 650 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2488,7 +2493,7 @@ yyreduce: + break; + + case 44: +-#line 651 "/usr/homes/chet/src/bash/src/parse.y" ++#line 656 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = 1; + redir.dest = 0; +@@ -2497,7 +2502,7 @@ yyreduce: + break; + + case 45: +-#line 657 "/usr/homes/chet/src/bash/src/parse.y" ++#line 662 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.dest = 0; +@@ -2506,7 +2511,7 @@ yyreduce: + break; + + case 46: +-#line 663 "/usr/homes/chet/src/bash/src/parse.y" ++#line 668 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.dest = 0; +@@ -2515,7 +2520,7 @@ yyreduce: + break; + + case 47: +-#line 669 "/usr/homes/chet/src/bash/src/parse.y" ++#line 674 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = 0; + redir.dest = 0; +@@ -2524,7 +2529,7 @@ yyreduce: + break; + + case 48: +-#line 675 "/usr/homes/chet/src/bash/src/parse.y" ++#line 680 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.dest = 0; +@@ -2533,7 +2538,7 @@ yyreduce: + break; + + case 49: +-#line 681 "/usr/homes/chet/src/bash/src/parse.y" ++#line 686 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.dest = 0; +@@ -2542,7 +2547,7 @@ yyreduce: + break; + + case 50: +-#line 687 "/usr/homes/chet/src/bash/src/parse.y" ++#line 692 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = 1; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2551,7 +2556,7 @@ yyreduce: + break; + + case 51: +-#line 693 "/usr/homes/chet/src/bash/src/parse.y" ++#line 698 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + source.dest = 1; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2560,29 +2565,29 @@ yyreduce: + break; + + case 52: +-#line 701 "/usr/homes/chet/src/bash/src/parse.y" ++#line 706 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.element).word = (yyvsp[(1) - (1)].word); (yyval.element).redirect = 0; } + break; + + case 53: +-#line 703 "/usr/homes/chet/src/bash/src/parse.y" ++#line 708 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.element).word = (yyvsp[(1) - (1)].word); (yyval.element).redirect = 0; } + break; + + case 54: +-#line 705 "/usr/homes/chet/src/bash/src/parse.y" ++#line 710 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.element).redirect = (yyvsp[(1) - (1)].redirect); (yyval.element).word = 0; } + break; + + case 55: +-#line 709 "/usr/homes/chet/src/bash/src/parse.y" ++#line 714 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.redirect) = (yyvsp[(1) - (1)].redirect); + } + break; + + case 56: +-#line 713 "/usr/homes/chet/src/bash/src/parse.y" ++#line 718 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + register REDIRECT *t; + +@@ -2594,27 +2599,27 @@ yyreduce: + break; + + case 57: +-#line 724 "/usr/homes/chet/src/bash/src/parse.y" ++#line 729 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = make_simple_command ((yyvsp[(1) - (1)].element), (COMMAND *)NULL); } + break; + + case 58: +-#line 726 "/usr/homes/chet/src/bash/src/parse.y" ++#line 731 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = make_simple_command ((yyvsp[(2) - (2)].element), (yyvsp[(1) - (2)].command)); } + break; + + case 59: +-#line 730 "/usr/homes/chet/src/bash/src/parse.y" ++#line 735 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = clean_simple_command ((yyvsp[(1) - (1)].command)); } + break; + + case 60: +-#line 732 "/usr/homes/chet/src/bash/src/parse.y" ++#line 737 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 61: +-#line 734 "/usr/homes/chet/src/bash/src/parse.y" ++#line 739 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + COMMAND *tc; + +@@ -2633,72 +2638,72 @@ yyreduce: + break; + + case 62: +-#line 750 "/usr/homes/chet/src/bash/src/parse.y" ++#line 755 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 63: +-#line 752 "/usr/homes/chet/src/bash/src/parse.y" ++#line 757 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 64: +-#line 756 "/usr/homes/chet/src/bash/src/parse.y" ++#line 761 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 65: +-#line 758 "/usr/homes/chet/src/bash/src/parse.y" ++#line 763 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 66: +-#line 760 "/usr/homes/chet/src/bash/src/parse.y" ++#line 765 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = make_while_command ((yyvsp[(2) - (5)].command), (yyvsp[(4) - (5)].command)); } + break; + + case 67: +-#line 762 "/usr/homes/chet/src/bash/src/parse.y" ++#line 767 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = make_until_command ((yyvsp[(2) - (5)].command), (yyvsp[(4) - (5)].command)); } + break; + + case 68: +-#line 764 "/usr/homes/chet/src/bash/src/parse.y" ++#line 769 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 69: +-#line 766 "/usr/homes/chet/src/bash/src/parse.y" ++#line 771 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 70: +-#line 768 "/usr/homes/chet/src/bash/src/parse.y" ++#line 773 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 71: +-#line 770 "/usr/homes/chet/src/bash/src/parse.y" ++#line 775 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 72: +-#line 772 "/usr/homes/chet/src/bash/src/parse.y" ++#line 777 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 73: +-#line 774 "/usr/homes/chet/src/bash/src/parse.y" ++#line 779 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 74: +-#line 776 "/usr/homes/chet/src/bash/src/parse.y" ++#line 781 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 75: +-#line 780 "/usr/homes/chet/src/bash/src/parse.y" ++#line 785 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_for_command ((yyvsp[(2) - (6)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(5) - (6)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2706,7 +2711,7 @@ yyreduce: + break; + + case 76: +-#line 785 "/usr/homes/chet/src/bash/src/parse.y" ++#line 790 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_for_command ((yyvsp[(2) - (6)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(5) - (6)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2714,7 +2719,7 @@ yyreduce: + break; + + case 77: +-#line 790 "/usr/homes/chet/src/bash/src/parse.y" ++#line 795 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_for_command ((yyvsp[(2) - (7)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(6) - (7)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2722,7 +2727,7 @@ yyreduce: + break; + + case 78: +-#line 795 "/usr/homes/chet/src/bash/src/parse.y" ++#line 800 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_for_command ((yyvsp[(2) - (7)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(6) - (7)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2730,7 +2735,7 @@ yyreduce: + break; + + case 79: +-#line 800 "/usr/homes/chet/src/bash/src/parse.y" ++#line 805 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_for_command ((yyvsp[(2) - (10)].word), REVERSE_LIST ((yyvsp[(5) - (10)].word_list), WORD_LIST *), (yyvsp[(9) - (10)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2738,7 +2743,7 @@ yyreduce: + break; + + case 80: +-#line 805 "/usr/homes/chet/src/bash/src/parse.y" ++#line 810 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_for_command ((yyvsp[(2) - (10)].word), REVERSE_LIST ((yyvsp[(5) - (10)].word_list), WORD_LIST *), (yyvsp[(9) - (10)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2746,7 +2751,7 @@ yyreduce: + break; + + case 81: +-#line 810 "/usr/homes/chet/src/bash/src/parse.y" ++#line 815 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_for_command ((yyvsp[(2) - (9)].word), (WORD_LIST *)NULL, (yyvsp[(8) - (9)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2754,7 +2759,7 @@ yyreduce: + break; + + case 82: +-#line 815 "/usr/homes/chet/src/bash/src/parse.y" ++#line 820 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_for_command ((yyvsp[(2) - (9)].word), (WORD_LIST *)NULL, (yyvsp[(8) - (9)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2762,7 +2767,7 @@ yyreduce: + break; + + case 83: +-#line 822 "/usr/homes/chet/src/bash/src/parse.y" ++#line 827 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_arith_for_command ((yyvsp[(2) - (7)].word_list), (yyvsp[(6) - (7)].command), arith_for_lineno); + if (word_top > 0) word_top--; +@@ -2770,7 +2775,7 @@ yyreduce: + break; + + case 84: +-#line 827 "/usr/homes/chet/src/bash/src/parse.y" ++#line 832 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_arith_for_command ((yyvsp[(2) - (7)].word_list), (yyvsp[(6) - (7)].command), arith_for_lineno); + if (word_top > 0) word_top--; +@@ -2778,7 +2783,7 @@ yyreduce: + break; + + case 85: +-#line 832 "/usr/homes/chet/src/bash/src/parse.y" ++#line 837 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_arith_for_command ((yyvsp[(2) - (5)].word_list), (yyvsp[(4) - (5)].command), arith_for_lineno); + if (word_top > 0) word_top--; +@@ -2786,7 +2791,7 @@ yyreduce: + break; + + case 86: +-#line 837 "/usr/homes/chet/src/bash/src/parse.y" ++#line 842 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_arith_for_command ((yyvsp[(2) - (5)].word_list), (yyvsp[(4) - (5)].command), arith_for_lineno); + if (word_top > 0) word_top--; +@@ -2794,7 +2799,7 @@ yyreduce: + break; + + case 87: +-#line 844 "/usr/homes/chet/src/bash/src/parse.y" ++#line 849 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_select_command ((yyvsp[(2) - (6)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(5) - (6)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2802,7 +2807,7 @@ yyreduce: + break; + + case 88: +-#line 849 "/usr/homes/chet/src/bash/src/parse.y" ++#line 854 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_select_command ((yyvsp[(2) - (6)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(5) - (6)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2810,7 +2815,7 @@ yyreduce: + break; + + case 89: +-#line 854 "/usr/homes/chet/src/bash/src/parse.y" ++#line 859 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_select_command ((yyvsp[(2) - (7)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(6) - (7)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2818,7 +2823,7 @@ yyreduce: + break; + + case 90: +-#line 859 "/usr/homes/chet/src/bash/src/parse.y" ++#line 864 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_select_command ((yyvsp[(2) - (7)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(6) - (7)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2826,7 +2831,7 @@ yyreduce: + break; + + case 91: +-#line 864 "/usr/homes/chet/src/bash/src/parse.y" ++#line 869 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_select_command ((yyvsp[(2) - (10)].word), REVERSE_LIST ((yyvsp[(5) - (10)].word_list), WORD_LIST *), (yyvsp[(9) - (10)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2834,7 +2839,7 @@ yyreduce: + break; + + case 92: +-#line 869 "/usr/homes/chet/src/bash/src/parse.y" ++#line 874 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_select_command ((yyvsp[(2) - (10)].word), REVERSE_LIST ((yyvsp[(5) - (10)].word_list), WORD_LIST *), (yyvsp[(9) - (10)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2842,7 +2847,7 @@ yyreduce: + break; + + case 93: +-#line 876 "/usr/homes/chet/src/bash/src/parse.y" ++#line 881 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_case_command ((yyvsp[(2) - (6)].word), (PATTERN_LIST *)NULL, word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2850,7 +2855,7 @@ yyreduce: + break; + + case 94: +-#line 881 "/usr/homes/chet/src/bash/src/parse.y" ++#line 886 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_case_command ((yyvsp[(2) - (7)].word), (yyvsp[(5) - (7)].pattern), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2858,7 +2863,7 @@ yyreduce: + break; + + case 95: +-#line 886 "/usr/homes/chet/src/bash/src/parse.y" ++#line 891 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_case_command ((yyvsp[(2) - (6)].word), (yyvsp[(5) - (6)].pattern), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2866,27 +2871,27 @@ yyreduce: + break; + + case 96: +-#line 893 "/usr/homes/chet/src/bash/src/parse.y" ++#line 898 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = make_function_def ((yyvsp[(1) - (5)].word), (yyvsp[(5) - (5)].command), function_dstart, function_bstart); } + break; + + case 97: +-#line 896 "/usr/homes/chet/src/bash/src/parse.y" ++#line 901 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = make_function_def ((yyvsp[(2) - (6)].word), (yyvsp[(6) - (6)].command), function_dstart, function_bstart); } + break; + + case 98: +-#line 899 "/usr/homes/chet/src/bash/src/parse.y" ++#line 904 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = make_function_def ((yyvsp[(2) - (4)].word), (yyvsp[(4) - (4)].command), function_dstart, function_bstart); } + break; + + case 99: +-#line 903 "/usr/homes/chet/src/bash/src/parse.y" ++#line 908 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 100: +-#line 905 "/usr/homes/chet/src/bash/src/parse.y" ++#line 910 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + COMMAND *tc; + +@@ -2918,7 +2923,7 @@ yyreduce: + break; + + case 101: +-#line 936 "/usr/homes/chet/src/bash/src/parse.y" ++#line 941 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_subshell_command ((yyvsp[(2) - (3)].command)); + (yyval.command)->flags |= CMD_WANT_SUBSHELL; +@@ -2926,7 +2931,7 @@ yyreduce: + break; + + case 102: +-#line 943 "/usr/homes/chet/src/bash/src/parse.y" ++#line 948 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_coproc_command ("COPROC", (yyvsp[(2) - (2)].command)); + (yyval.command)->flags |= CMD_WANT_SUBSHELL|CMD_COPROC_SUBSHELL; +@@ -2934,7 +2939,7 @@ yyreduce: + break; + + case 103: +-#line 948 "/usr/homes/chet/src/bash/src/parse.y" ++#line 953 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + COMMAND *tc; + +@@ -2954,7 +2959,7 @@ yyreduce: + break; + + case 104: +-#line 965 "/usr/homes/chet/src/bash/src/parse.y" ++#line 970 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_coproc_command ((yyvsp[(2) - (3)].word)->word, (yyvsp[(3) - (3)].command)); + (yyval.command)->flags |= CMD_WANT_SUBSHELL|CMD_COPROC_SUBSHELL; +@@ -2962,7 +2967,7 @@ yyreduce: + break; + + case 105: +-#line 970 "/usr/homes/chet/src/bash/src/parse.y" ++#line 975 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + COMMAND *tc; + +@@ -2982,7 +2987,7 @@ yyreduce: + break; + + case 106: +-#line 987 "/usr/homes/chet/src/bash/src/parse.y" ++#line 992 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = make_coproc_command ("COPROC", clean_simple_command ((yyvsp[(2) - (2)].command))); + (yyval.command)->flags |= CMD_WANT_SUBSHELL|CMD_COPROC_SUBSHELL; +@@ -2990,117 +2995,117 @@ yyreduce: + break; + + case 107: +-#line 994 "/usr/homes/chet/src/bash/src/parse.y" ++#line 999 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = make_if_command ((yyvsp[(2) - (5)].command), (yyvsp[(4) - (5)].command), (COMMAND *)NULL); } + break; + + case 108: +-#line 996 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1001 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = make_if_command ((yyvsp[(2) - (7)].command), (yyvsp[(4) - (7)].command), (yyvsp[(6) - (7)].command)); } + break; + + case 109: +-#line 998 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1003 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = make_if_command ((yyvsp[(2) - (6)].command), (yyvsp[(4) - (6)].command), (yyvsp[(5) - (6)].command)); } + break; + + case 110: +-#line 1003 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1008 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = make_group_command ((yyvsp[(2) - (3)].command)); } + break; + + case 111: +-#line 1007 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1012 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = make_arith_command ((yyvsp[(1) - (1)].word_list)); } + break; + + case 112: +-#line 1011 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1016 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(2) - (3)].command); } + break; + + case 113: +-#line 1015 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1020 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = make_if_command ((yyvsp[(2) - (4)].command), (yyvsp[(4) - (4)].command), (COMMAND *)NULL); } + break; + + case 114: +-#line 1017 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1022 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = make_if_command ((yyvsp[(2) - (6)].command), (yyvsp[(4) - (6)].command), (yyvsp[(6) - (6)].command)); } + break; + + case 115: +-#line 1019 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1024 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = make_if_command ((yyvsp[(2) - (5)].command), (yyvsp[(4) - (5)].command), (yyvsp[(5) - (5)].command)); } + break; + + case 117: +-#line 1024 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1029 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyvsp[(2) - (2)].pattern)->next = (yyvsp[(1) - (2)].pattern); (yyval.pattern) = (yyvsp[(2) - (2)].pattern); } + break; + + case 118: +-#line 1028 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1033 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.pattern) = make_pattern_list ((yyvsp[(2) - (4)].word_list), (yyvsp[(4) - (4)].command)); } + break; + + case 119: +-#line 1030 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1035 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.pattern) = make_pattern_list ((yyvsp[(2) - (4)].word_list), (COMMAND *)NULL); } + break; + + case 120: +-#line 1032 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1037 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.pattern) = make_pattern_list ((yyvsp[(3) - (5)].word_list), (yyvsp[(5) - (5)].command)); } + break; + + case 121: +-#line 1034 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1039 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.pattern) = make_pattern_list ((yyvsp[(3) - (5)].word_list), (COMMAND *)NULL); } + break; + + case 122: +-#line 1038 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1043 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.pattern) = (yyvsp[(1) - (2)].pattern); } + break; + + case 123: +-#line 1040 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1045 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyvsp[(2) - (3)].pattern)->next = (yyvsp[(1) - (3)].pattern); (yyval.pattern) = (yyvsp[(2) - (3)].pattern); } + break; + + case 124: +-#line 1042 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1047 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyvsp[(1) - (2)].pattern)->flags |= CASEPAT_FALLTHROUGH; (yyval.pattern) = (yyvsp[(1) - (2)].pattern); } + break; + + case 125: +-#line 1044 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1049 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyvsp[(2) - (3)].pattern)->flags |= CASEPAT_FALLTHROUGH; (yyvsp[(2) - (3)].pattern)->next = (yyvsp[(1) - (3)].pattern); (yyval.pattern) = (yyvsp[(2) - (3)].pattern); } + break; + + case 126: +-#line 1046 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1051 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyvsp[(1) - (2)].pattern)->flags |= CASEPAT_TESTNEXT; (yyval.pattern) = (yyvsp[(1) - (2)].pattern); } + break; + + case 127: +-#line 1048 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1053 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyvsp[(2) - (3)].pattern)->flags |= CASEPAT_TESTNEXT; (yyvsp[(2) - (3)].pattern)->next = (yyvsp[(1) - (3)].pattern); (yyval.pattern) = (yyvsp[(2) - (3)].pattern); } + break; + + case 128: +-#line 1052 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1057 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.word_list) = make_word_list ((yyvsp[(1) - (1)].word), (WORD_LIST *)NULL); } + break; + + case 129: +-#line 1054 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1059 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.word_list) = make_word_list ((yyvsp[(3) - (3)].word), (yyvsp[(1) - (3)].word_list)); } + break; + + case 130: +-#line 1063 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1068 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = (yyvsp[(2) - (2)].command); + if (need_here_doc) +@@ -3109,14 +3114,14 @@ yyreduce: + break; + + case 132: +-#line 1072 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1077 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = (yyvsp[(2) - (2)].command); + } + break; + + case 134: +-#line 1079 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1084 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + if ((yyvsp[(1) - (3)].command)->type == cm_connection) + (yyval.command) = connect_async_list ((yyvsp[(1) - (3)].command), (COMMAND *)NULL, '&'); +@@ -3126,17 +3131,17 @@ yyreduce: + break; + + case 136: +-#line 1090 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1095 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), AND_AND); } + break; + + case 137: +-#line 1092 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1097 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), OR_OR); } + break; + + case 138: +-#line 1094 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1099 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + if ((yyvsp[(1) - (4)].command)->type == cm_connection) + (yyval.command) = connect_async_list ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), '&'); +@@ -3146,37 +3151,37 @@ yyreduce: + break; + + case 139: +-#line 1101 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1106 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), ';'); } + break; + + case 140: +-#line 1103 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1108 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), ';'); } + break; + + case 141: +-#line 1105 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1110 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 144: +-#line 1113 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1118 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.number) = '\n'; } + break; + + case 145: +-#line 1115 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1120 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.number) = ';'; } + break; + + case 146: +-#line 1117 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1122 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.number) = yacc_EOF; } + break; + + case 149: +-#line 1131 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1136 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = (yyvsp[(1) - (1)].command); + if (need_here_doc) +@@ -3192,7 +3197,7 @@ yyreduce: + break; + + case 150: +-#line 1144 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1149 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + if ((yyvsp[(1) - (2)].command)->type == cm_connection) + (yyval.command) = connect_async_list ((yyvsp[(1) - (2)].command), (COMMAND *)NULL, '&'); +@@ -3211,7 +3216,7 @@ yyreduce: + break; + + case 151: +-#line 1160 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1165 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + (yyval.command) = (yyvsp[(1) - (2)].command); + if (need_here_doc) +@@ -3227,17 +3232,17 @@ yyreduce: + break; + + case 152: +-#line 1175 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1180 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), AND_AND); } + break; + + case 153: +-#line 1177 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1182 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), OR_OR); } + break; + + case 154: +-#line 1179 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1184 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + if ((yyvsp[(1) - (3)].command)->type == cm_connection) + (yyval.command) = connect_async_list ((yyvsp[(1) - (3)].command), (yyvsp[(3) - (3)].command), '&'); +@@ -3247,22 +3252,22 @@ yyreduce: + break; + + case 155: +-#line 1186 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1191 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = command_connect ((yyvsp[(1) - (3)].command), (yyvsp[(3) - (3)].command), ';'); } + break; + + case 156: +-#line 1189 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1194 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 157: +-#line 1193 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1198 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 158: +-#line 1195 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1200 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + if ((yyvsp[(2) - (2)].command)) + (yyvsp[(2) - (2)].command)->flags ^= CMD_INVERT_RETURN; /* toggle */ +@@ -3271,7 +3276,7 @@ yyreduce: + break; + + case 159: +-#line 1201 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1206 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + if ((yyvsp[(2) - (2)].command)) + (yyvsp[(2) - (2)].command)->flags |= (yyvsp[(1) - (2)].number); +@@ -3280,7 +3285,7 @@ yyreduce: + break; + + case 160: +-#line 1207 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1212 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + ELEMENT x; + +@@ -3300,7 +3305,7 @@ yyreduce: + break; + + case 161: +-#line 1224 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1229 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + ELEMENT x; + +@@ -3321,12 +3326,12 @@ yyreduce: + break; + + case 162: +-#line 1244 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1249 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), '|'); } + break; + + case 163: +-#line 1246 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1251 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { + /* Make cmd1 |& cmd2 equivalent to cmd1 2>&1 | cmd2 */ + COMMAND *tc; +@@ -3352,28 +3357,28 @@ yyreduce: + break; + + case 164: +-#line 1269 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1274 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 165: +-#line 1273 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1278 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.number) = CMD_TIME_PIPELINE; } + break; + + case 166: +-#line 1275 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1280 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.number) = CMD_TIME_PIPELINE|CMD_TIME_POSIX; } + break; + + case 167: +-#line 1277 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1282 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + { (yyval.number) = CMD_TIME_PIPELINE|CMD_TIME_POSIX; } + break; + + + /* Line 1267 of yacc.c. */ +-#line 3377 "y.tab.c" ++#line 3382 "y.tab.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); +@@ -3587,7 +3592,7 @@ yyreturn: + } + + +-#line 1279 "/usr/homes/chet/src/bash/src/parse.y" ++#line 1284 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" + + + /* Initial size to allocate for tokens, and the +@@ -4948,6 +4953,21 @@ yylex () + which allow ESAC to be the next one read. */ + static int esacs_needed_count; + ++static void ++push_heredoc (r) ++ REDIRECT *r; ++{ ++ if (need_here_doc >= HEREDOC_MAX) ++ { ++ last_command_exit_value = EX_BADUSAGE; ++ need_here_doc = 0; ++ report_syntax_error (_("maximum here-document count exceeded")); ++ reset_parser (); ++ exit_shell (last_command_exit_value); ++ } ++ redir_stack[need_here_doc++] = r; ++} ++ + void + gather_here_documents () + { +@@ -8541,3 +8561,4 @@ set_line_mbstate () + } + } + #endif /* HANDLE_MULTIBYTE */ ++ +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 27 ++#define PATCHLEVEL 28 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/129-upstream-bash43-029.patch b/utils/bash/patches/129-upstream-bash43-029.patch new file mode 100644 index 0000000..be82403 --- /dev/null +++ b/utils/bash/patches/129-upstream-bash43-029.patch @@ -0,0 +1,50 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-029 + +Bug-Reported-by: Michal Zalewski +Bug-Reference-ID: +Bug-Reference-URL: + +Bug-Description: + +When bash is parsing a function definition that contains a here-document +delimited by end-of-file (or end-of-string), it leaves the closing delimiter +uninitialized. This can result in an invalid memory access when the parsed +function is later copied. + +Patch (apply with `patch -p0'): + +--- a/make_cmd.c ++++ b/make_cmd.c +@@ -692,6 +692,7 @@ make_redirection (source, instruction, d + /* First do the common cases. */ + temp->redirector = source; + temp->redirectee = dest_and_filename; ++ temp->here_doc_eof = 0; + temp->instruction = instruction; + temp->flags = 0; + temp->rflags = flags; +--- a/copy_cmd.c ++++ b/copy_cmd.c +@@ -126,7 +126,7 @@ copy_redirect (redirect) + { + case r_reading_until: + case r_deblank_reading_until: +- new_redirect->here_doc_eof = savestring (redirect->here_doc_eof); ++ new_redirect->here_doc_eof = redirect->here_doc_eof ? savestring (redirect->here_doc_eof) : 0; + /*FALLTHROUGH*/ + case r_reading_string: + case r_appending_to: +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 28 ++#define PATCHLEVEL 29 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/130-upstream-bash43-030.patch b/utils/bash/patches/130-upstream-bash43-030.patch new file mode 100644 index 0000000..0eadc5c --- /dev/null +++ b/utils/bash/patches/130-upstream-bash43-030.patch @@ -0,0 +1,1396 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-030 + +Bug-Reported-by: Michal Zalewski +Bug-Reference-ID: +Bug-Reference-URL: + +Bug-Description: + +A combination of nested command substitutions and function importing from +the environment can cause bash to execute code appearing in the environment +variable value following the function definition. + +Patch (apply with `patch -p0'): + +--- a/builtins/evalstring.c ++++ b/builtins/evalstring.c +@@ -308,12 +308,25 @@ parse_and_execute (string, from_file, fl + { + struct fd_bitmap *bitmap; + +- if ((flags & SEVAL_FUNCDEF) && command->type != cm_function_def) ++ if (flags & SEVAL_FUNCDEF) + { +- internal_warning ("%s: ignoring function definition attempt", from_file); +- should_jump_to_top_level = 0; +- last_result = last_command_exit_value = EX_BADUSAGE; +- break; ++ char *x; ++ ++ /* If the command parses to something other than a straight ++ function definition, or if we have not consumed the entire ++ string, or if the parser has transformed the function ++ name (as parsing will if it begins or ends with shell ++ whitespace, for example), reject the attempt */ ++ if (command->type != cm_function_def || ++ ((x = parser_remaining_input ()) && *x) || ++ (STREQ (from_file, command->value.Function_def->name->word) == 0)) ++ { ++ internal_warning (_("%s: ignoring function definition attempt"), from_file); ++ should_jump_to_top_level = 0; ++ last_result = last_command_exit_value = EX_BADUSAGE; ++ reset_parser (); ++ break; ++ } + } + + bitmap = new_fd_bitmap (FD_BITMAP_SIZE); +@@ -378,7 +391,10 @@ parse_and_execute (string, from_file, fl + discard_unwind_frame ("pe_dispose"); + + if (flags & SEVAL_ONECMD) +- break; ++ { ++ reset_parser (); ++ break; ++ } + } + } + else +--- a/parse.y ++++ b/parse.y +@@ -2538,6 +2538,16 @@ shell_ungetc (c) + eol_ungetc_lookahead = c; + } + ++char * ++parser_remaining_input () ++{ ++ if (shell_input_line == 0) ++ return 0; ++ if (shell_input_line_index < 0 || shell_input_line_index >= shell_input_line_len) ++ return '\0'; /* XXX */ ++ return (shell_input_line + shell_input_line_index); ++} ++ + #ifdef INCLUDE_UNUSED + /* Back the input pointer up by one, effectively `ungetting' a character. */ + static void +@@ -4027,8 +4037,8 @@ xparse_dolparen (base, string, indp, fla + reset_parser (); + /* reset_parser clears shell_input_line and associated variables */ + restore_input_line_state (&ls); +- if (interactive) +- token_to_read = 0; ++ ++ token_to_read = 0; + + /* Need to find how many characters parse_and_execute consumed, update + *indp, if flags != 0, copy the portion of the string parsed into RET +--- a/shell.h ++++ b/shell.h +@@ -180,6 +180,8 @@ typedef struct _sh_input_line_state_t { + } sh_input_line_state_t; + + /* Let's try declaring these here. */ ++extern char *parser_remaining_input __P((void)); ++ + extern sh_parser_state_t *save_parser_state __P((sh_parser_state_t *)); + extern void restore_parser_state __P((sh_parser_state_t *)); + +--- a/y.tab.c ++++ b/y.tab.c +@@ -168,7 +168,7 @@ + + + /* Copy the first part of user declarations. */ +-#line 21 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 21 "/usr/src/local/bash/bash-4.3-patched/parse.y" + + #include "config.h" + +@@ -497,7 +497,7 @@ static REDIRECTEE redir; + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + typedef union YYSTYPE +-#line 329 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 329 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + WORD_DESC *word; /* the word that we read. */ + int number; /* the number that we read. */ +@@ -2098,7 +2098,7 @@ yyreduce: + switch (yyn) + { + case 2: +-#line 383 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 383 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + /* Case of regular command. Discard the error + safety net,and return the command just parsed. */ +@@ -2112,7 +2112,7 @@ yyreduce: + break; + + case 3: +-#line 394 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 394 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + /* Case of regular command, but not a very + interesting one. Return a NULL command. */ +@@ -2124,7 +2124,7 @@ yyreduce: + break; + + case 4: +-#line 403 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 403 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + /* Error during parsing. Return NULL command. */ + global_command = (COMMAND *)NULL; +@@ -2142,7 +2142,7 @@ yyreduce: + break; + + case 5: +-#line 418 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 418 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + /* Case of EOF seen by itself. Do ignoreeof or + not. */ +@@ -2153,17 +2153,17 @@ yyreduce: + break; + + case 6: +-#line 428 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 428 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.word_list) = make_word_list ((yyvsp[(1) - (1)].word), (WORD_LIST *)NULL); } + break; + + case 7: +-#line 430 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 430 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.word_list) = make_word_list ((yyvsp[(2) - (2)].word), (yyvsp[(1) - (2)].word_list)); } + break; + + case 8: +-#line 434 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 434 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = 1; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2172,7 +2172,7 @@ yyreduce: + break; + + case 9: +-#line 440 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 440 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = 0; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2181,7 +2181,7 @@ yyreduce: + break; + + case 10: +-#line 446 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 446 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2190,7 +2190,7 @@ yyreduce: + break; + + case 11: +-#line 452 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 452 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2199,7 +2199,7 @@ yyreduce: + break; + + case 12: +-#line 458 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 458 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2208,7 +2208,7 @@ yyreduce: + break; + + case 13: +-#line 464 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 464 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2217,7 +2217,7 @@ yyreduce: + break; + + case 14: +-#line 470 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 470 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = 1; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2226,7 +2226,7 @@ yyreduce: + break; + + case 15: +-#line 476 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 476 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2235,7 +2235,7 @@ yyreduce: + break; + + case 16: +-#line 482 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 482 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2244,7 +2244,7 @@ yyreduce: + break; + + case 17: +-#line 488 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 488 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = 1; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2253,7 +2253,7 @@ yyreduce: + break; + + case 18: +-#line 494 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 494 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2262,7 +2262,7 @@ yyreduce: + break; + + case 19: +-#line 500 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 500 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2271,7 +2271,7 @@ yyreduce: + break; + + case 20: +-#line 506 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 506 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = 0; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2280,7 +2280,7 @@ yyreduce: + break; + + case 21: +-#line 512 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 512 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2289,7 +2289,7 @@ yyreduce: + break; + + case 22: +-#line 518 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 518 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2298,7 +2298,7 @@ yyreduce: + break; + + case 23: +-#line 524 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 524 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = 0; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2308,7 +2308,7 @@ yyreduce: + break; + + case 24: +-#line 531 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 531 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2318,7 +2318,7 @@ yyreduce: + break; + + case 25: +-#line 538 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 538 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2328,7 +2328,7 @@ yyreduce: + break; + + case 26: +-#line 545 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 545 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = 0; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2338,7 +2338,7 @@ yyreduce: + break; + + case 27: +-#line 552 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 552 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2348,7 +2348,7 @@ yyreduce: + break; + + case 28: +-#line 559 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 559 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2358,7 +2358,7 @@ yyreduce: + break; + + case 29: +-#line 566 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 566 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = 0; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2367,7 +2367,7 @@ yyreduce: + break; + + case 30: +-#line 572 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 572 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2376,7 +2376,7 @@ yyreduce: + break; + + case 31: +-#line 578 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 578 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2385,7 +2385,7 @@ yyreduce: + break; + + case 32: +-#line 584 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 584 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = 0; + redir.dest = (yyvsp[(2) - (2)].number); +@@ -2394,7 +2394,7 @@ yyreduce: + break; + + case 33: +-#line 590 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 590 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.dest = (yyvsp[(3) - (3)].number); +@@ -2403,7 +2403,7 @@ yyreduce: + break; + + case 34: +-#line 596 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 596 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.dest = (yyvsp[(3) - (3)].number); +@@ -2412,7 +2412,7 @@ yyreduce: + break; + + case 35: +-#line 602 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 602 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = 1; + redir.dest = (yyvsp[(2) - (2)].number); +@@ -2421,7 +2421,7 @@ yyreduce: + break; + + case 36: +-#line 608 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 608 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.dest = (yyvsp[(3) - (3)].number); +@@ -2430,7 +2430,7 @@ yyreduce: + break; + + case 37: +-#line 614 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 614 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.dest = (yyvsp[(3) - (3)].number); +@@ -2439,7 +2439,7 @@ yyreduce: + break; + + case 38: +-#line 620 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 620 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = 0; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2448,7 +2448,7 @@ yyreduce: + break; + + case 39: +-#line 626 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 626 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2457,7 +2457,7 @@ yyreduce: + break; + + case 40: +-#line 632 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 632 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2466,7 +2466,7 @@ yyreduce: + break; + + case 41: +-#line 638 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 638 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = 1; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2475,7 +2475,7 @@ yyreduce: + break; + + case 42: +-#line 644 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 644 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2484,7 +2484,7 @@ yyreduce: + break; + + case 43: +-#line 650 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 650 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.filename = (yyvsp[(3) - (3)].word); +@@ -2493,7 +2493,7 @@ yyreduce: + break; + + case 44: +-#line 656 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 656 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = 1; + redir.dest = 0; +@@ -2502,7 +2502,7 @@ yyreduce: + break; + + case 45: +-#line 662 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 662 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.dest = 0; +@@ -2511,7 +2511,7 @@ yyreduce: + break; + + case 46: +-#line 668 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 668 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.dest = 0; +@@ -2520,7 +2520,7 @@ yyreduce: + break; + + case 47: +-#line 674 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 674 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = 0; + redir.dest = 0; +@@ -2529,7 +2529,7 @@ yyreduce: + break; + + case 48: +-#line 680 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 680 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = (yyvsp[(1) - (3)].number); + redir.dest = 0; +@@ -2538,7 +2538,7 @@ yyreduce: + break; + + case 49: +-#line 686 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 686 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.filename = (yyvsp[(1) - (3)].word); + redir.dest = 0; +@@ -2547,7 +2547,7 @@ yyreduce: + break; + + case 50: +-#line 692 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 692 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = 1; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2556,7 +2556,7 @@ yyreduce: + break; + + case 51: +-#line 698 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 698 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + source.dest = 1; + redir.filename = (yyvsp[(2) - (2)].word); +@@ -2565,29 +2565,29 @@ yyreduce: + break; + + case 52: +-#line 706 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 706 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.element).word = (yyvsp[(1) - (1)].word); (yyval.element).redirect = 0; } + break; + + case 53: +-#line 708 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 708 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.element).word = (yyvsp[(1) - (1)].word); (yyval.element).redirect = 0; } + break; + + case 54: +-#line 710 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 710 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.element).redirect = (yyvsp[(1) - (1)].redirect); (yyval.element).word = 0; } + break; + + case 55: +-#line 714 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 714 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.redirect) = (yyvsp[(1) - (1)].redirect); + } + break; + + case 56: +-#line 718 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 718 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + register REDIRECT *t; + +@@ -2599,27 +2599,27 @@ yyreduce: + break; + + case 57: +-#line 729 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 729 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = make_simple_command ((yyvsp[(1) - (1)].element), (COMMAND *)NULL); } + break; + + case 58: +-#line 731 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 731 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = make_simple_command ((yyvsp[(2) - (2)].element), (yyvsp[(1) - (2)].command)); } + break; + + case 59: +-#line 735 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 735 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = clean_simple_command ((yyvsp[(1) - (1)].command)); } + break; + + case 60: +-#line 737 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 737 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 61: +-#line 739 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 739 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + COMMAND *tc; + +@@ -2638,72 +2638,72 @@ yyreduce: + break; + + case 62: +-#line 755 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 755 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 63: +-#line 757 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 757 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 64: +-#line 761 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 761 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 65: +-#line 763 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 763 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 66: +-#line 765 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 765 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = make_while_command ((yyvsp[(2) - (5)].command), (yyvsp[(4) - (5)].command)); } + break; + + case 67: +-#line 767 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 767 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = make_until_command ((yyvsp[(2) - (5)].command), (yyvsp[(4) - (5)].command)); } + break; + + case 68: +-#line 769 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 769 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 69: +-#line 771 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 771 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 70: +-#line 773 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 773 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 71: +-#line 775 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 775 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 72: +-#line 777 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 777 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 73: +-#line 779 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 779 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 74: +-#line 781 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 781 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 75: +-#line 785 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 785 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_for_command ((yyvsp[(2) - (6)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(5) - (6)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2711,7 +2711,7 @@ yyreduce: + break; + + case 76: +-#line 790 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 790 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_for_command ((yyvsp[(2) - (6)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(5) - (6)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2719,7 +2719,7 @@ yyreduce: + break; + + case 77: +-#line 795 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 795 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_for_command ((yyvsp[(2) - (7)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(6) - (7)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2727,7 +2727,7 @@ yyreduce: + break; + + case 78: +-#line 800 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 800 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_for_command ((yyvsp[(2) - (7)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(6) - (7)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2735,7 +2735,7 @@ yyreduce: + break; + + case 79: +-#line 805 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 805 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_for_command ((yyvsp[(2) - (10)].word), REVERSE_LIST ((yyvsp[(5) - (10)].word_list), WORD_LIST *), (yyvsp[(9) - (10)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2743,7 +2743,7 @@ yyreduce: + break; + + case 80: +-#line 810 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 810 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_for_command ((yyvsp[(2) - (10)].word), REVERSE_LIST ((yyvsp[(5) - (10)].word_list), WORD_LIST *), (yyvsp[(9) - (10)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2751,7 +2751,7 @@ yyreduce: + break; + + case 81: +-#line 815 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 815 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_for_command ((yyvsp[(2) - (9)].word), (WORD_LIST *)NULL, (yyvsp[(8) - (9)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2759,7 +2759,7 @@ yyreduce: + break; + + case 82: +-#line 820 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 820 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_for_command ((yyvsp[(2) - (9)].word), (WORD_LIST *)NULL, (yyvsp[(8) - (9)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2767,7 +2767,7 @@ yyreduce: + break; + + case 83: +-#line 827 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 827 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_arith_for_command ((yyvsp[(2) - (7)].word_list), (yyvsp[(6) - (7)].command), arith_for_lineno); + if (word_top > 0) word_top--; +@@ -2775,7 +2775,7 @@ yyreduce: + break; + + case 84: +-#line 832 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 832 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_arith_for_command ((yyvsp[(2) - (7)].word_list), (yyvsp[(6) - (7)].command), arith_for_lineno); + if (word_top > 0) word_top--; +@@ -2783,7 +2783,7 @@ yyreduce: + break; + + case 85: +-#line 837 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 837 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_arith_for_command ((yyvsp[(2) - (5)].word_list), (yyvsp[(4) - (5)].command), arith_for_lineno); + if (word_top > 0) word_top--; +@@ -2791,7 +2791,7 @@ yyreduce: + break; + + case 86: +-#line 842 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 842 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_arith_for_command ((yyvsp[(2) - (5)].word_list), (yyvsp[(4) - (5)].command), arith_for_lineno); + if (word_top > 0) word_top--; +@@ -2799,7 +2799,7 @@ yyreduce: + break; + + case 87: +-#line 849 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 849 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_select_command ((yyvsp[(2) - (6)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(5) - (6)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2807,7 +2807,7 @@ yyreduce: + break; + + case 88: +-#line 854 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 854 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_select_command ((yyvsp[(2) - (6)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(5) - (6)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2815,7 +2815,7 @@ yyreduce: + break; + + case 89: +-#line 859 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 859 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_select_command ((yyvsp[(2) - (7)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(6) - (7)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2823,7 +2823,7 @@ yyreduce: + break; + + case 90: +-#line 864 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 864 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_select_command ((yyvsp[(2) - (7)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(6) - (7)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2831,7 +2831,7 @@ yyreduce: + break; + + case 91: +-#line 869 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 869 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_select_command ((yyvsp[(2) - (10)].word), REVERSE_LIST ((yyvsp[(5) - (10)].word_list), WORD_LIST *), (yyvsp[(9) - (10)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2839,7 +2839,7 @@ yyreduce: + break; + + case 92: +-#line 874 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 874 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_select_command ((yyvsp[(2) - (10)].word), REVERSE_LIST ((yyvsp[(5) - (10)].word_list), WORD_LIST *), (yyvsp[(9) - (10)].command), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2847,7 +2847,7 @@ yyreduce: + break; + + case 93: +-#line 881 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 881 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_case_command ((yyvsp[(2) - (6)].word), (PATTERN_LIST *)NULL, word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2855,7 +2855,7 @@ yyreduce: + break; + + case 94: +-#line 886 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 886 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_case_command ((yyvsp[(2) - (7)].word), (yyvsp[(5) - (7)].pattern), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2863,7 +2863,7 @@ yyreduce: + break; + + case 95: +-#line 891 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 891 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_case_command ((yyvsp[(2) - (6)].word), (yyvsp[(5) - (6)].pattern), word_lineno[word_top]); + if (word_top > 0) word_top--; +@@ -2871,27 +2871,27 @@ yyreduce: + break; + + case 96: +-#line 898 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 898 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = make_function_def ((yyvsp[(1) - (5)].word), (yyvsp[(5) - (5)].command), function_dstart, function_bstart); } + break; + + case 97: +-#line 901 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 901 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = make_function_def ((yyvsp[(2) - (6)].word), (yyvsp[(6) - (6)].command), function_dstart, function_bstart); } + break; + + case 98: +-#line 904 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 904 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = make_function_def ((yyvsp[(2) - (4)].word), (yyvsp[(4) - (4)].command), function_dstart, function_bstart); } + break; + + case 99: +-#line 908 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 908 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 100: +-#line 910 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 910 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + COMMAND *tc; + +@@ -2923,7 +2923,7 @@ yyreduce: + break; + + case 101: +-#line 941 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 941 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_subshell_command ((yyvsp[(2) - (3)].command)); + (yyval.command)->flags |= CMD_WANT_SUBSHELL; +@@ -2931,7 +2931,7 @@ yyreduce: + break; + + case 102: +-#line 948 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 948 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_coproc_command ("COPROC", (yyvsp[(2) - (2)].command)); + (yyval.command)->flags |= CMD_WANT_SUBSHELL|CMD_COPROC_SUBSHELL; +@@ -2939,7 +2939,7 @@ yyreduce: + break; + + case 103: +-#line 953 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 953 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + COMMAND *tc; + +@@ -2959,7 +2959,7 @@ yyreduce: + break; + + case 104: +-#line 970 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 970 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_coproc_command ((yyvsp[(2) - (3)].word)->word, (yyvsp[(3) - (3)].command)); + (yyval.command)->flags |= CMD_WANT_SUBSHELL|CMD_COPROC_SUBSHELL; +@@ -2967,7 +2967,7 @@ yyreduce: + break; + + case 105: +-#line 975 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 975 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + COMMAND *tc; + +@@ -2987,7 +2987,7 @@ yyreduce: + break; + + case 106: +-#line 992 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 992 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = make_coproc_command ("COPROC", clean_simple_command ((yyvsp[(2) - (2)].command))); + (yyval.command)->flags |= CMD_WANT_SUBSHELL|CMD_COPROC_SUBSHELL; +@@ -2995,117 +2995,117 @@ yyreduce: + break; + + case 107: +-#line 999 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 999 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = make_if_command ((yyvsp[(2) - (5)].command), (yyvsp[(4) - (5)].command), (COMMAND *)NULL); } + break; + + case 108: +-#line 1001 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1001 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = make_if_command ((yyvsp[(2) - (7)].command), (yyvsp[(4) - (7)].command), (yyvsp[(6) - (7)].command)); } + break; + + case 109: +-#line 1003 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1003 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = make_if_command ((yyvsp[(2) - (6)].command), (yyvsp[(4) - (6)].command), (yyvsp[(5) - (6)].command)); } + break; + + case 110: +-#line 1008 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1008 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = make_group_command ((yyvsp[(2) - (3)].command)); } + break; + + case 111: +-#line 1012 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1012 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = make_arith_command ((yyvsp[(1) - (1)].word_list)); } + break; + + case 112: +-#line 1016 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1016 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(2) - (3)].command); } + break; + + case 113: +-#line 1020 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1020 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = make_if_command ((yyvsp[(2) - (4)].command), (yyvsp[(4) - (4)].command), (COMMAND *)NULL); } + break; + + case 114: +-#line 1022 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1022 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = make_if_command ((yyvsp[(2) - (6)].command), (yyvsp[(4) - (6)].command), (yyvsp[(6) - (6)].command)); } + break; + + case 115: +-#line 1024 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1024 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = make_if_command ((yyvsp[(2) - (5)].command), (yyvsp[(4) - (5)].command), (yyvsp[(5) - (5)].command)); } + break; + + case 117: +-#line 1029 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1029 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyvsp[(2) - (2)].pattern)->next = (yyvsp[(1) - (2)].pattern); (yyval.pattern) = (yyvsp[(2) - (2)].pattern); } + break; + + case 118: +-#line 1033 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1033 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.pattern) = make_pattern_list ((yyvsp[(2) - (4)].word_list), (yyvsp[(4) - (4)].command)); } + break; + + case 119: +-#line 1035 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1035 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.pattern) = make_pattern_list ((yyvsp[(2) - (4)].word_list), (COMMAND *)NULL); } + break; + + case 120: +-#line 1037 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1037 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.pattern) = make_pattern_list ((yyvsp[(3) - (5)].word_list), (yyvsp[(5) - (5)].command)); } + break; + + case 121: +-#line 1039 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1039 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.pattern) = make_pattern_list ((yyvsp[(3) - (5)].word_list), (COMMAND *)NULL); } + break; + + case 122: +-#line 1043 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1043 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.pattern) = (yyvsp[(1) - (2)].pattern); } + break; + + case 123: +-#line 1045 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1045 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyvsp[(2) - (3)].pattern)->next = (yyvsp[(1) - (3)].pattern); (yyval.pattern) = (yyvsp[(2) - (3)].pattern); } + break; + + case 124: +-#line 1047 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1047 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyvsp[(1) - (2)].pattern)->flags |= CASEPAT_FALLTHROUGH; (yyval.pattern) = (yyvsp[(1) - (2)].pattern); } + break; + + case 125: +-#line 1049 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1049 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyvsp[(2) - (3)].pattern)->flags |= CASEPAT_FALLTHROUGH; (yyvsp[(2) - (3)].pattern)->next = (yyvsp[(1) - (3)].pattern); (yyval.pattern) = (yyvsp[(2) - (3)].pattern); } + break; + + case 126: +-#line 1051 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1051 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyvsp[(1) - (2)].pattern)->flags |= CASEPAT_TESTNEXT; (yyval.pattern) = (yyvsp[(1) - (2)].pattern); } + break; + + case 127: +-#line 1053 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1053 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyvsp[(2) - (3)].pattern)->flags |= CASEPAT_TESTNEXT; (yyvsp[(2) - (3)].pattern)->next = (yyvsp[(1) - (3)].pattern); (yyval.pattern) = (yyvsp[(2) - (3)].pattern); } + break; + + case 128: +-#line 1057 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1057 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.word_list) = make_word_list ((yyvsp[(1) - (1)].word), (WORD_LIST *)NULL); } + break; + + case 129: +-#line 1059 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1059 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.word_list) = make_word_list ((yyvsp[(3) - (3)].word), (yyvsp[(1) - (3)].word_list)); } + break; + + case 130: +-#line 1068 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1068 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = (yyvsp[(2) - (2)].command); + if (need_here_doc) +@@ -3114,14 +3114,14 @@ yyreduce: + break; + + case 132: +-#line 1077 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1077 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = (yyvsp[(2) - (2)].command); + } + break; + + case 134: +-#line 1084 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1084 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + if ((yyvsp[(1) - (3)].command)->type == cm_connection) + (yyval.command) = connect_async_list ((yyvsp[(1) - (3)].command), (COMMAND *)NULL, '&'); +@@ -3131,17 +3131,17 @@ yyreduce: + break; + + case 136: +-#line 1095 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1095 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), AND_AND); } + break; + + case 137: +-#line 1097 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1097 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), OR_OR); } + break; + + case 138: +-#line 1099 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1099 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + if ((yyvsp[(1) - (4)].command)->type == cm_connection) + (yyval.command) = connect_async_list ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), '&'); +@@ -3151,37 +3151,37 @@ yyreduce: + break; + + case 139: +-#line 1106 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1106 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), ';'); } + break; + + case 140: +-#line 1108 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1108 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), ';'); } + break; + + case 141: +-#line 1110 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1110 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 144: +-#line 1118 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1118 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.number) = '\n'; } + break; + + case 145: +-#line 1120 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1120 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.number) = ';'; } + break; + + case 146: +-#line 1122 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1122 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.number) = yacc_EOF; } + break; + + case 149: +-#line 1136 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1136 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = (yyvsp[(1) - (1)].command); + if (need_here_doc) +@@ -3197,7 +3197,7 @@ yyreduce: + break; + + case 150: +-#line 1149 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1149 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + if ((yyvsp[(1) - (2)].command)->type == cm_connection) + (yyval.command) = connect_async_list ((yyvsp[(1) - (2)].command), (COMMAND *)NULL, '&'); +@@ -3216,7 +3216,7 @@ yyreduce: + break; + + case 151: +-#line 1165 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1165 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + (yyval.command) = (yyvsp[(1) - (2)].command); + if (need_here_doc) +@@ -3232,17 +3232,17 @@ yyreduce: + break; + + case 152: +-#line 1180 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1180 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), AND_AND); } + break; + + case 153: +-#line 1182 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1182 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), OR_OR); } + break; + + case 154: +-#line 1184 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1184 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + if ((yyvsp[(1) - (3)].command)->type == cm_connection) + (yyval.command) = connect_async_list ((yyvsp[(1) - (3)].command), (yyvsp[(3) - (3)].command), '&'); +@@ -3252,22 +3252,22 @@ yyreduce: + break; + + case 155: +-#line 1191 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1191 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = command_connect ((yyvsp[(1) - (3)].command), (yyvsp[(3) - (3)].command), ';'); } + break; + + case 156: +-#line 1194 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1194 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 157: +-#line 1198 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1198 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 158: +-#line 1200 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1200 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + if ((yyvsp[(2) - (2)].command)) + (yyvsp[(2) - (2)].command)->flags ^= CMD_INVERT_RETURN; /* toggle */ +@@ -3276,7 +3276,7 @@ yyreduce: + break; + + case 159: +-#line 1206 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1206 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + if ((yyvsp[(2) - (2)].command)) + (yyvsp[(2) - (2)].command)->flags |= (yyvsp[(1) - (2)].number); +@@ -3285,7 +3285,7 @@ yyreduce: + break; + + case 160: +-#line 1212 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1212 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + ELEMENT x; + +@@ -3305,7 +3305,7 @@ yyreduce: + break; + + case 161: +-#line 1229 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1229 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + ELEMENT x; + +@@ -3326,12 +3326,12 @@ yyreduce: + break; + + case 162: +-#line 1249 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1249 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), '|'); } + break; + + case 163: +-#line 1251 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1251 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { + /* Make cmd1 |& cmd2 equivalent to cmd1 2>&1 | cmd2 */ + COMMAND *tc; +@@ -3357,22 +3357,22 @@ yyreduce: + break; + + case 164: +-#line 1274 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1274 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.command) = (yyvsp[(1) - (1)].command); } + break; + + case 165: +-#line 1278 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1278 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.number) = CMD_TIME_PIPELINE; } + break; + + case 166: +-#line 1280 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1280 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.number) = CMD_TIME_PIPELINE|CMD_TIME_POSIX; } + break; + + case 167: +-#line 1282 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1282 "/usr/src/local/bash/bash-4.3-patched/parse.y" + { (yyval.number) = CMD_TIME_PIPELINE|CMD_TIME_POSIX; } + break; + +@@ -3592,7 +3592,7 @@ yyreturn: + } + + +-#line 1284 "/usr/src/local/chet/src/bash/bash-4.3.28/parse.y" ++#line 1284 "/usr/src/local/bash/bash-4.3-patched/parse.y" + + + /* Initial size to allocate for tokens, and the +@@ -4850,6 +4850,16 @@ shell_ungetc (c) + eol_ungetc_lookahead = c; + } + ++char * ++parser_remaining_input () ++{ ++ if (shell_input_line == 0) ++ return 0; ++ if (shell_input_line_index < 0 || shell_input_line_index >= shell_input_line_len) ++ return '\0'; /* XXX */ ++ return (shell_input_line + shell_input_line_index); ++} ++ + #ifdef INCLUDE_UNUSED + /* Back the input pointer up by one, effectively `ungetting' a character. */ + static void +@@ -6339,8 +6349,8 @@ xparse_dolparen (base, string, indp, fla + reset_parser (); + /* reset_parser clears shell_input_line and associated variables */ + restore_input_line_state (&ls); +- if (interactive) +- token_to_read = 0; ++ ++ token_to_read = 0; + + /* Need to find how many characters parse_and_execute consumed, update + *indp, if flags != 0, copy the portion of the string parsed into RET +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 29 ++#define PATCHLEVEL 30 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/131-upstream-bash43-031.patch b/utils/bash/patches/131-upstream-bash43-031.patch new file mode 100644 index 0000000..a22cb07 --- /dev/null +++ b/utils/bash/patches/131-upstream-bash43-031.patch @@ -0,0 +1,96 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-031 + +Bug-Reported-by: lolilolicon +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-08/msg00139.html + +Bug-Description: + +The new nameref assignment functionality introduced in bash-4.3 did not perform +enough validation on the variable value and would create variables with +invalid names. + +Patch (apply with `patch -p0'): + +--- a/subst.h ++++ b/subst.h +@@ -47,6 +47,7 @@ + #define ASS_MKASSOC 0x0004 + #define ASS_MKGLOBAL 0x0008 /* force global assignment */ + #define ASS_NAMEREF 0x0010 /* assigning to nameref variable */ ++#define ASS_FROMREF 0x0020 /* assigning from value of nameref variable */ + + /* Flags for the string extraction functions. */ + #define SX_NOALLOC 0x0001 /* just skip; don't return substring */ +--- a/variables.c ++++ b/variables.c +@@ -2516,10 +2516,27 @@ bind_variable_internal (name, value, tab + HASH_TABLE *table; + int hflags, aflags; + { +- char *newval; ++ char *newname, *newval; + SHELL_VAR *entry; ++#if defined (ARRAY_VARS) ++ arrayind_t ind; ++ char *subp; ++ int sublen; ++#endif + ++ newname = 0; ++#if defined (ARRAY_VARS) ++ if ((aflags & ASS_FROMREF) && (hflags & HASH_NOSRCH) == 0 && valid_array_reference (name)) ++ { ++ newname = array_variable_name (name, &subp, &sublen); ++ if (newname == 0) ++ return (SHELL_VAR *)NULL; /* XXX */ ++ entry = hash_lookup (newname, table); ++ } ++ else ++#endif + entry = (hflags & HASH_NOSRCH) ? (SHELL_VAR *)NULL : hash_lookup (name, table); ++ + /* Follow the nameref chain here if this is the global variables table */ + if (entry && nameref_p (entry) && (invisible_p (entry) == 0) && table == global_variables->table) + { +@@ -2550,6 +2567,16 @@ bind_variable_internal (name, value, tab + var_setvalue (entry, make_variable_value (entry, value, 0)); + } + } ++#if defined (ARRAY_VARS) ++ else if (entry == 0 && newname) ++ { ++ entry = make_new_array_variable (newname); /* indexed array by default */ ++ if (entry == 0) ++ return entry; ++ ind = array_expand_index (name, subp, sublen); ++ bind_array_element (entry, ind, value, aflags); ++ } ++#endif + else if (entry == 0) + { + entry = make_new_variable (name, table); +@@ -2670,7 +2697,8 @@ bind_variable (name, value, flags) + normal. */ + if (nameref_cell (nv) == 0) + return (bind_variable_internal (nv->name, value, nvc->table, 0, flags)); +- return (bind_variable_internal (nameref_cell (nv), value, nvc->table, 0, flags)); ++ /* XXX - bug here with ref=array[index] */ ++ return (bind_variable_internal (nameref_cell (nv), value, nvc->table, 0, flags|ASS_FROMREF)); + } + else + v = nv; +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 30 ++#define PATCHLEVEL 31 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/132-upstream-bash43-032.patch b/utils/bash/patches/132-upstream-bash43-032.patch new file mode 100644 index 0000000..96a86c9 --- /dev/null +++ b/utils/bash/patches/132-upstream-bash43-032.patch @@ -0,0 +1,42 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-032 + +Bug-Reported-by: crispusfairbairn@gmail.com +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-09/msg00013.html + +Bug-Description: + +When bash is running in Posix mode, it allows signals -- including SIGCHLD -- +to interrupt the `wait' builtin, as Posix requires. However, the interrupt +causes bash to not run a SIGCHLD trap for all exited children. This patch +fixes the issue and restores the documented behavior in Posix mode. + +Patch (apply with `patch -p0'): + +--- a/jobs.c ++++ b/jobs.c +@@ -3339,7 +3339,9 @@ itrace("waitchld: waitpid returns %d blo + if (posixly_correct && this_shell_builtin && this_shell_builtin == wait_builtin) + { + interrupt_immediately = 0; +- trap_handler (SIGCHLD); /* set pending_traps[SIGCHLD] */ ++ /* This was trap_handler (SIGCHLD) but that can lose traps if ++ children_exited > 1 */ ++ queue_sigchld_trap (children_exited); + wait_signal_received = SIGCHLD; + /* If we're in a signal handler, let CHECK_WAIT_INTR pick it up; + run_pending_traps will call run_sigchld_trap later */ +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 31 ++#define PATCHLEVEL 32 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/133-upstream-bash43-033.patch b/utils/bash/patches/133-upstream-bash43-033.patch new file mode 100644 index 0000000..6210b5e --- /dev/null +++ b/utils/bash/patches/133-upstream-bash43-033.patch @@ -0,0 +1,201 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-033 + +Bug-Reported-by: mickael9@gmail.com, Jan Rome +Bug-Reference-ID: <20140907224046.382ED3610CC@mickael-laptop.localdomain>, + <540D661D.50908@gmail.com> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-09/msg00029.html + http://lists.gnu.org/archive/html/bug-bash/2014-09/msg00030.html + +Bug-Description: + +Bash does not clean up the terminal state in all cases where bash or +readline modifies it and bash is subsequently terminated by a fatal signal. +This happens when the `read' builtin modifies the terminal settings, both +when readline is active and when it is not. It occurs most often when a script +installs a trap that exits on a signal without re-sending the signal to itself. + +Patch (apply with `patch -p0'): + +--- a/shell.c ++++ b/shell.c +@@ -73,6 +73,7 @@ + #endif + + #if defined (READLINE) ++# include + # include "bashline.h" + #endif + +@@ -909,6 +910,14 @@ exit_shell (s) + fflush (stdout); /* XXX */ + fflush (stderr); + ++ /* Clean up the terminal if we are in a state where it's been modified. */ ++#if defined (READLINE) ++ if (RL_ISSTATE (RL_STATE_TERMPREPPED) && rl_deprep_term_function) ++ (*rl_deprep_term_function) (); ++#endif ++ if (read_tty_modified ()) ++ read_tty_cleanup (); ++ + /* Do trap[0] if defined. Allow it to override the exit status + passed to us. */ + if (signal_is_trapped (0)) +--- a/builtins/read.def ++++ b/builtins/read.def +@@ -140,10 +140,12 @@ static void reset_alarm __P((void)); + procenv_t alrmbuf; + int sigalrm_seen; + +-static int reading; ++static int reading, tty_modified; + static SigHandler *old_alrm; + static unsigned char delim; + ++static struct ttsave termsave; ++ + /* In all cases, SIGALRM just sets a flag that we check periodically. This + avoids problems with the semi-tricky stuff we do with the xfree of + input_string at the top of the unwind-protect list (see below). */ +@@ -188,7 +190,6 @@ read_builtin (list) + struct stat tsb; + SHELL_VAR *var; + TTYSTRUCT ttattrs, ttset; +- struct ttsave termsave; + #if defined (ARRAY_VARS) + WORD_LIST *alist; + #endif +@@ -221,7 +222,7 @@ read_builtin (list) + USE_VAR(ps2); + USE_VAR(lastsig); + +- sigalrm_seen = reading = 0; ++ sigalrm_seen = reading = tty_modified = 0; + + i = 0; /* Index into the string that we are reading. */ + raw = edit = 0; /* Not reading raw input by default. */ +@@ -438,6 +439,8 @@ read_builtin (list) + retval = 128+SIGALRM; + goto assign_vars; + } ++ if (interactive_shell == 0) ++ initialize_terminating_signals (); + old_alrm = set_signal_handler (SIGALRM, sigalrm); + add_unwind_protect (reset_alarm, (char *)NULL); + #if defined (READLINE) +@@ -482,7 +485,10 @@ read_builtin (list) + i = silent ? ttfd_cbreak (fd, &ttset) : ttfd_onechar (fd, &ttset); + if (i < 0) + sh_ttyerror (1); ++ tty_modified = 1; + add_unwind_protect ((Function *)ttyrestore, (char *)&termsave); ++ if (interactive_shell == 0) ++ initialize_terminating_signals (); + } + } + else if (silent) /* turn off echo but leave term in canonical mode */ +@@ -497,7 +503,10 @@ read_builtin (list) + if (i < 0) + sh_ttyerror (1); + ++ tty_modified = 1; + add_unwind_protect ((Function *)ttyrestore, (char *)&termsave); ++ if (interactive_shell == 0) ++ initialize_terminating_signals (); + } + + /* This *must* be the top unwind-protect on the stack, so the manipulation +@@ -588,6 +597,8 @@ read_builtin (list) + } + else + lastsig = 0; ++ if (terminating_signal && tty_modified) ++ ttyrestore (&termsave); /* fix terminal before exiting */ + CHECK_TERMSIG; + eof = 1; + break; +@@ -978,6 +989,20 @@ ttyrestore (ttp) + struct ttsave *ttp; + { + ttsetattr (ttp->fd, ttp->attrs); ++ tty_modified = 0; ++} ++ ++void ++read_tty_cleanup () ++{ ++ if (tty_modified) ++ ttyrestore (&termsave); ++} ++ ++int ++read_tty_modified () ++{ ++ return (tty_modified); + } + + #if defined (READLINE) +--- a/builtins/common.h ++++ b/builtins/common.h +@@ -122,6 +122,10 @@ extern void bash_logout __P((void)); + /* Functions from getopts.def */ + extern void getopts_reset __P((int)); + ++/* Functions from read.def */ ++extern void read_tty_cleanup __P((void)); ++extern int read_tty_modified __P((void)); ++ + /* Functions from set.def */ + extern int minus_o_option_value __P((char *)); + extern void list_minus_o_opts __P((int, int)); +--- a/bashline.c ++++ b/bashline.c +@@ -202,6 +202,7 @@ extern int current_command_line_count, s + extern int last_command_exit_value; + extern int array_needs_making; + extern int posixly_correct, no_symbolic_links; ++extern int sigalrm_seen; + extern char *current_prompt_string, *ps1_prompt; + extern STRING_INT_ALIST word_token_alist[]; + extern sh_builtin_func_t *last_shell_builtin, *this_shell_builtin; +@@ -4208,8 +4209,9 @@ bash_event_hook () + { + /* If we're going to longjmp to top_level, make sure we clean up readline. + check_signals will call QUIT, which will eventually longjmp to top_level, +- calling run_interrupt_trap along the way. */ +- if (interrupt_state) ++ calling run_interrupt_trap along the way. The check for sigalrm_seen is ++ to clean up the read builtin's state. */ ++ if (terminating_signal || interrupt_state || sigalrm_seen) + rl_cleanup_after_signal (); + bashline_reset_event_hook (); + check_signals_and_traps (); /* XXX */ +--- a/sig.c ++++ b/sig.c +@@ -532,8 +532,10 @@ termsig_sighandler (sig) + #if defined (READLINE) + /* Set the event hook so readline will call it after the signal handlers + finish executing, so if this interrupted character input we can get +- quick response. */ +- if (interactive_shell && interactive && no_line_editing == 0) ++ quick response. If readline is active or has modified the terminal we ++ need to set this no matter what the signal is, though the check for ++ RL_STATE_TERMPREPPED is possibly redundant. */ ++ if (RL_ISSTATE (RL_STATE_SIGHANDLER) || RL_ISSTATE (RL_STATE_TERMPREPPED)) + bashline_set_event_hook (); + #endif + +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 32 ++#define PATCHLEVEL 33 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/134-upstream-bash43-034.patch b/utils/bash/patches/134-upstream-bash43-034.patch new file mode 100644 index 0000000..d3c4f8f --- /dev/null +++ b/utils/bash/patches/134-upstream-bash43-034.patch @@ -0,0 +1,74 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-034 + +Bug-Reported-by: Dreamcat4 +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-05/msg00001.html + +Bug-Description: + +If neither the -f nor -v options is supplied to unset, and a name argument is +found to be a function and unset, subsequent name arguments are not treated as +variables before attempting to unset a function by that name. + +Patch (apply with `patch -p0'): + +--- a/builtins/set.def ++++ b/builtins/set.def +@@ -751,9 +751,11 @@ unset_builtin (list) + WORD_LIST *list; + { + int unset_function, unset_variable, unset_array, opt, nameref, any_failed; ++ int global_unset_func, global_unset_var; + char *name; + + unset_function = unset_variable = unset_array = nameref = any_failed = 0; ++ global_unset_func = global_unset_var = 0; + + reset_internal_getopt (); + while ((opt = internal_getopt (list, "fnv")) != -1) +@@ -761,10 +763,10 @@ unset_builtin (list) + switch (opt) + { + case 'f': +- unset_function = 1; ++ global_unset_func = 1; + break; + case 'v': +- unset_variable = 1; ++ global_unset_var = 1; + break; + case 'n': + nameref = 1; +@@ -777,7 +779,7 @@ unset_builtin (list) + + list = loptend; + +- if (unset_function && unset_variable) ++ if (global_unset_func && global_unset_var) + { + builtin_error (_("cannot simultaneously unset a function and a variable")); + return (EXECUTION_FAILURE); +@@ -795,6 +797,9 @@ unset_builtin (list) + + name = list->word->word; + ++ unset_function = global_unset_func; ++ unset_variable = global_unset_var; ++ + #if defined (ARRAY_VARS) + unset_array = 0; + if (!unset_function && valid_array_reference (name)) +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 33 ++#define PATCHLEVEL 34 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/135-upstream-bash43-035.patch b/utils/bash/patches/135-upstream-bash43-035.patch new file mode 100644 index 0000000..4e614ce --- /dev/null +++ b/utils/bash/patches/135-upstream-bash43-035.patch @@ -0,0 +1,48 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-035 + +Bug-Reported-by: +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-08/msg00045.html + +Bug-Description: + +A locale with a long name can trigger a buffer overflow and core dump. This +applies on systems that do not have locale_charset in libc, are not using +GNU libiconv, and are not using the libintl that ships with bash in lib/intl. + +Patch (apply with `patch -p0'): + +--- a/lib/sh/unicode.c ++++ b/lib/sh/unicode.c +@@ -78,13 +78,15 @@ stub_charset () + s = strrchr (locale, '.'); + if (s) + { +- strcpy (charsetbuf, s+1); ++ strncpy (charsetbuf, s+1, sizeof (charsetbuf) - 1); ++ charsetbuf[sizeof (charsetbuf) - 1] = '\0'; + t = strchr (charsetbuf, '@'); + if (t) + *t = 0; + return charsetbuf; + } +- strcpy (charsetbuf, locale); ++ strncpy (charsetbuf, locale, sizeof (charsetbuf) - 1); ++ charsetbuf[sizeof (charsetbuf) - 1] = '\0'; + return charsetbuf; + } + #endif +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 34 ++#define PATCHLEVEL 35 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/136-upstream-bash43-036.patch b/utils/bash/patches/136-upstream-bash43-036.patch new file mode 100644 index 0000000..198b662 --- /dev/null +++ b/utils/bash/patches/136-upstream-bash43-036.patch @@ -0,0 +1,48 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-036 + +Bug-Reported-by: emanuelczirai@cryptolab.net +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-02/msg00071.html + +Bug-Description: + +When evaluating and setting integer variables, and the assignment fails to +create a variable (for example, when performing an operation on an array +variable with an invalid subscript), bash attempts to dereference a null +pointer, causing a segmentation violation. + +Patch (apply with `patch -p0'): + +--- a/variables.c ++++ b/variables.c +@@ -2833,10 +2833,12 @@ bind_int_variable (lhs, rhs) + #endif + v = bind_variable (lhs, rhs, 0); + +- if (v && isint) +- VSETATTR (v, att_integer); +- +- VUNSETATTR (v, att_invisible); ++ if (v) ++ { ++ if (isint) ++ VSETATTR (v, att_integer); ++ VUNSETATTR (v, att_invisible); ++ } + + return (v); + } +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 35 ++#define PATCHLEVEL 36 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/137-upstream-bash43-037.patch b/utils/bash/patches/137-upstream-bash43-037.patch new file mode 100644 index 0000000..946e9fe --- /dev/null +++ b/utils/bash/patches/137-upstream-bash43-037.patch @@ -0,0 +1,38 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-037 + +Bug-Reported-by: Greg Wooledge +Bug-Reference-ID: <20150204144240.GN13956@eeg.ccf.org> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-02/msg00007.html + +Bug-Description: + +If an associative array uses `@' or `*' as a subscript, `declare -p' produces +output that cannot be reused as input. + +Patch (apply with `patch -p0'): + +--- a/assoc.c ++++ b/assoc.c +@@ -436,6 +436,8 @@ assoc_to_assign (hash, quoted) + #if 1 + if (sh_contains_shell_metas (tlist->key)) + istr = sh_double_quote (tlist->key); ++ else if (ALL_ELEMENT_SUB (tlist->key[0]) && tlist->key[1] == '\0') ++ istr = sh_double_quote (tlist->key); + else + istr = tlist->key; + #else +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 36 ++#define PATCHLEVEL 37 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/138-upstream-bash43-038.patch b/utils/bash/patches/138-upstream-bash43-038.patch new file mode 100644 index 0000000..9857847 --- /dev/null +++ b/utils/bash/patches/138-upstream-bash43-038.patch @@ -0,0 +1,67 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-038 + +Bug-Reported-by: worley@alum.mit.edu (Dale R. Worley) +Bug-Reference-ID: <201406100051.s5A0pCeB014978@hobgoblin.ariadne.com> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-06/msg00028.html + +Bug-Description: + +There are a number of instances where `time' is not recognized as a reserved +word when the shell grammar says it should be. + +Patch (apply with `patch -p0'): + +--- a/parse.y ++++ b/parse.y +@@ -2818,11 +2818,16 @@ time_command_acceptable () + case AND_AND: + case OR_OR: + case '&': ++ case WHILE: + case DO: ++ case UNTIL: ++ case IF: + case THEN: ++ case ELIF: + case ELSE: + case '{': /* } */ +- case '(': /* ) */ ++ case '(': /* )( */ ++ case ')': /* only valid in case statement */ + case BANG: /* ! time pipeline */ + case TIME: /* time time pipeline */ + case TIMEOPT: /* time -p time pipeline */ +--- a/y.tab.c ++++ b/y.tab.c +@@ -5130,11 +5130,16 @@ time_command_acceptable () + case AND_AND: + case OR_OR: + case '&': ++ case WHILE: + case DO: ++ case UNTIL: ++ case IF: + case THEN: ++ case ELIF: + case ELSE: + case '{': /* } */ +- case '(': /* ) */ ++ case '(': /* )( */ ++ case ')': /* only valid in case statement */ + case BANG: /* ! time pipeline */ + case TIME: /* time time pipeline */ + case TIMEOPT: /* time -p time pipeline */ +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 37 ++#define PATCHLEVEL 38 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/139-upstream-bash43-039.patch b/utils/bash/patches/139-upstream-bash43-039.patch new file mode 100644 index 0000000..f8ad363 --- /dev/null +++ b/utils/bash/patches/139-upstream-bash43-039.patch @@ -0,0 +1,52 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-039 + +Bug-Reported-by: SN +Bug-Reference-ID: <54E2554C.205@gazeta.pl> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-02/msg00060.html + +Bug-Description: + +Using the output of `declare -p' when run in a function can result in variables +that are invisible to `declare -p'. This problem occurs when an assignment +builtin such as `declare' receives a quoted compound array assignment as one of +its arguments. + +Patch (apply with `patch -p0'): + +--- a/arrayfunc.c ++++ b/arrayfunc.c +@@ -404,6 +404,9 @@ assign_array_var_from_word_list (var, li + (*var->assign_func) (var, l->word->word, i, 0); + else + array_insert (a, i, l->word->word); ++ ++ VUNSETATTR (var, att_invisible); /* no longer invisible */ ++ + return var; + } + +@@ -634,6 +637,10 @@ assign_array_var_from_string (var, value + + if (nlist) + dispose_words (nlist); ++ ++ if (var) ++ VUNSETATTR (var, att_invisible); /* no longer invisible */ ++ + return (var); + } + +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 38 ++#define PATCHLEVEL 39 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/140-upstream-bash43-040.patch b/utils/bash/patches/140-upstream-bash43-040.patch new file mode 100644 index 0000000..a329d37 --- /dev/null +++ b/utils/bash/patches/140-upstream-bash43-040.patch @@ -0,0 +1,38 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-040 + +Bug-Reported-by: Jean Delvare +Bug-Reference-ID: <20150609180231.5f463695@endymion.delvare> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-06/msg00033.html + +Bug-Description: + +There is a memory leak that occurs when bash expands an array reference on +the rhs of an assignment statement. + +Patch (apply with `patch -p0'): + +--- a/subst.c ++++ b/subst.c +@@ -5782,7 +5782,7 @@ expand_arrayref: + /* XXX - does this leak if name[@] or name[*]? */ + if (pflags & PF_ASSIGNRHS) + { +- temp = array_variable_name (name, &tt, (int *)0); ++ var = array_variable_part (name, &tt, (int *)0); + if (ALL_ELEMENT_SUB (tt[0]) && tt[1] == ']') + temp = array_value (name, quoted|Q_DOUBLE_QUOTES, 0, &atype, &ind); + else +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 39 ++#define PATCHLEVEL 40 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/141-upstream-bash43-041.patch b/utils/bash/patches/141-upstream-bash43-041.patch new file mode 100644 index 0000000..75fdace --- /dev/null +++ b/utils/bash/patches/141-upstream-bash43-041.patch @@ -0,0 +1,67 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-041 + +Bug-Reported-by: Hanno Böck +Bug-Reference-ID: <20150623131106.6f111da9@pc1>, <20150707004640.0e61d2f9@pc1> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-06/msg00089.html, + http://lists.gnu.org/archive/html/bug-bash/2015-07/msg00018.html + +Bug-Description: + +There are several out-of-bounds read errors that occur when completing command +lines where assignment statements appear before the command name. The first +two appear only when programmable completion is enabled; the last one only +happens when listing possible completions. + +Patch (apply with `patch -p0'): + +--- a/bashline.c ++++ b/bashline.c +@@ -1468,10 +1468,23 @@ attempt_shell_completion (text, start, e + + os = start; + n = 0; ++ was_assignment = 0; + s = find_cmd_start (os); + e = find_cmd_end (end); + do + { ++ /* Don't read past the end of rl_line_buffer */ ++ if (s > rl_end) ++ { ++ s1 = s = e1; ++ break; ++ } ++ /* Or past point if point is within an assignment statement */ ++ else if (was_assignment && s > rl_point) ++ { ++ s1 = s = e1; ++ break; ++ } + /* Skip over assignment statements preceding a command name. If we + don't find a command name at all, we can perform command name + completion. If we find a partial command name, we should perform +--- a/lib/readline/complete.c ++++ b/lib/readline/complete.c +@@ -689,6 +689,8 @@ printable_part (pathname) + + if (temp == 0 || *temp == '\0') + return (pathname); ++ else if (temp[1] == 0 && temp == pathname) ++ return (pathname); + /* If the basename is NULL, we might have a pathname like '/usr/src/'. + Look for a previous slash and, if one is found, return the portion + following that slash. If there's no previous slash, just return the +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 40 ++#define PATCHLEVEL 41 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/142-upstream-bash43-042.patch b/utils/bash/patches/142-upstream-bash43-042.patch new file mode 100644 index 0000000..bf1546b --- /dev/null +++ b/utils/bash/patches/142-upstream-bash43-042.patch @@ -0,0 +1,50 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 4.3 +Patch-ID: bash43-042 + +Bug-Reported-by: Nathan Neulinger +Bug-Reference-ID: <558EFDF2.7060402@neulinger.org> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-06/msg00096.html + +Bug-Description: + +There is a problem when parsing command substitutions containing `case' +commands within pipelines that causes the parser to not correctly identify +the end of the command substitution. + +Patch (apply with `patch -p0'): + +--- a/parse.y ++++ b/parse.y +@@ -3708,6 +3708,8 @@ eof_error: + /*itrace("parse_comsub:%d: lex_inword -> 1 ch = `%c' (%d)", line_number, ch, __LINE__);*/ + tflags |= LEX_INWORD; + lex_wlen = 0; ++ if (tflags & LEX_RESWDOK) ++ lex_rwlen = 0; + } + } + +--- a/y.tab.c ++++ b/y.tab.c +@@ -6020,6 +6020,8 @@ eof_error: + /*itrace("parse_comsub:%d: lex_inword -> 1 ch = `%c' (%d)", line_number, ch, __LINE__);*/ + tflags |= LEX_INWORD; + lex_wlen = 0; ++ if (tflags & LEX_RESWDOK) ++ lex_rwlen = 0; + } + } + +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 41 ++#define PATCHLEVEL 42 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/utils/bash/patches/900-no_doc.patch b/utils/bash/patches/900-no_doc.patch new file mode 100644 index 0000000..3e7be42 --- /dev/null +++ b/utils/bash/patches/900-no_doc.patch @@ -0,0 +1,13 @@ +--- a/Makefile.in ++++ b/Makefile.in +@@ -741,10 +741,8 @@ reconfig: force + # $(MAKE) -f $(srcdir)/Makefile $(MFLAGS) srcdir=$(srcdir) + + doc documentation: force +- @(cd $(DOCDIR) ; $(MAKE) $(MFLAGS) ) + + info dvi ps: force +- @(cd $(DOCDIR) ; $(MAKE) $(MFLAGS) CFLAGS='$(CCFLAGS)' $@ ) + + force: + diff --git a/utils/bc/Makefile b/utils/bc/Makefile new file mode 100644 index 0000000..900fd3e --- /dev/null +++ b/utils/bc/Makefile @@ -0,0 +1,65 @@ +# +# Copyright (C) 2006-2015 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:=bc +PKG_VERSION:=1.06.95 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz +PKG_SOURCE_URL:=ftp://ftp.debian.org/debian/pool/main/b/bc +PKG_MD5SUM:=24d0831812d8262b6cac8316b0bac483 + +PKG_MAINTAINER:=Bruno Randolf +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +include $(INCLUDE_DIR)/package.mk + +define Package/bc/Default + SECTION:=utils + CATEGORY:=Utilities + URL:=http://packages.debian.org/bc +endef + +define Package/bc + $(call Package/bc/Default) + TITLE:=Arbitrary precision calculator language + DEPENDS:=+libreadline +libncurses +endef + +define Package/bc/description + bc is a language that supports arbitrary precision numbers with + interactive execution of statements. +endef + +define Package/dc + $(call Package/bc/Default) + TITLE:=Arbitrary precision reverse-polish calculator + DEPENDS:=bc +endef + +define Package/dc/description + dc is a reverse-polish desk calculator which supports unlimited + precision arithmetic. +endef + +CONFIGURE_ARGS += --with-readline + +define Package/bc/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/bc/bc $(1)/usr/bin/ +endef + +define Package/dc/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/dc/dc $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,bc)) +$(eval $(call BuildPackage,dc)) diff --git a/utils/bc/patches/001-disable-doc.patch b/utils/bc/patches/001-disable-doc.patch new file mode 100644 index 0000000..a6ecd6e --- /dev/null +++ b/utils/bc/patches/001-disable-doc.patch @@ -0,0 +1,21 @@ +--- bc-1.06.95/Makefile.in 2010-07-03 10:48:13.422725147 +0000 ++++ bc-1.06.95/Makefile.in 2010-07-03 10:50:09.714725197 +0000 +@@ -149,7 +149,7 @@ + sharedstatedir = @sharedstatedir@ + sysconfdir = @sysconfdir@ + target_alias = @target_alias@ +-SUBDIRS = lib bc dc doc ++SUBDIRS = lib bc dc + MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure Makefile.in \ + stamp-h $(distdir).tar.gz h/number.h depcomp missing + +--- bc-1.06.95/Makefile.am 2010-07-03 10:48:32.522725037 +0000 ++++ bc-1.06.95/Makefile.am 2010-07-03 10:48:38.114725024 +0000 +@@ -1,6 +1,6 @@ + ## Process this file with automake to produce Makefile.in + +-SUBDIRS = lib bc dc doc ++SUBDIRS = lib bc dc + + MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure Makefile.in \ + stamp-h $(distdir).tar.gz h/number.h depcomp missing diff --git a/utils/bluelog/Makefile b/utils/bluelog/Makefile new file mode 100644 index 0000000..5ef7c65 --- /dev/null +++ b/utils/bluelog/Makefile @@ -0,0 +1,108 @@ +# +# Copyright (C) 2012-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:=bluelog +PKG_VERSION:=1.1.2 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=ftp://ftp.digifail.com/software/bluelog +PKG_MD5SUM:=614d0fe65bae68acff1d33d9f86e4805 + +OUI_SOURCE:=oui-2016-05-30.txt.gz +OUI_URL:=http://sources.lede-project.org/ +OUI_MD5SUM:=38048729fdb5a7a7e0c5db6a51dc2dd1 + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Nicolas Thill + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/bluelog/Default + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Bluetooth scanner and logger + URL:=http://www.digifail.com/software/bluelog.shtml + DEPENDS:=+bluez-libs +kmod-bluetooth +endef + +define Package/bluelog/Default/description + Bluelog is a simple Bluetooth scanner designed to tell you how many + discoverable devices there are in an area as quickly as possible. It is + intended to be used as a site survey tool, identifying the number of possible + Bluetooth targets there are in the surrounding environment. +endef + +define Package/bluelog + $(call Package/bluelog/Default) +endef + +define Package/bluelog/description + $(call Package/bluelog/Default/description) +endef + +define Package/bluelog-live + $(call Package/bluelog/Default) + TITLE+= (live output) + DEPENDS+= bluelog +endef + +define Package/bluelog-live/description + $(call Package/bluelog/Default/description) + This package contains the files for "Bluelog Live", an optional mode of + Bluelog which creates a real-time webpage of discovered Bluetooth devices. +endef + +define Download/oui.txt + FILE:=$(OUI_SOURCE) + URL:=$(OUI_URL) + MD5SUM:=$(OUI_MD5SUM) +endef + +TARGET_CFLAGS += -DOPENWRT + +MAKE_FLAGS += \ + LIBS="$(TARGET_LDFLAGS) -lbluetooth -lm" + +define Build/Prepare + $(eval $(call Download,oui.txt)) + $(Build/Prepare/Default) + zcat $(DL_DIR)/$(OUI_SOURCE) > $(PKG_BUILD_DIR)/oui.tmp +endef + +define Package/bluelog/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/bluelog $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/bluelog.init $(1)/etc/init.d/bluelog +endef + +define Package/bluelog-live/install + $(INSTALL_DIR) $(1)/www/bluelog + $(CP) $(PKG_INSTALL_DIR)/usr/share/bluelog/*.html $(1)/www/bluelog/ + $(CP) \ + $(PKG_INSTALL_DIR)/usr/share/bluelog/openwrt.css \ + $(1)/www/bluelog/style.css + $(INSTALL_DIR) $(1)/www/bluelog/images + $(CP) \ + $(PKG_INSTALL_DIR)/usr/share/bluelog/images/digifail_logo.png \ + $(PKG_INSTALL_DIR)/usr/share/bluelog/images/email.png \ + $(PKG_INSTALL_DIR)/usr/share/bluelog/images/favicon.png \ + $(PKG_INSTALL_DIR)/usr/share/bluelog/images/openwrt_logo.png \ + $(PKG_INSTALL_DIR)/usr/share/bluelog/images/qrcontact.png \ + $(1)/www/bluelog/images/ + $(INSTALL_DIR) $(1)/www/cgi-bin + $(CP) $(PKG_INSTALL_DIR)/usr/share/bluelog/cgi-bin/* $(1)/www/cgi-bin/ +endef + +$(eval $(call BuildPackage,bluelog)) +$(eval $(call BuildPackage,bluelog-live)) diff --git a/utils/bluelog/files/bluelog.init b/utils/bluelog/files/bluelog.init new file mode 100644 index 0000000..efae288 --- /dev/null +++ b/utils/bluelog/files/bluelog.init @@ -0,0 +1,13 @@ +#!/bin/sh /etc/rc.common + +START=65 + +SERVICE_DAEMONIZE=1 + +start() { + service_start /usr/bin/bluelog +} + +stop() { + service_stop /usr/bin/bluelog +} diff --git a/utils/bluelog/patches/100-gen-oui-fix-tempfile-use-mirror.patch b/utils/bluelog/patches/100-gen-oui-fix-tempfile-use-mirror.patch new file mode 100644 index 0000000..414ecb8 --- /dev/null +++ b/utils/bluelog/patches/100-gen-oui-fix-tempfile-use-mirror.patch @@ -0,0 +1,31 @@ +--- a/gen_oui.sh ++++ b/gen_oui.sh +@@ -3,7 +3,7 @@ + VER="1.2" + + # Location of tmp file +-TMPFILE="/tmp/oui.tmp" ++TMPFILE="./oui.tmp" + + # File to write + OUIFILE="oui.txt" +@@ -22,10 +22,7 @@ exit 1 + + get_oui () + { +-echo -n "Downloading OUI file from IEEE..." +-wget --quiet -O $TMPFILE http://standards.ieee.org/develop/regauth/oui/oui.txt || \ +- ErrorMsg ERR "Unable to contact IEEE server!" +- ++[ -f "$TMPFILE" ] || ErrorMsg ERR "Unable to find $TMPFILE" + echo "OK" + } + +@@ -44,7 +41,6 @@ echo "OK" + clean_all () + { + echo -n "Removing files..." +-rm -f $TMPFILE + rm -f $OUIFILE + echo "OK" + } diff --git a/utils/bluez/Makefile b/utils/bluez/Makefile new file mode 100644 index 0000000..0430cd6 --- /dev/null +++ b/utils/bluez/Makefile @@ -0,0 +1,159 @@ +# +# Copyright (C) 2006-2016 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:=bluez +PKG_VERSION:=5.38 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@KERNEL/linux/bluetooth/ +PKG_MD5SUM:=dae2ed00c63791800ea7d10a381270a5 + +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Nicolas Thill + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/bluez/Default + TITLE:=Bluetooth + URL:=http://www.bluez.org/ +endef + +define Package/bluez-examples +$(call Package/bluez/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE+= python example apps + DEPENDS:=+python +endef + +define Package/bluez-examples/description + contains many examples apps for bluetooth, requiring python +endef + +define Package/bluez-libs +$(call Package/bluez/Default) + SECTION:=libs + CATEGORY:=Libraries + TITLE+= library + DEPENDS:=+libpthread +kmod-bluetooth +endef + +define Package/bluez-utils +$(call Package/bluez/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE+= utilities + DEPENDS:=+bluez-libs +libpthread +librt +glib2 +libncurses +libreadline $(INTL_DEPENDS) $(ICONV_DEPENDS) +endef + +define Package/bluez-daemon +$(call Package/bluez/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE+= daemon + DEPENDS:=+bluez-libs +bluez-utils +dbus +libical $(INTL_DEPENDS) $(ICONV_DEPENDS) +endef + +define Package/bluez-daemon/conffiles +/etc/bluetooth/main.conf +/etc/bluetooth/network.conf +/etc/bluetooth/input.conf +/etc/bluetooth/proximity.conf +/etc/config/bluetooth +endef + +CONFIGURE_ARGS += \ + --enable-static \ + --enable-shared \ + --enable-client \ + --enable-datafiles \ + --enable-experimental \ + --enable-library \ + --enable-monitor \ + --enable-obex \ + --enable-threads \ + --enable-tools \ + --disable-android \ + --disable-cups \ + --disable-manpages \ + --disable-sixaxis \ + --disable-systemd \ + --disable-test \ + --disable-udev \ + +TARGET_CPPFLAGS += \ + -D_GNU_SOURCE + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/bluetooth $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbluetooth.{a,so*} $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/bluez.pc $(1)/usr/lib/pkgconfig/ +endef + +define Package/bluez-examples/install + $(INSTALL_DIR) $(1)/usr/bin/bluez + $(INSTALL_DATA) $(PKG_BUILD_DIR)/test/* $(1)/usr/bin/bluez/ +endef + +define Package/bluez-libs/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbluetooth.so.* $(1)/usr/lib/ +endef + +define Package/bluez-utils/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/bccmd $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/bluemoon $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/btmon $(1)/usr/bin/ + $(CP) $(PKG_BUILD_DIR)/tools/btmgmt $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/ciptool $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/hciattach $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/hciconfig $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/hcidump $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/hcitool $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/hex2hcd $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/l2ping $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/l2test $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/rctest $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/rfcomm $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/sdptool $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/attrib/gatttool $(1)/usr/bin/ +endef + +define Package/bluez-daemon/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/lib/bluetooth/bluetoothd $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/bluetoothctl $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/bluetooth/obexd $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/bluetooth.config $(1)/etc/config/bluetooth + $(INSTALL_DIR) $(1)/etc/dbus-1/system.d/ + $(INSTALL_DATA) ./files/bluetooth.dbus $(1)/etc/dbus-1/system.d/bluetooth.conf + $(INSTALL_DIR) $(1)/etc/bluetooth + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/main.conf $(1)/etc/bluetooth/main.conf + $(INSTALL_DATA) $(PKG_BUILD_DIR)/profiles/network/network.conf $(1)/etc/bluetooth/network.conf + $(INSTALL_DATA) $(PKG_BUILD_DIR)/profiles/input/input.conf $(1)/etc/bluetooth/input.conf + $(INSTALL_DATA) $(PKG_BUILD_DIR)/profiles/proximity/proximity.conf $(1)/etc/bluetooth/proximity.conf + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/bluetoothd.init $(1)/etc/init.d/bluetoothd +endef + +$(eval $(call BuildPackage,bluez-examples)) +$(eval $(call BuildPackage,bluez-libs)) +$(eval $(call BuildPackage,bluez-utils)) +$(eval $(call BuildPackage,bluez-daemon)) diff --git a/utils/bluez/files/bluetooth.config b/utils/bluez/files/bluetooth.config new file mode 100644 index 0000000..6f23617 --- /dev/null +++ b/utils/bluez/files/bluetooth.config @@ -0,0 +1,15 @@ +config bluetoothd +# option config /etc/bluetooth/main.conf + option enabled 1 + +config hciattach + option initspeed 115200 + option tty ttyS1 + option type csr + option speed 115200 + option flow noflow + option enabled 0 + +config rfcomm +# option config /etc/bluetooth/rfcomm.conf + option enabled 0 diff --git a/utils/bluez/files/bluetooth.dbus b/utils/bluez/files/bluetooth.dbus new file mode 100644 index 0000000..88545fa --- /dev/null +++ b/utils/bluez/files/bluetooth.dbus @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/bluez/files/bluetoothd.init b/utils/bluez/files/bluetoothd.init new file mode 100644 index 0000000..75f4d96 --- /dev/null +++ b/utils/bluez/files/bluetoothd.init @@ -0,0 +1,13 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2007 OpenWrt.org + +#start after dbus (60) +START=62 +USE_PROCD=1 +PROG=/usr/bin/bluetoothd + +start_service() { + procd_open_instance + procd_set_param command "$PROG" -n + procd_close_instance +} diff --git a/utils/bluez/files/givepin b/utils/bluez/files/givepin new file mode 100644 index 0000000..e52a338 --- /dev/null +++ b/utils/bluez/files/givepin @@ -0,0 +1,14 @@ +#!/bin/sh + +# Write bluetooth PIN number here: +pin= + +if [ -z "$pin" ]; then + msg="Set bluetooth PIN in file $0" + logger -p user.err "$msg" + for i in /dev/pts/* ; do + [ -w $i ] && echo "$msg" > $i + done +else + echo "PIN:$pin" +fi diff --git a/utils/bluez/patches/001-bcm43xx-Add-bcm43xx-3wire-variant.patch b/utils/bluez/patches/001-bcm43xx-Add-bcm43xx-3wire-variant.patch new file mode 100644 index 0000000..96e8a26 --- /dev/null +++ b/utils/bluez/patches/001-bcm43xx-Add-bcm43xx-3wire-variant.patch @@ -0,0 +1,21 @@ +From b4f2b77472aeb967d3a7595e8a965785c7a37c87 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 16 Feb 2016 16:40:46 +0000 +Subject: [PATCH 1/4] bcm43xx: Add bcm43xx-3wire variant + +--- + tools/hciattach.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -1144,6 +1144,9 @@ struct uart_t uart[] = { + { "bcm43xx", 0x0000, 0x0000, HCI_UART_H4, 115200, 3000000, + FLOW_CTL, DISABLE_PM, NULL, bcm43xx, NULL }, + ++ { "bcm43xx-3wire", 0x0000, 0x0000, HCI_UART_3WIRE, 115200, 3000000, ++ 0, DISABLE_PM, NULL, bcm43xx, NULL }, ++ + { "ath3k", 0x0000, 0x0000, HCI_UART_ATH3K, 115200, 115200, + FLOW_CTL, DISABLE_PM, NULL, ath3k_ps, ath3k_pm }, + diff --git a/utils/bluez/patches/002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch b/utils/bluez/patches/002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch new file mode 100644 index 0000000..a221861 --- /dev/null +++ b/utils/bluez/patches/002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch @@ -0,0 +1,33 @@ +From e145c9621f976063e5c573db1f2053d906f63427 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 16 Feb 2016 16:39:09 +0000 +Subject: [PATCH 2/4] bcm43xx: The UART speed must be reset after the firmware + download + +--- + tools/hciattach_bcm43xx.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/tools/hciattach_bcm43xx.c ++++ b/tools/hciattach_bcm43xx.c +@@ -366,11 +366,8 @@ int bcm43xx_init(int fd, int def_speed, + return -1; + + if (bcm43xx_locate_patch(FIRMWARE_DIR, chip_name, fw_path)) { +- fprintf(stderr, "Patch not found, continue anyway\n"); ++ fprintf(stderr, "Patch not found for %s, continue anyway\n", chip_name); + } else { +- if (bcm43xx_set_speed(fd, ti, speed)) +- return -1; +- + if (bcm43xx_load_firmware(fd, fw_path)) + return -1; + +@@ -380,6 +377,7 @@ int bcm43xx_init(int fd, int def_speed, + return -1; + } + ++ sleep(1); + if (bcm43xx_reset(fd)) + return -1; + } diff --git a/utils/bluez/patches/003-Increase-firmware-load-timeout-to-30s.patch b/utils/bluez/patches/003-Increase-firmware-load-timeout-to-30s.patch new file mode 100644 index 0000000..fa0948d --- /dev/null +++ b/utils/bluez/patches/003-Increase-firmware-load-timeout-to-30s.patch @@ -0,0 +1,20 @@ +From d41dc2046dd08d8c95197f677e224506f5b39bdd Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 20 Jan 2016 16:00:37 +0000 +Subject: [PATCH 3/4] Increase firmware load timeout to 30s + +--- + tools/hciattach.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -1293,7 +1293,7 @@ int main(int argc, char *argv[]) + { + struct uart_t *u = NULL; + int detach, printpid, raw, opt, i, n, ld, err; +- int to = 10; ++ int to = 30; + int init_speed = 0; + int send_break = 0; + pid_t pid; diff --git a/utils/bluez/patches/004-Move-the-43xx-firmware-into-lib-firmware.patch b/utils/bluez/patches/004-Move-the-43xx-firmware-into-lib-firmware.patch new file mode 100644 index 0000000..80b052d --- /dev/null +++ b/utils/bluez/patches/004-Move-the-43xx-firmware-into-lib-firmware.patch @@ -0,0 +1,20 @@ +From 76681284b0ea49852041fdb97a35175089a08781 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 23 Feb 2016 17:52:29 +0000 +Subject: [PATCH 4/4] Move the 43xx firmware into /lib/firmware + +--- + tools/hciattach_bcm43xx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/hciattach_bcm43xx.c ++++ b/tools/hciattach_bcm43xx.c +@@ -43,7 +43,7 @@ + #include "hciattach.h" + + #ifndef FIRMWARE_DIR +-#define FIRMWARE_DIR "/etc/firmware" ++#define FIRMWARE_DIR "/lib/firmware/brcm" + #endif + + #define FW_EXT ".hcd" diff --git a/utils/bluez/patches/200-uart-speed.patch b/utils/bluez/patches/200-uart-speed.patch new file mode 100644 index 0000000..ebe0153 --- /dev/null +++ b/utils/bluez/patches/200-uart-speed.patch @@ -0,0 +1,40 @@ +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -101,20 +101,37 @@ int uart_speed(int s) + return B230400; + case 460800: + return B460800; ++/* FIX: Not all platform support this high serial speed ++ claudyus84 @gamil.com ++*/ ++#ifdef B500000 + case 500000: + return B500000; ++#endif ++#ifdef B576000 + case 576000: + return B576000; ++#endif ++#ifdef B921600 + case 921600: + return B921600; ++#endif ++#ifdef B1000000 + case 1000000: + return B1000000; ++#endif ++#ifdef B1152000 + case 1152000: + return B1152000; ++#endif ++#ifdef B1500000 + case 1500000: + return B1500000; ++#endif ++#ifdef B2000000 + case 2000000: + return B2000000; ++#endif + #ifdef B2500000 + case 2500000: + return B2500000; diff --git a/utils/bluez/patches/201-readline.patch b/utils/bluez/patches/201-readline.patch new file mode 100644 index 0000000..45e1553 --- /dev/null +++ b/utils/bluez/patches/201-readline.patch @@ -0,0 +1,48 @@ +--- a/Makefile.in ++++ b/Makefile.in +@@ -2441,7 +2441,7 @@ unit_tests = $(am__append_35) unit/test- + @CLIENT_TRUE@ monitor/uuid.h monitor/uuid.c + + @CLIENT_TRUE@client_bluetoothctl_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@ \ +-@CLIENT_TRUE@ -lreadline ++@CLIENT_TRUE@ -lreadline -lncurses + + @MONITOR_TRUE@monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \ + @MONITOR_TRUE@ monitor/display.h monitor/display.c \ +@@ -2691,13 +2691,13 @@ unit_tests = $(am__append_35) unit/test- + @READLINE_TRUE@ client/display.h + + @READLINE_TRUE@attrib_gatttool_LDADD = lib/libbluetooth-internal.la \ +-@READLINE_TRUE@ src/libshared-glib.la @GLIB_LIBS@ -lreadline ++@READLINE_TRUE@ src/libshared-glib.la @GLIB_LIBS@ -lreadline -lncurses + + @READLINE_TRUE@tools_obex_client_tool_SOURCES = $(gobex_sources) $(btio_sources) \ + @READLINE_TRUE@ tools/obex-client-tool.c + + @READLINE_TRUE@tools_obex_client_tool_LDADD = lib/libbluetooth-internal.la \ +-@READLINE_TRUE@ @GLIB_LIBS@ -lreadline ++@READLINE_TRUE@ @GLIB_LIBS@ -lreadline -lncurses + + @READLINE_TRUE@tools_obex_server_tool_SOURCES = $(gobex_sources) $(btio_sources) \ + @READLINE_TRUE@ tools/obex-server-tool.c +@@ -2707,17 +2707,17 @@ unit_tests = $(am__append_35) unit/test- + @READLINE_TRUE@ client/display.h client/display.c + + @READLINE_TRUE@tools_bluetooth_player_LDADD = gdbus/libgdbus-internal.la \ +-@READLINE_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline ++@READLINE_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline -lncurses + + @READLINE_TRUE@tools_obexctl_SOURCES = tools/obexctl.c \ + @READLINE_TRUE@ client/display.h client/display.c + + @READLINE_TRUE@tools_obexctl_LDADD = gdbus/libgdbus-internal.la \ +-@READLINE_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline ++@READLINE_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline -lncurses + + @READLINE_TRUE@tools_btmgmt_SOURCES = tools/btmgmt.c src/uuid-helper.c client/display.c + @READLINE_TRUE@tools_btmgmt_LDADD = lib/libbluetooth-internal.la src/libshared-mainloop.la \ +-@READLINE_TRUE@ -lreadline ++@READLINE_TRUE@ -lreadline -lncurses + + @EXPERIMENTAL_TRUE@tools_gatt_service_SOURCES = tools/gatt-service.c + @EXPERIMENTAL_TRUE@tools_gatt_service_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ gdbus/libgdbus-internal.la diff --git a/utils/bonnie++/Makefile b/utils/bonnie++/Makefile new file mode 100644 index 0000000..0008cc2 --- /dev/null +++ b/utils/bonnie++/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2009-2016 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:=bonnie++ +PKG_VERSION:=1.97 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://www.coker.com.au/bonnie++/experimental/ +PKG_MD5SUM:=d6cf9703242998b2ddc2d875b028b3c6 +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=copyright.txt +PKG_MAINTAINER:=Florian Fainelli + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION).1 + +include $(INCLUDE_DIR)/package.mk + +define Package/bonniexx + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libstdcpp +libpthread + TITLE:=Bonnie++ - hard drive bottleneck testing program. + URL:=http://www.coker.com.au/bonnie++/ +endef + +define Package/bonniexx/description + Bonnie++ is a benchmark suite that is aimed at performing a number of simple + tests of hard drive and file system performance. +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + TARGET_CXX="$(TARGET_CXX)" \ + TARGET_LINK="$(TARGET_CXX)" \ + MORECFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CXXFLAGS)" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all +endef + +define Package/bonniexx/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_BUILD_DIR)/bonnie++ $(1)/usr/bin/ + $(CP) $(PKG_BUILD_DIR)/bon_csv2html $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,bonniexx)) diff --git a/utils/bonnie++/patches/001-cross_compile_fix.patch b/utils/bonnie++/patches/001-cross_compile_fix.patch new file mode 100644 index 0000000..0379fec --- /dev/null +++ b/utils/bonnie++/patches/001-cross_compile_fix.patch @@ -0,0 +1,38 @@ +Index: bonnie++-1.97.1/configure +=================================================================== +--- bonnie++-1.97.1.orig/configure ++++ bonnie++-1.97.1/configure +@@ -3955,9 +3955,7 @@ rm -f core conftest.err conftest.$ac_obj + + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +-as_fn_error $? "cannot run test program while cross compiling +-See \`config.log' for more details" "$LINENO" 5 ; } ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} } + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +Index: bonnie++-1.97.1/Makefile +=================================================================== +--- bonnie++-1.97.1.orig/Makefile ++++ bonnie++-1.97.1/Makefile +@@ -1,5 +1,7 @@ + EXES=bonnie++ zcav getc_putc getc_putc_helper + EXE=bon_csv2html generate_randfile ++TARGET_CXX=g++ ++TARGET_LINK=g++ + + all: $(EXE) $(EXES) + +@@ -10,8 +12,8 @@ eprefix=${prefix} + #MORE_WARNINGS=-Weffc++ + WFLAGS=-Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -Wcast-align -Wsign-compare -Wpointer-arith -Wwrite-strings -Wformat-security -Wswitch-enum -Winit-self $(MORE_WARNINGS) + CFLAGS=-O2 -DNDEBUG $(WFLAGS) $(MORECFLAGS) +-CXX=g++ $(CFLAGS) +-LINK=g++ ++CXX=$(TARGET_CXX) $(CFLAGS) ++LINK=$(TARGET_LINK) + THREAD_LFLAGS=-lpthread + + INSTALL=/usr/bin/install -c diff --git a/utils/bonnie++/patches/002-add-verbose-error-messages.patch b/utils/bonnie++/patches/002-add-verbose-error-messages.patch new file mode 100644 index 0000000..ccec8e8 --- /dev/null +++ b/utils/bonnie++/patches/002-add-verbose-error-messages.patch @@ -0,0 +1,47 @@ +--- a/bon_file.cpp ++++ b/bon_file.cpp +@@ -464,25 +464,37 @@ int COpenTest::delete_sequential(BonTime + } + if(m_number_directories != 1) + { +- if(chdir("..") || rmdir(buf)) ++ if(chdir("..")) + { ++ io_error("chdir"); ++ return -1; ++ } ++ if(rmdir(buf)) ++ { ++ fprintf(stderr, "Unable to delete directory '%s'\n", buf); + io_error("rmdir"); + return -1; + } + } + } +- if(chdir("..") || rmdir(m_dirname)) ++ if(count != m_number) + { +- io_error("rmdir"); ++ fprintf(stderr, "Expected %d files but only got %d\n", m_number, count); + return -1; + } +- delete m_dirname; +- m_dirname = NULL; +- if(count != m_number) ++ if(chdir("..")) + { +- fprintf(stderr, "Expected %d files but only got %d\n", m_number, count); ++ io_error("chdir"); ++ return -1; ++ } ++ if(rmdir(m_dirname)) ++ { ++ fprintf(stderr, "Unable to delete directory '%s'\n", m_dirname); ++ io_error("rmdir"); + return -1; + } ++ delete m_dirname; ++ m_dirname = NULL; + sync(); + timer.stop_and_record(DelSeq); + timer.add_latency(DelSeq, dur.getMax()); diff --git a/utils/btrfs-progs/Makefile b/utils/btrfs-progs/Makefile new file mode 100644 index 0000000..70c4a06 --- /dev/null +++ b/utils/btrfs-progs/Makefile @@ -0,0 +1,65 @@ +# +# 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:=btrfs-progs +PKG_VERSION:=4.7.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/kdave/btrfs-progs/ +PKG_MD5SUM:=f49bc9e143ffe60260c5bd70ef3b624576673f8b50f41e309892a425f7fbe60f +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-v$(PKG_VERSION) + +PKG_MAINTAINER:=Daniel Golle +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 +PKG_BUILD_DEPENDS:=libacl + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/btrfs-progs + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Filesystem + DEPENDS:=+libattr +libuuid +zlib +libblkid +liblzo +libpthread + TITLE:=Btrfs filesystems utilities + URL:=http://btrfs.wiki.kernel.org/ +endef + +define Package/btrfs-progs/description + Btrfs is a new copy on write filesystem for Linux aimed at implementing + advanced features while focusing on fault tolerance, repair and easy + administration. Initially developed by Oracle, Btrfs is licensed under the + GPL and open for contribution from anyone. +endef + +progs = btrfs btrfs-debug-tree btrfs-find-root btrfs-image btrfs-map-logical \ + btrfs-show-super btrfstune btrfs-zero-log fsck.btrfs mkfs.btrfs + +CONFIGURE_ARGS += \ + --disable-backtrace \ + --disable-convert \ + --disable-documentation + +define Package/btrfs-progs/install + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libbtrfs.so* $(1)/usr/lib + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(addprefix $(PKG_INSTALL_DIR)/usr/bin/, $(progs)) $(1)/usr/bin/ + $(LN) btrfs $(1)/usr/bin/btrfsck + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/btrfs-scan.init $(1)/etc/init.d/btrfs-scan +endef + +$(eval $(call BuildPackage,btrfs-progs)) diff --git a/utils/btrfs-progs/files/btrfs-scan.init b/utils/btrfs-progs/files/btrfs-scan.init new file mode 100644 index 0000000..762e0b8 --- /dev/null +++ b/utils/btrfs-progs/files/btrfs-scan.init @@ -0,0 +1,9 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014 OpenWrt.org + +START=19 + +start() { + grep -q btrfs /proc/filesystems && /usr/bin/btrfs device scan +} + diff --git a/utils/btrfs-progs/patches/0001-use-pthread_join-instead-of-pthread_tryjoin_np.patch b/utils/btrfs-progs/patches/0001-use-pthread_join-instead-of-pthread_tryjoin_np.patch new file mode 100644 index 0000000..90b56b4 --- /dev/null +++ b/utils/btrfs-progs/patches/0001-use-pthread_join-instead-of-pthread_tryjoin_np.patch @@ -0,0 +1,11 @@ +--- a/chunk-recover.c ++++ b/chunk-recover.c +@@ -887,7 +887,7 @@ static int scan_devices(struct recover_c + for (i = 0; i < devidx; i++) { + if (dev_scans[i].bytenr == -1) + continue; +- ret = pthread_tryjoin_np(t_scans[i], ++ ret = pthread_join(t_scans[i], + (void **)&t_rets[i]); + if (ret == EBUSY) { + all_done = 0; diff --git a/utils/canutils/Makefile b/utils/canutils/Makefile new file mode 100644 index 0000000..58ae762 --- /dev/null +++ b/utils/canutils/Makefile @@ -0,0 +1,116 @@ +# +# Copyright (C) 2015 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:=canutils +PKG_RELEASE=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/linux-can/can-utils +PKG_SOURCE_VERSION:=0e3ff3b3157e456d4b6343f5d4b42ef692bce538 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.bz2 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) + +PKG_MAINTAINER:=Anton Glukhov +PKG_LICENSE:=GPL-2.0+ + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +FILES:=canbusload can-calc-bit-timing candump \ + cangen cangw canplayer cansniffer cansend + +define Package/canutils/Default + SECTION:=utils + CATEGORY:=Utilities + URL:=https://github.com/linux-can/can-utils + TITLE:=CAN userspace utilities and tools +endef + +define Package/canutils + $(call Package/canutils/Default) + MENU:=1 +endef + +define Package/canutils-log-conversion + $(call Package/canutils/Default) + TITLE:=canutils log conversion + DEPENDS:=canutils +endef + +define PartGen +define Package/canutils-$(1) + $(call Package/canutils/Default) + TITLE:=$(1) tool from canutils + DEPENDS:=canutils +endef +endef + +$(foreach file,$(FILES),$(eval $(call PartGen,$(file)))) + +define Package/canutils/install +endef + +define Package/canutils-log-conversion/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/asc2log $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/log2asc $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/log2long $(1)/usr/bin/ +endef + +define PartInstall +define Package/canutils-$(1)/install + $(INSTALL_DIR) $$(1)/usr/bin + $(INSTALL_BIN) \ + $(PKG_BUILD_DIR)/$(1) \ + $$(1)/usr/bin/ +endef +endef + +define Package/canutils-log-conversion/description +asc2log - convert ASC logfile to compact CAN frame logfile. +log2asc - convert compact CAN frame logfile to ASC logfile. +log2long - convert compact CAN frame representation into user readable. +endef + +define Package/canutils-canbusload/description +canbusload - display the load percentage of can buses. +endef + +define Package/canutils-can-calc-bit-timing/description +can-calc-bit-timing - calculate hw bittiming for supported can chips. +endef + +define Package/canutils-candump/description +candump - dumps can frames to terminal, logfile or another can device, +with optional filtering. +endef + +define Package/canutils-cangen/description +cangen - CAN frames generator for testing purposes. +endef + +define Package/canutils-cangw/description +cangw - manage PF_CAN netlink gateway. +endef + +define Package/canutils-canplayer/description +canplayer - replay a compact CAN frame logfile to CAN devices. +endef + +define Package/canutils-cansend/description +cansend - simple command line tool to send CAN-frames via CAN_RAW sockets. +endef + +$(foreach file,$(FILES),$(eval $(call PartInstall,$(file)))) + +$(eval $(call BuildPackage,canutils)) +$(eval $(call BuildPackage,canutils-log-conversion)) +$(foreach file,$(FILES),$(eval $(call BuildPackage,canutils-$(file)))) diff --git a/utils/ccid/Makefile b/utils/ccid/Makefile new file mode 100644 index 0000000..c73809a --- /dev/null +++ b/utils/ccid/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2009-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:=ccid +PKG_VERSION:=1.4.24 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=https://alioth.debian.org/frs/download.php/file/4171 +PKG_MD5SUM:=62cb73c6c009c9799c526f05a05e25f00f0ad86d50f82a714dedcfbf4a7e4176 +PKG_MAINTAINER:=Daniel Golle +PKG_LICENSE:=LGPL-2.1+ +PKG_LICENSE_FILES:=COPYING + +PKG_FIXUP:=libtool +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/ccid + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=+libusb-1.0 +libpcsclite + TITLE:=Generic USB CCID smart card reader driver + URL:=http://pcsclite.alioth.debian.org/ccid.html +endef + +define Package/ccid/description + Generic USB CCID (Chip/Smart Card Interface Devices) driver and ICCD + (Integrated Circuit(s) Card Devices). +endef + +TARGET_CFLAGS += $(FPIC) + +TARGET_LDFLAGS += "-lpthread" + +CONFIGURE_ARGS += \ + --enable-embedded \ + --enable-usbdropdir=/usr/lib/pcsc/drivers + +define Package/ccid/install + $(INSTALL_DIR) $(1)/usr/lib/pcsc + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pcsc/drivers $(1)/usr/lib/pcsc/ +endef + +$(eval $(call BuildPackage,ccid)) diff --git a/utils/ccrypt/Makefile b/utils/ccrypt/Makefile new file mode 100644 index 0000000..1e25305 --- /dev/null +++ b/utils/ccrypt/Makefile @@ -0,0 +1,42 @@ +# +# Copyright (C) 2009-2016 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:=ccrypt +PKG_VERSION:=1.10 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/ccrypt +PKG_MD5SUM:=44ddd763465c254df83f5d38851d04d7 +PKG_MAINTAINER:=Hannu Nyman +PKG_LICENSE:=GPLv2+ + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/ccrypt + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Encryption + TITLE:=ccrypt is a utility for encrypting and decrypting files and streams + URL:=http://ccrypt.sourceforge.net/ +endef + +CONFIGURE_ARGS += --disable-emacs + +define Package/ccrypt/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ccrypt $(1)/usr/bin/ + ln -s ccrypt $(1)/usr/bin/ccencrypt + ln -s ccrypt $(1)/usr/bin/ccdecrypt + ln -s ccrypt $(1)/usr/bin/ccat +endef + +$(eval $(call BuildPackage,ccrypt)) diff --git a/utils/ccrypt/patches/001-no-intl.patch b/utils/ccrypt/patches/001-no-intl.patch new file mode 100644 index 0000000..4ac9abb --- /dev/null +++ b/utils/ccrypt/patches/001-no-intl.patch @@ -0,0 +1,89 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -123,17 +123,6 @@ AC_MSG_RESULT($UINT32_TYPE) + AC_DEFINE_UNQUOTED(UINT32_TYPE,$UINT32_TYPE,unsigned 32 bit integer type) + + dnl ---------------------------------------------------------------------- +-dnl Internationalization +- +-GETTEXT_PACKAGE=ccrypt +-AC_SUBST(GETTEXT_PACKAGE) +-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext]) +- +-AM_GNU_GETTEXT +-AM_GNU_GETTEXT_VERSION([0.14.3]) +-IT_PO_SUBDIR(po) +- +-dnl ---------------------------------------------------------------------- + dnl Libtool (needed by intl/) + + LT_INIT +@@ -153,9 +142,7 @@ AC_SUBST(TAR) + dnl ---------------------------------------------------------------------- + AC_CONFIG_FILES([doc/ccrypt.1 + doc/ccguess.1 +- po/Makefile.in + m4/Makefile +- intl/Makefile + Makefile + src/Makefile + emacs/Makefile +--- a/Makefile.am ++++ b/Makefile.am +@@ -4,7 +4,7 @@ + + ## Process this file with automake to produce Makefile.in + +-SUBDIRS = m4 po intl src emacs doc check ++SUBDIRS = m4 src emacs doc check + + EXTRA_DIST = m4/ChangeLog config.rpath README-WIN + +--- a/Makefile.in ++++ b/Makefile.in +@@ -36,7 +36,7 @@ host_triplet = @host@ + subdir = . + DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ +- $(top_srcdir)/configure $(top_srcdir)/intl/Makefile.in \ ++ $(top_srcdir)/configure \ + ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS config.guess \ + config.rpath config.sub depcomp elisp-comp install-sh \ + ltmain.sh missing mkinstalldirs +@@ -66,7 +66,7 @@ am__CONFIG_DISTCLEAN_FILES = config.stat + configure.lineno config.status.lineno + mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs + CONFIG_HEADER = config.h +-CONFIG_CLEAN_FILES = intl/Makefile ++CONFIG_CLEAN_FILES = + CONFIG_CLEAN_VPATH_FILES = + SOURCES = + DIST_SOURCES = +@@ -277,7 +277,7 @@ target_alias = @target_alias@ + top_build_prefix = @top_build_prefix@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ +-SUBDIRS = m4 po intl src emacs doc check ++SUBDIRS = m4 src emacs doc check + EXTRA_DIST = m4/ChangeLog config.rpath README-WIN + ACLOCAL_AMFLAGS = -I m4 + all: config.h +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -56,4 +56,4 @@ uninstall-local: + # internationalization stuff + localedir = $(datadir)/locale + INCLUDES = -I../intl -I$(top_srcdir)/intl -DLOCALEDIR=\"$(localedir)\" +-LIBS = @LIBINTL@ @LIBS@ ++LIBS = @LIBS@ +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -159,7 +159,7 @@ LDFLAGS = @LDFLAGS@ + LIBICONV = @LIBICONV@ + LIBINTL = @LIBINTL@ + LIBOBJS = @LIBOBJS@ +-LIBS = @LIBINTL@ @LIBS@ ++LIBS = @LIBS@ + LIBTOOL = @LIBTOOL@ + LIPO = @LIPO@ + LN_S = @LN_S@ diff --git a/utils/cmdpad/Makefile b/utils/cmdpad/Makefile new file mode 100644 index 0000000..c092fc9 --- /dev/null +++ b/utils/cmdpad/Makefile @@ -0,0 +1,61 @@ +# +# Copyright (C) 2007-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:=cmdpad +PKG_VERSION:=0.0.3 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=@SF/cmdpad +PKG_MD5SUM:=6633b2354b7f23f9cd8e2bfb6e735965 + +PKG_MAINTAINER:=Ted Hess +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=doc/COPYING + +include $(INCLUDE_DIR)/package.mk + +define Package/cmdpad + SECTION:=utils + CATEGORY:=Utilities + TITLE:=execute commands when a key is pressed, released or hold down + URL:=http://cmdpad.sourceforge.net/index.php +endef + +CONFIGURE_ARGS += \ + --enable-static \ + --enable-shared + +define Package/cmdpad/description + cmdpad - execute commands when a key is pressed, released or hold down. + Should be started from /etc/rc or /etc/rc.local. To run it as daemon you + need to start it with '&'. All logs are printed to standard out and standard + error (to write the log to disk use cmdpad > /var/log/cmdpad). Cmdpad + searches for /etc/cmdpad.conf and load the key bindings. Then wait for + key event and check each command to see if it should be run. +endef + +MAKE_FLAGS += \ + $(TARGET_CONFIGURE_OPTS) \ + $(1) + +define Package/cmdpad/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/cmdpad $(1)/usr/sbin/ + $(INSTALL_CONF) $(PKG_BUILD_DIR)/src/cmdpad.conf $(1)/etc/ + $(INSTALL_BIN) ./files/cmdpad.init $(1)/etc/init.d/cmdpad +endef + +define Package/cmdpad/conffiles +/etc/cmdpad.conf +endef + +$(eval $(call BuildPackage,cmdpad)) diff --git a/utils/cmdpad/files/cmdpad.init b/utils/cmdpad/files/cmdpad.init new file mode 100644 index 0000000..f612033 --- /dev/null +++ b/utils/cmdpad/files/cmdpad.init @@ -0,0 +1,14 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2007-2011 OpenWrt.org + +START=93 + +SSD_DAEMONIZE=1 + +start() { + service_start /usr/sbin/cmdpad --quiet +} + +stop() { + service_stop /usr/sbin/cmdpad +} diff --git a/utils/cmdpad/patches/100-Makefile.patch b/utils/cmdpad/patches/100-Makefile.patch new file mode 100644 index 0000000..61a6c8f --- /dev/null +++ b/utils/cmdpad/patches/100-Makefile.patch @@ -0,0 +1,35 @@ +--- cmdpad-0.0.3/src/Makefile.orig 2008-01-05 23:29:44.000000000 +0100 ++++ cmdpad-0.0.3/src/Makefile 2008-01-05 23:30:23.000000000 +0100 +@@ -5,25 +5,25 @@ + TOP=.. + include $(TOP)/Makefile.common + +-INCLUDE= -I/usr/include +-LIBS= -L/usr/lib -lc +-CFLAGS= -g3 +-LDFLAGS= -Xlinker -Map -Xlinker $(PROG).map #,--stack,16Mb ++#INCLUDE= -I/usr/include ++#LIBS= -L/usr/lib -lc ++#CFLAGS= -g3 ++#LDFLAGS= -Xlinker -Map -Xlinker $(PROG).map #,--stack,16Mb + OBJ= main.o command.o parse.o + SCRIPTS= *.sh + + build: $(PROG) + + $(PROG): $(OBJ) +- gcc -o $(PROG) $(OBJ) $(LIBS) $(LDFLAGS) ++ $(GCC) -o $(PROG) $(OBJ) $(LIBS) $(LDFLAGS) + @echo "===============================================" + @echo "edit $(PROG).conf file to set default preferences" + + %.o : %.c +- gcc $(CFLAGS) -D__COPYLEFT__='$(COPYLEFT)' -c $< ++ $(GCC) $(CFLAGS) -D__COPYLEFT__='$(COPYLEFT)' -c $< + + %.o : %.c %.h +- gcc $(CFLAGS) -D__COPYLEFT__='$(COPYLEFT)' -c $< ++ $(GCC) $(CFLAGS) -D__COPYLEFT__='$(COPYLEFT)' -c $< + + distclean clean: + rm $(PROG) *~ *.o -vf diff --git a/utils/cmdpad/patches/120-kernel26-compat.patch b/utils/cmdpad/patches/120-kernel26-compat.patch new file mode 100644 index 0000000..eb7beeb --- /dev/null +++ b/utils/cmdpad/patches/120-kernel26-compat.patch @@ -0,0 +1,15 @@ +--- cmdpad-0.0.3/src/parse.orig 2008-01-05 23:55:32.000000000 +0100 ++++ cmdpad-0.0.3/src/parse.c 2008-01-05 23:56:07.000000000 +0100 +@@ -289,6 +289,12 @@ + pchEventDevice = strdup( pchValue) ; + return 1 ; + } ++ if( (pchValue != NULL) && ++ (strncmp( pchValue, "/dev/event", 6) == 0) ) ++ { ++ pchEventDevice = strdup( pchValue) ; ++ return 1 ; ++ } + printf( "Option 'device' expects a /dev/input/eventX argument\n"); + return -1 ; + } diff --git a/utils/cmdpad/patches/130-no_zombie.patch b/utils/cmdpad/patches/130-no_zombie.patch new file mode 100644 index 0000000..aa4fc6a --- /dev/null +++ b/utils/cmdpad/patches/130-no_zombie.patch @@ -0,0 +1,18 @@ +--- cmdpad-0.0.3/src/command.c.orig 2003-03-29 17:54:12.000000000 +0100 ++++ cmdpad-0.0.3/src/command.c 2008-01-12 05:41:22.000000000 +0100 +@@ -68,6 +68,7 @@ + + void exec( char * command) + { ++ int status; + if( fork() == 0) { + char ** tmp ; + int i ; +@@ -88,6 +89,7 @@ + perror( "ERROR: execv") ; + exit( 1) ; + } // end if( fork()) ++ wait(&status); + } + + int getNumberofEntry() diff --git a/utils/cmdpad/patches/140-compile_fix.patch b/utils/cmdpad/patches/140-compile_fix.patch new file mode 100644 index 0000000..c7a9bb3 --- /dev/null +++ b/utils/cmdpad/patches/140-compile_fix.patch @@ -0,0 +1,11 @@ +--- a/src/parse.c ++++ b/src/parse.c +@@ -125,7 +125,7 @@ int readCommandLine( int argc, char *arg + + d2printf( "command line command %s found\n", pchCommandTranslations[ iCmd+1]) ; + +- vsnprintf( achCommand, sizeof( achCommand), ++ snprintf( achCommand, sizeof( achCommand), + pchCommandTranslations[ iCmd+1], + &argv[ i+1]) ; + diff --git a/utils/collectd/Makefile b/utils/collectd/Makefile new file mode 100644 index 0000000..70c055a --- /dev/null +++ b/utils/collectd/Makefile @@ -0,0 +1,367 @@ +# +# Copyright (C) 2006-2016 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:=collectd +PKG_VERSION:=5.5.2 +PKG_RELEASE:=4 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://collectd.org/files/ +PKG_MD5SUM:=40b83343f72089e0330f53965f1140bd + +PKG_FIXUP:=autoreconf +PKG_REMOVE_FILES:=aclocal.m4 libltdl/aclocal.m4 +PKG_MAINTAINER:=Jo-Philipp Wich + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +COLLECTD_PLUGINS_DISABLED:= \ + amqp \ + apple_sensors \ + aquaero \ + barometer \ + battery \ + ceph \ + cgroups \ + curl_json \ + curl_xml \ + dbi \ + drbd \ + ethstat \ + fhcount \ + genericjmx \ + gmond \ + hddtemp \ + ipc \ + ipmi \ + ipvs \ + java \ + log_logstash \ + lvm \ + lpar \ + mbmon \ + md \ + memcachec \ + memcached \ + mic \ + monitorus \ + multimeter \ + netapp \ + nfs \ + notify_desktop \ + notify_email \ + numa \ + openldap \ + openvz \ + oracle \ + perl \ + pf \ + pinba \ + python \ + redis \ + routeros \ + rrdcached \ + serial \ + sigrok \ + smart \ + statsd \ + swap \ + tape \ + tokyotyrant \ + turbostat \ + uuid \ + varnish \ + virt \ + vserver \ + write_kafka \ + write_log \ + write_mongodb \ + write_redis \ + write_riemann \ + write_sensu \ + write_tsdb \ + xmms \ + zfs_arc \ + zookeeper + +COLLECTD_PLUGINS_SELECTED:= \ + apache \ + apcups \ + ascent \ + bind \ + conntrack \ + contextswitch \ + cpu \ + cpufreq \ + csv \ + curl \ + df \ + disk \ + dns \ + email \ + entropy \ + exec \ + filecount \ + fscache \ + interface \ + iptables \ + irq \ + iwinfo \ + load \ + logfile \ + madwifi \ + memory \ + modbus \ + mysql \ + netlink \ + network \ + nginx \ + ntpd \ + nut \ + olsrd \ + onewire \ + openvpn \ + ping \ + postgresql \ + powerdns \ + processes \ + protocols \ + rrdtool \ + sensors \ + snmp \ + syslog \ + table \ + tail \ + tail_csv \ + tcpconns \ + teamspeak2 \ + ted \ + thermal \ + unixsock \ + uptime \ + users \ + vmem \ + wireless \ + write_graphite \ + write_http \ + +PKG_CONFIG_DEPENDS:= \ + $(patsubst %,CONFIG_PACKAGE_collectd-mod-%,$(subst _,-,$(COLLECTD_PLUGINS_SELECTED))) \ + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/kernel.mk + +define Package/collectd/Default + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Lightweight system statistics collection daemon + URL:=http://verplant.org/collectd/ +endef + +define Package/collectd +$(call Package/collectd/Default) + DEPENDS:= +libpthread +zlib +libltdl +libip4tc + MENU:=1 +endef + +define Package/collectd/description + collectd is a small daemon which collects system information periodically + and provides mechanismns to store the values in a variety of ways. +endef + +define Package/collectd/config + config PACKAGE_COLLECTD_ENCRYPTED_NETWORK + bool "Enable ability to use encrypted networking" + default n + depends on PACKAGE_collectd + select PACKAGE_collectd-mod-network +endef + +ifneq ($(CONFIG_avr32),) + TARGET_CFLAGS += -fsigned-char +endif + +# common configure args +CONFIGURE_ARGS+= \ + --disable-debug \ + --enable-daemon \ + --with-nan-emulation \ + --without-perl-bindings \ + --without-libudev + +ifneq ($(CONFIG_PACKAGE_COLLECTD_ENCRYPTED_NETWORK),) +CONFIGURE_ARGS+= \ + --with-libgcrypt=$(STAGING_DIR)/include +else +CONFIGURE_ARGS+= \ + --without-libgcrypt +endif + +CONFIGURE_VARS+= \ + CFLAGS="$$$$CFLAGS $(FPIC)" \ + LDFLAGS="$$$$LDFLAGS -lm -lz" \ + KERNEL_DIR="$(LINUX_DIR)" \ + +CONFIGURE_PLUGIN= \ + $(foreach m, $(1), \ + $(if $(CONFIG_PACKAGE_collectd-mod-$(subst _,-,$(m))),--enable-$(m),--disable-$(m)) \ + ) + +CONFIGURE_ARGS+= \ + $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_SELECTED)) \ + $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_DISABLED)) \ + +# exception: mod-ascent needs libxml2 +ifneq ($(CONFIG_PACKAGE_collectd-mod-ascent),) + CONFIGURE_VARS+= \ + CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libxml2" +endif + +ifneq ($(CONFIG_BIG_ENDIAN),) + CONFIGURE_ARGS+= --with-fp-layout=endianflip +else + CONFIGURE_ARGS+= --with-fp-layout=nothing +endif + +ifneq ($(CONFIG_PACKAGE_collectd-mod-postgresql),) + CONFIGURE_ARGS+= --with-libpq="$(STAGING_DIR)/usr/" +endif + +ifneq ($(CONFIG_PACKAGE_collectd-mod-mysql),) + CONFIGURE_ARGS+= --with-libmysql="$(STAGING_DIR)/usr/" +endif + +# exception: mod-netlink needs libnetlink from iproute +ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),) + CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr" +endif + +# exception: mod-modbus needs libmodbus +ifneq ($(CONFIG_PACKAGE_collectd-mod-modbus),) + CONFIGURE_ARGS+= --with-libmodbus="$(STAGING_DIR)/usr" +endif + +# exception: mod-onewire needs libow-capi +ifneq ($(CONFIG_PACKAGE_collectd-mod-onewire),) + CONFIGURE_ARGS+= --with-libowcapi="$(STAGING_DIR)/usr" +endif + +# exception: mod-rrdtool needs rrdtool-1.0.x +ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool),) + CONFIGURE_ARGS+= --with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0" +endif + +define Package/collectd/conffiles +/etc/collectd.conf +endef + +define Package/collectd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/collectd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/usr/share/collectd + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/collectd/types.db $(1)/usr/share/collectd/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) ./files/collectd.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/collectd.init $(1)/etc/init.d/collectd + $(INSTALL_DIR) $(1)/etc/collectd/conf.d +endef + +# 1: plugin name +# 2: plugin title/description +# 3: files +# 4: extra dependency +define BuildPlugin + + PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1) + + define Package/collectd-mod-$(1) + $$(call Package/collectd/Default) + TITLE:=$(2) plugin + DEPENDS:= collectd $(4) + endef + + define Package/collectd-mod-$(1)/install + $(INSTALL_DIR) $$(1)/usr/lib/collectd + for m in $(3); do \ + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/collectd/$$$$$$$${m}.so \ + $$(1)/usr/lib/collectd/ ; \ + done + endef + + $$(eval $$(call BuildPackage,collectd-mod-$(1))) + +endef + +$(eval $(call BuildPackage,collectd)) + +#$(eval $(call BuildPlugin,NAME,DESCRIPTION,FILES,DEPENDENCIES)) +$(eval $(call BuildPlugin,apache,apache status input,apache,+PACKAGE_collectd-mod-apache:libcurl)) +$(eval $(call BuildPlugin,apcups,apcups status input,apcups,)) +$(eval $(call BuildPlugin,ascent,ascent status input,ascent,+PACKAGE_collectd-mod-ascent:libcurl +PACKAGE_collectd-mod-ascent:libxml2)) +$(eval $(call BuildPlugin,bind,BIND server/zone input,bind,+PACKAGE_collectd-mod-bind:libcurl +PACKAGE_collectd-mod-bind:libxml2)) +$(eval $(call BuildPlugin,conntrack,connection tracking table size input,conntrack,)) +$(eval $(call BuildPlugin,contextswitch,context switch input,contextswitch,)) +$(eval $(call BuildPlugin,cpu,CPU input,cpu,)) +$(eval $(call BuildPlugin,cpufreq,CPU Freq input,cpufreq,@(TARGET_x86||TARGET_x86_64||TARGET_mvebu||TARGET_ipq806x))) # Only enable on x86 mvebu and ipq806x +$(eval $(call BuildPlugin,csv,CSV output,csv,)) +$(eval $(call BuildPlugin,curl,cURL input,curl,+PACKAGE_collectd-mod-curl:libcurl)) +#$(eval $(call BuildPlugin,dbi,relational database input,dbi,+PACKAGE_collectd-mod-dbi:libdbi)) +$(eval $(call BuildPlugin,df,disk space input,df,)) +$(eval $(call BuildPlugin,disk,disk usage/timing input,disk,)) +$(eval $(call BuildPlugin,dns,DNS traffic input,dns,+PACKAGE_collectd-mod-dns:libpcap)) +$(eval $(call BuildPlugin,email,email output,email,)) +$(eval $(call BuildPlugin,entropy,Entropy amount input,entropy,)) +$(eval $(call BuildPlugin,exec,process exec input,exec,)) +$(eval $(call BuildPlugin,filecount,file count input,filecount,)) +$(eval $(call BuildPlugin,fscache,file-system based caching framework input,fscache,)) +$(eval $(call BuildPlugin,interface,network interfaces input,interface,)) +$(eval $(call BuildPlugin,iptables,iptables status input,iptables,+PACKAGE_collectd-mod-iptables:iptables +libiptc)) +$(eval $(call BuildPlugin,irq,interrupt usage input,irq,)) +$(eval $(call BuildPlugin,iwinfo,libiwinfo wireless statistics,iwinfo,+PACKAGE_collectd-mod-iwinfo:libiwinfo)) +$(eval $(call BuildPlugin,load,system load input,load,)) +$(eval $(call BuildPlugin,logfile,log files output,logfile,)) +$(eval $(call BuildPlugin,madwifi,MadWifi status input,madwifi,)) +#$(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient-r)) +$(eval $(call BuildPlugin,memory,physical memory usage input,memory,)) +$(eval $(call BuildPlugin,modbus,read variables through libmodbus,modbus,+PACKAGE_collectd-mod-modbus:libmodbus)) +$(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:libmnl)) +$(eval $(call BuildPlugin,network,network input/output,network,+PACKAGE_COLLECTD_ENCRYPTED_NETWORK:libgcrypt)) +$(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl)) +$(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,)) +$(eval $(call BuildPlugin,nut,UPS monitoring input,nut,+PACKAGE_collectd-mod-nut:nut)) +$(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,)) +$(eval $(call BuildPlugin,onewire,onewire sensor input,onewire,+PACKAGE_collectd-mod-onewire:libow-capi @BROKEN)) +$(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,)) +$(eval $(call BuildPlugin,ping,ping status input,ping,+PACKAGE_collectd-mod-ping:liboping)) +$(eval $(call BuildPlugin,postgresql,PostgreSQL status input,postgresql,+PACKAGE_collectd-mod-postgresql:libpq)) +$(eval $(call BuildPlugin,powerdns,PowerDNS server status input,powerdns,)) +$(eval $(call BuildPlugin,processes,process status input,processes,)) +$(eval $(call BuildPlugin,protocols,network protocols input,protocols,)) +$(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+PACKAGE_collectd-mod-rrdtool:librrd1)) +$(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+PACKAGE_collectd-mod-sensors:libsensors)) +$(eval $(call BuildPlugin,snmp,SNMP input,snmp,+PACKAGE_collectd-mod-snmp:libnetsnmp)) +$(eval $(call BuildPlugin,syslog,syslog output,syslog,)) +$(eval $(call BuildPlugin,tail,tail input,tail,)) +$(eval $(call BuildPlugin,tail-csv,tail CSV input,tail_csv,)) +$(eval $(call BuildPlugin,table,table-like structured file input,table,)) +$(eval $(call BuildPlugin,teamspeak2,TeamSpeak2 input,teamspeak2,)) +$(eval $(call BuildPlugin,ted,The Energy Detective input,ted,@((!TARGET_avr32)||BROKEN))) # fails on avr32 because of warnings treated as errors +$(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,)) +$(eval $(call BuildPlugin,thermal,system temperatures input,thermal,)) +$(eval $(call BuildPlugin,unixsock,unix socket output,unixsock,)) +$(eval $(call BuildPlugin,uptime,uptime status input,uptime,)) +$(eval $(call BuildPlugin,users,user logged in status input,users,)) +$(eval $(call BuildPlugin,vmem,virtual memory usage input,vmem,)) +$(eval $(call BuildPlugin,wireless,wireless status input,wireless,)) +$(eval $(call BuildPlugin,write-graphite,Carbon/Graphite output,write_graphite,+PACKAGE_collectd-mod-write-graphite:libpthread)) +$(eval $(call BuildPlugin,write-http,HTTP POST output,write_http,+PACKAGE_collectd-mod-write-http:libcurl)) diff --git a/utils/collectd/files/collectd.conf b/utils/collectd/files/collectd.conf new file mode 100644 index 0000000..3afbfad --- /dev/null +++ b/utils/collectd/files/collectd.conf @@ -0,0 +1,39 @@ +# Config file for collectd. More info: https://collectd.org/ +# Note: Luci statistics will generate a new config and overwrite this file. + +#Hostname "localhost" +#FQDNLookup true +BaseDir "/var/run/collectd" +Include "/etc/collectd/conf.d" +PIDFile "/var/run/collectd.pid" +PluginDir "/usr/lib/collectd" +TypesDB "/usr/share/collectd/types.db" +Interval 30 +ReadThreads 2 + +LoadPlugin interface +LoadPlugin load +#LoadPlugin ping +LoadPlugin rrdtool + + + DataDir "/tmp/rrd" + RRARows 100 + RRASingle true + RRATimespan 3600 + RRATimespan 86400 + RRATimespan 604800 + RRATimespan 2678400 + RRATimespan 31622400 + + + + IgnoreSelected false + Interface "br-lan" + + +# +# Host "host.foo.bar" +# Interval 30 +# TTL 127 +# diff --git a/utils/collectd/files/collectd.init b/utils/collectd/files/collectd.init new file mode 100644 index 0000000..cb314d3 --- /dev/null +++ b/utils/collectd/files/collectd.init @@ -0,0 +1,15 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2016 OpenWrt.org + +START=80 +STOP=10 + +USE_PROCD=1 + +start_service() { + mkdir -m 0755 -p /var/lib/collectd + procd_open_instance + procd_set_param command /usr/sbin/collectd -f + procd_close_instance +} + diff --git a/utils/collectd/patches/001-undefined-AM_PATH_LIBGCRYPT.patch b/utils/collectd/patches/001-undefined-AM_PATH_LIBGCRYPT.patch new file mode 100644 index 0000000..0e01744 --- /dev/null +++ b/utils/collectd/patches/001-undefined-AM_PATH_LIBGCRYPT.patch @@ -0,0 +1,4 @@ +--- /dev/null ++++ b/fake-am_path_libgcrypt.m4 +@@ -0,0 +1 @@ ++AC_DEFUN([AM_PATH_LIBGCRYPT],[:]) diff --git a/utils/collectd/patches/003-remove-werror.patch b/utils/collectd/patches/003-remove-werror.patch new file mode 100644 index 0000000..c81f209 --- /dev/null +++ b/utils/collectd/patches/003-remove-werror.patch @@ -0,0 +1,22 @@ +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -7,7 +7,7 @@ SUBDIRS += daemon + PLUGIN_LDFLAGS = -module -avoid-version -export-symbols-regex '\' + + if COMPILER_IS_GCC +-AM_CFLAGS = -Wall -Werror ++AM_CFLAGS = -Wall + endif + + AM_CPPFLAGS = -I$(srcdir)/daemon +--- a/src/libcollectdclient/Makefile.am ++++ b/src/libcollectdclient/Makefile.am +@@ -1,7 +1,7 @@ + AUTOMAKE_OPTIONS = foreign no-dependencies + + if COMPILER_IS_GCC +-AM_CFLAGS = -Wall -Werror ++AM_CFLAGS = -Wall + endif + + pkginclude_HEADERS = collectd/client.h collectd/network.h collectd/network_buffer.h collectd/lcc_features.h diff --git a/utils/collectd/patches/100-rrdtool-add-rrasingle-option.patch b/utils/collectd/patches/100-rrdtool-add-rrasingle-option.patch new file mode 100644 index 0000000..704962f --- /dev/null +++ b/utils/collectd/patches/100-rrdtool-add-rrasingle-option.patch @@ -0,0 +1,57 @@ +--- a/src/rrdtool.c ++++ b/src/rrdtool.c +@@ -82,6 +82,7 @@ static const char *config_keys[] = + "HeartBeat", + "RRARows", + "RRATimespan", ++ "RRASingle", + "XFF", + "WritesPerSecond", + "RandomTimeout" +@@ -103,6 +104,8 @@ static rrdcreate_config_t rrdcreate_conf + /* timespans = */ NULL, + /* timespans_num = */ 0, + ++ /* rrasingle = */ 0, ++ + /* consolidation_functions = */ NULL, + /* consolidation_functions_num = */ 0, + +@@ -1110,6 +1113,14 @@ static int rrd_config (const char *key, + + free (value_copy); + } ++ else if (strcasecmp ("RRASingle", key) == 0) ++ { ++ if (IS_TRUE (value)) ++ { ++ rrdcreate_config.rrasingle = 1; ++ NOTICE ("rrdtool plugin: RRASingle = true: creating only AVERAGE RRAs"); ++ } ++ } + else if (strcasecmp ("XFF", key) == 0) + { + double tmp = atof (value); +--- a/src/utils_rrdcreate.c ++++ b/src/utils_rrdcreate.c +@@ -213,6 +213,9 @@ static int rra_get (char ***ret, const v + rts_num = rra_timespans_num; + } + ++ if (cfg->rrasingle) ++ rra_types_num = 1; ++ + rra_max = rts_num * rra_types_num; + assert (rra_max > 0); + +--- a/src/utils_rrdcreate.h ++++ b/src/utils_rrdcreate.h +@@ -41,6 +41,8 @@ struct rrdcreate_config_s + int *timespans; + size_t timespans_num; + ++ int rrasingle; ++ + char **consolidation_functions; + size_t consolidation_functions_num; + diff --git a/utils/collectd/patches/140-fix-fqdnlookup.patch b/utils/collectd/patches/140-fix-fqdnlookup.patch new file mode 100644 index 0000000..22990bd --- /dev/null +++ b/utils/collectd/patches/140-fix-fqdnlookup.patch @@ -0,0 +1,11 @@ +--- a/src/daemon/configfile.c ++++ b/src/daemon/configfile.c +@@ -111,7 +111,7 @@ static cf_global_option_t cf_global_opti + {"BaseDir", NULL, PKGLOCALSTATEDIR}, + {"PIDFile", NULL, PIDFILE}, + {"Hostname", NULL, NULL}, +- {"FQDNLookup", NULL, "true"}, ++ {"FQDNLookup", NULL, "false"}, + {"Interval", NULL, NULL}, + {"ReadThreads", NULL, "5"}, + {"WriteThreads", NULL, "5"}, diff --git a/utils/collectd/patches/200-fix-git-describe-error.patch b/utils/collectd/patches/200-fix-git-describe-error.patch new file mode 100644 index 0000000..8f570cb --- /dev/null +++ b/utils/collectd/patches/200-fix-git-describe-error.patch @@ -0,0 +1,11 @@ +--- a/version-gen.sh ++++ b/version-gen.sh +@@ -2,7 +2,7 @@ + + DEFAULT_VERSION="5.5.2.git" + +-VERSION="`git describe 2> /dev/null | grep collectd | sed -e 's/^collectd-//'`" ++#VERSION="`git describe 2> /dev/null | grep collectd | sed -e 's/^collectd-//'`" + + if test -z "$VERSION"; then + VERSION="$DEFAULT_VERSION" diff --git a/utils/collectd/patches/300-delay-first-read-cycle.patch b/utils/collectd/patches/300-delay-first-read-cycle.patch new file mode 100644 index 0000000..495c80f --- /dev/null +++ b/utils/collectd/patches/300-delay-first-read-cycle.patch @@ -0,0 +1,11 @@ +--- a/src/daemon/plugin.c ++++ b/src/daemon/plugin.c +@@ -1149,7 +1149,7 @@ static int plugin_insert_read (read_func + int status; + llentry_t *le; + +- rf->rf_next_read = cdtime (); ++ rf->rf_next_read = cdtime () + (cdtime_t) 1073741824; //delay first read 1s + rf->rf_effective_interval = rf->rf_interval; + + pthread_mutex_lock (&read_lock); diff --git a/utils/collectd/patches/400-fix-olsrd-get-all.patch b/utils/collectd/patches/400-fix-olsrd-get-all.patch new file mode 100644 index 0000000..1dc6c58 --- /dev/null +++ b/utils/collectd/patches/400-fix-olsrd-get-all.patch @@ -0,0 +1,11 @@ +--- a/src/olsrd.c ++++ b/src/olsrd.c +@@ -658,7 +658,7 @@ static int olsrd_read (void) /* {{{ */ + if (fh == NULL) + return (-1); + +- fputs ("\r\n", fh); ++ fputs ("/all \r\n", fh); + fflush (fh); + + while (fgets (buffer, sizeof (buffer), fh) != NULL) diff --git a/utils/collectd/patches/600-fix-libmodbus-detection.patch b/utils/collectd/patches/600-fix-libmodbus-detection.patch new file mode 100644 index 0000000..dd0198a --- /dev/null +++ b/utils/collectd/patches/600-fix-libmodbus-detection.patch @@ -0,0 +1,40 @@ +Patch reverts upstream commit: +https://github.com/collectd/collectd/commit/6124da7a48f28f54fc09ebeb942d1037516fe6ab + +The commit changed the detection path due to FreeBSD issues, +but apparently affects also Openwrt buildroot negatively. + +Original explanation: + From 6124da7a48f28f54fc09ebeb942d1037516fe6ab Mon Sep 17 00:00:00 2001 + Subject: [PATCH] Fix libmodbus detection on FreeBSD + + We look for modbus/modbus.h in /usr/local/include/modbus + but we should look for modbus.h + + This is only an issue on FreeBSD since /usr/local/include is not + in the default search path. + +Reversed patch to be applied: + +--- a/configure.ac ++++ b/configure.ac +@@ -2626,7 +2626,7 @@ then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags" + +- AC_CHECK_HEADERS(modbus.h, [], [with_libmodbus="no (modbus.h not found)"]) ++ AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" + fi +--- a/src/modbus.c ++++ b/src/modbus.c +@@ -27,7 +27,7 @@ + + #include + +-#include ++#include + + #ifndef LIBMODBUS_VERSION_CHECK + /* Assume version 2.0.3 */ diff --git a/utils/collectd/patches/900-add-iwinfo-plugin.patch b/utils/collectd/patches/900-add-iwinfo-plugin.patch new file mode 100644 index 0000000..7f8c1e1 --- /dev/null +++ b/utils/collectd/patches/900-add-iwinfo-plugin.patch @@ -0,0 +1,276 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -704,6 +704,9 @@ AC_CHECK_HEADERS(net/pfvar.h, + have_termios_h="no" + AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"]) + ++# For the iwinfo plugin ++AC_CHECK_LIB(iwinfo, iwinfo_backend, [with_iwinfo="yes"], [with_iwinfo="no (libiwinfo not found)"], []) ++ + # For the turbostat plugin + have_asm_msrindex_h="no" + AC_CHECK_HEADERS(asm/msr-index.h, [have_asm_msrindex_h="yes"]) +@@ -5310,6 +5313,7 @@ plugin_interface="no" + plugin_ipmi="no" + plugin_ipvs="no" + plugin_irq="no" ++plugin_iwinfo="no" + plugin_load="no" + plugin_log_logstash="no" + plugin_memory="no" +@@ -5713,6 +5717,7 @@ AC_PLUGIN([ipmi], [$plugin_ipmi], + AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters]) + AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics]) + AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics]) ++AC_PLUGIN([iwinfo], [$with_iwinfo], [Common iwinfo wireless statistics]) + AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine]) + AC_PLUGIN([load], [$plugin_load], [System load]) + AC_PLUGIN([logfile], [yes], [File logging plugin]) +@@ -6042,6 +6047,7 @@ Configuration: + oracle . . . . . . . $with_oracle + protobuf-c . . . . . $have_protoc_c + python . . . . . . . $with_python ++ iwinfo . . . . . . . $with_iwinfo + + Features: + daemon mode . . . . . $enable_daemon +@@ -6091,6 +6097,7 @@ Configuration: + iptables . . . . . . $enable_iptables + ipvs . . . . . . . . $enable_ipvs + irq . . . . . . . . . $enable_irq ++ iwinfo . . . . . . . $enable_iwinfo + java . . . . . . . . $enable_java + load . . . . . . . . $enable_load + logfile . . . . . . . $enable_logfile +--- a/src/collectd.conf.in ++++ b/src/collectd.conf.in +@@ -128,6 +128,7 @@ + #@BUILD_PLUGIN_IPTABLES_TRUE@LoadPlugin iptables + #@BUILD_PLUGIN_IPVS_TRUE@LoadPlugin ipvs + #@BUILD_PLUGIN_IRQ_TRUE@LoadPlugin irq ++#@BUILD_PLUGIN_IWINFO_TRUE@LoadPlugin iwinfo + #@BUILD_PLUGIN_JAVA_TRUE@LoadPlugin java + @BUILD_PLUGIN_LOAD_TRUE@@BUILD_PLUGIN_LOAD_TRUE@LoadPlugin load + #@BUILD_PLUGIN_LPAR_TRUE@LoadPlugin lpar +@@ -582,6 +583,12 @@ + # IgnoreSelected true + # + ++# ++# Interface "ath0" ++# Interface "ra0" ++# Interface "wlan0" ++# ++ + # + # JVMArg "-verbose:jni" + # JVMArg "-Djava.class.path=@prefix@/share/collectd/java/collectd-api.jar" +--- a/src/collectd.conf.pod ++++ b/src/collectd.conf.pod +@@ -2606,6 +2606,27 @@ and all other interrupts are collected. + + =back + ++=head2 Plugin C ++ ++=over 4 ++ ++=item B I ++ ++Select this interface. By default all detected wireless interfaces will be ++collected. For a more detailed description see B below. ++ ++=item B I|I ++ ++If no configuration if given, the B-plugin will collect data from all ++detected wireless interfaces. You can use the B-option to pick the ++interfaces you're interested in. Sometimes, however, it's easier/preferred to ++collect all interfaces I a few ones. This option enables you to do ++that: By setting B to I the effect of B is ++inverted: All selected interfaces are ignored and all other interfaces are ++collected. ++ ++=back ++ + =head2 Plugin C + + The I plugin makes it possible to write extensions for collectd in Java. +--- /dev/null ++++ b/src/iwinfo.c +@@ -0,0 +1,150 @@ ++/** ++ * collectd - src/iwinfo.c ++ * Copyright (C) 2011 Jo-Philipp Wich ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; only version 2 of the License is applicable. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License along ++ * with this program; if not, write to the Free Software Foundation, Inc., ++ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ++ **/ ++ ++#include "collectd.h" ++#include "common.h" ++#include "plugin.h" ++#include "utils_ignorelist.h" ++ ++#include ++#include ++ ++#define PROCNETDEV "/proc/net/dev" ++ ++static const char *config_keys[] = { ++ "Interface", ++ "IgnoreSelected" ++}; ++static int config_keys_num = STATIC_ARRAY_SIZE (config_keys); ++ ++static ignorelist_t *ignorelist = NULL; ++ ++static int iwinfo_config(const char *key, const char *value) ++{ ++ if (ignorelist == NULL) ++ ignorelist = ignorelist_create(1); ++ ++ if (ignorelist == NULL) ++ return 1; ++ ++ if (strcasecmp(key, "Interface") == 0) ++ ignorelist_add(ignorelist, value); ++ else if (strcasecmp(key, "IgnoreSelected") == 0) ++ ignorelist_set_invert(ignorelist, IS_TRUE(value) ? 0 : 1); ++ else ++ return -1; ++ ++ return 0; ++} ++ ++static void iwinfo_submit(const char *ifname, const char *type, int value) ++{ ++ value_t values[1]; ++ value_list_t vl = VALUE_LIST_INIT; ++ ++ values[0].gauge = value; ++ ++ vl.values = values; ++ vl.values_len = 1; ++ ++ sstrncpy(vl.host, hostname_g, sizeof(vl.host)); ++ sstrncpy(vl.plugin, "iwinfo", sizeof(vl.plugin)); ++ sstrncpy(vl.plugin_instance, ifname, sizeof(vl.plugin_instance)); ++ sstrncpy(vl.type, type, sizeof(vl.type)); ++ /*sstrncpy(vl.type_instance, "", sizeof(vl.type_instance));*/ ++ ++ plugin_dispatch_values(&vl); ++} ++ ++static void iwinfo_process(const char *ifname) ++{ ++ int val; ++ char buf[IWINFO_BUFSIZE]; ++ const struct iwinfo_ops *iw = iwinfo_backend(ifname); ++ ++ /* does appear to be a wifi iface */ ++ if (iw) ++ { ++ if (iw->bitrate(ifname, &val)) ++ val = 0; ++ iwinfo_submit(ifname, "bitrate", val * 1000); ++ ++ if (iw->signal(ifname, &val)) ++ val = 0; ++ iwinfo_submit(ifname, "signal_power", val); ++ ++ if (iw->noise(ifname, &val)) ++ val = 0; ++ iwinfo_submit(ifname, "signal_noise", val); ++ ++ if (iw->quality(ifname, &val)) ++ val = 0; ++ iwinfo_submit(ifname, "signal_quality", val); ++ ++ if (iw->assoclist(ifname, buf, &val)) ++ val = 0; ++ iwinfo_submit(ifname, "stations", ++ val / sizeof(struct iwinfo_assoclist_entry)); ++ } ++ ++ iwinfo_finish(); ++} ++ ++static int iwinfo_read(void) ++{ ++ char line[1024]; ++ char ifname[128]; ++ FILE *f; ++ ++ f = fopen(PROCNETDEV, "r"); ++ if (f == NULL) ++ { ++ char err[1024]; ++ WARNING("iwinfo: Unable to open " PROCNETDEV ": %s", ++ sstrerror(errno, err, sizeof(err))); ++ return -1; ++ } ++ ++ while (fgets(line, sizeof(line), f)) ++ { ++ if (!strchr(line, ':')) ++ continue; ++ ++ if (!sscanf(line, " %127[^:]", ifname)) ++ continue; ++ ++ if (ignorelist_match(ignorelist, ifname)) ++ continue; ++ ++ if (strstr(ifname, "mon.") || strstr(ifname, ".sta") || ++ strstr(ifname, "tmp.") || strstr(ifname, "wifi")) ++ continue; ++ ++ iwinfo_process(ifname); ++ } ++ ++ fclose(f); ++ ++ return 0; ++} ++ ++void module_register(void) ++{ ++ plugin_register_config("iwinfo", iwinfo_config, config_keys, config_keys_num); ++ plugin_register_read("iwinfo", iwinfo_read); ++} +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -457,6 +457,13 @@ irq_la_SOURCES = irq.c + irq_la_LDFLAGS = $(PLUGIN_LDFLAGS) + endif + ++if BUILD_PLUGIN_IWINFO ++pkglib_LTLIBRARIES += iwinfo.la ++iwinfo_la_SOURCES = iwinfo.c ++iwinfo_la_LDFLAGS = -module -avoid-version ++iwinfo_la_LIBADD = -liwinfo ++endif ++ + if BUILD_PLUGIN_JAVA + pkglib_LTLIBRARIES += java.la + java_la_SOURCES = java.c +--- a/src/types.db ++++ b/src/types.db +@@ -228,6 +228,7 @@ voltage value:GAUGE:U:U + vs_memory value:GAUGE:0:9223372036854775807 + vs_processes value:GAUGE:0:65535 + vs_threads value:GAUGE:0:65535 ++stations value:GAUGE:0:256 + + # + # Legacy types diff --git a/utils/collectd/patches/920-fix-ping-droprate.patch b/utils/collectd/patches/920-fix-ping-droprate.patch new file mode 100644 index 0000000..96a5c22 --- /dev/null +++ b/utils/collectd/patches/920-fix-ping-droprate.patch @@ -0,0 +1,11 @@ +--- a/src/ping.c ++++ b/src/ping.c +@@ -658,7 +658,7 @@ static int ping_read (void) /* {{{ */ + / ((double) (pkg_recv * (pkg_recv - 1)))); + + /* Calculate drop rate. */ +- droprate = ((double) (pkg_sent - pkg_recv)) / ((double) pkg_sent); ++ droprate = ((double) (pkg_sent - pkg_recv)) * 100 / ((double) pkg_sent); + + submit (hl->host, "ping", latency_average); + submit (hl->host, "ping_stddev", latency_stddev); diff --git a/utils/coreutils/Makefile b/utils/coreutils/Makefile new file mode 100644 index 0000000..73b1a85 --- /dev/null +++ b/utils/coreutils/Makefile @@ -0,0 +1,115 @@ +# +# 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:=coreutils +PKG_VERSION:=8.23 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@GNU/coreutils +PKG_MD5SUM:=abed135279f87ad6762ce57ff6d89c41 +PKG_BUILD_DEPENDS:=libpthread +PKG_MAINTAINER:=Jo-Philipp Wich + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +COREUTILS_APPLETS := \ + base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit \ + cut date dd dir dircolors dirname du echo env expand expr factor \ + false fmt fold groups head hostid id install join kill link ln logname \ + ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc od paste \ + pathchk pinky pr printenv printf ptx pwd readlink realpath rm rmdir \ + runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred \ + shuf sleep sort split stat stdbuf stty sum sync tac tail tee test \ + timeout touch tr true truncate tsort tty uname unexpand uniq unlink \ + uptime users vdir wc who whoami yes + +DEPENDS_sort = +libpthread +DEPENDS_timeout = +librt +DEPENDS_expr = +libgmp +DEPENDS_factor = +libgmp +DEPENDS_cp = +libacl +DEPENDS_dir = +libacl +DEPENDS_install = +libacl +DEPENDS_ls = +libacl +DEPENDS_mv = +libacl +DEPENDS_vdir = +libacl + +define Package/coreutils/Default + SECTION:=utils + CATEGORY:=Utilities + TITLE:=The GNU core utilities + URL:=http://www.gnu.org/software/coreutils/ +endef + +define Package/coreutils + $(call Package/coreutils/Default) + TITLE:=The GNU core utilities + MENU:=1 +endef + +define Package/coreutils/description + Full versions of standard GNU utilities. If an equivalent Busybox applet is + available, you should consider compiling that instead as Busybox applets are + usually smaller, at the expense of reduced functionality. +endef + +define GenPlugin + define Package/$(1) + $(call Package/coreutils/Default) + DEPENDS:=coreutils $(DEPENDS_$(2)) + TITLE:=Utility $(2) from the GNU core utilities + endef + + define Package/$(1)/description + Full version of standard GNU $(2) utility. + endef +endef + +$(foreach a,$(COREUTILS_APPLETS),$(eval $(call GenPlugin,coreutils-$(a),$(a)))) + +CONFIGURE_VARS += \ + gl_cv_func_mbrtowc_incomplete_state=yes \ + gl_cv_func_mbrtowc_retval=yes \ + gl_cv_func_wcrtomb_retval=yes + +ifneq ($(CONFIG_USE_UCLIBC),) + CONFIGURE_VARS += \ + ac_cv_type_pthread_spinlock_t=$(if $(filter 0.9.30% 0.9.2% 0.9.31%,$(call qstrip,$(CONFIG_UCLIBC_VERSION))),no,yes) +endif + +CONFIGURE_ARGS += \ + --disable-xattr \ + --enable-install-program=su + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + SHELL="/bin/bash" \ + all install +endef + +define Package/coreutils/install + true +endef + +define BuildPlugin + define Package/$(1)/install + $(INSTALL_DIR) $$(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $$(1)/usr/bin/ + endef + + $$(eval $$(call BuildPackage,$(1))) +endef + +$(eval $(call BuildPackage,coreutils)) + +$(foreach a,$(COREUTILS_APPLETS),$(eval $(call BuildPlugin,coreutils-$(a),$(a)))) diff --git a/utils/coreutils/patches/001-no_docs_man_tests.patch b/utils/coreutils/patches/001-no_docs_man_tests.patch new file mode 100644 index 0000000..60f2df2 --- /dev/null +++ b/utils/coreutils/patches/001-no_docs_man_tests.patch @@ -0,0 +1,89 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -17,7 +17,7 @@ + + ALL_RECURSIVE_TARGETS = + +-SUBDIRS = po . gnulib-tests ++SUBDIRS = po + + changelog_etc = \ + ChangeLog-2005 \ +@@ -213,6 +213,4 @@ AM_CPPFLAGS = -Ilib -I$(top_srcdir)/lib + + include $(top_srcdir)/lib/local.mk + include $(top_srcdir)/src/local.mk +-include $(top_srcdir)/doc/local.mk +-include $(top_srcdir)/man/local.mk +-include $(top_srcdir)/tests/local.mk ++ +--- a/Makefile.in ++++ b/Makefile.in +@@ -159,8 +159,7 @@ build_triplet = @build@ + host_triplet = @host@ + DIST_COMMON = $(top_srcdir)/lib/local.mk $(srcdir)/lib/gnulib.mk \ + $(top_srcdir)/src/local.mk $(srcdir)/src/cu-progs.mk \ +- $(top_srcdir)/src/single-binary.mk $(top_srcdir)/doc/local.mk \ +- $(top_srcdir)/man/local.mk $(top_srcdir)/tests/local.mk \ ++ $(top_srcdir)/src/single-binary.mk \ + INSTALL NEWS README AUTHORS ChangeLog $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(top_srcdir)/lib/config.hin ABOUT-NLS \ +@@ -2276,11 +2275,7 @@ RECURSIVE_TARGETS = all-recursive check- + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +-am__can_run_installinfo = \ +- case $$AM_UPDATE_INFO_DIR in \ +- n|no|NO) false;; \ +- *) (install-info --version) >/dev/null 2>&1;; \ +- esac ++am__can_run_installinfo = false + am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; + am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ +@@ -2606,7 +2601,7 @@ EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ + EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ + ERRNO_H = @ERRNO_H@ + EXEEXT = @EXEEXT@ +-EXTRA_MANS = @EXTRA_MANS@ ++EXTRA_MANS = + FLOAT_H = @FLOAT_H@ + FNMATCH_H = @FNMATCH_H@ + GETADDRINFO_LIB = @GETADDRINFO_LIB@ +@@ -3820,7 +3815,7 @@ libexecdir = @libexecdir@ + lispdir = @lispdir@ + localedir = @localedir@ + localstatedir = @localstatedir@ +-man1_MANS = @man1_MANS@ ++man1_MANS = + mandir = @mandir@ + mkdir_p = @mkdir_p@ + oldincludedir = @oldincludedir@ +@@ -3843,7 +3838,7 @@ top_build_prefix = @top_build_prefix@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + ALL_RECURSIVE_TARGETS = distcheck-hook check-root +-SUBDIRS = po . gnulib-tests ++SUBDIRS = po + changelog_etc = \ + ChangeLog-2005 \ + ChangeLog-2006 \ +@@ -5767,7 +5762,7 @@ all: $(BUILT_SOURCES) + .SUFFIXES: .1 .c .dvi .log .o .obj .pl .pl$(EXEEXT) .ps .sed .sh .sh$(EXEEXT) .sin .trs .x .xpl .xpl$(EXEEXT) .y + am--refresh: Makefile + @: +-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/lib/local.mk $(srcdir)/lib/gnulib.mk $(top_srcdir)/src/local.mk $(srcdir)/src/cu-progs.mk $(top_srcdir)/src/single-binary.mk $(top_srcdir)/doc/local.mk $(top_srcdir)/man/local.mk $(top_srcdir)/tests/local.mk $(am__configure_deps) ++$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/lib/local.mk $(srcdir)/lib/gnulib.mk $(top_srcdir)/src/local.mk $(srcdir)/src/cu-progs.mk $(top_srcdir)/src/single-binary.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ +@@ -5790,7 +5785,7 @@ Makefile: $(srcdir)/Makefile.in $(top_bu + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; +-$(top_srcdir)/lib/local.mk $(srcdir)/lib/gnulib.mk $(top_srcdir)/src/local.mk $(srcdir)/src/cu-progs.mk $(top_srcdir)/src/single-binary.mk $(top_srcdir)/doc/local.mk $(top_srcdir)/man/local.mk $(top_srcdir)/tests/local.mk: ++$(top_srcdir)/lib/local.mk $(srcdir)/lib/gnulib.mk $(top_srcdir)/src/local.mk $(srcdir)/src/cu-progs.mk $(top_srcdir)/src/single-binary.mk: + + $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck diff --git a/utils/coreutils/patches/002-fix_compile_with_uclibc.patch b/utils/coreutils/patches/002-fix_compile_with_uclibc.patch new file mode 100644 index 0000000..94187e4 --- /dev/null +++ b/utils/coreutils/patches/002-fix_compile_with_uclibc.patch @@ -0,0 +1,12 @@ +--- a/lib/pthread.in.h ++++ b/lib/pthread.in.h +@@ -252,6 +252,9 @@ pthread_mutex_unlock (pthread_mutex_t *m + + /* Approximate spinlocks with mutexes. */ + ++#ifdef __UCLIBC__ ++#define pthread_spinlock_t original_pthread_spinlock_t ++#endif + typedef pthread_mutex_t pthread_spinlock_t; + + _GL_PTHREAD_INLINE int diff --git a/utils/crelay/Makefile b/utils/crelay/Makefile new file mode 100644 index 0000000..5e14052 --- /dev/null +++ b/utils/crelay/Makefile @@ -0,0 +1,74 @@ +# +# Copyright (C) 2015-2016 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:=crelay +PKG_VERSION:=0.10.1 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/ondrej1024/crelay +PKG_SOURCE_VERSION:=V$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_MAINTAINER:=Ted Hess +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/crelay + SECTION:=utils + CATEGORY:=Utilities + TITLE:=USB relay remote control daemon + URL:=http://github.com/ondrej1024/crelay + DEPENDS:=+libftdi1 +hidapi +libusb-1.0 +endef + +define Package/crelay/description + crelay is used to control different relay cards in a unified manner. It provides + several interfaces for controlling the relays locally or remotely by a web browser + or a smartphone. The card which is detected first will be used. A WebUI control is + available on port 8000 (default) + . + Currently supported relay cards: + - Conrad USB 4-channel relay card + - Sainsmart USB 4/8-channel relay board + - Sainsmart USB 16-channel relay control module + - Generic GPIO relays + - HID API compatible relay card +endef + +define Build/Configure +endef + +TARGET_CFLAGS+= \ + -D_GNU_SOURCE \ + -I$(STAGING_DIR)/usr/include/libftdi1 \ + -I$(STAGING_DIR)/usr/include/hidapi + +TARGET_LDFLAGS+= $(if $(ICONV_FULL),-liconv) + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR)/src \ + CC="$(TARGET_CC)" \ + CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" +endef + +define Package/crelay/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/crelay $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/crelay.init $(1)/etc/init.d/crelay + $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/crelay.conf $(1)/etc +endef + +$(eval $(call BuildPackage,crelay)) diff --git a/utils/crelay/files/crelay.init b/utils/crelay/files/crelay.init new file mode 100644 index 0000000..b7c5123 --- /dev/null +++ b/utils/crelay/files/crelay.init @@ -0,0 +1,24 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2016 OpenWrt.org + +NAME=crelay +START=93 + +PROG=/usr/bin/${NAME} + +USE_PROCD=1 + +# Custom relay labels (for Web GUI) are defined in /etc/crelay.conf + +start_service() { + procd_open_instance + + # restart if it croaks + procd_set_param respawn + + procd_set_param command "$PROG" + # daemon mode in foreground - starts HTTP server + procd_append_param command -d + + procd_close_instance +} diff --git a/utils/crelay/patches/010-link_with_ftdi1.patch b/utils/crelay/patches/010-link_with_ftdi1.patch new file mode 100644 index 0000000..26b4c97 --- /dev/null +++ b/utils/crelay/patches/010-link_with_ftdi1.patch @@ -0,0 +1,11 @@ +--- a/src/Makefile ++++ b/src/Makefile +@@ -44,7 +44,7 @@ OPTS += -DDRV_CONRAD + endif + ifeq ($(DRV_SAINSMART), y) + SRC += relay_drv_sainsmart.c +-LIBS += -lftdi ++LIBS += -lftdi1 + OPTS += -DDRV_SAINSMART + endif + ifeq ($(DRV_SAINSMART16), y) diff --git a/utils/cryptodev-linux/Makefile b/utils/cryptodev-linux/Makefile new file mode 100644 index 0000000..4f187c8 --- /dev/null +++ b/utils/cryptodev-linux/Makefile @@ -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. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=cryptodev-linux +PKG_VERSION:=1.8 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://download.gna.org/cryptodev-linux/ +PKG_MD5SUM:=02644cc4cd02301e0b503a332eb2f0b5 + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +CRYPTODEV_AUTOLOAD:= \ + cryptodev + +define KernelPackage/cryptodev + SUBMENU:=Cryptographic API modules + DEFAULT:=m if ALL + TITLE:=Driver for cryptographic acceleration + URL:=http://cryptodev-linux.org/ + MAINTAINER:=Nikos Mavrogiannopoulos + VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) + DEPENDS:=+kmod-crypto-authenc +kmod-crypto-hash + FILES:= \ + $(PKG_BUILD_DIR)/cryptodev.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,50,$(CRYPTODEV_AUTOLOAD)) +endef + +define KernelPackage/cryptodev/description + This is a driver for that allows to use the Linux kernel supported + hardware ciphers by user-space applications. +endef + +CRYPTODEV_MAKEOPTS= -C $(PKG_BUILD_DIR) \ + PATH="$(TARGET_PATH)" \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + TOOLPREFIX="$(KERNEL_CROSS)" \ + TOOLPATH="$(KERNEL_CROSS)" \ + KERNEL_DIR="$(LINUX_DIR)" \ + LDOPTS=" " \ + DOMULTI=1 + +define Build/Compile/cryptodev + $(MAKE) $(CRYPTODEV_MAKEOPTS) +endef + +define Build/Compile + $(call Build/Compile/cryptodev) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR)/usr/include/crypto + $(CP) $(PKG_BUILD_DIR)/crypto/cryptodev.h $(STAGING_DIR)/usr/include/crypto/ +endef + +define KernelPackage/cryptodev/install + $(INSTALL_DIR) $(1)/etc/modules.d + $(INSTALL_DATA) ./files/cryptodev.modules $(1)/etc/modules.d/80-cryptodev + $(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION) + $(INSTALL_DIR) $(1)/usr/sbin +endef + +$(eval $(call KernelPackage,cryptodev)) diff --git a/utils/cryptodev-linux/files/cryptodev.modules b/utils/cryptodev-linux/files/cryptodev.modules new file mode 100644 index 0000000..fb39fcd --- /dev/null +++ b/utils/cryptodev-linux/files/cryptodev.modules @@ -0,0 +1 @@ +cryptodev diff --git a/utils/cryptsetup/Makefile b/utils/cryptsetup/Makefile new file mode 100644 index 0000000..691103f --- /dev/null +++ b/utils/cryptsetup/Makefile @@ -0,0 +1,79 @@ +# +# 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:=cryptsetup +PKG_VERSION:=1.7.2 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-2.0+ LGPL-2.1+ +PKG_LICENSE_FILES:=COPYING COPYING.LGPL + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@KERNEL/linux/utils/cryptsetup/v1.7 +PKG_MD5SUM:=a11a140cea496961222170944db01fc1 +PKG_MAINTAINER:=Daniel Golle + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +TARGET_LDFLAGS+=-Wl,-rpath-link=$(STAGING_DIR)/usr/lib + +define Package/cryptsetup/Default + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Encryption + TITLE:=Cryptsetup + DEPENDS:=+libblkid +libuuid +libpopt +lvm2 +libdevmapper +@KERNEL_DIRECT_IO + URL:=http://code.google.com/p/cryptsetup/ +endef + +define Package/cryptsetup +$(call Package/cryptsetup/Default) + DEPENDS+=+libgcrypt + VARIANT:=gcrypt +endef + +define Package/cryptsetup-openssl +$(call Package/cryptsetup/Default) + TITLE+= (with openssl support) + DEPENDS+=+libopenssl + VARIANT:=openssl +endef + +define Package/cryptsetup/Default/description + Cryptsetup-luks +endef + +define Package/cryptsetup/description +$(call Package/cryptsetup/Default/description) +linked against libgcrypt +endef + + +define Package/cryptsetup-openssl/description +$(call Package/cryptsetup/Default/description) +linked against openssl +endef + +ifeq ($(BUILD_VARIANT),openssl) +CONFIGURE_ARGS+= \ + --with-crypto_backend=openssl +endif + +define Package/cryptsetup/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_BUILD_DIR)/src/.libs/cryptsetup $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/lib/.libs/libcryptsetup.so* $(1)/usr/lib +endef + +Package/cryptsetup-openssl/install = $(Package/cryptsetup/install) + +$(eval $(call BuildPackage,cryptsetup)) +$(eval $(call BuildPackage,cryptsetup-openssl)) diff --git a/utils/dbus/Makefile b/utils/dbus/Makefile new file mode 100644 index 0000000..16ed227 --- /dev/null +++ b/utils/dbus/Makefile @@ -0,0 +1,214 @@ +# +# Copyright (C) 2007-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +# Make sure to also update the dbus-x package +PKG_NAME:=dbus +PKG_VERSION:=1.10.4 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://dbus.freedesktop.org/releases/dbus/ +PKG_MD5SUM:=27b8e99ffad603b8acfa25201c6e3d5c +PKG_MAINTAINER:=Steven Barth +PKG_LICENSE:=AFL-2.1 + +PKG_BUILD_PARALLEL:=1 +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/package.mk + +TARGET_LDFLAGS+= \ + -Wl,-rpath-link=$(STAGING_DIR)/usr/lib \ + +define Package/dbus/Default + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Simple interprocess messaging system + URL:=http://dbus.freedesktop.org/ +endef + +define Package/dbus/Default/description + D-Bus is a message bus system, a simple way for applications to talk to one + another. In addition to interprocess communication, D-Bus helps coordinate + process lifecycle; it makes it simple and reliable to code a "single instance" + application or daemon, and to launch applications and daemons on demand when + their services are needed. +endef + +define Package/libdbus +$(call Package/dbus/Default) + CATEGORY:=Libraries + TITLE+= (library) + DEPENDS:= +libpthread +endef + +define Package/libdbus/Description +$(call Package/dbus/Default/description) + This package contains the D-Bus shared library. +endef + +define Package/dbus +$(call Package/dbus/Default) + TITLE+= (daemon) + DEPENDS:= +libexpat +libdbus +endef + +define Package/dbus/Description +$(call Package/dbus/Default/description) + This package contains the D-Bus daemon. +endef + +define Package/dbus-utils +$(call Package/dbus/Default) + TITLE+= (utilities) + DEPENDS:= dbus +endef + +define Package/dbus-utils/Description +$(call Package/dbus/Default/description) + This package contains D-Bus utilities. +endef + + +define Build/Prepare + $(Build/Prepare/Default) + $(SED) 's/-Wl,--gc-sections/--gc-sections/' $(PKG_BUILD_DIR)/configure +endef + +CONFIGURE_ARGS += \ + --enable-shared \ + --enable-static \ + --disable-abstract-sockets \ + --disable-ansi \ + --disable-asserts \ + --disable-console-owner-file \ + --disable-doxygen-docs \ + --disable-compiler_coverage \ + --disable-selinux \ + --disable-tests \ + --disable-verbose-mode \ + --disable-xml-docs \ + --with-xml="expat" \ + --with-dbus-user=root \ + --with-dbus-daemondir="/usr/sbin" \ + --with-system-socket="/var/run/dbus/system_bus_socket" \ + --with-system-pid-file="/var/run/dbus.pid" \ + --without-x \ + --libexecdir=/usr/lib/dbus-1 + +CONFIGURE_VARS+= \ + ac_cv_have_abstract_sockets="yes" \ + ac_cv_lib_expat_XML_ParserCreate_MM="yes" \ + +HOST_CONFIGURE_ARGS+= \ + --enable-shared \ + --enable-static \ + --disable-abstract-sockets \ + --disable-ansi \ + --disable-asserts \ + --disable-console-owner-file \ + --disable-docygen-docs \ + --disable-compiler_coverage \ + --disable-selinux \ + --disable-tests \ + --disable-verbose-mode \ + --disable-xml-docs \ + --with-dbus-user=root \ + --with-dbus-daemondir="$(STAGIND_DIR)/host/bin" \ + --with-system-socket="$(STAGING_DIR)/host/var/run/dbus/system_bus_socket" \ + --with-system-pid-file="$(STAGING_DIR)/host/var/run/dbus.pid" \ + --without-x \ + --libexecdir="$(STAGING_DIR)/host/lib/dbus-1" + +HOST_CONFIGURE_VARS+= \ + ac_cv_have_abstract_sockets="yes" \ + ac_cv_lib_expat_XML_ParserCreate_MM="yes" \ + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) \ + $(PKG_INSTALL_DIR)/usr/include/dbus-1.0 \ + $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib/dbus-1.0/include/dbus/ + $(INSTALL_DATA) \ + $(PKG_INSTALL_DIR)/usr/lib/dbus-1.0/include/dbus/*.h \ + $(1)/usr/lib/dbus-1.0/include/dbus/ + + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_DATA) \ + $(PKG_INSTALL_DIR)/usr/lib/libdbus-1.{so*,la,a} \ + $(1)/usr/lib/ + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/dbus-1.0 \ + $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(INSTALL_DATA) \ + $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/dbus-1.pc \ + $(1)/usr/lib/pkgconfig/ +endef + +define Package/dbus/conffiles +/etc/dbus-1/session.conf +/etc/dbus-1/system.conf +endef + +define Package/libdbus/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/libdbus-1.so.* \ + $(1)/usr/lib/ +endef + +define Package/dbus/install + $(INSTALL_DIR) $(1)/usr/share + $(CP) \ + $(PKG_INSTALL_DIR)/usr/share/dbus-1 \ + $(1)/usr/share/ + + $(INSTALL_DIR) $(1)/usr/lib/dbus-1 + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/lib/dbus-1/dbus-daemon-launch-helper \ + $(1)/usr/lib/dbus-1/ + + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/sbin/dbus-daemon \ + $(1)/usr/sbin/ + + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/dbus-uuidgen \ + $(1)/usr/bin/ + + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/dbus-launch \ + $(1)/usr/bin/dbus-launch.real + $(INSTALL_BIN) \ + ./files/dbus-launch \ + $(1)/usr/bin/ + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) \ + ./files/dbus.init \ + $(1)/etc/init.d/dbus +endef + +define Package/dbus-utils/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/dbus-{send,monitor,cleanup-sockets} \ + $(1)/usr/bin/ +endef + +$(eval $(call HostBuild)) +$(eval $(call BuildPackage,libdbus)) +$(eval $(call BuildPackage,dbus)) +$(eval $(call BuildPackage,dbus-utils)) diff --git a/utils/dbus/files/dbus-launch b/utils/dbus/files/dbus-launch new file mode 100644 index 0000000..7c3f922 --- /dev/null +++ b/utils/dbus/files/dbus-launch @@ -0,0 +1,12 @@ +#!/bin/sh +# +# Simple wrapper script which allows us to build dbus without general x support +# If an application needs x support in dbus-launch it has to depend on the +# dbus-launch-x package. The script is used to prefer dbus-launch with x over +# the dbus-lauch without x. + +if [ -f /usr/bin/dbus-launch-x ]; then + exec /usr/bin/dbus-launch-x $@ +else + exec /usr/bin/dbus-launch.real $@ +fi diff --git a/utils/dbus/files/dbus.init b/utils/dbus/files/dbus.init new file mode 100644 index 0000000..4294083 --- /dev/null +++ b/utils/dbus/files/dbus.init @@ -0,0 +1,17 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2007-2011 OpenWrt.org + +START=60 + +SERVICE_PID_FILE=/var/run/dbus.pid + +start() { + mkdir -m 0755 -p /var/lib/dbus + mkdir -m 0755 -p /var/run/dbus + [ -x /usr/bin/dbus-uuidgen ] && /usr/bin/dbus-uuidgen --ensure + service_start /usr/sbin/dbus-daemon --system +} + +stop() { + service_stop /usr/sbin/dbus-daemon && rm $SERVICE_PID_FILE +} diff --git a/utils/dbus/patches/100-fix-poll-select.patch b/utils/dbus/patches/100-fix-poll-select.patch new file mode 100644 index 0000000..64f6525 --- /dev/null +++ b/utils/dbus/patches/100-fix-poll-select.patch @@ -0,0 +1,13 @@ +Index: dbus-1.9.4/tools/tool-common.c +=================================================================== +--- dbus-1.9.4.orig/tools/tool-common.c ++++ dbus-1.9.4/tools/tool-common.c +@@ -29,6 +29,8 @@ + #include + #include + ++#include ++ + #ifdef DBUS_WIN + #include + #endif diff --git a/utils/dfu-programmer/Makefile b/utils/dfu-programmer/Makefile new file mode 100644 index 0000000..777f92d --- /dev/null +++ b/utils/dfu-programmer/Makefile @@ -0,0 +1,46 @@ +# +# Copyright (C) 2015 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:=dfu-programmer +PKG_VERSION:=0.7.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/$(PKG_VERSION)/ +PKG_MD5SUM:=98641b0a7cf1cc8c8be3584d5552f6d8 + +PKG_MAINTAINER:=Stefan Hellermann +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/dfu-programmer + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Microcontroller programming + TITLE:=USB programmer for Atmel microcontrollers + URL:=http://dfu-programmer.github.io/ + DEPENDS:=+libusb-1.0 +endef + +define Package/dfu-programmer/description + dfu-programmer is a Device Firmware Update (DFU) based USB programmer + for Atmel chips with a USB bootloader. +endef + +define Package/dfu-programmer/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,dfu-programmer)) diff --git a/utils/dmidecode/Makefile b/utils/dmidecode/Makefile new file mode 100644 index 0000000..cae94d0 --- /dev/null +++ b/utils/dmidecode/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 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:=dmidecode +PKG_VERSION:=3.0 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@SAVANNAH/$(PKG_NAME) +PKG_MD5SUM:=7ec35bb193729c1d593a1460b59d82d24b89102ab23fd0416e6cf4325d077e45 +PKG_MAINTAINER:=Álvaro Fernández Rojas + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=LICENSE + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/dmidecode + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=@(TARGET_x86||TARGET_x86_64) + TITLE:=Displays BIOS informations. + URL:=http://www.nongnu.org/dmidecode/ +endef + +define Package/dmidecode/description + Dmidecode reports information about your system's hardware + as described in your system BIOS according to the SMBIOS/DMI + standard. +endef + +MAKE_FLAGS += \ + prefix="/usr" + +define Package/dmidecode/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/$(PKG_NAME) $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,dmidecode)) diff --git a/utils/dosfstools/Makefile b/utils/dosfstools/Makefile new file mode 100644 index 0000000..82b8a68 --- /dev/null +++ b/utils/dosfstools/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2006-2016 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:=dosfstools +PKG_VERSION:=4.0 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=https://github.com/dosfstools/dosfstools/releases/download/v$(PKG_VERSION)/ \ + http://fossies.org/linux/misc +PKG_MD5SUM:=9037738953559d1efe04fc5408b6846216cc0138f7f9d32de80b6ec3c35e7daf +PKG_MAINTAINER:=Álvaro Fernández Rojas + +PKG_LICENSE:=GPL-3.0+ +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +CONFIGURE_ARGS += \ + --without-udev + +define Package/dosfstools + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Filesystem + DEPENDS:=$(ICONV_DEPENDS) + TITLE:=Utilities for making and checking MS-DOS FAT filesystems + URL:=https://github.com/dosfstools +endef + +define Package/dosfstools/description + The dosfstools package includes the mkfs.fat and fsck.fat utilities, which respectively make and check MS-DOS FAT filesystems. +endef + +define Package/dosfstools/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/fatlabel $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/fsck.fat $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/mkfs.fat $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,dosfstools)) diff --git a/utils/dosfstools/patches/0001-mkfs-Default-to-64-32-heads-sectors-for-targets-smal.patch b/utils/dosfstools/patches/0001-mkfs-Default-to-64-32-heads-sectors-for-targets-smal.patch new file mode 100644 index 0000000..76672e0 --- /dev/null +++ b/utils/dosfstools/patches/0001-mkfs-Default-to-64-32-heads-sectors-for-targets-smal.patch @@ -0,0 +1,34 @@ +From 1e76e5778a1885452939a79d9145b80634a5b023 Mon Sep 17 00:00:00 2001 +From: Andreas Bombe +Date: Wed, 11 May 2016 03:44:58 +0200 +Subject: [PATCH] mkfs: Default to 64/32 heads/sectors for targets smaller than + 512 MB + +This may put defaults in certain use cases a little bit more in line +with the old defaults in versions up to 3.0.28. It has mostly aesthetic +value in most cases. + +Signed-off-by: Andreas Bombe +--- + src/mkfs.fat.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/src/mkfs.fat.c ++++ b/src/mkfs.fat.c +@@ -519,6 +519,16 @@ static void establish_params(struct devi + unsigned int cluster_size = 4; /* starting point for FAT12 and FAT16 */ + int def_root_dir_entries = 512; + ++ if (info->size < 512 * 1024 * 1024) { ++ /* ++ * These values are more or less meaningless, but we can at least ++ * use less extreme values for smaller filesystems where the large ++ * dummy values signifying LBA only access are not needed. ++ */ ++ sec_per_track = 32; ++ heads = 64; ++ } ++ + if (info->type != TYPE_FIXED) { + /* enter default parameters for floppy disks if the size matches */ + switch (info->size / 1024) { diff --git a/utils/dosfstools/patches/0002-Switch-to-AC_CHECK_LIB-for-iconv-library-linking.patch b/utils/dosfstools/patches/0002-Switch-to-AC_CHECK_LIB-for-iconv-library-linking.patch new file mode 100644 index 0000000..72a932d --- /dev/null +++ b/utils/dosfstools/patches/0002-Switch-to-AC_CHECK_LIB-for-iconv-library-linking.patch @@ -0,0 +1,27 @@ +From 1c6c135ee15e449c1bf2e76d5307f83a3a1d7425 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Tue, 11 Oct 2016 12:07:48 +0200 +Subject: [PATCH] Switch to AC_CHECK_LIB for iconv library linking. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +AC_SEARCH_LIB doesn't work properly for openwrt/lede when building dosfstools +as a package. + +Signed-off-by: Álvaro Fernández Rojas +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/configure.ac ++++ b/configure.ac +@@ -59,7 +59,7 @@ if test "x$with_udev" != "xno"; then + [true]) + fi + +-AC_SEARCH_LIBS(iconv_open, iconv) ++AC_CHECK_LIB(iconv, iconv_open) + + AC_CONFIG_FILES([Makefile src/Makefile src/version.h + manpages/Makefile manpages/mkfs.fat.8 diff --git a/utils/dump1090/Makefile b/utils/dump1090/Makefile new file mode 100644 index 0000000..25dfa3d --- /dev/null +++ b/utils/dump1090/Makefile @@ -0,0 +1,79 @@ +# +# Copyright (C) 2013-2016 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:=dump1090 +PKG_VERSION:=2016-10-02 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/mutability/dump1090.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=344415b91f018e7fd3719fe639888505c54792ad +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz +PKG_MAINTAINER:=Álvaro Fernández Rojas + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING LICENSE + +PKG_BUILD_DEPENDS:=librtlsdr + +include $(INCLUDE_DIR)/package.mk + +define Package/dump1090/Default + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Mode S decoder for the Realtek RTL2832U + URL:=https://github.com/mutability/dump1090 + DEPENDS:=+libpthread +endef + +define Package/dump1090 + $(call Package/dump1090/Default) + TITLE+= (dump1090) + DEPENDS+= +librtlsdr +uhttpd +endef + +define Package/view1090 + $(call Package/dump1090/Default) + TITLE+= (view1090) +endef + +define Package/dump1090/description + Dump1090 is a Mode S decoder specifically designed for RTLSDR devices. +endef + +define Package/view1090/description + View1090 is a Mode S messages viewer for dump1090 devices. +endef + +MAKE_FLAGS += \ + CFLAGS="$(TARGET_CFLAGS)" \ + UNAME="Linux" + +define Package/dump1090/install + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) files/dump1090.init $(1)/etc/init.d/dump1090 + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) files/dump1090.config $(1)/etc/config/dump1090 + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_DATA) files/dump1090.default $(1)/etc/uci-defaults/00_uhttpd_dump1090 + $(INSTALL_DIR) $(1)/usr/share/dump1090 + $(CP) $(PKG_BUILD_DIR)/public_html/* $(1)/usr/share/dump1090 + $(LN) /var/run/dump1090 $(1)/usr/share/dump1090/data + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/dump1090 $(1)/usr/bin +endef + +define Package/view1090/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/view1090 $(1)/usr/bin +endef + +$(eval $(call BuildPackage,dump1090)) +$(eval $(call BuildPackage,view1090)) diff --git a/utils/dump1090/files/dump1090.config b/utils/dump1090/files/dump1090.config new file mode 100644 index 0000000..2b9e96a --- /dev/null +++ b/utils/dump1090/files/dump1090.config @@ -0,0 +1,50 @@ +config dump1090 main + option disabled '1' + option respawn '1' + option device_index '' + option gain '' + option enable_agc '0' + option freq '' + option ifile '' + option iformat '' + option throttle '0' + option raw '0' + option net '1' + option modeac '0' + option net_only '0' + option net_bind_address '' + option net_ri_port '' + option net_ro_port '' + option net_sbs_port '' + option net_bi_port '' + option net_bo_port '' + option net_ro_size '' + option net_ro_interval '' + option net_heartbeat '' + option net_buffer '' + option net_verbatim '0' + option forward_mlat '0' + option lat '' + option lon '' + option max_range '' + option fix '0' + option no_fix '0' + option no_crc_check '0' + option phase_enhance '0' + option mlat '0' + option stats '0' + option stats_range '0' + option stats_every '' + option onlyaddr '0' + option metric '0' + option gnss '0' + option snip '' + option debug '' + option ppm '' + option html_dir '/usr/share/dump1090' + option write_json '/var/run/dump1090' + option write_json_every '1' + option json_location_accuracy '' + option oversample '0' + option dcfilter '0' + option measure_noise '0' diff --git a/utils/dump1090/files/dump1090.default b/utils/dump1090/files/dump1090.default new file mode 100644 index 0000000..8df01a6 --- /dev/null +++ b/utils/dump1090/files/dump1090.default @@ -0,0 +1,16 @@ +#!/bin/sh +uci batch <<-EOF + set uhttpd.xupnpd=uhttpd + set uhttpd.xupnpd.listen_http='0.0.0.0:8080 [::]:8080' + set uhttpd.xupnpd.home=/usr/share/dump1090 + set uhttpd.xupnpd.rfc1918_filter=1 + set uhttpd.xupnpd.max_requests=3 + set uhttpd.xupnpd.max_connections=100 + set uhttpd.xupnpd.script_timeout=60 + set uhttpd.xupnpd.network_timeout=30 + set uhttpd.xupnpd.http_keepalive=20 + set uhttpd.xupnpd.tcp_keepalive=1 + set uhttpd.xupnpd.index_page='index.html index.htm gmap.html' + commit uhttpd +EOF +exit 0 diff --git a/utils/dump1090/files/dump1090.init b/utils/dump1090/files/dump1090.init new file mode 100644 index 0000000..d57a2e1 --- /dev/null +++ b/utils/dump1090/files/dump1090.init @@ -0,0 +1,105 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014-2016 OpenWrt.org + +START=90 +STOP=10 +USE_PROCD=1 + +append_arg() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}" +} + +append_bool() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get_bool val "$cfg" "$var" "$def" + [ "$val" = 1 ] && procd_append_param command "$opt" +} + +start_instance() { + local cfg="$1" + local aux + + config_get_bool aux "$cfg" 'disabled' '0' + [ "$aux" = 1 ] && return 1 + + procd_open_instance + + procd_set_param command /usr/bin/dump1090 + procd_append_param command "--quiet" + + append_arg "$cfg" device_index "--device-index" + append_arg "$cfg" gain "--gain" + append_bool "$cfg" enable_agc "--enable-agc" + append_arg "$cfg" freq "--freq" + append_arg "$cfg" ifile "--ifile" + append_arg "$cfg" iformat "--iformat" + append_bool "$cfg" throttle "--throttle" + append_bool "$cfg" raw "--raw" + append_bool "$cfg" net "--net" + append_bool "$cfg" modeac "--modeac" + append_bool "$cfg" net_only "--net-only" + append_arg "$cfg" net_bind_address "--net-bind-address" + append_arg "$cfg" net_ri_port "--net-ri-port" + append_arg "$cfg" net_ro_port "--net-ro-port" + append_arg "$cfg" net_sbs_port "--net-sbs-port" + append_arg "$cfg" net_bi_port "--net-bi-port" + append_arg "$cfg" net_bo_port "--net-bo-port" + append_arg "$cfg" net_ro_size "--net-ro-size" + append_arg "$cfg" net_ro_interval "--net-ro-interval" + append_arg "$cfg" net_heartbeat "--net-heartbeat" + append_arg "$cfg" net_buffer "--net-buffer" + append_bool "$cfg" net_verbatim "--net-verbatim" + append_bool "$cfg" forward_mlat "--forward-mlat" + append_arg "$cfg" lat "--lat" + append_arg "$cfg" lon "--lon" + append_arg "$cfg" max_range "--max-range" + append_bool "$cfg" fix "--fix" + append_bool "$cfg" no_fix "--no-fix" + append_bool "$cfg" no_crc_check "--no-crc-check" + append_bool "$cfg" phase_enhance "--phase-enhance" + append_bool "$cfg" mlat "--mlat" + append_bool "$cfg" stats "--stats" + append_bool "$cfg" stats_range "--stats-range" + append_arg "$cfg" stats_every "--stats-every" + append_bool "$cfg" onlyaddr "--onlyaddr" + append_bool "$cfg" metric "--metric" + append_bool "$cfg" gnss "--gnss" + append_arg "$cfg" snip "--snip" + append_arg "$cfg" debug "--debug" + append_arg "$cfg" ppm "--ppm" + append_arg "$cfg" html_dir "--html-dir" + append_arg "$cfg" write_json "--write-json" + config_get aux "$cfg" "write_json" + [ -n "$aux" ] && mkdir -p $aux + append_arg "$cfg" write_json_every "--write-json-every" + append_arg "$cfg" json_location_accuracy "--json-location-accuracy" + append_bool "$cfg" oversample "--oversample" + append_bool "$cfg" dcfilter "--dcfilter" + append_bool "$cfg" measure_noise "--measure-noise" + + config_get_bool aux "$cfg" 'respawn' '0' + [ "$aux" = 1 ] && procd_set_param respawn + + procd_close_instance +} + +service_triggers() { + procd_add_reload_trigger "dump1090" +} + +start_service() { + config_load dump1090 + config_foreach start_instance dump1090 +} diff --git a/utils/dvtm/Makefile b/utils/dvtm/Makefile new file mode 100644 index 0000000..471b0e5 --- /dev/null +++ b/utils/dvtm/Makefile @@ -0,0 +1,42 @@ +# +# Copyright (C) 2016 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:=dvtm +PKG_VERSION:=0.15 +PKG_RELEASE:=1 + +PKG_SOURCE:=dvtm-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.brain-dump.org/projects/dvtm/ +PKG_MD5SUM:=887e162a3abe2ad8e86caefab20cdd63 +PKG_MAINTAINER:=Yunfan Jiang + +PKG_LICENSE:=MIT/X +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define Package/dvtm + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Terminal + DEPENDS:=+libncursesw + TITLE:=dynamic virtual terminal manager + URL:=http://www.brain-dump.org/projects/dvtm/ +endef + +define Package/dvtm/description + dvtm brings the concept of tiling window management, popularized by X11-window managers like dwm to the console. As a console window manager it tries to make it easy to work with multiple console based programs. +endef + +define Package/dvtm/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/dvtm $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,dvtm)) diff --git a/utils/eudev/Config.in b/utils/eudev/Config.in new file mode 100644 index 0000000..6cd3970 --- /dev/null +++ b/utils/eudev/Config.in @@ -0,0 +1,68 @@ +# udev package config + +menu "Configuration" + depends on PACKAGE_eudev + +config EUDEV_EXTRA_ata_id + bool "Install eudev ata_id callout" + default y + help + ata_id - udev callout to read product/serial number + from ATA drives + +config EUDEV_EXTRA_blkid + bool "Use blkid to identify block devices" + default y + help + blkid - make use of libblkid to identify block devices + +config EUDEV_EXTRA_cdrom_id + bool "Install eudev cdrom_id callout" + default y + help + cdrom_id - udev callout to determine the capabilities + of optical drives and media + +config EUDEV_EXTRA_collect + bool "Install eudev collect" + default n + help + Adds ID to the list governed by + +config EUDEV_EXTRA_input_id + bool "Install input_id callout" + default y + help + input_id - udev callout to classify input devices + +config EUDEV_EXTRA_kmod + bool "Use kmod for loading kernel modules" + default n + help + kmod - make use of kmod to load kernel modules on demand + +config EUDEV_EXTRA_mtd_probe + bool "Install mtd_probe callout" + default y + help + mtd_probe - udev callout to probe mtd devices + +config EUDEV_EXTRA_rule_generator + bool "Install (legacy) eudev rule_generator" + default n + help + +config EUDEV_EXTRA_scsi_id + bool "Install eudev scsi_id callout" + default y + help + scsi_id - retrieve and generate a unique SCSI identifier + +config EUDEV_EXTRA_v4l_id + bool "Install eudev v4l_id callout" + default y + help + v4l_id - udev callout to identify Video4Linux devices + + +endmenu diff --git a/utils/eudev/Makefile b/utils/eudev/Makefile new file mode 100644 index 0000000..9c42b74 --- /dev/null +++ b/utils/eudev/Makefile @@ -0,0 +1,144 @@ +# +# 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:=eudev +PKG_VERSION:=3.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://dev.gentoo.org/~blueness/eudev/ +PKG_MD5SUM:=7e42d9b9ed8162021665139520676367 +PKG_LICENSE:=GPL-2.0 + +include $(INCLUDE_DIR)/package.mk + +PKG_BUILD_DEPENDS:=gperf/host +PKG_FIXUP:=autoreconf +PKG_INSTALL=1 + +define Package/libudev + SECTION:=libs + CATEGORY:=Libraries + TITLE:=Dynamic device management subsystem + URL:=https://wiki.gentoo.org/wiki/Project:Eudev + MAINTAINER:=Daniel Golle +endef + +define Package/eudev + SECTION:=base + CATEGORY:=Base system + TITLE:=Dynamic device management subsystem + URL:=https://wiki.gentoo.org/wiki/Project:Eudev + MAINTAINER:=Daniel Golle + MENU:=1 + DEPENDS:=+EUDEV_EXTRA_blkid:libblkid +EUDEV_EXTRA_kmod:libkmod +librt +libudev + PROVIDES:=udev + CONFLICTS:=udev +endef + +define Package/eudev/description +udev allows Linux users to have a dynamic /dev directory and it +provides the ability to have persistent device names. +eudev is a fork of systemd-udev with the goal of obtaining better +compatibility with existing software such as OpenRC and Upstart, older +kernels, various toolchains and anything else required by users and +various distributions. +endef + +define Package/eudev/conffiles +/etc/udev/udev.conf +endef + +define Package/eudev/config + source "$(SOURCE)/Config.in" +endef + +CONFIGURE_ARGS += \ + --prefix=/usr --exec-prefix= --sysconfdir=/etc \ + --libexecdir=/lib/udev --sbindir=/sbin \ + --disable-hwdb --disable-introspection --disable-manpages \ + --disable-selinux \ + $(if $(CONFIG_EUDEV_EXTRA_blkid),--enable-blkid,--disable-blkid) \ + $(if $(CONFIG_EUDEV_EXTRA_kmod),--enable-kmod,--disable-kmod) + + +eudev-extra-lib-bin-$(CONFIG_EUDEV_EXTRA_ata_id) += ata_id + +eudev-extra-rules-$(CONFIG_EUDEV_EXTRA_blkid) += 60-persistent-storage.rules + +eudev-extra-lib-bin-$(CONFIG_EUDEV_EXTRA_cdrom_id) += cdrom_id +eudev-extra-rules-$(CONFIG_EUDEV_EXTRA_cdrom_id) += 60-cdrom_id.rules + +eudev-extra-lib-bin-$(CONFIG_EUDEV_EXTRA_collect) += collect + +eudev-extra-rules-$(CONFIG_EUDEV_EXTRA_input_id) += 60-persistent-input.rules + +eudev-extra-lib-bin-$(CONFIG_EUDEV_EXTRA_mtd_probe) += mtd_probe +eudev-extra-rules-$(CONFIG_EUDEV_EXTRA_mtd_probe) += 75-probe_mtd.rules + +eudev-extra-lib-bin-$(CONFIG_EUDEV_EXTRA_scsi_id) += scsi_id + +eudev-extra-lib-bin-$(CONFIG_EUDEV_EXTRA_v4l_id) += v4l_id +eudev-extra-rules-$(CONFIG_EUDEV_EXTRA_v4l_id) += 60-persistent-v4l.rules + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/libudev.h $(1)/usr/include + $(INSTALL_DIR) $(1)/usr/share/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/share/pkgconfig/udev.pc $(1)/usr/share/pkgconfig + $(INSTALL_DIR) $(1)/lib + $(CP) $(PKG_INSTALL_DIR)/lib/libudev.so* $(1)/lib + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/lib/pkgconfig/libudev.pc $(1)/usr/lib/pkgconfig +endef + +define Package/libudev/install + $(INSTALL_DIR) $(1)/lib + $(CP) $(PKG_INSTALL_DIR)/lib/libudev.so* $(1)/lib +endef + +define Package/eudev/install + $(INSTALL_DIR) $(1)/etc/udev/rules.d + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/udev/udev.conf $(1)/etc/udev + + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/udevadm \ + $(PKG_INSTALL_DIR)/sbin/udevd \ + $(1)/sbin + + $(INSTALL_DIR) $(1)/lib/udev/rules.d + $(INSTALL_DATA) \ + $(addprefix $(PKG_INSTALL_DIR)/lib/udev/rules.d/, \ + $(eudev-extra-rules-y)) \ + $(addprefix $(PKG_INSTALL_DIR)/lib/udev/rules.d/, \ + 50-udev-default.rules \ + 60-block.rules \ + 60-drm.rules \ + 60-evdev.rules \ + 60-persistent-alsa.rules \ + 60-persistent-storage-tape.rules \ + 60-serial.rules \ + 64-btrfs.rules \ + 70-mouse.rules \ + 75-net-description.rules \ + 78-sound-card.rules \ + 80-net-name-slot.rules) \ + $(1)/lib/udev/rules.d + +ifneq ($(eudev-extra-lib-bin-y),) + $(INSTALL_BIN) \ + $(addprefix $(PKG_INSTALL_DIR)/lib/udev/, \ + $(eudev-extra-lib-bin-y)) \ + $(1)/lib/udev/ +endif +endef + +$(eval $(call BuildPackage,eudev)) +$(eval $(call BuildPackage,libudev)) diff --git a/utils/eudev/patches/0001-mtd_probe-uses-stdint_h.patch b/utils/eudev/patches/0001-mtd_probe-uses-stdint_h.patch new file mode 100644 index 0000000..2ae5634 --- /dev/null +++ b/utils/eudev/patches/0001-mtd_probe-uses-stdint_h.patch @@ -0,0 +1,12 @@ +Index: eudev-3.1.5/src/mtd_probe/mtd_probe.h +=================================================================== +--- eudev-3.1.5.orig/src/mtd_probe/mtd_probe.h ++++ eudev-3.1.5/src/mtd_probe/mtd_probe.h +@@ -18,6 +18,7 @@ + */ + + #include ++#include + + #include "macro.h" + diff --git a/utils/evtest/Makefile b/utils/evtest/Makefile new file mode 100644 index 0000000..e85deeb --- /dev/null +++ b/utils/evtest/Makefile @@ -0,0 +1,45 @@ +# +# Copyright (C) 2015 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:=evtest +PKG_REV:=ab140a2dab1547f7deb5233be6d94a388cf08b26 +PKG_VERSION:=1.33 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=git://anongit.freedesktop.org/evtest +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=$(PKG_REV) + +PKG_MAINTAINER:=Pushpal Sidhu +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/autotools.mk + +define Package/evtest + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Event Test Program +endef + +define Package/evtest/description + Utility to test event driven devices such as keyboards and mice +endef + +define Package/evtest/install + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/evtest $(1)/sbin/ +endef + +$(eval $(call BuildPackage,evtest)) diff --git a/utils/f2fs-tools/Makefile b/utils/f2fs-tools/Makefile new file mode 100644 index 0000000..6a39bc7 --- /dev/null +++ b/utils/f2fs-tools/Makefile @@ -0,0 +1,90 @@ +# +# 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:=f2fs-tools +PKG_VERSION:=1.7.0 +PKG_RELEASE:=1 + +PKG_LICENSE:=GPLv2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs-tools.git/snapshot/ +PKG_MD5SUM:=9db22274264f0c88dbee012f257917b1 + +PKG_FIXUP:=autoreconf +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +PKG_MAINTAINER:=Luka Perkov + +include $(INCLUDE_DIR)/package.mk + +define Package/f2fs-tools/Default + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Filesystem + DEPENDS:=+libf2fs + URL:=http://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs-tools.git +endef + +define Package/mkf2fs + $(Package/f2fs-tools/Default) + TITLE:=Utility for creating a Flash-Friendly File System (F2FS) +endef + +define Package/f2fsck + $(Package/f2fs-tools/Default) + TITLE:=Utility for checking/repairing a Flash-Friendly File System (F2FS) +endef + +define Package/f2fs-tools + $(Package/f2fs-tools/Default) + TITLE:=Tools for Flash-Friendly File System (F2FS) + DEPENDS += +mkf2fs +f2fsck +endef + +define Package/libf2fs + SECTION:=libs + CATEGORY:=Libraries + TITLE:=Library for Flash-Friendly File System (F2FS) tools + DEPENDS:=+libuuid +endef + +define Package/libf2fs/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/libf2fs.so* $(1)/usr/lib/ +endef + +define Package/mkf2fs/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/mkfs.f2fs $(1)/usr/sbin +endef + +define Package/f2fsck/install + $(INSTALL_DIR) $(1)/usr/sbin + + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/fsck.f2fs $(1)/usr/sbin + ln -s /usr/sbin/fsck.f2fs $(1)/usr/sbin/defrag.f2fs + ln -s /usr/sbin/fsck.f2fs $(1)/usr/sbin/dump.f2fs + ln -s /usr/sbin/fsck.f2fs $(1)/usr/sbin/sload.f2fs + ln -s /usr/sbin/fsck.f2fs $(1)/usr/sbin/resize.f2fs +endef + +define Package/f2fs-tools/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/f2fstat $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/fibmap.f2fs $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/parse.f2fs $(1)/usr/sbin +endef + +$(eval $(call BuildPackage,libf2fs)) +$(eval $(call BuildPackage,mkf2fs)) +$(eval $(call BuildPackage,f2fsck)) +$(eval $(call BuildPackage,f2fs-tools)) diff --git a/utils/f2fs-tools/patches/001-compile.patch b/utils/f2fs-tools/patches/001-compile.patch new file mode 100644 index 0000000..2ff6ee8 --- /dev/null +++ b/utils/f2fs-tools/patches/001-compile.patch @@ -0,0 +1,19 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -20,14 +20,9 @@ AC_DEFINE([F2FS_MINOR_VERSION], m4_bpats + [\([0-9]*\).\([0-9]*\)\(\w\|\W\)*], [\2]), + [Minor version for f2fs-tools]) + +-AC_CHECK_FILE(.git, +- AC_DEFINE([F2FS_TOOLS_DATE], +- "m4_bpatsubst(f2fs_tools_gitdate, +- [\([0-9-]*\)\(\w\|\W\)*], [\1])", +- [f2fs-tools date based on Git commits]), +- AC_DEFINE([F2FS_TOOLS_DATE], ++AC_DEFINE([F2FS_TOOLS_DATE], + "f2fs_tools_date", +- [f2fs-tools date based on Source releases])) ++ [f2fs-tools date based on Source releases]) + + AC_CONFIG_SRCDIR([config.h.in]) + AC_CONFIG_HEADER([config.h]) diff --git a/utils/f2fs-tools/patches/010-include-byteswap-h.patch b/utils/f2fs-tools/patches/010-include-byteswap-h.patch new file mode 100644 index 0000000..b8c9ff3 --- /dev/null +++ b/utils/f2fs-tools/patches/010-include-byteswap-h.patch @@ -0,0 +1,10 @@ +--- a/include/f2fs_fs.h ++++ b/include/f2fs_fs.h +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include diff --git a/utils/f2fs-tools/patches/020-sload.f2fs-allow-to-build-without-libselinux.patch b/utils/f2fs-tools/patches/020-sload.f2fs-allow-to-build-without-libselinux.patch new file mode 100644 index 0000000..eac06c9 --- /dev/null +++ b/utils/f2fs-tools/patches/020-sload.f2fs-allow-to-build-without-libselinux.patch @@ -0,0 +1,100 @@ +From b0a2386089fd6efade6b89094325ed8a9f8c6fff Mon Sep 17 00:00:00 2001 +From: Christian Hesse +Date: Sat, 22 Oct 2016 22:06:54 +0200 +Subject: [PATCH] sload.f2fs: allow to build without libselinux + +Some systems do not have libselinux. Allow to build sload.f2fs without +support for selinux. + +Signed-off-by: Christian Hesse +Signed-off-by: Jaegeuk Kim +--- + configure.ac | 4 +++- + fsck/sload.c | 12 +++++++++++- + 2 files changed, 14 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index f519790..7a62328 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -54,7 +54,9 @@ AC_PATH_PROG([LDCONFIG], [ldconfig], + + # Checks for libraries. + PKG_CHECK_MODULES([libuuid], [uuid]) +-PKG_CHECK_MODULES([libselinux], [libselinux]) ++PKG_CHECK_MODULES([libselinux], [libselinux], ++ [AC_DEFINE([HAVE_LIBSELINUX], [1], [Use libselinux])], ++ [AC_MSG_NOTICE([libselinux not found])]) + + # Checks for header files. + AC_CHECK_HEADERS([linux/fs.h fcntl.h mntent.h stdlib.h string.h \ +diff --git a/fsck/sload.c b/fsck/sload.c +index ea072d1..68799c1 100644 +--- a/fsck/sload.c ++++ b/fsck/sload.c +@@ -16,8 +16,11 @@ + #include + #include + #include ++ ++#ifdef HAVE_LIBSELINUX + #include + #include ++#endif + + #ifdef WITH_ANDROID + #include +@@ -110,10 +113,12 @@ static int build_directory(struct f2fs_sb_info *sbi, const char *full_path, + handle_selabel(dentries + i, S_ISDIR(stat.st_mode), + target_out_dir); + ++#ifdef HAVE_LIBSELINUX + if (sehnd && selabel_lookup(sehnd, &dentries[i].secon, + dentries[i].path, stat.st_mode) < 0) + ERR_MSG("Cannot lookup security context for %s\n", + dentries[i].path); ++#endif + + dentries[i].pino = dir_ino; + +@@ -174,6 +179,7 @@ static int build_directory(struct f2fs_sb_info *sbi, const char *full_path, + MSG(1, "Error unknown file type\n"); + } + ++#ifdef HAVE_LIBSELINUX + if (dentries[i].secon) { + inode_set_selinux(sbi, dentries[i].ino, dentries[i].secon); + MSG(1, "File = %s \n----->SELinux context = %s\n", +@@ -184,10 +190,12 @@ static int build_directory(struct f2fs_sb_info *sbi, const char *full_path, + dentries[i].gid, dentries[i].capabilities); + } + ++ free(dentries[i].secon); ++#endif ++ + free(dentries[i].path); + free(dentries[i].full_path); + free((void *)dentries[i].name); +- free(dentries[i].secon); + } + + free(dentries); +@@ -218,6 +226,7 @@ int f2fs_sload(struct f2fs_sb_info *sbi, const char *from_dir, + return ret; + } + ++#ifdef HAVE_LIBSELINUX + if (sehnd) { + char *secontext = NULL; + +@@ -233,6 +242,7 @@ int f2fs_sload(struct f2fs_sb_info *sbi, const char *from_dir, + } + free(secontext); + } ++#endif + + /* update curseg info; can update sit->types */ + move_curseg_info(sbi, SM_I(sbi)->main_blkaddr); +-- +2.10.0 + diff --git a/utils/findutils/Makefile b/utils/findutils/Makefile new file mode 100644 index 0000000..d884a95 --- /dev/null +++ b/utils/findutils/Makefile @@ -0,0 +1,88 @@ +# +# Copyright (C) 2006-2016 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:=findutils +PKG_VERSION:=4.6.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@GNU/$(PKG_NAME) +PKG_MD5SUM:=9936aa8009438ce185bea2694a997fc1 +PKG_MAINTAINER:=Daniel Dickinson + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/findutils/Default + TITLE:=GNU findutils + SECTION:=utils + CATEGORY:=Utilities +endef + +define Package/findutils/description/Default +Replace busybox versions of findutils with full GNU versions. +This is normally not needed as busybox is smaller and provides +sufficient functionality, but some users may want or need +the full functionality of the GNU tools. +endef + +define Package/findutils-find + $(call Package/findutils/Default) + TITLE+= (find) +endef + +define Package/findutils-find/description +$(call Package/findutils/description/Default) +This package contains the find utility +endef + +define Package/findutils-xargs + $(call Package/findutils/Default) + TITLE := (xargs) +endef + +define Package/findutils-xargs/description +$(call Package/findutils/description/Default) +This package contains the xargs utility +endef + +define Package/findutils-locate + $(call Package/findutils/Default) + TITLE := (locate) +endef + +define Package/findutils-locate/description +$(call Package/findutils/description/Default) +This package contains the locate and related updatedb utility +endef + +CONFIGURE_ARGS += --localstatedir=/srv/var +CONFIGURE_VARS += ac_cv_path_SORT=sort + +define Package/findutils-find/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/find $(1)/usr/bin/ +endef + +define Package/findutils-xargs/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/xargs $(1)/usr/bin/ +endef + +define Package/findutils-locate/install + $(INSTALL_DIR) $(1)/usr/bin $(1)/srv/var + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/locate $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/updatedb $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib $(1)/usr/ +endef + +$(eval $(call BuildPackage,findutils-find)) +$(eval $(call BuildPackage,findutils-xargs)) +$(eval $(call BuildPackage,findutils-locate)) diff --git a/utils/flashrom/Makefile b/utils/flashrom/Makefile new file mode 100644 index 0000000..bc062d3 --- /dev/null +++ b/utils/flashrom/Makefile @@ -0,0 +1,111 @@ +# +# Copyright (C) 2010-2016 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:=flashrom +PKG_VERSION:=0.9.9 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://download.flashrom.org/releases +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_MD5SUM:=aab9c98925d9cfb5ffb28b67a6112530 +PKG_MAINTAINER:=Álvaro Fernández Rojas + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR) + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include flashrom.mk + +TARGET_CFLAGS+= \ + -std=gnu89 + +MAKE_FLAGS+= \ + PREFIX="/usr" + +define Package/flashrom/default + SECTION:=utils + CATEGORY:=Utilities + TITLE:=FlashROM Utility + URL:=http://www.flashrom.org/ +endef + +define Package/flashrom + $(Package/flashrom/default) + TITLE+= (full) + DEPENDS+= \ + +(TARGET_x86||TARGET_x86_64):dmidecode \ + +libftdi1 \ + +libusb-1.0 \ + +libusb-compat \ + +pciutils + VARIANT:=full + DEFAULT_VARIANT:=1 +endef + +define Package/flashrom-pci + $(Package/flashrom/default) + TITLE+= (pci) + DEPENDS+= \ + +(TARGET_x86||TARGET_x86_64):dmidecode \ + +pciutils + VARIANT:=pci +endef + +define Package/flashrom-spi + $(Package/flashrom/default) + TITLE+= (spi) + VARIANT:=spi +endef + +define Package/flashrom-usb + $(Package/flashrom/default) + TITLE+= (usb) + DEPENDS+= \ + +libftdi1 \ + +libusb-1.0 \ + +libusb-compat + VARIANT:=usb +endef + +define Package/flashrom/default/description + flashrom is an utility for identifying, reading, writing, verifying + and erasing flash chips. It's often used to flash BIOS/EFI/coreboot + /firmware images. +endef +Package/flashrom/description = $(Package/flashrom/default/description) +Package/flashrom-pci/description = $(Package/flashrom/default/description) +Package/flashrom-spi/description = $(Package/flashrom/default/description) +Package/flashrom-usb/description = $(Package/flashrom/default/description) + +define Package/flashrom/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/flashrom $(1)/usr/sbin/flashrom +endef +define Package/flashrom-pci/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/flashrom $(1)/usr/sbin/flashrom-pci +endef +define Package/flashrom-spi/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/flashrom $(1)/usr/sbin/flashrom-spi +endef +define Package/flashrom-usb/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/flashrom $(1)/usr/sbin/flashrom-usb +endef + +$(eval $(call BuildPackage,flashrom)) +$(eval $(call BuildPackage,flashrom-pci)) +$(eval $(call BuildPackage,flashrom-spi)) +$(eval $(call BuildPackage,flashrom-usb)) diff --git a/utils/flashrom/flashrom.mk b/utils/flashrom/flashrom.mk new file mode 100644 index 0000000..f910758 --- /dev/null +++ b/utils/flashrom/flashrom.mk @@ -0,0 +1,99 @@ +# Flashrom variants + +define DefaultProgrammer + MAKE_FLAGS += CONFIG_DEFAULT_PROGRAMMER=PROGRAMMER_$(1) +endef +define DefineConfig + MAKE_FLAGS += NEED_$(1)=$(2) +endef +define DefineProgrammer + # Selecting invalid programmers will fail + # Only disable unwanted programmers and keep the default ones + ifeq ($(2),no) + MAKE_FLAGS += CONFIG_$(1)=$(2) + endif +endef + +ifeq ($(BUILD_VARIANT),full) + $(eval $(call DefaultProgrammer,LINUX_SPI)) + FLASHROM_BASIC := yes + FLASHROM_FTDI := yes + FLASHROM_PCI := yes + FLASHROM_RAW := yes + FLASHROM_SERIAL := yes + FLASHROM_USB := yes +endif +ifeq ($(BUILD_VARIANT),pci) + $(eval $(call DefaultProgrammer,INTERNAL)) + FLASHROM_BASIC := yes + FLASHROM_FTDI := no + FLASHROM_PCI := yes + FLASHROM_RAW := yes + FLASHROM_SERIAL := no + FLASHROM_USB := no +endif +ifeq ($(BUILD_VARIANT),spi) + $(eval $(call DefaultProgrammer,LINUX_SPI)) + FLASHROM_BASIC := yes + FLASHROM_FTDI := no + FLASHROM_PCI := no + FLASHROM_RAW := no + FLASHROM_SERIAL := no + FLASHROM_USB := no +endif +ifeq ($(BUILD_VARIANT),usb) + $(eval $(call DefaultProgrammer,SERPROG)) + FLASHROM_BASIC := yes + FLASHROM_FTDI := yes + FLASHROM_PCI := no + FLASHROM_RAW := no + FLASHROM_SERIAL := yes + FLASHROM_USB := yes +endif + +# Misc +$(eval $(call DefineProgrammer,LINUX_SPI,$(FLASHROM_BASIC))) +#$(eval $(call DefineProgrammer,MSTARDDC_SPI,$(FLASHROM_BASIC))) +$(eval $(call DefineProgrammer,DUMMY,$(FLASHROM_BASIC))) + +# FTDI +$(eval $(call DefineConfig,FTDI,$(FLASHROM_FTDI))) +$(eval $(call DefineProgrammer,FT2232_SPI,$(FLASHROM_FTDI))) +$(eval $(call DefineProgrammer,USBBLASTER_SPI,$(FLASHROM_FTDI))) + +# RAW +$(eval $(call DefineConfig,RAW_ACCESS,$(FLASHROM_RAW))) +$(eval $(call DefineProgrammer,RAYER_SPI,$(FLASHROM_RAW))) + +# PCI +$(eval $(call DefineConfig,PCI,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,INTERNAL,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,NIC3COM,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,GFXNVIDIA,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,SATASII,$(FLASHROM_PCI))) +#$(eval $(call DefineProgrammer,ATAHPT,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,ATAVIA,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,IT8212,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,DRKAISER,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,NICREALTEK,$(FLASHROM_PCI))) +#$(eval $(call DefineProgrammer,NICNATSEMI,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,NICINTEL,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,NICINTEL_SPI,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,NICINTEL_EEPROM,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,OGP_SPI,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,SATAMV,$(FLASHROM_PCI))) + +# Serial +$(eval $(call DefineConfig,SERIAL,$(FLASHROM_SERIAL))) +$(eval $(call DefineProgrammer,SERPROG,$(FLASHROM_SERIAL))) +$(eval $(call DefineProgrammer,PONY_SPI,$(FLASHROM_SERIAL))) +$(eval $(call DefineProgrammer,BUSPIRATE_SPI,$(FLASHROM_SERIAL))) + +# USB0 +$(eval $(call DefineConfig,USB0,$(FLASHROM_USB))) +$(eval $(call DefineProgrammer,PICKIT2_SPI,$(FLASHROM_USB))) + +# USB1 +$(eval $(call DefineConfig,USB1,$(FLASHROM_USB))) +$(eval $(call DefineProgrammer,CH341A_SPI,$(FLASHROM_USB))) +$(eval $(call DefineProgrammer,DEDIPROG,$(FLASHROM_USB))) diff --git a/utils/flashrom/patches/0001-fix_internal_bitbang.patch b/utils/flashrom/patches/0001-fix_internal_bitbang.patch new file mode 100644 index 0000000..376d6b2 --- /dev/null +++ b/utils/flashrom/patches/0001-fix_internal_bitbang.patch @@ -0,0 +1,11 @@ +--- a/programmer.h ++++ b/programmer.h +@@ -557,7 +557,7 @@ enum spi_controller { + #if CONFIG_DEDIPROG == 1 + SPI_CONTROLLER_DEDIPROG, + #endif +-#if CONFIG_OGP_SPI == 1 || CONFIG_NICINTEL_SPI == 1 || CONFIG_RAYER_SPI == 1 || CONFIG_PONY_SPI == 1 || (CONFIG_INTERNAL == 1 && (defined(__i386__) || defined(__x86_64__))) ++#if CONFIG_OGP_SPI == 1 || CONFIG_NICINTEL_SPI == 1 || CONFIG_RAYER_SPI == 1 || CONFIG_PONY_SPI == 1 || CONFIG_INTERNAL == 1 + SPI_CONTROLLER_BITBANG, + #endif + #if CONFIG_LINUX_SPI == 1 diff --git a/utils/flashrom/patches/0002-fix-io-h-include.patch b/utils/flashrom/patches/0002-fix-io-h-include.patch new file mode 100644 index 0000000..50aa2a8 --- /dev/null +++ b/utils/flashrom/patches/0002-fix-io-h-include.patch @@ -0,0 +1,12 @@ +diff -uprN a/linux_spi.c b/linux_spi.c +--- a/flash.h 2015-02-08 16:57:52.000000000 -0500 ++++ b/flash.h 2016-01-08 20:09:51.599387507 -0500 +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + #include + #if IS_WINDOWS + #include + diff --git a/utils/flent-tools/Makefile b/utils/flent-tools/Makefile new file mode 100644 index 0000000..fc8fadc --- /dev/null +++ b/utils/flent-tools/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2007-2011 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:=flent-tools +PKG_VERSION:=0.15.0 +PKG_LICENSE:=GPLv3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_REV).tar.gz +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/tohojo/flent +PKG_REV:=fd4c41cf4667fb5203e41e7eaa805ae54820218b +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=$(PKG_REV) + +include $(INCLUDE_DIR)/package.mk + +define Package/flent-tools + SECTION:=util + CATEGORY:=Utilities + TITLE:=Helper programs for the Flent test tool + URL:=https://flent.org + MAINTAINER:=Toke Høiland-Jørgensen + DEPENDS+=+librt +endef + +define Package/flent-tc_iterate/description + This builds the C helper programs for gathering data for + the Flent network testing tool. These tools are needed for + gathering data when a Bash shell is not available (and also + perform better than the shell equivalents). +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR)/misc \ + CC="$(TARGET_CC)" \ + CFLAGS="$(TARGET_CFLAGS) -std=gnu99" +endef + +define Package/flent-tools/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/tc_iterate $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/wifistats_iterate $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,flent-tools)) diff --git a/utils/fontconfig/Makefile b/utils/fontconfig/Makefile new file mode 100644 index 0000000..7d0ef2d --- /dev/null +++ b/utils/fontconfig/Makefile @@ -0,0 +1,64 @@ +# +# Copyright (C) 2008-2016 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:=fontconfig +PKG_VERSION:=2.11.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://fontconfig.org/release/ +PKG_MD5SUM:=824d000eb737af6e16c826dd3b2d6c90 + +PKG_FIXUP:=libtool +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/fontconfig + SECTION:=xorg-util + CATEGORY:=Xorg + SUBMENU:=font-utils + TITLE:=fontconfig + DEPENDS:=+libpthread +libexpat +libfreetype + URL:=http://fontconfig.org/ +endef + +#TODO: better put cache on persistent storage for faster boot time? +CONFIGURE_ARGS+= \ + --with-cache-dir=/tmp/fontconfig/cache \ + --with-arch=$(ARCH) \ + --disable-iconv \ + --disable-libxml2 \ + --disable-docs + +CONFIGURE_VARS+= \ + ac_cv_prog_HASDOCBOOK=no \ + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/fontconfig $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfontconfig.* $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/fontconfig.pc $(1)/usr/lib/pkgconfig/ +endef + +define Package/fontconfig/install + $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib $(1)/usr/share/fontconfig/conf.avail + $(INSTALL_DIR) $(1)/etc/fonts/conf.d + $(CP) $(PKG_INSTALL_DIR)/etc/fonts/fonts.conf $(1)/etc/fonts + $(CP) $(PKG_INSTALL_DIR)/etc/fonts/conf.d/* $(1)/etc/fonts/conf.d + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/share/fontconfig/conf.avail/* $(1)/usr/share/fontconfig/conf.avail + $(INSTALL_DIR) $(1)/etc/init.d +# $(INSTALL_BIN) ./files/fontconfig.init $(1)/etc/init.d/fontconfig +endef + +$(eval $(call BuildPackage,fontconfig)) diff --git a/utils/gammu/Makefile b/utils/gammu/Makefile new file mode 100644 index 0000000..f2ab0fc --- /dev/null +++ b/utils/gammu/Makefile @@ -0,0 +1,72 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# 2014-2015 Vitaly Protsko +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=gammu +PKG_VERSION:=1.37.4 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://dl.cihar.com/gammu/releases/ +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_MD5SUM:=38e6f5a48fe05a64b0f0f1dc6787f1f2 +PKG_MAINTAINER:=Vitaly Protsko +PKG_LICENCE:=GPL-2.0 + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/gammu + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Cell phone/modem SMS and control tool + URL:=http://dl.cihar.com/gammu/releases/ + DEPENDS:=+libpthread +libcurl +glib2 $(ICONV_DEPENDS) $(INTL_DEPENDS) + DEPENDS+=+PACKAGE_python:python +PACKAGE_bluez-libs:bluez-libs + DEPENDS+=+PACKAGE_libmysqlclient:libmysqlclient +PACKAGE_unixodbc:unixodbc +PACKAGE_libpq:libpq + DEPENDS+=+PACKAGE_libusb-1.0:libusb-1.0 +endef + +CMAKE_OPTIONS += -DWITH_LibDBI:BOOL=OFF +ifneq ($(INTL_FULL),) +CMAKE_OPTIONS += -DLIBINTL_INCLUDE_DIRS:PATH=$(INTL_PREFIX)/include +CMAKE_OPTIONS += -DLIBINTL_LIBRARIES:STRING=intl +endif +ifneq ($(ICONV_FULL),) +CMAKE_OPTIONS += -DDISABLE_ICONV=OFF +CMAKE_OPTIONS += -DICONV_INCLUDE_DIRS:PATH=$(ICONV_PREFIX)/include +CMAKE_OPTIONS += -DICONV_LIBRARIES:STRING=iconv +endif + +define Build/InstallDev + mkdir -p $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/gammu $(1)/usr/include/ + mkdir -p $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib$(LIB_SUFFIX)/lib{Gammu*,gsmsd*} $(1)/usr/lib/ +endef + +define Package/gammu/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gammu $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gammu-{smsd,smsd-inject,smsd-monitor} $(1)/usr/bin + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib$(LIB_SUFFIX)/lib{Gammu*,gsmsd*} $(1)/usr/lib + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/gammu $(1)/etc/config/gammu + $(INSTALL_BIN) ./files/gammu.init $(1)/etc/init.d/gammu +endef + +define Package/gammu/conffiles +/etc/config/gammu +endef + +$(eval $(call BuildPackage,gammu)) diff --git a/utils/gammu/files/gammu b/utils/gammu/files/gammu new file mode 100644 index 0000000..d05fb25 --- /dev/null +++ b/utils/gammu/files/gammu @@ -0,0 +1,5 @@ +config daemon default + option enabled 0 + option device /dev/ttyUSB0 + option connection at + option logfile syslog diff --git a/utils/gammu/files/gammu.init b/utils/gammu/files/gammu.init new file mode 100755 index 0000000..3723245 --- /dev/null +++ b/utils/gammu/files/gammu.init @@ -0,0 +1,116 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 villy@sft.ru + +START=98 + +USE_PROCD=1 +PROG=/usr/bin/gammu-smsd +CONFPFX=/var/gammu + +start_instance() { + local conf="$1" + local item + local conffile="$CONFPFX-$conf.conf" + + config_get_bool item "$conf" enabled 0 + [ $item = 0 ] && return + + echo -e "; don't edit. instead look into /etc/config/gammu\n[gammu]\n" > $conffile + + config_get item "$conf" device + [ -z "$item" ] && return + echo "device = $item" >> $conffile + + config_get item "$conf" connection + [ -z "$item" ] && return + echo "connection = $item" >> $conffile + + config_get item "$conf" logfile + [ -z "$item" ] && item=syslog + echo "logfile = $item" >> $conffile + + echo -e "\n[smsd]\nphoneid = $conf\nservice = files\nlogfile = $item" >> $conffile + echo -e "checkbattery = 0\nhangupcalls = 1" >> $conffile + + config_get item "$conf" pin + [ -n "$item" ] && echo "pin = $item" >> $conffile + + config_get item "$conf" phonecode + [ -n "$item" ] && echo "phonecode = $item" >> $conffile + + config_get item "$conf" send + [ -n "$item" ] && echo "send = $item" >> $conffile + + config_get item "$conf" receive + [ -n "$item" ] && echo "receive = $item" >> $conffile + + config_get item "$conf" timeout + [ -n "$item" ] && echo "commtimeout = $item" >> $conffile + + config_get item "$conf" sleep + [ -n "$item" ] && echo "loopsleep = $item" >> $conffile + + config_get item "$conf" report + [ -n "$item" ] && echo "deliveryreport = $item" >> $conffile + + config_get item "$conf" onreceive + [ -n "$item" ] && echo "runonreceive = $item" >> $conffile + + config_get item "$conf" onerror + [ -n "$item" ] && echo "runonfailure = $item" >> $conffile + + config_get item "$conf" spool + [ -z "$item" ] && item=/var/sms + [ ! -d $item ] && { + mkdir $item + mkdir $item/inbox + mkdir $item/outbox + mkdir $item/sent + mkdir $item/error + } + echo -e "inboxpath = $item/inbox/\noutboxpath = $item/outbox/" >> $conffile + echo -e "sentsmspath = $item/sent/\nerrorsmspath = $item/error/" >> $conffile + + config_get item "$conf" allow + [ -n "$item" ] && { + local data + local allowfile=$CONFPFX-$conf.allow + for data in $item ; do + echo $data >> $allowfile + done + + echo "includenumbersfile = $allowfile" >> $conffile + } + + config_get item "$conf" deny + [ -n "$item" ] && { + local data + local denyfile=$CONFPFX-$conf.deny + for data in $item ; do + echo $data >> $denyfile + done + + echo "excludenumbersfile = $denyfile" >> $conffile + } + + procd_open_instance + + config_get_bool item "$conf" respawn 0 + [ $item != 0 ] && procd_set_param respawn + + procd_set_param command $PROG --config=$conffile + + config_get item "$conf" pidfile + [ -n "$item" ] && procd_append_param command --pid=$item + + procd_close_instance +} + +start_service() { + config_load gammu + config_foreach start_instance daemon +} + +service_triggers() { + procd_add_reload_trigger "gammu" +} diff --git a/utils/gammu/patches/001-iconv-disabling-option.patch b/utils/gammu/patches/001-iconv-disabling-option.patch new file mode 100644 index 0000000..91abfe7 --- /dev/null +++ b/utils/gammu/patches/001-iconv-disabling-option.patch @@ -0,0 +1,51 @@ +--- a/cmake/FindIconv.cmake ++++ b/cmake/FindIconv.cmake +@@ -34,9 +34,9 @@ string(REGEX REPLACE "(.*)/include/?" "\ + + FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c HINTS "${ICONV_INCLUDE_BASE_DIR}/lib" PATHS /opt/local/lib) + +-IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) ++IF(NOT DISABLE_ICONV AND ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + SET(ICONV_FOUND TRUE) +-ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) ++ENDIF(NOT DISABLE_ICONV AND ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + + set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) +--- a/configure ++++ b/configure +@@ -31,6 +31,7 @@ Usage: ./configure [options] + --enable-backup enable backup support + --enable-win32 enable mingw crosscomilation + --enable-protection enable compile time protections ++--disable-iconv disable iconv support + --with-python= path to Python interpreter + --without-gnapplet disable installation of gnapplet + --without-completion disable installation of bash completion script +@@ -57,6 +58,7 @@ CMAKE_PROTECTION= + CMAKE_PYTHON= + CMAKE_GNAP= + CMAKE_COMPLETE= ++CMAKE_ICONV= + + # process command line + while [ "$#" -gt 0 ] ; do +@@ -94,6 +96,12 @@ while [ "$#" -gt 0 ] ; do + --disable-protection) + CMAKE_PROTECTION="-DENABLE_PROTECTION=OFF" + ;; ++ --enable-iconv) ++ CMAKE_ICONV="-DDISABLE_ICONV=OFF" ++ ;; ++ --disable-iconv) ++ CMAKE_ICONV="-DDISABLE_ICONV=ON" ++ ;; + --enable-debug) + CMAKE_DEBUG="-DCMAKE_BUILD_TYPE=Debug" + ;; +@@ -142,4 +150,4 @@ fi + cd "$BUILD_DIR" + + # invoke cmake to do configuration +-cmake $SOURCE_DIR $CMAKE_PREFIX $CMAKE_SHARED $CMAKE_DEBUG $CMAKE_BACKUP $CMAKE_CROSS $CMAKE_PROTECTION $CMAKE_PYTHON $CMAKE_GNAP $CMAKE_COMPLETE ++cmake $SOURCE_DIR $CMAKE_PREFIX $CMAKE_SHARED $CMAKE_DEBUG $CMAKE_BACKUP $CMAKE_CROSS $CMAKE_PROTECTION $CMAKE_PYTHON $CMAKE_GNAP $CMAKE_COMPLETE $CMAKE_ICONV diff --git a/utils/gammu/patches/002-no-fstack-protector.patch b/utils/gammu/patches/002-no-fstack-protector.patch new file mode 100644 index 0000000..ec0badf --- /dev/null +++ b/utils/gammu/patches/002-no-fstack-protector.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -537,8 +537,6 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMP + # MACRO_TUNE_LINKER("-pie") + # These do not work on Windows right now + if (NOT WIN32) +- # Stack protector +- MACRO_TUNE_COMPILER("-fstack-protector") + # Mark code read only + MACRO_TUNE_LINKER("-Wl,-zrelro") + endif (NOT WIN32) diff --git a/utils/gammu/patches/003-cmake-cross-toolchain.patch b/utils/gammu/patches/003-cmake-cross-toolchain.patch new file mode 100644 index 0000000..cfacf11 --- /dev/null +++ b/utils/gammu/patches/003-cmake-cross-toolchain.patch @@ -0,0 +1,43 @@ +--- /dev/null ++++ b/cmake/Toolchain-cross.cmake +@@ -0,0 +1,5 @@ ++# search for programs in the build host directories ++SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) ++# for libraries and headers in the target directories ++SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) ++SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +--- a/configure ++++ b/configure +@@ -25,6 +25,7 @@ Usage: ./configure [options] + + --help|-h shows this help + --prefix= installation prefix ++--cross-root= cross-compilation prefix + --enable-shared enables shared build + --enable-debug enables debug build + --enable-tiger enables Mac OS X 10.4 (Tiger) build +@@ -50,6 +51,7 @@ SOURCE_DIR=`pwd` + + # cmake parameters + CMAKE_PREFIX= ++CMAKE_ROOT= + CMAKE_SHARED= + CMAKE_DEBUG= + CMAKE_BACKUP= +@@ -69,6 +71,10 @@ while [ "$#" -gt 0 ] ; do + --prefix=*) + CMAKE_PREFIX="-DCMAKE_INSTALL_PREFIX=${1##--prefix=}" + ;; ++ --cross-root=*) ++ CMAKE_ROOT="-DCMAKE_TOOLCHAIN_FILE=$SOURCE_DIR/cmake/Toolchain-cross.cmake" ++ echo "SET(CMAKE_FIND_ROOT_PATH ${1##--cross-root=})" >> $SOURCE_DIR/cmake/Toolchain-cross.cmake ++ ;; + --with-python=*) + CMAKE_PYTHON="-DBUILD_PYTHON=${1##--with-python=}" + ;; +@@ -150,4 +156,4 @@ fi + cd "$BUILD_DIR" + + # invoke cmake to do configuration +-cmake $SOURCE_DIR $CMAKE_PREFIX $CMAKE_SHARED $CMAKE_DEBUG $CMAKE_BACKUP $CMAKE_CROSS $CMAKE_PROTECTION $CMAKE_PYTHON $CMAKE_GNAP $CMAKE_COMPLETE $CMAKE_ICONV ++cmake $SOURCE_DIR $CMAKE_ROOT $CMAKE_PREFIX $CMAKE_SHARED $CMAKE_DEBUG $CMAKE_BACKUP $CMAKE_CROSS $CMAKE_PROTECTION $CMAKE_PYTHON $CMAKE_GNAP $CMAKE_COMPLETE $CMAKE_ICONV diff --git a/utils/gammu/patches/004-cmake_libdbi_optional.patch b/utils/gammu/patches/004-cmake_libdbi_optional.patch new file mode 100644 index 0000000..c1e6728 --- /dev/null +++ b/utils/gammu/patches/004-cmake_libdbi_optional.patch @@ -0,0 +1,34 @@ +--- a/configure ++++ b/configure +@@ -36,6 +36,7 @@ Usage: ./configure [options] + --with-python= path to Python interpreter + --without-gnapplet disable installation of gnapplet + --without-completion disable installation of bash completion script ++--without-libdbi disable libdbi support + + All enable params have their disable counterparts. + +@@ -61,6 +62,7 @@ CMAKE_PYTHON= + CMAKE_GNAP= + CMAKE_COMPLETE= + CMAKE_ICONV= ++CMAKE_LIBDBI= + + # process command line + while [ "$#" -gt 0 ] ; do +@@ -120,6 +122,9 @@ while [ "$#" -gt 0 ] ; do + --without-completion) + CMAKE_COMPLETE="-DINSTALL_BASH_COMPLETION=OFF" + ;; ++ --without-libdbi) ++ CMAKE_LIBDBI="-DWITH_LibDBI=OFF" ++ ;; + --build=*) + ;; + --disable-dependency-tracking) +@@ -156,4 +161,4 @@ fi + cd "$BUILD_DIR" + + # invoke cmake to do configuration +-cmake $SOURCE_DIR $CMAKE_ROOT $CMAKE_PREFIX $CMAKE_SHARED $CMAKE_DEBUG $CMAKE_BACKUP $CMAKE_CROSS $CMAKE_PROTECTION $CMAKE_PYTHON $CMAKE_GNAP $CMAKE_COMPLETE $CMAKE_ICONV ++cmake $SOURCE_DIR $CMAKE_ROOT $CMAKE_PREFIX $CMAKE_SHARED $CMAKE_DEBUG $CMAKE_BACKUP $CMAKE_CROSS $CMAKE_PROTECTION $CMAKE_PYTHON $CMAKE_GNAP $CMAKE_COMPLETE $CMAKE_ICONV $CMAKE_LIBDBI diff --git a/utils/gammu/patches/010-utils-shell-fix.patch b/utils/gammu/patches/010-utils-shell-fix.patch new file mode 100644 index 0000000..d1b3ec3 --- /dev/null +++ b/utils/gammu/patches/010-utils-shell-fix.patch @@ -0,0 +1,16 @@ +--- a/utils/gammu-config ++++ b/utils/gammu-config +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Gammu configuration generator + # Copyright (C) 2003 - 2009 Michal Cihar + # vim: expandtab sw=4 ts=4 sts=4: +--- a/utils/jadmaker ++++ b/utils/jadmaker +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # JAD file generator + # Copyright © 2008 - 2009 Michal Čihař + # vim: expandtab sw=4 ts=4 sts=4: diff --git a/utils/gkermit/Makefile b/utils/gkermit/Makefile new file mode 100644 index 0000000..6f3b19c --- /dev/null +++ b/utils/gkermit/Makefile @@ -0,0 +1,58 @@ +# Copyright (C) 2017 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v3+. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=gkermit +PKG_VERSION:=1.00 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-2.0 + +PKG_SOURCE:=gku100.tar.gz +PKG_SOURCE_URL:=ftp://kermit.columbia.edu/kermit/archives +PKG_MD5SUM:=aea4fa728b9981fce41c9f2c635f2e05 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +PKG_MAINTAINER:=Nathaniel Wesley Filardo + +include $(INCLUDE_DIR)/package.mk + +define Package/gkermit + SECTION:=utils + CATEGORY:=Utilities + TITLE:=gkermit + URL:=http://www.columbia.edu/kermit/gkermit.html +endef + +define Package/gkermit/description + A minimal kermit file transfer program +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) + tar -C $(PKG_BUILD_DIR) -xzvf "$(DL_DIR)/$(PKG_SOURCE)" +endef + +# nothing to do +define Build/Configure +endef + +define Build/Compile + mkdir -p $(PKG_INSTALL_DIR) + $(TARGET_CC) \ + $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) \ + -include string.h -include unistd.h \ + -DPOSIX -DERRNO_H \ + -o $(PKG_INSTALL_DIR)/gkermit \ + $(PKG_BUILD_DIR)/{gproto,gkermit,gunixio,gcmdline}.c +endef + +define Package/gkermit/install + $(INSTALL_DIR) $(1)/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/gkermit $(1)/bin +endef + +$(eval $(call BuildPackage,gkermit)) diff --git a/utils/gnupg/Makefile b/utils/gnupg/Makefile new file mode 100644 index 0000000..cd1a691 --- /dev/null +++ b/utils/gnupg/Makefile @@ -0,0 +1,91 @@ +# +# Copyright (C) 2006-2015 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:=gnupg +PKG_VERSION:=1.4.20 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=ftp://ftp.franken.de/pub/crypt/mirror/ftp.gnupg.org/gcrypt/gnupg \ + ftp://ftp.gnupg.org/gcrypt/gnupg +PKG_MD5SUM:=b7af897a041c03c8ad1c7c466b54d10d + +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Nicolas Thill + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/gnupg/Default + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Encryption + DEPENDS:=+zlib +libncurses +libreadline + TITLE:=GNU privacy guard - a free PGP replacement + URL:=http://www.gnupg.org/ +endef + +define Package/gnupg + $(call Package/gnupg/Default) + MENU:=1 +endef + +define Package/gnupg-utils + $(call Package/gnupg/Default) + DEPENDS:=gnupg +libcurl + TITLE:=Key management utilities for GnuPG +endef + +define Package/gnupg/description + GnuPG is GNU's tool for secure communication and data storage. + It can be used to encrypt data and to create digital signatures. + It includes an advanced key management facility and is compliant + with the proposed OpenPGP Internet standard as described in RFC2440. + . + GnuPG does not use any patented algorithms so it cannot be compatible + with PGP2 because it uses IDEA (which is patented worldwide). +endef + +define Package/gnupg-utils/description + Key management utilies for GnuPG. + This package is needed to import keys from a keyserver. +endef + +CONFIGURE_ARGS += \ + --disable-rpath \ + --disable-asm \ + --disable-gnupg-iconv \ + --disable-card-support \ + --disable-agent-support \ + --disable-bzip2 \ + --disable-ldap \ + --disable-finger \ + --disable-dns-srv \ + --disable-regex \ + +MAKE_FLAGS += \ + SUBDIRS="m4 intl zlib util mpi cipher tools g10 keyserver ${checks}" \ + +define Package/gnupg/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gpg $(1)/usr/bin/ +endef + +define Package/gnupg-utils/install + $(INSTALL_DIR) $(1)/usr/lib/gnupg + for file in gpgkeys_curl gpgkeys_hkp; do \ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnupg/$$$$file \ + $(1)/usr/lib/gnupg/; \ + done +endef + +$(eval $(call BuildPackage,gnupg)) +$(eval $(call BuildPackage,gnupg-utils)) diff --git a/utils/gpsd/Makefile b/utils/gpsd/Makefile new file mode 100644 index 0000000..4adb531 --- /dev/null +++ b/utils/gpsd/Makefile @@ -0,0 +1,148 @@ +# +# Copyright (C) 2006-2015 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:=gpsd +PKG_VERSION:=3.15 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://download-mirror.savannah.gnu.org/releases/gpsd/ +PKG_MD5SUM:=afd79b87337fadf38ee2a7c4314dac79 + +PKG_MAINTAINER:=Pushpal Sidhu +PKG_LICENSE:=BSD-3-Clause +PKG_LICENSE_FILES:=COPYING + +PKG_BUILD_DEPENDS:=libncurses libusb-1.0 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/scons.mk + +define Package/gpsd/Default + DEPENDS:=+librt +libncurses + URL:=http://catb.org/gpsd/ +endef + +define Package/gpsd/Default/description + gpsd is a userland daemon acting as a translator between GPS and AIS receivers + and their clients. gpsd listens on port 2947 for clients requesting + position/time/velocity information. The receivers are expected to generate + position information in a well-known format -- as NMEA-0183 sentences, SiRF + binary, Rockwell binary, Garmin binary format, or other vendor binary + protocols. gpsd takes this information from the GPS and translates it into + something uniform and easier to understand for clients. +endef + +define Package/gpsd + $(call Package/gpsd/Default) + SECTION:=net + CATEGORY:=Network + DEPENDS+= +libgps +libusb-1.0 + TITLE:=An interface daemon for GPS receivers +endef + +define Package/gpsd/conffiles +/etc/config/gpsd +endef + +define Package/gpsd/description + $(call Package/gpsd/Default/description) + This package contains the GPS daemon. +endef + +define Package/gpsd-clients + $(call Package/gpsd/Default) + SECTION:=net + CATEGORY:=Network + DEPENDS+= +libgps +libncurses +libusb-1.0 + TITLE:=GPS tools and clients +endef + +define Package/gpsd-clients/description + $(call Package/gpsd/Default/description) + This package contains auxiliary tools and example clients for monitoring and + testing the GPS daemon. +endef + +define Package/libgps + $(call Package/gpsd/Default) + SECTION:=libs + CATEGORY:=Libraries + DEPENDS+= +libcap + TITLE:=C service library for communicating with the GPS daemon +endef + +define Package/libgps/description + $(call Package/gpsd/Default/description) + This package contains the libgps library. +endef + +SCONS_VARS += \ + LINKFLAGS="$(TARGET_LDFLAGS)" + +SCONS_OPTIONS += \ + dbus_export=no \ + tsip=no \ + fv18=no \ + tripmate=no \ + earthmate=no \ + itrax=no \ + navcom=no \ + ubx=no \ + evermore=no \ + ntrip=no \ + libgpsmm=no \ + libQgpsmm=no \ + bluez=no \ + nostrip=yes \ + python=no \ + implicit_link=no \ + chrpath=no \ + target="$(TARGET_CROSS:-=)" + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/gps.h $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgps*.so* $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libgps*.pc \ + $(1)/usr/lib/pkgconfig/ +endef + +define Package/gpsd/install + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/gpsd.config $(1)/etc/config/gpsd + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/gpsd.init $(1)/etc/init.d/gpsd + $(INSTALL_DIR) $(1)/etc/hotplug.d/usb + $(INSTALL_DATA) ./files/gpsd.hotplug $(1)/etc/hotplug.d/usb/20-gpsd + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/gpsd $(1)/usr/sbin/ +endef + +define Package/gpsd-clients/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/cgps \ + $(PKG_INSTALL_DIR)/usr/bin/gps{ctl,decode,mon,pipe} \ + $(PKG_INSTALL_DIR)/usr/bin/gpxlogger \ + $(PKG_INSTALL_DIR)/usr/bin/lcdgps \ + $(1)/usr/bin/ +endef + +define Package/libgps/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgps.so.* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,gpsd)) +$(eval $(call BuildPackage,gpsd-clients)) +$(eval $(call BuildPackage,libgps)) diff --git a/utils/gpsd/files/gpsd.config b/utils/gpsd/files/gpsd.config new file mode 100644 index 0000000..1a5ddaa --- /dev/null +++ b/utils/gpsd/files/gpsd.config @@ -0,0 +1,5 @@ +config gpsd core + option device "/dev/ttyUSB0" + option port "2947" + option listen_globally "false" + option enabled "false" diff --git a/utils/gpsd/files/gpsd.hotplug b/utils/gpsd/files/gpsd.hotplug new file mode 100644 index 0000000..fc15dda --- /dev/null +++ b/utils/gpsd/files/gpsd.hotplug @@ -0,0 +1,16 @@ +case "$ACTION" in + add) + # start process + # only pl2303 devices are handled + if [ "$PRODUCT" = "67b/2303/300" ] && [ "$TYPE" = "0/0/0" ] && [ "$INTERFACE" = "255/0/0" ]; then + sleep 3 && /etc/init.d/gpsd start + fi + ;; + remove) + # stop process + # only pl2303 devices are handled + if [ "$PRODUCT" = "67b/2303/300" ] && [ "$TYPE" = "0/0/0" ] && [ "$INTERFACE" = "255/0/0" ]; then + /etc/init.d/gpsd stop + fi + ;; +esac diff --git a/utils/gpsd/files/gpsd.init b/utils/gpsd/files/gpsd.init new file mode 100644 index 0000000..96cee78 --- /dev/null +++ b/utils/gpsd/files/gpsd.init @@ -0,0 +1,32 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2009-2011 OpenWrt.org +START=50 + +NAME=gpsd +PIDF=/var/run/$NAME.pid +PROG=/usr/sbin/$NAME + +start() { + config_load gpsd + config_get device core device + config_get port core port + config_get_bool listen_globally core listen_globally + config_get_bool enabled core enabled + [ "$enabled" != "1" ] && exit + logger -t "$NAME" "Starting..." + [ ! -c "$device" ] && { + logger -t "$NAME" "Unable to find device $device. Exiting." + exit 1 + } + [ "$listen_globally" != "0" ] && append args "-G" + $PROG -n -P $PIDF -S $port $args $device +} + +stop() { + logger -t "$NAME" "Stopping..." + [ -f "$PIDF" ] && { + read PID < "$PIDF" + kill -9 $PID + rm $PIDF + } +} diff --git a/utils/gpsd/patches/0001-Remove-a-BSD-ism.patch b/utils/gpsd/patches/0001-Remove-a-BSD-ism.patch new file mode 100644 index 0000000..55004ab --- /dev/null +++ b/utils/gpsd/patches/0001-Remove-a-BSD-ism.patch @@ -0,0 +1,42 @@ +From 95c99f69e026e8c57aecba545e51c97f3b284e75 Mon Sep 17 00:00:00 2001 +From: "Gary E. Miller" +Date: Tue, 23 Jun 2015 14:36:26 -0700 +Subject: [PATCH] Remove a BSD-ism. + +CTRL('L') is a BSD-ism. CTRL() is defined in sys/ttydefaults.h +which does not always exist. Instead of adding scons tests for +needing CTRL() and its include files just replace with a simple +constant. + +Needed for musl and found by Baruch Siach +--- + gpsmon.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/gpsmon.c b/gpsmon.c +index c3001c8..58c8300 100644 +--- a/gpsmon.c ++++ b/gpsmon.c +@@ -583,6 +583,9 @@ static void select_packet_monitor(struct gps_device_t *device) + (void)wnoutrefresh(devicewin); + } + ++/* Control-L character */ ++#define CTRL_L 0x0C ++ + static char *curses_get_command(void) + /* char-by-char nonblocking input, return accumulated command line on \n */ + { +@@ -591,7 +594,8 @@ static char *curses_get_command(void) + int c; + + c = wgetch(cmdwin); +- if (c == CTRL('L')) { ++ if (CTRL_L == c) { ++ /* ^L is to repaint the screen */ + (void)clearok(stdscr, true); + if (active != NULL && (*active)->initialize != NULL) + (void)(*active)->initialize(); +-- +2.6.0 + diff --git a/utils/gptfdisk/Makefile b/utils/gptfdisk/Makefile new file mode 100644 index 0000000..3ce5a69 --- /dev/null +++ b/utils/gptfdisk/Makefile @@ -0,0 +1,87 @@ +# +# Copyright (C) 2016 Daniel Engberg +# +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=gptfdisk +PKG_VERSION:=1.0.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/gptfdisk +PKG_MD5SUM:=d7f3d306b083123bcc6f5941efade586 + +include $(INCLUDE_DIR)/package.mk + +define Package/gptfdisk/default + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Disc + URL:=http://www.rodsbooks.com/gdisk + MAINTAINER:=Daniel Engberg +endef + +define Package/gdisk + $(call Package/gptfdisk/default) + TITLE:=GPT partition table manipulation utility + DEPENDS:=+libstdcpp +libuuid +libpopt +endef + +define Package/gdisk/description + GPT partition table manipulation utility with an interface + similar to fdisk. It can read and convert MBR partitions in GPT + but is otherwise unable to generate or modify MBR partitions. +endef + +define Package/sgdisk + $(call Package/gptfdisk/default) + TITLE:=script-friendly GPT partition table manipulation utility + DEPENDS:=+libstdcpp +libuuid +libpopt +endef + +define Package/sgdisk/description + Script-friendly GPT partition table manipulation utility. + It can read and convert MBR partitions in GPT but is otherwise + unable to generate or modify MBR partitions. + To the contrary of gdisk, its interface is geared towards scripts, + so it takes command line arguments instead of being interactive. + It will NOT ask confirmation before carrying out the operations. + It has a slightly smaller footprint than gdisk tool. +endef + +define Package/cgdisk + $(call Package/gptfdisk/default) + TITLE:=ncurses-based GPT partition table manipulation utility + DEPENDS:=+libstdcpp +libuuid +libncurses +libpopt +endef + +define Package/cgdisk/description +ncurses-based partition table manipulation utility with GPT support. +Similar to sfdisk, but works with GPT partitions. Shares the same limitations +of the gdisk partition utility. While it can read and convert MBR partitions +in GPT, it cannot modify MBR partitions on its own. +endef + +define Package/gdisk/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/gdisk $(1)/usr/sbin +endef + +define Package/sgdisk/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/sgdisk $(1)/usr/sbin +endef + +define Package/cgdisk/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/cgdisk $(1)/usr/sbin +endef + +$(eval $(call BuildPackage,gdisk)) +$(eval $(call BuildPackage,sgdisk)) +$(eval $(call BuildPackage,cgdisk)) diff --git a/utils/grep/Makefile b/utils/grep/Makefile new file mode 100644 index 0000000..5273231 --- /dev/null +++ b/utils/grep/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2010-2016 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:=grep +PKG_VERSION:=2.25 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@GNU/grep +PKG_MD5SUM:=04e96b0e6f0fe6a180ae62c88fcd0af6 + +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Julen Landa Alustiza + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +TARGET_CFLAGS+=--std=gnu99 + +define Package/grep + SECTION:=utils + CATEGORY:=Utilities + TITLE:=grep search utility - full version + DEPENDS:=+libpcre + URL:=http://www.gnu.org/software/grep/ +endef + +define Package/grep/description +The grep command searches one or more input files for lines +containing a match to a specified pattern. By default, grep +prints the matching lines. +endef + +define Package/grep/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/grep $(1)/usr/bin/grep +endef + +define Package/grep/postinst +#!/bin/sh +[ -L "$${IPKG_INSTROOT}/bin/grep" ] && rm -f "$${IPKG_INSTROOT}/bin/grep" +exit 0 +endef + +define Package/grep/prerm +$${IPKG_INSTROOT}/bin/busybox grep -h 2>&1 | grep -q BusyBox && \ +ln -sf busybox $${IPKG_INSTROOT}/bin/grep +exit 0 +endef + +$(eval $(call BuildPackage,grep)) diff --git a/utils/gzip/Makefile b/utils/gzip/Makefile new file mode 100644 index 0000000..83f3e38 --- /dev/null +++ b/utils/gzip/Makefile @@ -0,0 +1,64 @@ +# +# Copyright (C) 2006-2016 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:=gzip +PKG_VERSION:=1.7 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@GNU/gzip +PKG_MD5SUM:=c4abae2ddd5c6f39c6f8169693cc7ac0 +PKG_LICENSE:=GPL-3.0+ + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/gzip + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Compression + TITLE:=gzip (GNU zip) is a compression utility. + URL:=https://www.gnu.org/software/gzip/ + MAINTAINER:=Christian Beier +endef + +define Package/gzip/description + gzip (GNU zip) is a compression utility designed to be a \ + replacement for compress. +endef + +CONFIGURE_VARS += \ + gl_cv_func_getopt_gnu=yes \ + ac_cv_search_clock_gettime=no + +define Package/gzip/install + $(SED) 's,/bin/bash,/bin/sh,g' $(PKG_INSTALL_DIR)/usr/bin/{gunzip,zcat} + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{gunzip,gzip,zcat} $(1)/usr/bin/ +endef + +define Package/gzip/postinst +#!/bin/sh +for app in gunzip gzip zcat; do + ln -sf ../usr/bin/$$app $${IPKG_INSTROOT}/bin/$$app +done +endef + +define Package/gzip/postrm +#!/bin/sh +for app in gunzip gzip zcat; do + ln -sf busybox $${IPKG_INSTROOT}/bin/$$app + $${IPKG_INSTROOT}/bin/$$app 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/bin/$$app +done +exit 0 +endef + +$(eval $(call BuildPackage,gzip)) + diff --git a/utils/haserl/Config.in b/utils/haserl/Config.in new file mode 100644 index 0000000..e5fb90d --- /dev/null +++ b/utils/haserl/Config.in @@ -0,0 +1,35 @@ +if PACKAGE_haserl + + config HASERL_with_lua + bool + default n + + comment "Lua support" + + config HASERL_shell_luac + bool + prompt "Support --shell=luac" + select HASERL_with_lua + default n + help + haserl(1): + The luac "shell" is a precompiled lua chunk, so interactive + editing and testing of scripts is not possible. However, + haserl can be compiled with luac support only, and this + allows lua support even in a small memory environment. All + haserl lua features listed above are still available. (If + luac is the only shell built into haserl, the + haserl.loadfile is disabled, as the haserl parser is not + compiled in.) + + config HASERL_shell_lua + bool + prompt "Support --shell=lua" + select HASERL_with_lua + default n + help + haserl(1): + If compiled with lua support, --shell=lua will enable lua as the + script language instead of bash shell. + +endif diff --git a/utils/haserl/Makefile b/utils/haserl/Makefile new file mode 100644 index 0000000..1d58625 --- /dev/null +++ b/utils/haserl/Makefile @@ -0,0 +1,57 @@ +# +# Copyright (C) 2006-2015 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:=haserl +PKG_VERSION:=0.9.35 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/haserl +PKG_MD5SUM:=918f0b4f6cec0b438c8b5c78f2989010 +PKG_MAINTAINER:=Maxim Storchak +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_CONFIG_DEPENDS:= \ + CONFIG_HASERL_with_lua \ + CONFIG_HASERL_shell_luac \ + CONFIG_HASERL_shell_lua \ + +include $(INCLUDE_DIR)/package.mk + +define Package/haserl + SECTION:=utils + CATEGORY:=Utilities + TITLE:=A CGI wrapper to embed shell scripts in HTML documents + URL:=http://haserl.sourceforge.net/ + MENU:=1 + DEPENDS:= +HASERL_with_lua:liblua +endef + +define Package/haserl/config + source "$(SOURCE)/Config.in" +endef + +ifeq ($(CONFIG_HASERL_with_lua),y) + CONFIGURE_ARGS+=--with-lua + TARGET_LDFLAGS += -ldl +endif +ifneq ($(CONFIG_HASERL_shell_lua),y) + CONFIGURE_ARGS+=--disable-luashell +endif +ifneq ($(CONFIG_HASERL_shell_luac),y) + CONFIGURE_ARGS+=--disable-luacshell +endif + +define Package/haserl/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/haserl $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,haserl)) diff --git a/utils/haserl/patches/100-replace-lua2c-with-sed.patch b/utils/haserl/patches/100-replace-lua2c-with-sed.patch new file mode 100644 index 0000000..4626a02 --- /dev/null +++ b/utils/haserl/patches/100-replace-lua2c-with-sed.patch @@ -0,0 +1,82 @@ +diff --git a/src/Makefile.in b/src/Makefile.in +index 31d45f7..d249f67 100644 +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -86,7 +86,6 @@ POST_INSTALL = : + NORMAL_UNINSTALL = : + PRE_UNINSTALL = : + POST_UNINSTALL = : +-@USE_LUA_TRUE@noinst_PROGRAMS = lua2c$(EXEEXT) + @INCLUDE_LUASHELL_TRUE@@USE_LUA_TRUE@am__append_1 = h_lua.c h_lua.h + @INCLUDE_LUACSHELL_TRUE@@USE_LUA_TRUE@am__append_2 = h_luac.c h_luac.h + bin_PROGRAMS = haserl$(EXEEXT) +@@ -124,9 +123,6 @@ am__DEPENDENCIES_1 = + haserl_DEPENDENCIES = $(am__DEPENDENCIES_1) + haserl_LINK = $(CCLD) $(haserl_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +-lua2c_SOURCES = lua2c.c +-lua2c_OBJECTS = lua2c.$(OBJEXT) +-lua2c_LDADD = $(LDADD) + AM_V_P = $(am__v_P_@AM_V@) + am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) + am__v_P_0 = false +@@ -159,8 +155,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) + am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) + am__v_CCLD_0 = @echo " CCLD " $@; + am__v_CCLD_1 = +-SOURCES = $(haserl_SOURCES) $(nodist_haserl_SOURCES) lua2c.c +-DIST_SOURCES = $(am__haserl_SOURCES_DIST) lua2c.c ++SOURCES = $(haserl_SOURCES) $(nodist_haserl_SOURCES) ++DIST_SOURCES = $(am__haserl_SOURCES_DIST) + am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ +@@ -284,7 +280,7 @@ target_alias = @target_alias@ + top_build_prefix = @top_build_prefix@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ +-EXTRA_DIST = haserl_lualib.lua lua2c.c ++EXTRA_DIST = haserl_lualib.lua + + # Not strictly required, but we explicitly do not distribute the generated inc file + nodist_haserl_SOURCES = haserl_lualib.inc +@@ -396,10 +392,6 @@ haserl$(EXEEXT): $(haserl_OBJECTS) $(haserl_DEPENDENCIES) $(EXTRA_haserl_DEPENDE + @rm -f haserl$(EXEEXT) + $(AM_V_CCLD)$(haserl_LINK) $(haserl_OBJECTS) $(haserl_LDADD) $(LIBS) + +-@USE_LUA_FALSE@lua2c$(EXEEXT): $(lua2c_OBJECTS) $(lua2c_DEPENDENCIES) $(EXTRA_lua2c_DEPENDENCIES) +-@USE_LUA_FALSE@ @rm -f lua2c$(EXEEXT) +-@USE_LUA_FALSE@ $(AM_V_CCLD)$(LINK) $(lua2c_OBJECTS) $(lua2c_LDADD) $(LIBS) +- + mostlyclean-compile: + -rm -f *.$(OBJEXT) + +@@ -416,7 +408,6 @@ distclean-compile: + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/haserl-haserl.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/haserl-rfc2388.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/haserl-sliding_buffer.Po@am__quote@ +-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lua2c.Po@am__quote@ + + .c.o: + @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@@ -770,17 +761,13 @@ uninstall-am: uninstall-binPROGRAMS + .PRECIOUS: Makefile + + +-# lua2c_LIBS ?= -llua -ldl -lm +-@USE_LUA_TRUE@lua2c_LDFLAGS ?= -Wl,-E +-@USE_LUA_TRUE@lua2c: lua2c.c +-@USE_LUA_TRUE@ $(CC_FOR_BUILD) $(CFLAGS) $(LUA_CFLAGS) $(LDFLAGS) $(lua2c_LDFLAGS) \ +-@USE_LUA_TRUE@ -o $@ $^ $(LIBS) $(LUA_LIBS) + +-@USE_LUA_TRUE@haserl_lualib.inc : haserl_lualib.lua lua2c +-@USE_LUA_TRUE@ if ! ./lua2c haserl_lualib haserl_lualib.lua >$@; then \ ++@USE_LUA_TRUE@haserl_lualib.inc : haserl_lualib.lua ++@USE_LUA_TRUE@ if ! sed -re '/--\[\[/,/\]\]--/d; s/[[:space:]]*--.*//g; s/^[[:space:]]*//g; /^$$/d; s/ (=+) /\1/g; s/,[[:space:]]*/,/g; s/ ([()])/\1/g; s/key/k/g; s/value/v/g; s/^/"/; s/$$/\\n"/' haserl_lualib.lua >$@.tmp; then \ + @USE_LUA_TRUE@ rm $@; \ + @USE_LUA_TRUE@ exit 1 ;\ + @USE_LUA_TRUE@ fi ++@USE_LUA_TRUE@ { echo "static const char haserl_lualib[] = "; cat $@.tmp; echo ";"; rm $@.tmp; } >$@ + + @USE_LUA_TRUE@h_lua_common.c : haserl_lualib.inc + diff --git a/utils/haserl/patches/101-adjust-script-size.patch b/utils/haserl/patches/101-adjust-script-size.patch new file mode 100644 index 0000000..a4b7d9a --- /dev/null +++ b/utils/haserl/patches/101-adjust-script-size.patch @@ -0,0 +1,11 @@ +--- a/src/h_lua_common.c 2013-09-20 23:35:19.000000000 +0300 ++++ b/src/h_lua_common.c 2014-05-03 19:27:43.000000000 +0300 +@@ -79,7 +79,7 @@ + + /* and load our haserl library */ + if (luaL_loadbuffer +- (lua_vm, (const char *) &haserl_lualib, sizeof (haserl_lualib), ++ (lua_vm, (const char *) haserl_lualib, sizeof(haserl_lualib)-1, + "luascript.lua") || lua_pcall (lua_vm, 0, 0, 0)) + { + die_with_message (NULL, NULL, diff --git a/utils/haveged/Makefile b/utils/haveged/Makefile new file mode 100644 index 0000000..78a8552 --- /dev/null +++ b/utils/haveged/Makefile @@ -0,0 +1,65 @@ +# +# 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:=haveged +PKG_VERSION:=1.9.1 +PKG_RELEASE:=5 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.issihosts.com/$(PKG_NAME) \ + http://pkgs.fedoraproject.org/repo/pkgs/haveged/haveged-1.9.1.tar.gz/015ff58cd10607db0e0de60aeca2f5f8/ +PKG_MD5SUM:=015ff58cd10607db0e0de60aeca2f5f8 +PKG_LICENSE:=GPLv3 + +PKG_MAINTAINER:=Hannu Nyman + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/haveged + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libhavege + TITLE:=Feeds the kernel entropy pool by timing CPU loops. + URL:=http://www.issihosts.com/haveged/ +endef + +define Package/libhavege + CATEGORY:=Libraries + TITLE:=Library for haveged + URL:=http://www.issihosts.com/haveged/ +endef + +CONFIGURE_ARGS+= \ + --enable-daemon=yes \ + --enable-threads=no \ + --enable-olt=no + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/src/havege.h $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/src/.libs/libhavege.{a,so*} $(1)/usr/lib/ +endef + +define Package/haveged/install + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/haveged.init $(1)/etc/init.d/haveged + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/.libs/haveged $(1)/usr/sbin/ +endef + +define Package/libhavege/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/src/.libs/libhavege.so* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,haveged)) +$(eval $(call BuildPackage,libhavege)) diff --git a/utils/haveged/files/haveged.init b/utils/haveged/files/haveged.init new file mode 100644 index 0000000..113d64f --- /dev/null +++ b/utils/haveged/files/haveged.init @@ -0,0 +1,16 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2012 OpenWrt.org + +START=13 + +HAVEGED_THRESHOLD=1024 +HAVEGED_DCACHE=32 +HAVEGED_ICACHE=32 + +start() { + service_start /usr/sbin/haveged -w $HAVEGED_THRESHOLD -d $HAVEGED_DCACHE -i $HAVEGED_ICACHE -v 1 +} + +stop() { + service_stop /usr/sbin/haveged +} diff --git a/utils/hd-idle/Makefile b/utils/hd-idle/Makefile new file mode 100644 index 0000000..a0c9cca --- /dev/null +++ b/utils/hd-idle/Makefile @@ -0,0 +1,55 @@ +# +# 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:=hd-idle +PKG_VERSION:=1.04 +PKG_RELEASE:=2 + +PKG_MAINTAINER:=Lim Guo Wei +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:= + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=@SF/$(PKG_NAME) +PKG_MD5SUM:=41e52e669fc59fa82ee0c2bcce1336d3 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/hd-idle + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Another idle-daemon for attached hard drives + SUBMENU:=Disc + URL:=http://hd-idle.sourceforge.net/ +endef + +define Package/hd-idle/description + hd-idle is a utility program for spinning-down external disks after a period of idle time. +endef + +define Build/Compile + $(TARGET_CC) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/$(PKG_NAME) $(PKG_BUILD_DIR)/$(PKG_NAME).c +endef + +define Package/hd-idle/conffiles +/etc/config/hd-idle +endef + +define Package/hd-idle/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME) + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME) +endef + +$(eval $(call BuildPackage,hd-idle)) diff --git a/utils/hd-idle/files/hd-idle.config b/utils/hd-idle/files/hd-idle.config new file mode 100644 index 0000000..dbbd358 --- /dev/null +++ b/utils/hd-idle/files/hd-idle.config @@ -0,0 +1,5 @@ +config 'hd-idle' + option 'disk' 'sda' + option 'enabled' '0' + option 'idle_time_unit' 'minutes' + option 'idle_time_interval' '10' diff --git a/utils/hd-idle/files/hd-idle.init b/utils/hd-idle/files/hd-idle.init new file mode 100644 index 0000000..4f6a2d7 --- /dev/null +++ b/utils/hd-idle/files/hd-idle.init @@ -0,0 +1,72 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008-2011 OpenWrt.org + +START=50 +STOP=10 + +USE_PROCD=1 + +validate_section_hdidle() +{ + uci_validate_section hd-idle hd-idle "${1}" \ + 'disk:string' \ + 'enabled:bool' \ + 'idle_time_interval:uinteger:10' \ + 'idle_time_unit:string:minutes' +} + +compute_seconds() { + local interval="$1" + local unit="$2" + + # compute interval in seconds + case "$unit" in + "days" ) + interval_seconds=$(($interval*60*60*24)) + ;; + "hours" ) + interval_seconds=$(($interval*60*60)) + ;; + "minutes" ) + interval_seconds=$(($interval*60)) + ;; + "seconds" ) + interval_seconds=$interval + ;; + * ) + # default is minutes + interval_seconds=$(($interval*60)) + ;; + esac + + echo $interval_seconds +} + +hdidle_append() { + local disk enabled idle_time_interval idle_time_unit + + validate_section_hdidle "${1}" || return + + [ "$enabled" -gt 0 ] || return + + if [ "$numdisks" = "0" ]; then + procd_open_instance + procd_set_param command /usr/bin/hd-idle + procd_append_param command -d -i 0 + fi + procd_append_param command -a $disk + procd_append_param command -i "$(compute_seconds $idle_time_interval $idle_time_unit)" + numdisks=$(( numdisks + 1 )) +} + +start_service() { + config_load "hd-idle" + + numdisks="0" + config_foreach hdidle_append "hd-idle" + + if [ "$numdisks" -gt 0 ]; then + procd_set_param respawn + procd_close_instance + fi +} diff --git a/utils/hdparm/Makefile b/utils/hdparm/Makefile new file mode 100644 index 0000000..f3b552c --- /dev/null +++ b/utils/hdparm/Makefile @@ -0,0 +1,42 @@ +# +# 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:=hdparm +PKG_VERSION:=9.50 +PKG_RELEASE:=1 +PKG_USE_MIPS16:=0 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/$(PKG_NAME) +PKG_MD5SUM:=d380062ad6c4b40076736efbb640f1f5 +PKG_MAINTAINER:=Richard Kunze +PKG_LICENSE:=BSD-Style Open Source License + +include $(INCLUDE_DIR)/package.mk + +TARGET_CFLAGS+=-D_GNU_SOURCE + +define Package/hdparm + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Disc + TITLE:=Hard disk drive configuration utilitity + URL:=http://sourceforge.net/projects/hdparm/ +endef + +define Package/hdparm/description + get/set SATA/IDE device parameters +endef + +define Package/hdparm/install + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/sbin +endef + +$(eval $(call BuildPackage,hdparm)) diff --git a/utils/hfsprogs/Makefile b/utils/hfsprogs/Makefile new file mode 100644 index 0000000..9c44a35 --- /dev/null +++ b/utils/hfsprogs/Makefile @@ -0,0 +1,81 @@ +# +# Copyright (C) 2015 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:=hfsprogs +PKG_VERSION:=332.25 +PKG_RELEASE:=1 + +PKG_LICENSE:=GPL-3.0+ +PKG_LICENSE_FILES:=COPYING + +PKG_MAINTAINER:=Florian Fainelli + +PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz +PKG_SOURCE_URL:=http://archive.ubuntu.com/ubuntu/pool/universe/h/$(PKG_NAME) +PKG_BUILD_DIR:=$(BUILD_DIR)/diskdev_cmds-$(PKG_VERSION) +PKG_MD5SUM:=261c3de5ec0dcf5244e3f60d79c1d6f1 +PKG_LICENSE:=APSL 2.0 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/hfsprogs/Default + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Filesystem + DEPENDS:=+libopenssl +endef + +define Package/hfsfsck + $(call Package/hfsprogs/Default) + TITLE:=fsck (fsck.hfs) utility from hfsprogs +endef + +define Package/mkhfs + $(call Package/hfsprogs/Default) + TITLE:=mkfs (mkfs.hfs) utility from hfsprogs +endef + +define Package/hfsfsck/description + Utilities to create and check HFS/HFS+ filesystems. + (fsck.hfs and fsck.hfsplus for checking integrity of HFS/HFS+ volumes) +endef + +define Package/mkhfs/description + Utilities to create and check HFS/HFS+ filesystems. + (mkfs.hfs and mkfs.hfsplus for creating HFS/HFS+ volumes) +endef + +define Build/Configure +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + -f Makefile.lnx \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS+="$(TARGET_CFLAGS) -I$(PKG_BUILD_DIR)/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1" \ + all +endef + +define Package/hfsfsck/install + $(INSTALL_DIR) $(1)/lib/functions/fsck + $(INSTALL_DATA) ./files/hfsfsck.sh $(1)/lib/functions/fsck/ + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/fsck_hfs.tproj/fsck_hfs $(1)/usr/sbin/fsck.hfsplus + (cd $(1)/usr/sbin; ln -sf fsck.hfsplus fsck.hfs;) +endef + +define Package/mkhfs/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/newfs_hfs.tproj/newfs_hfs $(1)/usr/sbin/mkfs.hfsplus + (cd $(1)/usr/sbin; ln -sf mkfs.hfsplus mkfs.hfs;) +endef + +$(eval $(call BuildPackage,hfsfsck)) +$(eval $(call BuildPackage,mkhfs)) diff --git a/utils/hfsprogs/files/hfsfsck.sh b/utils/hfsprogs/files/hfsfsck.sh new file mode 100644 index 0000000..8bcd2c1 --- /dev/null +++ b/utils/hfsprogs/files/hfsfsck.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# Copyright 2015 OpenWrt.org +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +fsck_hfsfsck() { + hfsfsck "$device" 2>&1 | logger -t "fstab: hfsfsck ($device)" + local status="$?" + case "$status" in + 0) ;; #success + 4) reboot;; + 8) echo "hfsfsck ($device): Warning! Uncorrected errors."| logger -t fstab + return 1 + ;; + *) echo "hfsfsck ($device): Error $status. Check not complete."| logger -t fstab;; + esac + return 0 +} + +fsck_hfs() { + fsck_hfsfsck "$@" +} + +fsck_hfsplus() { + fsck_hfsfsck "$@" +} + +append libmount_known_fsck "hfs" +append libmount_known_fsck "hfsplus" diff --git a/utils/hfsprogs/patches/0001-Create-short-Makefiles-for-Debian.patch b/utils/hfsprogs/patches/0001-Create-short-Makefiles-for-Debian.patch new file mode 100644 index 0000000..a8c4193 --- /dev/null +++ b/utils/hfsprogs/patches/0001-Create-short-Makefiles-for-Debian.patch @@ -0,0 +1,93 @@ +From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= +Date: Thu, 24 Oct 2013 01:11:21 -0200 +Subject: Create short Makefiles for Debian + +Create short Makefiles for compiling just the necessary parts for a +Debian-based (and possibly other distributions) HFS+ filesystem +utilities. +--- + Makefile.lnx | 8 ++++++++ + fsck_hfs.tproj/Makefile.lnx | 16 ++++++++++++++++ + fsck_hfs.tproj/dfalib/Makefile.lnx | 15 +++++++++++++++ + newfs_hfs.tproj/Makefile.lnx | 12 ++++++++++++ + 4 files changed, 51 insertions(+) + create mode 100644 Makefile.lnx + create mode 100644 fsck_hfs.tproj/Makefile.lnx + create mode 100644 fsck_hfs.tproj/dfalib/Makefile.lnx + create mode 100644 newfs_hfs.tproj/Makefile.lnx + +diff --git a/Makefile.lnx b/Makefile.lnx +new file mode 100644 +index 0000000..687d1e7 +--- /dev/null ++++ b/Makefile.lnx +@@ -0,0 +1,8 @@ ++CC := gcc ++CFLAGS += -I$(PWD)/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1 ++SUBDIRS := newfs_hfs.tproj fsck_hfs.tproj ++ ++all clean: ++ for d in $(SUBDIRS); do $(MAKE) -C $$d -f Makefile.lnx $@; done ++ ++export CC CFLAGS +diff --git a/fsck_hfs.tproj/Makefile.lnx b/fsck_hfs.tproj/Makefile.lnx +new file mode 100644 +index 0000000..977d7e8 +--- /dev/null ++++ b/fsck_hfs.tproj/Makefile.lnx +@@ -0,0 +1,16 @@ ++CFILES = fsck_hfs.c strings.c utilities.c cache.c fsck_debug.c ++OFILES = $(CFILES:.c=.o) ++ ++all: fsck_hfs ++ ++fsck_hfs: $(OFILES) dfalib/libdfa.a ++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OFILES) dfalib/libdfa.a ++ ++dfalib/libdfa.a: FORCE ++ $(MAKE) -C dfalib -f Makefile.lnx CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" libdfa.a ++ ++clean: ++ $(RM) fsck_hfs $(OFILES) ++ $(MAKE) -C dfalib -f Makefile.lnx clean ++ ++.PHONY : FORCE clean +diff --git a/fsck_hfs.tproj/dfalib/Makefile.lnx b/fsck_hfs.tproj/dfalib/Makefile.lnx +new file mode 100644 +index 0000000..8c07196 +--- /dev/null ++++ b/fsck_hfs.tproj/dfalib/Makefile.lnx +@@ -0,0 +1,15 @@ ++CFILES = hfs_endian.c BlockCache.c\ ++ BTree.c BTreeAllocate.c BTreeMiscOps.c \ ++ BTreeNodeOps.c BTreeScanner.c BTreeTreeOps.c\ ++ CatalogCheck.c HardLinkCheck.c\ ++ SBTree.c SControl.c SVerify1.c SVerify2.c\ ++ SRepair.c SRebuildCatalogBTree.c\ ++ SUtils.c SKeyCompare.c SDevice.c SExtents.c SAllocate.c\ ++ SCatalog.c SStubs.c VolumeBitmapCheck.c ++OFILES = $(CFILES:.c=.o) ++ ++libdfa.a: $(OFILES) ++ ar rc $@ $? ++ ++clean: ++ $(RM) $(OFILES) libdfa.a +diff --git a/newfs_hfs.tproj/Makefile.lnx b/newfs_hfs.tproj/Makefile.lnx +new file mode 100644 +index 0000000..58e6700 +--- /dev/null ++++ b/newfs_hfs.tproj/Makefile.lnx +@@ -0,0 +1,12 @@ ++CFILES = hfs_endian.c makehfs.c newfs_hfs.c ++OFILES = $(CFILES:.c=.o) ++ ++all: newfs_hfs ++ ++newfs_hfs: $(OFILES) ++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OFILES) -lcrypto ++ ++clean: ++ $(RM) newfs_hfs $(OFILES) ++ ++.PHONY : FORCE clean diff --git a/utils/hfsprogs/patches/0002-Add-exclude-Darwin-specific-code.patch b/utils/hfsprogs/patches/0002-Add-exclude-Darwin-specific-code.patch new file mode 100644 index 0000000..0046c36 --- /dev/null +++ b/utils/hfsprogs/patches/0002-Add-exclude-Darwin-specific-code.patch @@ -0,0 +1,1407 @@ +From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= +Date: Thu, 24 Oct 2013 01:11:21 -0200 +Subject: Add/exclude Darwin-specific code + +Modify some of the files so that they can be compiled without the +Apple owned frameworks in a Debian system (and possibly others). +--- + fsck_hfs.tproj/cache.c | 4 ++ + fsck_hfs.tproj/dfalib/BTree.c | 2 + + fsck_hfs.tproj/dfalib/BlockCache.c | 3 + + fsck_hfs.tproj/dfalib/SBTree.c | 2 + + fsck_hfs.tproj/dfalib/SDevice.c | 92 ++++++++++++++++++++--------- + fsck_hfs.tproj/dfalib/SKeyCompare.c | 2 + + fsck_hfs.tproj/dfalib/SRepair.c | 2 + + fsck_hfs.tproj/dfalib/SRuntime.h | 7 ++- + fsck_hfs.tproj/dfalib/SUtils.c | 5 +- + fsck_hfs.tproj/dfalib/SVerify2.c | 7 +++ + fsck_hfs.tproj/dfalib/Scavenger.h | 11 +++- + fsck_hfs.tproj/dfalib/hfs_endian.c | 4 ++ + fsck_hfs.tproj/dfalib/hfs_endian.h | 7 ++- + fsck_hfs.tproj/fsck_hfs.c | 61 +++++++++++++++---- + fsck_hfs.tproj/utilities.c | 8 ++- + include/missing.h | 115 ++++++++++++++++++++++++++++++++++++ + newfs_hfs.tproj/hfs_endian.c | 5 ++ + newfs_hfs.tproj/hfs_endian.h | 5 ++ + newfs_hfs.tproj/makehfs.c | 72 ++++++++++++++++------ + newfs_hfs.tproj/newfs_hfs.c | 74 ++++++++++++++++++++--- + newfs_hfs.tproj/newfs_hfs.h | 26 ++++---- + 21 files changed, 429 insertions(+), 85 deletions(-) + create mode 100644 include/missing.h + +diff --git a/fsck_hfs.tproj/cache.c b/fsck_hfs.tproj/cache.c +index be46195..527088a 100644 +--- a/fsck_hfs.tproj/cache.c ++++ b/fsck_hfs.tproj/cache.c +@@ -26,7 +26,11 @@ + #include + #include + #include ++#if LINUX ++#include "missing.h" ++#else + #include ++#endif /* __LINUX__ */ + #include + #include + #include +diff --git a/fsck_hfs.tproj/dfalib/BTree.c b/fsck_hfs.tproj/dfalib/BTree.c +index edd8301..7ad9fe0 100644 +--- a/fsck_hfs.tproj/dfalib/BTree.c ++++ b/fsck_hfs.tproj/dfalib/BTree.c +@@ -1705,7 +1705,9 @@ OSStatus BTGetInformation (SFCB *filePtr, + UInt16 version, + BTreeInfoRec *info ) + { ++#if !LINUX + #pragma unused (version) ++#endif + + BTreeControlBlockPtr btreePtr; + +diff --git a/fsck_hfs.tproj/dfalib/BlockCache.c b/fsck_hfs.tproj/dfalib/BlockCache.c +index 1bb952f..e3a28a2 100644 +--- a/fsck_hfs.tproj/dfalib/BlockCache.c ++++ b/fsck_hfs.tproj/dfalib/BlockCache.c +@@ -20,6 +20,9 @@ + * @APPLE_LICENSE_HEADER_END@ + */ + ++#if LINUX ++#include "missing.h" ++#endif + #include "SRuntime.h" + #include "Scavenger.h" + #include "../cache.h" +diff --git a/fsck_hfs.tproj/dfalib/SBTree.c b/fsck_hfs.tproj/dfalib/SBTree.c +index 2fbcd1d..cd81b13 100644 +--- a/fsck_hfs.tproj/dfalib/SBTree.c ++++ b/fsck_hfs.tproj/dfalib/SBTree.c +@@ -322,7 +322,9 @@ ErrorExit: + OSStatus + SetEndOfForkProc ( SFCB *filePtr, FSSize minEOF, FSSize maxEOF ) + { ++#if !LINUX + #pragma unused (maxEOF) ++#endif + + OSStatus result; + UInt32 actualSectorsAdded; +diff --git a/fsck_hfs.tproj/dfalib/SDevice.c b/fsck_hfs.tproj/dfalib/SDevice.c +index bf6f61c..9a46023 100644 +--- a/fsck_hfs.tproj/dfalib/SDevice.c ++++ b/fsck_hfs.tproj/dfalib/SDevice.c +@@ -2,7 +2,7 @@ + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ +- * ++ * + * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. This file contains Original Code and/or Modifications of + * Original Code as defined in and that are subject to the Apple Public +@@ -10,7 +10,7 @@ + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource and read it before using + * this file. +- * ++ * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, +@@ -18,7 +18,7 @@ + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License." +- * ++ * + * @APPLE_LICENSE_HEADER_END@ + */ + #include "SRuntime.h" +@@ -28,33 +28,71 @@ + #include + #include + #include +- ++#if LINUX ++#include ++#include ++#else + #include +- ++#endif /* LINUX */ + #else +- + #include + #include + #include + + #endif + +- + OSErr GetDeviceSize(int driveRefNum, UInt64 *numBlocks, UInt32 *blockSize) + { + #if BSD + UInt64 devBlockCount = 0; + int devBlockSize = 0; ++#if LINUX ++ struct stat stbuf; ++ ++ devBlockSize = 512; + ++#ifndef BLKGETSIZE ++#define BLKGETSIZE _IO(0x12,96) ++#endif ++#ifndef BLKGETSIZE64 ++#define BLKGETSIZE64 _IOR(0x12,114,size_t) ++#endif ++ if (fstat(driveRefNum, &stbuf) < 0){ ++ printf("Error: %s\n", strerror(errno)); ++ return(-1); ++ } ++ ++ if (S_ISREG(stbuf.st_mode)) { ++ devBlockCount = stbuf.st_size / 512; ++ } ++ else if (S_ISBLK(stbuf.st_mode)) { ++ unsigned long size; ++ u_int64_t size64; ++ if (!ioctl(driveRefNum, BLKGETSIZE64, &size64)) ++ devBlockCount = size64 / 512; ++ else if (!ioctl(driveRefNum, BLKGETSIZE, &size)) ++ devBlockCount = size; ++ else{ ++ printf("Error: %s\n", strerror(errno)); ++ return(-1); ++ } ++ ++ } ++ else{ ++ printf("Device is not a block device"); ++ return(-1); ++ } ++#elif BSD + if (ioctl(driveRefNum, DKIOCGETBLOCKCOUNT, &devBlockCount) < 0) { + printf("ioctl(DKIOCGETBLOCKCOUNT) for fd %d: %s\n", driveRefNum, strerror(errno)); + return (-1); + } +- ++ + if (ioctl(driveRefNum, DKIOCGETBLOCKSIZE, &devBlockSize) < 0) { + printf("ioctl(DKIOCGETBLOCKSIZE) for fd %d: %s\n", driveRefNum, strerror(errno)); + return (-1); + } ++#endif /* BSD */ + + if (devBlockSize != 512) { + *numBlocks = (devBlockCount * (UInt64)devBlockSize) / 512; +@@ -70,24 +108,24 @@ OSErr GetDeviceSize(int driveRefNum, UInt64 *numBlocks, UInt32 *blockSize) + { + /* return format list status code */ + kFmtLstCode = 6, +- ++ + /* reference number of .SONY driver */ + kSonyRefNum = 0xfffb, +- ++ + /* values returned by DriveStatus in DrvSts.twoSideFmt */ + kSingleSided = 0, + kDoubleSided = -1, + kSingleSidedSize = 800, /* 400K */ + kDoubleSidedSize = 1600, /* 800K */ +- ++ + /* values in DrvQEl.qType */ + kWordDrvSiz = 0, + kLongDrvSiz = 1, +- ++ + /* more than enough formatListRecords */ + kMaxFormatListRecs = 16 + }; +- ++ + ParamBlockRec pb; + FormatListRec formatListRecords[kMaxFormatListRecs]; + DrvSts status; +@@ -95,22 +133,22 @@ OSErr GetDeviceSize(int driveRefNum, UInt64 *numBlocks, UInt32 *blockSize) + OSErr result; + unsigned long blocks = 0; + +- ++ + /* Attempt to get the drive's format list. */ + /* (see the Technical Note "What Your Sony Drives For You") */ +- ++ + pb.cntrlParam.ioVRefNum = driveQElementPtr->dQDrive; + pb.cntrlParam.ioCRefNum = driveQElementPtr->dQRefNum; + pb.cntrlParam.csCode = kFmtLstCode; + pb.cntrlParam.csParam[0] = kMaxFormatListRecs; + *(long *)&pb.cntrlParam.csParam[1] = (long)&formatListRecords[0]; +- ++ + result = PBStatusSync(&pb); +- ++ + if ( result == noErr ) + { + /* The drive supports ReturnFormatList status call. */ +- ++ + /* Get the current disk's size. */ + for( formatListRecIndex = 0; + formatListRecIndex < pb.cntrlParam.csParam[0]; +@@ -131,7 +169,7 @@ OSErr GetDeviceSize(int driveRefNum, UInt64 *numBlocks, UInt32 *blockSize) + else if ( driveQElementPtr->dQRefNum == (short)kSonyRefNum ) + { + /* The drive is a non-SuperDrive floppy which only supports 400K and 800K disks */ +- ++ + result = DriveStatus(driveQElementPtr->dQDrive, &status); + if ( result == noErr ) + { +@@ -140,11 +178,11 @@ OSErr GetDeviceSize(int driveRefNum, UInt64 *numBlocks, UInt32 *blockSize) + case kSingleSided: + blocks = kSingleSidedSize; + break; +- ++ + case kDoubleSided: + blocks = kDoubleSidedSize; + break; +- ++ + default: // This should never happen + result = paramErr; + break; +@@ -155,20 +193,20 @@ OSErr GetDeviceSize(int driveRefNum, UInt64 *numBlocks, UInt32 *blockSize) + { + /* The drive is not a floppy and it doesn't support ReturnFormatList */ + /* so use the dQDrvSz field(s) */ +- ++ + result = noErr; /* reset result */ +- ++ + switch ( driveQElementPtr->qType ) + { + case kWordDrvSiz: + blocks = driveQElementPtr->dQDrvSz; + break; +- ++ + case kLongDrvSiz: + blocks = ((unsigned long)driveQElementPtr->dQDrvSz2 << 16) + + driveQElementPtr->dQDrvSz; + break; +- ++ + default: // This should never happen + result = paramErr; + break; +@@ -177,7 +215,7 @@ OSErr GetDeviceSize(int driveRefNum, UInt64 *numBlocks, UInt32 *blockSize) + + *numBlocks = blocks; + *blockSize = 512; +- ++ + return( result ); + #endif + } +@@ -188,7 +226,7 @@ OSErr DeviceRead(int device, int drive, void* buffer, SInt64 offset, UInt32 reqB + #if BSD + off_t seek_off; + ssize_t nbytes; +- ++ + *actBytes = 0; + + seek_off = lseek(device, offset, SEEK_SET); +diff --git a/fsck_hfs.tproj/dfalib/SKeyCompare.c b/fsck_hfs.tproj/dfalib/SKeyCompare.c +index 46e145f..18d99c5 100644 +--- a/fsck_hfs.tproj/dfalib/SKeyCompare.c ++++ b/fsck_hfs.tproj/dfalib/SKeyCompare.c +@@ -454,7 +454,9 @@ SInt32 CompareExtentKeysPlus( const HFSPlusExtentKey *searchKey, const HFSPlusEx + * The name portion of the key is compared using a 16-bit binary comparison. + * This is called from the b-tree code. + */ ++#if !LINUX + __private_extern__ ++#endif + SInt32 + CompareAttributeKeys(const AttributeKey *searchKey, const AttributeKey *trialKey) + { +diff --git a/fsck_hfs.tproj/dfalib/SRepair.c b/fsck_hfs.tproj/dfalib/SRepair.c +index 01c1a10..8eb759c 100644 +--- a/fsck_hfs.tproj/dfalib/SRepair.c ++++ b/fsck_hfs.tproj/dfalib/SRepair.c +@@ -1617,7 +1617,9 @@ Output: + + static OSErr FixWrapperExtents( SGlobPtr GPtr, RepairOrderPtr p ) + { ++#if !LINUX + #pragma unused (p) ++#endif + + OSErr err; + HFSMasterDirectoryBlock *mdb; +diff --git a/fsck_hfs.tproj/dfalib/SRuntime.h b/fsck_hfs.tproj/dfalib/SRuntime.h +index 646917b..770e3ef 100644 +--- a/fsck_hfs.tproj/dfalib/SRuntime.h ++++ b/fsck_hfs.tproj/dfalib/SRuntime.h +@@ -27,8 +27,11 @@ + #define __SRUNTIME__ + + #if BSD +- ++#if LINUX ++#include "missing.h" ++#else + #include ++#endif + #include + #include + #include +@@ -91,10 +94,12 @@ typedef const unsigned char * ConstStr255Param; + + typedef u_int32_t HFSCatalogNodeID; + ++#if !LINUX + enum { + false = 0, + true = 1 + }; ++#endif + + /* OS error codes */ + enum { +diff --git a/fsck_hfs.tproj/dfalib/SUtils.c b/fsck_hfs.tproj/dfalib/SUtils.c +index 72035f0..6e9253e 100644 +--- a/fsck_hfs.tproj/dfalib/SUtils.c ++++ b/fsck_hfs.tproj/dfalib/SUtils.c +@@ -380,7 +380,8 @@ void InvalidateCalculatedVolumeBitMap( SGlobPtr GPtr ) + // GPtr->realVCB Real in-memory vcb + //------------------------------------------------------------------------------ + +-#if !BSD ++#if BSD ++#if !LINUX + OSErr GetVolumeFeatures( SGlobPtr GPtr ) + { + OSErr err; +@@ -418,7 +419,7 @@ OSErr GetVolumeFeatures( SGlobPtr GPtr ) + return( noErr ); + } + #endif +- ++#endif + + + /*------------------------------------------------------------------------------- +diff --git a/fsck_hfs.tproj/dfalib/SVerify2.c b/fsck_hfs.tproj/dfalib/SVerify2.c +index 6a47935..c68f3d8 100644 +--- a/fsck_hfs.tproj/dfalib/SVerify2.c ++++ b/fsck_hfs.tproj/dfalib/SVerify2.c +@@ -32,7 +32,9 @@ + */ + + #include ++#if !LINUX + #include ++#endif + + #include "BTree.h" + #include "BTreePrivate.h" +@@ -1354,8 +1356,13 @@ OSErr CompareVolumeHeader( SGlobPtr GPtr, HFSPlusVolumeHeader *volumeHeader ) + * clump size for read-only media is irrelevant we skip the clump size + * check to avoid non useful warnings. + */ ++#if LINUX ++ // FIXME ++ isWriteable = 1; ++#else + isWriteable = 0; + ioctl( GPtr->DrvNum, DKIOCISWRITABLE, &isWriteable ); ++#endif + if ( isWriteable != 0 && + volumeHeader->catalogFile.clumpSize != vcb->vcbCatalogFile->fcbClumpSize ) { + PrintError(GPtr, E_InvalidClumpSize, 0); +diff --git a/fsck_hfs.tproj/dfalib/Scavenger.h b/fsck_hfs.tproj/dfalib/Scavenger.h +index cf53970..edb3a80 100644 +--- a/fsck_hfs.tproj/dfalib/Scavenger.h ++++ b/fsck_hfs.tproj/dfalib/Scavenger.h +@@ -37,11 +37,16 @@ + #include "../fsck_debug.h" + + #include ++#if LINUX ++#define XATTR_MAXNAMELEN 127 ++#include ++#else + #include + #include + #include +-#include + #include ++#endif ++#include + + #ifdef __cplusplus + extern "C" { +@@ -1465,4 +1470,8 @@ extern int AllocateContigBitmapBits (SVCB *vcb, UInt32 numBlocks, UInt32 *actua + }; + #endif + ++/* #if LINUX ++#undef XATTR_MAXNAMELEN ++#endif */ ++ + #endif /* __SCAVENGER__ */ +diff --git a/fsck_hfs.tproj/dfalib/hfs_endian.c b/fsck_hfs.tproj/dfalib/hfs_endian.c +index 7fa5385..69500c1 100755 +--- a/fsck_hfs.tproj/dfalib/hfs_endian.c ++++ b/fsck_hfs.tproj/dfalib/hfs_endian.c +@@ -31,7 +31,11 @@ + #include + #include + ++#if LINUX ++#include "missing.h" ++#else + #include ++#endif + #include + + #include "Scavenger.h" +diff --git a/fsck_hfs.tproj/dfalib/hfs_endian.h b/fsck_hfs.tproj/dfalib/hfs_endian.h +index 52d0c3a..0763d9d 100755 +--- a/fsck_hfs.tproj/dfalib/hfs_endian.h ++++ b/fsck_hfs.tproj/dfalib/hfs_endian.h +@@ -27,9 +27,14 @@ + * + * This file prototypes endian swapping routines for the HFS/HFS Plus + * volume format. +- */ ++*/ + #include ++#if LINUX ++#include ++#include ++#else + #include ++#endif + #include "SRuntime.h" + + /*********************/ +diff --git a/fsck_hfs.tproj/fsck_hfs.c b/fsck_hfs.tproj/fsck_hfs.c +index 90532fd..f1a18bd 100644 +--- a/fsck_hfs.tproj/fsck_hfs.c ++++ b/fsck_hfs.tproj/fsck_hfs.c +@@ -24,10 +24,14 @@ + #include + #include + #include ++#if !LINUX + #include ++#endif + #include + #include ++#if !LINUX + #include ++#endif + + #include + +@@ -195,8 +199,12 @@ main(argc, argv) + if (guiControl) + debug = 0; /* debugging is for command line only */ + ++#if LINUX ++// FIXME ++#else + if (signal(SIGINT, SIG_IGN) != SIG_IGN) + (void)signal(SIGINT, catch); ++#endif + + if (argc < 1) { + (void) fprintf(stderr, "%s: missing special-device\n", progname); +@@ -218,7 +226,9 @@ checkfilesys(char * filesys) + int chkLev, repLev, logLev; + int blockDevice_fd, canWrite; + char *unraw, *mntonname; ++#if !LINUX + struct statfs *fsinfo; ++#endif + int fs_fd=-1; // fd to the root-dir of the fs we're checking (only w/lfag == 1) + + flags = 0; +@@ -227,7 +237,9 @@ checkfilesys(char * filesys) + canWrite = 0; + unraw = NULL; + mntonname = NULL; +- ++#if LINUX ++ // FIXME ++#else + if (lflag) { + result = getmntinfo(&fsinfo, MNT_NOWAIT); + +@@ -257,10 +269,10 @@ checkfilesys(char * filesys) + } + } + } +- ++#endif + if (debug && preen) + pwarn("starting\n"); +- ++ + if (setup( filesys, &blockDevice_fd, &canWrite ) == 0) { + if (preen) + pfatal("CAN'T CHECK FILE SYSTEM."); +@@ -278,7 +290,7 @@ checkfilesys(char * filesys) + repLev = kMajorRepairs; + logLev = kVerboseLog; + +- if (yflag) ++ if (yflag) + repLev = kMajorRepairs; + + if (quick) { +@@ -298,16 +310,16 @@ checkfilesys(char * filesys) + + if (nflag) + repLev = kNeverRepair; +- ++ + if ( rebuildCatalogBtree ) { + chkLev = kPartialCheck; + repLev = kForceRepairs; // this will force rebuild of catalog B-Tree file + } +- ++ + /* + * go check HFS volume... + */ +- result = CheckHFS( fsreadfd, fswritefd, chkLev, repLev, logLev, ++ result = CheckHFS( fsreadfd, fswritefd, chkLev, repLev, logLev, + guiControl, lostAndFoundMode, canWrite, &fsmodified ); + if (!hotroot) { + ckfini(1); +@@ -330,6 +342,9 @@ checkfilesys(char * filesys) + } + } + } else { ++#if LINUX ++ // FIXME ++#else + struct statfs stfs_buf; + /* + * Check to see if root is mounted read-write. +@@ -339,19 +354,25 @@ checkfilesys(char * filesys) + else + flags = 0; + ckfini(flags & MNT_RDONLY); ++#endif + } + + /* XXX free any allocated memory here */ + + if (hotroot && fsmodified) { ++#if !LINUX + struct hfs_mount_args args; ++#endif + /* + * We modified the root. Do a mount update on + * it, unless it is read-write, so we can continue. + */ + if (!preen) + printf("\n***** FILE SYSTEM WAS MODIFIED *****\n"); +- if (flags & MNT_RDONLY) { ++#if LINUX ++ // FIXME ++#else ++ if (flags & MNT_RDONLY) { + bzero(&args, sizeof(args)); + flags |= MNT_UPDATE | MNT_RELOAD; + if (mount("hfs", "/", flags, &args) == 0) { +@@ -359,6 +380,7 @@ checkfilesys(char * filesys) + goto ExitThisRoutine; + } + } ++#endif + if (!preen) + printf("\n***** REBOOT NOW *****\n"); + sync(); +@@ -367,7 +389,7 @@ checkfilesys(char * filesys) + } + + result = (result == 0) ? 0 : EEXIT; +- ++ + ExitThisRoutine: + if (lflag) { + fcntl(fs_fd, F_THAW_FS, NULL); +@@ -401,16 +423,18 @@ setup( char *dev, int *blockDevice_fdPtr, int *canWritePtr ) + fswritefd = -1; + *blockDevice_fdPtr = -1; + *canWritePtr = 0; +- ++ + if (stat(dev, &statb) < 0) { + printf("Can't stat %s: %s\n", dev, strerror(errno)); + return (0); + } ++#if !LINUX + if ((statb.st_mode & S_IFMT) != S_IFCHR) { + pfatal("%s is not a character device", dev); + if (reply("CONTINUE") == 0) + return (0); + } ++#endif + if ((fsreadfd = open(dev, O_RDONLY)) < 0) { + printf("Can't open %s: %s\n", dev, strerror(errno)); + return (0); +@@ -419,7 +443,7 @@ setup( char *dev, int *blockDevice_fdPtr, int *canWritePtr ) + /* attempt to get write access to the block device and if not check if volume is */ + /* mounted read-only. */ + getWriteAccess( dev, blockDevice_fdPtr, canWritePtr ); +- ++ + if (preen == 0 && !guiControl) + printf("** %s", dev); + if (nflag || (fswritefd = open(dev, O_WRONLY)) < 0) { +@@ -433,10 +457,14 @@ setup( char *dev, int *blockDevice_fdPtr, int *canWritePtr ) + printf("\n"); + + /* Get device block size to initialize cache */ ++#if LINUX ++ devBlockSize = 512; ++#else + if (ioctl(fsreadfd, DKIOCGETBLOCKSIZE, &devBlockSize) < 0) { + pfatal ("Can't get device block size\n"); + return (0); + } ++#endif + + /* calculate the cache block size and total blocks */ + if (CalculateCacheSize(userCacheSize, &cacheBlockSize, &cacheTotalBlocks, debug) != 0) { +@@ -463,11 +491,15 @@ setup( char *dev, int *blockDevice_fdPtr, int *canWritePtr ) + + static void getWriteAccess( char *dev, int *blockDevice_fdPtr, int *canWritePtr ) + { ++#if !LINUX + int i; + int myMountsCount; ++#endif + void * myPtr; + char * myCharPtr; ++#if !LINUX + struct statfs * myBufPtr; ++#endif + void * myNamePtr; + + myPtr = NULL; +@@ -490,6 +522,9 @@ static void getWriteAccess( char *dev, int *blockDevice_fdPtr, int *canWritePtr + } + + // get count of mounts then get the info for each ++#if LINUX ++ // FIXME ++#else + myMountsCount = getfsstat( NULL, 0, MNT_NOWAIT ); + if ( myMountsCount < 0 ) + goto ExitThisRoutine; +@@ -513,8 +548,8 @@ static void getWriteAccess( char *dev, int *blockDevice_fdPtr, int *canWritePtr + } + myBufPtr++; + } +- *canWritePtr = 1; // single user will get us here, f_mntfromname is not /dev/diskXXXX +- ++#endif ++ *canWritePtr = 1; // single user will get us here, f_mntfromname is not /dev/diskXXXX + ExitThisRoutine: + if ( myPtr != NULL ) + free( myPtr ); +diff --git a/fsck_hfs.tproj/utilities.c b/fsck_hfs.tproj/utilities.c +index ee41bef..8e1cd77 100644 +--- a/fsck_hfs.tproj/utilities.c ++++ b/fsck_hfs.tproj/utilities.c +@@ -183,12 +183,14 @@ retry: + printf("Can't stat %s\n", raw); + return (origname); + } ++#if !LINUX + if ((stchar.st_mode & S_IFMT) == S_IFCHR) { + return (raw); + } else { + printf("%s is not a character device\n", raw); + return (origname); + } ++#endif + } else if ((stblock.st_mode & S_IFMT) == S_IFCHR && !retried) { + newname = unrawname(newname); + retried++; +@@ -214,7 +216,11 @@ rawname(char *name) + *dp = 0; + (void)strcpy(rawbuf, name); + *dp = '/'; +- (void)strcat(rawbuf, "/r"); ++#if LINUX ++ (void)strcat(rawbuf, "/"); ++#else ++ (void)strcat(rawbuf,"/r"); ++#endif + (void)strcat(rawbuf, &dp[1]); + + return (rawbuf); +diff --git a/include/missing.h b/include/missing.h +new file mode 100644 +index 0000000..0a859c4 +--- /dev/null ++++ b/include/missing.h +@@ -0,0 +1,114 @@ ++#ifndef _MISSING_H_ ++#define _MISSING_H_ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#define MAXBSIZE (256 * 4096) ++ ++#ifndef true ++#define true 1 ++#endif ++#ifndef false ++#define false 0 ++#endif ++ ++/* Mac types */ ++ ++/* 8 Bit */ ++#ifndef UInt8 ++#define UInt8 uint8_t ++#endif ++#ifndef u_int8_t ++#define u_int8_t UInt8 ++#endif ++#ifndef SInt8 ++#define SInt8 int8_t ++#endif ++ ++/* 16 Bit */ ++#ifndef UInt16 ++#define UInt16 uint16_t ++#endif ++#ifndef u_int16_t ++#define u_int16_t UInt16 ++#endif ++#ifndef SInt16 ++#define SInt16 int16_t ++#endif ++ ++/* 32 Bit */ ++#ifndef UInt32 ++#define UInt32 uint32_t ++#endif ++#ifndef u_int32_t ++#define u_int32_t UInt32 ++#endif ++#ifndef SInt32 ++#define SInt32 int32_t ++#endif ++ ++/* 64 Bit */ ++#ifndef UInt64 ++#define UInt64 uint64_t ++#endif ++#ifndef u_int64_t ++#define u_int64_t UInt64 ++#endif ++#ifndef SInt64 ++#define SInt64 int64_t ++#endif ++ ++#define UniChar u_int16_t ++#define Boolean u_int8_t ++ ++#define UF_NODUMP 0x00000001 ++ ++/* syslimits.h */ ++#define NAME_MAX 255 ++ ++/* Byteswap stuff */ ++#define NXSwapHostLongToBig(x) cpu_to_be64(x) ++#define NXSwapBigShortToHost(x) be16_to_cpu(x) ++#define OSSwapBigToHostInt16(x) be16_to_cpu(x) ++#define NXSwapBigLongToHost(x) be32_to_cpu(x) ++#define OSSwapBigToHostInt32(x) be32_to_cpu(x) ++#define NXSwapBigLongLongToHost(x) be64_to_cpu(x) ++#define OSSwapBigToHostInt64(x) be64_to_cpu(x) ++ ++#if __BYTE_ORDER == __LITTLE_ENDIAN ++/* Big Endian Swaps */ ++#ifndef be16_to_cpu ++#define be16_to_cpu(x) bswap_16(x) ++#endif ++#ifndef be32_to_cpu ++#define be32_to_cpu(x) bswap_32(x) ++#endif ++#ifndef be64_to_cpu ++#define be64_to_cpu(x) bswap_64(x) ++#endif ++#ifndef cpu_to_be64 ++#define cpu_to_be64(x) bswap_64(x) ++#endif ++#elif __BYTE_ORDER == __BIG_ENDIAN ++/* Big endian doesn't swap */ ++#ifndef be16_to_cpu ++#define be16_to_cpu(x) (x) ++#endif ++#ifndef be32_to_cpu ++#define be32_to_cpu(x) (x) ++#endif ++#ifndef be64_to_cpu ++#define be64_to_cpu(x) (x) ++#endif ++#ifndef cpu_to_be64 ++#define cpu_to_be64(x) (x) ++#endif ++#endif ++ ++#define KAUTH_FILESEC_XATTR "com.apple.system.Security" ++ ++#endif +diff --git a/newfs_hfs.tproj/hfs_endian.c b/newfs_hfs.tproj/hfs_endian.c +index 117b7f8..fdf7353 100644 +--- a/newfs_hfs.tproj/hfs_endian.c ++++ b/newfs_hfs.tproj/hfs_endian.c +@@ -30,7 +30,12 @@ + #include + #include + ++#if LINUX ++#include "missing.h" ++#else + #include ++#endif ++ + #include + + #include "hfs_endian.h" +diff --git a/newfs_hfs.tproj/hfs_endian.h b/newfs_hfs.tproj/hfs_endian.h +index 8d9d01d..5c7ff57 100644 +--- a/newfs_hfs.tproj/hfs_endian.h ++++ b/newfs_hfs.tproj/hfs_endian.h +@@ -29,7 +29,12 @@ + * volume format. + */ + #include ++#if LINUX ++#include ++#include ++#else + #include ++#endif + + /*********************/ + /* BIG ENDIAN Macros */ +diff --git a/newfs_hfs.tproj/makehfs.c b/newfs_hfs.tproj/makehfs.c +index 085222f..7609779 100644 +--- a/newfs_hfs.tproj/makehfs.c ++++ b/newfs_hfs.tproj/makehfs.c +@@ -31,10 +31,16 @@ + #include + #include + #include ++#if LINUX ++#include ++#include "missing.h" ++#endif + #include + #include + #include ++#if !LINUX + #include ++#endif + + #include + #include +@@ -47,13 +53,14 @@ + + #include + ++#if !LINUX + #include + + #include + #include + + extern Boolean _CFStringGetFileSystemRepresentation(CFStringRef string, UInt8 *buffer, CFIndex maxBufLen); +- ++#endif + + #include + #include +@@ -129,7 +136,9 @@ static UInt32 Largest __P((UInt32 a, UInt32 b, UInt32 c, UInt32 d )); + static void MarkBitInAllocationBuffer __P((HFSPlusVolumeHeader *header, + UInt32 allocationBlock, void* sectorBuffer, UInt32 *sector)); + ++#if !LINUX + static UInt32 GetDefaultEncoding(); ++#endif + + static UInt32 UTCToLocal __P((UInt32 utcTime)); + +@@ -158,11 +167,14 @@ void SETOFFSET (void *buffer, UInt16 btNodeSize, SInt16 recOffset, SInt16 vecOff + + #define ROUNDUP(x, u) (((x) % (u) == 0) ? (x) : ((x)/(u) + 1) * (u)) + +-#define ENCODING_TO_BIT(e) \ ++#if LINUX ++#define ENCODING_TO_BIT(e) (e) ++#else ++#define ENCODING_TO_BIT(e) + ((e) < 48 ? (e) : \ + ((e) == kCFStringEncodingMacUkrainian ? 48 : \ + ((e) == kCFStringEncodingMacFarsi ? 49 : 0))) +- ++#endif + /* + * make_hfs + * +@@ -528,6 +540,7 @@ InitMDB(hfsparams_t *defaults, UInt32 driveBlocks, HFS_MDB *mdbp) + * Map UTF-8 input into a Mac encoding. + * On conversion errors "untitled" is used as a fallback. + */ ++#if !LINUX + { + UniChar unibuf[kHFSMaxVolumeNameChars]; + CFStringRef cfstr; +@@ -553,7 +566,11 @@ InitMDB(hfsparams_t *defaults, UInt32 driveBlocks, HFS_MDB *mdbp) + bcopy(&mdbp->drVN[1], defaults->volumeName, mdbp->drVN[0]); + defaults->volumeName[mdbp->drVN[0]] = '\0'; + } ++#endif + /* Save the encoding hint in the Finder Info (field 4). */ ++ mdbp->drVN[0] = strlen(defaults->volumeName); ++ bcopy(defaults->volumeName,&mdbp->drVN[1],mdbp->drVN[0]); ++ + mdbp->drFndrInfo[4] = SET_HFS_TEXT_ENCODING(defaults->encodingHint); + + mdbp->drWrCnt = kWriteSeqNum; +@@ -1100,9 +1117,11 @@ InitCatalogRoot_HFSPlus(const hfsparams_t *dp, const HFSPlusVolumeHeader *header + UInt16 nodeSize; + SInt16 offset; + UInt32 unicodeBytes; ++#if !LINUX + UInt8 canonicalName[256]; + CFStringRef cfstr; + Boolean cfOK; ++#endif + int index = 0; + + nodeSize = dp->catalogNodeSize; +@@ -1122,7 +1141,9 @@ InitCatalogRoot_HFSPlus(const hfsparams_t *dp, const HFSPlusVolumeHeader *header + * First record is always the root directory... + */ + ckp = (HFSPlusCatalogKey *)((UInt8 *)buffer + offset); +- ++#if LINUX ++ ConvertUTF8toUnicode(dp->volumeName, sizeof(ckp->nodeName.unicode), ckp->nodeName.unicode, &ckp->nodeName.length); ++#else + /* Use CFString functions to get a HFSPlus Canonical name */ + cfstr = CFStringCreateWithCString(kCFAllocatorDefault, (char *)dp->volumeName, kCFStringEncodingUTF8); + cfOK = _CFStringGetFileSystemRepresentation(cfstr, canonicalName, sizeof(canonicalName)); +@@ -1139,6 +1160,7 @@ InitCatalogRoot_HFSPlus(const hfsparams_t *dp, const HFSPlusVolumeHeader *header + dp->volumeName, kDefaultVolumeNameStr); + } + CFRelease(cfstr); ++#endif + ckp->nodeName.length = SWAP_BE16 (ckp->nodeName.length); + + unicodeBytes = sizeof(UniChar) * SWAP_BE16 (ckp->nodeName.length); +@@ -1821,15 +1843,15 @@ WriteBuffer(const DriveInfo *driveInfo, UInt64 startingSector, UInt32 byteCount, + off_t sector; + + if ((byteCount % driveInfo->sectorSize) != 0) +- errx(1, "WriteBuffer: byte count %ld is not sector size multiple", byteCount); ++ errx(1, "WriteBuffer: byte count %i is not sector size multiple", byteCount); + + sector = driveInfo->sectorOffset + startingSector; + + if (lseek(driveInfo->fd, sector * driveInfo->sectorSize, SEEK_SET) < 0) +- err(1, "seek (sector %qd)", sector); ++ err(1, "seek (sector %lld)", sector); + + if (write(driveInfo->fd, buffer, byteCount) != byteCount) +- err(1, "write (sector %qd, %ld bytes)", sector, byteCount); ++ err(1, "write (sector %lld, %i bytes)", sector, byteCount); + } + + +@@ -1913,7 +1935,7 @@ DivideAndRoundUp(UInt32 numerator, UInt32 denominator) + return quotient; + } + +- ++#if !LINUX + #define __kCFUserEncodingFileName ("/.CFUserTextEncoding") + + static UInt32 +@@ -1939,7 +1961,7 @@ GetDefaultEncoding() + } + return 0; + } +- ++#endif + + static int + ConvertUTF8toUnicode(const UInt8* source, UInt32 bufsize, UniChar* unibuf, +@@ -2006,6 +2028,9 @@ ConvertUTF8toUnicode(const UInt8* source, UInt32 bufsize, UniChar* unibuf, + static int + getencodinghint(unsigned char *name) + { ++#if LINUX ++ return(0); ++#else + int mib[3]; + size_t buflen = sizeof(int); + struct vfsconf vfc; +@@ -2023,7 +2048,8 @@ getencodinghint(unsigned char *name) + return (hint); + error: + hint = GetDefaultEncoding(); +- return (hint); ++ return (0); ++#endif + } + + +@@ -2034,12 +2060,14 @@ void GenerateVolumeUUID(VolumeUUID *newVolumeID) { + unsigned char digest[20]; + time_t now; + clock_t uptime; +- int mib[2]; +- int sysdata; +- char sysctlstring[128]; + size_t datalen; + double sysloadavg[3]; ++#if !LINUX ++ int sysdata; ++ int mib[2]; ++ char sysctlstring[128]; + struct vmtotal sysvmtotal; ++#endif + + do { + /* Initialize the SHA-1 context for processing: */ +@@ -2052,52 +2080,58 @@ void GenerateVolumeUUID(VolumeUUID *newVolumeID) { + SHA1_Update(&context, &uptime, sizeof(uptime)); + + /* The kernel's boot time: */ ++#if !LINUX + mib[0] = CTL_KERN; + mib[1] = KERN_BOOTTIME; + datalen = sizeof(sysdata); + sysctl(mib, 2, &sysdata, &datalen, NULL, 0); + SHA1_Update(&context, &sysdata, datalen); +- ++#endif + /* The system's host id: */ ++#if !LINUX + mib[0] = CTL_KERN; + mib[1] = KERN_HOSTID; + datalen = sizeof(sysdata); + sysctl(mib, 2, &sysdata, &datalen, NULL, 0); + SHA1_Update(&context, &sysdata, datalen); +- ++#endif + /* The system's host name: */ ++#if !LINUX + mib[0] = CTL_KERN; + mib[1] = KERN_HOSTNAME; + datalen = sizeof(sysctlstring); + sysctl(mib, 2, sysctlstring, &datalen, NULL, 0); + SHA1_Update(&context, sysctlstring, datalen); +- ++#endif + /* The running kernel's OS release string: */ ++#if !LINUX + mib[0] = CTL_KERN; + mib[1] = KERN_OSRELEASE; + datalen = sizeof(sysctlstring); + sysctl(mib, 2, sysctlstring, &datalen, NULL, 0); + SHA1_Update(&context, sysctlstring, datalen); +- ++#endif + /* The running kernel's version string: */ ++#if !LINUX + mib[0] = CTL_KERN; + mib[1] = KERN_VERSION; + datalen = sizeof(sysctlstring); + sysctl(mib, 2, sysctlstring, &datalen, NULL, 0); + SHA1_Update(&context, sysctlstring, datalen); +- ++#endif + /* The system's load average: */ + datalen = sizeof(sysloadavg); + getloadavg(sysloadavg, 3); + SHA1_Update(&context, &sysloadavg, datalen); + + /* The system's VM statistics: */ ++#if !LINUX + mib[0] = CTL_VM; + mib[1] = VM_METER; + datalen = sizeof(sysvmtotal); + sysctl(mib, 2, &sysvmtotal, &datalen, NULL, 0); + SHA1_Update(&context, &sysvmtotal, datalen); +- ++#endif + /* The current GMT (26 ASCII characters): */ + time(&now); + strncpy(randomInputBuffer, asctime(gmtime(&now)), 26); /* "Mon Mar 27 13:46:26 2000" */ +diff --git a/newfs_hfs.tproj/newfs_hfs.c b/newfs_hfs.tproj/newfs_hfs.c +index c4176a9..bf2ed21 100644 +--- a/newfs_hfs.tproj/newfs_hfs.c ++++ b/newfs_hfs.tproj/newfs_hfs.c +@@ -38,8 +38,13 @@ + #include + #include + #include ++#if LINUX ++#include ++#endif + ++#if !LINUX + #include ++#endif + + #include + #include "newfs_hfs.h" +@@ -73,7 +78,9 @@ static void usage __P((void)); + + char *progname; + char gVolumeName[kHFSPlusMaxFileNameChars + 1] = {kDefaultVolumeNameStr}; ++#if !LINUX + char rawdevice[MAXPATHLEN]; ++#endif + char blkdevice[MAXPATHLEN]; + UInt32 gBlockSize = 0; + UInt32 gNextCNID = kHFSFirstUserCatalogNodeID; +@@ -158,8 +165,10 @@ main(argc, argv) + extern int optind; + int ch; + int forceHFS; ++#if !LINUX + char *cp, *special; + struct statfs *mp; ++#endif + int n; + + if ((progname = strrchr(*argv, '/'))) +@@ -260,16 +269,19 @@ main(argc, argv) + usage(); + } + +- argc -= optind; +- argv += optind; ++ argc -= optind; ++ argv += optind; + +- if (gPartitionSize != 0) { +- if (argc != 0) +- usage(); +- } else { +- if (argc != 1) +- usage(); ++ if (gPartitionSize != 0) { ++ if (argc != 0) ++ usage(); ++ } else { ++ if (argc != 1) ++ usage(); + ++#if LINUX ++ (void) sprintf(blkdevice, "%s", argv[0]); ++#else + special = argv[0]; + cp = strrchr(special, '/'); + if (cp != 0) +@@ -278,6 +290,7 @@ main(argc, argv) + special++; + (void) sprintf(rawdevice, "%sr%s", _PATH_DEV, special); + (void) sprintf(blkdevice, "%s%s", _PATH_DEV, special); ++#endif + } + + if (forceHFS && gJournaled) { +@@ -301,6 +314,9 @@ main(argc, argv) + /* + * Check if target device is aready mounted + */ ++#if LINUX ++ // FIXME ++#else + n = getmntinfo(&mp, MNT_NOWAIT); + if (n == 0) + fatal("%s: getmntinfo: %s", blkdevice, strerror(errno)); +@@ -310,15 +326,20 @@ main(argc, argv) + fatal("%s is mounted on %s", blkdevice, mp->f_mntonname); + ++mp; + } ++#endif + } + +- if (hfs_newfs(rawdevice, forceHFS, true) < 0) { ++ if (hfs_newfs(blkdevice, forceHFS, true) < 0) { ++#if LINUX ++ err(1, NULL); ++#else + /* On ENXIO error use the block device (to get de-blocking) */ + if (errno == ENXIO) { + if (hfs_newfs(blkdevice, forceHFS, false) < 0) + err(1, NULL); + } else + err(1, NULL); ++#endif + } + + exit(0); +@@ -506,7 +527,9 @@ hfs_newfs(char *device, int forceHFS, int isRaw) + int fso = 0; + int retval = 0; + hfsparams_t defaults = {0}; ++#if !LINUX + u_int64_t maxSectorsPerIO; ++#endif + + if (gPartitionSize) { + dip.sectorSize = kBytesPerSector; +@@ -526,6 +549,34 @@ hfs_newfs(char *device, int forceHFS, int isRaw) + + if (fstat( fso, &stbuf) < 0) + fatal("%s: %s", device, strerror(errno)); ++#if LINUX ++ dip.sectorSize = 512; ++ dip.sectorsPerIO = 256; ++ ++# ifndef BLKGETSIZE ++# define BLKGETSIZE _IO(0x12,96) ++# endif ++ ++# ifndef BLKGETSIZE64 ++# define BLKGETSIZE64 _IOR(0x12,114,size_t) ++# endif ++ ++ if (S_ISREG(stbuf.st_mode)) { ++ dip.totalSectors = stbuf.st_size / 512; ++ } ++ else if (S_ISBLK(stbuf.st_mode)) { ++ unsigned long size; ++ u_int64_t size64; ++ if (!ioctl(fso, BLKGETSIZE64, &size64)) ++ dip.totalSectors = size64 / 512; ++ else if (!ioctl(fso, BLKGETSIZE, &size)) ++ dip.totalSectors = size; ++ else ++ fatal("%s: %s", device, strerror(errno)); ++ } ++ else ++ fatal("%s: is not a block device", device); ++#else + + if (ioctl(fso, DKIOCGETBLOCKCOUNT, &dip.totalSectors) < 0) + fatal("%s: %s", device, strerror(errno)); +@@ -537,11 +588,14 @@ hfs_newfs(char *device, int forceHFS, int isRaw) + dip.sectorsPerIO = (128 * 1024) / dip.sectorSize; /* use 128K as default */ + else + dip.sectorsPerIO = MIN(maxSectorsPerIO, (1024 * 1024) / dip.sectorSize); ++#endif ++ + /* + * The make_hfs code currentlydoes 512 byte sized I/O. + * If the sector size is bigger than 512, start over + * using the block device (to get de-blocking). + */ ++#if !LINUX + if (dip.sectorSize != kBytesPerSector) { + if (isRaw) { + close(fso); +@@ -556,7 +610,9 @@ hfs_newfs(char *device, int forceHFS, int isRaw) + dip.sectorSize = kBytesPerSector; + } + } ++#endif + } ++ + dip.sectorOffset = 0; + time(&createtime); + +diff --git a/newfs_hfs.tproj/newfs_hfs.h b/newfs_hfs.tproj/newfs_hfs.h +index 968ff10..5680a34 100644 +--- a/newfs_hfs.tproj/newfs_hfs.h ++++ b/newfs_hfs.tproj/newfs_hfs.h +@@ -19,8 +19,12 @@ + * + * @APPLE_LICENSE_HEADER_END@ + */ +- ++ ++#if LINUX ++#include "missing.h" ++#else + #include ++#endif + + /* + * Mac OS Finder flags +@@ -122,33 +126,33 @@ enum { + #define kDTDF_FileID 16 + #define kDTDF_Name "Desktop DF" + #define kDTDF_Chars 10 +-#define kDTDF_Type 'DTFL' +-#define kDTDF_Creator 'DMGR' ++#define kDTDF_Type 0x4454464C /* 'DTFL' */ ++#define kDTDF_Creator 0x444D4752 /* 'DMGR' */ + + #define kDTDB_FileID 17 + #define kDTDB_Name "Desktop DB" + #define kDTDB_Chars 10 +-#define kDTDB_Type 'BTFL' +-#define kDTDB_Creator 'DMGR' ++#define kDTDB_Type 0x4254464C /* 'BTFL' */ ++#define kDTDB_Creator 0x444D4752 /* 'DMGR' */ + #define kDTDB_Size 1024 + + #define kReadMe_FileID 18 + #define kReadMe_Name "ReadMe" + #define kReadMe_Chars 6 +-#define kReadMe_Type 'ttro' +-#define kReadMe_Creator 'ttxt' ++#define kReadMe_Type 0x7474726F /* 'ttro' */ ++#define kReadMe_Creator 0x74747974 /* 'ttxt' */ + + #define kFinder_FileID 19 + #define kFinder_Name "Finder" + #define kFinder_Chars 6 +-#define kFinder_Type 'FNDR' +-#define kFinder_Creator 'MACS' ++#define kFinder_Type 0x464E4452 /* 'FNDR' */ ++#define kFinder_Creator 0x4D414353 /* 'MACS' */ + + #define kSystem_FileID 20 + #define kSystem_Name "System" + #define kSystem_Chars 6 +-#define kSystem_Type 'zsys' +-#define kSystem_Creator 'MACS' ++#define kSystem_Type 0x7A737973 /* 'zsys' */ ++#define kSystem_Creator 0x4D414353 /* 'MACS' */ + + + diff --git a/utils/hfsprogs/patches/0003-Add-helper-include-files-absent-from-the-upstream-pa.patch b/utils/hfsprogs/patches/0003-Add-helper-include-files-absent-from-the-upstream-pa.patch new file mode 100644 index 0000000..36b9417 --- /dev/null +++ b/utils/hfsprogs/patches/0003-Add-helper-include-files-absent-from-the-upstream-pa.patch @@ -0,0 +1,1024 @@ +From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= +Date: Thu, 24 Oct 2013 01:11:21 -0200 +Subject: Add helper include files absent from the upstream package + +Add some include files from an Apple system that contain the definition of +the data structures used by the programs that manipulate the filesystems. +--- + include/bitstring.h | 164 +++++++++++ + include/hfs/hfs_format.h | 689 +++++++++++++++++++++++++++++++++++++++++++++ + include/hfs/hfs_mount.h | 78 +++++ + include/sys/appleapiopts.h | 52 ++++ + 4 files changed, 983 insertions(+) + create mode 100644 include/bitstring.h + create mode 100644 include/hfs/hfs_format.h + create mode 100644 include/hfs/hfs_mount.h + create mode 100644 include/sys/appleapiopts.h + +diff --git a/include/bitstring.h b/include/bitstring.h +new file mode 100644 +index 0000000..fbecfbe +--- /dev/null ++++ b/include/bitstring.h +@@ -0,0 +1,164 @@ ++/* ++ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. ++ * ++ * @APPLE_LICENSE_HEADER_START@ ++ * ++ * The contents of this file constitute Original Code as defined in and ++ * are subject to the Apple Public Source License Version 1.1 (the ++ * "License"). You may not use this file except in compliance with the ++ * License. Please obtain a copy of the License at ++ * http://www.apple.com/publicsource and read it before using this file. ++ * ++ * This Original Code and all software distributed under the License are ++ * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ++ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ++ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ++ * License for the specific language governing rights and limitations ++ * under the License. ++ * ++ * @APPLE_LICENSE_HEADER_END@ ++ */ ++/* ++ * Copyright (c) 1989, 1993 ++ * The Regents of the University of California. All rights reserved. ++ * ++ * This code is derived from software contributed to Berkeley by ++ * Paul Vixie. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 3. All advertising materials mentioning features or use of this software ++ * must display the following acknowledgement: ++ * This product includes software developed by the University of ++ * California, Berkeley and its contributors. ++ * 4. Neither the name of the University nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ * ++ * @(#)bitstring.h 8.1 (Berkeley) 7/19/93 ++ */ ++ ++#ifndef _BITSTRING_H_ ++#define _BITSTRING_H_ ++ ++typedef unsigned char bitstr_t; ++ ++/* internal macros */ ++ /* byte of the bitstring bit is in */ ++#define _bit_byte(bit) \ ++ ((bit) >> 3) ++ ++ /* mask for the bit within its byte */ ++#define _bit_mask(bit) \ ++ (1 << ((bit)&0x7)) ++ ++/* external macros */ ++ /* bytes in a bitstring of nbits bits */ ++#define bitstr_size(nbits) \ ++ ((((nbits) - 1) >> 3) + 1) ++ ++ /* allocate a bitstring */ ++#define bit_alloc(nbits) \ ++ (bitstr_t *)calloc(1, \ ++ (unsigned int)bitstr_size(nbits) * sizeof(bitstr_t)) ++ ++ /* allocate a bitstring on the stack */ ++#define bit_decl(name, nbits) \ ++ (name)[bitstr_size(nbits)] ++ ++ /* is bit N of bitstring name set? */ ++#define bit_test(name, bit) \ ++ ((name)[_bit_byte(bit)] & _bit_mask(bit)) ++ ++ /* set bit N of bitstring name */ ++#define bit_set(name, bit) \ ++ (name)[_bit_byte(bit)] |= _bit_mask(bit) ++ ++ /* clear bit N of bitstring name */ ++#define bit_clear(name, bit) \ ++ (name)[_bit_byte(bit)] &= ~_bit_mask(bit) ++ ++ /* clear bits start ... stop in bitstring */ ++#define bit_nclear(name, start, stop) { \ ++ register bitstr_t *_name = name; \ ++ register int _start = start, _stop = stop; \ ++ register int _startbyte = _bit_byte(_start); \ ++ register int _stopbyte = _bit_byte(_stop); \ ++ if (_startbyte == _stopbyte) { \ ++ _name[_startbyte] &= ((0xff >> (8 - (_start&0x7))) | \ ++ (0xff << ((_stop&0x7) + 1))); \ ++ } else { \ ++ _name[_startbyte] &= 0xff >> (8 - (_start&0x7)); \ ++ while (++_startbyte < _stopbyte) \ ++ _name[_startbyte] = 0; \ ++ _name[_stopbyte] &= 0xff << ((_stop&0x7) + 1); \ ++ } \ ++} ++ ++ /* set bits start ... stop in bitstring */ ++#define bit_nset(name, start, stop) { \ ++ register bitstr_t *_name = name; \ ++ register int _start = start, _stop = stop; \ ++ register int _startbyte = _bit_byte(_start); \ ++ register int _stopbyte = _bit_byte(_stop); \ ++ if (_startbyte == _stopbyte) { \ ++ _name[_startbyte] |= ((0xff << (_start&0x7)) & \ ++ (0xff >> (7 - (_stop&0x7)))); \ ++ } else { \ ++ _name[_startbyte] |= 0xff << ((_start)&0x7); \ ++ while (++_startbyte < _stopbyte) \ ++ _name[_startbyte] = 0xff; \ ++ _name[_stopbyte] |= 0xff >> (7 - (_stop&0x7)); \ ++ } \ ++} ++ ++ /* find first bit clear in name */ ++#define bit_ffc(name, nbits, value) { \ ++ register bitstr_t *_name = name; \ ++ register int _byte, _nbits = nbits; \ ++ register int _stopbyte = _bit_byte(_nbits), _value = -1; \ ++ for (_byte = 0; _byte <= _stopbyte; ++_byte) \ ++ if (_name[_byte] != 0xff) { \ ++ _value = _byte << 3; \ ++ for (_stopbyte = _name[_byte]; (_stopbyte&0x1); \ ++ ++_value, _stopbyte >>= 1); \ ++ break; \ ++ } \ ++ *(value) = _value; \ ++} ++ ++ /* find first bit set in name */ ++#define bit_ffs(name, nbits, value) { \ ++ register bitstr_t *_name = name; \ ++ register int _byte, _nbits = nbits; \ ++ register int _stopbyte = _bit_byte(_nbits), _value = -1; \ ++ for (_byte = 0; _byte <= _stopbyte; ++_byte) \ ++ if (_name[_byte]) { \ ++ _value = _byte << 3; \ ++ for (_stopbyte = _name[_byte]; !(_stopbyte&0x1); \ ++ ++_value, _stopbyte >>= 1); \ ++ break; \ ++ } \ ++ *(value) = _value; \ ++} ++ ++#endif /* !_BITSTRING_H_ */ +diff --git a/include/hfs/hfs_format.h b/include/hfs/hfs_format.h +new file mode 100644 +index 0000000..d820329 +--- /dev/null ++++ b/include/hfs/hfs_format.h +@@ -0,0 +1,689 @@ ++/* ++ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. ++ * ++ * @APPLE_LICENSE_HEADER_START@ ++ * ++ * The contents of this file constitute Original Code as defined in and ++ * are subject to the Apple Public Source License Version 1.1 (the ++ * "License"). You may not use this file except in compliance with the ++ * License. Please obtain a copy of the License at ++ * http://www.apple.com/publicsource and read it before using this file. ++ * ++ * This Original Code and all software distributed under the License are ++ * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ++ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ++ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ++ * License for the specific language governing rights and limitations ++ * under the License. ++ * ++ * @APPLE_LICENSE_HEADER_END@ ++ */ ++#ifndef __HFS_FORMAT__ ++#define __HFS_FORMAT__ ++ ++#include "missing.h" ++ ++#include ++ ++/* ++ * hfs_format.c ++ * ++ * This file describes the on-disk format for HFS and HFS Plus volumes. ++ * The HFS Plus volume format is desciibed in detail in Apple Technote 1150. ++ * ++ * http://developer.apple.com/technotes/tn/tn1150.html ++ * ++ */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/* some on-disk hfs structures have 68K alignment (misaligned) */ ++ ++#define PACKED_S __attribute__((packed)) ++ ++/* Signatures used to differentiate between HFS and HFS Plus volumes */ ++enum { ++ kHFSSigWord = 0x4244, /* 'BD' in ASCII */ ++ kHFSPlusSigWord = 0x482B, /* 'H+' in ASCII */ ++ kHFSXSigWord = 0x4858, /* 'HX' in ASCII */ ++ ++ kHFSPlusVersion = 0x0004, /* 'H+' volumes are version 4 only */ ++ kHFSXVersion = 0x0005, /* 'HX' volumes start with version 5 */ ++ ++ kHFSPlusMountVersion = 0x31302E30, /* '10.0' for Mac OS X */ ++ kHFSJMountVersion = 0x4846534a, /* 'HFSJ' for journaled HFS+ on OS X */ ++ kFSKMountVersion = 0x46534b21 /* 'FSK!' for failed journal replay */ ++}PACKED_S; ++ ++ ++#if 1 ++/* ++ * Mac OS X has a special directory for linked and unlinked files (HFS Plus only). ++ * This directory and its contents are never exported from the filesystem under ++ * Mac OS X. ++ * ++ * To make this folder name sort last, it has embedded null prefix. ++ * (0xC0, 0x80 in UTF-8) ++ */ ++#define HFSPLUSMETADATAFOLDER "\xC0\x80\xC0\x80\xC0\x80\xC0\x80HFS+ Private Data" ++ ++/* ++ * Files in the HFS Private Data folder have one of the following prefixes ++ * followed by a decimal number (no leading zeros). For indirect nodes this ++ * number is a 32 bit random number. For unlinked (deleted) files that are ++ * still open, the number is the file ID for that file. ++ * ++ * e.g. iNode7182000 and temp3296 ++ */ ++#define HFS_INODE_PREFIX "iNode" ++#define HFS_DELETE_PREFIX "temp" ++ ++#endif /* __APPLE_API_PRIVATE */ ++ ++/* ++ * Indirect link files (hard links) have the following type/creator. ++ */ ++enum { ++ kHardLinkFileType = 0x686C6E6B, /* 'hlnk' */ ++ kHFSPlusCreator = 0x6866732B /* 'hfs+' */ ++}PACKED_S; ++ ++ ++#ifndef _HFSUNISTR255_DEFINED_ ++#define _HFSUNISTR255_DEFINED_ ++/* Unicode strings are used for HFS Plus file and folder names */ ++struct HFSUniStr255 { ++ u_int16_t length; /* number of unicode characters */ ++ u_int16_t unicode[255]; /* unicode characters */ ++} PACKED_S; ++typedef struct HFSUniStr255 HFSUniStr255; ++typedef const HFSUniStr255 *ConstHFSUniStr255Param; ++#endif /* _HFSUNISTR255_DEFINED_ */ ++ ++enum { ++ kHFSMaxVolumeNameChars = 27, ++ kHFSMaxFileNameChars = 31, ++ kHFSPlusMaxFileNameChars = 255 ++}PACKED_S; ++ ++ ++/* Extent overflow file data structures */ ++ ++/* HFS Extent key */ ++struct HFSExtentKey { ++ u_int8_t keyLength; /* length of key, excluding this field */ ++ u_int8_t forkType; /* 0 = data fork, FF = resource fork */ ++ u_int32_t fileID; /* file ID */ ++ u_int16_t startBlock; /* first file allocation block number in this extent */ ++}PACKED_S; ++typedef struct HFSExtentKey HFSExtentKey; ++ ++/* HFS Plus Extent key */ ++struct HFSPlusExtentKey { ++ u_int16_t keyLength; /* length of key, excluding this field */ ++ u_int8_t forkType; /* 0 = data fork, FF = resource fork */ ++ u_int8_t pad; /* make the other fields align on 32-bit boundary */ ++ u_int32_t fileID; /* file ID */ ++ u_int32_t startBlock; /* first file allocation block number in this extent */ ++}PACKED_S; ++typedef struct HFSPlusExtentKey HFSPlusExtentKey; ++ ++/* Number of extent descriptors per extent record */ ++enum { ++ kHFSExtentDensity = 3, ++ kHFSPlusExtentDensity = 8 ++}PACKED_S; ++ ++/* HFS extent descriptor */ ++struct HFSExtentDescriptor { ++ u_int16_t startBlock; /* first allocation block */ ++ u_int16_t blockCount; /* number of allocation blocks */ ++}PACKED_S; ++typedef struct HFSExtentDescriptor HFSExtentDescriptor; ++ ++/* HFS Plus extent descriptor */ ++struct HFSPlusExtentDescriptor { ++ u_int32_t startBlock; /* first allocation block */ ++ u_int32_t blockCount; /* number of allocation blocks */ ++}PACKED_S; ++typedef struct HFSPlusExtentDescriptor HFSPlusExtentDescriptor; ++ ++/* HFS extent record */ ++typedef HFSExtentDescriptor HFSExtentRecord[3]; ++ ++/* HFS Plus extent record */ ++typedef HFSPlusExtentDescriptor HFSPlusExtentRecord[8]; ++ ++ ++/* Finder information */ ++struct FndrFileInfo { ++ u_int32_t fdType; /* file type */ ++ u_int32_t fdCreator; /* file creator */ ++ u_int16_t fdFlags; /* Finder flags */ ++ struct { ++ int16_t v; /* file's location */ ++ int16_t h; ++ } PACKED_S fdLocation; ++ int16_t opaque; ++}PACKED_S; ++typedef struct FndrFileInfo FndrFileInfo; ++ ++struct FndrDirInfo { ++ struct { /* folder's window rectangle */ ++ int16_t top; ++ int16_t left; ++ int16_t bottom; ++ int16_t right; ++ }PACKED_S frRect; ++ unsigned short frFlags; /* Finder flags */ ++ struct { ++ u_int16_t v; /* folder's location */ ++ u_int16_t h; ++ }PACKED_S frLocation; ++ int16_t opaque; ++}PACKED_S; ++typedef struct FndrDirInfo FndrDirInfo; ++ ++struct FndrOpaqueInfo { ++ int8_t opaque[16]; ++}PACKED_S; ++typedef struct FndrOpaqueInfo FndrOpaqueInfo; ++ ++ ++/* HFS Plus Fork data info - 80 bytes */ ++struct HFSPlusForkData { ++ u_int64_t logicalSize; /* fork's logical size in bytes */ ++ u_int32_t clumpSize; /* fork's clump size in bytes */ ++ u_int32_t totalBlocks; /* total blocks used by this fork */ ++ HFSPlusExtentRecord extents; /* initial set of extents */ ++}PACKED_S; ++typedef struct HFSPlusForkData HFSPlusForkData; ++ ++ ++/* Mac OS X has 16 bytes worth of "BSD" info. ++ * ++ * Note: Mac OS 9 implementations and applications ++ * should preserve, but not change, this information. ++ */ ++struct HFSPlusBSDInfo { ++ u_int32_t ownerID; /* user or group ID of file/folder owner */ ++ u_int32_t groupID; /* additional user of group ID */ ++ u_int8_t adminFlags; /* super-user changeable flags */ ++ u_int8_t ownerFlags; /* owner changeable flags */ ++ u_int16_t fileMode; /* file type and permission bits */ ++ union { ++ u_int32_t iNodeNum; /* indirect node number (hard links only) */ ++ u_int32_t linkCount; /* links that refer to this indirect node */ ++ u_int32_t rawDevice; /* special file device (FBLK and FCHR only) */ ++ }PACKED_S special; ++}PACKED_S; ++typedef struct HFSPlusBSDInfo HFSPlusBSDInfo; ++ ++ ++/* Catalog file data structures */ ++ ++enum { ++ kHFSRootParentID = 1, /* Parent ID of the root folder */ ++ kHFSRootFolderID = 2, /* Folder ID of the root folder */ ++ kHFSExtentsFileID = 3, /* File ID of the extents file */ ++ kHFSCatalogFileID = 4, /* File ID of the catalog file */ ++ kHFSBadBlockFileID = 5, /* File ID of the bad allocation block file */ ++ kHFSAllocationFileID = 6, /* File ID of the allocation file (HFS Plus only) */ ++ kHFSStartupFileID = 7, /* File ID of the startup file (HFS Plus only) */ ++ kHFSAttributesFileID = 8, /* File ID of the attribute file (HFS Plus only) */ ++ kHFSRepairCatalogFileID = 14, /* Used when rebuilding Catalog B-tree */ ++ kHFSBogusExtentFileID = 15, /* Used for exchanging extents in extents file */ ++ kHFSFirstUserCatalogNodeID = 16 ++}PACKED_S; ++ ++/* HFS catalog key */ ++struct HFSCatalogKey { ++ u_int8_t keyLength; /* key length (in bytes) */ ++ u_int8_t reserved; /* reserved (set to zero) */ ++ u_int32_t parentID; /* parent folder ID */ ++ u_int8_t nodeName[kHFSMaxFileNameChars + 1]; /* catalog node name */ ++}PACKED_S; ++typedef struct HFSCatalogKey HFSCatalogKey; ++ ++/* HFS Plus catalog key */ ++struct HFSPlusCatalogKey { ++ u_int16_t keyLength; /* key length (in bytes) */ ++ u_int32_t parentID; /* parent folder ID */ ++ HFSUniStr255 nodeName; /* catalog node name */ ++}PACKED_S; ++typedef struct HFSPlusCatalogKey HFSPlusCatalogKey; ++ ++/* Catalog record types */ ++enum { ++ /* HFS Catalog Records */ ++ kHFSFolderRecord = 0x0100, /* Folder record */ ++ kHFSFileRecord = 0x0200, /* File record */ ++ kHFSFolderThreadRecord = 0x0300, /* Folder thread record */ ++ kHFSFileThreadRecord = 0x0400, /* File thread record */ ++ ++ /* HFS Plus Catalog Records */ ++ kHFSPlusFolderRecord = 1, /* Folder record */ ++ kHFSPlusFileRecord = 2, /* File record */ ++ kHFSPlusFolderThreadRecord = 3, /* Folder thread record */ ++ kHFSPlusFileThreadRecord = 4 /* File thread record */ ++}PACKED_S; ++ ++ ++/* Catalog file record flags */ ++enum { ++ kHFSFileLockedBit = 0x0000, /* file is locked and cannot be written to */ ++ kHFSFileLockedMask = 0x0001, ++ ++ kHFSThreadExistsBit = 0x0001, /* a file thread record exists for this file */ ++ kHFSThreadExistsMask = 0x0002, ++ ++ kHFSHasAttributesBit = 0x0002, /* object has extended attributes */ ++ kHFSHasAttributesMask = 0x0004, ++ ++ kHFSHasSecurityBit = 0x0003, /* object has security data (ACLs) */ ++ kHFSHasSecurityMask = 0x0008 ++}PACKED_S; ++ ++ ++/* HFS catalog folder record - 70 bytes */ ++struct HFSCatalogFolder { ++ int16_t recordType; /* == kHFSFolderRecord */ ++ u_int16_t flags; /* folder flags */ ++ u_int16_t valence; /* folder valence */ ++ u_int32_t folderID; /* folder ID */ ++ u_int32_t createDate; /* date and time of creation */ ++ u_int32_t modifyDate; /* date and time of last modification */ ++ u_int32_t backupDate; /* date and time of last backup */ ++ FndrDirInfo userInfo; /* Finder information */ ++ FndrOpaqueInfo finderInfo; /* additional Finder information */ ++ u_int32_t reserved[4]; /* reserved - initialized as zero */ ++}PACKED_S; ++typedef struct HFSCatalogFolder HFSCatalogFolder; ++ ++/* HFS Plus catalog folder record - 88 bytes */ ++struct HFSPlusCatalogFolder { ++ int16_t recordType; /* == kHFSPlusFolderRecord */ ++ u_int16_t flags; /* file flags */ ++ u_int32_t valence; /* folder's valence (limited to 2^16 in Mac OS) */ ++ u_int32_t folderID; /* folder ID */ ++ u_int32_t createDate; /* date and time of creation */ ++ u_int32_t contentModDate; /* date and time of last content modification */ ++ u_int32_t attributeModDate; /* date and time of last attribute modification */ ++ u_int32_t accessDate; /* date and time of last access (MacOS X only) */ ++ u_int32_t backupDate; /* date and time of last backup */ ++ HFSPlusBSDInfo bsdInfo; /* permissions (for MacOS X) */ ++ FndrDirInfo userInfo; /* Finder information */ ++ FndrOpaqueInfo finderInfo; /* additional Finder information */ ++ u_int32_t textEncoding; /* hint for name conversions */ ++ u_int32_t attrBlocks; /* cached count of attribute data blocks */ ++}PACKED_S; ++typedef struct HFSPlusCatalogFolder HFSPlusCatalogFolder; ++ ++/* HFS catalog file record - 102 bytes */ ++struct HFSCatalogFile { ++ int16_t recordType; /* == kHFSFileRecord */ ++ u_int8_t flags; /* file flags */ ++ int8_t fileType; /* file type (unused ?) */ ++ FndrFileInfo userInfo; /* Finder information */ ++ u_int32_t fileID; /* file ID */ ++ u_int16_t dataStartBlock; /* not used - set to zero */ ++ int32_t dataLogicalSize; /* logical EOF of data fork */ ++ int32_t dataPhysicalSize; /* physical EOF of data fork */ ++ u_int16_t rsrcStartBlock; /* not used - set to zero */ ++ int32_t rsrcLogicalSize; /* logical EOF of resource fork */ ++ int32_t rsrcPhysicalSize; /* physical EOF of resource fork */ ++ u_int32_t createDate; /* date and time of creation */ ++ u_int32_t modifyDate; /* date and time of last modification */ ++ u_int32_t backupDate; /* date and time of last backup */ ++ FndrOpaqueInfo finderInfo; /* additional Finder information */ ++ u_int16_t clumpSize; /* file clump size (not used) */ ++ HFSExtentRecord dataExtents; /* first data fork extent record */ ++ HFSExtentRecord rsrcExtents; /* first resource fork extent record */ ++ u_int32_t reserved; /* reserved - initialized as zero */ ++}PACKED_S; ++typedef struct HFSCatalogFile HFSCatalogFile; ++ ++/* HFS Plus catalog file record - 248 bytes */ ++struct HFSPlusCatalogFile { ++ int16_t recordType; /* == kHFSPlusFileRecord */ ++ u_int16_t flags; /* file flags */ ++ u_int32_t reserved1; /* reserved - initialized as zero */ ++ u_int32_t fileID; /* file ID */ ++ u_int32_t createDate; /* date and time of creation */ ++ u_int32_t contentModDate; /* date and time of last content modification */ ++ u_int32_t attributeModDate; /* date and time of last attribute modification */ ++ u_int32_t accessDate; /* date and time of last access (MacOS X only) */ ++ u_int32_t backupDate; /* date and time of last backup */ ++ HFSPlusBSDInfo bsdInfo; /* permissions (for MacOS X) */ ++ FndrFileInfo userInfo; /* Finder information */ ++ FndrOpaqueInfo finderInfo; /* additional Finder information */ ++ u_int32_t textEncoding; /* hint for name conversions */ ++ u_int32_t attrBlocks; /* cached count of attribute data blocks */ ++ ++ /* Note: these start on double long (64 bit) boundary */ ++ HFSPlusForkData dataFork; /* size and block data for data fork */ ++ HFSPlusForkData resourceFork; /* size and block data for resource fork */ ++}PACKED_S; ++typedef struct HFSPlusCatalogFile HFSPlusCatalogFile; ++ ++/* HFS catalog thread record - 46 bytes */ ++struct HFSCatalogThread { ++ int16_t recordType; /* == kHFSFolderThreadRecord or kHFSFileThreadRecord */ ++ int32_t reserved[2]; /* reserved - initialized as zero */ ++ u_int32_t parentID; /* parent ID for this catalog node */ ++ u_int8_t nodeName[kHFSMaxFileNameChars + 1]; /* name of this catalog node */ ++}PACKED_S; ++typedef struct HFSCatalogThread HFSCatalogThread; ++ ++/* HFS Plus catalog thread record -- 264 bytes */ ++struct HFSPlusCatalogThread { ++ int16_t recordType; /* == kHFSPlusFolderThreadRecord or kHFSPlusFileThreadRecord */ ++ int16_t reserved; /* reserved - initialized as zero */ ++ u_int32_t parentID; /* parent ID for this catalog node */ ++ HFSUniStr255 nodeName; /* name of this catalog node (variable length) */ ++}PACKED_S; ++typedef struct HFSPlusCatalogThread HFSPlusCatalogThread; ++ ++#ifdef __APPLE_API_UNSTABLE ++/* ++ These are the types of records in the attribute B-tree. The values were ++ chosen so that they wouldn't conflict with the catalog record types. ++*/ ++enum { ++ kHFSPlusAttrInlineData = 0x10, /* if size < kAttrOverflowSize */ ++ kHFSPlusAttrForkData = 0x20, /* if size >= kAttrOverflowSize */ ++ kHFSPlusAttrExtents = 0x30 /* overflow extents for large attributes */ ++}PACKED_S; ++ ++ ++/* ++ HFSPlusAttrForkData ++ For larger attributes, whose value is stored in allocation blocks. ++ If the attribute has more than 8 extents, there will be additional ++ records (of type HFSPlusAttrExtents) for this attribute. ++*/ ++struct HFSPlusAttrForkData { ++ u_int32_t recordType; /* == kHFSPlusAttrForkData*/ ++ u_int32_t reserved; ++ HFSPlusForkData theFork; /* size and first extents of value*/ ++}PACKED_S; ++typedef struct HFSPlusAttrForkData HFSPlusAttrForkData; ++ ++/* ++ HFSPlusAttrExtents ++ This record contains information about overflow extents for large, ++ fragmented attributes. ++*/ ++struct HFSPlusAttrExtents { ++ u_int32_t recordType; /* == kHFSPlusAttrExtents*/ ++ u_int32_t reserved; ++ HFSPlusExtentRecord extents; /* additional extents*/ ++}PACKED_S; ++typedef struct HFSPlusAttrExtents HFSPlusAttrExtents; ++ ++/* ++ * Atrributes B-tree Data Record ++ * ++ * For small attributes, whose entire value is stored ++ * within a single B-tree record. ++ */ ++struct HFSPlusAttrData { ++ u_int32_t recordType; /* == kHFSPlusAttrInlineData */ ++ u_int32_t reserved[2]; ++ u_int32_t attrSize; /* size of attribute data in bytes */ ++ u_int8_t attrData[2]; /* variable length */ ++}PACKED_S; ++typedef struct HFSPlusAttrData HFSPlusAttrData; ++ ++ ++/* HFSPlusAttrInlineData is obsolete use HFSPlusAttrData instead */ ++struct HFSPlusAttrInlineData { ++ u_int32_t recordType; ++ u_int32_t reserved; ++ u_int32_t logicalSize; ++ u_int8_t userData[2]; ++}PACKED_S; ++typedef struct HFSPlusAttrInlineData HFSPlusAttrInlineData; ++ ++ ++/* A generic Attribute Record*/ ++union HFSPlusAttrRecord { ++ u_int32_t recordType; ++ HFSPlusAttrInlineData inlineData; /* NOT USED */ ++ HFSPlusAttrData attrData; ++ HFSPlusAttrForkData forkData; ++ HFSPlusAttrExtents overflowExtents; ++}PACKED_S; ++typedef union HFSPlusAttrRecord HFSPlusAttrRecord; ++ ++/* Attribute key */ ++enum { kHFSMaxAttrNameLen = 127 }; ++struct HFSPlusAttrKey { ++ u_int16_t keyLength; /* key length (in bytes) */ ++ u_int16_t pad; /* set to zero */ ++ u_int32_t fileID; /* file associated with attribute */ ++ u_int32_t startBlock; /* first attribue allocation block number for extents */ ++ u_int16_t attrNameLen; /* number of unicode characters */ ++ u_int16_t attrName[127]; /* attribute name (Unicode) */ ++}PACKED_S; ++typedef struct HFSPlusAttrKey HFSPlusAttrKey; ++ ++#define kHFSPlusAttrKeyMaximumLength (sizeof(HFSPlusAttrKey) - sizeof(u_int16_t)) ++#define kHFSPlusAttrKeyMinimumLength (kHFSPlusAttrKeyMaximumLength - (127 * sizeof(u_int16_t))) ++ ++#endif /* __APPLE_API_UNSTABLE */ ++ ++ ++/* Key and node lengths */ ++enum { ++ kHFSPlusExtentKeyMaximumLength = sizeof(HFSPlusExtentKey) - sizeof(u_int16_t), ++ kHFSExtentKeyMaximumLength = sizeof(HFSExtentKey) - sizeof(u_int8_t), ++ kHFSPlusCatalogKeyMaximumLength = sizeof(HFSPlusCatalogKey) - sizeof(u_int16_t), ++ kHFSPlusCatalogKeyMinimumLength = kHFSPlusCatalogKeyMaximumLength - sizeof(HFSUniStr255) + sizeof(u_int16_t), ++ kHFSCatalogKeyMaximumLength = sizeof(HFSCatalogKey) - sizeof(u_int8_t), ++ kHFSCatalogKeyMinimumLength = kHFSCatalogKeyMaximumLength - (kHFSMaxFileNameChars + 1) + sizeof(u_int8_t), ++ kHFSPlusCatalogMinNodeSize = 4096, ++ kHFSPlusExtentMinNodeSize = 512, ++ kHFSPlusAttrMinNodeSize = 4096 ++}PACKED_S; ++ ++/* HFS and HFS Plus volume attribute bits */ ++enum { ++ /* Bits 0-6 are reserved (always cleared by MountVol call) */ ++ kHFSVolumeHardwareLockBit = 7, /* volume is locked by hardware */ ++ kHFSVolumeUnmountedBit = 8, /* volume was successfully unmounted */ ++ kHFSVolumeSparedBlocksBit = 9, /* volume has bad blocks spared */ ++ kHFSVolumeNoCacheRequiredBit = 10, /* don't cache volume blocks (i.e. RAM or ROM disk) */ ++ kHFSBootVolumeInconsistentBit = 11, /* boot volume is inconsistent (System 7.6 and later) */ ++ kHFSCatalogNodeIDsReusedBit = 12, ++ kHFSVolumeJournaledBit = 13, /* this volume has a journal on it */ ++ kHFSVolumeInconsistentBit = 14, /* serious inconsistencies detected at runtime */ ++ kHFSVolumeSoftwareLockBit = 15, /* volume is locked by software */ ++ ++ kHFSVolumeHardwareLockMask = 1 << kHFSVolumeHardwareLockBit, ++ kHFSVolumeUnmountedMask = 1 << kHFSVolumeUnmountedBit, ++ kHFSVolumeSparedBlocksMask = 1 << kHFSVolumeSparedBlocksBit, ++ kHFSVolumeNoCacheRequiredMask = 1 << kHFSVolumeNoCacheRequiredBit, ++ kHFSBootVolumeInconsistentMask = 1 << kHFSBootVolumeInconsistentBit, ++ kHFSCatalogNodeIDsReusedMask = 1 << kHFSCatalogNodeIDsReusedBit, ++ kHFSVolumeJournaledMask = 1 << kHFSVolumeJournaledBit, ++ kHFSVolumeInconsistentMask = 1 << kHFSVolumeInconsistentBit, ++ kHFSVolumeSoftwareLockMask = 1 << kHFSVolumeSoftwareLockBit, ++ kHFSMDBAttributesMask = 0x8380 ++}PACKED_S; ++ ++ ++/* HFS Master Directory Block - 162 bytes */ ++/* Stored at sector #2 (3rd sector) and second-to-last sector. */ ++struct HFSMasterDirectoryBlock { ++ u_int16_t drSigWord; /* == kHFSSigWord */ ++ u_int32_t drCrDate; /* date and time of volume creation */ ++ u_int32_t drLsMod; /* date and time of last modification */ ++ u_int16_t drAtrb; /* volume attributes */ ++ u_int16_t drNmFls; /* number of files in root folder */ ++ u_int16_t drVBMSt; /* first block of volume bitmap */ ++ u_int16_t drAllocPtr; /* start of next allocation search */ ++ u_int16_t drNmAlBlks; /* number of allocation blocks in volume */ ++ u_int32_t drAlBlkSiz; /* size (in bytes) of allocation blocks */ ++ u_int32_t drClpSiz; /* default clump size */ ++ u_int16_t drAlBlSt; /* first allocation block in volume */ ++ u_int32_t drNxtCNID; /* next unused catalog node ID */ ++ u_int16_t drFreeBks; /* number of unused allocation blocks */ ++ u_int8_t drVN[kHFSMaxVolumeNameChars + 1]; /* volume name */ ++ u_int32_t drVolBkUp; /* date and time of last backup */ ++ u_int16_t drVSeqNum; /* volume backup sequence number */ ++ u_int32_t drWrCnt; /* volume write count */ ++ u_int32_t drXTClpSiz; /* clump size for extents overflow file */ ++ u_int32_t drCTClpSiz; /* clump size for catalog file */ ++ u_int16_t drNmRtDirs; /* number of directories in root folder */ ++ u_int32_t drFilCnt; /* number of files in volume */ ++ u_int32_t drDirCnt; /* number of directories in volume */ ++ u_int32_t drFndrInfo[8]; /* information used by the Finder */ ++ u_int16_t drEmbedSigWord; /* embedded volume signature (formerly drVCSize) */ ++ HFSExtentDescriptor drEmbedExtent; /* embedded volume location and size (formerly drVBMCSize and drCtlCSize) */ ++ u_int32_t drXTFlSize; /* size of extents overflow file */ ++ HFSExtentRecord drXTExtRec; /* extent record for extents overflow file */ ++ u_int32_t drCTFlSize; /* size of catalog file */ ++ HFSExtentRecord drCTExtRec; /* extent record for catalog file */ ++}PACKED_S; ++typedef struct HFSMasterDirectoryBlock HFSMasterDirectoryBlock; ++ ++ ++#ifdef __APPLE_API_UNSTABLE ++#define SET_HFS_TEXT_ENCODING(hint) \ ++ (0x656e6300 | ((hint) & 0xff)) ++#define GET_HFS_TEXT_ENCODING(hint) \ ++ (((hint) & 0xffffff00) == 0x656e6300 ? (hint) & 0x000000ff : 0xffffffffU) ++#endif /* __APPLE_API_UNSTABLE */ ++ ++ ++/* HFS Plus Volume Header - 512 bytes */ ++/* Stored at sector #2 (3rd sector) and second-to-last sector. */ ++struct HFSPlusVolumeHeader { ++ u_int16_t signature; /* == kHFSPlusSigWord */ ++ u_int16_t version; /* == kHFSPlusVersion */ ++ u_int32_t attributes; /* volume attributes */ ++ u_int32_t lastMountedVersion; /* implementation version which last mounted volume */ ++ u_int32_t journalInfoBlock; /* block addr of journal info (if volume is journaled, zero otherwise) */ ++ ++ u_int32_t createDate; /* date and time of volume creation */ ++ u_int32_t modifyDate; /* date and time of last modification */ ++ u_int32_t backupDate; /* date and time of last backup */ ++ u_int32_t checkedDate; /* date and time of last disk check */ ++ ++ u_int32_t fileCount; /* number of files in volume */ ++ u_int32_t folderCount; /* number of directories in volume */ ++ ++ u_int32_t blockSize; /* size (in bytes) of allocation blocks */ ++ u_int32_t totalBlocks; /* number of allocation blocks in volume (includes this header and VBM*/ ++ u_int32_t freeBlocks; /* number of unused allocation blocks */ ++ ++ u_int32_t nextAllocation; /* start of next allocation search */ ++ u_int32_t rsrcClumpSize; /* default resource fork clump size */ ++ u_int32_t dataClumpSize; /* default data fork clump size */ ++ u_int32_t nextCatalogID; /* next unused catalog node ID */ ++ ++ u_int32_t writeCount; /* volume write count */ ++ u_int64_t encodingsBitmap; /* which encodings have been use on this volume */ ++ ++ u_int8_t finderInfo[32]; /* information used by the Finder */ ++ ++ HFSPlusForkData allocationFile; /* allocation bitmap file */ ++ HFSPlusForkData extentsFile; /* extents B-tree file */ ++ HFSPlusForkData catalogFile; /* catalog B-tree file */ ++ HFSPlusForkData attributesFile; /* extended attributes B-tree file */ ++ HFSPlusForkData startupFile; /* boot file (secondary loader) */ ++}PACKED_S; ++typedef struct HFSPlusVolumeHeader HFSPlusVolumeHeader; ++ ++ ++/* B-tree structures */ ++ ++enum BTreeKeyLimits{ ++ kMaxKeyLength = 520 ++}PACKED_S; ++ ++union BTreeKey{ ++ u_int8_t length8; ++ u_int16_t length16; ++ u_int8_t rawData [kMaxKeyLength+2]; ++}PACKED_S; ++typedef union BTreeKey BTreeKey; ++ ++/* BTNodeDescriptor -- Every B-tree node starts with these fields. */ ++struct BTNodeDescriptor { ++ u_int32_t fLink; /* next node at this level*/ ++ u_int32_t bLink; /* previous node at this level*/ ++ int8_t kind; /* kind of node (leaf, index, header, map)*/ ++ u_int8_t height; /* zero for header, map; child is one more than parent*/ ++ u_int16_t numRecords; /* number of records in this node*/ ++ u_int16_t reserved; /* reserved - initialized as zero */ ++}PACKED_S; ++typedef struct BTNodeDescriptor BTNodeDescriptor; ++ ++/* Constants for BTNodeDescriptor kind */ ++enum { ++ kBTLeafNode = -1, ++ kBTIndexNode = 0, ++ kBTHeaderNode = 1, ++ kBTMapNode = 2 ++}PACKED_S; ++ ++/* BTHeaderRec -- The first record of a B-tree header node */ ++struct BTHeaderRec { ++ u_int16_t treeDepth; /* maximum height (usually leaf nodes) */ ++ u_int32_t rootNode; /* node number of root node */ ++ u_int32_t leafRecords; /* number of leaf records in all leaf nodes */ ++ u_int32_t firstLeafNode; /* node number of first leaf node */ ++ u_int32_t lastLeafNode; /* node number of last leaf node */ ++ u_int16_t nodeSize; /* size of a node, in bytes */ ++ u_int16_t maxKeyLength; /* reserved */ ++ u_int32_t totalNodes; /* total number of nodes in tree */ ++ u_int32_t freeNodes; /* number of unused (free) nodes in tree */ ++ u_int16_t reserved1; /* unused */ ++ u_int32_t clumpSize; /* reserved */ ++ u_int8_t btreeType; /* reserved */ ++ u_int8_t keyCompareType; /* Key string Comparison Type */ ++ u_int32_t attributes; /* persistent attributes about the tree */ ++ u_int32_t reserved3[16]; /* reserved */ ++}PACKED_S; ++typedef struct BTHeaderRec BTHeaderRec; ++ ++/* Constants for BTHeaderRec attributes */ ++enum { ++ kBTBadCloseMask = 0x00000001, /* reserved */ ++ kBTBigKeysMask = 0x00000002, /* key length field is 16 bits */ ++ kBTVariableIndexKeysMask = 0x00000004 /* keys in index nodes are variable length */ ++}PACKED_S; ++ ++ ++/* Catalog Key Name Comparison Type */ ++enum { ++ kHFSCaseFolding = 0xCF, /* case folding (case-insensitive) */ ++ kHFSBinaryCompare = 0xBC /* binary compare (case-sensitive) */ ++}PACKED_S; ++ ++/* JournalInfoBlock - Structure that describes where our journal lives */ ++struct JournalInfoBlock { ++ u_int32_t flags; ++ u_int32_t device_signature[8]; // signature used to locate our device. ++ u_int64_t offset; // byte offset to the journal on the device ++ u_int64_t size; // size in bytes of the journal ++ u_int32_t reserved[32]; ++}PACKED_S; ++typedef struct JournalInfoBlock JournalInfoBlock; ++ ++enum { ++ kJIJournalInFSMask = 0x00000001, ++ kJIJournalOnOtherDeviceMask = 0x00000002, ++ kJIJournalNeedInitMask = 0x00000004 ++}PACKED_S; ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* __HFS_FORMAT__ */ +diff --git a/include/hfs/hfs_mount.h b/include/hfs/hfs_mount.h +new file mode 100644 +index 0000000..ad729f2 +--- /dev/null ++++ b/include/hfs/hfs_mount.h +@@ -0,0 +1,78 @@ ++/* ++ * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved. ++ * ++ * @APPLE_LICENSE_HEADER_START@ ++ * ++ * The contents of this file constitute Original Code as defined in and ++ * are subject to the Apple Public Source License Version 1.1 (the ++ * "License"). You may not use this file except in compliance with the ++ * License. Please obtain a copy of the License at ++ * http://www.apple.com/publicsource and read it before using this file. ++ * ++ * This Original Code and all software distributed under the License are ++ * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ++ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ++ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ++ * License for the specific language governing rights and limitations ++ * under the License. ++ * ++ * @APPLE_LICENSE_HEADER_END@ ++ */ ++/* ++ * Copyright (c) 1997-2002 Apple Computer, Inc. All Rights Reserved ++ * ++ */ ++ ++#ifndef _HFS_MOUNT_H_ ++#define _HFS_MOUNT_H_ ++ ++#include ++ ++#include ++#include ++ ++/* ++ * Arguments to mount HFS-based filesystems ++ */ ++ ++#define OVERRIDE_UNKNOWN_PERMISSIONS 0 ++ ++#define UNKNOWNUID ((uid_t)99) ++#define UNKNOWNGID ((gid_t)99) ++#define UNKNOWNPERMISSIONS (S_IRWXU | S_IROTH | S_IXOTH) /* 705 */ ++ ++#ifdef __APPLE_API_UNSTABLE ++struct hfs_mount_args { ++#ifndef KERNEL ++ char *fspec; /* block special device to mount */ ++#endif ++ uid_t hfs_uid; /* uid that owns hfs files (standard HFS only) */ ++ gid_t hfs_gid; /* gid that owns hfs files (standard HFS only) */ ++ mode_t hfs_mask; /* mask to be applied for hfs perms (standard HFS only) */ ++ u_int32_t hfs_encoding; /* encoding for this volume (standard HFS only) */ ++ struct timezone hfs_timezone; /* user time zone info (standard HFS only) */ ++ int flags; /* mounting flags, see below */ ++ int journal_tbuffer_size; /* size in bytes of the journal transaction buffer */ ++ int journal_flags; /* flags to pass to journal_open/create */ ++ int journal_disable; /* don't use journaling (potentially dangerous) */ ++}; ++ ++#define HFSFSMNT_NOXONFILES 0x1 /* disable execute permissions for files */ ++#define HFSFSMNT_WRAPPER 0x2 /* mount HFS wrapper (if it exists) */ ++#define HFSFSMNT_EXTENDED_ARGS 0x4 /* indicates new fields after "flags" are valid */ ++ ++/* ++ * Sysctl values for HFS ++ */ ++#define HFS_ENCODINGBIAS 1 /* encoding matching CJK bias */ ++#define HFS_EXTEND_FS 2 ++#define HFS_ENCODINGHINT 3 /* guess encoding for string */ ++#define HFS_ENABLE_JOURNALING 0x082969 ++#define HFS_DISABLE_JOURNALING 0x031272 ++#define HFS_GET_JOURNAL_INFO 0x6a6e6c69 ++#define HFS_SET_PKG_EXTENSIONS 0x121031 ++ ++#endif /* __APPLE_API_UNSTABLE */ ++ ++#endif /* ! _HFS_MOUNT_H_ */ +diff --git a/include/sys/appleapiopts.h b/include/sys/appleapiopts.h +new file mode 100644 +index 0000000..4d2061f +--- /dev/null ++++ b/include/sys/appleapiopts.h +@@ -0,0 +1,52 @@ ++/* ++ * Copyright (c) 2002 Apple Computer, Inc. All rights reserved. ++ * ++ * @APPLE_LICENSE_HEADER_START@ ++ * ++ * The contents of this file constitute Original Code as defined in and ++ * are subject to the Apple Public Source License Version 1.1 (the ++ * "License"). You may not use this file except in compliance with the ++ * License. Please obtain a copy of the License at ++ * http://www.apple.com/publicsource and read it before using this file. ++ * ++ * This Original Code and all software distributed under the License are ++ * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ++ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ++ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ++ * License for the specific language governing rights and limitations ++ * under the License. ++ * ++ * @APPLE_LICENSE_HEADER_END@ ++ */ ++ ++#ifndef __SYS_APPLEAPIOPTS_H__ ++#define __SYS_APPLEAPIOPTS_H__ ++ ++ ++#ifndef __APPLE_API_STANDARD ++#define __APPLE_API_STANDARD ++#endif /* __APPLE_API_STANDARD */ ++ ++#ifndef __APPLE_API_STABLE ++#define __APPLE_API_STABLE ++#endif /* __APPLE_API_STABLE */ ++ ++#ifndef __APPLE_API_STRICT_CONFORMANCE ++ ++#ifndef __APPLE_API_EVOLVING ++#define __APPLE_API_EVOLVING ++#endif /* __APPLE_API_EVOLVING */ ++ ++#ifndef __APPLE_API_UNSTABLE ++#define __APPLE_API_UNSTABLE ++#endif /* __APPLE_API_UNSTABLE */ ++ ++#ifndef __APPLE_API_OBSOLETE ++#define __APPLE_API_OBSOLETE ++#endif /* __APPLE_API_OBSOLETE */ ++ ++#endif /* __APPLE_API_STRICT_CONFORMANCE */ ++ ++#endif /* __SYS_APPLEAPIOPTS_H__ */ ++ diff --git a/utils/hfsprogs/patches/0004-Fix-compilation-on-64-bit-arches.patch b/utils/hfsprogs/patches/0004-Fix-compilation-on-64-bit-arches.patch new file mode 100644 index 0000000..57f6011 --- /dev/null +++ b/utils/hfsprogs/patches/0004-Fix-compilation-on-64-bit-arches.patch @@ -0,0 +1,131 @@ +From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= +Date: Thu, 24 Oct 2013 01:11:21 -0200 +Subject: Fix compilation on 64-bit arches + +--- + fsck_hfs.tproj/dfalib/BTreePrivate.h | 5 ++++- + fsck_hfs.tproj/dfalib/SControl.c | 8 ++++---- + fsck_hfs.tproj/dfalib/SVerify1.c | 14 +++++++------- + fsck_hfs.tproj/dfalib/hfs_endian.c | 2 +- + 4 files changed, 16 insertions(+), 13 deletions(-) + +diff --git a/fsck_hfs.tproj/dfalib/BTreePrivate.h b/fsck_hfs.tproj/dfalib/BTreePrivate.h +index 058c75b..2fc2f28 100644 +--- a/fsck_hfs.tproj/dfalib/BTreePrivate.h ++++ b/fsck_hfs.tproj/dfalib/BTreePrivate.h +@@ -104,6 +104,9 @@ typedef enum { + + ///////////////////////////////////// Types ///////////////////////////////////// + ++// Forward declaration from Scavenger.h ++struct BTreeExtensionsRec; ++ + typedef struct BTreeControlBlock { // fields specific to BTree CBs + + UInt8 keyCompareType; /* Key string Comparison Type */ +@@ -144,7 +147,7 @@ typedef struct BTreeControlBlock { // fields specific to BTree CBs + UInt32 numPossibleHints; // Looks like a formated hint + UInt32 numValidHints; // Hint used to find correct record. + +- UInt32 refCon; // Used by DFA to point to private data. ++ struct BTreeExtensionsRec *refCon; // Used by DFA to point to private data. + SFCB *fcbPtr; // fcb of btree file + + } BTreeControlBlock, *BTreeControlBlockPtr; +diff --git a/fsck_hfs.tproj/dfalib/SControl.c b/fsck_hfs.tproj/dfalib/SControl.c +index 37eb242..4ce9e16 100644 +--- a/fsck_hfs.tproj/dfalib/SControl.c ++++ b/fsck_hfs.tproj/dfalib/SControl.c +@@ -1034,7 +1034,7 @@ static int ScavTerm( SGlobPtr GPtr ) + btcbP = (BTreeControlBlock*)fcbP->fcbBtree; + if ( btcbP != nil) + { +- if( btcbP->refCon != (UInt32)nil ) ++ if( btcbP->refCon != nil ) + { + if(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != nil) + { +@@ -1043,13 +1043,13 @@ static int ScavTerm( SGlobPtr GPtr ) + } + DisposeMemory( (Ptr)btcbP->refCon ); + err = MemError(); +- btcbP->refCon = (UInt32)nil; ++ btcbP->refCon = nil; + } + + fcbP = GPtr->calculatedCatalogFCB; // release catalog BTree bit map + btcbP = (BTreeControlBlock*)fcbP->fcbBtree; + +- if( btcbP->refCon != (UInt32)nil ) ++ if( btcbP->refCon != nil ) + { + if(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != nil) + { +@@ -1058,7 +1058,7 @@ static int ScavTerm( SGlobPtr GPtr ) + } + DisposeMemory( (Ptr)btcbP->refCon ); + err = MemError(); +- btcbP->refCon = (UInt32)nil; ++ btcbP->refCon = nil; + } + } + } +diff --git a/fsck_hfs.tproj/dfalib/SVerify1.c b/fsck_hfs.tproj/dfalib/SVerify1.c +index c272d4d..a273bf3 100644 +--- a/fsck_hfs.tproj/dfalib/SVerify1.c ++++ b/fsck_hfs.tproj/dfalib/SVerify1.c +@@ -789,8 +789,8 @@ OSErr CreateExtentsBTreeControlBlock( SGlobPtr GPtr ) + // + // set up our DFA extended BTCB area. Will we have enough memory on all HFS+ volumes. + // +- btcb->refCon = (UInt32) AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions +- if ( btcb->refCon == (UInt32) nil ) { ++ btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions ++ if ( btcb->refCon == nil ) { + err = R_NoMem; + goto exit; + } +@@ -1144,8 +1144,8 @@ OSErr CreateCatalogBTreeControlBlock( SGlobPtr GPtr ) + // set up our DFA extended BTCB area. Will we have enough memory on all HFS+ volumes. + // + +- btcb->refCon = (UInt32) AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions +- if ( btcb->refCon == (UInt32)nil ) { ++ btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions ++ if ( btcb->refCon == nil ) { + err = R_NoMem; + goto exit; + } +@@ -1779,8 +1779,8 @@ OSErr CreateAttributesBTreeControlBlock( SGlobPtr GPtr ) + // + // set up our DFA extended BTCB area. Will we have enough memory on all HFS+ volumes. + // +- btcb->refCon = (UInt32) AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions +- if ( btcb->refCon == (UInt32)nil ) { ++ btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions ++ if ( btcb->refCon == nil ) { + err = R_NoMem; + goto exit; + } +@@ -1793,7 +1793,7 @@ OSErr CreateAttributesBTreeControlBlock( SGlobPtr GPtr ) + } + else + { +- if ( btcb->refCon == (UInt32)nil ) { ++ if ( btcb->refCon == nil ) { + err = R_NoMem; + goto exit; + } +diff --git a/fsck_hfs.tproj/dfalib/hfs_endian.c b/fsck_hfs.tproj/dfalib/hfs_endian.c +index 69500c1..3cc9eb4 100755 +--- a/fsck_hfs.tproj/dfalib/hfs_endian.c ++++ b/fsck_hfs.tproj/dfalib/hfs_endian.c +@@ -437,7 +437,7 @@ hfs_swap_HFSPlusBTInternalNode ( + BTNodeDescriptor *srcDesc = src->buffer; + UInt16 *srcOffs = (UInt16 *)((char *)src->buffer + (src->blockSize - (srcDesc->numRecords * sizeof (UInt16)))); + char *nextRecord; /* Points to start of record following current one */ +- UInt32 i; ++ int i; + UInt32 j; + + if (fileID == kHFSExtentsFileID) { diff --git a/utils/hfsprogs/patches/0005-Remove-Apple-specific-p-from-strings.patch b/utils/hfsprogs/patches/0005-Remove-Apple-specific-p-from-strings.patch new file mode 100644 index 0000000..318fd60 --- /dev/null +++ b/utils/hfsprogs/patches/0005-Remove-Apple-specific-p-from-strings.patch @@ -0,0 +1,291 @@ +From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= +Date: Thu, 24 Oct 2013 01:11:21 -0200 +Subject: Remove (Apple-specific?) \p from strings + +Modify the way that debug messages are sent to the user, by eliminating one +character of them. +--- + fsck_hfs.tproj/dfalib/BTreeTreeOps.c | 48 ++++++++++++++++++------------------ + fsck_hfs.tproj/dfalib/SBTree.c | 14 +++++------ + 2 files changed, 31 insertions(+), 31 deletions(-) + +diff --git a/fsck_hfs.tproj/dfalib/BTreeTreeOps.c b/fsck_hfs.tproj/dfalib/BTreeTreeOps.c +index b812b14..37fb170 100644 +--- a/fsck_hfs.tproj/dfalib/BTreeTreeOps.c ++++ b/fsck_hfs.tproj/dfalib/BTreeTreeOps.c +@@ -223,7 +223,7 @@ OSStatus SearchTree (BTreeControlBlockPtr btreePtr, + // + if (curNodeNum == 0) + { +-// Panic("\pSearchTree: curNodeNum is zero!"); ++ Panic("SearchTree: curNodeNum is zero!"); + err = fsBTInvalidNodeErr; + goto ErrorExit; + } +@@ -433,7 +433,7 @@ OSStatus InsertLevel (BTreeControlBlockPtr btreePtr, + M_ExitOnError (err); + + if ( DEBUG_BUILD && updateParent && newRoot ) +- DebugStr("\p InsertLevel: New root from primary key, update from secondary key..."); ++ DebugStr("InsertLevel: New root from primary key, update from secondary key..."); + } + + //////////////////////// Update Parent(s) /////////////////////////////// +@@ -448,7 +448,7 @@ OSStatus InsertLevel (BTreeControlBlockPtr btreePtr, + + secondaryKey = nil; + +- PanicIf ( (level == btreePtr->treeDepth), "\p InsertLevel: unfinished insert!?"); ++ PanicIf ( (level == btreePtr->treeDepth), "InsertLevel: unfinished insert!?"); + + ++level; + +@@ -456,7 +456,7 @@ OSStatus InsertLevel (BTreeControlBlockPtr btreePtr, + index = treePathTable [level].index; + parentNodeNum = treePathTable [level].node; + +- PanicIf ( parentNodeNum == 0, "\p InsertLevel: parent node is zero!?"); ++ PanicIf ( parentNodeNum == 0, "InsertLevel: parent node is zero!?"); + + err = GetNode (btreePtr, parentNodeNum, &parentNode); // released as target node in next level up + M_ExitOnError (err); +@@ -470,7 +470,7 @@ OSStatus InsertLevel (BTreeControlBlockPtr btreePtr, + { + //¥¥Êdebug: check if ptr == targetNodeNum + GetRecordByIndex (btreePtr, parentNode.buffer, index, &keyPtr, &recPtr, &recSize); +- PanicIf( (*(UInt32 *) recPtr) != targetNodeNum, "\p InsertLevel: parent ptr doesn't match target node!"); ++ PanicIf( (*(UInt32 *) recPtr) != targetNodeNum, "InsertLevel: parent ptr doesn't match target node!"); + + // need to delete and re-insert this parent key/ptr + // we delete it here and it gets re-inserted in the +@@ -532,7 +532,7 @@ ErrorExit: + (void) ReleaseNode (btreePtr, targetNode); + (void) ReleaseNode (btreePtr, &siblingNode); + +- Panic ("\p InsertLevel: an error occured!"); ++ Panic ("InsertLevel: an error occured!"); + + return err; + +@@ -566,7 +566,7 @@ static OSErr InsertNode (BTreeControlBlockPtr btreePtr, + + *rootSplit = false; + +- PanicIf ( targetNode->buffer == siblingNode->buffer, "\p InsertNode: targetNode == siblingNode, huh?"); ++ PanicIf ( targetNode->buffer == siblingNode->buffer, "InsertNode: targetNode == siblingNode, huh?"); + + leftNodeNum = ((NodeDescPtr) targetNode->buffer)->bLink; + rightNodeNum = ((NodeDescPtr) targetNode->buffer)->fLink; +@@ -606,7 +606,7 @@ static OSErr InsertNode (BTreeControlBlockPtr btreePtr, + + if ( leftNodeNum > 0 ) + { +- PanicIf ( siblingNode->buffer != nil, "\p InsertNode: siblingNode already aquired!"); ++ PanicIf ( siblingNode->buffer != nil, "InsertNode: siblingNode already aquired!"); + + if ( siblingNode->buffer == nil ) + { +@@ -614,7 +614,7 @@ static OSErr InsertNode (BTreeControlBlockPtr btreePtr, + M_ExitOnError (err); + } + +- PanicIf ( ((NodeDescPtr) siblingNode->buffer)->fLink != nodeNum, "\p InsertNode, RotateLeft: invalid sibling link!" ); ++ PanicIf ( ((NodeDescPtr) siblingNode->buffer)->fLink != nodeNum, "InsertNode, RotateLeft: invalid sibling link!" ); + + if ( !key->skipRotate ) // are rotates allowed? + { +@@ -703,7 +703,7 @@ OSStatus DeleteTree (BTreeControlBlockPtr btreePtr, + + targetNodeNum = treePathTable[level].node; + targetNodePtr = targetNode->buffer; +- PanicIf (targetNodePtr == nil, "\pDeleteTree: targetNode has nil buffer!"); ++ PanicIf (targetNodePtr == nil, "DeleteTree: targetNode has nil buffer!"); + + DeleteRecord (btreePtr, targetNodePtr, index); + +@@ -797,7 +797,7 @@ OSStatus DeleteTree (BTreeControlBlockPtr btreePtr, + + //¥¥Êdebug: check if ptr == targetNodeNum + GetRecordByIndex (btreePtr, parentNode.buffer, index, &keyPtr, &recPtr, &recSize); +- PanicIf( (*(UInt32 *) recPtr) != targetNodeNum, "\p DeleteTree: parent ptr doesn't match targetNodeNum!!"); ++ PanicIf( (*(UInt32 *) recPtr) != targetNodeNum, " DeleteTree: parent ptr doesn't match targetNodeNum!!"); + + // need to delete and re-insert this parent key/ptr + DeleteRecord (btreePtr, parentNode.buffer, index); +@@ -1018,7 +1018,7 @@ static OSStatus RotateLeft (BTreeControlBlockPtr btreePtr, + keyPtr, keyLength, recPtr, recSize); + if ( !didItFit ) + { +- Panic ("\pRotateLeft: InsertKeyRecord (left) returned false!"); ++ Panic ("RotateLeft: InsertKeyRecord (left) returned false!"); + err = fsBTBadRotateErr; + goto ErrorExit; + } +@@ -1031,7 +1031,7 @@ static OSStatus RotateLeft (BTreeControlBlockPtr btreePtr, + didItFit = RotateRecordLeft (btreePtr, leftNode, rightNode); + if ( !didItFit ) + { +- Panic ("\pRotateLeft: RotateRecordLeft returned false!"); ++ Panic ("RotateLeft: RotateRecordLeft returned false!"); + err = fsBTBadRotateErr; + goto ErrorExit; + } +@@ -1048,7 +1048,7 @@ static OSStatus RotateLeft (BTreeControlBlockPtr btreePtr, + keyPtr, keyLength, recPtr, recSize); + if ( !didItFit ) + { +- Panic ("\pRotateLeft: InsertKeyRecord (right) returned false!"); ++ Panic ("RotateLeft: InsertKeyRecord (right) returned false!"); + err = fsBTBadRotateErr; + goto ErrorExit; + } +@@ -1117,7 +1117,7 @@ static OSStatus SplitLeft (BTreeControlBlockPtr btreePtr, + right = rightNode->buffer; + left = leftNode->buffer; + +- PanicIf ( right->bLink != 0 && left == 0, "\p SplitLeft: left sibling missing!?" ); ++ PanicIf ( right->bLink != 0 && left == 0, " SplitLeft: left sibling missing!?" ); + + //¥¥ type should be kLeafNode or kIndexNode + +@@ -1240,8 +1240,8 @@ static OSStatus AddNewRootNode (BTreeControlBlockPtr btreePtr, + Boolean didItFit; + UInt16 keyLength; + +- PanicIf (leftNode == nil, "\pAddNewRootNode: leftNode == nil"); +- PanicIf (rightNode == nil, "\pAddNewRootNode: rightNode == nil"); ++ PanicIf (leftNode == nil, "AddNewRootNode: leftNode == nil"); ++ PanicIf (rightNode == nil, "AddNewRootNode: rightNode == nil"); + + + /////////////////////// Initialize New Root Node //////////////////////////// +@@ -1264,7 +1264,7 @@ static OSStatus AddNewRootNode (BTreeControlBlockPtr btreePtr, + didItFit = InsertKeyRecord ( btreePtr, rootNode.buffer, 0, keyPtr, keyLength, + (UInt8 *) &rightNode->bLink, 4 ); + +- PanicIf ( !didItFit, "\pAddNewRootNode:InsertKeyRecord failed for left index record"); ++ PanicIf ( !didItFit, "AddNewRootNode:InsertKeyRecord failed for left index record"); + + + //////////////////// Insert Right Node Index Record ///////////////////////// +@@ -1275,7 +1275,7 @@ static OSStatus AddNewRootNode (BTreeControlBlockPtr btreePtr, + didItFit = InsertKeyRecord ( btreePtr, rootNode.buffer, 1, keyPtr, keyLength, + (UInt8 *) &leftNode->fLink, 4 ); + +- PanicIf ( !didItFit, "\pAddNewRootNode:InsertKeyRecord failed for right index record"); ++ PanicIf ( !didItFit, "AddNewRootNode:InsertKeyRecord failed for right index record"); + + + #if DEBUG_TREEOPS +@@ -1355,7 +1355,7 @@ static OSStatus SplitRight (BTreeControlBlockPtr btreePtr, + } + rightPtr = rightNodePtr->buffer; + +- PanicIf ( leftPtr->fLink != 0 && rightPtr == 0, "\p SplitRight: right sibling missing!?" ); ++ PanicIf ( leftPtr->fLink != 0 && rightPtr == 0, "SplitRight: right sibling missing!?" ); + + //¥¥ type should be kLeafNode or kIndexNode + +@@ -1557,7 +1557,7 @@ static OSStatus RotateRight (BTreeControlBlockPtr btreePtr, + keyPtr, keyLength, recPtr, recSize); + if ( !didItFit ) + { +- Panic ("\pRotateRight: InsertKeyRecord (left) returned false!"); ++ Panic ("RotateRight: InsertKeyRecord (left) returned false!"); + err = fsBTBadRotateErr; + goto ErrorExit; + } +@@ -1572,7 +1572,7 @@ static OSStatus RotateRight (BTreeControlBlockPtr btreePtr, + didItFit = RotateRecordRight( btreePtr, leftNodePtr, rightNodePtr ); + if ( !didItFit ) + { +- Panic ("\pRotateRight: RotateRecordRight returned false!"); ++ Panic ("RotateRight: RotateRecordRight returned false!"); + err = fsBTBadRotateErr; + goto ErrorExit; + } +@@ -1583,7 +1583,7 @@ static OSStatus RotateRight (BTreeControlBlockPtr btreePtr, + keyPtr, keyLength, recPtr, recSize); + if ( !didItFit ) + { +- Panic ("\pRotateRight: InsertKeyRecord (left) returned false!"); ++ Panic ("RotateRight: InsertKeyRecord (left) returned false!"); + err = fsBTBadRotateErr; + goto ErrorExit; + } +@@ -1607,7 +1607,7 @@ static OSStatus RotateRight (BTreeControlBlockPtr btreePtr, + keyPtr, keyLength, recPtr, recSize); + if ( !didItFit ) + { +- Panic ("\pRotateRight: InsertKeyRecord (right) returned false!"); ++ Panic ("RotateRight: InsertKeyRecord (right) returned false!"); + err = fsBTBadRotateErr; + goto ErrorExit; + } +diff --git a/fsck_hfs.tproj/dfalib/SBTree.c b/fsck_hfs.tproj/dfalib/SBTree.c +index cd81b13..eeb4e8c 100644 +--- a/fsck_hfs.tproj/dfalib/SBTree.c ++++ b/fsck_hfs.tproj/dfalib/SBTree.c +@@ -103,7 +103,7 @@ OSErr SearchBTreeRecord(SFCB *fcb, const void* key, UInt32 hint, void* foundKey, + CopyMemory(&resultIterator->key, foundKey, CalcKeySize(btcb, &resultIterator->key)); //¥¥ warning, this could overflow user's buffer!!! + + if ( DEBUG_BUILD && !ValidHFSRecord(data, btcb, *dataSize) ) +- DebugStr("\pSearchBTreeRecord: bad record?"); ++ DebugStr("SearchBTreeRecord: bad record?"); + } + + ErrorExit: +@@ -211,7 +211,7 @@ OSErr GetBTreeRecord(SFCB *fcb, SInt16 selectionIndex, void* key, void* data, UI + CopyMemory(&iterator->key, key, CalcKeySize(btcb, &iterator->key)); //¥¥ warning, this could overflow user's buffer!!! + + if ( DEBUG_BUILD && !ValidHFSRecord(data, btcb, *dataSize) ) +- DebugStr("\pGetBTreeRecord: bad record?"); ++ DebugStr("GetBTreeRecord: bad record?"); + + } + +@@ -243,7 +243,7 @@ OSErr InsertBTreeRecord(SFCB *fcb, const void* key, const void* data, UInt16 dat + CopyMemory(key, &iterator.key, CalcKeySize(btcb, (BTreeKey *) key)); //¥¥ should we range check against maxkeylen? + + if ( DEBUG_BUILD && !ValidHFSRecord(data, btcb, dataSize) ) +- DebugStr("\pInsertBTreeRecord: bad record?"); ++ DebugStr("InsertBTreeRecord: bad record?"); + + result = BTInsertRecord( fcb, &iterator, &btRecord, dataSize ); + +@@ -305,7 +305,7 @@ OSErr ReplaceBTreeRecord(SFCB *fcb, const void* key, UInt32 hint, void *newData, + CopyMemory(key, &iterator.key, CalcKeySize(btcb, (BTreeKey *) key)); //¥¥ should we range check against maxkeylen? + + if ( DEBUG_BUILD && !ValidHFSRecord(newData, btcb, dataSize) ) +- DebugStr("\pReplaceBTreeRecord: bad record?"); ++ DebugStr("ReplaceBTreeRecord: bad record?"); + + result = BTReplaceRecord( fcb, &iterator, &btRecord, dataSize ); + +@@ -344,7 +344,7 @@ SetEndOfForkProc ( SFCB *filePtr, FSSize minEOF, FSSize maxEOF ) + else + { + if ( DEBUG_BUILD ) +- DebugStr("\pSetEndOfForkProc: minEOF is smaller than current size!"); ++ DebugStr("SetEndOfForkProc: minEOF is smaller than current size!"); + return -1; + } + +@@ -370,7 +370,7 @@ SetEndOfForkProc ( SFCB *filePtr, FSSize minEOF, FSSize maxEOF ) + // Make sure we got at least as much space as we needed + // + if (filePtr->fcbLogicalSize < minEOF) { +- Panic("\pSetEndOfForkProc: disk too full to extend B-tree file"); ++ Panic("SetEndOfForkProc: disk too full to extend B-tree file"); + return dskFulErr; + } + +@@ -442,7 +442,7 @@ static OSErr CheckBTreeKey(const BTreeKey *key, const BTreeControlBlock *btcb) + if ( (keyLen < 6) || (keyLen > btcb->maxKeyLength) ) + { + if ( DEBUG_BUILD ) +- DebugStr("\pCheckBTreeKey: bad key length!"); ++ DebugStr("CheckBTreeKey: bad key length!"); + return fsBTInvalidKeyLengthErr; + } + diff --git a/utils/hfsprogs/patches/0006-Adjust-types-for-printing.patch b/utils/hfsprogs/patches/0006-Adjust-types-for-printing.patch new file mode 100644 index 0000000..09efbb6 --- /dev/null +++ b/utils/hfsprogs/patches/0006-Adjust-types-for-printing.patch @@ -0,0 +1,37 @@ +From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= +Date: Thu, 24 Oct 2013 01:11:21 -0200 +Subject: Adjust types for printing + +Try to address the issues of a given integral type having different sizes +in 32 and 64-bit architectures. +--- + fsck_hfs.tproj/dfalib/SControl.c | 2 +- + fsck_hfs.tproj/dfalib/hfs_endian.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/fsck_hfs.tproj/dfalib/SControl.c b/fsck_hfs.tproj/dfalib/SControl.c +index 4ce9e16..8b03ece 100644 +--- a/fsck_hfs.tproj/dfalib/SControl.c ++++ b/fsck_hfs.tproj/dfalib/SControl.c +@@ -776,7 +776,7 @@ static int ScavSetUp( SGlob *GPtr) + pointer = (ScavStaticStructures *) AllocateClearMemory( sizeof(ScavStaticStructures) ); + if ( pointer == nil ) { + if ( GPtr->logLevel >= kDebugLog ) { +- printf( "\t error %d - could not allocate %ld bytes of memory \n", ++ printf( "\t error %d - could not allocate %i bytes of memory \n", + R_NoMem, sizeof(ScavStaticStructures) ); + } + return( R_NoMem ); +diff --git a/fsck_hfs.tproj/dfalib/hfs_endian.c b/fsck_hfs.tproj/dfalib/hfs_endian.c +index 3cc9eb4..6ca2ac1 100755 +--- a/fsck_hfs.tproj/dfalib/hfs_endian.c ++++ b/fsck_hfs.tproj/dfalib/hfs_endian.c +@@ -563,7 +563,7 @@ hfs_swap_HFSPlusBTInternalNode ( + /* Make sure name length is consistent with key length */ + if (keyLength < sizeof(srcKey->parentID) + sizeof(srcKey->nodeName.length) + + srcKey->nodeName.length*sizeof(srcKey->nodeName.unicode[0])) { +- if (debug) printf("hfs_swap_HFSPlusBTInternalNode: catalog record #%d keyLength=%d expected=%lu\n", ++ if (debug) printf("hfs_swap_HFSPlusBTInternalNode: catalog record #%d keyLength=%d expected=%i\n", + srcDesc->numRecords-i, keyLength, sizeof(srcKey->parentID) + sizeof(srcKey->nodeName.length) + + srcKey->nodeName.length*sizeof(srcKey->nodeName.unicode[0])); + WriteError(fcb->fcbVolume->vcbGPtr, E_KeyLen, fcb->fcbFileID, src->blockNum); diff --git a/utils/hfsprogs/patches/0007-Fix-path-for-HFS-wrapper-block.patch b/utils/hfsprogs/patches/0007-Fix-path-for-HFS-wrapper-block.patch new file mode 100644 index 0000000..f92bb22 --- /dev/null +++ b/utils/hfsprogs/patches/0007-Fix-path-for-HFS-wrapper-block.patch @@ -0,0 +1,23 @@ +From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= +Date: Thu, 24 Oct 2013 01:11:21 -0200 +Subject: Fix path for HFS wrapper block + +Fix the installation of the HFS wrapper block to be compliant in Linux +systems (since it is arch independent). +--- + newfs_hfs.tproj/makehfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/newfs_hfs.tproj/makehfs.c b/newfs_hfs.tproj/makehfs.c +index 7609779..2233ef7 100644 +--- a/newfs_hfs.tproj/makehfs.c ++++ b/newfs_hfs.tproj/makehfs.c +@@ -70,7 +70,7 @@ extern Boolean _CFStringGetFileSystemRepresentation(CFStringRef string, UInt8 *b + #include "readme.h" + + +-#define HFS_BOOT_DATA "/usr/share/misc/hfsbootdata" ++#define HFS_BOOT_DATA "/usr/share/hfsprogs/hfsbootdata" + + #define HFS_JOURNAL_FILE ".journal" + #define HFS_JOURNAL_INFO ".journal_info_block" diff --git a/utils/hfsprogs/patches/0008-Provide-command-line-option-a.patch b/utils/hfsprogs/patches/0008-Provide-command-line-option-a.patch new file mode 100644 index 0000000..366dbbc --- /dev/null +++ b/utils/hfsprogs/patches/0008-Provide-command-line-option-a.patch @@ -0,0 +1,40 @@ +From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= +Date: Thu, 24 Oct 2013 01:11:21 -0200 +Subject: Provide command line option -a + +Create a new command line option (-a) for the fsck.hfsplus that has the same +behavior that the -p option has, for greater compatibility with other tools. +--- + fsck_hfs.tproj/fsck_hfs.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/fsck_hfs.tproj/fsck_hfs.c b/fsck_hfs.tproj/fsck_hfs.c +index f1a18bd..6117698 100644 +--- a/fsck_hfs.tproj/fsck_hfs.c ++++ b/fsck_hfs.tproj/fsck_hfs.c +@@ -104,7 +104,7 @@ main(argc, argv) + else + progname = *argv; + +- while ((ch = getopt(argc, argv, "c:D:dfglm:npqruy")) != EOF) { ++ while ((ch = getopt(argc, argv, "c:D:dfglm:napqruy")) != EOF) { + switch (ch) { + case 'c': + /* Cache size to use in fsck_hfs */ +@@ -169,6 +169,7 @@ main(argc, argv) + yflag = 0; + break; + ++ case 'a': + case 'p': + preen++; + break; +@@ -572,7 +573,7 @@ usage() + (void) fprintf(stderr, " l = live fsck (lock down and test-only)\n"); + (void) fprintf(stderr, " m arg = octal mode used when creating lost+found directory \n"); + (void) fprintf(stderr, " n = assume a no response \n"); +- (void) fprintf(stderr, " p = just fix normal inconsistencies \n"); ++ (void) fprintf(stderr, " p, a = just fix normal inconsistencies \n"); + (void) fprintf(stderr, " q = quick check returns clean, dirty, or failure \n"); + (void) fprintf(stderr, " r = rebuild catalog btree \n"); + (void) fprintf(stderr, " u = usage \n"); diff --git a/utils/hfsprogs/patches/0009-Rename-dprintf-to-dbg_printf.patch b/utils/hfsprogs/patches/0009-Rename-dprintf-to-dbg_printf.patch new file mode 100644 index 0000000..23f8518 --- /dev/null +++ b/utils/hfsprogs/patches/0009-Rename-dprintf-to-dbg_printf.patch @@ -0,0 +1,187 @@ +From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= +Date: Thu, 24 Oct 2013 01:11:21 -0200 +Subject: Rename dprintf to dbg_printf + +--- + fsck_hfs.tproj/dfalib/SRepair.c | 18 +++++++++--------- + fsck_hfs.tproj/dfalib/SVerify1.c | 6 +++--- + fsck_hfs.tproj/fsck_debug.c | 10 +++++----- + fsck_hfs.tproj/fsck_debug.h | 10 +++++----- + 4 files changed, 22 insertions(+), 22 deletions(-) + +diff --git a/fsck_hfs.tproj/dfalib/SRepair.c b/fsck_hfs.tproj/dfalib/SRepair.c +index 8eb759c..89c12d6 100644 +--- a/fsck_hfs.tproj/dfalib/SRepair.c ++++ b/fsck_hfs.tproj/dfalib/SRepair.c +@@ -1825,13 +1825,13 @@ static OSErr FixAttrSize(SGlobPtr GPtr, RepairOrderPtr p) + result = BTSearchRecord(GPtr->calculatedAttributesFCB, &iterator, + kInvalidMRUCacheKey, &btRecord, &recSize, &iterator); + if (result) { +- dprintf (d_error|d_xattr, "%s: Cannot find attribute record (err = %d)\n", __FUNCTION__, result); ++ dbg_printf (d_error|d_xattr, "%s: Cannot find attribute record (err = %d)\n", __FUNCTION__, result); + goto out; + } + + /* We should only get record of type kHFSPlusAttrForkData */ + if (record.recordType != kHFSPlusAttrForkData) { +- dprintf (d_error|d_xattr, "%s: Record found is not attribute fork data\n", __FUNCTION__); ++ dbg_printf (d_error|d_xattr, "%s: Record found is not attribute fork data\n", __FUNCTION__); + result = btNotFound; + goto out; + } +@@ -1862,7 +1862,7 @@ static OSErr FixAttrSize(SGlobPtr GPtr, RepairOrderPtr p) + result = BTReplaceRecord(GPtr->calculatedAttributesFCB, &iterator, + &btRecord, recSize); + if (result) { +- dprintf (d_error|d_xattr, "%s: Cannot replace attribute record (err=%d)\n", __FUNCTION__, result); ++ dbg_printf (d_error|d_xattr, "%s: Cannot replace attribute record (err=%d)\n", __FUNCTION__, result); + goto out; + } + } +@@ -2058,7 +2058,7 @@ del_overflow_extents: + + /* Delete the extent record */ + err = DeleteBTreeRecord(GPtr->calculatedExtentsFCB, &extentKey); +- dprintf (d_info, "%s: Deleting extent overflow for fileID=%u, forkType=%u, startBlock=%u\n", __FUNCTION__, fileID, forkType, foundStartBlock); ++ dbg_printf (d_info, "%s: Deleting extent overflow for fileID=%u, forkType=%u, startBlock=%u\n", __FUNCTION__, fileID, forkType, foundStartBlock); + if (err) { + goto create_symlink; + } +@@ -3227,12 +3227,12 @@ static OSErr MoveExtent(SGlobPtr GPtr, ExtentInfo *extentInfo) + &extentData, &recordSize, &foundExtentIndex); + foundLocation = extentsBTree; + if (err != noErr) { +- dprintf (d_error|d_overlap, "%s: No matching extent record found in extents btree for fileID = %d (err=%d)\n", __FUNCTION__, extentInfo->fileID, err); ++ dbg_printf (d_error|d_overlap, "%s: No matching extent record found in extents btree for fileID = %d (err=%d)\n", __FUNCTION__, extentInfo->fileID, err); + goto out; + } + } else { + /* No more extents exist for this file */ +- dprintf (d_error|d_overlap, "%s: No matching extent record found for fileID = %d\n", __FUNCTION__, extentInfo->fileID); ++ dbg_printf (d_error|d_overlap, "%s: No matching extent record found for fileID = %d\n", __FUNCTION__, extentInfo->fileID); + goto out; + } + } +@@ -3241,7 +3241,7 @@ static OSErr MoveExtent(SGlobPtr GPtr, ExtentInfo *extentInfo) + err = CopyDiskBlocks(GPtr, extentInfo->startBlock, extentInfo->blockCount, + extentInfo->newStartBlock); + if (err != noErr) { +- dprintf (d_error|d_overlap, "%s: Error in copying disk blocks for fileID = %d (err=%d)\n", __FUNCTION__, extentInfo->fileID, err); ++ dbg_printf (d_error|d_overlap, "%s: Error in copying disk blocks for fileID = %d (err=%d)\n", __FUNCTION__, extentInfo->fileID, err); + goto out; + } + +@@ -3260,7 +3260,7 @@ static OSErr MoveExtent(SGlobPtr GPtr, ExtentInfo *extentInfo) + + } + if (err != noErr) { +- dprintf (d_error|d_overlap, "%s: Error in updating extent record for fileID = %d (err=%d)\n", __FUNCTION__, extentInfo->fileID, err); ++ dbg_printf (d_error|d_overlap, "%s: Error in updating extent record for fileID = %d (err=%d)\n", __FUNCTION__, extentInfo->fileID, err); + goto out; + } + +@@ -3491,7 +3491,7 @@ static OSErr SearchExtentInAttributeBT(SGlobPtr GPtr, ExtentInfo *extentInfo, + result = BTSearchRecord(GPtr->calculatedAttributesFCB, &iterator, + kInvalidMRUCacheKey, &btRecord, recordSize, &iterator); + if (result) { +- dprintf (d_error|d_overlap, "%s: Error finding attribute record (err=%d) for fileID = %d, attrname = %d\n", __FUNCTION__, result, extentInfo->fileID, extentInfo->attrname); ++ dbg_printf (d_error|d_overlap, "%s: Error finding attribute record (err=%d) for fileID = %d, attrname = %d\n", __FUNCTION__, result, extentInfo->fileID, extentInfo->attrname); + goto out; + } + +diff --git a/fsck_hfs.tproj/dfalib/SVerify1.c b/fsck_hfs.tproj/dfalib/SVerify1.c +index a273bf3..39bda5c 100644 +--- a/fsck_hfs.tproj/dfalib/SVerify1.c ++++ b/fsck_hfs.tproj/dfalib/SVerify1.c +@@ -2157,9 +2157,9 @@ CheckAttributeRecord(SGlobPtr GPtr, const HFSPlusAttrKey *key, const HFSPlusAttr + + if (doDelete == true) { + result = DeleteBTreeRecord(GPtr->calculatedAttributesFCB, key); +- dprintf (d_info|d_xattr, "%s: Deleting attribute %s for fileID %d, type = %d\n", __FUNCTION__, attrname, key->fileID, rec->recordType); ++ dbg_printf (d_info|d_xattr, "%s: Deleting attribute %s for fileID %d, type = %d\n", __FUNCTION__, attrname, key->fileID, rec->recordType); + if (result) { +- dprintf (d_error|d_xattr, "%s: Error in deleting record for %s for fileID %d, type = %d\n", __FUNCTION__, attrname, key->fileID, rec->recordType); ++ dbg_printf (d_error|d_xattr, "%s: Error in deleting record for %s for fileID %d, type = %d\n", __FUNCTION__, attrname, key->fileID, rec->recordType); + } + + /* Set flags to mark header and map dirty */ +@@ -3034,7 +3034,7 @@ OSErr CheckFileExtents( SGlobPtr GPtr, UInt32 fileNumber, UInt8 forkType, + // checkout the extent record first + err = ChkExtRec( GPtr, extents, &lastExtentIndex ); + if (err != noErr) { +- dprintf (d_info, "%s: Bad extent for fileID %u in extent %u for startblock %u\n", __FUNCTION__, fileNumber, lastExtentIndex, blockCount); ++ dbg_printf (d_info, "%s: Bad extent for fileID %u in extent %u for startblock %u\n", __FUNCTION__, fileNumber, lastExtentIndex, blockCount); + + /* Stop verification if bad extent is found for system file or EA */ + if ((fileNumber < kHFSFirstUserCatalogNodeID) || +diff --git a/fsck_hfs.tproj/fsck_debug.c b/fsck_hfs.tproj/fsck_debug.c +index 1be3fc5..77e8e51 100644 +--- a/fsck_hfs.tproj/fsck_debug.c ++++ b/fsck_hfs.tproj/fsck_debug.c +@@ -25,18 +25,18 @@ + #include + #include + +-/* Current debug level of fsck_hfs for printing messages via dprintf */ ++/* Current debug level of fsck_hfs for printing messages via dbg_printf */ + unsigned long cur_debug_level; + +-/* Function: dprintf ++/* Function: dbg_printf + * + * Description: Debug function similar to printf except the first parameter +- * which indicates the type of message to be printed by dprintf. Based on ++ * which indicates the type of message to be printed by dbg_printf. Based on + * current debug level and the type of message, the function decides + * whether to print the message or not. + * + * Each unique message type has a bit assigned to it. The message type +- * passed to dprintf can be one or combination (OR-ed value) of pre-defined ++ * passed to dbg_printf can be one or combination (OR-ed value) of pre-defined + * debug message types. Only the messages whose type have one or more similar + * bits set in comparison with current global debug level are printed. + * +@@ -56,7 +56,7 @@ unsigned long cur_debug_level; + * Output: + * Nothing + */ +-void dprintf (unsigned long type, char *fmt, ...) ++void dbg_printf (unsigned long type, char *fmt, ...) + { + if (cur_debug_level & type) { + va_list ap; +diff --git a/fsck_hfs.tproj/fsck_debug.h b/fsck_hfs.tproj/fsck_debug.h +index 81e3932..cb1b9be 100644 +--- a/fsck_hfs.tproj/fsck_debug.h ++++ b/fsck_hfs.tproj/fsck_debug.h +@@ -36,18 +36,18 @@ enum debug_message_type { + d_overlap = 0x0020 /* Overlap extents related messages */ + }; + +-/* Current debug level of fsck_hfs for printing messages via dprintf */ ++/* Current debug level of fsck_hfs for printing messages via dbg_printf */ + extern unsigned long cur_debug_level; + +-/* Function: dprintf ++/* Function: dbg_printf + * + * Description: Debug function similar to printf except the first parameter +- * which indicates the type of message to be printed by dprintf. Based on ++ * which indicates the type of message to be printed by dbg_printf. Based on + * current debug level and the type of message, the function decides + * whether to print the message or not. + * + * Each unique message type has a bit assigned to it. The message type +- * passed to dprintf can be one or combination (OR-ed value) of pre-defined ++ * passed to dbg_printf can be one or combination (OR-ed value) of pre-defined + * debug message types. Only the messages whose type have one or more similar + * bits set in comparison with current global debug level are printed. + * +@@ -67,6 +67,6 @@ extern unsigned long cur_debug_level; + * Output: + * Nothing + */ +-extern void dprintf (unsigned long message_type, char *format, ...); ++extern void dbg_printf (unsigned long message_type, char *format, ...); + + #endif /* __FSCK_DEBUG__ */ diff --git a/utils/hfsprogs/patches/0010-Rename-custom-macro-nil-with-NULL.patch b/utils/hfsprogs/patches/0010-Rename-custom-macro-nil-with-NULL.patch new file mode 100644 index 0000000..354b4ff --- /dev/null +++ b/utils/hfsprogs/patches/0010-Rename-custom-macro-nil-with-NULL.patch @@ -0,0 +1,1319 @@ +From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= +Date: Thu, 24 Oct 2013 01:11:21 -0200 +Subject: Rename custom macro nil with NULL + +--- + fsck_hfs.tproj/dfalib/BTree.c | 142 +++++++++++++++++----------------- + fsck_hfs.tproj/dfalib/BTreeAllocate.c | 14 ++-- + fsck_hfs.tproj/dfalib/BTreeMiscOps.c | 26 +++---- + fsck_hfs.tproj/dfalib/BTreeNodeOps.c | 30 +++---- + fsck_hfs.tproj/dfalib/BTreeTreeOps.c | 38 ++++----- + fsck_hfs.tproj/dfalib/SControl.c | 56 +++++++------- + fsck_hfs.tproj/dfalib/SRepair.c | 6 +- + fsck_hfs.tproj/dfalib/SUtils.c | 6 +- + fsck_hfs.tproj/dfalib/SVerify1.c | 32 ++++---- + fsck_hfs.tproj/dfalib/SVerify2.c | 4 +- + 10 files changed, 177 insertions(+), 177 deletions(-) + +diff --git a/fsck_hfs.tproj/dfalib/BTree.c b/fsck_hfs.tproj/dfalib/BTree.c +index 7ad9fe0..c0c8744 100644 +--- a/fsck_hfs.tproj/dfalib/BTree.c ++++ b/fsck_hfs.tproj/dfalib/BTree.c +@@ -163,21 +163,21 @@ OSStatus BTInitialize (FCB *filePtr, + + ////////////////////// Preliminary Error Checking /////////////////////////// + +- headerNode.buffer = nil; ++ headerNode.buffer = NULL; + +- if (pathPtr == nil) return paramErr; ++ if (pathPtr == NULL) return paramErr; + + setEndOfForkProc = pathPtr->agentPtr->agent.setEndOfForkProc; + setBlockSizeProc = pathPtr->agentPtr->agent.setBlockSizeProc; + +- if (pathPtr->agentPtr->agent.getBlockProc == nil) return E_NoGetBlockProc; +- if (pathPtr->agentPtr->agent.releaseBlockProc == nil) return E_NoReleaseBlockProc; +- if (setEndOfForkProc == nil) return E_NoSetEndOfForkProc; +- if (setBlockSizeProc == nil) return E_NoSetBlockSizeProc; ++ if (pathPtr->agentPtr->agent.getBlockProc == NULL) return E_NoGetBlockProc; ++ if (pathPtr->agentPtr->agent.releaseBlockProc == NULL) return E_NoReleaseBlockProc; ++ if (setEndOfForkProc == NULL) return E_NoSetEndOfForkProc; ++ if (setBlockSizeProc == NULL) return E_NoSetBlockSizeProc; + + forkPtr = pathPtr->path.forkPtr; + +- if (forkPtr->fork.btreePtr != nil) return fsBTrFileAlreadyOpenErr; ++ if (forkPtr->fork.btreePtr != NULL) return fsBTrFileAlreadyOpenErr; + + if ((maxKeyLength == 0) || + (maxKeyLength > kMaxKeyLength)) return fsBTInvalidKeyLengthErr; +@@ -209,7 +209,7 @@ OSStatus BTInitialize (FCB *filePtr, + //////////////////////// Allocate Control Block ///////////////////////////// + + M_RESIDENT_ALLOCATE_FIXED_CLEAR( &btreePtr, sizeof( BTreeControlBlock ), kFSBTreeControlBlockType ); +- if (btreePtr == nil) ++ if (btreePtr == NULL) + { + err = memFullErr; + goto ErrorExit; +@@ -220,7 +220,7 @@ OSStatus BTInitialize (FCB *filePtr, + btreePtr->flags = 0; + btreePtr->attributes = 0; + btreePtr->forkPtr = forkPtr; +- btreePtr->keyCompareProc = nil; ++ btreePtr->keyCompareProc = NULL; + btreePtr->keyDescPtr = keyDescPtr; + btreePtr->btreeType = btreeType; + btreePtr->treeDepth = 0; +@@ -282,7 +282,7 @@ OSStatus BTInitialize (FCB *filePtr, + + ///////////////////// Copy Key Descriptor To Header ///////////////////////// + #if SupportsKeyDescriptors +- if (keyDescPtr != nil) ++ if (keyDescPtr != NULL) + { + err = CheckKeyDescriptor (keyDescPtr, maxKeyLength); + M_ExitOnError (err); +@@ -309,7 +309,7 @@ OSStatus BTInitialize (FCB *filePtr, + err = UpdateHeader (btreePtr); + M_ExitOnError (err); + +- pathPtr->path.forkPtr->fork.btreePtr = nil; ++ pathPtr->path.forkPtr->fork.btreePtr = NULL; + M_RESIDENT_DEALLOCATE_FIXED( btreePtr, sizeof( BTreeControlBlock ), kFSBTreeControlBlockType ); + + return noErr; +@@ -320,7 +320,7 @@ OSStatus BTInitialize (FCB *filePtr, + ErrorExit: + + (void) ReleaseNode (btreePtr, &headerNode); +- if (btreePtr != nil) ++ if (btreePtr != NULL) + M_RESIDENT_DEALLOCATE_FIXED( btreePtr, sizeof( BTreeControlBlock ), kFSBTreeControlBlockType ); + + return err; +@@ -342,7 +342,7 @@ Input: filePtr - pointer to file to open as a B-tree + setEndOfForkProc - pointer to client's SetEOF function + + Result: noErr - success +- paramErr - required ptr was nil ++ paramErr - required ptr was NULL + fsBTInvalidFileErr - + memFullErr - + != noErr - failure +@@ -364,16 +364,16 @@ OSStatus BTOpenPath (SFCB *filePtr, + + ////////////////////// Preliminary Error Checking /////////////////////////// + +- if ( filePtr == nil || +- getBlockProc == nil || +- releaseBlockProc == nil || +- setEndOfForkProc == nil || +- setBlockSizeProc == nil ) ++ if (filePtr == NULL || ++ getBlockProc == NULL || ++ releaseBlockProc == NULL || ++ setEndOfForkProc == NULL || ++ setBlockSizeProc == NULL) + { + return paramErr; + } + +- if ( filePtr->fcbBtree != nil ) // already has a BTreeCB ++ if (filePtr->fcbBtree != NULL) // already has a BTreeCB + return noErr; + + // is file large enough to contain header node? +@@ -384,7 +384,7 @@ OSStatus BTOpenPath (SFCB *filePtr, + //////////////////////// Allocate Control Block ///////////////////////////// + + btreePtr = (BTreeControlBlock*) AllocateClearMemory( sizeof( BTreeControlBlock ) ); +- if (btreePtr == nil) ++ if (btreePtr == NULL) + { + Panic ("\pBTOpen: no memory for btreePtr."); + return memFullErr; +@@ -397,7 +397,7 @@ OSStatus BTOpenPath (SFCB *filePtr, + + /////////////////////////// Read Header Node //////////////////////////////// + +- nodeRec.buffer = nil; // so we can call ReleaseNode ++ nodeRec.buffer = NULL; // so we can call ReleaseNode + + btreePtr->fcbPtr = filePtr; + filePtr->fcbBtree = (void *) btreePtr; // attach btree cb to file +@@ -487,7 +487,7 @@ OSStatus BTOpenPath (SFCB *filePtr, + + ////////////////////////// Get Key Descriptor /////////////////////////////// + #if SupportsKeyDescriptors +- if ( keyCompareProc == nil ) // if no key compare proc then get key descriptor ++ if (keyCompareProc == NULL) // if no key compare proc then get key descriptor + { + err = GetKeyDescriptor (btreePtr, nodeRec.buffer); //¥¥ it should check amount of memory allocated... + M_ExitOnError (err); +@@ -499,7 +499,7 @@ OSStatus BTOpenPath (SFCB *filePtr, + else + #endif + { +- btreePtr->keyDescPtr = nil; // clear it so we don't dispose garbage later ++ btreePtr->keyDescPtr = NULL; // clear it so we don't dispose garbage later + } + + err = ReleaseNode (btreePtr, &nodeRec); +@@ -528,7 +528,7 @@ OSStatus BTOpenPath (SFCB *filePtr, + + ErrorExit: + +- filePtr->fcbBtree = nil; ++ filePtr->fcbBtree = NULL; + (void) ReleaseNode (btreePtr, &nodeRec); + DisposeMemory( btreePtr ); + +@@ -567,7 +567,7 @@ OSStatus BTClosePath (SFCB *filePtr) + + btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree; + +- if (btreePtr == nil) ++ if (btreePtr == NULL) + return fsBTInvalidFileErr; + + ////////////////////// Check for other BTree Paths ////////////////////////// +@@ -603,14 +603,14 @@ OSStatus BTClosePath (SFCB *filePtr) + M_ExitOnError (err); + + #if SupportsKeyDescriptors +- if (btreePtr->keyDescPtr != nil) // deallocate keyDescriptor, if any ++ if (btreePtr->keyDescPtr != NULL) // deallocate keyDescriptor, if any + { + DisposeMemory( btreePtr->keyDescPtr ); + } + #endif + + DisposeMemory( btreePtr ); +- filePtr->fcbBtree = nil; ++ filePtr->fcbBtree = NULL; + + // LogEndTime(kTraceCloseBTree, noErr); + +@@ -643,7 +643,7 @@ Function: Search for position in B*Tree indicated by searchKey. If a valid node + + Input: pathPtr - pointer to path for BTree file. + searchKey - pointer to search key to match. +- hintPtr - pointer to hint (may be nil) ++ hintPtr - pointer to hint (may be NULL) + + Output: record - pointer to BufferDescriptor containing record + recordLen - length of data at recordPtr +@@ -678,14 +678,14 @@ OSStatus BTSearchRecord (SFCB *filePtr, + + // LogStartTime(kTraceSearchBTree); + +- if (filePtr == nil) return paramErr; +- if (searchIterator == nil) return paramErr; ++ if (filePtr == NULL) return paramErr; ++ if (searchIterator == NULL) return paramErr; + + btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree; +- if (btreePtr == nil) return fsBTInvalidFileErr; ++ if (btreePtr == NULL) return fsBTInvalidFileErr; + + #if SupportsKeyDescriptors +- if (btreePtr->keyCompareProc == nil) // CheckKey if we using Key Descriptor ++ if (btreePtr->keyCompareProc == NULL) // CheckKey if we using Key Descriptor + { + err = CheckKey (&searchIterator->key, btreePtr->keyDescPtr, btreePtr->maxKeyLength); + M_ExitOnError (err); +@@ -775,9 +775,9 @@ OSStatus BTSearchRecord (SFCB *filePtr, + //¥¥ Should check for errors! Or BlockMove could choke on recordPtr!!! + GetRecordByIndex (btreePtr, node.buffer, index, &keyPtr, &recordPtr, &len); + +- if (recordLen != nil) *recordLen = len; ++ if (recordLen != NULL) *recordLen = len; + +- if (record != nil) ++ if (record != NULL) + { + ByteCount recordSize; + +@@ -794,7 +794,7 @@ OSStatus BTSearchRecord (SFCB *filePtr, + + /////////////////////// Success - Update Iterator /////////////////////////// + +- if (resultIterator != nil) ++ if (resultIterator != NULL) + { + resultIterator->hint.writeCount = btreePtr->writeCount; + resultIterator->hint.nodeNum = nodeNum; +@@ -825,10 +825,10 @@ OSStatus BTSearchRecord (SFCB *filePtr, + + ErrorExit: + +- if (recordLen != nil) ++ if (recordLen != NULL) + *recordLen = 0; + +- if (resultIterator != nil) ++ if (resultIterator != NULL) + { + resultIterator->hint.writeCount = 0; + resultIterator->hint.nodeNum = 0; +@@ -892,18 +892,18 @@ OSStatus BTIterateRecord (SFCB *filePtr, + + ////////////////////////// Priliminary Checks /////////////////////////////// + +- left.buffer = nil; +- right.buffer = nil; +- node.buffer = nil; ++ left.buffer = NULL; ++ right.buffer = NULL; ++ node.buffer = NULL; + + +- if (filePtr == nil) ++ if (filePtr == NULL) + { + return paramErr; + } + + btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree; +- if (btreePtr == nil) ++ if (btreePtr == NULL) + { + return fsBTInvalidFileErr; //¥¥ handle properly + } +@@ -968,7 +968,7 @@ OSStatus BTIterateRecord (SFCB *filePtr, + } + else + { +- if (left.buffer == nil) ++ if (left.buffer == NULL) + { + nodeNum = ((NodeDescPtr) node.buffer)->bLink; + if ( nodeNum > 0) +@@ -981,13 +981,13 @@ OSStatus BTIterateRecord (SFCB *filePtr, + } + } + // Before we stomp on "right", we'd better release it if needed +- if (right.buffer != nil) { ++ if (right.buffer != NULL) { + err = ReleaseNode(btreePtr, &right); + M_ExitOnError(err); + } + right = node; + node = left; +- left.buffer = nil; ++ left.buffer = NULL; + index = ((NodeDescPtr) node.buffer)->numRecords -1; + } + } +@@ -1012,7 +1012,7 @@ OSStatus BTIterateRecord (SFCB *filePtr, + } + else + { +- if (right.buffer == nil) ++ if (right.buffer == NULL) + { + nodeNum = ((NodeDescPtr) node.buffer)->fLink; + if ( nodeNum > 0) +@@ -1025,13 +1025,13 @@ OSStatus BTIterateRecord (SFCB *filePtr, + } + } + // Before we stomp on "left", we'd better release it if needed +- if (left.buffer != nil) { ++ if (left.buffer != NULL) { + err = ReleaseNode(btreePtr, &left); + M_ExitOnError(err); + } + left = node; + node = right; +- right.buffer = nil; ++ right.buffer = NULL; + index = 0; + } + } +@@ -1054,9 +1054,9 @@ CopyData: + err = GetRecordByIndex (btreePtr, node.buffer, index, &keyPtr, &recordPtr, &len); + M_ExitOnError (err); + +- if (recordLen != nil) *recordLen = len; ++ if (recordLen != NULL) *recordLen = len; + +- if (record != nil) ++ if (record != NULL) + { + ByteCount recordSize; + +@@ -1069,7 +1069,7 @@ CopyData: + CopyMemory (recordPtr, record->bufferAddress, len); + } + +- if (iterator != nil) // first & last do not require iterator ++ if (iterator != NULL) // first & last do not require iterator + { + iterator->hint.writeCount = btreePtr->writeCount; + iterator->hint.nodeNum = nodeNum; +@@ -1089,13 +1089,13 @@ CopyData: + err = ReleaseNode (btreePtr, &node); + M_ExitOnError (err); + +- if (left.buffer != nil) ++ if (left.buffer != NULL) + { + err = ReleaseNode (btreePtr, &left); + M_ExitOnError (err); + } + +- if (right.buffer != nil) ++ if (right.buffer != NULL) + { + err = ReleaseNode (btreePtr, &right); + M_ExitOnError (err); +@@ -1113,10 +1113,10 @@ ErrorExit: + (void) ReleaseNode (btreePtr, &node); + (void) ReleaseNode (btreePtr, &right); + +- if (recordLen != nil) ++ if (recordLen != NULL) + *recordLen = 0; + +- if (iterator != nil) ++ if (iterator != NULL) + { + iterator->hint.writeCount = 0; + iterator->hint.nodeNum = 0; +@@ -1157,7 +1157,7 @@ OSStatus BTInsertRecord (SFCB *filePtr, + + ////////////////////////// Priliminary Checks /////////////////////////////// + +- nodeRec.buffer = nil; // so we can call ReleaseNode ++ nodeRec.buffer = NULL; // so we can call ReleaseNode + + err = CheckInsertParams (filePtr, iterator, record, recordLen); + if (err != noErr) +@@ -1317,7 +1317,7 @@ OSStatus BTSetRecord (SFCB *filePtr, + + ////////////////////////// Priliminary Checks /////////////////////////////// + +- nodeRec.buffer = nil; // so we can call ReleaseNode ++ nodeRec.buffer = NULL; // so we can call ReleaseNode + + err = CheckInsertParams (filePtr, iterator, record, recordLen); + if (err != noErr) +@@ -1506,7 +1506,7 @@ OSStatus BTReplaceRecord (SFCB *filePtr, + + ////////////////////////// Priliminary Checks /////////////////////////////// + +- nodeRec.buffer = nil; // so we can call ReleaseNode ++ nodeRec.buffer = NULL; // so we can call ReleaseNode + + err = CheckInsertParams (filePtr, iterator, record, recordLen); + if (err != noErr) +@@ -1645,20 +1645,20 @@ OSStatus BTDeleteRecord (SFCB *filePtr, + + ////////////////////////// Priliminary Checks /////////////////////////////// + +- nodeRec.buffer = nil; // so we can call ReleaseNode ++ nodeRec.buffer = NULL; // so we can call ReleaseNode + +- M_ReturnErrorIf (filePtr == nil, paramErr); +- M_ReturnErrorIf (iterator == nil, paramErr); ++ M_ReturnErrorIf (filePtr == NULL, paramErr); ++ M_ReturnErrorIf (iterator == NULL, paramErr); + + btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree; +- if (btreePtr == nil) ++ if (btreePtr == NULL) + { + err = fsBTInvalidFileErr; + goto ErrorExit; + } + + #if SupportsKeyDescriptors +- if (btreePtr->keyDescPtr != nil) ++ if (btreePtr->keyDescPtr != NULL) + { + err = CheckKey (&iterator->key, btreePtr->keyDescPtr, btreePtr->maxKeyLength); + M_ExitOnError (err); +@@ -1712,12 +1712,12 @@ OSStatus BTGetInformation (SFCB *filePtr, + BTreeControlBlockPtr btreePtr; + + +- M_ReturnErrorIf (filePtr == nil, paramErr); ++ M_ReturnErrorIf (filePtr == NULL, paramErr); + + btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree; + +- M_ReturnErrorIf (btreePtr == nil, fsBTInvalidFileErr); +- M_ReturnErrorIf (info == nil, paramErr); ++ M_ReturnErrorIf (btreePtr == NULL, fsBTInvalidFileErr); ++ M_ReturnErrorIf (info == NULL, paramErr); + + //¥¥ check version? + +@@ -1730,7 +1730,7 @@ OSStatus BTGetInformation (SFCB *filePtr, + info->keyDescriptor = btreePtr->keyDescPtr; //¥¥ this won't do at all... + info->reserved = 0; + +- if (btreePtr->keyDescPtr == nil) ++ if (btreePtr->keyDescPtr == NULL) + info->keyDescLength = 0; + else + info->keyDescLength = (UInt32) btreePtr->keyDescPtr->length; +@@ -1762,11 +1762,11 @@ OSStatus BTFlushPath (SFCB *filePtr) + + // LogStartTime(kTraceFlushBTree); + +- M_ReturnErrorIf (filePtr == nil, paramErr); ++ M_ReturnErrorIf (filePtr == NULL, paramErr); + + btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree; + +- M_ReturnErrorIf (btreePtr == nil, fsBTInvalidFileErr); ++ M_ReturnErrorIf (btreePtr == NULL, fsBTInvalidFileErr); + + err = UpdateHeader (btreePtr); + +@@ -1788,13 +1788,13 @@ Input: iterator - pointer to BTreeIterator + Output: iterator - iterator with the hint.nodeNum cleared + + Result: noErr - success +- paramErr - iterator == nil ++ paramErr - iterator == NULL + -------------------------------------------------------------------------------*/ + + + OSStatus BTInvalidateHint (BTreeIterator *iterator ) + { +- if (iterator == nil) ++ if (iterator == NULL) + return paramErr; + + iterator->hint.nodeNum = 0; +diff --git a/fsck_hfs.tproj/dfalib/BTreeAllocate.c b/fsck_hfs.tproj/dfalib/BTreeAllocate.c +index 485d867..02bdd8d 100644 +--- a/fsck_hfs.tproj/dfalib/BTreeAllocate.c ++++ b/fsck_hfs.tproj/dfalib/BTreeAllocate.c +@@ -83,7 +83,7 @@ OSStatus AllocateNode (BTreeControlBlockPtr btreePtr, UInt32 *nodeNum) + + + nodeNumber = 0; // first node number of header map record +- node.buffer = nil; // clear node.buffer to get header node ++ node.buffer = NULL; // clear node.buffer to get header node + // - and for ErrorExit + + while (true) +@@ -192,7 +192,7 @@ OSStatus FreeNode (BTreeControlBlockPtr btreePtr, UInt32 nodeNum) + + //////////////////////////// Find Map Record //////////////////////////////// + nodeIndex = 0; // first node number of header map record +- node.buffer = nil; // invalidate node.buffer to get header node ++ node.buffer = NULL; // invalidate node.buffer to get header node + + while (nodeNum >= nodeIndex) + { +@@ -278,8 +278,8 @@ OSStatus ExtendBTree (BTreeControlBlockPtr btreePtr, + nodeSize = btreePtr->nodeSize; + filePtr = btreePtr->fcbPtr; + +- mapNode.buffer = nil; +- newNode.buffer = nil; ++ mapNode.buffer = NULL; ++ newNode.buffer = NULL; + + mapNodeRecSize = nodeSize - sizeof(BTNodeDescriptor) - 6; // 2 bytes of free space (see note) + +@@ -448,7 +448,7 @@ ErrorExit: + Routine: GetMapNode - Get the next map node and pointer to the map record. + + Function: Given a BlockDescriptor to a map node in nodePtr, GetMapNode releases +- it and gets the next node. If nodePtr->buffer is nil, then the header ++ it and gets the next node. If nodePtr->buffer is NULL, then the header + node is retrieved. + + +@@ -474,7 +474,7 @@ OSStatus GetMapNode (BTreeControlBlockPtr btreePtr, + UInt16 mapIndex; + UInt32 nextNodeNum; + +- if (nodePtr->buffer != nil) // if iterator is valid... ++ if (nodePtr->buffer != NULL) // if iterator is valid... + { + nextNodeNum = ((NodeDescPtr)nodePtr->buffer)->fLink; + if (nextNodeNum == 0) +@@ -521,7 +521,7 @@ ErrorExit: + + (void) ReleaseNode (btreePtr, nodePtr); + +- *mapPtr = nil; ++ *mapPtr = NULL; + *mapSize = 0; + + return err; +diff --git a/fsck_hfs.tproj/dfalib/BTreeMiscOps.c b/fsck_hfs.tproj/dfalib/BTreeMiscOps.c +index 7c9edca..997f34b 100644 +--- a/fsck_hfs.tproj/dfalib/BTreeMiscOps.c ++++ b/fsck_hfs.tproj/dfalib/BTreeMiscOps.c +@@ -236,13 +236,13 @@ OSStatus FindIteratorPosition (BTreeControlBlockPtr btreePtr, + // assume index points to UInt16 + // assume foundRecord points to Boolean + +- left->buffer = nil; +- middle->buffer = nil; +- right->buffer = nil; ++ left->buffer = NULL; ++ middle->buffer = NULL; ++ right->buffer = NULL; + + foundIt = false; + +- if (iterator == nil) // do we have an iterator? ++ if (iterator == NULL) // do we have an iterator? + { + err = fsBTInvalidIteratorErr; + goto ErrorExit; +@@ -250,7 +250,7 @@ OSStatus FindIteratorPosition (BTreeControlBlockPtr btreePtr, + + #if SupportsKeyDescriptors + //¥¥ verify iterator key (change CheckKey to take btreePtr instead of keyDescPtr?) +- if (btreePtr->keyDescPtr != nil) ++ if (btreePtr->keyDescPtr != NULL) + { + err = CheckKey (&iterator->key, btreePtr->keyDescPtr, btreePtr->maxKeyLength ); + M_ExitOnError (err); +@@ -309,7 +309,7 @@ OSStatus FindIteratorPosition (BTreeControlBlockPtr btreePtr, + { + *right = *middle; + *middle = *left; +- left->buffer = nil; ++ left->buffer = NULL; + index = leftIndex; + + goto SuccessfulExit; +@@ -330,7 +330,7 @@ OSStatus FindIteratorPosition (BTreeControlBlockPtr btreePtr, + { + *right = *middle; + *middle = *left; +- left->buffer = nil; ++ left->buffer = NULL; + index = leftIndex; + + goto SuccessfulExit; +@@ -363,7 +363,7 @@ OSStatus FindIteratorPosition (BTreeControlBlockPtr btreePtr, + { + *left = *middle; + *middle = *right; +- right->buffer = nil; ++ right->buffer = NULL; + index = rightIndex; + + goto SuccessfulExit; +@@ -427,15 +427,15 @@ OSStatus CheckInsertParams (SFCB *filePtr, + { + BTreeControlBlockPtr btreePtr; + +- if (filePtr == nil) return paramErr; ++ if (filePtr == NULL) return paramErr; + + btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree; +- if (btreePtr == nil) return fsBTInvalidFileErr; +- if (iterator == nil) return paramErr; +- if (record == nil) return paramErr; ++ if (btreePtr == NULL) return fsBTInvalidFileErr; ++ if (iterator == NULL) return paramErr; ++ if (record == NULL) return paramErr; + + #if SupportsKeyDescriptors +- if (btreePtr->keyDescPtr != nil) ++ if (btreePtr->keyDescPtr != NULL) + { + OSStatus err; + +diff --git a/fsck_hfs.tproj/dfalib/BTreeNodeOps.c b/fsck_hfs.tproj/dfalib/BTreeNodeOps.c +index da07cc7..ef2bd7b 100644 +--- a/fsck_hfs.tproj/dfalib/BTreeNodeOps.c ++++ b/fsck_hfs.tproj/dfalib/BTreeNodeOps.c +@@ -105,7 +105,7 @@ Function: Gets an existing BTree node from FS Agent and verifies it. + Input: btreePtr - pointer to BTree control block + nodeNum - number of node to request + +-Output: nodePtr - pointer to beginning of node (nil if error) ++Output: nodePtr - pointer to beginning of node (NULL if error) + + Result: + noErr - success +@@ -139,7 +139,7 @@ OSStatus GetNode (BTreeControlBlockPtr btreePtr, + if (err != noErr) + { + Panic ("\pGetNode: getNodeProc returned error."); +- nodePtr->buffer = nil; ++ nodePtr->buffer = NULL; + goto ErrorExit; + } + ++btreePtr->numGetNodes; +@@ -156,8 +156,8 @@ OSStatus GetNode (BTreeControlBlockPtr btreePtr, + return noErr; + + ErrorExit: +- nodePtr->buffer = nil; +- nodePtr->blockHeader = nil; ++ nodePtr->buffer = NULL; ++ nodePtr->blockHeader = NULL; + + // LogEndTime(kTraceGetNode, err); + +@@ -176,7 +176,7 @@ Function: Gets a new BTree node from FS Agent and initializes it to an empty + Input: btreePtr - pointer to BTree control block + nodeNum - number of node to request + +-Output: returnNodePtr - pointer to beginning of node (nil if error) ++Output: returnNodePtr - pointer to beginning of node (NULL if error) + + Result: noErr - success + != noErr - failure +@@ -203,7 +203,7 @@ OSStatus GetNewNode (BTreeControlBlockPtr btreePtr, + if (err != noErr) + { + Panic ("\pGetNewNode: getNodeProc returned error."); +- returnNodePtr->buffer = nil; ++ returnNodePtr->buffer = NULL; + return err; + } + ++btreePtr->numGetNewNodes; +@@ -248,7 +248,7 @@ OSStatus ReleaseNode (BTreeControlBlockPtr btreePtr, + + err = noErr; + +- if (nodePtr->buffer != nil) ++ if (nodePtr->buffer != NULL) + { + /* + * The nodes must remain in the cache as big endian! +@@ -267,8 +267,8 @@ OSStatus ReleaseNode (BTreeControlBlockPtr btreePtr, + ++btreePtr->numReleaseNodes; + } + +- nodePtr->buffer = nil; +- nodePtr->blockHeader = nil; ++ nodePtr->buffer = NULL; ++ nodePtr->blockHeader = NULL; + + // LogEndTime(kTraceReleaseNode, err); + +@@ -299,7 +299,7 @@ OSStatus TrashNode (BTreeControlBlockPtr btreePtr, + + err = noErr; + +- if (nodePtr->buffer != nil) ++ if (nodePtr->buffer != NULL) + { + releaseNodeProc = btreePtr->releaseBlockProc; + err = releaseNodeProc (btreePtr->fcbPtr, +@@ -309,8 +309,8 @@ OSStatus TrashNode (BTreeControlBlockPtr btreePtr, + ++btreePtr->numReleaseNodes; + } + +- nodePtr->buffer = nil; +- nodePtr->blockHeader = nil; ++ nodePtr->buffer = NULL; ++ nodePtr->blockHeader = NULL; + + return err; + } +@@ -338,7 +338,7 @@ OSStatus UpdateNode (BTreeControlBlockPtr btreePtr, + + err = noErr; + +- if (nodePtr->buffer != nil) //¥¥ why call UpdateNode if nil ?!? ++ if (nodePtr->buffer != NULL) //¥¥ why call UpdateNode if NULL ?!? + { + // LogStartTime(kTraceReleaseNode); + err = hfs_swap_BTNode(nodePtr, btreePtr->fcbPtr, kSwapBTNodeHostToBig); +@@ -358,8 +358,8 @@ OSStatus UpdateNode (BTreeControlBlockPtr btreePtr, + ++btreePtr->numUpdateNodes; + } + +- nodePtr->buffer = nil; +- nodePtr->blockHeader = nil; ++ nodePtr->buffer = NULL; ++ nodePtr->blockHeader = NULL; + + return noErr; + +diff --git a/fsck_hfs.tproj/dfalib/BTreeTreeOps.c b/fsck_hfs.tproj/dfalib/BTreeTreeOps.c +index 37fb170..73e1fda 100644 +--- a/fsck_hfs.tproj/dfalib/BTreeTreeOps.c ++++ b/fsck_hfs.tproj/dfalib/BTreeTreeOps.c +@@ -177,7 +177,7 @@ Output: nodeNum - number of the node containing the key position + + Result: noErr - key found, index is record index + fsBTRecordNotFoundErr - key not found, index is insert index +- fsBTEmptyErr - key not found, return params are nil ++ fsBTEmptyErr - key not found, return params are NULL + otherwise - catastrophic failure (GetNode/ReleaseNode failed) + -------------------------------------------------------------------------------*/ + +@@ -321,8 +321,8 @@ ReleaseAndExit: + ErrorExit: + + *nodeNum = 0; +- nodePtr->buffer = nil; +- nodePtr->blockHeader = nil; ++ nodePtr->buffer = NULL; ++ nodePtr->blockHeader = NULL; + *returnIndex = 0; + + return err; +@@ -354,7 +354,7 @@ OSStatus InsertTree ( BTreeControlBlockPtr btreePtr, + primaryKey.replacingKey = replacingKey; + primaryKey.skipRotate = false; + +- err = InsertLevel (btreePtr, treePathTable, &primaryKey, nil, ++ err = InsertLevel (btreePtr, treePathTable, &primaryKey, NULL, + targetNode, index, level, insertNode ); + + return err; +@@ -385,7 +385,7 @@ OSStatus InsertLevel (BTreeControlBlockPtr btreePtr, + #if defined(applec) && !defined(__SC__) + PanicIf ((level == 1) && (((NodeDescPtr)targetNode->buffer)->kind != kBTLeafNode), "\P InsertLevel: non-leaf at level 1! "); + #endif +- siblingNode.buffer = nil; ++ siblingNode.buffer = NULL; + targetNodeNum = treePathTable [level].node; + + insertParent = false; +@@ -420,7 +420,7 @@ OSStatus InsertLevel (BTreeControlBlockPtr btreePtr, + + ////// process second insert (if any) ////// + +- if ( secondaryKey != nil ) ++ if (secondaryKey != NULL) + { + Boolean temp; + +@@ -446,7 +446,7 @@ OSStatus InsertLevel (BTreeControlBlockPtr btreePtr, + UInt8 * recPtr; + UInt16 recSize; + +- secondaryKey = nil; ++ secondaryKey = NULL; + + PanicIf ( (level == btreePtr->treeDepth), "InsertLevel: unfinished insert!?"); + +@@ -606,9 +606,9 @@ static OSErr InsertNode (BTreeControlBlockPtr btreePtr, + + if ( leftNodeNum > 0 ) + { +- PanicIf ( siblingNode->buffer != nil, "InsertNode: siblingNode already aquired!"); ++ PanicIf(siblingNode->buffer != NULL, "InsertNode: siblingNode already aquired!"); + +- if ( siblingNode->buffer == nil ) ++ if (siblingNode->buffer == NULL) + { + err = GetNode (btreePtr, leftNodeNum, siblingNode); // will be released by caller or a split below + M_ExitOnError (err); +@@ -703,7 +703,7 @@ OSStatus DeleteTree (BTreeControlBlockPtr btreePtr, + + targetNodeNum = treePathTable[level].node; + targetNodePtr = targetNode->buffer; +- PanicIf (targetNodePtr == nil, "DeleteTree: targetNode has nil buffer!"); ++ PanicIf (targetNodePtr == NULL, "DeleteTree: targetNode has NULL buffer!"); + + DeleteRecord (btreePtr, targetNodePtr, index); + +@@ -766,7 +766,7 @@ OSStatus DeleteTree (BTreeControlBlockPtr btreePtr, + deleteRequired = false; + updateRequired = false; + +- if ( targetNode->buffer == nil ) // then root was freed and the btree is empty ++ if (targetNode->buffer == NULL) // then root was freed and the btree is empty + { + btreePtr->rootNode = 0; + btreePtr->treeDepth = 0; +@@ -1124,7 +1124,7 @@ static OSStatus SplitLeft (BTreeControlBlockPtr btreePtr, + if ( (right->height == 1) && (right->kind != kBTLeafNode) ) + return fsBTInvalidNodeErr; + +- if ( left != nil ) ++ if (left != NULL) + { + if ( left->fLink != rightNodeNum ) + return fsBTInvalidNodeErr; //¥¥ E_BadSibling ? +@@ -1145,7 +1145,7 @@ static OSStatus SplitLeft (BTreeControlBlockPtr btreePtr, + + /////////////// Update Forward Link In Original Left Node /////////////////// + +- if ( left != nil ) ++ if (left != NULL) + { + left->fLink = newNodeNum; + err = UpdateNode (btreePtr, leftNode); +@@ -1240,8 +1240,8 @@ static OSStatus AddNewRootNode (BTreeControlBlockPtr btreePtr, + Boolean didItFit; + UInt16 keyLength; + +- PanicIf (leftNode == nil, "AddNewRootNode: leftNode == nil"); +- PanicIf (rightNode == nil, "AddNewRootNode: rightNode == nil"); ++ PanicIf (leftNode == NULL, "AddNewRootNode: leftNode == NULL"); ++ PanicIf (rightNode == NULL, "AddNewRootNode: rightNode == NULL"); + + + /////////////////////// Initialize New Root Node //////////////////////////// +@@ -1362,7 +1362,7 @@ static OSStatus SplitRight (BTreeControlBlockPtr btreePtr, + if ( (leftPtr->height == 1) && (leftPtr->kind != kBTLeafNode) ) + return fsBTInvalidNodeErr; + +- if ( rightPtr != nil ) ++ if (rightPtr != NULL) + { + if ( rightPtr->bLink != nodeNum ) + return fsBTInvalidNodeErr; //¥¥ E_BadSibling ? +@@ -1382,7 +1382,7 @@ static OSStatus SplitRight (BTreeControlBlockPtr btreePtr, + + /////////////// Update backward Link In Original Right Node /////////////////// + +- if ( rightPtr != nil ) ++ if (rightPtr != NULL) + { + rightPtr->bLink = newNodeNum; + err = UpdateNode (btreePtr, rightNodePtr); +@@ -1739,7 +1739,7 @@ static int DoKeyCheck( NodeDescPtr nodeP, BTreeControlBlock *btcb ) + UInt16 keyLength; + KeyPtr keyPtr; + UInt8 *dataPtr; +- KeyPtr prevkeyP = nil; ++ KeyPtr prevkeyP = NULL; + + + if ( nodeP->numRecords == 0 ) +@@ -1766,7 +1766,7 @@ static int DoKeyCheck( NodeDescPtr nodeP, BTreeControlBlock *btcb ) + return( -1 ); + } + +- if ( prevkeyP != nil ) ++ if (prevkeyP != NULL) + { + if ( CompareKeys( (BTreeControlBlockPtr)btcb, prevkeyP, keyPtr ) >= 0 ) + { +diff --git a/fsck_hfs.tproj/dfalib/SControl.c b/fsck_hfs.tproj/dfalib/SControl.c +index 8b03ece..d3145e0 100644 +--- a/fsck_hfs.tproj/dfalib/SControl.c ++++ b/fsck_hfs.tproj/dfalib/SControl.c +@@ -82,7 +82,7 @@ CheckHFS( int fsReadRef, int fsWriteRef, int checkLevel, int repairLevel, + { + SGlob dataArea; // Allocate the scav globals + short temp; +- FileIdentifierTable *fileIdentifierTable = nil; ++ FileIdentifierTable *fileIdentifierTable = NULL; + OSErr err = noErr; + OSErr scavError = 0; + int scanCount = 0; +@@ -228,7 +228,7 @@ DoAgain: + } + + // Set up structures for post processing +- if ( (autoRepair == true) && (dataArea.fileIdentifierTable != nil) ) ++ if ((autoRepair == true) && (dataArea.fileIdentifierTable != NULL)) + { + // *repairInfo = *repairInfo | kVolumeHadOverlappingExtents; // Report back that volume has overlapping extents + fileIdentifierTable = (FileIdentifierTable *) AllocateMemory( GetHandleSize( (Handle) dataArea.fileIdentifierTable ) ); +@@ -239,7 +239,7 @@ DoAgain: + // + // Post processing + // +- if ( fileIdentifierTable != nil ) ++ if (fileIdentifierTable != NULL) + { + DisposeMemory( fileIdentifierTable ); + } +@@ -682,7 +682,7 @@ short CheckForStop( SGlob *GPtr ) + + //if ( ((ticks - 10) > GPtr->lastTickCount) || (dfaStage == kAboutToRepairStage) ) // To reduce cursor flicker on fast machines, call through on a timed interval + //{ +- if ( GPtr->userCancelProc != nil ) ++ if (GPtr->userCancelProc != NULL) + { + UInt64 progress = 0; + Boolean progressChanged; +@@ -761,7 +761,7 @@ static int ScavSetUp( SGlob *GPtr) + short ioRefNum; + #endif + +- GPtr->MinorRepairsP = nil; ++ GPtr->MinorRepairsP = NULL; + + GPtr->itemsProcessed = 0; + GPtr->lastProgress = 0; +@@ -774,7 +774,7 @@ static int ScavSetUp( SGlob *GPtr) + ScavStaticStructures *pointer; + + pointer = (ScavStaticStructures *) AllocateClearMemory( sizeof(ScavStaticStructures) ); +- if ( pointer == nil ) { ++ if (pointer == NULL) { + if ( GPtr->logLevel >= kDebugLog ) { + printf( "\t error %d - could not allocate %i bytes of memory \n", + R_NoMem, sizeof(ScavStaticStructures) ); +@@ -831,7 +831,7 @@ static int ScavSetUp( SGlob *GPtr) + // Save current value of vcbWrCnt, to detect modifications to volume by other apps etc + if ( GPtr->volumeFeatures & volumeIsMountedMask ) + { +- FlushVol( nil, GPtr->realVCB->vcbVRefNum ); // Ask HFS to update all changes to disk ++ FlushVol(NULL, GPtr->realVCB->vcbVRefNum); // Ask HFS to update all changes to disk + GPtr->wrCnt = GPtr->realVCB->vcbWrCnt; // Remember write count after writing changes + } + #endif +@@ -949,7 +949,7 @@ static int ScavSetUp( SGlob *GPtr) + + // Keep a valid file id list for HFS volumes + GPtr->validFilesList = (UInt32**)NewHandle( 0 ); +- if ( GPtr->validFilesList == nil ) { ++ if (GPtr->validFilesList == NULL) { + if ( GPtr->logLevel >= kDebugLog ) { + printf( "\t error %d - could not allocate file ID list \n", R_NoMem ); + } +@@ -995,17 +995,17 @@ static int ScavTerm( SGlobPtr GPtr ) + + (void) BitMapCheckEnd(); + +- while( (rP = GPtr->MinorRepairsP) != nil ) // loop freeing leftover (undone) repair orders ++ while((rP = GPtr->MinorRepairsP) != NULL) // loop freeing leftover (undone) repair orders + { + GPtr->MinorRepairsP = rP->link; // (in case repairs were not made) + DisposeMemory(rP); + err = MemError(); + } + +- if( GPtr->validFilesList != nil ) ++ if (GPtr->validFilesList != NULL) + DisposeHandle( (Handle) GPtr->validFilesList ); + +- if( GPtr->overlappedExtents != nil ) { ++ if (GPtr->overlappedExtents != NULL) { + extentsTableH = GPtr->overlappedExtents; + + /* Overlapped extents list also allocated memory for attribute name */ +@@ -1021,44 +1021,44 @@ static int ScavTerm( SGlobPtr GPtr ) + DisposeHandle( (Handle) GPtr->overlappedExtents ); + } + +- if( GPtr->fileIdentifierTable != nil ) ++ if (GPtr->fileIdentifierTable != NULL) + DisposeHandle( (Handle) GPtr->fileIdentifierTable ); + +- if( GPtr->calculatedVCB == nil ) // already freed? ++ if (GPtr->calculatedVCB == NULL) // already freed? + return( noErr ); + + // If the FCB's and BTCB's have been set up, dispose of them + fcbP = GPtr->calculatedExtentsFCB; // release extent file BTree bit map +- if ( fcbP != nil ) ++ if (fcbP != NULL) + { + btcbP = (BTreeControlBlock*)fcbP->fcbBtree; +- if ( btcbP != nil) ++ if (btcbP != NULL) + { +- if( btcbP->refCon != nil ) ++ if (btcbP->refCon != NULL) + { +- if(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != nil) ++ if (((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != NULL) + { + DisposeMemory(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr); + err = MemError(); + } + DisposeMemory( (Ptr)btcbP->refCon ); + err = MemError(); +- btcbP->refCon = nil; ++ btcbP->refCon = NULL; + } + + fcbP = GPtr->calculatedCatalogFCB; // release catalog BTree bit map + btcbP = (BTreeControlBlock*)fcbP->fcbBtree; + +- if( btcbP->refCon != nil ) ++ if (btcbP->refCon != NULL) + { +- if(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != nil) ++ if (((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != NULL) + { + DisposeMemory(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr); + err = MemError(); + } + DisposeMemory( (Ptr)btcbP->refCon ); + err = MemError(); +- btcbP->refCon = nil; ++ btcbP->refCon = NULL; + } + } + } +@@ -1066,7 +1066,7 @@ static int ScavTerm( SGlobPtr GPtr ) + DisposeMemory( GPtr->calculatedVCB ); // Release our block of data structures + err = MemError(); + +- GPtr->calculatedVCB = nil; ++ GPtr->calculatedVCB = NULL; + + return( noErr ); + } +@@ -1113,7 +1113,7 @@ Boolean IsBlueBoxSharedDrive ( DrvQElPtr dqPtr ) + // Now look at the name of the Driver name. If it is .BlueBoxShared keep it out of the list of available disks. + driverDCtlHandle = GetDCtlEntry(dqPtr->dQRefNum); + driverDCtlPtr = *driverDCtlHandle; +- if((((driverDCtlPtr->dCtlFlags) & Is_Native_Mask) == 0) && (driverDCtlPtr->dCtlDriver != nil)) ++ if((((driverDCtlPtr->dCtlFlags) & Is_Native_Mask) == 0) && (driverDCtlPtr->dCtlDriver != NULL)) + { + if (((driverDCtlPtr->dCtlFlags) & Is_Ram_Based_Mask) == 0) + { +@@ -1127,19 +1127,19 @@ Boolean IsBlueBoxSharedDrive ( DrvQElPtr dqPtr ) + + } + driverName = (StringPtr)&(drvrHeaderPtr->drvrName); +- if (!(IdenticalString(driverName,blueBoxSharedDriverName,nil))) ++ if (!(IdenticalString(driverName,blueBoxSharedDriverName,NULL))) + { + return( true ); + } + + // Special case for the ".Sony" floppy driver which might be accessed in Shared mode inside the Blue Box + // Test its "where" string instead of the driver name. +- if (!(IdenticalString(driverName,sonyDriverName,nil))) ++ if (!(IdenticalString(driverName,sonyDriverName,NULL))) + { + CntrlParam paramBlock; + +- paramBlock.ioCompletion = nil; +- paramBlock.ioNamePtr = nil; ++ paramBlock.ioCompletion = NULL; ++ paramBlock.ioNamePtr = NULL; + paramBlock.ioVRefNum = dqPtr->dQDrive; + paramBlock.ioCRefNum = dqPtr->dQRefNum; + paramBlock.csCode = kDriveIcon; // return physical icon +@@ -1152,7 +1152,7 @@ Boolean IsBlueBoxSharedDrive ( DrvQElPtr dqPtr ) + + iconAndStringRecPtr = * (IconAndStringRecPtr*) & paramBlock.csParam; + whereStringPtr = (StringPtr) & iconAndStringRecPtr->string; +- if (!(IdenticalString(whereStringPtr,blueBoxFloppyWhereString,nil))) ++ if (!(IdenticalString(whereStringPtr,blueBoxFloppyWhereString,NULL))) + { + return( true ); + } +diff --git a/fsck_hfs.tproj/dfalib/SRepair.c b/fsck_hfs.tproj/dfalib/SRepair.c +index 89c12d6..b261c37 100644 +--- a/fsck_hfs.tproj/dfalib/SRepair.c ++++ b/fsck_hfs.tproj/dfalib/SRepair.c +@@ -844,7 +844,7 @@ static int DelFThd( SGlobPtr GPtr, UInt32 fid ) // the file ID + + isHFSPlus = VolumeObjectIsHFSPlus( ); + +- BuildCatalogKey( fid, (const CatalogName*) nil, isHFSPlus, &key ); ++ BuildCatalogKey(fid, NULL, isHFSPlus, &key); + result = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint, &foundKey, &record, &recSize, &hint ); + + if ( result ) return ( IntError( GPtr, result ) ); +@@ -910,7 +910,7 @@ static OSErr FixDirThread( SGlobPtr GPtr, UInt32 did ) // the dir ID + + isHFSPlus = VolumeObjectIsHFSPlus( ); + +- BuildCatalogKey( did, (const CatalogName*) nil, isHFSPlus, &key ); ++ BuildCatalogKey(did, NULL, isHFSPlus, &key); + result = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint, &foundKey, &record, &recSize, &hint ); + + if ( result ) +@@ -2171,7 +2171,7 @@ static OSErr FixOrphanedFiles ( SGlobPtr GPtr ) + } + + //-- Build the key for the file thread +- BuildCatalogKey( cNodeID, nil, isHFSPlus, &key ); ++ BuildCatalogKey(cNodeID, NULL, isHFSPlus, &key); + + err = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint, + &tempKey, &threadRecord, &recordSize, &hint2 ); +diff --git a/fsck_hfs.tproj/dfalib/SUtils.c b/fsck_hfs.tproj/dfalib/SUtils.c +index 6e9253e..491afbf 100644 +--- a/fsck_hfs.tproj/dfalib/SUtils.c ++++ b/fsck_hfs.tproj/dfalib/SUtils.c +@@ -395,11 +395,11 @@ OSErr GetVolumeFeatures( SGlobPtr GPtr ) + err = GetVCBDriveNum( &GPtr->realVCB, GPtr->DrvNum ); + ReturnIfError( err ); + +- if ( GPtr->realVCB != nil ) ++ if (GPtr->realVCB != NULL) + { + GPtr->volumeFeatures |= volumeIsMountedMask; + +- pb.ioParam.ioNamePtr = nil; ++ pb.ioParam.ioNamePtr = NULL; + pb.ioParam.ioVRefNum = GPtr->realVCB->vcbVRefNum; + pb.ioParam.ioBuffer = (Ptr) &buffer; + pb.ioParam.ioReqCount = sizeof( buffer ); +@@ -2282,7 +2282,7 @@ void print_prime_buckets(PrimeBuckets *cur); + * 4. btreetye - can be kHFSPlusCatalogRecord or kHFSPlusAttributeRecord + * indicates which btree prime number bucket should be incremented + * +- * Output: nil ++ * Output: NULL + */ + void RecordXAttrBits(SGlobPtr GPtr, UInt16 flags, HFSCatalogNodeID fileid, UInt16 btreetype) + { +diff --git a/fsck_hfs.tproj/dfalib/SVerify1.c b/fsck_hfs.tproj/dfalib/SVerify1.c +index 39bda5c..c33155f 100644 +--- a/fsck_hfs.tproj/dfalib/SVerify1.c ++++ b/fsck_hfs.tproj/dfalib/SVerify1.c +@@ -790,13 +790,13 @@ OSErr CreateExtentsBTreeControlBlock( SGlobPtr GPtr ) + // set up our DFA extended BTCB area. Will we have enough memory on all HFS+ volumes. + // + btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions +- if ( btcb->refCon == nil ) { ++ if (btcb->refCon == NULL) { + err = R_NoMem; + goto exit; + } + size = (btcb->totalNodes + 7) / 8; // size of BTree bit map + ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr = AllocateClearMemory(size); // get precleared bitmap +- if ( ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == nil ) ++ if (((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == NULL) + { + err = R_NoMem; + goto exit; +@@ -1145,13 +1145,13 @@ OSErr CreateCatalogBTreeControlBlock( SGlobPtr GPtr ) + // + + btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions +- if ( btcb->refCon == nil ) { ++ if (btcb->refCon == NULL) { + err = R_NoMem; + goto exit; + } + size = (btcb->totalNodes + 7) / 8; // size of BTree bit map + ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr = AllocateClearMemory(size); // get precleared bitmap +- if ( ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == nil ) ++ if (((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == NULL) + { + err = R_NoMem; + goto exit; +@@ -1339,7 +1339,7 @@ OSErr CatHChk( SGlobPtr GPtr ) + + //¥¥ Can we ignore this part by just taking advantage of setting the selCode = 0x8001; + { +- BuildCatalogKey( 1, (const CatalogName *)nil, isHFSPlus, &key ); ++ BuildCatalogKey(1, NULL, isHFSPlus, &key); + result = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint, &foundKey, &threadRecord, &recSize, &hint ); + + GPtr->TarBlock = hint; /* set target block */ +@@ -1443,7 +1443,7 @@ OSErr CatHChk( SGlobPtr GPtr ) + /* + * Find thread record + */ +- BuildCatalogKey( dprP->directoryID, (const CatalogName *) nil, isHFSPlus, &key ); ++ BuildCatalogKey(dprP->directoryID, NULL, isHFSPlus, &key); + result = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint, &foundKey, &threadRecord, &recSize, &hint ); + if ( result != noErr ) { + char idStr[16]; +@@ -1780,26 +1780,26 @@ OSErr CreateAttributesBTreeControlBlock( SGlobPtr GPtr ) + // set up our DFA extended BTCB area. Will we have enough memory on all HFS+ volumes. + // + btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions +- if ( btcb->refCon == nil ) { ++ if (btcb->refCon == NULL) { + err = R_NoMem; + goto exit; + } + + if (btcb->totalNodes == 0) + { +- ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr = nil; ++ ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr = NULL; + ((BTreeExtensionsRec*)btcb->refCon)->BTCBMSize = 0; + ((BTreeExtensionsRec*)btcb->refCon)->realFreeNodeCount = 0; + } + else + { +- if ( btcb->refCon == nil ) { ++ if (btcb->refCon == NULL) { + err = R_NoMem; + goto exit; + } + size = (btcb->totalNodes + 7) / 8; // size of BTree bit map + ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr = AllocateClearMemory(size); // get precleared bitmap +- if ( ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == nil ) ++ if (((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == NULL) + { + err = R_NoMem; + goto exit; +@@ -2358,7 +2358,7 @@ static OSErr RcdMDBEmbededVolDescriptionErr( SGlobPtr GPtr, OSErr type, HFSMaste + RcdError( GPtr, type ); // first, record the error + + p = AllocMinorRepairOrder( GPtr, sizeof(EmbededVolDescription) ); // get the node +- if ( p == nil ) return( R_NoMem ); ++ if (p == NULL) return( R_NoMem ); + + p->type = type; // save error info + desc = (EmbededVolDescription *) &(p->name); +@@ -2397,7 +2397,7 @@ static OSErr RcdInvalidWrapperExtents( SGlobPtr GPtr, OSErr type ) + RcdError( GPtr, type ); // first, record the error + + p = AllocMinorRepairOrder( GPtr, 0 ); // get the node +- if ( p == nil ) return( R_NoMem ); ++ if (p == NULL) return( R_NoMem ); + + p->type = type; // save error info + +@@ -3029,7 +3029,7 @@ OSErr CheckFileExtents( SGlobPtr GPtr, UInt32 fileNumber, UInt8 forkType, + foundBadExtent = false; + lastExtentIndex = GPtr->numExtents; + +- while ( (extents != nil) && (err == noErr) ) ++ while ((extents != NULL) && (err == noErr)) + { + // checkout the extent record first + err = ChkExtRec( GPtr, extents, &lastExtentIndex ); +@@ -3105,7 +3105,7 @@ OSErr CheckFileExtents( SGlobPtr GPtr, UInt32 fileNumber, UInt8 forkType, + if ( err == btNotFound ) + { + err = noErr; // no more extent records +- extents = nil; ++ extents = NULL; + break; + } + else if ( err != noErr ) +@@ -3121,7 +3121,7 @@ OSErr CheckFileExtents( SGlobPtr GPtr, UInt32 fileNumber, UInt8 forkType, + if ( err == btNotFound ) + { + err = noErr; // no more extent records +- extents = nil; ++ extents = NULL; + break; + } + else if ( err != noErr ) +@@ -3205,7 +3205,7 @@ static OSErr AddExtentToOverlapList( SGlobPtr GPtr, HFSCatalogNodeID fileNumber, + } + + // If it's uninitialized +- if ( GPtr->overlappedExtents == nil ) ++ if (GPtr->overlappedExtents == NULL) + { + GPtr->overlappedExtents = (ExtentsTable **) NewHandleClear( sizeof(ExtentsTable) ); + extentsTableH = GPtr->overlappedExtents; +diff --git a/fsck_hfs.tproj/dfalib/SVerify2.c b/fsck_hfs.tproj/dfalib/SVerify2.c +index c68f3d8..da1a982 100644 +--- a/fsck_hfs.tproj/dfalib/SVerify2.c ++++ b/fsck_hfs.tproj/dfalib/SVerify2.c +@@ -1013,7 +1013,7 @@ static int BTKeyChk( SGlobPtr GPtr, NodeDescPtr nodeP, BTreeControlBlock *btcb ) + UInt16 keyLength; + KeyPtr keyPtr; + UInt8 *dataPtr; +- KeyPtr prevkeyP = nil; ++ KeyPtr prevkeyP = NULL; + + + if ( nodeP->numRecords == 0 ) +@@ -1044,7 +1044,7 @@ static int BTKeyChk( SGlobPtr GPtr, NodeDescPtr nodeP, BTreeControlBlock *btcb ) + return( E_KeyLen ); + } + +- if ( prevkeyP != nil ) ++ if (prevkeyP != NULL) + { + if ( CompareKeys( (BTreeControlBlockPtr)btcb, prevkeyP, keyPtr ) >= 0 ) + { diff --git a/utils/hfsprogs/patches/0011-Fix-types.patch b/utils/hfsprogs/patches/0011-Fix-types.patch new file mode 100644 index 0000000..88c049f --- /dev/null +++ b/utils/hfsprogs/patches/0011-Fix-types.patch @@ -0,0 +1,71 @@ +From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= +Date: Thu, 24 Oct 2013 01:11:22 -0200 +Subject: Fix types + +--- + fsck_hfs.tproj/cache.c | 30 ++++++++++++++++-------------- + 1 file changed, 16 insertions(+), 14 deletions(-) + +diff --git a/fsck_hfs.tproj/cache.c b/fsck_hfs.tproj/cache.c +index 527088a..540fa0b 100644 +--- a/fsck_hfs.tproj/cache.c ++++ b/fsck_hfs.tproj/cache.c +@@ -961,20 +961,21 @@ int CacheLookup (Cache_t *cache, uint64_t off, Tag_t **tag) + */ + int CacheRawRead (Cache_t *cache, uint64_t off, uint32_t len, void *buf) + { +- uint64_t result; ++ off_t result1; ++ ssize_t result2; + + /* Both offset and length must be multiples of the device block size */ + if (off % cache->DevBlockSize) return (EINVAL); + if (len % cache->DevBlockSize) return (EINVAL); + + /* Seek to the position */ +- result = lseek (cache->FD_R, off, SEEK_SET); +- if (result < 0) return (errno); +- if (result != off) return (ENXIO); ++ result1 = lseek(cache->FD_R, off, SEEK_SET); ++ if (result1 < 0) return (errno); ++ if (result1 != off) return (ENXIO); + /* Read into the buffer */ +- result = read (cache->FD_R, buf, len); +- if (result < 0) return (errno); +- if (result == 0) return (ENXIO); ++ result2 = read(cache->FD_R, buf, len); ++ if (result2 < 0) return (errno); ++ if (result2 == 0) return (ENXIO); + + /* Update counters */ + cache->DiskRead++; +@@ -989,21 +990,22 @@ int CacheRawRead (Cache_t *cache, uint64_t off, uint32_t len, void *buf) + */ + int CacheRawWrite (Cache_t *cache, uint64_t off, uint32_t len, void *buf) + { +- uint64_t result; ++ off_t result1; ++ ssize_t result2; + + /* Both offset and length must be multiples of the device block size */ + if (off % cache->DevBlockSize) return (EINVAL); + if (len % cache->DevBlockSize) return (EINVAL); + + /* Seek to the position */ +- result = lseek (cache->FD_W, off, SEEK_SET); +- if (result < 0) return (errno); +- if (result != off) return (ENXIO); ++ result1 = lseek (cache->FD_W, off, SEEK_SET); ++ if (result1 < 0) return (errno); ++ if (result1 != off) return (ENXIO); + + /* Write into the buffer */ +- result = write (cache->FD_W, buf, len); +- if (result < 0) return (errno); +- if (result == 0) return (ENXIO); ++ result2 = write (cache->FD_W, buf, len); ++ if (result2 < 0) return (errno); ++ if (result2 == 0) return (ENXIO); + + /* Update counters */ + cache->DiskWrite++; diff --git a/utils/hfsprogs/patches/0012-Fix-mkfs-not-creating-UUIDs-for-new-filesystems.patch b/utils/hfsprogs/patches/0012-Fix-mkfs-not-creating-UUIDs-for-new-filesystems.patch new file mode 100644 index 0000000..883a7b7 --- /dev/null +++ b/utils/hfsprogs/patches/0012-Fix-mkfs-not-creating-UUIDs-for-new-filesystems.patch @@ -0,0 +1,50 @@ +From: Matthew Garrett +Date: Thu, 24 Oct 2013 01:11:22 -0200 +Subject: Fix mkfs not creating UUIDs for new filesystems. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fix mkfs not creating UUIDs for new filesystems. + +Thanks to Lars Noodén for reporting the bug at + . + +This closes LP: #737002. +--- + include/missing.h | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/include/missing.h b/include/missing.h +index 0a859c4..f50e8fb 100644 +--- a/include/missing.h ++++ b/include/missing.h +@@ -72,7 +72,7 @@ + #define NAME_MAX 255 + + /* Byteswap stuff */ +-#define NXSwapHostLongToBig(x) cpu_to_be64(x) ++#define NXSwapHostLongToBig(x) cpu_to_be32(x) + #define NXSwapBigShortToHost(x) be16_to_cpu(x) + #define OSSwapBigToHostInt16(x) be16_to_cpu(x) + #define NXSwapBigLongToHost(x) be32_to_cpu(x) +@@ -88,6 +88,9 @@ + #ifndef be32_to_cpu + #define be32_to_cpu(x) bswap_32(x) + #endif ++#ifndef cpu_to_be32 ++#define cpu_to_be32(x) bswap_32(x) ++#endif + #ifndef be64_to_cpu + #define be64_to_cpu(x) bswap_64(x) + #endif +@@ -102,6 +105,9 @@ + #ifndef be32_to_cpu + #define be32_to_cpu(x) (x) + #endif ++#ifndef cpu_to_be32 ++#define cpu_to_be32(x) (x) ++#endif + #ifndef be64_to_cpu + #define be64_to_cpu(x) (x) + #endif diff --git a/utils/hfsprogs/patches/0013-Fix-manpages.patch b/utils/hfsprogs/patches/0013-Fix-manpages.patch new file mode 100644 index 0000000..d78083b --- /dev/null +++ b/utils/hfsprogs/patches/0013-Fix-manpages.patch @@ -0,0 +1,157 @@ +From: =?UTF-8?q?Rog=C3=A9rio=20Theodoro=20de=20Brito?= +Date: Thu, 25 Nov 2010 00:00:00 -0200 +Subject: Fix manpages +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Remove typos, references in the "See also" sections of the manpages to +commands that are not available in Debian systems (and, quite probably, +other systems too) and non-Linux specific comments. + +Authored also by Christoph Hellwig and "A. Costa" + +Bug-Debian: http://bugs.debian.org/598714 +Bug-Debian: http://bugs.debian.org/575201 +Forwarded: no +Reviewed-by: Rogério Theodoro de Brito +--- + fsck_hfs.tproj/fsck_hfs.8 | 18 +++++++----------- + newfs_hfs.tproj/newfs_hfs.8 | 23 ++++++++--------------- + 2 files changed, 15 insertions(+), 26 deletions(-) + +diff --git a/fsck_hfs.tproj/fsck_hfs.8 b/fsck_hfs.tproj/fsck_hfs.8 +index aec9949..0bc804d 100644 +--- a/fsck_hfs.tproj/fsck_hfs.8 ++++ b/fsck_hfs.tproj/fsck_hfs.8 +@@ -19,18 +19,18 @@ + .Dt FSCK_HFS 8 + .Os "Mac OS X" + .Sh NAME +-.Nm fsck_hfs ++.Nm fsck.hfs + .Nd HFS file system consistency check + .Sh SYNOPSIS +-.Nm fsck_hfs ++.Nm fsck.hfs + .Fl q + .Op Fl df + .Ar special ... +-.Nm fsck_hfs ++.Nm fsck.hfs + .Fl p + .Op Fl df + .Ar special ... +-.Nm fsck_hfs ++.Nm fsck.hfs + .Op Fl n | y | r + .Op Fl dfgl + .Op Fl m Ar mode +@@ -52,9 +52,7 @@ The second form of + preens the specified file systems. + It is normally started by + .Xr fsck 8 +-run from +-.Pa /etc/rc.boot +-during automatic reboot, when a HFS file system is detected. ++during systen boot, when a HFS file system is detected. + When preening file systems, + .Nm + will fix common inconsistencies for file systems that were not +@@ -105,9 +103,9 @@ to check and repair journaled HFS+ file systems. + .It Fl g + Causes + .Nm +-to generate it's output strings in GUI format. ++to generate its output strings in GUI format. + This option is used when another application with a graphical user interface +-(like Mac OS X Disk Utility) is envoking the ++(like Mac OS X Disk Utility) is invoking the + .Nm + tool. + .It Fl l +@@ -144,8 +142,6 @@ specified file system for a new catalog file and if there is no damage + to the leaf nodes in the existing catalog file. + .El + .Pp +-Because of inconsistencies between the block device and the buffer cache, +-the raw device should always be used. + .Sh SEE ALSO + .Xr fsck 8 + .Sh BUGS +diff --git a/newfs_hfs.tproj/newfs_hfs.8 b/newfs_hfs.tproj/newfs_hfs.8 +index d002cc9..fe91962 100644 +--- a/newfs_hfs.tproj/newfs_hfs.8 ++++ b/newfs_hfs.tproj/newfs_hfs.8 +@@ -19,10 +19,10 @@ + .Dt NEWFS_HFS 8 + .Os "Mac OS X" + .Sh NAME +-.Nm newfs_hfs ++.Nm mkfs.hfs + .Nd construct a new HFS Plus file system + .Sh SYNOPSIS +-.Nm newfs_hfs ++.Nm mkfs.hfs + .Op Fl N Ar [partition-size] + .Op Fl U Ar uid + .Op Fl G Ar gid +@@ -37,19 +37,13 @@ + .Op Fl v Ar volume-name + .Ar special + .Sh DESCRIPTION +-.Nm Newfs_hfs ++.Nm mkfs.hfs + builds an HFS Plus file system on the specified special device. +-Before running +-.Nm newfs_hfs +-the disk should be partitioned using the +-.Em Disk Utility +-application or +-.Xr pdisk 8 . + .Pp + The file system default parameters are calculated based on + the size of the disk partition. Typically the defaults are + reasonable, however +-.Nm newfs_hfs ++.Nm mkfs.hfs + has several options to allow the defaults to be selectively overridden. + The options are as follows: + .Bl -tag -width Fl +@@ -66,7 +60,7 @@ Set the group of the file system's root directory to + Specify the access permissions mask for the file system's root directory. + .It Fl h + Creates a legacy HFS format filesystem. This option +-is not recomended for file systems that will be ++is not recommended for file systems that will be + primarily used with Mac OS X or Darwin. + .It Fl s + Creates a case-sensitive HFS Plus filesystem. By +@@ -93,7 +87,7 @@ sizes are specified with the + option followed by a comma + separated list of the form arg=blocks. + .Pp +-Example: -c c=5000,e=500 ++Example: \-c c=5000,e=500 + .Bl -tag -width Fl + .It Em a=blocks + Set the attribute file clump size. +@@ -126,7 +120,7 @@ the form arg=bytes. The + size must be a power of two and no larger than + 32768 bytes. + .Pp +-Example: -n c=8192,e=4096 ++Example: \-n c=8192,e=4096 + .Bl -tag -width Fl + .It Em a=bytes + Set the attribute b-tree node size. +@@ -139,8 +133,7 @@ Set the extent overflow b-tree node size. + Volume name (file system name) in ascii or UTF-8 format. + .El + .Sh SEE ALSO +-.Xr mount 8 , +-.Xr pdisk 8 ++.Xr mount 8 + .Sh HISTORY + The + .Nm diff --git a/utils/hfsprogs/patches/0014-uClibc_no_loadavg.patch b/utils/hfsprogs/patches/0014-uClibc_no_loadavg.patch new file mode 100644 index 0000000..48649ba --- /dev/null +++ b/utils/hfsprogs/patches/0014-uClibc_no_loadavg.patch @@ -0,0 +1,15 @@ +--- diskdev_cmds-332.25/newfs_hfs.tproj/makehfs.c 2015-03-27 21:58:04.163171675 -0700 ++++ hfsprogs-332.25/newfs_hfs.tproj/makehfs.c 2015-03-27 21:56:03.687175020 -0700 +@@ -2119,10 +2119,12 @@ + sysctl(mib, 2, sysctlstring, &datalen, NULL, 0); + SHA1_Update(&context, sysctlstring, datalen); + #endif ++#ifndef __UCLIBC__ + /* The system's load average: */ + datalen = sizeof(sysloadavg); + getloadavg(sysloadavg, 3); + SHA1_Update(&context, &sysloadavg, datalen); ++#endif + + /* The system's VM statistics: */ + #if !LINUX diff --git a/utils/hfsprogs/patches/0015-sysctl-only-on-glibc.patch b/utils/hfsprogs/patches/0015-sysctl-only-on-glibc.patch new file mode 100644 index 0000000..b71290f --- /dev/null +++ b/utils/hfsprogs/patches/0015-sysctl-only-on-glibc.patch @@ -0,0 +1,91 @@ +--- a/newfs_hfs.tproj/makehfs.c ++++ b/newfs_hfs.tproj/makehfs.c +@@ -37,7 +37,9 @@ + #endif + #include + #include ++#ifdef __GLIBC__ + #include ++#endif + #if !LINUX + #include + #endif +@@ -2039,6 +2041,7 @@ getencodinghint(unsigned char *name) + if (getvfsbyname("hfs", &vfc) < 0) + goto error; + ++#ifdef __GLIBC__ + mib[0] = CTL_VFS; + mib[1] = vfc.vfc_typenum; + mib[2] = HFS_ENCODINGHINT; +@@ -2046,6 +2049,7 @@ getencodinghint(unsigned char *name) + if (sysctl(mib, 3, &hint, &buflen, name, strlen((char *)name) + 1) < 0) + goto error; + return (hint); ++#endif + error: + hint = GetDefaultEncoding(); + return (0); +@@ -2062,7 +2066,7 @@ void GenerateVolumeUUID(VolumeUUID *newV + clock_t uptime; + size_t datalen; + double sysloadavg[3]; +-#if !LINUX ++#if !LINUX && defined(__GLIBC__) + int sysdata; + int mib[2]; + char sysctlstring[128]; +@@ -2080,7 +2084,7 @@ void GenerateVolumeUUID(VolumeUUID *newV + SHA1_Update(&context, &uptime, sizeof(uptime)); + + /* The kernel's boot time: */ +-#if !LINUX ++#if !LINUX && defined(__GLIBC__) + mib[0] = CTL_KERN; + mib[1] = KERN_BOOTTIME; + datalen = sizeof(sysdata); +@@ -2088,7 +2092,7 @@ void GenerateVolumeUUID(VolumeUUID *newV + SHA1_Update(&context, &sysdata, datalen); + #endif + /* The system's host id: */ +-#if !LINUX ++#if !LINUX && defined(__GLIBC__) + mib[0] = CTL_KERN; + mib[1] = KERN_HOSTID; + datalen = sizeof(sysdata); +@@ -2096,7 +2100,7 @@ void GenerateVolumeUUID(VolumeUUID *newV + SHA1_Update(&context, &sysdata, datalen); + #endif + /* The system's host name: */ +-#if !LINUX ++#if !LINUX && defined(__GLIBC__) + mib[0] = CTL_KERN; + mib[1] = KERN_HOSTNAME; + datalen = sizeof(sysctlstring); +@@ -2104,7 +2108,7 @@ void GenerateVolumeUUID(VolumeUUID *newV + SHA1_Update(&context, sysctlstring, datalen); + #endif + /* The running kernel's OS release string: */ +-#if !LINUX ++#if !LINUX && defined(__GLIBC__) + mib[0] = CTL_KERN; + mib[1] = KERN_OSRELEASE; + datalen = sizeof(sysctlstring); +@@ -2112,7 +2116,7 @@ void GenerateVolumeUUID(VolumeUUID *newV + SHA1_Update(&context, sysctlstring, datalen); + #endif + /* The running kernel's version string: */ +-#if !LINUX ++#if !LINUX && defined(__GLIBC__) + mib[0] = CTL_KERN; + mib[1] = KERN_VERSION; + datalen = sizeof(sysctlstring); +@@ -2127,7 +2131,7 @@ void GenerateVolumeUUID(VolumeUUID *newV + #endif + + /* The system's VM statistics: */ +-#if !LINUX ++#if !LINUX && defined(__GLIBC__) + mib[0] = CTL_VM; + mib[1] = VM_METER; + datalen = sizeof(sysvmtotal); diff --git a/utils/hub-ctrl/Makefile b/utils/hub-ctrl/Makefile new file mode 100644 index 0000000..48cca4d --- /dev/null +++ b/utils/hub-ctrl/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2015 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:=hub-ctrl +PKG_VERSION:=1.0 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/codazoda/hub-ctrl.c.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=3eef0240fac90067d081551e9f73dfa741d94a9e +PKG_LICENSE:=GPL-2.0+ + +PKG_MAINTAINER:=Simon Peter + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/hub-ctrl + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Control USB power on a port by port basis + URL:=https://github.com/codazoda/hub-ctrl.c + DEPENDS:=+libusb-compat +endef + +define Package/hub-ctrl/description + Control USB power on a port by port basis on some USB hubs. + This only works on USB hubs that have the hardware necessary + to allow software controlled power switching. + Most hubs DO NOT include the hardware. +endef + +define Build/Compile + $(TARGET_CC) $(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include \ + -L$(STAGING_DIR)/usr/lib -lusb \ + -o $(PKG_BUILD_DIR)/hub-ctrl $(PKG_BUILD_DIR)/hub-ctrl.c +endef + +define Package/hub-ctrl/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/hub-ctrl $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,hub-ctrl)) diff --git a/utils/i2c-tools/Makefile b/utils/i2c-tools/Makefile new file mode 100644 index 0000000..4fb9b50 --- /dev/null +++ b/utils/i2c-tools/Makefile @@ -0,0 +1,125 @@ +# +# Copyright (C) 2007-2015 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:=i2c-tools +PKG_VERSION:=3.1.2 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://dl.lm-sensors.org/i2c-tools/releases/ \ + http://fossies.org/linux/misc/ + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_MD5SUM:=7104a1043d11a5e2c7b131614eb1b962 + +PKG_BUILD_PARALLEL:=1 +PKG_BUILD_DEPENDS:=PACKAGE_python-smbus:python + +PKG_MAINTAINER:=Daniel Golle +PKG_LICENSE:=GPLv2 +PKG_LICENSE_FILES:=COPYING + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) +$(call include_mk, python3-package.mk) + +define Package/i2c/Default + URL:=http://lm-sensors.org/wiki/I2CTools + TITLE:=I2C +endef + +define Package/i2c-tools + $(call Package/i2c/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE+=tools for Linux +endef + +define Package/python-smbus + $(call Package/i2c/Default) + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + TITLE:=Python bindings for the SMBUS + DEPENDS:=+python-light +endef + +define Package/python3-smbus + $(call Package/i2c/Default) + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + TITLE:=Python bindings for the SMBUS + DEPENDS:=+python3-light +endef + +define Package/i2c-tools/description + This package contains an heterogeneous set of I2C tools for Linux. These tools + were originally part of the lm-sensors package. +endef + +define Package/python-smbus/description + This package contain the python bindings for Linux SMBus access through i2c-dev. +endef + +define Package/python3-smbus/description + This package contain the python bindings for Linux SMBus access through i2c-dev. +endef + +TARGET_CPPFLAGS += -I$(PKG_BUILD_DIR)/include + +ifdef CONFIG_PACKAGE_python-smbus + define Build/Compile/python-smbus + $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false) + $(call Build/Compile/PyMod,./py-smbus/, \ + install --prefix="$(PKG_INSTALL_DIR)/usr", \ + ) + endef +endif + +ifdef CONFIG_PACKAGE_python3-smbus + define Build/Compile/python3-smbus + $(if $(Build/Compile/Py3Mod),,@echo Python3 packaging code not found.; false) + $(call Build/Compile/Py3Mod,./py-smbus/, \ + install --prefix="$(PKG_INSTALL_DIR)/usr", \ + ) + endef +endif + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + LINUX="$(LINUX_DIR)" \ + CC="$(TARGET_CC)" \ + STAGING_DIR="$(STAGING_DIR)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + CFLAGS="$(TARGET_CFLAGS)" + $(Build/Compile/python-smbus) + $(Build/Compile/python3-smbus) +endef + +define Package/i2c-tools/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdetect $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdump $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cset $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cget $(1)/usr/sbin/ +endef + +define PyPackage/python-smbus/filespec ++|$(PYTHON_PKG_DIR) +endef + +define PyPackage/python3-smbus/filespec ++|$(PYTHON3_PKG_DIR) +endef + +$(eval $(call BuildPackage,i2c-tools)) +$(eval $(call PyPackage,python-smbus)) +$(eval $(call BuildPackage,python-smbus)) +$(eval $(call PyPackage,python3-smbus)) +$(eval $(call BuildPackage,python3-smbus)) diff --git a/utils/joe/Makefile b/utils/joe/Makefile new file mode 100644 index 0000000..3132104 --- /dev/null +++ b/utils/joe/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2007-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +# changes by David Kuehling : +# +# - include support for all emulation modes jmacs jpico etc. +# - see patches/002-builtinrc.patch +# +# changes by Vitaly Prosko : +# +# - updated for new build system rules +# - added static joerc config - no more defaults for native mode +# - got maintenance role +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=joe +PKG_VERSION:=4.3 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=@SF/joe-editor +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=5a167f5e88e62c77bb42b0145d72c466 +PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_MAINTAINER:=Vitaly Protsko +PKG_LICENCE:=GPL-2.0 + +include $(INCLUDE_DIR)/package.mk + +define Package/joe + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Editors + TITLE:=JOE - Joes own editor + URL:=http://sourceforge.net/projects/joe-editor/ + DEPENDS:=+libncurses +endef + +define Package/joe/description +Joe is world-famous Wordstar like text editor, that also features +Emacs and Pico emulation +endef + +define Package/joe/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/joe/joe $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/joe + $(INSTALL_CONF) ./files/joerc $(1)/etc/joe/joerc +endef + +define Package/joe/conffiles +/etc/joe/joerc +endef + +$(eval $(call BuildPackage,joe)) diff --git a/utils/joe/files/joerc b/utils/joe/files/joerc new file mode 100644 index 0000000..403cce6 --- /dev/null +++ b/utils/joe/files/joerc @@ -0,0 +1,783 @@ +-asis +-nobackups +-nonotice +-noxon +-notite +-assume_color +-assume_256color +-guess_non_utf8 +-guess_utf16 +-guess_crlf +-guess_indent +-menu_above +-transpose + -joe_state +-joexterm +-brpaste +-pastehack +-restore +-search_prompting +-lmsg \i%k%T%W%I%X %n %m%y%R %M %x +-rmsg %S Row %4r Col %3c +-smsg ** Line %r Col %c Offset %o(0x%O) %e %a(0x%A) Width %w ** +-zmsg ** Line %r Col %c Offset %o(0x%O) ** +-xmsg \i Joe's Own Editor %v (%b) ** Type \bCtrl-K Q\b to exit or \bCtrl-K H\b for help **\i +-aborthint ^C +-helphint ^K H +-highlight +-istep 4 + +:include ftyperc + +:defmenu root +mode,"overwrite",rtn T Overtype %Zoverwrite% +mode,"hex",rtn ' Hex edit mode +mode,"autoindent",rtn I Autoindent %Zautoindent% +mode,"wordwrap",rtn W Word wrap %Zwordwrap% +mode,"tab",rtn D Tab width %Ztab% +mode,"lmargin",rtn L Left margin %Zlmargin% +mode,"rmargin",rtn R Right margin %Zrmargin% +mode,"square",rtn X Column mode %Zsquare% +mode,"indentc",rtn % % Indent char %Zindentc% +mode,"istep",rtn % % Indent step %Zistep% +menu,"indent",rtn = Indent select +mode,"highlight",rtn H Highlighting %Zhighlight% +mode,"crlf",rtn Z CR-LF/MS-DOS %Zcrlf% +mode,"linums",rtn N Line numbers %Zlinums% +mode,"beep",rtn B Beep %Zbeep% +mode,"rdonly",rtn O Read only %Zrdonly% +mode,"syntax",rtn Y Syntax +mode,"encoding",rtn E Encoding +mode,"asis",rtn % % Meta chars as-is +mode,"language",rtn V Language +mode,"picture",rtn P picture %Zpicture% +mode,"type",rtn F File type [%Ztype%] +mode,"title",rtn C Context %Ztitle% +menu,"more-options",rtn % % More options... + +:defmenu more-options menu,"root",rtn +menu,"^G",rtn % % ^G options +menu,"search",rtn % % search options +menu,"paragraph",rtn % % paragraph options +menu,"file",rtn % % file options +menu,"menu",rtn % % menu options +menu,"global",rtn % % global options +menu,"cursor",rtn % % cursor options +menu,"marking",rtn % % marking options +menu,"tab",rtn % % tab/indent options + +:defmenu indent menu,"root",rtn +mode,"istep",rtn,"1",rtn,mode,"indentc",rtn,"32",rtn,msg,"Indent step = 1, Indent character = 32",rtn 1 Space +mode,"istep",rtn,"2",rtn,mode,"indentc",rtn,"32",rtn,msg,"Indent step = 2, Indent character = 32",rtn 2 Spaces +mode,"istep",rtn,"3",rtn,mode,"indentc",rtn,"32",rtn,msg,"Indent step = 3, Indent character = 32",rtn 3 Spaces +mode,"istep",rtn,"4",rtn,mode,"indentc",rtn,"32",rtn,msg,"Indent step = 4, Indent character = 32",rtn 4 Spaces +mode,"istep",rtn,"5",rtn,mode,"indentc",rtn,"32",rtn,msg,"Indent step = 5, Indent character = 32",rtn 5 Spaces +mode,"istep",rtn,"8",rtn,mode,"indentc",rtn,"32",rtn,msg,"Indent step = 8, Indent character = 32",rtn 8 Spaces +mode,"istep",rtn,"10",rtn,mode,"indentc",rtn,"32",rtn,msg,"Indent step = 10, Indent character = 32",rtn 0 Ten +mode,"istep",rtn,"1",rtn,mode,"indentc",rtn,"9",rtn,msg,"Indent step = 1, Indent character = 9",rtn T Tab + +:defmenu menu menu,"more-options",rtn +mode,"menu_explorer",rtn % % Menu explorer %Zmenu_explorer% +mode,"menu_above",rtn % % Menu position %Zmenu_above% +mode,"menu_jump",rtn % % Jump into menu %Zmenu_jump% +mode,"transpose",rtn % % Transpose menus %Ztranspose% + +:defmenu ^G menu,"more-options",rtn +mode,"highlighter_context",rtn % % ^G uses highlighter context %Zhighlighter_context% +mode,"single_quoted",rtn % % ^G ignores '...' %Zsingle_quoted% +mode,"no_double_quoted",rtn % % ^G no ignore "..." %Zno_double_quoted% +mode,"c_comment",rtn % % ^G ignores /*...*/ %Zc_comment% +mode,"cpp_comment",rtn % % ^G ignores //... %Zcpp_comment% +mode,"pound_comment",rtn % % ^G ignores #... %Zpound_comment% +mode,"vhdl_comment",rtn % % ^G ignores --... %Zvhdl_comment% +mode,"semi_comment",rtn % % ^G ignores ;... %Zsemi_comment% +mode,"tex_comment",rtn % % ^G ignores %%... %Ztex_comment% +mode,"text_delimiters",rtn % % Text delimiters %Ztext_delimiters% + +:defmenu search menu,"more-options",rtn +mode,"icase",rtn % % Case insensitivity %Zicase% +mode,"wrap",rtn % % Search wraps %Zwrap% +mode,"search_prompting",rtn % % Search prompting %Zsearch_prompting% +mode,"csmode",rtn % % Continued search %Zcsmode% + +:defmenu paragraph menu,"more-options",rtn +mode,"french",rtn % % French spacing %Zfrench% +mode,"flowed",rtn % % Flowed text %Zflowed% +mode,"cpara",rtn % % Paragraph indent chars %Zcpara% +mode,"cnotpara",rtn % % Not-paragraph chars %Zcnotpara% + +:defmenu file menu,"more-options",rtn +mode,"restore",rtn % % Restore cursor %Zrestore% +mode,"guess_crlf",rtn % % Auto detect CR-LF %Zguess_crlf% +mode,"guess_indent",rtn % % Guess indent %Zguess_indent% +mode,"guess_non_utf8",rtn % % Guess non-UTF-8 %Zguess_non_utf8% +mode,"guess_utf8",rtn % % Guess UTF-8 %Zguess_utf8% +mode,"guess_utf16",rtn % % Guess UTF-16 %Zguess_utf16% +mode,"force",rtn % % Force last NL %Zforce% +mode,"nobackup",rtn % % No backup %Znobackup% + +:defmenu global menu,"more-options",rtn +mode,"nolocks",rtn % % Disable locks %Znolocks% +mode,"nobackups",rtn % % Disable backups %Znobackups% +mode,"nodeadjoe",rtn % % Disable DEADJOE %Znodeadjoe% +mode,"nomodcheck",rtn % % Disable mtime check %Znomodcheck% +mode,"nocurdir",rtn % % Disable current dir %Znocurdir% +mode,"exask",rtn % % Exit ask %Zexask% +mode,"nosta",rtn % % Disable status line %Znosta% +mode,"keepup",rtn % % Fast status line %Zkeepup% +mode,"break_hardlinks",rtn % % Break hard links %Zbreak_hardlinks% +mode,"break_links",rtn % % Break links %Zbreak_links% +mode,"joe_state",rtn % % Joe_state file %Zjoe_state% +mode,"undo_keep",rtn % % No. undo records %Zundo_keep% +mode,"backpath",rtn % % Path to backup files %Zbackpath% + +:defmenu cursor menu,"more-options",rtn +mode,"pg",rtn % % No. PgUp/PgDn lines %Zpg% +mode,"mid",rtn C Center on scroll %Zmid% +mode,"left",rtn L Columns to scroll left %Zleft% +mode,"right",rtn R Columns to scroll right %Zright% +mode,"floatmouse",rtn % % Click past end %Zfloatmouse% +mode,"rtbutton",rtn % % Right button %Zrtbutton% + +:defmenu marking menu,"more-options",rtn +mode,"autoswap",rtn % % Autoswap mode %Zautoswap% +mode,"marking",rtn % % Marking %Zmarking% +mode,"lightoff",rtn % % Auto unmask %Zlightoff% + +:defmenu tab menu,"more-options",rtn +mode,"smarthome",rtn % % Smart home key %Zsmarthome% +mode,"smartbacks",rtn % % Smart backspace %Zsmartbacks% +mode,"indentfirst",rtn % % To indent first %Zindentfirst% +mode,"purify",rtn % % Clean up indents %Zpurify% +mode,"spaces",rtn % % No tabs %Zspaces% + +{Basic + \|\uREGION\u \|\uGO TO\u \|\uGO TO\u \|\uDELETE\u \|\uEXIT\u \|\uSEARCH\u \| + \|\b^Arrow\b Select \|\b^Z\b Prev. word \|\b^U/^V\b PgUp/PgDn \|\b^D\b Char. \|\b^KX\b Save \|\b^KF\b Find \| + \|\b^KB\b Begin \|\b^X\b Next word \|\uMISC\u \|\b^Y\b Line \|\b^C\b Abort \|\b^L\b Next \| + \|\b^KK\b End \|\b^KU\b Top of file \|\b^KJ\b Paragraph \|\b^W\b >Word \|\b^KQ\b All \|\uHELP\u \| + \|\b^KC\b Copy \|\b^KV\b End of file \|\b^KA\b Center line \|\b^O\b Word< \|\uFILE\u \|\bEsc .\b Next\| + \|\b^KM\b Move \|\b^A\b Beg. of line \|\b^K Space\b Status \|\b^J\b >Line \|\b^KE\b Edit \|\bEsc ,\b Prev\| + \|\b^KW\b File \|\b^E\b End of line \|\uSPELL\u \|\b^[O\b Line< \|\b^KR\b Insert \|\b^KH\b Off \| + \|\b^KY\b Delete \|\b^KL\b To line no. \|\bEsc N\b Word \|\b^_\b Undo \|\b^KD\b Save \|\b^T\b Menu \| + \|\b^K/\b Filter \|\b^G\b Matching ( \|\bEsc L\b File \|\b^^\b Redo \|\b^K`\b Revert \|\b\b \| +} + +{Advanced + \|\uMACROS\u \|\uSCROLL\u \|\uWINDOW\u \|\uGO TO\u \|\uI-SEARCH\u \| + \|\b^K[ 0-9\b Record \|\bEsc W\b Up \|\b^KO\b Open \b^C\b Close \|\bEsc B\b / \bK\b \|\b^R\b Backwards \| + \|\b^K]\b Stop \|\bEsc Z\b Down \|\b^KG\b Grow \b^KT\b Shrink \|to \b^KB\b/\b^KK \b\|\b^S\b Forwards \| + \|\bEsc I\b Text \|\bEsc <\b Left \|\b^KN\b Next \b^KP\b Prev. \|\b^P\b Up \|\uBOOKMARKS\u \| + \|\b^K?\b Pause \|\bEsc >\b Right \|\b^KI\b Show one / All \|\b^N\b Down \|\bEsc 0-9\b Goto \| + \| for prompt \|\uINSERT\u \|\uSHELL\u \|\b^B\b Left \|\bEsc Esc\b Set \| + \|\b^K 0-9\b Play \|\b^]\b Line \b^Q\b Ctrl \|\bF1-F4\b Term emulator \|\b^F\b Right \|\b^K-\b Auto prev\| + \|\b^K\\\b Repeat \|\b^@\b Space \b^\\\b Meta \|\b^K'\b In buffer \| \|\b^K=\b Auto next\| + \|\bEsc D\b Dump \|\bEsc Y\b Paste \|\b^KZ\b Suspend \bEsc !\b Append \| \| \| +} + +{Programs + \|\uCOMMANDS\u \|\uCOMPILING\u \|\uQUICK\u \| + \|\bEsc X\b Command prompt\|\bEsc C\b Save modified compile\|\b^G\b Find word under cursor \| + \|\bEsc M\b Calculator \|\bEsc G\b Grep \|\b^K;\b Tags file search \| + \|\bshowlog\b Startup log \|\bEsc =\b To next error \|\bEsc Enter\b Complete word \| + \|\bupper\b Change case \|\bEsc -\b To prev. error \|\uBUFFER\u \| + \|\blower\b Change case \|\bEsc Space\b Jump to error \|\bEsc U\b Next \| + \|\bcd\b Change dir \|\uINDENT\u \|\bEsc V\b Previous \| + \|\bkeymap\b Change map \|\b^K,\b Less \|\bEsc X bufed\b Switch \| + \| \|\b^K.\b More \| \| +} + +{Search + Search sequences: \| + \b\\^ \\$\b matches beg./end of line \b\\.\b match any single char \| + \b\\< \\>\b matches beg./end of word \b\\!\b match char or expression \| + \b\\( \\)\b grouping \b\\|\b match left or right \| + \b\\[a-z]\b matches one of a set \b\\y \\Y\b short for (.*) / (!*) \| + \b\\{1,3}\b match 1 - 3 occurrences \b\\?\b match 0 or 1 occurrence \| + \b\\+\b match 1 or more occurrences \b\\*\b match 0 or more occurrences \| + \| + \b^C\b to abort \bEsc .\b to list of escape sequences \| +} + +{Escape sequences + Escape sequences: \| + \b\\x{10fff}\b Unicode code point \b\\p{Ll}\b Unicode category \| + \b\\i\b / \b\\I\b Identifier start \b\\t\b tab \b\\e\b escape \| + \b\\c\b / \b\\C\b Identifier continue \b\\n\b newline \b\\r\b carriage return \| + \b\\d\b / \b\\D\b Digit / Not a digit \b\\b\b backspace \b\\xFF\b hex character \| + \b\\w\b / \b\\W\b Word / Not a word \b\\a\b alert \b\\377\b octal character \| + \b\\s\b / \b\\S\b Space / Not a space \b\\f\b formfeed \b\\\\\b backslash \| + \| + \| +} + +{Replace + Replace sequences: \| + \b\\&\b replaced with entire match \b\\1\b - \b9\b replaced with Nth group \| + \b\\u \\l\b convert next to upper/lower \b\\U \\L\b case convert until \b\\E\b \| + \| + \| + \| + \| + \| + \b^C\b to abort \bEsc ,\b to list of escape sequences \| +} + +{SearchOptions + Search options: \| + \br\b Replace \bk\b Restrict search to highlighted block \| + \bi\b Ignore case \bb\b Search backwards instead of forwards \| + \ba\b Search across all loaded files \| + \be\b Search across all files in Grep or Compile error list \| + \bw\b / \bn\b Allow / prevent wrap to start of file \| + \bx\b / \by\b Search text is standard format / JOE format regular expression \| + \bnnn\b Perform exactly nnn replacements \| + \b^C\b to abort +} + +{Math + \uMATH COMMANDS\u \uCONSTANTS\u \| + \bhex oct bin\b display mode \b0xff\b hex entry \| + \beng dec\b engineering / normal \b0o77\b octal entry \| + \bins\b type result into file \b0b11\b binary entry \| + \beval\b evaluate block \b3e-4\b floating point entry \| + 2+3\b:\bins multiple commands \uVARIABLES\u \| + \uOPERATORS\u \bans\b Previous result \| + \b! ^ * / % + -\b \ba=10\b Assign a variable \| + \b< <= > >= == != && || ? :\b \bEsc .\b for list of functions \| +} + +{Functions + \uFUNCTIONS\u \uCONSTANTS\u \| + \bsin cos tab asin acos atan\b \be pi\b \| + \bsinh cosh tanh asinh acosh atanh\b \| + \bsqrt cbrt exp ln log\b \| + \bint floor ceil abs\b \| + \berf erfc j0 j1 y0 y1\b \| + \bjoe(..macro..)\b - runs an editor macro \| + \| + \bEsc .\b for statistics \| +} + +{Statistics + \uMATH COMMANDS\u \| + Statistics on region of numbers Linear regression on region of x y pairs \| + \bsum\b Sum \blr(x)\b Estimate y given x y=m*x+b \| + \bcnt\b Count \brlr(y)\b Estimate x given y \| + \bavg\b Mean \bLr rLr\b Logarithmic regression y=m*ln(x)+b \| + Standard deviation: \blR rlR\b Exponential regression y=e^(m*x)+b \| + \bdev\b all data present \bLR rLR\b Power regression y=b*x^m \| + \bsamp\b sample of data present Side effects: \bb\b, \bm\b: regression coef. \| + \br\b: correlation coef., \bcov\b: covariance \| +} + +{Names + Hit TAB to complete names. Use up / down arrow keys to traverse history. \| + Special file names: \| + \b!\bcommand Pipe in/out of a shell command \| + \b>>\bfilename Append to a file \| + \b-\b Read/Write to/from standard I/O \| + filename\b,START,SIZE\b Read/Write a part of a file/device \| + Give START/SIZE in decimal (255), octal (0377) or hex (0xFF) \| + \b\\,\b Use backslash to quote special characters \| + \b^C\b to abort +} + +{CharTable + \| Dec \u 0123 4567 8901 2345 0123 4567 8901 2345 \u Dec \| + \| 0 | \u@ABC\u \uDEFG\u \uHIJK\u \uLMNO\u \i\u@ABC\u\i \i\uDEFG\u\i \i\uHIJK\u\i \i\uLMNO\u\i | 128 \| + \| 16 | \uPQRS\u \uTUVW\u \uXYZ[\u \u\\]^_\u \i\uPQRS\u\i \i\uTUVW\u\i \i\uXYZ[\u\i \i\u\\]^_\u\i | 144 \| + \| 32 | !"# $%&' ()*+ ,-./  ¡¢£ ¤¥¦§ ¨©ª« ¬X®¯ | 160 \| + \| 48 | 0123 4567 89:; <=>? °±²³ ´µ¶· ¸¹º» ¼½¾¿ | 176 \| + \| 64 | @ABC DEFG HIJK LMNO ÀÁÂà ÄÅÆÇ ÈÉÊË ÌÍÎÏ | 192 \| + \| 80 | PQRS TUVW XYZ[ \\]^_ ÐÑÒÓ ÔÕÖ× ØÙÚÛ ÜÝÞß | 208 \| + \| 96 | `abc defg hijk lmno àáâã äåæç èéêë ìíîï | 224 \| + \| 112 | pqrs tuvw xyz{ |}~ ðñòó ôõö÷ øùúû üýþÿ | 240 \| +} + +{Joe + Send bug reports to: http://sourceforge.net/projects/joe-editor \| + \| + default joerc file is here @JOERC@/joerc \| + default syntax and i18n files are here @JOEDATA@ \| + additional documentation can be found here @JOEDOC@ \| + \| + \| + \| + \| +} + +:def recenter retype,arg,"top+height/2-line",rtn,upslide + +:windows +type U+0 TO U+10FFFF +abort ^C + abort ^K Q + abort ^K ^Q + abort ^K q +querysave,query,killjoe ^K Q +querysave,query,killjoe ^K ^Q +querysave,query,killjoe ^K q +arg ^K \ +explode ^K I +explode ^K ^I +explode ^K i +help ^K H +help ^K ^H +help ^K h +hnext ^[ . +hprev ^[ , +math ^[ m +math ^[ M + math ^[ ^M +msg ^[ h +msg ^[ H +msg ^[ ^H +nextw ^K N +nextw ^K ^N +nextw ^K n +pgdn .kN +pgdn ^V +pgdn ^[ [ 6 ~ + pgdn ^# S +pgup .kP +pgup ^U +pgup ^[ [ 5 ~ + pgup ^# T +play ^K 0 TO 9 +prevw ^K P +prevw ^K ^P +prevw ^K p +query ^K ? +record ^K [ + retype ^R + recenter ^R +rtn ^M +shell ^K Z +shell ^K ^Z +shell ^K z +stop ^K ] + Mouse handling +defmdown MDOWN +defmup MUP +defmdrag MDRAG +defm2down M2DOWN +defm2up M2UP +defm2drag M2DRAG +defm3down M3DOWN +defm3up M3UP +defm3drag M3DRAG +defmiddleup MIDDLEUP +defmiddledown MIDDLEDOWN + +xtmouse ^[ [ M +extmouse ^[ [ < + +:main Text editing window +:inherit windows + +:def compile mwind!,mfit!,querysave,query,scratch,"* Build Log *",rtn,bof,markb,eof," ",markk,blkdel,build +:def grep_find mwind!,mfit!,scratch,"* Grep Log *",rtn,bof,markb,eof," ",markk,blkdel,grep + +:def shell1 scratch_push,"* Startup Log *",rtn,scratch_push,"* Shell 1 *",rtn,vtbknd!,eof +:def shell2 scratch_push,"* Startup Log *",rtn,scratch_push,"* Shell 2 *",rtn,vtbknd!,eof +:def shell3 scratch_push,"* Startup Log *",rtn,scratch_push,"* Shell 3 *",rtn,vtbknd!,eof +:def shell4 scratch_push,"* Startup Log *",rtn,scratch_push,"* Shell 4 *",rtn,vtbknd!,eof +:def shell_clear psh,bof,markb,eof,markk,blkdel +:def shell_parse parserr +:def shell_gparse gparse +:def shell_release release +:def shell_math maths +:def shell_abort abort +:def shell_typemath txt,maths,"ins",rtn,rtn,txt," ",rtn,txt,quote,"d",rtn +:def shell_rtn rtn +:def shell_edit edit +:def shell_dellin dellin +:def shell_cd cd +:def shell_pop popabort +:def shell_markb markb +:def shell_markk markk + +paste ^[ ] 5 2 ; +brpaste ^[ [ 2 0 0 ~ +brpaste_done ^[ [ 2 0 1 ~ +insc ^[ [ 2 ~ +insc ^[ [ L +delch ^[ [ 3 ~ +pgup ^[ [ I +pgdn ^[ [ G +home ^[ [ 1 ~ +home ^[ [ H +home ^[ O H +home ^[ [ 7 ~ + home ^# SP A +eol ^[ [ 4 ~ +eol ^[ [ F +eol ^[ O F +eol ^[ [ 8 ~ + eol ^# SP @ + +rtarw,ltarw,begin_marking,rtarw,toggle_marking ^[ [ 1 ; 5 C +rtarw,ltarw,begin_marking,rtarw,toggle_marking ^[ [ 5 C +rtarw,ltarw,begin_marking,rtarw,toggle_marking ^[ O c +ltarw,rtarw,begin_marking,ltarw,toggle_marking ^[ [ 1 ; 5 D +ltarw,rtarw,begin_marking,ltarw,toggle_marking ^[ [ 5 D + ltarw,rtarw,begin_marking,ltarw,toggle_marking ^[ O D +ltarw,rtarw,begin_marking,ltarw,toggle_marking ^[ O d +uparw,dnarw,begin_marking,uparw,toggle_marking ^[ [ 1 ; 5 A +uparw,dnarw,begin_marking,uparw,toggle_marking ^[ [ 5 A + uparw,dnarw,begin_marking,uparw,toggle_marking ^[ O A +uparw,dnarw,begin_marking,uparw,toggle_marking ^[ O a +dnarw,uparw,begin_marking,dnarw,toggle_marking ^[ [ 1 ; 5 B +dnarw,uparw,begin_marking,dnarw,toggle_marking ^[ [ 5 B + dnarw,uparw,begin_marking,dnarw,toggle_marking ^[ O B +dnarw,uparw,begin_marking,dnarw,toggle_marking ^[ O b + +blkdel,nmark ^[ [ 3 ; 5 - +blkdel,nmark ^[ [ 3 ; 5 ~ + +yank ^[ [ 2 ; 5 - +yank ^[ [ 2 ; 5 ~ +delbol ^[ o +delbol ^[ ^O +dnslide ^[ z +dnslide ^[ Z +dnslide ^[ ^Z +dnslide,dnslide,dnslide,dnslide MWDOWN +compile ^[ c +compile ^[ C +compile ^[ ^C +grep_find ^[ g +grep_find ^[ G +grep_find ^[ ^G +execmd ^[ x +execmd ^[ X +execmd ^[ ^X +finish ^[ ^I +finish ^[ ^M +mwind!,mfit,jump,bol ^[ SP +isrch ^[ s +isrch ^[ S +isrch ^[ ^S +isrch ^S +notmod ^[ ~ +mwind,mfit,prevw,nxterr ^[ = +parserr ^[ e +parserr ^[ E +parserr ^[ ^E +mwind,mfit,prevw,prverr ^[ - +rsrch ^[ r +rsrch ^[ R +rsrch ^[ ^R +retype,rsrch ^R +run ^[ ! +tomarkb ^[ b +tomarkb ^[ ^B +tomarkk ^[ k +tomarkk ^[ ^K +tomarkk ^[ K +txt ^[ i +txt ^[ I +upslide ^[ w +upslide ^[ ^W +upslide ^[ W +upslide,upslide,upslide,upslide MWUP +yank ^[ y +yankpop ^[ ^Y +yank ^[ Y +insc ^@ + bufed ^[ d +nbuf ^[ v +nbuf ^[ V +nbuf ^[ ^V +pbuf ^[ u +pbuf ^[ U +pbuf ^[ ^U + query ^[ q + byte ^[ n + col ^[ c + abortbuf ^[ k + ask ^[ a + bop ^[ p + bos ^[ x + copy ^[ ^W + dupw ^[ \ + eop ^[ n + format ^[ j + markl ^[ l + nmark ^[ @ + pop ^[ > + psh ^[ < + swap ^[ x + tomarkbk ^[ g + tos ^[ e + tw0 ^[ 0 + tw1 ^[ 1 + uarg ^[ u + yank ^[ ^Y + yapp ^[ w +quote8 ^\ + quote ` +quote ^[ ' +quote ^Q +backs ^? +backs ^H +backw ^O +bknd ^K ' +blkcpy ^K C +blkcpy ^K ^C +blkcpy ^K c +blkdel ^K Y +blkdel ^K ^Y +blkdel ^K y +blkmove ^K M +blkmove ^K ^M +blkmove ^K m +blksave ^K W +blksave ^K ^W +blksave ^K w +bof ^K U +bof ^K ^U +bof ^K u + bol .kh + bol ^A + bol ^# SP A +home .kh +home ^A +center ^K A +center ^K ^A +center ^K a +crawll ^K < +crawll ^[ < +crawlr ^K > +crawlr ^[ > +delch .kD +delch ^D +deleol ^J +dellin ^Y +delw ^W +dnarw .kd +dnarw ^N +dnarw ^[ O B +dnarw ^[ [ B + dnarw ^# B +edit ^K E +edit ^K ^E +edit ^K e +eof ^K V +eof ^K ^V +eof ^K v +eol .kH +eol .@7 +eol ^E +exsave ^K X +exsave ^K ^X +exsave ^K x +ffirst ^K F +ffirst ^K ^F +ffirst ^K f +filt ^K / + finish ^K ^M +fnext ^L +fmtblk ^K J +fmtblk ^K ^J +fmtblk ^K j +gomark ^[ 0 TO 9 +groww ^K G +groww ^K ^G +groww ^K g +insc .kI + insc ^@ +insf ^K R +insf ^K ^R +insf ^K r +lindent ^K , +line ^K L +line ^K ^L +line ^K l +ltarw .kl +ltarw ^B +ltarw ^[ O D +ltarw ^[ [ D + ltarw ^# D +macros ^[ d +macros ^[ ^D +markb ^K B +markb ^K ^B +markb ^K b +markk ^K K +markk ^K ^K +markk ^K k + mode ^T +menu,"root",rtn ^T +nextpos ^K = +nextword ^X +open ^] +prevpos ^K - +prevword ^Z +reload ^K ` +redo ^^ +rindent ^K . +rtarw .kr +rtarw ^F +rtarw ^[ O C +rtarw ^[ [ C + rtarw ^# C +run ^K ! +save ^K D +save ^K S +save ^K ^D +save ^K ^S +save ^K d +save ^K s +setmark ^[ ^[ +shrinkw ^K T +shrinkw ^K ^T +shrinkw ^K t +splitw ^K O +splitw ^K ^O +splitw ^K o +stat ^K SP +stat ^K ^@ +tag ^K ; +tomatch ^G +undo ^_ +uparw .ku + uparw ^# A +uparw ^P +uparw ^[ O A +uparw ^[ [ A +shell1 ^[ [ 1 1 ~ +shell1 ^[ O P +shell1 ^[ [ [ A +shell1 .k1 +shell2 ^[ [ 1 2 ~ +shell2 ^[ O Q +shell2 ^[ [ [ B +shell2 .k2 +shell3 ^[ [ 1 3 ~ +shell3 ^[ O R +shell3 ^[ [ [ C +shell3 .k3 +shell4 ^[ [ 1 4 ~ +shell4 ^[ O S +shell4 ^[ [ [ D +shell4 .k4 + +:prompt Prompt windows +:inherit main +if,"byte>size",then,complete,complete,else,delch,endif ^D +complete ^I +dnarw,eol .kd +dnarw,eol ^N +dnarw,eol ^[ O B +dnarw,eol ^[ [ B + dnarw,eol ^# B +uparw,eol .ku + uparw,eol ^# A +uparw,eol ^P +uparw,eol ^[ O A +uparw,eol ^[ [ A + +:menu Selection menus +:inherit windows + +pgupmenu ^[ [ I +pgdnmenu ^[ [ G +bolmenu ^[ [ 1 ~ +bolmenu ^[ [ H +bolmenu ^[ O H +bolmenu ^[ [ 7 ~ + bolmenu ^# SP A +eolmenu ^[ [ 4 ~ +eolmenu ^[ [ F +eolmenu ^[ O F +eolmenu ^[ [ 8 ~ + eolmenu ^# SP @ +abort ^[ ^[ +backsmenu ^? +backsmenu ^H +bofmenu ^K U +bofmenu ^K ^U +bofmenu ^K u +bolmenu .kh +bolmenu ^A +dnarwmenu .kd +dnarwmenu ^N +dnarwmenu ^[ [ B +dnarwmenu ^[ O B + dnarwmenu ^# B +dnarwmenu MWDOWN +eofmenu ^K V +eofmenu ^K ^V +eofmenu ^K v +eolmenu .kH +eolmenu ^E +ltarwmenu .kl +ltarwmenu ^B +ltarwmenu ^[ [ D +ltarwmenu ^[ O D + ltarwmenu ^# D +pgdnmenu .kN +pgdnmenu ^V +pgdnmenu ^[ [ 6 ~ + pgdnmenu ^# S +pgupmenu .kP +pgupmenu ^U +pgupmenu ^[ [ 5 ~ + pgupmenu ^# T +rtarwmenu .kr +rtarwmenu ^F +rtarwmenu ^[ [ C + rtarwmenu ^# C +rtarwmenu ^[ O C +rtn SP +rtn ^I +rtn ^K H +rtn ^K h +rtn ^K ^H +tabmenu ^I +uparwmenu .ku +uparwmenu ^P +uparwmenu ^[ [ A +uparwmenu ^[ O A + uparwmenu ^# A +uparwmenu MWUP +defm2down M2DOWN + +:query Single-key query window +:inherit windows + +:querya Single-key query window for quoting +type U+0 TO U+10FFFF + +:querysr Search & replace query window +type U+0 TO U+10FFFF + +:shell Input to shell windows +:inherit main +"" ^C +"" ^D +" " ^I +"" ^H +" " ^M +"" ^? + +:vtshell Input to ANSI shell windows +:inherit main +""  [ A +"" .ku +""  [ B +"" .kd +""  [ C +"" .kr +""  [ D +"" .kl +"" ^A +"" ^C +"" ^D +"" ^E +" " ^I +"" ^H +" " ^M +"" ^? diff --git a/utils/klish/Makefile b/utils/klish/Makefile new file mode 100644 index 0000000..4374e27 --- /dev/null +++ b/utils/klish/Makefile @@ -0,0 +1,91 @@ + +# +# Copyright (C) 2016 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:=klish +PKG_VERSION:=2.1.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=http://libcode.org/attachments/download/66/ +PKG_LICENSE:=BSD-3-Clause +PKG_LICENSE_FILES:=LICENCE +PKG_MAINTAINER:=Takashi Umeno +PKG_MD5SUM:=7dfe46d474c02c86946c1d7a461ae549 + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/klish/default + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Shells + TITLE:=Kommand Line Interface SHell ($(1)) + URL:=http://libcode.org/projects/klish/ +endef + +define Package/klish +$(call Package/klish/default,main tool) + DEPENDS:=+libstdcpp +libxml2 +endef + +define Package/klish/description + The klish is a framework for implementing a CISCO-like CLI on a UNIX + systems. It is configurable by XML files. The KLISH stands for Kommand + Line Interface Shell. + The klish is a fork of clish 0.7.3 developed by Graeme McKerrell. + It defines new features but it's compatible (as much as possible) with + clish's XML configuration files. + klish is able to run using clish XML configuration files although + current clish users may expect some changes in behavior. + Konf and konfd are klish utilities that are used to store configuration + informations in a way which is similar to what's found on CISCO devices. + More information about these tools is to be found on the klish web site. +endef + +define Build/Configure + $(call Build/Configure/Default, \ + --with-libxml2 \ + ) +endef + +define Package/klish/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/clish $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/konf $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/konfd $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sigexec $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,klish)) + +define Package/klish-xml-files + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=klish + TITLE:=klish sample XML files + URL:=http://code.google.com/p/klish/ +endef + +define Package/klish-xml-files/description + This is a set of sample XML files for klish. +endef + +define Package/klish-xml-files/install + $(INSTALL_DIR) $(1)/etc/clish + $(CP) $(PKG_BUILD_DIR)/xml-examples/clish $(1)/etc/clish/ + $(CP) $(PKG_BUILD_DIR)/xml-examples/klish $(1)/etc/clish/ + $(CP) $(PKG_BUILD_DIR)/xml-examples/lua $(1)/etc/clish/ + $(CP) $(PKG_BUILD_DIR)/xml-examples/test $(1)/etc/clish/ +endef + +$(eval $(call BuildPackage,klish-xml-files)) diff --git a/utils/klish/patches/010-shell_execute_fix.patch b/utils/klish/patches/010-shell_execute_fix.patch new file mode 100644 index 0000000..c9ea8c1 --- /dev/null +++ b/utils/klish/patches/010-shell_execute_fix.patch @@ -0,0 +1,16 @@ +--- a/clish/shell/shell_execute.c ++++ b/clish/shell/shell_execute.c +@@ -19,13 +19,6 @@ + #include + #include + +-/* Empty signal handler to ignore signal but don't use SIG_IGN. */ +-static void sigignore(int signo) +-{ +- signo = signo; /* Happy compiler */ +- return; +-} +- + /*-------------------------------------------------------- */ + static int clish_shell_lock(const char *lock_path) + { diff --git a/utils/kmod/Makefile b/utils/kmod/Makefile new file mode 100644 index 0000000..96769aa --- /dev/null +++ b/utils/kmod/Makefile @@ -0,0 +1,93 @@ +# +# Copyright (C) 2015 Jeff Waugh +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=kmod +PKG_VERSION:=20 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=https://www.kernel.org/pub/linux/utils/kernel/kmod/ +PKG_MD5SUM:=d6f4fef718a50bd88080de6a43bc64d8 +PKG_MAINTAINER:=Jeff Waugh +PKG_LICENSE:=LGPL-2.1+ +PKG_LICENSE_FILES:=COPYING +PKG_FIXUP:=autoreconf + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +CONFIGURE_ARGS += --with-zlib + +define Package/kmod/Default + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Linux kernel module handling + URL:=https://www.kernel.org/pub/linux/utils/kernel/kmod/ + DEPENDS:=+zlib +endef + + +define Package/kmod +$(call Package/kmod/Default) + TITLE+= (tools) +endef + +define Package/kmod/description +Linux kernel module handling + kmod is a set of tools to handle common tasks with Linux kernel modules like + insert, remove, list, check properties, resolve dependencies and aliases. +endef + +LEGACY_BINARIES:= \ + depmod \ + insmod \ + lsmod \ + modinfo \ + modprobe \ + rmmod + +define Package/kmod/install + $(INSTALL_DIR) $(1)/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/kmod $(1)/sbin + + for b in $(LEGACY_BINARIES); do \ + ln -sf kmod $(1)/sbin/$$$$b ; \ + done +endef + + +define Package/libkmod +$(call Package/kmod/Default) + SECTION:=libs + CATEGORY:=Libraries + TITLE+= (library) +endef + +define Package/libkmod/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libkmod.so.* $(1)/usr/lib/ +endef + + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include $(1)/usr/ + + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libkmod.{so*,la} $(1)/usr/lib/ + + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libkmod.pc $(1)/usr/lib/pkgconfig/ +endef + + +$(eval $(call BuildPackage,kmod)) +$(eval $(call BuildPackage,libkmod)) diff --git a/utils/kmod/patches/001-fix_pkgconfig_file.patch b/utils/kmod/patches/001-fix_pkgconfig_file.patch new file mode 100644 index 0000000..1891078 --- /dev/null +++ b/utils/kmod/patches/001-fix_pkgconfig_file.patch @@ -0,0 +1,22 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -35,9 +35,6 @@ SED_PROCESS = \ + -e 's,@zlib_LIBS\@,${zlib_LIBS},g' \ + < $< > $@ || rm $@ + +-%.pc: %.pc.in Makefile +- $(SED_PROCESS) +- + LIBKMOD_CURRENT=4 + LIBKMOD_REVISION=9 + LIBKMOD_AGE=2 +--- a/configure.ac ++++ b/configure.ac +@@ -221,6 +221,7 @@ AC_CONFIG_HEADERS(config.h) + AC_CONFIG_FILES([ + Makefile + man/Makefile ++ libkmod/libkmod.pc + libkmod/docs/Makefile + libkmod/docs/version.xml + ]) diff --git a/utils/lcd4linux/Config.in b/utils/lcd4linux/Config.in new file mode 100644 index 0000000..1410f2b --- /dev/null +++ b/utils/lcd4linux/Config.in @@ -0,0 +1,490 @@ +if PACKAGE_lcd4linux-custom + +config LCD4LINUX_CUSTOM_NEEDS_libdbus + bool + +#config LCD4LINUX_CUSTOM_NEEDS_libftdi +# bool + +config LCD4LINUX_CUSTOM_NEEDS_libgd + bool + +config LCD4LINUX_CUSTOM_NEEDS_libiconv + bool + +config LCD4LINUX_CUSTOM_NEEDS_libjpeg + bool + +config LCD4LINUX_CUSTOM_NEEDS_libmpdclient + bool + +config LCD4LINUX_CUSTOM_NEEDS_libmysqlclient + bool + +config LCD4LINUX_CUSTOM_NEEDS_libncurses + bool + +config LCD4LINUX_CUSTOM_NEEDS_libnmeap + bool + +config LCD4LINUX_CUSTOM_NEEDS_libsqlite3 + bool + +config LCD4LINUX_CUSTOM_NEEDS_libusb + bool + +#config LCD4LINUX_CUSTOM_NEEDS_libX11 +# bool + +config LCD4LINUX_CUSTOM_NEEDS_ppp + bool + +config LCD4LINUX_CUSTOM_NEEDS_python + bool + + +comment "Drivers ---" + +config LCD4LINUX_CUSTOM_DRIVER_ASTUSB + bool + prompt "ASTUSB" + +config LCD4LINUX_CUSTOM_DRIVER_BeckmannEgle + bool + prompt "BeckmannEgle" + +config LCD4LINUX_CUSTOM_DRIVER_BWCT + bool + prompt "BWCT" + select LCD4LINUX_CUSTOM_NEEDS_libusb + +config LCD4LINUX_CUSTOM_DRIVER_CrystalFontz + bool + prompt "CrystalFontz" + +config LCD4LINUX_CUSTOM_DRIVER_Curses + bool + prompt "Curses" + select LCD4LINUX_CUSTOM_NEEDS_libncurses + +config LCD4LINUX_CUSTOM_DRIVER_Cwlinux + bool + prompt "Cwlinux" + +config LCD4LINUX_CUSTOM_DRIVER_D4D + bool + prompt "D4D" + select LCD4LINUX_CUSTOM_NEEDS_libgd + +config LCD4LINUX_CUSTOM_DRIVER_dpf + bool + prompt "dpf" + select LCD4LINUX_CUSTOM_NEEDS_libusb + select LCD4LINUX_CUSTOM_NEEDS_libgd + +config LCD4LINUX_CUSTOM_DRIVER_EA232graphic + bool + prompt "EA232graphic" + select LCD4LINUX_CUSTOM_NEEDS_libgd + +config LCD4LINUX_CUSTOM_DRIVER_EFN + bool + prompt "EFN" + +config LCD4LINUX_CUSTOM_DRIVER_FutabaVFD + bool + prompt "FutabaVFD" + +config LCD4LINUX_CUSTOM_DRIVER_FW8888 + bool + prompt "FW8888" + +config LCD4LINUX_CUSTOM_DRIVER_G15 + bool + prompt "G15" + select LCD4LINUX_CUSTOM_NEEDS_libgd + select LCD4LINUX_CUSTOM_NEEDS_libusb + +config LCD4LINUX_CUSTOM_DRIVER_GLCD2USB + bool + prompt "GLCD2USB" + select LCD4LINUX_CUSTOM_NEEDS_libgd + select LCD4LINUX_CUSTOM_NEEDS_libusb + +config LCD4LINUX_CUSTOM_DRIVER_HD44780 + bool + prompt "HD44780" + depends on BROKEN + +config LCD4LINUX_CUSTOM_DRIVER_HD44780-I2C + bool + prompt "HD44780-I2C" + depends on BROKEN + +config LCD4LINUX_CUSTOM_DRIVER_IRLCD + bool + prompt "IRLCD" + select LCD4LINUX_CUSTOM_NEEDS_libusb + +config LCD4LINUX_CUSTOM_DRIVER_LCD2USB + bool + prompt "LCD2USB" + select LCD4LINUX_CUSTOM_NEEDS_libgd + select LCD4LINUX_CUSTOM_NEEDS_libusb + +config LCD4LINUX_CUSTOM_DRIVER_LCDLinux + bool + prompt "LCDLinux" + depends on BROKEN + +config LCD4LINUX_CUSTOM_DRIVER_LCDTerm + bool + prompt "LCDTerm" + +config LCD4LINUX_CUSTOM_DRIVER_LEDMatrix + bool + prompt "LEDMatrix" + select LCD4LINUX_CUSTOM_NEEDS_libgd + +config LCD4LINUX_CUSTOM_DRIVER_LPH7508 + bool + prompt "LPH7508" + select LCD4LINUX_CUSTOM_NEEDS_libgd + +config LCD4LINUX_CUSTOM_DRIVER_LUIse + bool + prompt "LUIse" + select LCD4LINUX_CUSTOM_NEEDS_libgd + #select LCD4LINUX_CUSTOM_NEEDS_libluise + depends on BROKEN + +config LCD4LINUX_CUSTOM_DRIVER_LW_ABP + bool + prompt "LW_ABP" + +config LCD4LINUX_CUSTOM_DRIVER_M50530 + bool + prompt "M50530" + +config LCD4LINUX_CUSTOM_DRIVER_MatrixOrbital + bool + prompt "MatrixOrbital" + +config LCD4LINUX_CUSTOM_DRIVER_MatrixOrbitalGX + bool + prompt "MatrixOrbitalGX" + select LCD4LINUX_CUSTOM_NEEDS_libgd + select LCD4LINUX_CUSTOM_NEEDS_libusb + +config LCD4LINUX_CUSTOM_DRIVER_mdm166a + bool + prompt "mdm166a" + select LCD4LINUX_CUSTOM_NEEDS_libgd + +config LCD4LINUX_CUSTOM_DRIVER_MilfordInstruments + bool + prompt "MilfordInstruments" + +config LCD4LINUX_CUSTOM_DRIVER_Newhaven + bool + prompt "Newhaven" + +config LCD4LINUX_CUSTOM_DRIVER_Noritake + bool + prompt "Noritake" + select LCD4LINUX_CUSTOM_NEEDS_libgd + +config LCD4LINUX_CUSTOM_DRIVER_NULL + bool + prompt "NULL" + default y + +config LCD4LINUX_CUSTOM_DRIVER_Pertelian + bool + prompt "Pertelian" + +config LCD4LINUX_CUSTOM_DRIVER_PHAnderson + bool + prompt "PHAnderson" + +config LCD4LINUX_CUSTOM_DRIVER_PICGraphic + bool + prompt "PICGraphic" + select LCD4LINUX_CUSTOM_NEEDS_libgd + +config LCD4LINUX_CUSTOM_DRIVER_picoLCD + bool + prompt "picoLCD" + select LCD4LINUX_CUSTOM_NEEDS_libusb + +config LCD4LINUX_CUSTOM_DRIVER_picoLCDGraphic + bool + prompt "picoLCDGraphic" + select LCD4LINUX_CUSTOM_NEEDS_libgd + select LCD4LINUX_CUSTOM_NEEDS_libusb + +config LCD4LINUX_CUSTOM_DRIVER_PNG + bool + prompt "PNG" + select LCD4LINUX_CUSTOM_NEEDS_libgd + +config LCD4LINUX_CUSTOM_DRIVER_PPM + bool + prompt "PPM" + select LCD4LINUX_CUSTOM_NEEDS_libgd + +config LCD4LINUX_CUSTOM_DRIVER_RouterBoard + bool + prompt "RouterBoard" + depends on TARGET_rb532 + +config LCD4LINUX_CUSTOM_DRIVER_SamsungSPF + bool + prompt "SamsungSPF" + select LCD4LINUX_CUSTOM_NEEDS_libgd + select LCD4LINUX_CUSTOM_NEEDS_libjpeg + +config LCD4LINUX_CUSTOM_DRIVER_serdisplib + bool + prompt "serdisplib" + select LCD4LINUX_CUSTOM_NEEDS_libgd + select LCD4LINUX_CUSTOM_NEEDS_serdisplib + +config LCD4LINUX_CUSTOM_DRIVER_ShuttleVFD + bool + prompt "ShuttleVFD" + select LCD4LINUX_CUSTOM_NEEDS_libusb + +config LCD4LINUX_CUSTOM_DRIVER_SimpleLCD + bool + prompt "SimpleLCD" + +config LCD4LINUX_CUSTOM_DRIVER_st2205 + bool + prompt "st2205" + select LCD4LINUX_CUSTOM_NEEDS_libgd + select LCD4LINUX_CUSTOM_NEEDS_st2205tool + +config LCD4LINUX_CUSTOM_DRIVER_T6963 + bool + prompt "T6963" + select LCD4LINUX_CUSTOM_NEEDS_libgd + +config LCD4LINUX_CUSTOM_DRIVER_TeakLCM + bool + prompt "TeakLCM" + +config LCD4LINUX_CUSTOM_DRIVER_TEW673GRU + bool + select LCD4LINUX_CUSTOM_NEEDS_libgd + depends on TARGET_ar71xx + default TARGET_ar71xx + +config LCD4LINUX_CUSTOM_DRIVER_Trefon + bool + prompt "Trefon" + select LCD4LINUX_CUSTOM_NEEDS_libusb + +#config LCD4LINUX_CUSTOM_DRIVER_ULA200 +# bool +# prompt "ULA200" +# select LCD4LINUX_CUSTOM_NEEDS_libftdi +# select LCD4LINUX_CUSTOM_NEEDS_libusb + +config LCD4LINUX_CUSTOM_DRIVER_USBHUB + bool + prompt "USBHUB" + select LCD4LINUX_CUSTOM_NEEDS_libusb + +config LCD4LINUX_CUSTOM_DRIVER_USBLCD + bool + prompt "USBLCD" + select LCD4LINUX_CUSTOM_NEEDS_libusb + +config LCD4LINUX_CUSTOM_DRIVER_VNC + bool + prompt "VNC" + select LCD4LINUX_CUSTOM_NEEDS_libgd + select LCD4LINUX_CUSTOM_NEEDS_libvncserver + +config LCD4LINUX_CUSTOM_DRIVER_WincorNixdorf + bool + prompt "WincorNixdorf" + +#config LCD4LINUX_CUSTOM_DRIVER_X11 +# bool +# prompt "X11" +# select LCD4LINUX_CUSTOM_NEEDS_libgd +# select LCD4LINUX_CUSTOM_NEEDS_libX11 + + +comment "Plugins ---" + +config LCD4LINUX_CUSTOM_PLUGIN_apm + bool + prompt "apm" + +config LCD4LINUX_CUSTOM_PLUGIN_asterisk + bool + prompt "asterisk" + +config LCD4LINUX_CUSTOM_PLUGIN_button_exec + bool + prompt "button_exec" + +config LCD4LINUX_CUSTOM_PLUGIN_cpuinfo + bool + prompt "cpuinfo" + default y + +config LCD4LINUX_CUSTOM_PLUGIN_dbus + bool + prompt "dbus" + select LCD4LINUX_CUSTOM_NEEDS_libdbus + +config LCD4LINUX_CUSTOM_PLUGIN_diskstats + bool + prompt "diskstats" + +config LCD4LINUX_CUSTOM_PLUGIN_dvb + bool + prompt "dvb" + +config LCD4LINUX_CUSTOM_PLUGIN_event + bool + prompt "event" + +config LCD4LINUX_CUSTOM_PLUGIN_exec + bool + prompt "exec" + +config LCD4LINUX_CUSTOM_PLUGIN_fifo + bool + prompt "fifo" + +config LCD4LINUX_CUSTOM_PLUGIN_file + bool + prompt "file" + +config LCD4LINUX_CUSTOM_PLUGIN_gps + bool + prompt "gps" + select LCD4LINUX_CUSTOM_NEEDS_libnmeap + +config LCD4LINUX_CUSTOM_PLUGIN_hddtemp + bool + prompt "hddtemp" + +config LCD4LINUX_CUSTOM_PLUGIN_huawei + bool + prompt "huawei" + +config LCD4LINUX_CUSTOM_PLUGIN_i2c_sensors + bool + prompt "i2c_sensors" + +config LCD4LINUX_CUSTOM_PLUGIN_iconv + bool + prompt "iconv" + select LCD4LINUX_CUSTOM_NEEDS_libiconv + +config LCD4LINUX_CUSTOM_PLUGIN_imon + bool + prompt "imon" + +config LCD4LINUX_CUSTOM_PLUGIN_isdn + bool + prompt "isdn" + +config LCD4LINUX_CUSTOM_PLUGIN_kvv + bool + prompt "kvv" + +config LCD4LINUX_CUSTOM_PLUGIN_loadavg + bool + prompt "loadavg" + default y + +config LCD4LINUX_CUSTOM_PLUGIN_meminfo + bool + prompt "meminfo" + default y + +config LCD4LINUX_CUSTOM_PLUGIN_mpd + bool + prompt "mpd" + select LCD4LINUX_CUSTOM_NEEDS_libmpdclient + +config LCD4LINUX_CUSTOM_PLUGIN_mpris_dbus + bool + prompt "mpris_dbus" + select LCD4LINUX_CUSTOM_NEEDS_libdbus + +config LCD4LINUX_CUSTOM_PLUGIN_mysql + bool + prompt "mysql" + select LCD4LINUX_CUSTOM_NEEDS_libmysqlclient + +config LCD4LINUX_CUSTOM_PLUGIN_netdev + bool + prompt "netdev" + +config LCD4LINUX_CUSTOM_PLUGIN_netinfo + bool + prompt "netinfo" + +config LCD4LINUX_CUSTOM_PLUGIN_pop3 + bool + prompt "pop3" + +config LCD4LINUX_CUSTOM_PLUGIN_ppp + bool + prompt "ppp" + select LCD4LINUX_CUSTOM_NEEDS_ppp + +config LCD4LINUX_CUSTOM_PLUGIN_proc_stat + bool + prompt "proc_stat" + default y + +#config LCD4LINUX_CUSTOM_PLUGIN_python +# bool +# prompt "python" +# select LCD4LINUX_CUSTOM_NEEDS_python + +config LCD4LINUX_CUSTOM_PLUGIN_qnaplog + bool + prompt "qnaplog" + select LCD4LINUX_CUSTOM_NEEDS_libsqlite3 + +config LCD4LINUX_CUSTOM_PLUGIN_seti + bool + prompt "seti" + +config LCD4LINUX_CUSTOM_PLUGIN_statfs + bool + prompt "statfs" + +config LCD4LINUX_CUSTOM_PLUGIN_uname + bool + prompt "uname" + +config LCD4LINUX_CUSTOM_PLUGIN_uptime + bool + prompt "uptime" + default y + +config LCD4LINUX_CUSTOM_PLUGIN_w1retap + bool + prompt "w1retap" + +config LCD4LINUX_CUSTOM_PLUGIN_wireless + bool + prompt "wireless" + depends on BROKEN + +config LCD4LINUX_CUSTOM_PLUGIN_xmms + bool + prompt "xmms" + +endif diff --git a/utils/lcd4linux/Makefile b/utils/lcd4linux/Makefile new file mode 100644 index 0000000..cbb8c91 --- /dev/null +++ b/utils/lcd4linux/Makefile @@ -0,0 +1,309 @@ +# +# Copyright (C) 2007-2015 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:=lcd4linux +PKG_REV:=1203 +PKG_VERSION:=r$(PKG_REV) +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=https://ssl.bulix.org/svn/lcd4linux/trunk/ +PKG_SOURCE_SUBDIR:=lcd4linux-$(PKG_VERSION) +PKG_SOURCE_VERSION:=$(PKG_REV) +PKG_SOURCE_PROTO:=svn + +LCD4LINUX_DRIVERS:= \ + ASTUSB \ + BeckmannEgle \ + BWCT \ + CrystalFontz \ + Curses \ + Cwlinux \ + D4D \ + DPF \ + EA232graphic \ + EFN \ + FutabaVFD \ + FW8888 \ + G15 \ + GLCD2USB \ + IRLCD \ + $(if $(CONFIG_BROKEN),HD44780) \ + $(if $(CONFIG_BROKEN),HD44780-I2C) \ + LCD2USB \ + $(if $(CONFIG_BROKEN),LCDLinux) \ + LCDTerm \ + LEDMatrix \ + LPH7508 \ + $(if $(CONFIG_BROKEN),LUIse) \ + LW_ABP \ + M50530 \ + MatrixOrbital \ + MatrixOrbitalGX \ + MilfordInstruments \ + Newhaven \ + Noritake \ + NULL \ + Pertelian \ + PHAnderson \ + PICGraphic \ + picoLCD \ + picoLCDGraphic \ + PNG \ + PPM \ + $(if $(CONFIG_TARGET_rb532),RouterBoard) \ + $(if $(CONFIG_BROKEN),SamsungSPF) \ + ShuttleVFD \ + SimpleLCD \ + st2205 \ + T6963 \ + TeakLCM \ + $(if $(CONFIG_TARGET_ar71xx),TEW673GRU) \ + Trefon \ + USBHUB \ + USBLCD \ + VNC \ + WincorNixdorf \ +# ULA200 \ +# X11 \ + +LCD4LINUX_PLUGINS:= \ + apm \ + asterisk \ + button_exec \ + cpuinfo \ + dbus \ + diskstats \ + dvb \ + event \ + exec \ + fifo \ + file \ + gps \ + hddtemp \ + huawei \ + i2c_sensors \ + iconv \ + imon \ + isdn \ + kvv \ + loadavg \ + netdev \ + netinfo \ + meminfo \ + mpd \ + mpris_dbus \ + mysql \ + netdev \ + pop3 \ + ppp \ + proc_stat \ + qnaplog \ + seti \ + statfs \ + uname \ + uptime \ + w1retap \ + $(if $(CONFIG_BROKEN),wireless) \ + xmms \ +# python \ + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +PKG_BUILD_DEPENDS:= \ + libdbus \ + libgd \ + libmpdclient \ + libmysqlclient \ + libncurses \ + libnmeap \ + libsqlite3 \ + ppp \ +# libftdi \ +# libX11 \ +# python \ + +PKG_CONFIG_DEPENDS:= \ + $(patsubst %,CONFIG_LCD4LINUX_CUSTOM_DRIVER_%,$(LCD4LINUX_DRIVERS)) \ + $(patsubst %,CONFIG_LCD4LINUX_CUSTOM_PLUGIN_%,$(LCD4LINUX_PLUGINS)) \ + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/lcd4linux/Default + SECTION:=utils + CATEGORY:=Utilities + PKG_MAINTAINER:=Jonathan McCrohan + TITLE:=LCD display utility + URL:=http://lcd4linux.bulix.org/ +endef + +define Package/lcd4linux/Default/description + LCD4Linux is a small program that grabs information from the kernel and + some subsystems and displays it on an external liquid crystal display. +endef + + +define Package/lcd4linux-custom +$(call Package/lcd4linux/Default) + DEPENDS:= \ + +LCD4LINUX_CUSTOM_NEEDS_libdbus:libdbus \ + +LCD4LINUX_CUSTOM_NEEDS_libgd:libgd \ + $(if $(ICONV_FULL),+LCD4LINUX_CUSTOM_NEEDS_libiconv:libiconv-full) \ + +LCD4LINUX_CUSTOM_NEEDS_libjpeg:libjpeg \ + +LCD4LINUX_CUSTOM_NEEDS_libmpdclient:libmpdclient \ + +LCD4LINUX_CUSTOM_NEEDS_libmysqlclient:libmysqlclient \ + +LCD4LINUX_CUSTOM_NEEDS_libncurses:libncurses \ + +LCD4LINUX_CUSTOM_NEEDS_libsqlite3:libsqlite3 \ + +LCD4LINUX_CUSTOM_NEEDS_libusb:libusb-compat \ +# +LCD4LINUX_CUSTOM_NEEDS_libftdi:libftdi \ +# +LCD4LINUX_CUSTOM_NEEDS_libX11:libX11 \ +# +LCD4LINUX_CUSTOM_NEEDS_python:python + MENU:=1 + PROVIDES:=lcd4linux + VARIANT=custom +endef + +define Package/lcd4linux-custom/config + source "$(SOURCE)/Config.in" +endef + +define Package/lcd4linux-custom/description +$(call Package/lcd4linux/Default/description) + . + This package contains a customized version of LCD4Linux. +endef + + +define Package/lcd4linux-full +$(call Package/lcd4linux/Default) + DEPENDS:= @DEVEL \ + +libdbus \ + +libgd \ + $(if $(ICONV_FULL),+libiconv-full) \ + +libmpdclient \ + +libmysqlclient \ + +libncurses \ + +libsqlite3 \ + +libusb-compat \ +# +libftdi \ +# +libX11 \ +# +python + PROVIDES:=lcd4linux + VARIANT=full +endef + +define Package/lcd4linux-full/description +$(call Package/lcd4linux/Default/description) + . + This package contains a version of LCD4Linux built with all supported + drivers and plugins. +endef + + +CONFIGURE_ARGS+= \ + --disable-rpath \ + +EXTRA_LDFLAGS+= -Wl,-rpath-link,$(STAGING_DIR)/usr/lib + +ifeq ($(BUILD_VARIANT),custom) + + LCD4LINUX_CUSTOM_DRIVERS:= $(strip $(foreach c, $(LCD4LINUX_DRIVERS), \ + $(if $(CONFIG_LCD4LINUX_CUSTOM_DRIVER_$(c)),$(c),) \ + )) + ifeq ($(LCD4LINUX_CUSTOM_DRIVERS),) + LCD4LINUX_CUSTOM_DRIVERS:=Sample + endif + + LCD4LINUX_CUSTOM_PLUGINS:= $(strip $(foreach c, $(LCD4LINUX_PLUGINS), \ + $(if $(CONFIG_LCD4LINUX_CUSTOM_PLUGIN_$(c)),$(c)) \ + )) + ifeq ($(LCD4LINUX_CUSTOM_PLUGINS),) + LCD4LINUX_CUSTOM_PLUGINS:=sample + endif + + CONFIGURE_ARGS+= \ + --with-drivers="$(LCD4LINUX_CUSTOM_DRIVERS)" \ + --with-plugins="$(LCD4LINUX_CUSTOM_PLUGINS)" \ + + ifneq ($(CONFIG_LCD4LINUX_CUSTOM_NEEDS_libiconv),) + CONFIGURE_ARGS+= --with-libiconv-prefix="$(ICONV_PREFIX)" + else + CONFIGURE_ARGS+= --without-libiconv-prefix + endif + + ifneq ($(CONFIG_LCD4LINUX_CUSTOM_NEEDS_libmysqlclient),) + EXTRA_LDFLAGS+= -L$(STAGING_DIR)/usr/lib/mysql + endif + +# ifneq ($(CONFIG_LCD4LINUX_CUSTOM_NEEDS_python),) +# CONFIGURE_ARGS+= --with-python +# else + CONFIGURE_ARGS+= --without-python +# endif + +# ifneq ($(CONFIG_LCD4LINUX_CUSTOM_NEEDS_libX11),) +# CONFIGURE_ARGS+= --with-x +# else + CONFIGURE_ARGS+= --without-x +# endif + +endif + +ifeq ($(BUILD_VARIANT),full) + + LCD4LINUX_FULL_DRIVERS:= $(strip $(foreach c, $(LCD4LINUX_DRIVERS), \ + $(c) \ + )) + + LCD4LINUX_FULL_PLUGINS:= $(strip $(foreach c, $(LCD4LINUX_PLUGINS), \ + $(c) \ + )) + + CONFIGURE_ARGS+= \ + --with-drivers="$(LCD4LINUX_FULL_DRIVERS)" \ + --with-plugins="$(LCD4LINUX_FULL_PLUGINS)" \ + --with-libiconv-prefix="$(ICONV_PREFIX)" \ + --without-python \ + --without-x \ + + EXTRA_LDFLAGS+= -L$(STAGING_DIR)/usr/lib/mysql + +endif + + +define Package/lcd4linux/conffiles +/etc/lcd4linux.conf +endef + +define Package/lcd4linux/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/lcd4linux $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_BUILD_DIR)/lcd4linux.conf.sample $(1)/etc/lcd4linux.conf + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/lcd4linux.init $(1)/etc/init.d/lcd4linux + $(SED) "s|^\(Display 'GLCD2USB'\)|#\1|g" \ + -e "s|^\(Layout 'TestLayer'\)|#\1|g" \ + -e "s|^#\(Display 'Image'\)|\1|g" \ + -e "s|^#\(Layout 'Default'\)|\1|g" \ + $(1)/etc/lcd4linux.conf +endef + +Package/lcd4linux-custom/conffiles = $(Package/lcd4linux/conffiles) +Package/lcd4linux-custom/install = $(Package/lcd4linux/install) + +Package/lcd4linux-full/conffiles = $(Package/lcd4linux/conffiles) +Package/lcd4linux-full/install = $(Package/lcd4linux/install) + +$(eval $(call BuildPackage,lcd4linux-custom)) +$(eval $(call BuildPackage,lcd4linux-full)) diff --git a/utils/lcd4linux/files/lcd4linux.init b/utils/lcd4linux/files/lcd4linux.init new file mode 100644 index 0000000..25033f3 --- /dev/null +++ b/utils/lcd4linux/files/lcd4linux.init @@ -0,0 +1,15 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2007-2015 OpenWrt.org + +START=98 + +SERVICE_USE_PID=1 + +start() { + service_start /usr/bin/lcd4linux -o /tmp/lcd4linux.png -q +} + +stop() { + service_stop /usr/bin/lcd4linux +} + diff --git a/utils/lcd4linux/patches/100-drv_RouterBoard.patch b/utils/lcd4linux/patches/100-drv_RouterBoard.patch new file mode 100644 index 0000000..9780f5a --- /dev/null +++ b/utils/lcd4linux/patches/100-drv_RouterBoard.patch @@ -0,0 +1,11 @@ +--- a/drv_RouterBoard.c ++++ b/drv_RouterBoard.c +@@ -106,7 +106,7 @@ + #include + #include + #include +-#include ++#include + + #include "debug.h" + #include "cfg.h" diff --git a/utils/lcd4linux/patches/110-uclibc-logarithm-fix.patch b/utils/lcd4linux/patches/110-uclibc-logarithm-fix.patch new file mode 100644 index 0000000..8f6d861 --- /dev/null +++ b/utils/lcd4linux/patches/110-uclibc-logarithm-fix.patch @@ -0,0 +1,11 @@ +--- a/plugin_netinfo.c ++++ b/plugin_netinfo.c +@@ -264,7 +264,7 @@ static void my_netmask_short(RESULT * re + sin = get_netmask(arg1); + if (NULL != sin) { + logval = (long double) (get_netmask(arg1)->sin_addr.s_addr); +- netlen = (int) rint(log2l(logval) / log2l(2.0)); ++ netlen = (int) rint(log2f(logval) / log2f(2.0)); + qprintf(value, sizeof(value), "/%d", netlen); + } else { + qprintf(value, sizeof(value), "/?"); diff --git a/utils/lcd4linux/patches/120-remove-as-needed-linker-option.patch b/utils/lcd4linux/patches/120-remove-as-needed-linker-option.patch new file mode 100644 index 0000000..b5e56fe --- /dev/null +++ b/utils/lcd4linux/patches/120-remove-as-needed-linker-option.patch @@ -0,0 +1,11 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -18,7 +18,7 @@ ACLOCAL_AMFLAGS=-I m4 + # use this for lots of warnings + #AM_CFLAGS = -D_GNU_SOURCE -std=c99 -m64 -Wall -W -pedantic -Wno-variadic-macros -fno-strict-aliasing + +-lcd4linux_LDFLAGS ="-Wl,--as-needed" ++lcd4linux_LDFLAGS = + lcd4linux_LDADD = @DRIVERS@ @PLUGINS@ @DRVLIBS@ @PLUGINLIBS@ + lcd4linux_DEPENDENCIES = @DRIVERS@ @PLUGINS@ + diff --git a/utils/lcd4linux/patches/140-no_repnop_T6963.patch b/utils/lcd4linux/patches/140-no_repnop_T6963.patch new file mode 100644 index 0000000..85be2c3 --- /dev/null +++ b/utils/lcd4linux/patches/140-no_repnop_T6963.patch @@ -0,0 +1,22 @@ +--- a/drv_T6963.c ++++ b/drv_T6963.c +@@ -114,7 +114,9 @@ static void drv_T6_status1(void) + /* wait for STA0=1 and STA1=1 */ + n = 0; + do { ++#if 0 + rep_nop(); ++#endif + if (++n > 1000) { + debug("hang in status1"); + bug = 1; +@@ -150,7 +152,9 @@ static void drv_T6_status2(void) + /* wait for STA3=1 */ + n = 0; + do { ++#if 0 + rep_nop(); ++#endif + if (++n > 1000) { + debug("hang in status2"); + bug = 1; diff --git a/utils/lcd4linux/patches/150-addlibmpdclient.patch b/utils/lcd4linux/patches/150-addlibmpdclient.patch new file mode 100644 index 0000000..0e51f67 --- /dev/null +++ b/utils/lcd4linux/patches/150-addlibmpdclient.patch @@ -0,0 +1,2624 @@ +--- /dev/null ++++ b/libmpdclient.c +@@ -0,0 +1,1957 @@ ++/* libmpdclient ++ (c)2003-2006 by Warren Dukes (warren.dukes@gmail.com) ++ This project's homepage is: http://www.musicpd.org ++ ++ Redistribution and use in source and binary forms, with or without ++ modification, are permitted provided that the following conditions ++ are met: ++ ++ - Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ ++ - Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ ++ - Neither the name of the Music Player Daemon nor the names of its ++ contributors may be used to endorse or promote products derived from ++ this software without specific prior written permission. ++ ++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ++ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR ++ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include "libmpdclient.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#ifdef WIN32 ++# include ++# include ++#else ++# include ++# include ++# include ++# include ++#endif ++ ++/* (bits+1)/3 (plus the sign character) */ ++#define INTLEN ((sizeof(int) * CHAR_BIT + 1) / 3 + 1) ++#define LONGLONGLEN ((sizeof(long long) * CHAR_BIT + 1) / 3 + 1) ++ ++#define COMMAND_LIST 1 ++#define COMMAND_LIST_OK 2 ++ ++#ifndef MPD_NO_GAI ++# ifdef AI_ADDRCONFIG ++# define MPD_HAVE_GAI ++# endif ++#endif ++ ++#ifndef MSG_DONTWAIT ++# define MSG_DONTWAIT 0 ++#endif ++ ++#ifdef WIN32 ++# define SELECT_ERRNO_IGNORE (errno == WSAEINTR || errno == WSAEINPROGRESS) ++# define SENDRECV_ERRNO_IGNORE SELECT_ERRNO_IGNORE ++#else ++# define SELECT_ERRNO_IGNORE (errno == EINTR) ++# define SENDRECV_ERRNO_IGNORE (errno == EINTR || errno == EAGAIN) ++# define winsock_dll_error(c) 0 ++# define closesocket(s) close(s) ++# define WSACleanup() do { /* nothing */ } while (0) ++#endif ++ ++#ifdef WIN32 ++static int winsock_dll_error(mpd_Connection * connection) ++{ ++ WSADATA wsaData; ++ if ((WSAStartup(MAKEWORD(2, 2), &wsaData)) != 0 || LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) { ++ strcpy(connection->errorStr, "Could not find usable WinSock DLL."); ++ connection->error = MPD_ERROR_SYSTEM; ++ return 1; ++ } ++ return 0; ++} ++ ++static int do_connect_fail(mpd_Connection * connection, const struct sockaddr *serv_addr, int addrlen) ++{ ++ int iMode = 1; /* 0 = blocking, else non-blocking */ ++ ioctlsocket(connection->sock, FIONBIO, (u_long FAR *) & iMode); ++ return (connect(connection->sock, serv_addr, addrlen) == SOCKET_ERROR && WSAGetLastError() != WSAEWOULDBLOCK); ++} ++#else /* !WIN32 (sane operating systems) */ ++static int do_connect_fail(mpd_Connection * connection, const struct sockaddr *serv_addr, int addrlen) ++{ ++ int flags = fcntl(connection->sock, F_GETFL, 0); ++ fcntl(connection->sock, F_SETFL, flags | O_NONBLOCK); ++ return (connect(connection->sock, serv_addr, addrlen) < 0 && errno != EINPROGRESS); ++} ++#endif /* !WIN32 */ ++ ++#ifdef MPD_HAVE_GAI ++static int mpd_connect(mpd_Connection * connection, const char *host, int port, float timeout) ++{ ++ int error; ++ char service[INTLEN + 1]; ++ struct addrinfo hints; ++ struct addrinfo *res = NULL; ++ struct addrinfo *addrinfo = NULL; ++ ++ /** ++ * Setup hints ++ */ ++ hints.ai_flags = AI_ADDRCONFIG; ++ hints.ai_family = PF_UNSPEC; ++ hints.ai_socktype = SOCK_STREAM; ++ hints.ai_protocol = IPPROTO_TCP; ++ hints.ai_addrlen = 0; ++ hints.ai_addr = NULL; ++ hints.ai_canonname = NULL; ++ hints.ai_next = NULL; ++ ++ snprintf(service, sizeof(service), "%i", port); ++ ++ error = getaddrinfo(host, service, &hints, &addrinfo); ++ ++ if (error) { ++ snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, "host \"%s\" not found: %s", host, gai_strerror(error)); ++ connection->error = MPD_ERROR_UNKHOST; ++ return -1; ++ } ++ ++ for (res = addrinfo; res; res = res->ai_next) { ++ /* create socket */ ++ connection->sock = socket(res->ai_family, SOCK_STREAM, res->ai_protocol); ++ if (connection->sock < 0) { ++ snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, "problems creating socket: %s", strerror(errno)); ++ connection->error = MPD_ERROR_SYSTEM; ++ freeaddrinfo(addrinfo); ++ return -1; ++ } ++ ++ mpd_setConnectionTimeout(connection, timeout); ++ ++ /* connect stuff */ ++ if (do_connect_fail(connection, res->ai_addr, res->ai_addrlen)) { ++ /* try the next address family */ ++ closesocket(connection->sock); ++ connection->sock = -1; ++ continue; ++ } ++ } ++ ++ freeaddrinfo(addrinfo); ++ ++ if (connection->sock < 0) { ++ snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, ++ "problems connecting to \"%s\" on port %i: %s", host, port, strerror(errno)); ++ connection->error = MPD_ERROR_CONNPORT; ++ ++ return -1; ++ } ++ ++ return 0; ++} ++#else /* !MPD_HAVE_GAI */ ++static int mpd_connect(mpd_Connection * connection, const char *host, int port, float timeout) ++{ ++ struct hostent *he; ++ struct sockaddr *dest; ++ int destlen; ++ struct sockaddr_in sin; ++ ++ if (!(he = gethostbyname(host))) { ++ snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, "host \"%s\" not found", host); ++ connection->error = MPD_ERROR_UNKHOST; ++ return -1; ++ } ++ ++ memset(&sin, 0, sizeof(struct sockaddr_in)); ++ /*dest.sin_family = he->h_addrtype; */ ++ sin.sin_family = AF_INET; ++ sin.sin_port = htons(port); ++ ++ switch (he->h_addrtype) { ++ case AF_INET: ++ memcpy((char *) &sin.sin_addr.s_addr, (char *) he->h_addr, he->h_length); ++ dest = (struct sockaddr *) &sin; ++ destlen = sizeof(struct sockaddr_in); ++ break; ++ default: ++ strcpy(connection->errorStr, "address type is not IPv4"); ++ connection->error = MPD_ERROR_SYSTEM; ++ return -1; ++ break; ++ } ++ ++ if ((connection->sock = socket(dest->sa_family, SOCK_STREAM, 0)) < 0) { ++ strcpy(connection->errorStr, "problems creating socket"); ++ connection->error = MPD_ERROR_SYSTEM; ++ return -1; ++ } ++ ++ mpd_setConnectionTimeout(connection, timeout); ++ ++ /* connect stuff */ ++ if (do_connect_fail(connection, dest, destlen)) { ++ snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, ++ "problems connecting to \"%s\" on port" " %i", host, port); ++ connection->error = MPD_ERROR_CONNPORT; ++ return -1; ++ } ++ ++ return 0; ++} ++#endif /* !MPD_HAVE_GAI */ ++ ++char *mpdTagItemKeys[MPD_TAG_NUM_OF_ITEM_TYPES] = { ++ "Artist", ++ "Album", ++ "Title", ++ "Track", ++ "Name", ++ "Genre", ++ "Date", ++ "Composer", ++ "Performer", ++ "Comment", ++ "Disc", ++ "Filename", ++ "Any" ++}; ++ ++static char *mpd_sanitizeArg(const char *arg) ++{ ++ size_t i; ++ char *ret; ++ register const char *c; ++ register char *rc; ++ ++ /* instead of counting in that loop above, just ++ * use a bit more memory and half running time ++ */ ++ ret = malloc(strlen(arg) * 2 + 1); ++ ++ c = arg; ++ rc = ret; ++ for (i = strlen(arg) + 1; i != 0; --i) { ++ if (*c == '"' || *c == '\\') ++ *rc++ = '\\'; ++ *(rc++) = *(c++); ++ } ++ ++ return ret; ++} ++ ++static mpd_ReturnElement *mpd_newReturnElement(const char *name, const char *value) ++{ ++ mpd_ReturnElement *ret = malloc(sizeof(mpd_ReturnElement)); ++ ++ ret->name = strdup(name); ++ ret->value = strdup(value); ++ ++ return ret; ++} ++ ++static void mpd_freeReturnElement(mpd_ReturnElement * re) ++{ ++ free(re->name); ++ free(re->value); ++ free(re); ++} ++ ++void mpd_setConnectionTimeout(mpd_Connection * connection, float timeout) ++{ ++ connection->timeout.tv_sec = (int) timeout; ++ connection->timeout.tv_usec = (int) (timeout * 1e6 - connection->timeout.tv_sec * 1000000 + 0.5); ++} ++ ++static int mpd_parseWelcome(mpd_Connection * connection, const char *host, int port, char *rt, char *output) ++{ ++ char *tmp; ++ char *test; ++ int i; ++ ++ if (strncmp(output, MPD_WELCOME_MESSAGE, strlen(MPD_WELCOME_MESSAGE))) { ++ snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, ++ "mpd not running on port %i on host \"%s\"", port, host); ++ connection->error = MPD_ERROR_NOTMPD; ++ return 1; ++ } ++ ++ tmp = &output[strlen(MPD_WELCOME_MESSAGE)]; ++ ++ for (i = 0; i < 3; i++) { ++ if (tmp) ++ connection->version[i] = strtol(tmp, &test, 10); ++ ++ if (!tmp || (test[0] != '.' && test[0] != '\0')) { ++ snprintf(connection->errorStr, ++ MPD_ERRORSTR_MAX_LENGTH, ++ "error parsing version number at " "\"%s\"", &output[strlen(MPD_WELCOME_MESSAGE)]); ++ connection->error = MPD_ERROR_NOTMPD; ++ return 1; ++ } ++ tmp = ++test; ++ } ++ ++ return 0; ++} ++ ++mpd_Connection *mpd_newConnection(const char *host, int port, float timeout) ++{ ++ int err; ++ char *rt; ++ char *output = NULL; ++ mpd_Connection *connection = malloc(sizeof(mpd_Connection)); ++ struct timeval tv; ++ fd_set fds; ++ strcpy(connection->buffer, ""); ++ connection->buflen = 0; ++ connection->bufstart = 0; ++ strcpy(connection->errorStr, ""); ++ connection->error = 0; ++ connection->doneProcessing = 0; ++ connection->commandList = 0; ++ connection->listOks = 0; ++ connection->doneListOk = 0; ++ connection->returnElement = NULL; ++ connection->request = NULL; ++ ++ if (winsock_dll_error(connection)) ++ return connection; ++ ++ if (mpd_connect(connection, host, port, timeout) < 0) ++ return connection; ++ ++ while (!(rt = strstr(connection->buffer, "\n"))) { ++ tv.tv_sec = connection->timeout.tv_sec; ++ tv.tv_usec = connection->timeout.tv_usec; ++ FD_ZERO(&fds); ++ FD_SET(connection->sock, &fds); ++ if ((err = select(connection->sock + 1, &fds, NULL, NULL, &tv)) == 1) { ++ int readed; ++ readed = recv(connection->sock, ++ &(connection->buffer[connection->buflen]), MPD_BUFFER_MAX_LENGTH - connection->buflen, 0); ++ if (readed <= 0) { ++ snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, ++ "problems getting a response from" " \"%s\" on port %i : %s", host, port, strerror(errno)); ++ connection->error = MPD_ERROR_NORESPONSE; ++ return connection; ++ } ++ connection->buflen += readed; ++ connection->buffer[connection->buflen] = '\0'; ++ } else if (err < 0) { ++ if (SELECT_ERRNO_IGNORE) ++ continue; ++ snprintf(connection->errorStr, ++ MPD_ERRORSTR_MAX_LENGTH, "problems connecting to \"%s\" on port" " %i", host, port); ++ connection->error = MPD_ERROR_CONNPORT; ++ return connection; ++ } else { ++ snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, ++ "timeout in attempting to get a response from" " \"%s\" on port %i", host, port); ++ connection->error = MPD_ERROR_NORESPONSE; ++ return connection; ++ } ++ } ++ ++ *rt = '\0'; ++ output = strdup(connection->buffer); ++ strcpy(connection->buffer, rt + 1); ++ connection->buflen = strlen(connection->buffer); ++ ++ if (mpd_parseWelcome(connection, host, port, rt, output) == 0) ++ connection->doneProcessing = 1; ++ ++ free(output); ++ ++ return connection; ++} ++ ++void mpd_clearError(mpd_Connection * connection) ++{ ++ connection->error = 0; ++ connection->errorStr[0] = '\0'; ++} ++ ++void mpd_closeConnection(mpd_Connection * connection) ++{ ++ closesocket(connection->sock); ++ if (connection->returnElement) ++ free(connection->returnElement); ++ if (connection->request) ++ free(connection->request); ++ free(connection); ++ WSACleanup(); ++} ++ ++static void mpd_executeCommand(mpd_Connection * connection, char *command) ++{ ++ int ret; ++ struct timeval tv; ++ fd_set fds; ++ char *commandPtr = command; ++ int commandLen = strlen(command); ++ ++ if (!connection->doneProcessing && !connection->commandList) { ++ strcpy(connection->errorStr, "not done processing current command"); ++ connection->error = 1; ++ return; ++ } ++ ++ mpd_clearError(connection); ++ ++ FD_ZERO(&fds); ++ FD_SET(connection->sock, &fds); ++ tv.tv_sec = connection->timeout.tv_sec; ++ tv.tv_usec = connection->timeout.tv_usec; ++ ++ while ((ret = select(connection->sock + 1, NULL, &fds, NULL, &tv) == 1) || (ret == -1 && SELECT_ERRNO_IGNORE)) { ++ ret = send(connection->sock, commandPtr, commandLen, MSG_DONTWAIT); ++ if (ret <= 0) { ++ if (SENDRECV_ERRNO_IGNORE) ++ continue; ++ snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, "problems giving command \"%s\"", command); ++ connection->error = MPD_ERROR_SENDING; ++ return; ++ } else { ++ commandPtr += ret; ++ commandLen -= ret; ++ } ++ ++ if (commandLen <= 0) ++ break; ++ } ++ ++ if (commandLen > 0) { ++ perror(""); ++ snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, "timeout sending command \"%s\"", command); ++ connection->error = MPD_ERROR_TIMEOUT; ++ return; ++ } ++ ++ if (!connection->commandList) ++ connection->doneProcessing = 0; ++ else if (connection->commandList == COMMAND_LIST_OK) { ++ connection->listOks++; ++ } ++} ++ ++static void mpd_getNextReturnElement(mpd_Connection * connection) ++{ ++ char *output = NULL; ++ char *rt = NULL; ++ char *name = NULL; ++ char *value = NULL; ++ fd_set fds; ++ struct timeval tv; ++ char *tok = NULL; ++ int readed; ++ char *bufferCheck = NULL; ++ int err; ++ int pos; ++ ++ if (connection->returnElement) ++ mpd_freeReturnElement(connection->returnElement); ++ connection->returnElement = NULL; ++ ++ if (connection->doneProcessing || (connection->listOks && connection->doneListOk)) { ++ strcpy(connection->errorStr, "already done processing current command"); ++ connection->error = 1; ++ return; ++ } ++ ++ bufferCheck = connection->buffer + connection->bufstart; ++ while (connection->bufstart >= connection->buflen || !(rt = strchr(bufferCheck, '\n'))) { ++ if (connection->buflen >= MPD_BUFFER_MAX_LENGTH) { ++ memmove(connection->buffer, ++ connection->buffer + connection->bufstart, connection->buflen - connection->bufstart + 1); ++ connection->buflen -= connection->bufstart; ++ connection->bufstart = 0; ++ } ++ if (connection->buflen >= MPD_BUFFER_MAX_LENGTH) { ++ strcpy(connection->errorStr, "buffer overrun"); ++ connection->error = MPD_ERROR_BUFFEROVERRUN; ++ connection->doneProcessing = 1; ++ connection->doneListOk = 0; ++ return; ++ } ++ bufferCheck = connection->buffer + connection->buflen; ++ tv.tv_sec = connection->timeout.tv_sec; ++ tv.tv_usec = connection->timeout.tv_usec; ++ FD_ZERO(&fds); ++ FD_SET(connection->sock, &fds); ++ if ((err = select(connection->sock + 1, &fds, NULL, NULL, &tv) == 1)) { ++ readed = recv(connection->sock, ++ connection->buffer + connection->buflen, ++ MPD_BUFFER_MAX_LENGTH - connection->buflen, MSG_DONTWAIT); ++ if (readed < 0 && SENDRECV_ERRNO_IGNORE) { ++ continue; ++ } ++ if (readed <= 0) { ++ strcpy(connection->errorStr, "connection" " closed"); ++ connection->error = MPD_ERROR_CONNCLOSED; ++ connection->doneProcessing = 1; ++ connection->doneListOk = 0; ++ return; ++ } ++ connection->buflen += readed; ++ connection->buffer[connection->buflen] = '\0'; ++ } else if (err < 0 && SELECT_ERRNO_IGNORE) ++ continue; ++ else { ++ strcpy(connection->errorStr, "connection timeout"); ++ connection->error = MPD_ERROR_TIMEOUT; ++ connection->doneProcessing = 1; ++ connection->doneListOk = 0; ++ return; ++ } ++ } ++ ++ *rt = '\0'; ++ output = connection->buffer + connection->bufstart; ++ connection->bufstart = rt - connection->buffer + 1; ++ ++ if (strcmp(output, "OK") == 0) { ++ if (connection->listOks > 0) { ++ strcpy(connection->errorStr, "expected more list_OK's"); ++ connection->error = 1; ++ } ++ connection->listOks = 0; ++ connection->doneProcessing = 1; ++ connection->doneListOk = 0; ++ return; ++ } ++ ++ if (strcmp(output, "list_OK") == 0) { ++ if (!connection->listOks) { ++ strcpy(connection->errorStr, "got an unexpected list_OK"); ++ connection->error = 1; ++ } else { ++ connection->doneListOk = 1; ++ connection->listOks--; ++ } ++ return; ++ } ++ ++ if (strncmp(output, "ACK", strlen("ACK")) == 0) { ++ char *test; ++ char *needle; ++ int val; ++ ++ strcpy(connection->errorStr, output); ++ connection->error = MPD_ERROR_ACK; ++ connection->errorCode = MPD_ACK_ERROR_UNK; ++ connection->errorAt = MPD_ERROR_AT_UNK; ++ connection->doneProcessing = 1; ++ connection->doneListOk = 0; ++ ++ needle = strchr(output, '['); ++ if (!needle) ++ return; ++ val = strtol(needle + 1, &test, 10); ++ if (*test != '@') ++ return; ++ connection->errorCode = val; ++ val = strtol(test + 1, &test, 10); ++ if (*test != ']') ++ return; ++ connection->errorAt = val; ++ return; ++ } ++ ++ tok = strchr(output, ':'); ++ if (!tok) ++ return; ++ pos = tok - output; ++ value = ++tok; ++ name = output; ++ name[pos] = '\0'; ++ ++ if (value[0] == ' ') { ++ connection->returnElement = mpd_newReturnElement(name, &(value[1])); ++ } else { ++ snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, "error parsing: %s:%s", name, value); ++ connection->error = 1; ++ } ++} ++ ++void mpd_finishCommand(mpd_Connection * connection) ++{ ++ while (!connection->doneProcessing) { ++ if (connection->doneListOk) ++ connection->doneListOk = 0; ++ mpd_getNextReturnElement(connection); ++ } ++} ++ ++static void mpd_finishListOkCommand(mpd_Connection * connection) ++{ ++ while (!connection->doneProcessing && connection->listOks && !connection->doneListOk) { ++ mpd_getNextReturnElement(connection); ++ } ++} ++ ++int mpd_nextListOkCommand(mpd_Connection * connection) ++{ ++ mpd_finishListOkCommand(connection); ++ if (!connection->doneProcessing) ++ connection->doneListOk = 0; ++ if (connection->listOks == 0 || connection->doneProcessing) ++ return -1; ++ return 0; ++} ++ ++void mpd_sendStatusCommand(mpd_Connection * connection) ++{ ++ mpd_executeCommand(connection, "status\n"); ++} ++ ++mpd_Status *mpd_getStatus(mpd_Connection * connection) ++{ ++ mpd_Status *status; ++ ++ /*mpd_executeCommand(connection,"status\n"); ++ ++ if(connection->error) return NULL; */ ++ ++ if (connection->doneProcessing || (connection->listOks && connection->doneListOk)) { ++ return NULL; ++ } ++ ++ if (!connection->returnElement) ++ mpd_getNextReturnElement(connection); ++ ++ status = malloc(sizeof(mpd_Status)); ++ status->volume = -1; ++ status->repeat = 0; ++ status->random = 0; ++ status->playlist = -1; ++ status->playlistLength = -1; ++ status->state = -1; ++ status->song = 0; ++ status->songid = 0; ++ status->elapsedTime = 0; ++ status->totalTime = 0; ++ status->bitRate = 0; ++ status->sampleRate = 0; ++ status->bits = 0; ++ status->channels = 0; ++ status->crossfade = -1; ++ status->error = NULL; ++ status->updatingDb = 0; ++ ++ if (connection->error) { ++ free(status); ++ return NULL; ++ } ++ while (connection->returnElement) { ++ mpd_ReturnElement *re = connection->returnElement; ++ if (strcmp(re->name, "volume") == 0) { ++ status->volume = atoi(re->value); ++ } else if (strcmp(re->name, "repeat") == 0) { ++ status->repeat = atoi(re->value); ++ } else if (strcmp(re->name, "random") == 0) { ++ status->random = atoi(re->value); ++ } else if (strcmp(re->name, "playlist") == 0) { ++ status->playlist = strtol(re->value, NULL, 10); ++ } else if (strcmp(re->name, "playlistlength") == 0) { ++ status->playlistLength = atoi(re->value); ++ } else if (strcmp(re->name, "bitrate") == 0) { ++ status->bitRate = atoi(re->value); ++ } else if (strcmp(re->name, "state") == 0) { ++ if (strcmp(re->value, "play") == 0) { ++ status->state = MPD_STATUS_STATE_PLAY; ++ } else if (strcmp(re->value, "stop") == 0) { ++ status->state = MPD_STATUS_STATE_STOP; ++ } else if (strcmp(re->value, "pause") == 0) { ++ status->state = MPD_STATUS_STATE_PAUSE; ++ } else { ++ status->state = MPD_STATUS_STATE_UNKNOWN; ++ } ++ } else if (strcmp(re->name, "song") == 0) { ++ status->song = atoi(re->value); ++ } else if (strcmp(re->name, "songid") == 0) { ++ status->songid = atoi(re->value); ++ } else if (strcmp(re->name, "time") == 0) { ++ char *tok = strchr(re->value, ':'); ++ /* the second strchr below is a safety check */ ++ if (tok && (strchr(tok, 0) > (tok + 1))) { ++ /* atoi stops at the first non-[0-9] char: */ ++ status->elapsedTime = atoi(re->value); ++ status->totalTime = atoi(tok + 1); ++ } ++ } else if (strcmp(re->name, "error") == 0) { ++ status->error = strdup(re->value); ++ } else if (strcmp(re->name, "xfade") == 0) { ++ status->crossfade = atoi(re->value); ++ } else if (strcmp(re->name, "updating_db") == 0) { ++ status->updatingDb = atoi(re->value); ++ } else if (strcmp(re->name, "audio") == 0) { ++ char *tok = strchr(re->value, ':'); ++ if (tok && (strchr(tok, 0) > (tok + 1))) { ++ status->sampleRate = atoi(re->value); ++ status->bits = atoi(++tok); ++ tok = strchr(tok, ':'); ++ if (tok && (strchr(tok, 0) > (tok + 1))) ++ status->channels = atoi(tok + 1); ++ } ++ } ++ ++ mpd_getNextReturnElement(connection); ++ if (connection->error) { ++ free(status); ++ return NULL; ++ } ++ } ++ ++ if (connection->error) { ++ free(status); ++ return NULL; ++ } else if (status->state < 0) { ++ strcpy(connection->errorStr, "state not found"); ++ connection->error = 1; ++ free(status); ++ return NULL; ++ } ++ ++ return status; ++} ++ ++void mpd_freeStatus(mpd_Status * status) ++{ ++ if (status->error) ++ free(status->error); ++ free(status); ++} ++ ++void mpd_sendStatsCommand(mpd_Connection * connection) ++{ ++ mpd_executeCommand(connection, "stats\n"); ++} ++ ++mpd_Stats *mpd_getStats(mpd_Connection * connection) ++{ ++ mpd_Stats *stats; ++ ++ /*mpd_executeCommand(connection,"stats\n"); ++ ++ if(connection->error) return NULL; */ ++ ++ if (connection->doneProcessing || (connection->listOks && connection->doneListOk)) { ++ return NULL; ++ } ++ ++ if (!connection->returnElement) ++ mpd_getNextReturnElement(connection); ++ ++ stats = malloc(sizeof(mpd_Stats)); ++ stats->numberOfArtists = 0; ++ stats->numberOfAlbums = 0; ++ stats->numberOfSongs = 0; ++ stats->uptime = 0; ++ stats->dbUpdateTime = 0; ++ stats->playTime = 0; ++ stats->dbPlayTime = 0; ++ ++ if (connection->error) { ++ free(stats); ++ return NULL; ++ } ++ while (connection->returnElement) { ++ mpd_ReturnElement *re = connection->returnElement; ++ if (strcmp(re->name, "artists") == 0) { ++ stats->numberOfArtists = atoi(re->value); ++ } else if (strcmp(re->name, "albums") == 0) { ++ stats->numberOfAlbums = atoi(re->value); ++ } else if (strcmp(re->name, "songs") == 0) { ++ stats->numberOfSongs = atoi(re->value); ++ } else if (strcmp(re->name, "uptime") == 0) { ++ stats->uptime = strtol(re->value, NULL, 10); ++ } else if (strcmp(re->name, "db_update") == 0) { ++ stats->dbUpdateTime = strtol(re->value, NULL, 10); ++ } else if (strcmp(re->name, "playtime") == 0) { ++ stats->playTime = strtol(re->value, NULL, 10); ++ } else if (strcmp(re->name, "db_playtime") == 0) { ++ stats->dbPlayTime = strtol(re->value, NULL, 10); ++ } ++ ++ mpd_getNextReturnElement(connection); ++ if (connection->error) { ++ free(stats); ++ return NULL; ++ } ++ } ++ ++ if (connection->error) { ++ free(stats); ++ return NULL; ++ } ++ ++ return stats; ++} ++ ++void mpd_freeStats(mpd_Stats * stats) ++{ ++ free(stats); ++} ++ ++mpd_SearchStats *mpd_getSearchStats(mpd_Connection * connection) ++{ ++ mpd_SearchStats *stats; ++ mpd_ReturnElement *re; ++ ++ if (connection->doneProcessing || (connection->listOks && connection->doneListOk)) { ++ return NULL; ++ } ++ ++ if (!connection->returnElement) ++ mpd_getNextReturnElement(connection); ++ ++ if (connection->error) ++ return NULL; ++ ++ stats = malloc(sizeof(mpd_SearchStats)); ++ stats->numberOfSongs = 0; ++ stats->playTime = 0; ++ ++ while (connection->returnElement) { ++ re = connection->returnElement; ++ ++ if (strcmp(re->name, "songs") == 0) { ++ stats->numberOfSongs = atoi(re->value); ++ } else if (strcmp(re->name, "playtime") == 0) { ++ stats->playTime = strtol(re->value, NULL, 10); ++ } ++ ++ mpd_getNextReturnElement(connection); ++ if (connection->error) { ++ free(stats); ++ return NULL; ++ } ++ } ++ ++ if (connection->error) { ++ free(stats); ++ return NULL; ++ } ++ ++ return stats; ++} ++ ++void mpd_freeSearchStats(mpd_SearchStats * stats) ++{ ++ free(stats); ++} ++ ++static void mpd_initSong(mpd_Song * song) ++{ ++ song->file = NULL; ++ song->artist = NULL; ++ song->album = NULL; ++ song->track = NULL; ++ song->title = NULL; ++ song->name = NULL; ++ song->date = NULL; ++ /* added by Qball */ ++ song->genre = NULL; ++ song->composer = NULL; ++ song->performer = NULL; ++ song->disc = NULL; ++ song->comment = NULL; ++ ++ song->time = MPD_SONG_NO_TIME; ++ song->pos = MPD_SONG_NO_NUM; ++ song->id = MPD_SONG_NO_ID; ++} ++ ++static void mpd_finishSong(mpd_Song * song) ++{ ++ if (song->file) ++ free(song->file); ++ if (song->artist) ++ free(song->artist); ++ if (song->album) ++ free(song->album); ++ if (song->title) ++ free(song->title); ++ if (song->track) ++ free(song->track); ++ if (song->name) ++ free(song->name); ++ if (song->date) ++ free(song->date); ++ if (song->genre) ++ free(song->genre); ++ if (song->composer) ++ free(song->composer); ++ if (song->disc) ++ free(song->disc); ++ if (song->comment) ++ free(song->comment); ++} ++ ++mpd_Song *mpd_newSong(void) ++{ ++ mpd_Song *ret = malloc(sizeof(mpd_Song)); ++ ++ mpd_initSong(ret); ++ ++ return ret; ++} ++ ++void mpd_freeSong(mpd_Song * song) ++{ ++ mpd_finishSong(song); ++ free(song); ++} ++ ++mpd_Song *mpd_songDup(mpd_Song * song) ++{ ++ mpd_Song *ret = mpd_newSong(); ++ ++ if (song->file) ++ ret->file = strdup(song->file); ++ if (song->artist) ++ ret->artist = strdup(song->artist); ++ if (song->album) ++ ret->album = strdup(song->album); ++ if (song->title) ++ ret->title = strdup(song->title); ++ if (song->track) ++ ret->track = strdup(song->track); ++ if (song->name) ++ ret->name = strdup(song->name); ++ if (song->date) ++ ret->date = strdup(song->date); ++ if (song->genre) ++ ret->genre = strdup(song->genre); ++ if (song->composer) ++ ret->composer = strdup(song->composer); ++ if (song->disc) ++ ret->disc = strdup(song->disc); ++ if (song->comment) ++ ret->comment = strdup(song->comment); ++ ret->time = song->time; ++ ret->pos = song->pos; ++ ret->id = song->id; ++ ++ return ret; ++} ++ ++static void mpd_initDirectory(mpd_Directory * directory) ++{ ++ directory->path = NULL; ++} ++ ++static void mpd_finishDirectory(mpd_Directory * directory) ++{ ++ if (directory->path) ++ free(directory->path); ++} ++ ++mpd_Directory *mpd_newDirectory(void) ++{ ++ mpd_Directory *directory = malloc(sizeof(mpd_Directory));; ++ ++ mpd_initDirectory(directory); ++ ++ return directory; ++} ++ ++void mpd_freeDirectory(mpd_Directory * directory) ++{ ++ mpd_finishDirectory(directory); ++ ++ free(directory); ++} ++ ++mpd_Directory *mpd_directoryDup(mpd_Directory * directory) ++{ ++ mpd_Directory *ret = mpd_newDirectory(); ++ ++ if (directory->path) ++ ret->path = strdup(directory->path); ++ ++ return ret; ++} ++ ++static void mpd_initPlaylistFile(mpd_PlaylistFile * playlist) ++{ ++ playlist->path = NULL; ++} ++ ++static void mpd_finishPlaylistFile(mpd_PlaylistFile * playlist) ++{ ++ if (playlist->path) ++ free(playlist->path); ++} ++ ++mpd_PlaylistFile *mpd_newPlaylistFile(void) ++{ ++ mpd_PlaylistFile *playlist = malloc(sizeof(mpd_PlaylistFile)); ++ ++ mpd_initPlaylistFile(playlist); ++ ++ return playlist; ++} ++ ++void mpd_freePlaylistFile(mpd_PlaylistFile * playlist) ++{ ++ mpd_finishPlaylistFile(playlist); ++ free(playlist); ++} ++ ++mpd_PlaylistFile *mpd_playlistFileDup(mpd_PlaylistFile * playlist) ++{ ++ mpd_PlaylistFile *ret = mpd_newPlaylistFile(); ++ ++ if (playlist->path) ++ ret->path = strdup(playlist->path); ++ ++ return ret; ++} ++ ++static void mpd_initInfoEntity(mpd_InfoEntity * entity) ++{ ++ entity->info.directory = NULL; ++} ++ ++static void mpd_finishInfoEntity(mpd_InfoEntity * entity) ++{ ++ if (entity->info.directory) { ++ if (entity->type == MPD_INFO_ENTITY_TYPE_DIRECTORY) { ++ mpd_freeDirectory(entity->info.directory); ++ } else if (entity->type == MPD_INFO_ENTITY_TYPE_SONG) { ++ mpd_freeSong(entity->info.song); ++ } else if (entity->type == MPD_INFO_ENTITY_TYPE_PLAYLISTFILE) { ++ mpd_freePlaylistFile(entity->info.playlistFile); ++ } ++ } ++} ++ ++mpd_InfoEntity *mpd_newInfoEntity(void) ++{ ++ mpd_InfoEntity *entity = malloc(sizeof(mpd_InfoEntity)); ++ ++ mpd_initInfoEntity(entity); ++ ++ return entity; ++} ++ ++void mpd_freeInfoEntity(mpd_InfoEntity * entity) ++{ ++ mpd_finishInfoEntity(entity); ++ free(entity); ++} ++ ++static void mpd_sendInfoCommand(mpd_Connection * connection, char *command) ++{ ++ mpd_executeCommand(connection, command); ++} ++ ++mpd_InfoEntity *mpd_getNextInfoEntity(mpd_Connection * connection) ++{ ++ mpd_InfoEntity *entity = NULL; ++ ++ if (connection->doneProcessing || (connection->listOks && connection->doneListOk)) { ++ return NULL; ++ } ++ ++ if (!connection->returnElement) ++ mpd_getNextReturnElement(connection); ++ ++ if (connection->returnElement) { ++ if (strcmp(connection->returnElement->name, "file") == 0) { ++ entity = mpd_newInfoEntity(); ++ entity->type = MPD_INFO_ENTITY_TYPE_SONG; ++ entity->info.song = mpd_newSong(); ++ entity->info.song->file = strdup(connection->returnElement->value); ++ } else if (strcmp(connection->returnElement->name, "directory") == 0) { ++ entity = mpd_newInfoEntity(); ++ entity->type = MPD_INFO_ENTITY_TYPE_DIRECTORY; ++ entity->info.directory = mpd_newDirectory(); ++ entity->info.directory->path = strdup(connection->returnElement->value); ++ } else if (strcmp(connection->returnElement->name, "playlist") == 0) { ++ entity = mpd_newInfoEntity(); ++ entity->type = MPD_INFO_ENTITY_TYPE_PLAYLISTFILE; ++ entity->info.playlistFile = mpd_newPlaylistFile(); ++ entity->info.playlistFile->path = strdup(connection->returnElement->value); ++ } else if (strcmp(connection->returnElement->name, "cpos") == 0) { ++ entity = mpd_newInfoEntity(); ++ entity->type = MPD_INFO_ENTITY_TYPE_SONG; ++ entity->info.song = mpd_newSong(); ++ entity->info.song->pos = atoi(connection->returnElement->value); ++ } else { ++ connection->error = 1; ++ strcpy(connection->errorStr, "problem parsing song info"); ++ return NULL; ++ } ++ } else ++ return NULL; ++ ++ mpd_getNextReturnElement(connection); ++ while (connection->returnElement) { ++ mpd_ReturnElement *re = connection->returnElement; ++ ++ if (strcmp(re->name, "file") == 0) ++ return entity; ++ else if (strcmp(re->name, "directory") == 0) ++ return entity; ++ else if (strcmp(re->name, "playlist") == 0) ++ return entity; ++ else if (strcmp(re->name, "cpos") == 0) ++ return entity; ++ ++ if (entity->type == MPD_INFO_ENTITY_TYPE_SONG && strlen(re->value)) { ++ if (!entity->info.song->artist && strcmp(re->name, "Artist") == 0) { ++ entity->info.song->artist = strdup(re->value); ++ } else if (!entity->info.song->album && strcmp(re->name, "Album") == 0) { ++ entity->info.song->album = strdup(re->value); ++ } else if (!entity->info.song->title && strcmp(re->name, "Title") == 0) { ++ entity->info.song->title = strdup(re->value); ++ } else if (!entity->info.song->track && strcmp(re->name, "Track") == 0) { ++ entity->info.song->track = strdup(re->value); ++ } else if (!entity->info.song->name && strcmp(re->name, "Name") == 0) { ++ entity->info.song->name = strdup(re->value); ++ } else if (entity->info.song->time == MPD_SONG_NO_TIME && strcmp(re->name, "Time") == 0) { ++ entity->info.song->time = atoi(re->value); ++ } else if (entity->info.song->pos == MPD_SONG_NO_NUM && strcmp(re->name, "Pos") == 0) { ++ entity->info.song->pos = atoi(re->value); ++ } else if (entity->info.song->id == MPD_SONG_NO_ID && strcmp(re->name, "Id") == 0) { ++ entity->info.song->id = atoi(re->value); ++ } else if (!entity->info.song->date && strcmp(re->name, "Date") == 0) { ++ entity->info.song->date = strdup(re->value); ++ } else if (!entity->info.song->genre && strcmp(re->name, "Genre") == 0) { ++ entity->info.song->genre = strdup(re->value); ++ } else if (!entity->info.song->composer && strcmp(re->name, "Composer") == 0) { ++ entity->info.song->composer = strdup(re->value); ++ } else if (!entity->info.song->performer && strcmp(re->name, "Performer") == 0) { ++ entity->info.song->performer = strdup(re->value); ++ } else if (!entity->info.song->disc && strcmp(re->name, "Disc") == 0) { ++ entity->info.song->disc = strdup(re->value); ++ } else if (!entity->info.song->comment && strcmp(re->name, "Comment") == 0) { ++ entity->info.song->comment = strdup(re->value); ++ } ++ } else if (entity->type == MPD_INFO_ENTITY_TYPE_DIRECTORY) { ++ } else if (entity->type == MPD_INFO_ENTITY_TYPE_PLAYLISTFILE) { ++ } ++ ++ mpd_getNextReturnElement(connection); ++ } ++ ++ return entity; ++} ++ ++static char *mpd_getNextReturnElementNamed(mpd_Connection * connection, const char *name) ++{ ++ if (connection->doneProcessing || (connection->listOks && connection->doneListOk)) { ++ return NULL; ++ } ++ ++ mpd_getNextReturnElement(connection); ++ while (connection->returnElement) { ++ mpd_ReturnElement *re = connection->returnElement; ++ ++ if (strcmp(re->name, name) == 0) ++ return strdup(re->value); ++ mpd_getNextReturnElement(connection); ++ } ++ ++ return NULL; ++} ++ ++char *mpd_getNextTag(mpd_Connection * connection, int type) ++{ ++ if (type < 0 || type >= MPD_TAG_NUM_OF_ITEM_TYPES || type == MPD_TAG_ITEM_ANY) ++ return NULL; ++ if (type == MPD_TAG_ITEM_FILENAME) ++ return mpd_getNextReturnElementNamed(connection, "file"); ++ return mpd_getNextReturnElementNamed(connection, mpdTagItemKeys[type]); ++} ++ ++char *mpd_getNextArtist(mpd_Connection * connection) ++{ ++ return mpd_getNextReturnElementNamed(connection, "Artist"); ++} ++ ++char *mpd_getNextAlbum(mpd_Connection * connection) ++{ ++ return mpd_getNextReturnElementNamed(connection, "Album"); ++} ++ ++void mpd_sendPlaylistInfoCommand(mpd_Connection * connection, int songPos) ++{ ++ int len = strlen("playlistinfo") + 2 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "playlistinfo \"%i\"\n", songPos); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendPlaylistIdCommand(mpd_Connection * connection, int id) ++{ ++ int len = strlen("playlistid") + 2 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "playlistid \"%i\"\n", id); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendPlChangesCommand(mpd_Connection * connection, long long playlist) ++{ ++ int len = strlen("plchanges") + 2 + LONGLONGLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "plchanges \"%lld\"\n", playlist); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendPlChangesPosIdCommand(mpd_Connection * connection, long long playlist) ++{ ++ int len = strlen("plchangesposid") + 2 + LONGLONGLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "plchangesposid \"%lld\"\n", playlist); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendListallCommand(mpd_Connection * connection, const char *dir) ++{ ++ char *sDir = mpd_sanitizeArg(dir); ++ int len = strlen("listall") + 2 + strlen(sDir) + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "listall \"%s\"\n", sDir); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++ free(sDir); ++} ++ ++void mpd_sendListallInfoCommand(mpd_Connection * connection, const char *dir) ++{ ++ char *sDir = mpd_sanitizeArg(dir); ++ int len = strlen("listallinfo") + 2 + strlen(sDir) + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "listallinfo \"%s\"\n", sDir); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++ free(sDir); ++} ++ ++void mpd_sendLsInfoCommand(mpd_Connection * connection, const char *dir) ++{ ++ char *sDir = mpd_sanitizeArg(dir); ++ int len = strlen("lsinfo") + 2 + strlen(sDir) + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "lsinfo \"%s\"\n", sDir); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++ free(sDir); ++} ++ ++void mpd_sendCurrentSongCommand(mpd_Connection * connection) ++{ ++ mpd_executeCommand(connection, "currentsong\n"); ++} ++ ++void mpd_sendSearchCommand(mpd_Connection * connection, int table, const char *str) ++{ ++ mpd_startSearch(connection, 0); ++ mpd_addConstraintSearch(connection, table, str); ++ mpd_commitSearch(connection); ++} ++ ++void mpd_sendFindCommand(mpd_Connection * connection, int table, const char *str) ++{ ++ mpd_startSearch(connection, 1); ++ mpd_addConstraintSearch(connection, table, str); ++ mpd_commitSearch(connection); ++} ++ ++void mpd_sendListCommand(mpd_Connection * connection, int table, const char *arg1) ++{ ++ char st[10]; ++ int len; ++ char *string; ++ if (table == MPD_TABLE_ARTIST) ++ strcpy(st, "artist"); ++ else if (table == MPD_TABLE_ALBUM) ++ strcpy(st, "album"); ++ else { ++ connection->error = 1; ++ strcpy(connection->errorStr, "unknown table for list"); ++ return; ++ } ++ if (arg1) { ++ char *sanitArg1 = mpd_sanitizeArg(arg1); ++ len = strlen("list") + 1 + strlen(sanitArg1) + 2 + strlen(st) + 3; ++ string = malloc(len); ++ snprintf(string, len, "list %s \"%s\"\n", st, sanitArg1); ++ free(sanitArg1); ++ } else { ++ len = strlen("list") + 1 + strlen(st) + 2; ++ string = malloc(len); ++ snprintf(string, len, "list %s\n", st); ++ } ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendAddCommand(mpd_Connection * connection, const char *file) ++{ ++ char *sFile = mpd_sanitizeArg(file); ++ int len = strlen("add") + 2 + strlen(sFile) + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "add \"%s\"\n", sFile); ++ mpd_executeCommand(connection, string); ++ free(string); ++ free(sFile); ++} ++ ++int mpd_sendAddIdCommand(mpd_Connection * connection, const char *file) ++{ ++ int retval = -1; ++ char *sFile = mpd_sanitizeArg(file); ++ int len = strlen("addid") + 2 + strlen(sFile) + 3; ++ char *string = malloc(len); ++ ++ snprintf(string, len, "addid \"%s\"\n", sFile); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++ free(sFile); ++ ++ string = mpd_getNextReturnElementNamed(connection, "Id"); ++ if (string) { ++ retval = atoi(string); ++ free(string); ++ } ++ ++ return retval; ++} ++ ++void mpd_sendDeleteCommand(mpd_Connection * connection, int songPos) ++{ ++ int len = strlen("delete") + 2 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "delete \"%i\"\n", songPos); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendDeleteIdCommand(mpd_Connection * connection, int id) ++{ ++ int len = strlen("deleteid") + 2 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "deleteid \"%i\"\n", id); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendSaveCommand(mpd_Connection * connection, const char *name) ++{ ++ char *sName = mpd_sanitizeArg(name); ++ int len = strlen("save") + 2 + strlen(sName) + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "save \"%s\"\n", sName); ++ mpd_executeCommand(connection, string); ++ free(string); ++ free(sName); ++} ++ ++void mpd_sendLoadCommand(mpd_Connection * connection, const char *name) ++{ ++ char *sName = mpd_sanitizeArg(name); ++ int len = strlen("load") + 2 + strlen(sName) + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "load \"%s\"\n", sName); ++ mpd_executeCommand(connection, string); ++ free(string); ++ free(sName); ++} ++ ++void mpd_sendRmCommand(mpd_Connection * connection, const char *name) ++{ ++ char *sName = mpd_sanitizeArg(name); ++ int len = strlen("rm") + 2 + strlen(sName) + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "rm \"%s\"\n", sName); ++ mpd_executeCommand(connection, string); ++ free(string); ++ free(sName); ++} ++ ++void mpd_sendRenameCommand(mpd_Connection * connection, const char *from, const char *to) ++{ ++ char *sFrom = mpd_sanitizeArg(from); ++ char *sTo = mpd_sanitizeArg(to); ++ int len = strlen("rename") + 2 + strlen(sFrom) + 3 + strlen(sTo) + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "rename \"%s\" \"%s\"\n", sFrom, sTo); ++ mpd_executeCommand(connection, string); ++ free(string); ++ free(sFrom); ++ free(sTo); ++} ++ ++void mpd_sendShuffleCommand(mpd_Connection * connection) ++{ ++ mpd_executeCommand(connection, "shuffle\n"); ++} ++ ++void mpd_sendClearCommand(mpd_Connection * connection) ++{ ++ mpd_executeCommand(connection, "clear\n"); ++} ++ ++void mpd_sendPlayCommand(mpd_Connection * connection, int songPos) ++{ ++ int len = strlen("play") + 2 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "play \"%i\"\n", songPos); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendPlayIdCommand(mpd_Connection * connection, int id) ++{ ++ int len = strlen("playid") + 2 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "playid \"%i\"\n", id); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendStopCommand(mpd_Connection * connection) ++{ ++ mpd_executeCommand(connection, "stop\n"); ++} ++ ++void mpd_sendPauseCommand(mpd_Connection * connection, int pauseMode) ++{ ++ int len = strlen("pause") + 2 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "pause \"%i\"\n", pauseMode); ++ mpd_executeCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendNextCommand(mpd_Connection * connection) ++{ ++ mpd_executeCommand(connection, "next\n"); ++} ++ ++void mpd_sendMoveCommand(mpd_Connection * connection, int from, int to) ++{ ++ int len = strlen("move") + 2 + INTLEN + 3 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "move \"%i\" \"%i\"\n", from, to); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendMoveIdCommand(mpd_Connection * connection, int id, int to) ++{ ++ int len = strlen("moveid") + 2 + INTLEN + 3 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "moveid \"%i\" \"%i\"\n", id, to); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendSwapCommand(mpd_Connection * connection, int song1, int song2) ++{ ++ int len = strlen("swap") + 2 + INTLEN + 3 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "swap \"%i\" \"%i\"\n", song1, song2); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendSwapIdCommand(mpd_Connection * connection, int id1, int id2) ++{ ++ int len = strlen("swapid") + 2 + INTLEN + 3 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "swapid \"%i\" \"%i\"\n", id1, id2); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendSeekCommand(mpd_Connection * connection, int song, int time) ++{ ++ int len = strlen("seek") + 2 + INTLEN + 3 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "seek \"%i\" \"%i\"\n", song, time); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendSeekIdCommand(mpd_Connection * connection, int id, int time) ++{ ++ int len = strlen("seekid") + 2 + INTLEN + 3 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "seekid \"%i\" \"%i\"\n", id, time); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendUpdateCommand(mpd_Connection * connection, char *path) ++{ ++ char *sPath = mpd_sanitizeArg(path); ++ int len = strlen("update") + 2 + strlen(sPath) + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "update \"%s\"\n", sPath); ++ mpd_sendInfoCommand(connection, string); ++ free(string); ++ free(sPath); ++} ++ ++int mpd_getUpdateId(mpd_Connection * connection) ++{ ++ char *jobid; ++ int ret = 0; ++ ++ jobid = mpd_getNextReturnElementNamed(connection, "updating_db"); ++ if (jobid) { ++ ret = atoi(jobid); ++ free(jobid); ++ } ++ ++ return ret; ++} ++ ++void mpd_sendPrevCommand(mpd_Connection * connection) ++{ ++ mpd_executeCommand(connection, "previous\n"); ++} ++ ++void mpd_sendRepeatCommand(mpd_Connection * connection, int repeatMode) ++{ ++ int len = strlen("repeat") + 2 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "repeat \"%i\"\n", repeatMode); ++ mpd_executeCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendRandomCommand(mpd_Connection * connection, int randomMode) ++{ ++ int len = strlen("random") + 2 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "random \"%i\"\n", randomMode); ++ mpd_executeCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendSetvolCommand(mpd_Connection * connection, int volumeChange) ++{ ++ int len = strlen("setvol") + 2 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "setvol \"%i\"\n", volumeChange); ++ mpd_executeCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendVolumeCommand(mpd_Connection * connection, int volumeChange) ++{ ++ int len = strlen("volume") + 2 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "volume \"%i\"\n", volumeChange); ++ mpd_executeCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendCrossfadeCommand(mpd_Connection * connection, int seconds) ++{ ++ int len = strlen("crossfade") + 2 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "crossfade \"%i\"\n", seconds); ++ mpd_executeCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendPasswordCommand(mpd_Connection * connection, const char *pass) ++{ ++ char *sPass = mpd_sanitizeArg(pass); ++ int len = strlen("password") + 2 + strlen(sPass) + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "password \"%s\"\n", sPass); ++ mpd_executeCommand(connection, string); ++ free(string); ++ free(sPass); ++} ++ ++void mpd_sendCommandListBegin(mpd_Connection * connection) ++{ ++ if (connection->commandList) { ++ strcpy(connection->errorStr, "already in command list mode"); ++ connection->error = 1; ++ return; ++ } ++ connection->commandList = COMMAND_LIST; ++ mpd_executeCommand(connection, "command_list_begin\n"); ++} ++ ++void mpd_sendCommandListOkBegin(mpd_Connection * connection) ++{ ++ if (connection->commandList) { ++ strcpy(connection->errorStr, "already in command list mode"); ++ connection->error = 1; ++ return; ++ } ++ connection->commandList = COMMAND_LIST_OK; ++ mpd_executeCommand(connection, "command_list_ok_begin\n"); ++ connection->listOks = 0; ++} ++ ++void mpd_sendCommandListEnd(mpd_Connection * connection) ++{ ++ if (!connection->commandList) { ++ strcpy(connection->errorStr, "not in command list mode"); ++ connection->error = 1; ++ return; ++ } ++ connection->commandList = 0; ++ mpd_executeCommand(connection, "command_list_end\n"); ++} ++ ++void mpd_sendOutputsCommand(mpd_Connection * connection) ++{ ++ mpd_executeCommand(connection, "outputs\n"); ++} ++ ++mpd_OutputEntity *mpd_getNextOutput(mpd_Connection * connection) ++{ ++ mpd_OutputEntity *output = NULL; ++ ++ if (connection->doneProcessing || (connection->listOks && connection->doneListOk)) { ++ return NULL; ++ } ++ ++ if (connection->error) ++ return NULL; ++ ++ output = malloc(sizeof(mpd_OutputEntity)); ++ output->id = -10; ++ output->name = NULL; ++ output->enabled = 0; ++ ++ if (!connection->returnElement) ++ mpd_getNextReturnElement(connection); ++ ++ while (connection->returnElement) { ++ mpd_ReturnElement *re = connection->returnElement; ++ if (strcmp(re->name, "outputid") == 0) { ++ if (output != NULL && output->id >= 0) ++ return output; ++ output->id = atoi(re->value); ++ } else if (strcmp(re->name, "outputname") == 0) { ++ output->name = strdup(re->value); ++ } else if (strcmp(re->name, "outputenabled") == 0) { ++ output->enabled = atoi(re->value); ++ } ++ ++ mpd_getNextReturnElement(connection); ++ if (connection->error) { ++ free(output); ++ return NULL; ++ } ++ ++ } ++ ++ return output; ++} ++ ++void mpd_sendEnableOutputCommand(mpd_Connection * connection, int outputId) ++{ ++ int len = strlen("enableoutput") + 2 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "enableoutput \"%i\"\n", outputId); ++ mpd_executeCommand(connection, string); ++ free(string); ++} ++ ++void mpd_sendDisableOutputCommand(mpd_Connection * connection, int outputId) ++{ ++ int len = strlen("disableoutput") + 2 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "disableoutput \"%i\"\n", outputId); ++ mpd_executeCommand(connection, string); ++ free(string); ++} ++ ++void mpd_freeOutputElement(mpd_OutputEntity * output) ++{ ++ free(output->name); ++ free(output); ++} ++ ++/** ++ * mpd_sendNotCommandsCommand ++ * odd naming, but it gets the not allowed commands ++ */ ++ ++void mpd_sendNotCommandsCommand(mpd_Connection * connection) ++{ ++ mpd_executeCommand(connection, "notcommands\n"); ++} ++ ++/** ++ * mpd_sendCommandsCommand ++ * odd naming, but it gets the allowed commands ++ */ ++void mpd_sendCommandsCommand(mpd_Connection * connection) ++{ ++ mpd_executeCommand(connection, "commands\n"); ++} ++ ++/** ++ * Get the next returned command ++ */ ++char *mpd_getNextCommand(mpd_Connection * connection) ++{ ++ return mpd_getNextReturnElementNamed(connection, "command"); ++} ++ ++void mpd_sendUrlHandlersCommand(mpd_Connection * connection) ++{ ++ mpd_executeCommand(connection, "urlhandlers\n"); ++} ++ ++char *mpd_getNextHandler(mpd_Connection * connection) ++{ ++ return mpd_getNextReturnElementNamed(connection, "handler"); ++} ++ ++void mpd_sendTagTypesCommand(mpd_Connection * connection) ++{ ++ mpd_executeCommand(connection, "tagtypes\n"); ++} ++ ++char *mpd_getNextTagType(mpd_Connection * connection) ++{ ++ return mpd_getNextReturnElementNamed(connection, "tagtype"); ++} ++ ++void mpd_startSearch(mpd_Connection * connection, int exact) ++{ ++ if (connection->request) { ++ strcpy(connection->errorStr, "search already in progress"); ++ connection->error = 1; ++ return; ++ } ++ ++ if (exact) ++ connection->request = strdup("find"); ++ else ++ connection->request = strdup("search"); ++} ++ ++void mpd_startStatsSearch(mpd_Connection * connection) ++{ ++ if (connection->request) { ++ strcpy(connection->errorStr, "search already in progress"); ++ connection->error = 1; ++ return; ++ } ++ ++ connection->request = strdup("count"); ++} ++ ++void mpd_startPlaylistSearch(mpd_Connection * connection, int exact) ++{ ++ if (connection->request) { ++ strcpy(connection->errorStr, "search already in progress"); ++ connection->error = 1; ++ return; ++ } ++ ++ if (exact) ++ connection->request = strdup("playlistfind"); ++ else ++ connection->request = strdup("playlistsearch"); ++} ++ ++void mpd_startFieldSearch(mpd_Connection * connection, int type) ++{ ++ char *strtype; ++ int len; ++ ++ if (connection->request) { ++ strcpy(connection->errorStr, "search already in progress"); ++ connection->error = 1; ++ return; ++ } ++ ++ if (type < 0 || type >= MPD_TAG_NUM_OF_ITEM_TYPES) { ++ strcpy(connection->errorStr, "invalid type specified"); ++ connection->error = 1; ++ return; ++ } ++ ++ strtype = mpdTagItemKeys[type]; ++ ++ len = 5 + strlen(strtype) + 1; ++ connection->request = malloc(len); ++ ++ snprintf(connection->request, len, "list %c%s", tolower(strtype[0]), strtype + 1); ++} ++ ++void mpd_addConstraintSearch(mpd_Connection * connection, int type, const char *name) ++{ ++ char *strtype; ++ char *arg; ++ int len; ++ char *string; ++ ++ if (!connection->request) { ++ strcpy(connection->errorStr, "no search in progress"); ++ connection->error = 1; ++ return; ++ } ++ ++ if (type < 0 || type >= MPD_TAG_NUM_OF_ITEM_TYPES) { ++ strcpy(connection->errorStr, "invalid type specified"); ++ connection->error = 1; ++ return; ++ } ++ ++ if (name == NULL) { ++ strcpy(connection->errorStr, "no name specified"); ++ connection->error = 1; ++ return; ++ } ++ ++ string = strdup(connection->request); ++ strtype = mpdTagItemKeys[type]; ++ arg = mpd_sanitizeArg(name); ++ ++ len = strlen(string) + 1 + strlen(strtype) + 2 + strlen(arg) + 2; ++ connection->request = realloc(connection->request, len); ++ snprintf(connection->request, len, "%s %c%s \"%s\"", string, tolower(strtype[0]), strtype + 1, arg); ++ ++ free(string); ++ free(arg); ++} ++ ++void mpd_commitSearch(mpd_Connection * connection) ++{ ++ int len; ++ ++ if (!connection->request) { ++ strcpy(connection->errorStr, "no search in progress"); ++ connection->error = 1; ++ return; ++ } ++ ++ len = strlen(connection->request) + 2; ++ connection->request = realloc(connection->request, len); ++ connection->request[len - 2] = '\n'; ++ connection->request[len - 1] = '\0'; ++ mpd_sendInfoCommand(connection, connection->request); ++ ++ free(connection->request); ++ connection->request = NULL; ++} ++ ++/** ++ * @param connection a MpdConnection ++ * @param path the path to the playlist. ++ * ++ * List the content, with full metadata, of a stored playlist. ++ * ++ */ ++void mpd_sendListPlaylistInfoCommand(mpd_Connection * connection, char *path) ++{ ++ char *arg = mpd_sanitizeArg(path); ++ int len = strlen("listplaylistinfo") + 2 + strlen(arg) + 3; ++ char *query = malloc(len); ++ snprintf(query, len, "listplaylistinfo \"%s\"\n", arg); ++ mpd_sendInfoCommand(connection, query); ++ free(arg); ++ free(query); ++} ++ ++/** ++ * @param connection a MpdConnection ++ * @param path the path to the playlist. ++ * ++ * List the content of a stored playlist. ++ * ++ */ ++void mpd_sendListPlaylistCommand(mpd_Connection * connection, char *path) ++{ ++ char *arg = mpd_sanitizeArg(path); ++ int len = strlen("listplaylist") + 2 + strlen(arg) + 3; ++ char *query = malloc(len); ++ snprintf(query, len, "listplaylist \"%s\"\n", arg); ++ mpd_sendInfoCommand(connection, query); ++ free(arg); ++ free(query); ++} ++ ++void mpd_sendPlaylistClearCommand(mpd_Connection * connection, char *path) ++{ ++ char *sPath = mpd_sanitizeArg(path); ++ int len = strlen("playlistclear") + 2 + strlen(sPath) + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "playlistclear \"%s\"\n", sPath); ++ mpd_executeCommand(connection, string); ++ free(sPath); ++ free(string); ++} ++ ++void mpd_sendPlaylistAddCommand(mpd_Connection * connection, char *playlist, char *path) ++{ ++ char *sPlaylist = mpd_sanitizeArg(playlist); ++ char *sPath = mpd_sanitizeArg(path); ++ int len = strlen("playlistadd") + 2 + strlen(sPlaylist) + 3 + strlen(sPath) + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "playlistadd \"%s\" \"%s\"\n", sPlaylist, sPath); ++ mpd_executeCommand(connection, string); ++ free(sPlaylist); ++ free(sPath); ++ free(string); ++} ++ ++void mpd_sendPlaylistMoveCommand(mpd_Connection * connection, char *playlist, int from, int to) ++{ ++ char *sPlaylist = mpd_sanitizeArg(playlist); ++ int len = strlen("playlistmove") + 2 + strlen(sPlaylist) + 3 + INTLEN + 3 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "playlistmove \"%s\" \"%i\" \"%i\"\n", sPlaylist, from, to); ++ mpd_executeCommand(connection, string); ++ free(sPlaylist); ++ free(string); ++} ++ ++void mpd_sendPlaylistDeleteCommand(mpd_Connection * connection, char *playlist, int pos) ++{ ++ char *sPlaylist = mpd_sanitizeArg(playlist); ++ int len = strlen("playlistdelete") + 2 + strlen(sPlaylist) + 3 + INTLEN + 3; ++ char *string = malloc(len); ++ snprintf(string, len, "playlistdelete \"%s\" \"%i\"\n", sPlaylist, pos); ++ mpd_executeCommand(connection, string); ++ free(sPlaylist); ++ free(string); ++} +--- /dev/null ++++ b/libmpdclient.h +@@ -0,0 +1,661 @@ ++/* libmpdclient ++ (c)2003-2006 by Warren Dukes (warren.dukes@gmail.com) ++ This project's homepage is: http://www.musicpd.org ++ ++ Redistribution and use in source and binary forms, with or without ++ modification, are permitted provided that the following conditions ++ are met: ++ ++ - Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ ++ - Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ ++ - Neither the name of the Music Player Daemon nor the names of its ++ contributors may be used to endorse or promote products derived from ++ this software without specific prior written permission. ++ ++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ++ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR ++ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#ifndef LIBMPDCLIENT_H ++#define LIBMPDCLIENT_H ++ ++#ifdef WIN32 ++# define __W32API_USE_DLLIMPORT__ 1 ++#endif ++ ++#include ++#include ++#define MPD_BUFFER_MAX_LENGTH 50000 ++#define MPD_ERRORSTR_MAX_LENGTH 1000 ++#define MPD_WELCOME_MESSAGE "OK MPD " ++ ++#define MPD_ERROR_TIMEOUT 10 /* timeout trying to talk to mpd */ ++#define MPD_ERROR_SYSTEM 11 /* system error */ ++#define MPD_ERROR_UNKHOST 12 /* unknown host */ ++#define MPD_ERROR_CONNPORT 13 /* problems connecting to port on host */ ++#define MPD_ERROR_NOTMPD 14 /* mpd not running on port at host */ ++#define MPD_ERROR_NORESPONSE 15 /* no response on attempting to connect */ ++#define MPD_ERROR_SENDING 16 /* error sending command */ ++#define MPD_ERROR_CONNCLOSED 17 /* connection closed by mpd */ ++#define MPD_ERROR_ACK 18 /* ACK returned! */ ++#define MPD_ERROR_BUFFEROVERRUN 19 /* Buffer was overrun! */ ++ ++#define MPD_ACK_ERROR_UNK -1 ++#define MPD_ERROR_AT_UNK -1 ++ ++#define MPD_ACK_ERROR_NOT_LIST 1 ++#define MPD_ACK_ERROR_ARG 2 ++#define MPD_ACK_ERROR_PASSWORD 3 ++#define MPD_ACK_ERROR_PERMISSION 4 ++#define MPD_ACK_ERROR_UNKNOWN_CMD 5 ++ ++#define MPD_ACK_ERROR_NO_EXIST 50 ++#define MPD_ACK_ERROR_PLAYLIST_MAX 51 ++#define MPD_ACK_ERROR_SYSTEM 52 ++#define MPD_ACK_ERROR_PLAYLIST_LOAD 53 ++#define MPD_ACK_ERROR_UPDATE_ALREADY 54 ++#define MPD_ACK_ERROR_PLAYER_SYNC 55 ++#define MPD_ACK_ERROR_EXIST 56 ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ typedef enum mpd_TagItems { ++ MPD_TAG_ITEM_ARTIST, ++ MPD_TAG_ITEM_ALBUM, ++ MPD_TAG_ITEM_TITLE, ++ MPD_TAG_ITEM_TRACK, ++ MPD_TAG_ITEM_NAME, ++ MPD_TAG_ITEM_GENRE, ++ MPD_TAG_ITEM_DATE, ++ MPD_TAG_ITEM_COMPOSER, ++ MPD_TAG_ITEM_PERFORMER, ++ MPD_TAG_ITEM_COMMENT, ++ MPD_TAG_ITEM_DISC, ++ MPD_TAG_ITEM_FILENAME, ++ MPD_TAG_ITEM_ANY, ++ MPD_TAG_NUM_OF_ITEM_TYPES ++ } mpd_TagItems; ++ ++ extern char *mpdTagItemKeys[MPD_TAG_NUM_OF_ITEM_TYPES]; ++ ++/* internal stuff don't touch this struct */ ++ typedef struct _mpd_ReturnElement { ++ char *name; ++ char *value; ++ } mpd_ReturnElement; ++ ++/* mpd_Connection ++ * holds info about connection to mpd ++ * use error, and errorStr to detect errors ++ */ ++ typedef struct _mpd_Connection { ++ /* use this to check the version of mpd */ ++ int version[3]; ++ /* IMPORTANT, you want to get the error messages from here */ ++ char errorStr[MPD_ERRORSTR_MAX_LENGTH + 1]; ++ int errorCode; ++ int errorAt; ++ /* this will be set to MPD_ERROR_* if there is an error, 0 if not */ ++ int error; ++ /* DON'T TOUCH any of the rest of this stuff */ ++ int sock; ++ char buffer[MPD_BUFFER_MAX_LENGTH + 1]; ++ int buflen; ++ int bufstart; ++ int doneProcessing; ++ int listOks; ++ int doneListOk; ++ int commandList; ++ mpd_ReturnElement *returnElement; ++ struct timeval timeout; ++ char *request; ++ } mpd_Connection; ++ ++/* mpd_newConnection ++ * use this to open a new connection ++ * you should use mpd_closeConnection, when your done with the connection, ++ * even if an error has occurred ++ * _timeout_ is the connection timeout period in seconds ++ */ ++ mpd_Connection *mpd_newConnection(const char *host, int port, float timeout); ++ ++ void mpd_setConnectionTimeout(mpd_Connection * connection, float timeout); ++ ++/* mpd_closeConnection ++ * use this to close a connection and free'ing subsequent memory ++ */ ++ void mpd_closeConnection(mpd_Connection * connection); ++ ++/* mpd_clearError ++ * clears error ++ */ ++ void mpd_clearError(mpd_Connection * connection); ++ ++/* STATUS STUFF */ ++ ++/* use these with status.state to determine what state the player is in */ ++#define MPD_STATUS_STATE_UNKNOWN 0 ++#define MPD_STATUS_STATE_STOP 1 ++#define MPD_STATUS_STATE_PLAY 2 ++#define MPD_STATUS_STATE_PAUSE 3 ++ ++/* us this with status.volume to determine if mpd has volume support */ ++#define MPD_STATUS_NO_VOLUME -1 ++ ++/* mpd_Status ++ * holds info return from status command ++ */ ++ typedef struct mpd_Status { ++ /* 0-100, or MPD_STATUS_NO_VOLUME when there is no volume support */ ++ int volume; ++ /* 1 if repeat is on, 0 otherwise */ ++ int repeat; ++ /* 1 if random is on, 0 otherwise */ ++ int random; ++ /* playlist length */ ++ int playlistLength; ++ /* playlist, use this to determine when the playlist has changed */ ++ long long playlist; ++ /* use with MPD_STATUS_STATE_* to determine state of player */ ++ int state; ++ /* crossfade setting in seconds */ ++ int crossfade; ++ /* if a song is currently selected (always the case when state is ++ * PLAY or PAUSE), this is the position of the currently ++ * playing song in the playlist, beginning with 0 ++ */ ++ int song; ++ /* Song ID of the currently selected song */ ++ int songid; ++ /* time in seconds that have elapsed in the currently playing/paused ++ * song ++ */ ++ int elapsedTime; ++ /* length in seconds of the currently playing/paused song */ ++ int totalTime; ++ /* current bit rate in kbs */ ++ int bitRate; ++ /* audio sample rate */ ++ unsigned int sampleRate; ++ /* audio bits */ ++ int bits; ++ /* audio channels */ ++ int channels; ++ /* 1 if mpd is updating, 0 otherwise */ ++ int updatingDb; ++ /* error */ ++ char *error; ++ } mpd_Status; ++ ++ void mpd_sendStatusCommand(mpd_Connection * connection); ++ ++/* mpd_getStatus ++ * returns status info, be sure to free it with mpd_freeStatus() ++ * call this after mpd_sendStatusCommand() ++ */ ++ mpd_Status *mpd_getStatus(mpd_Connection * connection); ++ ++/* mpd_freeStatus ++ * free's status info malloc'd and returned by mpd_getStatus ++ */ ++ void mpd_freeStatus(mpd_Status * status); ++ ++ typedef struct _mpd_Stats { ++ int numberOfArtists; ++ int numberOfAlbums; ++ int numberOfSongs; ++ unsigned long uptime; ++ unsigned long dbUpdateTime; ++ unsigned long playTime; ++ unsigned long dbPlayTime; ++ } mpd_Stats; ++ ++ typedef struct _mpd_SearchStats { ++ int numberOfSongs; ++ unsigned long playTime; ++ } mpd_SearchStats; ++ ++ void mpd_sendStatsCommand(mpd_Connection * connection); ++ ++ mpd_Stats *mpd_getStats(mpd_Connection * connection); ++ ++ void mpd_freeStats(mpd_Stats * stats); ++ ++ mpd_SearchStats *mpd_getSearchStats(mpd_Connection * connection); ++ ++ void mpd_freeSearchStats(mpd_SearchStats * stats); ++ ++/* SONG STUFF */ ++ ++#define MPD_SONG_NO_TIME -1 ++#define MPD_SONG_NO_NUM -1 ++#define MPD_SONG_NO_ID -1 ++ ++/* mpd_Song ++ * for storing song info returned by mpd ++ */ ++ typedef struct _mpd_Song { ++ /* filename of song */ ++ char *file; ++ /* artist, maybe NULL if there is no tag */ ++ char *artist; ++ /* title, maybe NULL if there is no tag */ ++ char *title; ++ /* album, maybe NULL if there is no tag */ ++ char *album; ++ /* track, maybe NULL if there is no tag */ ++ char *track; ++ /* name, maybe NULL if there is no tag; it's the name of the current ++ * song, f.e. the icyName of the stream */ ++ char *name; ++ /* date */ ++ char *date; ++ ++ /* added by qball */ ++ /* Genre */ ++ char *genre; ++ /* Composer */ ++ char *composer; ++ /* Performer */ ++ char *performer; ++ /* Disc */ ++ char *disc; ++ /* Comment */ ++ char *comment; ++ ++ /* length of song in seconds, check that it is not MPD_SONG_NO_TIME */ ++ int time; ++ /* if plchanges/playlistinfo/playlistid used, is the position of the ++ * song in the playlist */ ++ int pos; ++ /* song id for a song in the playlist */ ++ int id; ++ } mpd_Song; ++ ++/* mpd_newSong ++ * use to allocate memory for a new mpd_Song ++ * file, artist, etc all initialized to NULL ++ * if your going to assign values to file, artist, etc ++ * be sure to malloc or strdup the memory ++ * use mpd_freeSong to free the memory for the mpd_Song, it will also ++ * free memory for file, artist, etc, so don't do it yourself ++ */ ++ mpd_Song *mpd_newSong(void); ++ ++/* mpd_freeSong ++ * use to free memory allocated by mpd_newSong ++ * also it will free memory pointed to by file, artist, etc, so be careful ++ */ ++ void mpd_freeSong(mpd_Song * song); ++ ++/* mpd_songDup ++ * works like strDup, but for a mpd_Song ++ */ ++ mpd_Song *mpd_songDup(mpd_Song * song); ++ ++/* DIRECTORY STUFF */ ++ ++/* mpd_Directory ++ * used to store info fro directory (right now that just the path) ++ */ ++ typedef struct _mpd_Directory { ++ char *path; ++ } mpd_Directory; ++ ++/* mpd_newDirectory ++ * allocates memory for a new directory ++ * use mpd_freeDirectory to free this memory ++ */ ++ mpd_Directory *mpd_newDirectory(void); ++ ++/* mpd_freeDirectory ++ * used to free memory allocated with mpd_newDirectory, and it frees ++ * path of mpd_Directory, so be careful ++ */ ++ void mpd_freeDirectory(mpd_Directory * directory); ++ ++/* mpd_directoryDup ++ * works like strdup, but for mpd_Directory ++ */ ++ mpd_Directory *mpd_directoryDup(mpd_Directory * directory); ++ ++/* PLAYLISTFILE STUFF */ ++ ++/* mpd_PlaylistFile ++ * stores info about playlist file returned by lsinfo ++ */ ++ typedef struct _mpd_PlaylistFile { ++ char *path; ++ } mpd_PlaylistFile; ++ ++/* mpd_newPlaylistFile ++ * allocates memory for new mpd_PlaylistFile, path is set to NULL ++ * free this memory with mpd_freePlaylistFile ++ */ ++ mpd_PlaylistFile *mpd_newPlaylistFile(void); ++ ++/* mpd_freePlaylist ++ * free memory allocated for freePlaylistFile, will also free ++ * path, so be careful ++ */ ++ void mpd_freePlaylistFile(mpd_PlaylistFile * playlist); ++ ++/* mpd_playlistFileDup ++ * works like strdup, but for mpd_PlaylistFile ++ */ ++ mpd_PlaylistFile *mpd_playlistFileDup(mpd_PlaylistFile * playlist); ++ ++/* INFO ENTITY STUFF */ ++ ++/* the type of entity returned from one of the commands that generates info ++ * use in conjunction with mpd_InfoEntity.type ++ */ ++#define MPD_INFO_ENTITY_TYPE_DIRECTORY 0 ++#define MPD_INFO_ENTITY_TYPE_SONG 1 ++#define MPD_INFO_ENTITY_TYPE_PLAYLISTFILE 2 ++ ++/* mpd_InfoEntity ++ * stores info on stuff returned info commands ++ */ ++ typedef struct mpd_InfoEntity { ++ /* the type of entity, use with MPD_INFO_ENTITY_TYPE_* to determine ++ * what this entity is (song, directory, etc...) ++ */ ++ int type; ++ /* the actual data you want, mpd_Song, mpd_Directory, etc */ ++ union { ++ mpd_Directory *directory; ++ mpd_Song *song; ++ mpd_PlaylistFile *playlistFile; ++ } info; ++ } mpd_InfoEntity; ++ ++ mpd_InfoEntity *mpd_newInfoEntity(void); ++ ++ void mpd_freeInfoEntity(mpd_InfoEntity * entity); ++ ++/* INFO COMMANDS AND STUFF */ ++ ++/* use this function to loop over after calling Info/Listall functions */ ++ mpd_InfoEntity *mpd_getNextInfoEntity(mpd_Connection * connection); ++ ++/* fetches the currently seeletect song (the song referenced by status->song ++ * and status->songid*/ ++ void mpd_sendCurrentSongCommand(mpd_Connection * connection); ++ ++/* songNum of -1, means to display the whole list */ ++ void mpd_sendPlaylistInfoCommand(mpd_Connection * connection, int songNum); ++ ++/* songId of -1, means to display the whole list */ ++ void mpd_sendPlaylistIdCommand(mpd_Connection * connection, int songId); ++ ++/* use this to get the changes in the playlist since version _playlist_ */ ++ void mpd_sendPlChangesCommand(mpd_Connection * connection, long long playlist); ++ ++/** ++ * @param connection: A valid and connected mpd_Connection. ++ * @param playlist: The playlist version you want the diff with. ++ * A more bandwidth efficient version of the mpd_sendPlChangesCommand. ++ * It only returns the pos+id of the changes song. ++ */ ++ void mpd_sendPlChangesPosIdCommand(mpd_Connection * connection, long long playlist); ++ ++/* recursivel fetches all songs/dir/playlists in "dir* (no metadata is ++ * returned) */ ++ void mpd_sendListallCommand(mpd_Connection * connection, const char *dir); ++ ++/* same as sendListallCommand, but also metadata is returned */ ++ void mpd_sendListallInfoCommand(mpd_Connection * connection, const char *dir); ++ ++/* non-recursive version of ListallInfo */ ++ void mpd_sendLsInfoCommand(mpd_Connection * connection, const char *dir); ++ ++#define MPD_TABLE_ARTIST MPD_TAG_ITEM_ARTIST ++#define MPD_TABLE_ALBUM MPD_TAG_ITEM_ALBUM ++#define MPD_TABLE_TITLE MPD_TAG_ITEM_TITLE ++#define MPD_TABLE_FILENAME MPD_TAG_ITEM_FILENAME ++ ++ void mpd_sendSearchCommand(mpd_Connection * connection, int table, const char *str); ++ ++ void mpd_sendFindCommand(mpd_Connection * connection, int table, const char *str); ++ ++/* LIST TAG COMMANDS */ ++ ++/* use this function fetch next artist entry, be sure to free the returned ++ * string. NULL means there are no more. Best used with sendListArtists ++ */ ++ char *mpd_getNextArtist(mpd_Connection * connection); ++ ++ char *mpd_getNextAlbum(mpd_Connection * connection); ++ ++ char *mpd_getNextTag(mpd_Connection * connection, int type); ++ ++/* list artist or albums by artist, arg1 should be set to the artist if ++ * listing albums by a artist, otherwise NULL for listing all artists or albums ++ */ ++ void mpd_sendListCommand(mpd_Connection * connection, int table, const char *arg1); ++ ++/* SIMPLE COMMANDS */ ++ ++ void mpd_sendAddCommand(mpd_Connection * connection, const char *file); ++ ++ int mpd_sendAddIdCommand(mpd_Connection * connection, const char *file); ++ ++ void mpd_sendDeleteCommand(mpd_Connection * connection, int songNum); ++ ++ void mpd_sendDeleteIdCommand(mpd_Connection * connection, int songNum); ++ ++ void mpd_sendSaveCommand(mpd_Connection * connection, const char *name); ++ ++ void mpd_sendLoadCommand(mpd_Connection * connection, const char *name); ++ ++ void mpd_sendRmCommand(mpd_Connection * connection, const char *name); ++ ++ void mpd_sendRenameCommand(mpd_Connection * connection, const char *from, const char *to); ++ ++ void mpd_sendShuffleCommand(mpd_Connection * connection); ++ ++ void mpd_sendClearCommand(mpd_Connection * connection); ++ ++/* use this to start playing at the beginning, useful when in random mode */ ++#define MPD_PLAY_AT_BEGINNING -1 ++ ++ void mpd_sendPlayCommand(mpd_Connection * connection, int songNum); ++ ++ void mpd_sendPlayIdCommand(mpd_Connection * connection, int songNum); ++ ++ void mpd_sendStopCommand(mpd_Connection * connection); ++ ++ void mpd_sendPauseCommand(mpd_Connection * connection, int pauseMode); ++ ++ void mpd_sendNextCommand(mpd_Connection * connection); ++ ++ void mpd_sendPrevCommand(mpd_Connection * connection); ++ ++ void mpd_sendMoveCommand(mpd_Connection * connection, int from, int to); ++ ++ void mpd_sendMoveIdCommand(mpd_Connection * connection, int from, int to); ++ ++ void mpd_sendSwapCommand(mpd_Connection * connection, int song1, int song2); ++ ++ void mpd_sendSwapIdCommand(mpd_Connection * connection, int song1, int song2); ++ ++ void mpd_sendSeekCommand(mpd_Connection * connection, int song, int time); ++ ++ void mpd_sendSeekIdCommand(mpd_Connection * connection, int song, int time); ++ ++ void mpd_sendRepeatCommand(mpd_Connection * connection, int repeatMode); ++ ++ void mpd_sendRandomCommand(mpd_Connection * connection, int randomMode); ++ ++ void mpd_sendSetvolCommand(mpd_Connection * connection, int volumeChange); ++ ++/* WARNING: don't use volume command, its depreacted */ ++ void mpd_sendVolumeCommand(mpd_Connection * connection, int volumeChange); ++ ++ void mpd_sendCrossfadeCommand(mpd_Connection * connection, int seconds); ++ ++ void mpd_sendUpdateCommand(mpd_Connection * connection, char *path); ++ ++/* returns the update job id, call this after a update command*/ ++ int mpd_getUpdateId(mpd_Connection * connection); ++ ++ void mpd_sendPasswordCommand(mpd_Connection * connection, const char *pass); ++ ++/* after executing a command, when your done with it to get its status ++ * (you want to check connection->error for an error) ++ */ ++ void mpd_finishCommand(mpd_Connection * connection); ++ ++/* command list stuff, use this to do things like add files very quickly */ ++ void mpd_sendCommandListBegin(mpd_Connection * connection); ++ ++ void mpd_sendCommandListOkBegin(mpd_Connection * connection); ++ ++ void mpd_sendCommandListEnd(mpd_Connection * connection); ++ ++/* advance to the next listOk ++ * returns 0 if advanced to the next list_OK, ++ * returns -1 if it advanced to an OK or ACK */ ++ int mpd_nextListOkCommand(mpd_Connection * connection); ++ ++ typedef struct _mpd_OutputEntity { ++ int id; ++ char *name; ++ int enabled; ++ } mpd_OutputEntity; ++ ++ void mpd_sendOutputsCommand(mpd_Connection * connection); ++ ++ mpd_OutputEntity *mpd_getNextOutput(mpd_Connection * connection); ++ ++ void mpd_sendEnableOutputCommand(mpd_Connection * connection, int outputId); ++ ++ void mpd_sendDisableOutputCommand(mpd_Connection * connection, int outputId); ++ ++ void mpd_freeOutputElement(mpd_OutputEntity * output); ++ ++/** ++ * @param connection a #mpd_Connection ++ * ++ * Queries mpd for the allowed commands ++ */ ++ void mpd_sendCommandsCommand(mpd_Connection * connection); ++ ++/** ++ * @param connection a #mpd_Connection ++ * ++ * Queries mpd for the not allowed commands ++ */ ++ void mpd_sendNotCommandsCommand(mpd_Connection * connection); ++ ++/** ++ * @param connection a #mpd_Connection ++ * ++ * returns the next supported command. ++ * ++ * @returns a string, needs to be free'ed ++ */ ++ char *mpd_getNextCommand(mpd_Connection * connection); ++ ++ void mpd_sendUrlHandlersCommand(mpd_Connection * connection); ++ ++ char *mpd_getNextHandler(mpd_Connection * connection); ++ ++ void mpd_sendTagTypesCommand(mpd_Connection * connection); ++ ++ char *mpd_getNextTagType(mpd_Connection * connection); ++ ++/** ++ * @param connection a MpdConnection ++ * @param path the path to the playlist. ++ * ++ * List the content, with full metadata, of a stored playlist. ++ * ++ */ ++ void mpd_sendListPlaylistInfoCommand(mpd_Connection * connection, char *path); ++ ++/** ++ * @param connection a MpdConnection ++ * @param path the path to the playlist. ++ * ++ * List the content of a stored playlist. ++ * ++ */ ++ void mpd_sendListPlaylistCommand(mpd_Connection * connection, char *path); ++ ++/** ++ * @param connection a #mpd_Connection ++ * @param exact if to match exact ++ * ++ * starts a search, use mpd_addConstraintSearch to add ++ * a constraint to the search, and mpd_commitSearch to do the actual search ++ */ ++ void mpd_startSearch(mpd_Connection * connection, int exact); ++ ++/** ++ * @param connection a #mpd_Connection ++ * @param type ++ * @param name ++ */ ++ void mpd_addConstraintSearch(mpd_Connection * connection, int type, const char *name); ++ ++/** ++ * @param connection a #mpd_Connection ++ */ ++ void mpd_commitSearch(mpd_Connection * connection); ++ ++/** ++ * @param connection a #mpd_Connection ++ * @param type The type to search for ++ * ++ * starts a search for fields... f.e. get a list of artists would be: ++ * @code ++ * mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST); ++ * mpd_commitSearch(connection); ++ * @endcode ++ * ++ * or get a list of artist in genre "jazz" would be: ++ * @code ++ * mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST); ++ * mpd_addConstraintSearch(connection, MPD_TAG_ITEM_GENRE, "jazz") ++ * mpd_commitSearch(connection); ++ * @endcode ++ * ++ * mpd_startSearch will return a list of songs (and you need mpd_getNextInfoEntity) ++ * this one will return a list of only one field (the one specified with type) and you need ++ * mpd_getNextTag to get the results ++ */ ++ void mpd_startFieldSearch(mpd_Connection * connection, int type); ++ ++ void mpd_startPlaylistSearch(mpd_Connection * connection, int exact); ++ ++ void mpd_startStatsSearch(mpd_Connection * connection); ++ ++ void mpd_sendPlaylistClearCommand(mpd_Connection * connection, char *path); ++ ++ void mpd_sendPlaylistAddCommand(mpd_Connection * connection, char *playlist, char *path); ++ ++ void mpd_sendPlaylistMoveCommand(mpd_Connection * connection, char *playlist, int from, int to); ++ ++ void mpd_sendPlaylistDeleteCommand(mpd_Connection * connection, char *playlist, int pos); ++#ifdef __cplusplus ++} ++#endif ++#endif diff --git a/utils/lcd4linux/patches/160-uinput_defs.patch b/utils/lcd4linux/patches/160-uinput_defs.patch new file mode 100644 index 0000000..44b24b3 --- /dev/null +++ b/utils/lcd4linux/patches/160-uinput_defs.patch @@ -0,0 +1,24 @@ +--- a/drv_G15.c ++++ b/drv_G15.c +@@ -42,6 +42,7 @@ + + #include + #include ++#include + #include + #include + +@@ -269,8 +270,13 @@ void drv_G15_initKeyHandling(char *devic + } + memset(&device, 0, sizeof(device)); + strncpy(device.name, "G15 Keys", UINPUT_MAX_NAME_SIZE); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + device.id.bustype = BUS_USB; + device.id.version = 4; ++#else ++ device.idbus = BUS_USB; ++ device.idversion = 4; ++#endif + + ioctl(uinput_fd, UI_SET_EVBIT, EV_KEY); + diff --git a/utils/lcd4linux/patches/170-add-generic-spidev-driver.patch b/utils/lcd4linux/patches/170-add-generic-spidev-driver.patch new file mode 100644 index 0000000..4cd53d6 --- /dev/null +++ b/utils/lcd4linux/patches/170-add-generic-spidev-driver.patch @@ -0,0 +1,195 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -71,6 +71,8 @@ drv_generic_i2c.c \ + drv_generic_i2c.h \ + drv_generic_keypad.c \ + drv_generic_keypad.h \ ++drv_generic_spidev.c \ ++drv_generic_spidev.h \ + drv_ASTUSB.c \ + drv_BeckmannEgle.c \ + drv_BWCT.c \ +--- /dev/null ++++ b/drv_generic_spidev.c +@@ -0,0 +1,89 @@ ++/* $Id$ ++ * $URL$ ++ * ++ * generic driver helper for displays connected via SPI bus ++ * ++ * Copyright (C) 2012 Gabor Juhos ++ * ++ * This file is part of LCD4Linux. ++ * ++ * LCD4Linux is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * LCD4Linux is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ * ++ */ ++ ++#include "config.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "debug.h" ++#include "qprintf.h" ++#include "cfg.h" ++#include "drv_generic_spidev.h" ++ ++static char *generic_spidev_section = ""; ++static char *generic_spidev_driver = ""; ++static int generic_spidev_fd; ++ ++int drv_generic_spidev_open(const char *section, const char *driver) ++{ ++ char *spidev; ++ ++ udelay_init(); ++ ++ generic_spidev_section = (char *) section; ++ generic_spidev_driver = (char *) driver; ++ ++ spidev = cfg_get(generic_spidev_section, "Port", NULL); ++ ++ info("%s: initializing SPI device %s", generic_spidev_driver, spidev); ++ generic_spidev_fd = open(spidev, O_WRONLY); ++ if (generic_spidev_fd < 0) { ++ error("%s: unable to open SPI device %s!\n", generic_spidev_driver, spidev); ++ goto exit_error; ++ } ++ ++ return 0; ++ ++ exit_error: ++ free(spidev); ++ return -1; ++} ++ ++int drv_generic_spidev_close(void) ++{ ++ close(generic_spidev_fd); ++ return 0; ++} ++ ++int drv_generic_spidev_transfer(const int count, struct spi_ioc_transfer *tr) ++{ ++ int ret; ++ ++ ret = ioctl(generic_spidev_fd, SPI_IOC_MESSAGE(count), tr); ++ if (ret < count) { ++ error("%s: can't send SPI message! (%s)\n", ++ generic_spidev_driver, strerror(errno)); ++ return -1; ++ } ++ ++ return 0; ++} +--- /dev/null ++++ b/drv_generic_spidev.h +@@ -0,0 +1,54 @@ ++/* $Id$ ++ * $URL$ ++ * ++ * generic driver helper for displays connected via SPI bus ++ * ++ * Copyright (C) 2012 Gabor Juhos ++ * Copyright (C) 2012 The LCD4Linux Team ++ * ++ * This file is part of LCD4Linux. ++ * ++ * LCD4Linux is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * LCD4Linux is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ * ++ */ ++ ++/* ++ * ++ * exported fuctions: ++ * ++ * int drv_generic_spidev_open (const char *section, const char *driver) ++ * reads 'Port' entry from config and opens ++ * the SPI device ++ * returns 0 if ok, -1 on failure ++ * ++ * int drv_generic_spidev_close (void) ++ * closes SPI device ++ * returns 0 if ok, -1 on failure ++ * ++ * void drv_generic_spidev_transfer (int count, struct spi_ioc_transfer *tr) ++ * transfer data to/from the SPI device ++ * ++ */ ++ ++#ifndef _DRV_GENERIC_SPIDEV_H_ ++#define _DRV_GENERIC_SPIDEV_H_ ++ ++#include ++ ++int drv_generic_spidev_open(const char *section, const char *driver); ++int drv_generic_spidev_close(void); ++int drv_generic_spidev_transfer(const int count, struct spi_ioc_transfer *tr); ++ ++#endif /* _DRV_GENERIC_SPIDEV_H_ */ +--- a/drivers.m4 ++++ b/drivers.m4 +@@ -301,6 +301,7 @@ PARPORT="no" + SERIAL="no" + I2C="no" + KEYPAD="no" ++SPIDEV="no" + + # generic libraries + LIBUSB="no" +@@ -936,6 +937,12 @@ if test "$LIBJPEG" = "yes"; then + DRVLIBS="$DRVLIBS -ljpeg" + fi + ++# generic spidev driver ++if test "$SPIDEV" = "yes"; then ++ DRIVERS="$DRIVERS drv_generic_spidev.o" ++ AC_DEFINE(WITH_SPIDEV, 1, [SPIDEV driver]) ++fi ++ + # libusb + if test "$LIBUSB" = "yes"; then + DRVLIBS="$DRVLIBS -lusb" +--- a/configure.ac ++++ b/configure.ac +@@ -115,6 +115,9 @@ AC_ARG_WITH(outb, + + AC_CHECK_HEADERS([asm/io.h] [linux/parport.h linux/ppdev.h], [has_parport="true"], [has_parport="false"]) + ++# check for spidev ++AC_CHECK_HEADERS([linux/spi/spidev.h], [has_spidev="true"], [has_spidev="false"]) ++ + # drivers + sinclude(drivers.m4) + diff --git a/utils/lcd4linux/patches/171-allow-to-specify-drv_generic_graphic_real_clear.patch b/utils/lcd4linux/patches/171-allow-to-specify-drv_generic_graphic_real_clear.patch new file mode 100644 index 0000000..5a26643 --- /dev/null +++ b/utils/lcd4linux/patches/171-allow-to-specify-drv_generic_graphic_real_clear.patch @@ -0,0 +1,45 @@ +--- a/drv_generic_graphic.c ++++ b/drv_generic_graphic.c +@@ -24,7 +24,7 @@ + * + */ + +-/* ++/* + * + * exported functions: + * +@@ -98,6 +98,9 @@ static int INVERTED = 0; + /* must be implemented by the real driver */ + void (*drv_generic_graphic_real_blit) () = NULL; + ++/* can be implemented by the real driver */ ++void (*drv_generic_graphic_real_clear) () = NULL; ++ + + /****************************************/ + /*** generic Framebuffer stuff ***/ +@@ -691,7 +694,10 @@ int drv_generic_graphic_clear(void) + for (i = 0; i < LCOLS * LROWS; i++) + drv_generic_graphic_FB[l][i] = NO_COL; + +- drv_generic_graphic_blit(0, 0, LROWS, LCOLS); ++ if (drv_generic_graphic_real_clear) ++ drv_generic_graphic_real_clear(NO_COL); ++ else ++ drv_generic_graphic_blit(0, 0, LROWS, LCOLS); + + return 0; + } +--- a/drv_generic_graphic.h ++++ b/drv_generic_graphic.h +@@ -40,6 +40,9 @@ extern RGBA NO_COL; /* no color (comple + /* these functions must be implemented by the real driver */ + extern void (*drv_generic_graphic_real_blit) (const int row, const int col, const int height, const int width); + ++/* these functions can be implemented by the real driver */ ++void (*drv_generic_graphic_real_clear) (const RGBA rgba); ++ + /* helper function to get pixel color or gray value */ + extern RGBA drv_generic_graphic_rgb(const int row, const int col); + extern unsigned char drv_generic_graphic_gray(const int row, const int col); diff --git a/utils/lcd4linux/patches/172-add-TEW673GRU-driver.patch b/utils/lcd4linux/patches/172-add-TEW673GRU-driver.patch new file mode 100644 index 0000000..428465c --- /dev/null +++ b/utils/lcd4linux/patches/172-add-TEW673GRU-driver.patch @@ -0,0 +1,552 @@ +--- a/drivers.m4 ++++ b/drivers.m4 +@@ -39,7 +39,7 @@ AC_ARG_WITH( + [ Newhaven, Noritake, NULL, Pertelian, PHAnderson,] + [ PICGraphic, picoLCD, picoLCDGraphic, PNG, PPM, RouterBoard,] + [ Sample, SamsungSPF, serdisplib, ShuttleVFD, SimpleLCD, st2205, T6963,] +- [ TeakLCM, Trefon, ULA200, USBHUB, USBLCD, VNC, WincorNixdorf, X11], ++ [ TeakLCM, TEW673GRU, Trefon, ULA200, USBHUB, USBLCD, VNC, WincorNixdorf, X11], + drivers=$withval, + drivers=all + ) +@@ -107,6 +107,7 @@ for driver in $drivers; do + SHUTTLEVFD="yes" + SIMPLELCD="yes" + T6963="yes" ++ TEW673GRU="yes" + TeakLCM="yes" + Trefon="yes" + ULA200="yes" +@@ -260,6 +261,9 @@ for driver in $drivers; do + TeakLCM) + TeakLCM=$val + ;; ++ TEW673GRU) ++ TEW673GRU=$val ++ ;; + Trefon) + Trefon=$val + ;; +@@ -797,6 +801,18 @@ if test "$TeakLCM" = "yes"; then + AC_DEFINE(WITH_TEAK_LCM,1,[TeakLCM driver]) + fi + ++if test "$TEW673GRU" = "yes"; then ++ if test "$has_spidev" = "true"; then ++ GRAPHIC="yes" ++ TEXT="yes" ++ SPIDEV="yes" ++ DRIVERS="$DRIVERS drv_TEW673GRU.o" ++ AC_DEFINE(WITH_TEW673GRU,1,[TEW673GRU driver]) ++ else ++ AC_MSG_WARN(linux/spi/spidev.h not found: TEW673GRU driver disabled) ++ fi ++fi ++ + if test "$Trefon" = "yes"; then + if test "$has_usb" = "true"; then + TEXT="yes" +--- a/drv.c ++++ b/drv.c +@@ -92,6 +92,7 @@ extern DRIVER drv_serdisplib; + extern DRIVER drv_ShuttleVFD; + extern DRIVER drv_SimpleLCD; + extern DRIVER drv_T6963; ++extern DRIVER drv_TEW673GRU; + extern DRIVER drv_TeakLCM; + extern DRIVER drv_Trefon; + extern DRIVER drv_ula200; +@@ -248,6 +249,9 @@ DRIVER *Driver[] = { + #ifdef WITH_TEAK_LCM + &drv_TeakLCM, + #endif ++#ifdef WITH_TEW673GRU ++ &drv_TEW673GRU, ++#endif + #ifdef WITH_TREFON + &drv_Trefon, + #endif +--- a/Makefile.am ++++ b/Makefile.am +@@ -119,6 +119,7 @@ drv_ShuttleVFD.c \ + drv_SimpleLCD.c \ + drv_T6963.c \ + drv_TeakLCM.c \ ++drv_TEW673GRU.c \ + drv_Trefon.c \ + drv_ula200.c \ + drv_USBHUB.c \ +--- /dev/null ++++ b/drv_TEW673GRU.c +@@ -0,0 +1,457 @@ ++/* $Id$ ++ * $URL$ ++ * ++ * TRENDnet TEW673GRU LCD4linux driver ++ * ++ * Copyright (C) 2012 Gabor Juhos ++ * ++ * based on the Sample driver which is: ++ * Copyright (C) 2005 Michael Reinelt ++ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team ++ * ++ * This file is part of LCD4Linux. ++ * ++ * LCD4Linux is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * LCD4Linux is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ * ++ */ ++ ++/* ++ * exported fuctions: ++ * ++ * struct DRIVER drv_TEW673GRU ++ */ ++ ++#include "config.h" ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "debug.h" ++#include "cfg.h" ++#include "qprintf.h" ++#include "udelay.h" ++#include "plugin.h" ++#include "widget.h" ++#include "widget_text.h" ++#include "widget_icon.h" ++#include "widget_bar.h" ++#include "drv.h" ++ ++#include "drv_generic_text.h" ++#include "drv_generic_graphic.h" ++#include "drv_generic_spidev.h" ++ ++#ifdef WITH_DMALLOC ++#include ++#endif ++ ++#define TEW673GRU_NUM_COLS 220 ++#define TEW673GRU_NUM_ROWS 176 ++#define TEW673GRU_BPP 2 /* bytes per pixel */ ++ ++#define TEW673GRU_CMD_SIZE 9 ++#define TEW673GRU_NUM_ROW_BYTES (TEW673GRU_NUM_COLS * TEW673GRU_BPP) ++ ++enum { ++ CMD_SHOW_STRING = 49, ++ CMD_SHOW_IMAGE_DIR = 52, ++ CMD_SCREEN_COLOR = 54, ++}; ++ ++static char Name[] = "TEW673GRU"; ++ ++static char *drv_TEW673GRU_FB; ++static long FB_SIZE; ++static int MODE; ++ ++static unsigned int RGBAto16(RGBA rgb) ++{ ++ return (((rgb.R >> 3) << 11) | ((rgb.G >> 2) << 5) | (rgb.B >> 3)); ++} ++ ++static unsigned char color_msb(unsigned int color) ++{ ++ return color >> 8; ++} ++ ++static unsigned char color_lsb(unsigned int color) ++{ ++ return color & 0xff; ++} ++ ++static void drv_TEW673GRU_hw_clear(const unsigned int color) ++{ ++ unsigned char cmd[TEW673GRU_CMD_SIZE]; ++ struct spi_ioc_transfer tr[1]; ++ ++ memset(tr, '\0', sizeof(tr)); ++ memset(cmd, '\0', sizeof(cmd)); ++ ++ cmd[0] = CMD_SCREEN_COLOR; ++ cmd[7] = color_msb(color); ++ cmd[8] = color_lsb(color); ++ ++ tr[0].tx_buf = (unsigned long) cmd; ++ tr[0].len = sizeof(cmd); ++ ++ drv_generic_spidev_transfer(1, tr); ++} ++ ++static void drv_TEW673GRU_hw_send_row(const int row, const int col, const char *data, const int width) ++{ ++ unsigned char cmd[TEW673GRU_CMD_SIZE]; ++ struct spi_ioc_transfer tr[2]; ++ int datasize; ++ ++ memset(tr, '\0', sizeof(tr)); ++ memset(cmd, '\0', sizeof(cmd)); ++ ++ datasize = width * TEW673GRU_BPP; ++ ++ cmd[0] = CMD_SHOW_IMAGE_DIR; ++ cmd[1] = col; ++ cmd[2] = col + width; ++ cmd[3] = row; ++ cmd[4] = row; ++ cmd[5] = datasize >> 8; ++ cmd[6] = datasize & 0xff; ++ ++ tr[0].tx_buf = (unsigned long) cmd; ++ tr[0].len = sizeof(cmd); ++ tr[1].tx_buf = (unsigned long) data; ++ tr[1].len = datasize; ++ ++ drv_generic_spidev_transfer(2, tr); ++} ++ ++static void drv_TEW673GRU_hw_write_string(const int row, const int col, const char *data, const int datasize) ++{ ++ unsigned char cmd[TEW673GRU_CMD_SIZE]; ++ struct spi_ioc_transfer tr[2]; ++ unsigned char len; ++ ++ memset(tr, '\0', sizeof(tr)); ++ memset(cmd, '\0', sizeof(cmd)); ++ ++ len = datasize & 0xff; ++ cmd[0] = CMD_SHOW_STRING; ++ cmd[1] = col; ++ cmd[2] = col + (XRES * len); ++ cmd[3] = row; ++ cmd[4] = row + YRES; ++ cmd[7] = 0; ++ cmd[8] = len; ++ ++ tr[0].tx_buf = (unsigned long) cmd; ++ tr[0].len = sizeof(cmd); ++ tr[1].tx_buf = (unsigned long) data; ++ tr[1].len = datasize; ++ ++ drv_generic_spidev_transfer(2, tr); ++} ++ ++static void drv_TEW673GRU_FB_set_pixel(const int col, const unsigned int color) ++{ ++ int pos; ++ ++ pos = col * TEW673GRU_BPP; ++ drv_TEW673GRU_FB[pos] = color_msb(color); ++ drv_TEW673GRU_FB[pos + 1] = color_lsb(color); ++} ++ ++static void drv_TEW673GRU_blit(const int row, const int col, const int height, const int width) ++{ ++ int r, c; ++ ++ debug("%s: update area r:%d c:%d w:%d h:%d", Name, row, col, height, width); ++ ++ for (r = row; r < row + height; r++) { ++ for (c = col; c < col + width; c++) { ++ unsigned int color; ++ RGBA rgb; ++ ++ rgb = drv_generic_graphic_rgb(r, c); ++ color = RGBAto16(rgb); ++ drv_TEW673GRU_FB_set_pixel(c, color); ++ } ++ ++ if (width) { ++ char *data; ++ ++ data = &drv_TEW673GRU_FB[col * TEW673GRU_BPP]; ++ drv_TEW673GRU_hw_send_row(r, col, data, width); ++ udelay(100 + width * 50); ++ } ++ } ++} ++ ++static void drv_TEW673GRU_clear(RGBA rgba) ++{ ++ unsigned int color; ++ ++ color = RGBAto16(rgba); ++ drv_TEW673GRU_hw_clear(color); ++} ++ ++static void drv_TEW673GRU_write(const int row, const int col, const char *data, const int len) ++{ ++ int i; ++ ++ for (i = 0; i < len; i++) { ++ drv_TEW673GRU_hw_write_string(row * YRES, (col + i) * XRES, " ", 1); ++ udelay(10000); ++ drv_TEW673GRU_hw_write_string(row * YRES, 2 + (col + i) * XRES, " ", 1); ++ udelay(10000); ++ drv_TEW673GRU_hw_write_string(row * YRES, (col + i) * XRES, &data[i], 1); ++ udelay(10000); ++ } ++} ++ ++static int drv_TEW673GRU_open(const char *section) ++{ ++ int err; ++ ++ err = drv_generic_spidev_open(section, Name); ++ if (err < 0) ++ return err; ++ ++ return 0; ++} ++ ++static int drv_TEW673GRU_close(void) ++{ ++ drv_generic_spidev_close(); ++ return 0; ++} ++ ++static void drv_TEW673GRU_clear_screen(void) ++{ ++ if (MODE) { ++ drv_generic_graphic_clear(); ++ } else { ++ memset(drv_TEW673GRU_FB, ' ', FB_SIZE); ++ drv_TEW673GRU_hw_clear(0x0000); ++ } ++} ++ ++static int drv_TEW673GRU_init_font(const char *section) ++{ ++ char *font; ++ int ret = -1; ++ ++ font = cfg_get(section, "Font", "6x8"); ++ if (font == NULL) { ++ error("%s: no '%s.Font' entry from %s", Name, section, cfg_source()); ++ goto out; ++ } ++ ++ if (*font == '\0') { ++ error("%s: invalid '%s.Font' entry in %s", Name, section, cfg_source()); ++ goto out_free; ++ } ++ ++ XRES = -1; ++ YRES = -1; ++ if (sscanf(font, "%dx%d", &XRES, &YRES) != 2 || ++ XRES < 1 || ++ YRES < 1) { ++ error("%s: bad Font '%s' from %s", Name, font, cfg_source()); ++ goto out_free; ++ } ++ ++ if (XRES != 6 && YRES != 8) { ++ error("%s: bad Font '%s' from %s (only 6x8 at the moment)", ++ Name, font, cfg_source()); ++ goto out_free; ++ } ++ ++ error("%s: font '%s' selected", Name, font); ++ ++ ret = 0; ++ ++out_free: ++ free(font); ++out: ++ return ret; ++} ++ ++static int drv_TEW673GRU_start(const char *section) ++{ ++ int ret; ++ ++ DCOLS = TEW673GRU_NUM_COLS; ++ DROWS = TEW673GRU_NUM_ROWS; ++ ++ if (MODE) { ++ ret = drv_TEW673GRU_init_font(section); ++ if (ret) ++ goto err; ++ ++ FB_SIZE = DCOLS * TEW673GRU_BPP; ++ } else { ++ XRES = 10; ++ YRES = 16; ++ DCOLS = DCOLS / XRES; ++ DROWS = DROWS / YRES; ++ ++ FB_SIZE = DCOLS * DROWS; ++ } ++ ++ if (FB_SIZE) { ++ drv_TEW673GRU_FB = malloc(FB_SIZE); ++ if (drv_TEW673GRU_FB == NULL) { ++ error("%s: framebuffer could not be allocated", Name); ++ goto err; ++ } ++ } ++ ++ ret = drv_TEW673GRU_open(section); ++ if (ret < 0) ++ goto err_free; ++ ++ if (MODE == 0) ++ drv_TEW673GRU_clear_screen(); ++ ++ return 0; ++ ++ err_free: ++ if (drv_TEW673GRU_FB) ++ free(drv_TEW673GRU_FB); ++ err: ++ return -1; ++} ++ ++static int drv_TEW673GRU_greet(const char *msg1, const char *msg2) ++{ ++ if (MODE) ++ return drv_generic_graphic_greet(msg1, msg2); ++ ++ return drv_generic_text_greet(msg1, msg2); ++} ++ ++ ++/****************************************/ ++/*** widget callbacks ***/ ++/****************************************/ ++ ++ ++/* using drv_generic_text_draw(W) */ ++/* using drv_generic_text_icon_draw(W) */ ++/* using drv_generic_text_bar_draw(W) */ ++/* using drv_generic_gpio_draw(W) */ ++ ++ ++/****************************************/ ++/*** exported functions ***/ ++/****************************************/ ++ ++int drv_TEW673GRU_list(void) ++{ ++ printf("TEW673GRU driver"); ++ return 0; ++} ++ ++int drv_TEW673GRU_init(const char *section, const int quiet) ++{ ++ WIDGET_CLASS wc; ++ int ret; ++ ++ cfg_number(section, "Mode", 0, 0, 1, &MODE); ++ ++ if (MODE) { ++ drv_generic_graphic_real_blit = drv_TEW673GRU_blit; ++ drv_generic_graphic_real_clear = drv_TEW673GRU_clear; ++ } else { ++ drv_generic_text_real_write = drv_TEW673GRU_write; ++ } ++ ++ ret = drv_TEW673GRU_start(section); ++ if (ret) ++ return ret; ++ ++ if (MODE) { ++ ret = drv_generic_graphic_init(section, Name); ++ if (ret) ++ return ret; ++ } else { ++ ret = drv_generic_text_init(section, Name); ++ if (ret) ++ return ret; ++ ++ ret = drv_generic_text_icon_init(); ++ if (ret != 0) ++ return ret; ++ ++ ret = drv_generic_text_bar_init(1); ++ if (ret != 0) ++ return ret; ++ ++ drv_generic_text_bar_add_segment(0, 0, 255, ' '); ++ drv_generic_text_bar_add_segment(255, 255, 255, '#'); ++ ++ wc = Widget_Text; ++ wc.draw = drv_generic_text_draw; ++ widget_register(&wc); ++ ++ wc = Widget_Icon; ++ wc.draw = drv_generic_text_icon_draw; ++ widget_register(&wc); ++ ++ wc = Widget_Bar; ++ wc.draw = drv_generic_text_bar_draw; ++ widget_register(&wc); ++ } ++ ++ if (!quiet) { ++ char buffer[40]; ++ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS); ++ drv_TEW673GRU_greet(buffer, "www.openwrt.org"); ++ sleep(3); ++ drv_TEW673GRU_clear_screen(); ++ } ++ ++ return 0; ++} ++ ++int drv_TEW673GRU_quit(const int quiet) ++{ ++ ++ info("%s: shutting down.", Name); ++ ++ drv_TEW673GRU_clear_screen(); ++ ++ if (!quiet) ++ drv_TEW673GRU_greet("goodbye!", NULL); ++ ++ if (MODE) ++ drv_generic_graphic_quit(); ++ else ++ drv_generic_text_quit(); ++ ++ debug("closing connection"); ++ drv_TEW673GRU_close(); ++ ++ return (0); ++} ++ ++DRIVER drv_TEW673GRU = { ++ .name = Name, ++ .list = drv_TEW673GRU_list, ++ .init = drv_TEW673GRU_init, ++ .quit = drv_TEW673GRU_quit, ++}; +--- a/lcd4linux.conf.sample ++++ b/lcd4linux.conf.sample +@@ -581,6 +581,11 @@ Display FutabaVFD { + } + } + ++Display TEW673GRU { ++ Driver 'TEW673GRU' ++ Font '6x8' ++ Port '/dev/spidev1.0' ++} + + #Plugin KVV { + # StationID '12_701' diff --git a/utils/lcd4linux/patches/173-glcd2usb-bigendian-fix.patch b/utils/lcd4linux/patches/173-glcd2usb-bigendian-fix.patch new file mode 100644 index 0000000..97e03c7 --- /dev/null +++ b/utils/lcd4linux/patches/173-glcd2usb-bigendian-fix.patch @@ -0,0 +1,20 @@ +--- a/drv_GLCD2USB.c ++++ b/drv_GLCD2USB.c +@@ -48,6 +48,7 @@ + #include + #include + #include ++#include + + #include "debug.h" + #include "cfg.h" +@@ -487,6 +488,9 @@ static int drv_GLCD2USB_start(const char + return -1; + } + ++ buffer.display_info.width = le16toh(buffer.display_info.width); ++ buffer.display_info.height = le16toh(buffer.display_info.height); ++ + info("%s: display name = %s", Name, buffer.display_info.name); + info("%s: display resolution = %d * %d", Name, buffer.display_info.width, buffer.display_info.height); + info("%s: display flags: %x", Name, buffer.display_info.flags); diff --git a/utils/less/Makefile b/utils/less/Makefile new file mode 100644 index 0000000..2e79e8e --- /dev/null +++ b/utils/less/Makefile @@ -0,0 +1,93 @@ +# +# Copyright (C) 2010-2015 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:=less +PKG_VERSION:=481 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.greenwoodsoftware.com/less +PKG_MD5SUM:=50ef46065c65257141a7340123527767 + +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Julen Landa Alustiza + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/less/Default + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Pager program similar to more + URL:=http://www.greenwoodsoftware.com/less/ +endef + +define Package/less/Default/description + Full version of GNU less utility +endef + +define Package/less + $(call Package/less/Default) + DEPENDS:=+libncurses + VARIANT:=narrow +endef + +define Package/less/description + $(call Package/less/Default/description) +endef + +define Package/less-wide + $(call Package/less/Default) + TITLE+= (Unicode) + DEPENDS:=+libncursesw + VARIANT:=wide +endef + +define Package/less-wide/description + $(call Package/less/Default/description) + This package contains the Unicode enabled version of less. +endef + +ifeq ($(BUILD_VARIANT),narrow) + CONFIGURE_VARS += \ + ac_cv_lib_ncursesw_initscr=no +endif + +ifeq ($(BUILD_VARIANT),wide) + CONFIGURE_VARS += \ + ac_cv_lib_ncursesw_initscr=yes +endif + +define Package/less/install + $(INSTALL_DIR) $(1)/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/less $(1)/bin/less +endef + +define Package/less/postinst +#!/bin/sh +[ -L "$${IPKG_INSTROOT}/usr/bin/less" ] && rm -f "$${IPKG_INSTROOT}/usr/bin/less" +exit 0 +endef + +define Package/less/postrm +#!/bin/sh +/bin/busybox less -h 2>&1 | grep -q BusyBox && ln -sf ../../bin/busybox /usr/bin/less +exit 0 +endef + +Package/less-wide/install = $(Package/less/install) +Package/less-wide/postinst = $(Package/less/postinst) +Package/less-wide/postrm = $(Package/less/postrm) + +$(eval $(call BuildPackage,less)) +$(eval $(call BuildPackage,less-wide)) diff --git a/utils/lm-sensors/Makefile b/utils/lm-sensors/Makefile new file mode 100644 index 0000000..b11349c --- /dev/null +++ b/utils/lm-sensors/Makefile @@ -0,0 +1,117 @@ +# +# Copyright (C) 2006-2015 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:=lm-sensors +PKG_VERSION:=3.3.5 +PKG_RELEASE:=3 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/groeck/lm-sensors.git +PKG_SOURCE_VERSION:=f8cdcc35bff0785aecf49d9a8484a71ce3ebee4f +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_MAINTAINER:=Jo-Philipp Wich +PKG_LICENSE:=GPL-2.0+ LGPL-2.1+ + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lm-sensors/Default + DEPENDS:=+sysfsutils + URL:=http://www.lm-sensors.org/ +endef + +define Package/lm-sensors + $(call Package/lm-sensors/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE:=lm-sensors + DEPENDS+=+libsensors +endef + +define Package/lm-sensors-detect + $(call Package/lm-sensors/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE:=lm-sensors-detect + DEPENDS+=+lm-sensors +perl +perlbase-essential +perlbase-fcntl +perlbase-file +perlbase-xsloader +endef + +define Package/libsensors + $(call Package/lm-sensors/Default) + SECTION:=libs + CATEGORY:=Libraries + TITLE:=libsensors +endef + +define Package/lm-sensors/description + utility to read hardware sensor data +endef + +define Package/lm-sensors-detect/description + script to autodetect sensor hardware +endef + +define Package/libsensors/description + lm-sensors libraries +endef + +define Package/lm-sensors/conffiles +/etc/sensors.conf +endef + +define Build/Compile + +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + KERNELVERSION="$(LINUX_VERSION)" \ + LINUX="$(LINUX_DIR)" \ + CC="$(TARGET_CC)" \ + CFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="$(TARGET_CPPFLAGS)" \ + STAGING_DIR="$(STAGING_DIR)" \ + PREFIX="/usr" \ + MACHINE="$(ARCH)" \ + EXLDFLAGS="" \ + user +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include/sensors + $(CP) \ + $(PKG_BUILD_DIR)/lib/sensors.h \ + $(1)/usr/include/sensors + $(INSTALL_DIR) $(1)/usr/lib + $(CP) \ + $(PKG_BUILD_DIR)/lib/libsensors.{a,so*} \ + $(1)/usr/lib +endef + +define Package/lm-sensors/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/prog/sensors/sensors $(1)/usr/sbin +ifeq ($(ARCH),i386) + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) ./files/sensors.conf $(1)/etc/sensors.conf +endif +endef + +define Package/lm-sensors-detect/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/prog/detect/sensors-detect $(1)/usr/sbin +endef + +define Package/libsensors/install + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/libsensors.so* $(1)/usr/lib +endef + +$(eval $(call BuildPackage,lm-sensors)) +$(eval $(call BuildPackage,lm-sensors-detect)) +$(eval $(call BuildPackage,libsensors)) diff --git a/utils/lm-sensors/files/sensors.conf b/utils/lm-sensors/files/sensors.conf new file mode 100644 index 0000000..505b9d9 --- /dev/null +++ b/utils/lm-sensors/files/sensors.conf @@ -0,0 +1,117 @@ +chip "pc87366-*" + +# Soekris net4801 configuration + +# Written by Henrik Brix Andersen +# Latest version can be found at http://www.brixandersen.dk/ + +# The configuration is partly based on the PC87366 datasheet and +# partly borrowed from the env4801 utility by Poul-Henning +# Kamp + +# Datasheet: http://www.winbond.com/PDF/APCsheet/PC87366.pdf +# env4801: http://phk.freebsd.dk/soekris/env4801/ + + +# Voltage inputs + ignore vid + + # Unknown + # label in0 "avi0" + ignore in0 + + + # Core Voltage, +2.0V + label in1 "VCORE" + set in1_min 1.9 + set in1_max 2.1 + + + # VCC, +5.0V + label in2 "VCC" + compute in2 @*2, @/2 + + + # Power Supply Input, +6.0V - +28.0V + label in3 "VPWR" + compute in3 @*20.1, @/20.1 + set in3_min 6.0 + set in3_max 28.0 + + + # +12V + label in4 "+12V" + compute in4 @*4.83, @/4.83 + set in4_min 11 + set in4_max 13 + + + # -12V + label in5 "-12V" + # If in10 on your net4801 doesn't have the 3.3V reference, use this + # compute line instead: + # compute in5 (@-3.3)*19.2+3.3, (@-3.3)/19.2+3.3 + compute in5 (@-in10)*19.2+in10, (@-in10)/19.2+in10 + set in5_min -13 + set in5_max -11 + + + # GND, 0V + label in6 "GND" + set in6_min 0 + set in6_max 0 + + + # Standby Voltage, +3.3V + # Internally divided by 2 + label in7 "Vsb" + compute in7 @*2, @/2 + set in7_min 3.0 + set in7_max 3.6 + + + # Supply Voltage, +3.3V + # Internally divided by 2 + label in8 "Vdd" + compute in8 @*2, @/2 + set in8_min 3.0 + set in8_max 3.6 + + + # Battery Backup Supply Voltage, +3.0V + label in9 "Vbat" + set in9_min 2.4 + set in9_max 3.6 + + + # Analog Supply Voltage, +3.3V + # Internally divided by 2 + label in10 "AVdd" + compute in10 @*2, @/2 + set in10_min 3.0 + set in10_max 3.6 + + +# Temperature inputs + ignore temp1 + ignore temp2 + + # PC87366 Internal Temperature + # PC87366 Recommended Operating Conditions: 0 - 70C + # SC1100 Recommended Operating Conditions: 0 - 85C + label temp3 "Temp" + label temp3_crit "Critical" + set temp3_min 0 + set temp3_max 70 + set temp3_crit 85 + + + ignore temp4 + ignore temp5 + ignore temp6 + + +# Fan inputs + ignore fan1 + ignore fan2 + ignore fan3 diff --git a/utils/lm-sensors/patches/100-musl-compat.patch b/utils/lm-sensors/patches/100-musl-compat.patch new file mode 100644 index 0000000..1cd82ab --- /dev/null +++ b/utils/lm-sensors/patches/100-musl-compat.patch @@ -0,0 +1,44 @@ +--- a/prog/dump/isadump.c ++++ b/prog/dump/isadump.c +@@ -38,7 +38,7 @@ + + + /* To keep glibc2 happy */ +-#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0 ++#if !defined(__UCLIBC__) + #include + #else + #include +--- a/prog/dump/isaset.c ++++ b/prog/dump/isaset.c +@@ -34,7 +34,7 @@ + + + /* To keep glibc2 happy */ +-#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0 ++#if !defined(__UCLIBC__) + #include + #else + #include +--- a/prog/dump/superio.c ++++ b/prog/dump/superio.c +@@ -21,7 +21,7 @@ + + #include + +-#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0 ++#if !defined(__UCLIBC__) + #include + #else + #include +--- a/prog/dump/util.c ++++ b/prog/dump/util.c +@@ -12,7 +12,7 @@ + #include "util.h" + + /* To keep glibc2 happy */ +-#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0 ++#if !defined(__UCLIBC__) + #include + #else + #include diff --git a/utils/logrotate/Makefile b/utils/logrotate/Makefile new file mode 100644 index 0000000..4823c59 --- /dev/null +++ b/utils/logrotate/Makefile @@ -0,0 +1,62 @@ +# +# Copyright (C) 2006-2016 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:=logrotate +PKG_VERSION:=3.10.0 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:= https://github.com/logrotate/logrotate/releases/download/$(PKG_VERSION) +PKG_MD5SUM:=888f58caf07082c76f5dd39e5d30ec12 +PKG_LICENSE:=GPL-2.0 + +include $(INCLUDE_DIR)/package.mk + +define Package/logrotate + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libpopt + TITLE:=rotates, compresses, and mails system logs + URL:=https://github.com/logrotate/logrotate + MAINTAINER:=Christian Beier +endef + +define Package/logrotate/description + logrotate is designed to ease administration of systems that generate large + numbers of log files. It allows auto-matic rotation, compression, removal and + mailing of log files. Each log file may be handled daily, weekly, monthly or + when it grows too large. +endef + +define Package/logrotate/conffiles +/etc/logrotate.conf +endef + +CONFIGURE_ARGS += --with-acl=no + +EXTRA_CFLAGS += $(TARGET_CPPFLAGS) -Wno-nonnull-compare +EXTRA_LDFLAGS += $(TARGET_LDFLAGS) + +define Build/Compile + $(call Build/Compile/Default, \ + RPM_OPT_FLAGS:="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \ + LDFLAGS="$(EXTRA_LDFLAGS)" \ + logrotate \ + ) +endef + +define Package/logrotate/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) ${PKG_BUILD_DIR}/logrotate $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) ./files/logrotate.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/logrotate.d +endef + +$(eval $(call BuildPackage,logrotate)) diff --git a/utils/logrotate/files/logrotate.conf b/utils/logrotate/files/logrotate.conf new file mode 100644 index 0000000..9a91db9 --- /dev/null +++ b/utils/logrotate/files/logrotate.conf @@ -0,0 +1,30 @@ +# rotate log files weekly +weekly +#daily + +# keep 4 weeks worth of backlogs +rotate 4 + +# create new (empty) log files after rotating old ones +create + +notifempty +nomail +#olddir /var/log/backup/ +missingok +#dateext + +# uncomment this if you want your log files compressed +#compress + +# packages can drop log rotation information into this directory +include /etc/logrotate.d + +# no packages own lastlog or wtmp -- we'll rotate them here +#/var/log/wtmp { +# monthly +# create 0664 root utmp +# rotate 1 +#} + +# system-specific logs may be also be configured here. diff --git a/utils/lrzsz/Makefile b/utils/lrzsz/Makefile new file mode 100644 index 0000000..5074a1d --- /dev/null +++ b/utils/lrzsz/Makefile @@ -0,0 +1,58 @@ +# +# Copyright (C) 2006-2016 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:=lrzsz +PKG_VERSION:=0.12.20 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://ohse.de/uwe/releases/ +PKG_MD5SUM:=b5ce6a74abc9b9eb2af94dffdfd372a4 + +PKG_MAINTAINER:=Hsing-Wang Liao +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lrzsz + SECTION:=utils + CATEGORY:=Utilities + TITLE:=X, Y and Z-modem protocols + URL:=https://ohse.de/uwe/software/lrzsz.html +endef + +define Package/lrzsz/description + Transfer files in your login sessions. + Very leightweight and straight forward. + You just need a terminal client that can do + either X, Y or Z-modem file transfers. +endef + +define Package/lrzsz/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lrz $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lsz $(1)/usr/bin/ + (cd $(1)/usr/bin; \ + ln -fs lrz lrx; \ + ln -fs lrz lrb; \ + ln -fs lrz rz; \ + ln -fs lrz rx; \ + ln -fs lrz rb; \ + ln -fs lsz lsx; \ + ln -fs lsz lsb; \ + ln -fs lsz sz; \ + ln -fs lsz sx; \ + ln -fs lsz sb; \ + ); +endef + +$(eval $(call BuildPackage,lrzsz)) diff --git a/utils/lrzsz/patches/100-install_delete_fix.patch b/utils/lrzsz/patches/100-install_delete_fix.patch new file mode 100644 index 0000000..3b19443 --- /dev/null +++ b/utils/lrzsz/patches/100-install_delete_fix.patch @@ -0,0 +1,19 @@ +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -372,13 +372,13 @@ + rm -f $(DESTDIR)/$(bindir)/`echo lsb | sed -e '$(transform)'` + ln $(DESTDIR)/$(bindir)/`echo lsz |sed -e '$(transform)'` \ + $(DESTDIR)/$(bindir)/`echo lsb |sed -e '$(transform)'` +- rm -f $(bindir)/`echo lsx | sed -e '$(transform)'` ++ rm -f $(DESTDIR)/$(bindir)/`echo lsx | sed -e '$(transform)'` + ln $(DESTDIR)/$(bindir)/`echo lsz |sed -e '$(transform)'` \ + $(DESTDIR)/$(bindir)/`echo lsx |sed -e '$(transform)'` +- rm -f $(bindir)/`echo lrb | sed -e '$(transform)'` ++ rm -f $(DESTDIR)/$(bindir)/`echo lrb | sed -e '$(transform)'` + ln $(DESTDIR)/$(bindir)/`echo lrz |sed -e '$(transform)'` \ + $(DESTDIR)/$(bindir)/`echo lrb |sed -e '$(transform)'` +- rm -f $(bindir)/`echo lrx | sed -e '$(transform)'` ++ rm -f $(DESTDIR)/$(bindir)/`echo lrx | sed -e '$(transform)'` + ln $(DESTDIR)/$(bindir)/`echo lrz |sed -e '$(transform)'` \ + $(DESTDIR)/$(bindir)/`echo lrx |sed -e '$(transform)'` + # rm -f $(bindir)/`echo lrzszbug | sed -e '$(transform)'` diff --git a/utils/lsof/Makefile b/utils/lsof/Makefile new file mode 100644 index 0000000..c891344 --- /dev/null +++ b/utils/lsof/Makefile @@ -0,0 +1,68 @@ +# +# Copyright (C) 2007-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=lsof +PKG_VERSION:=4.89 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=https://www.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/ ftp://sunsite.ualberta.ca/pub/Mirror/lsof/ ftp://ftp.fu-berlin.de/pub/unix/tools/lsof +PKG_MD5SUM:=1b9cd34f3fb86856a125abbf2be3a386 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)_$(PKG_VERSION) +PKG_MAINTAINER:=Maxim Storchak +PKG_LICENSE:=Unique +PKG_LICENSE_FILES:=00README + +include $(INCLUDE_DIR)/package.mk + +TARGET_LDFLAGS += $(LIBRPC) + +define Package/lsof + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=$(LIBRPC_DEPENDS) + TITLE:=LiSt Open Files - a diagnostic tool + URL:=http://people.freebsd.org/~abe/ +endef + +ifneq ($(CONFIG_IPV6),n) + LINUX_CLIB_IPV6=-DHASIPv6 +else + LINUX_CLIB_IPV6= +endif + +define Build/Prepare + $(PKG_UNPACK) + (cd $(PKG_BUILD_DIR) && tar -xf $(PKG_NAME)_$(PKG_VERSION)_src.tar && mv $(PKG_NAME)_$(PKG_VERSION)_src/* .) + $(Build/Patch) +endef + +define Build/Configure + cd $(PKG_BUILD_DIR); \ + LINUX_CLIB="-DGLIBCV=2 $(LINUX_CLIB_IPV6)" \ + LSOF_CC="$(TARGET_CC)" \ + LSOF_VSTR="$(LINUX_VERSION)" \ + LSOF_CFGF="$(TARGET_CFLAGS)" \ + LSOF_CFGL="$(TARGET_LDFLAGS)" \ + LSOF_AR="$(TARGET_CROSS)ar cr" \ + LSOF_RANLIB="$(TARGET_CROSS)ranlib" \ + ./Configure -n linux +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) +endef + +define Package/lsof/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lsof $(1)/usr/bin +endef + +$(eval $(call BuildPackage,lsof)) diff --git a/utils/lsof/patches/001-lsof_makefile.patch b/utils/lsof/patches/001-lsof_makefile.patch new file mode 100644 index 0000000..eb2b735 --- /dev/null +++ b/utils/lsof/patches/001-lsof_makefile.patch @@ -0,0 +1,13 @@ +--- a/lib/Makefile.skel ++++ b/lib/Makefile.skel +@@ -21,8 +21,8 @@ OBJ= ckkv.o cvfs.o dvch.o fino.o isfn.o + all: ${LIB} + + ${LIB}: ${OBJ} +- ${AR} +- ${RANLIB} ++ ${AR} ${LIB} ${OBJ} ++ ${RANLIB} ${LIB} + + clean: FRC + rm -f ${LIB} ${OBJ} errs Makefile.bak a.out core diff --git a/utils/lsof/patches/002-lsof_noportmap.patch b/utils/lsof/patches/002-lsof_noportmap.patch new file mode 100644 index 0000000..d0e8889 --- /dev/null +++ b/utils/lsof/patches/002-lsof_noportmap.patch @@ -0,0 +1,18 @@ +--- a/print.c ++++ b/print.c +@@ -161,6 +161,7 @@ endnm(sz) + static void + fill_portmap() + { ++#if !defined __UCLIBC__ || (defined __UCLIBC__ && defined __UCLIBC_HAS_RPC__) + char buf[128], *cp, *nm; + CLIENT *c; + int h, port, pr; +@@ -279,6 +280,7 @@ fill_portmap() + Pth[pr][h] = pt; + } + clnt_destroy(c); ++#endif + } + #endif /* !defined(HASNORPC_H) */ + diff --git a/utils/lsof/patches/003-lsof_selinux.patch b/utils/lsof/patches/003-lsof_selinux.patch new file mode 100644 index 0000000..f3168e5 --- /dev/null +++ b/utils/lsof/patches/003-lsof_selinux.patch @@ -0,0 +1,13 @@ +diff --git a/Configure b/Configure +index e4a25a2..3a6e78b 100755 +--- a/Configure ++++ b/Configure +@@ -2923,7 +2923,7 @@ return(0); } + LSOF_TMP1=1 + fi # } + fi # } +- if test $LSOF_TMP1 -eq 1 # { ++ if test 0 -eq 1 # { + then + LSOF_CFGF="$LSOF_CFGF -DHASSELINUX" + LSOF_CFGL="$LSOF_CFGL -lselinux" diff --git a/utils/lsof/patches/004-lsof_ccv.patch b/utils/lsof/patches/004-lsof_ccv.patch new file mode 100644 index 0000000..e2f162b --- /dev/null +++ b/utils/lsof/patches/004-lsof_ccv.patch @@ -0,0 +1,14 @@ +diff --git a/Configure b/Configure +index 3a6e78b..a2946c6 100755 +--- a/Configure ++++ b/Configure +@@ -2788,6 +2788,9 @@ LOCKF_OWNER4 + if test "X$LSOF_CC" = "X" # { + then + LSOF_CC=cc ++ fi # } ++ if test "X$LSOF_CCV" = "X" # { ++ then + LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'` + fi # } + if test "X$LINUX_CONF_CC" = "X" # { diff --git a/utils/luci-app-lxc/Makefile b/utils/luci-app-lxc/Makefile new file mode 100644 index 0000000..026f714 --- /dev/null +++ b/utils/luci-app-lxc/Makefile @@ -0,0 +1,68 @@ +# +# 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:=luci-app-lxc +PKG_RELEASE:=20161030 + +PKG_LICENSE:=Apache-2.0 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/luci-app-lxc + SECTION:=luci + CATEGORY:=LuCI + SUBMENU:=3. Applications + TITLE:=LXC management Web UI + DEPENDS:=+luci-mod-admin-full +lxc +lxc-create +liblxc +rpcd-mod-lxc +getopt +xz + MAINTAINER:=Petar Koretic +endef + +define Package/luci-app-lxc/description + This package will install LXC management Web UI. +endef + +define Build/Prepare +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/luci-app-lxc/install + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/ + $(INSTALL_BIN) \ + ./files/controller/lxc.lua \ + $(1)/usr/lib/lua/luci/controller/ + + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/ + $(INSTALL_DATA) \ + ./files/view/lxc.htm \ + $(1)/usr/lib/lua/luci/view/ + + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/ + $(INSTALL_BIN) \ + ./files/model/cbi/lxc.lua \ + $(1)/usr/lib/lua/luci/model/cbi/ + + $(INSTALL_DIR) $(1)/etc/config/ + $(INSTALL_DATA) \ + ./files/lxc.config \ + $(1)/etc/config/lxc + + $(INSTALL_DIR) $(1)/www + $(CP) -R \ + ./files/www/* \ + $(1)/www +endef + +$(eval $(call BuildPackage,luci-app-lxc)) diff --git a/utils/luci-app-lxc/files/controller/lxc.lua b/utils/luci-app-lxc/files/controller/lxc.lua new file mode 100644 index 0000000..ea7adba --- /dev/null +++ b/utils/luci-app-lxc/files/controller/lxc.lua @@ -0,0 +1,167 @@ +--[[ + +LuCI LXC module + +Copyright (C) 2014, Cisco Systems, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Author: Petar Koretic + +]]-- + +module("luci.controller.lxc", package.seeall) + +require "ubus" +local conn = ubus.connect() +if not conn then + error("Failed to connect to ubus") +end + + +function fork_exec(command) + local pid = nixio.fork() + if pid > 0 then + return + elseif pid == 0 then + -- change to root dir + nixio.chdir("/") + + -- patch stdin, out, err to /dev/null + local null = nixio.open("/dev/null", "w+") + if null then + nixio.dup(null, nixio.stderr) + nixio.dup(null, nixio.stdout) + nixio.dup(null, nixio.stdin) + if null:fileno() > 2 then + null:close() + end + end + + -- replace with target command + nixio.exec("/bin/sh", "-c", command) + end +end + +function index() + page = node("admin", "services", "lxc") + page.target = cbi("lxc") + page.title = _("LXC Containers") + page.order = 70 + + page = entry({"admin", "services", "lxc_create"}, call("lxc_create"), nil) + page.leaf = true + + page = entry({"admin", "services", "lxc_action"}, call("lxc_action"), nil) + page.leaf = true + + page = entry({"admin", "services", "lxc_get_downloadable"}, call("lxc_get_downloadable"), nil) + page.leaf = true + + page = entry({"admin", "services", "lxc_configuration_get"}, call("lxc_configuration_get"), nil) + page.leaf = true + + page = entry({"admin", "services", "lxc_configuration_set"}, call("lxc_configuration_set"), nil) + page.leaf = true + +end + +function lxc_get_downloadable() + luci.http.prepare_content("application/json") + + local f = io.popen('uname -m', 'r') + local target = f:read('*a') + f:close() + target = target:gsub("^%s*(.-)%s*$", "%1") + + local templates = {} + + local f = io.popen('lxc-create -n just_want_to_list_available_lxc_templates -t download -- --list', 'r') + + for line in f:lines() do + local dist,version = line:match("^(%S+)%s+(%S+)%s+" .. target .. "%s+default%s+%S+$") + if dist~=nil and version~=nil then templates[#templates + 1] = dist .. ":" .. version end + end + + f:close() + luci.http.write_json(templates) +end + +function lxc_create(lxc_name, lxc_template) + luci.http.prepare_content("text/plain") + + local uci = require("uci").cursor() + + local url = uci:get("lxc", "lxc", "url") + + if not pcall(dofile, "/etc/openwrt_release") then + return luci.http.write("1") + end + + local f = io.popen('uname -m', 'r') + local target = f:read('*a') + f:close() + target = target:gsub("^%s*(.-)%s*$", "%1") + + local lxc_dist = lxc_template:gsub("(.*):(.*)", '%1') + local lxc_release = lxc_template:gsub("(.*):(.*)", '%2') + + local data = conn:call("lxc", "create", { name = lxc_name, template = "download", args = { "--server", url, "--no-validate", "--dist", lxc_dist, "--release", lxc_release, "--arch", target } } ) + + luci.http.write(data) +end + +function lxc_action(lxc_action, lxc_name) + luci.http.prepare_content("application/json") + + local data, ec = conn:call("lxc", lxc_action, lxc_name and { name = lxc_name} or {} ) + + luci.http.write_json(ec and {} or data) +end + +function lxc_get_config_path() + local f = io.open("/etc/lxc/lxc.conf", "r") + local content = f:read("*all") + f:close() + local ret = content:match('^%s*lxc.lxcpath%s*=%s*([^%s]*)') + if ret then + return ret .. "/" + else + return "/srv/lxc/" + end +end + +function lxc_configuration_get(lxc_name) + luci.http.prepare_content("text/plain") + + local f = io.open(lxc_get_config_path() .. lxc_name .. "/config", "r") + local content = f:read("*all") + f:close() + + luci.http.write(content) +end + +function lxc_configuration_set(lxc_name) + luci.http.prepare_content("text/plain") + + local lxc_configuration = luci.http.formvalue("lxc_configuration") + + if lxc_configuration == nil then + return luci.http.write("1") + end + + local f, err = io.open(lxc_get_config_path() .. lxc_name .. "/config","w+") + if not f then + return luci.http.write("2") + end + + f:write(lxc_configuration) + f:close() + + luci.http.write("0") +end + diff --git a/utils/luci-app-lxc/files/lxc.config b/utils/luci-app-lxc/files/lxc.config new file mode 100644 index 0000000..5572c73 --- /dev/null +++ b/utils/luci-app-lxc/files/lxc.config @@ -0,0 +1,6 @@ +# +# lxc uci configuration +# + +config lxc 'lxc' + option url 'virtualwrt.org/containers/' diff --git a/utils/luci-app-lxc/files/model/cbi/lxc.lua b/utils/luci-app-lxc/files/model/cbi/lxc.lua new file mode 100644 index 0000000..ac0fdff --- /dev/null +++ b/utils/luci-app-lxc/files/model/cbi/lxc.lua @@ -0,0 +1,31 @@ +--[[ + +LuCI LXC module + +Copyright (C) 2014, Cisco Systems, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Author: Petar Koretic + +]]-- + +local fs = require "nixio.fs" + +m = Map("lxc", translate("LXC Containers")) + +if fs.access("/etc/config/lxc") then + m:section(SimpleSection).template = "lxc" + + s = m:section(TypedSection, "lxc", translate("Options")) + s.anonymous = true + s.addremove = false + + s:option(Value, "url", translate("Containers URL")) +end + +return m diff --git a/utils/luci-app-lxc/files/view/lxc.htm b/utils/luci-app-lxc/files/view/lxc.htm new file mode 100644 index 0000000..edfff8e --- /dev/null +++ b/utils/luci-app-lxc/files/view/lxc.htm @@ -0,0 +1,458 @@ +<%# + +LuCI LXC module + +Copyright (C) 2014, Cisco Systems, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Author: Petar Koretic + +-%> + +
+ <%:Available Containers%> +
+ + + + + + +
<%:Name%><%:Status%><%:Actions%>
+
+
+ +
+ +
+ +
+
+ <%:Create New Container%> +
+ + + + + + + + + + + +
<%:Name%><%:Template%><%:Actions%>
+ + + + + + +
+
+
+ +
+ +
+ +
+ + + diff --git a/utils/luci-app-lxc/files/www/luci-static/resources/cbi/green.gif b/utils/luci-app-lxc/files/www/luci-static/resources/cbi/green.gif new file mode 100644 index 0000000000000000000000000000000000000000..d09febf1273b9a20ed89f69b19c9837c325b6db2 GIT binary patch literal 310 zcmV-60m=SHNk%w1VG;lm0K^{vZ~bkE`i3IOOtAj1%l^tt)@2&AVF&*PSoufY_~E|k z)JgwHS>#w4z1r7`qnUWO@4hjMkkD&(? z0tz3V7O9d47M&sq1`M&7ve%u0>iE{m+T+XZwTj1Er9cj@j0>9S$296cLx79uX8676b;Mmj(nD z0vijDs2vL%0v{X*39y$P2?!h_5Df&mpS%PO5F-K&7<&n-5d+>4 S5eN;-E)Uxq8{)YwApkob^ml{+ literal 0 HcmV?d00001 diff --git a/utils/lvm2/Makefile b/utils/lvm2/Makefile new file mode 100644 index 0000000..928050a --- /dev/null +++ b/utils/lvm2/Makefile @@ -0,0 +1,95 @@ +# +# Copyright (C) 2009-2010 Stefan Monnier +# Copyright (C) 2011-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v3+. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=LVM2 +PKG_VERSION:=2.02.165 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-2.0 LGPL-2.1 + +PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz +PKG_SOURCE_URL:=ftp://sources.redhat.com/pub/lvm2/releases +PKG_MD5SUM:=d459cfe50fd549fe41eeed4ef8fbca3f9833f68012f735adb3462483360e07c7 +PKG_MAINTAINER:=Daniel Golle +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME).$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/libdevmapper + SECTION:=libs + CATEGORY:=Libraries + TITLE:=The Linux Kernel Device Mapper userspace library + URL:=http://sourceware.org/dm/ + DEPENDS:=+kmod-dm +libpthread +libuuid +librt +endef + +define Package/libdevmapper/description + The device-mapper is a component of the 2.6 linux kernel that supports logical + volume management. It is required by LVM2 and EVMS. +endef + +define Package/lvm2 + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Disc + TITLE:=The Linux Logical Volume Manager + URL:=http://sourceware.org/lvm2/ + DEPENDS:=+libdevmapper +libblkid +libreadline +libncurses +endef + +define Package/lvm2/description + LVM2 refers to a new userspace toolset that provide logical volume management + facilities on linux. It is reasonably backwards-compatible with the original + LVM toolset. +endef + +CONFIGURE_ARGS += --disable-o_direct + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + install +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/libdevmapper.h $(1)/usr/include + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdevmapper.so* $(1)/usr/lib + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_BUILD_DIR)/libdm/libdevmapper.pc $(1)/usr/lib/pkgconfig +endef + +define Package/libdevmapper/install + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libdevmapper.so.* $(1)/usr/lib +endef + +define Package/lvm2/install + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/lvm $(1)/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dmsetup $(1)/sbin + $(INSTALL_DIR) $(1)/etc/lvm + $(SED) '/^[[:space:]]*\(#\|$$$$\)/d; /cache_dir/s@.*@ cache_dir = "/tmp/lvm/cache"@' $(PKG_INSTALL_DIR)/etc/lvm/lvm.conf + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/lvm/lvm.conf $(1)/etc/lvm/ + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/lvm/lvmlocal.conf $(1)/etc/lvm/ + $(INSTALL_DIR) $(1)/etc/lvm/profile + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/lvm/profile/* $(1)/etc/lvm/profile/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/lvm2.init $(1)/etc/init.d/lvm2 + $(FIND) $(PKG_INSTALL_DIR)/usr/sbin/ -type l -exec $(CP) -a {} $(1)/sbin/ \; +endef + +define Package/lvm2/conffiles +/etc/lvm/lvm.conf +endef + +$(eval $(call BuildPackage,libdevmapper)) +$(eval $(call BuildPackage,lvm2)) diff --git a/utils/lvm2/files/lvm2.init b/utils/lvm2/files/lvm2.init new file mode 100644 index 0000000..4faf5d5 --- /dev/null +++ b/utils/lvm2/files/lvm2.init @@ -0,0 +1,14 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2009 Stefan Monnier +START=15 + +start () { + mkdir -p /tmp/lvm/cache + /sbin/lvm vgscan --ignorelockingfailure --mknodes || : + /sbin/lvm vgchange -aly --ignorelockingfailure || return 2 +} + +stop () { + mkdir -p /tmp/lvm/cache + /sbin/lvm vgchange -aln --ignorelockingfailure || return 2 +} diff --git a/utils/lvm2/patches/000-compile.patch b/utils/lvm2/patches/000-compile.patch new file mode 100644 index 0000000..9fa1c1d --- /dev/null +++ b/utils/lvm2/patches/000-compile.patch @@ -0,0 +1,11 @@ +--- a/make.tmpl.in ++++ b/make.tmpl.in +@@ -19,7 +19,7 @@ SHELL = /bin/sh + + # Allow environment to override any built-in default value for CC. + # If there is a built-in default, CC is NOT set to @CC@ here. +-CC ?= @CC@ ++CC = @CC@ + + # If $(CC) holds the usual built-in default value of 'cc' then replace it with + # the configured value. diff --git a/utils/lvm2/patches/001-include_fix.patch b/utils/lvm2/patches/001-include_fix.patch new file mode 100644 index 0000000..09d2db9 --- /dev/null +++ b/utils/lvm2/patches/001-include_fix.patch @@ -0,0 +1,11 @@ +--- a/lib/device/dev-type.c ++++ b/lib/device/dev-type.c +@@ -22,7 +22,7 @@ + #include + + #ifdef BLKID_WIPING_SUPPORT +-#include ++#include + #endif + + #ifdef UDEV_SYNC_SUPPORT diff --git a/utils/lvm2/patches/002-const-stdio.patch b/utils/lvm2/patches/002-const-stdio.patch new file mode 100644 index 0000000..546a03c --- /dev/null +++ b/utils/lvm2/patches/002-const-stdio.patch @@ -0,0 +1,43 @@ +--- a/lib/commands/toolcontext.c ++++ b/lib/commands/toolcontext.c +@@ -1843,7 +1843,7 @@ struct cmd_context *create_toolcontext(u + /* FIXME Make this configurable? */ + reset_lvm_errno(1); + +-#ifndef VALGRIND_POOL ++#if defined(__GLIBC__) && !defined(VALGRIND_POOL) + /* Set in/out stream buffering before glibc */ + if (set_buffering) { + /* Allocate 2 buffers */ +@@ -2224,7 +2224,7 @@ void destroy_toolcontext(struct cmd_cont + if (cmd->libmem) + dm_pool_destroy(cmd->libmem); + +-#ifndef VALGRIND_POOL ++#if defined(__GLIBC__) && !defined(VALGRIND_POOL) + if (cmd->linebuffer) { + /* Reset stream buffering to defaults */ + if (is_valid_fd(STDIN_FILENO) && +--- a/tools/lvmcmdline.c ++++ b/tools/lvmcmdline.c +@@ -1815,6 +1815,7 @@ int lvm_split(char *str, int *argc, char + /* Make sure we have always valid filedescriptors 0,1,2 */ + static int _check_standard_fds(void) + { ++#ifdef __GLIBC__ + int err = is_valid_fd(STDERR_FILENO); + + if (!is_valid_fd(STDIN_FILENO) && +@@ -1841,6 +1842,12 @@ static int _check_standard_fds(void) + strerror(errno)); + return 0; + } ++#else ++ if (!is_valid_fd(STDERR_FILENO) || ++ !is_valid_fd(STDOUT_FILENO) || ++ !is_valid_fd(STDIN_FILENO)) ++ return 0; ++#endif + + return 1; + } diff --git a/utils/lvm2/patches/003-no-mallinfo.patch b/utils/lvm2/patches/003-no-mallinfo.patch new file mode 100644 index 0000000..6762742 --- /dev/null +++ b/utils/lvm2/patches/003-no-mallinfo.patch @@ -0,0 +1,45 @@ +--- a/lib/mm/memlock.c ++++ b/lib/mm/memlock.c +@@ -174,12 +174,15 @@ static void _allocate_memory(void) + * memory on free(), this is good enough for our purposes. + */ + while (missing > 0) { ++#ifdef __GLIBC__ + struct mallinfo inf = mallinfo(); + hblks = inf.hblks; ++#endif + + if ((areas[area] = malloc(_size_malloc_tmp))) + _touch_memory(areas[area], _size_malloc_tmp); + ++#ifdef __GLIBC__ + inf = mallinfo(); + + if (hblks < inf.hblks) { +@@ -189,9 +192,12 @@ static void _allocate_memory(void) + free(areas[area]); + _size_malloc_tmp /= 2; + } else { ++#endif + ++ area; + missing -= _size_malloc_tmp; ++#ifdef __GLIBC__ + } ++#endif + + if (area == max_areas && missing > 0) { + /* Too bad. Warn the user and proceed, as things are +@@ -480,8 +486,13 @@ static void _lock_mem(struct cmd_context + * will not block memory locked thread + * Note: assuming _memlock_count_daemon is updated before _memlock_count + */ ++#ifdef __GLIBC__ + _use_mlockall = _memlock_count_daemon ? 1 : + find_config_tree_bool(cmd, activation_use_mlockall_CFG, NULL); ++#else ++ /* always use mlockall on musl */ ++ _use_mlockall = 1; ++#endif + + if (!_use_mlockall) { + if (!*_procselfmaps && diff --git a/utils/lvm2/patches/004-device-include-goto-lable-as-well.patch b/utils/lvm2/patches/004-device-include-goto-lable-as-well.patch new file mode 100644 index 0000000..30cc5e6 --- /dev/null +++ b/utils/lvm2/patches/004-device-include-goto-lable-as-well.patch @@ -0,0 +1,26 @@ +From a887fe76be459d32a638d0abde96cc715632c8d5 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Fri, 20 May 2016 06:31:15 +0200 +Subject: [PATCH] device: include goto lable as well +To: lvm-devel@redhat.com + +commit b5314c2a6ae5fe4f802e82a4f31cf2fad398ded9 +device: Retry open without O_NOATIME if it fails. + +makes use of goto lable 'opened:' but that might not be defined, e.g. +on standard C libraries without O_DIRECT_SUPPORT. +--- + lib/device/dev-io.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/lib/device/dev-io.c ++++ b/lib/device/dev-io.c +@@ -529,7 +529,7 @@ int dev_open_flags(struct device *dev, i + return 0; + } + +-#ifdef O_DIRECT_SUPPORT ++#if defined(O_DIRECT_SUPPORT) || defined(O_NOATIME) + opened: + if (direct) + dev->flags |= DEV_O_DIRECT_TESTED; diff --git a/utils/lxc/Config.in b/utils/lxc/Config.in new file mode 100644 index 0000000..618fde0 --- /dev/null +++ b/utils/lxc/Config.in @@ -0,0 +1,37 @@ +menu "Configuration" + depends on PACKAGE_lxc + +config LXC_KERNEL_OPTIONS + bool "Enable kernel support for LXC" + default n + select KERNEL_CGROUPS + select KERNEL_NAMESPACES + select KERNEL_LXC_MISC + help + Select needed kernel options for LXC related utilities. Options + include cgroups, namespaces and other miscellaneous options. These + options unfortunately can not be installed as a module. + +config LXC_BUSYBOX_OPTIONS + bool "Enable busybox support for lxc-create tool" + default n + select BUSYBOX_CUSTOM + select BUSYBOX_CONFIG_HAVE_DOT_CONFIG + select BUSYBOX_CONFIG_FEATURE_SEAMLESS_XZ + select BUSYBOX_CONFIG_FEATURE_TAR_LONG_OPTIONS + select BUSYBOX_CONFIG_UNXZ + select BUSYBOX_CONFIG_XZ + select BUSYBOX_CONFIG_GETOPT + select BUSYBOX_CONFIG_FEATURE_GETOPT_LONG + help + Select needed busybox options for lxc-create utility. This include XZ tar + compression, long option support for tar and built-in getopt support. + +config LXC_SECCOMP + bool "Enable support for seccomp in LXC" + default KERNEL_SECCOMP + help + Build LXC with support for seccomp filters. + Select libseccomp which also pulls-in the needed kernel features. + +endmenu diff --git a/utils/lxc/Makefile b/utils/lxc/Makefile new file mode 100644 index 0000000..0df1460 --- /dev/null +++ b/utils/lxc/Makefile @@ -0,0 +1,280 @@ +# +# Copyright (C) 2013-2015 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:=lxc +PKG_VERSION:=1.1.5 +PKG_RELEASE:=3 + +PKG_LICENSE:=LGPL-2.1+ BSD-2-Clause GPL-2.0 +PKG_MAINTAINER:=Luka Perkov + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://linuxcontainers.org/downloads/lxc/ +PKG_MD5SUM:=dd9684dde0a58ed13f4f49c855b79a1a + +PKG_BUILD_DEPENDS:=lua +PKG_BUILD_PARALLEL:=1 + +PKG_INSTALL:=1 +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +LXC_APPLETS_BIN += \ + attach autostart cgroup clone config console create destroy device \ + execute freeze info monitor snapshot start stop unfreeze unshare \ + usernsexec wait + +LXC_APPLETS_LIB += \ + monitord user-nic + +LXC_SCRIPTS += \ + checkconfig ls top + +DEPENDS_APPLETS = +libpthread +libcap +liblxc + +DEPENDS_create = +lxc-configs +lxc-hooks +lxc-templates +flock + +DEPENDS_ls = +lxc-config +DEPENDS_top = +lxc-lua +luafilesystem @BROKEN + + +define Package/lxc/Default + SECTION:=utils + CATEGORY:=Utilities + TITLE:=LXC userspace tools + URL:=http://lxc.sourceforge.net/ +endef + +define Package/lxc + $(call Package/lxc/Default) + MENU:=1 +endef + +define Package/lxc-auto + $(call Package/lxc/Default) + TITLE:= (initscript) + DEPENDS:=+lxc-start +lxc-stop +endef + +define Package/lxc-auto/description + LXC is the userspace control package for Linux Containers, a lightweight + virtual system mechanism sometimes described as "chroot on steroids". + This package adds and initscript for starting and stopping the containers + on boot and shutdown. +endef + +define Package/lxc-auto/conffiles +/etc/config/lxc-auto +endef + +define Package/lxc/config + source "$(SOURCE)/Config.in" +endef + +define Package/lxc/description + LXC is the userspace control package for Linux Containers, a lightweight + virtual system mechanism sometimes described as "chroot on steroids". +endef + +define Package/lxc-common + $(call Package/lxc/Default) + TITLE:=LXC common files + DEPENDS:= lxc +endef + +define Package/lxc-hooks + $(call Package/lxc/Default) + TITLE:=LXC virtual machine hooks + DEPENDS:= lxc +endef + +define Package/lxc-templates + $(call Package/lxc/Default) + TITLE:=LXC virtual machine templates + DEPENDS:= lxc +endef + +define Package/lxc-configs + $(call Package/lxc/Default) + TITLE:=LXC virtual machine common config files + DEPENDS:= lxc +endef + +define Package/liblxc + $(call Package/lxc/Default) + SECTION:=libs + CATEGORY:=Libraries + TITLE:=LXC userspace library + DEPENDS:= lxc +libcap +libpthread +LXC_SECCOMP:libseccomp +endef + +define Package/lxc-lua + $(call Package/lxc/Default) + TITLE:=LXC Lua bindings + DEPENDS:= lxc +liblua +liblxc +luafilesystem +endef + +define Package/lxc-init + $(call Package/lxc/Default) + TITLE:=LXC Lua bindings + DEPENDS:= lxc +liblxc +endef + +CONFIGURE_ARGS += \ + --disable-apparmor \ + --disable-doc \ + --disable-examples \ + --enable-lua=yes \ + --with-lua-pc="$(STAGING_DIR)/usr/lib/pkgconfig/lua.pc" + +ifeq ($(CONFIG_LXC_SECCOMP),y) +CONFIGURE_ARGS += --enable-seccomp +else +CONFIGURE_ARGS += --disable-seccomp +endif + +MAKE_FLAGS += \ + LUA_INSTALL_CMOD="/usr/lib/lua" \ + LUA_INSTALL_LMOD="/usr/lib/lua" + + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include/lxc/ + $(CP) \ + $(PKG_INSTALL_DIR)/usr/include/lxc/* \ + $(1)/usr/include/lxc/ + + $(INSTALL_DIR) $(1)/usr/lib + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \ + $(1)/usr/lib/ + + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lxc.pc \ + $(1)/usr/lib/pkgconfig/ +endef + + +define Package/lxc/install + true +endef + +define Package/lxc-auto/install + $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d + $(INSTALL_CONF) ./files/lxc-auto.config $(1)/etc/config/lxc-auto + $(INSTALL_BIN) ./files/lxc-auto.init $(1)/etc/init.d/lxc-auto +endef + +define Package/lxc-common/conffiles +/etc/lxc/default.conf +/etc/lxc/lxc.conf +endef + +define Package/lxc-common/install + $(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \ + $(1)/usr/lib/lxc/rootfs/ + + $(INSTALL_DIR) $(1)/usr/share/lxc + $(CP) \ + $(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \ + $(1)/usr/share/lxc/ + + $(INSTALL_DIR) $(1)/etc/lxc/ + $(CP) \ + $(PKG_INSTALL_DIR)/etc/lxc/default.conf \ + $(1)/etc/lxc/default.conf + + $(INSTALL_DIR) $(1)/etc/lxc/ + $(CP) \ + ./files/lxc.conf \ + $(1)/etc/lxc/lxc.conf + + $(INSTALL_DIR) $(1)/srv/lxc/ +endef + +define Package/lxc-hooks/install + $(INSTALL_DIR) $(1)/usr/share/lxc/hooks + $(CP) \ + $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/* \ + $(1)/usr/share/lxc/hooks/ +endef + +define Package/lxc-templates/install + $(INSTALL_DIR) $(1)/usr/share/lxc/templates/ + $(CP) \ + $(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \ + $(1)/usr/share/lxc/templates/ +endef + +define Package/lxc-configs/install + $(INSTALL_DIR) $(1)/usr/share/lxc/config/ + $(CP) \ + $(PKG_INSTALL_DIR)/usr/share/lxc/config/* \ + $(1)/usr/share/lxc/config/ +endef + +define Package/liblxc/install + $(INSTALL_DIR) $(1)/usr/lib/ + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \ + $(1)/usr/lib/ +endef + +define Package/lxc-lua/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(CP) \ + $(PKG_INSTALL_DIR)/usr/share/lua/5.1/lxc.lua \ + $(1)/usr/lib/lua/ + $(INSTALL_DIR) $(1)/usr/lib/lua/lxc + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/lua/5.1/lxc/core.so \ + $(1)/usr/lib/lua/lxc/ +endef + +define Package/lxc-init/install + $(INSTALL_DIR) $(1)/sbin + $(CP) \ + $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \ + $(1)/sbin/ +endef + +define GenPlugin + define Package/lxc-$(1) + $(call Package/lxc/Default) + TITLE:=Utility lxc-$(1) from the LXC userspace tools + DEPENDS:= lxc +lxc-common $(2) $(DEPENDS_$(1)) + endef + + define Package/lxc-$(1)/install + $(INSTALL_DIR) $$(1)$(3) + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \ + $$(1)$(3)/ + endef + + $$(eval $$(call BuildPackage,lxc-$(1))) +endef + + +$(eval $(call BuildPackage,lxc)) +$(eval $(call BuildPackage,lxc-common)) +$(eval $(call BuildPackage,lxc-hooks)) +$(eval $(call BuildPackage,lxc-configs)) +$(eval $(call BuildPackage,lxc-templates)) +$(eval $(call BuildPackage,liblxc)) +$(eval $(call BuildPackage,lxc-lua)) +$(eval $(call BuildPackage,lxc-init)) +$(eval $(call BuildPackage,lxc-auto)) +$(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin"))) +$(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/lib/lxc"))) +$(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin"))) diff --git a/utils/lxc/files/lxc-auto.config b/utils/lxc/files/lxc-auto.config new file mode 100644 index 0000000..b5a7ec9 --- /dev/null +++ b/utils/lxc/files/lxc-auto.config @@ -0,0 +1,5 @@ +#config container + #option name container1 + #option timeout 300 + #list command '/bin/command --option' + diff --git a/utils/lxc/files/lxc-auto.init b/utils/lxc/files/lxc-auto.init new file mode 100755 index 0000000..937f082 --- /dev/null +++ b/utils/lxc/files/lxc-auto.init @@ -0,0 +1,60 @@ +#!/bin/sh /etc/rc.common + +. /lib/functions.sh + +START=99 +STOP=00 + +run_command() { + local command="$1" + $command +} + +start_container() { + local cfg="$1" + local name + + config_get name "$cfg" name + config_list_foreach "$cfg" command run_command + if [ -n "$name" ]; then + /usr/bin/lxc-start -n "$name" + fi +} + +max_timeout=0 + +stop_container() { + local cfg="$1" + local name timeout + + config_get name "$cfg" name + config_get timeout "$cfg" timeout 300 + + if [ "$max_timeout" -lt "$timeout" ]; then + max_timeout=$timeout + fi + + if [ -n "$name" ]; then + if [ "$timeout" = "0" ]; then + /usr/bin/lxc-stop -n "$name" & + else + /usr/bin/lxc-stop -n "$name" -t $timeout & + fi + fi +} + +start() { + config_load lxc-auto + config_foreach start_container container +} + +stop() { + config_load lxc-auto + config_foreach stop_container container + # ensure e.g. shutdown doesn't occur before maximum timeout on + # containers that are shutting down + if [ $max_timeout -gt 0 ]; then + sleep $max_timeout + fi +} + diff --git a/utils/lxc/files/lxc.conf b/utils/lxc/files/lxc.conf new file mode 100644 index 0000000..77841cc --- /dev/null +++ b/utils/lxc/files/lxc.conf @@ -0,0 +1 @@ +lxc.lxcpath = /srv/lxc diff --git a/utils/lxc/patches/010-compile.patch b/utils/lxc/patches/010-compile.patch new file mode 100644 index 0000000..6f12c38 --- /dev/null +++ b/utils/lxc/patches/010-compile.patch @@ -0,0 +1,33 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -31,30 +31,6 @@ AC_CANONICAL_HOST + AM_PROG_CC_C_O + AC_GNU_SOURCE + +-# Detect the distribution. This is used for the default configuration and +-# for some distro-specific build options. +-AC_MSG_CHECKING([host distribution]) +-AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, oracle, centos, fedora, suse, gentoo, debian, arch, slackware, paldo, openmandriva or pardus.])) +-if type lsb_release >/dev/null 2>&1 && test "z$with_distro" = "z"; then +- with_distro=`lsb_release -is` +-fi +-if test "z$with_distro" = "z"; then +- AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat") +- AC_CHECK_FILE(/etc/oracle-release,with_distro="oracle") +- AC_CHECK_FILE(/etc/centos-release,with_distro="centos") +- AC_CHECK_FILE(/etc/fedora-release,with_distro="fedora") +- AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse") +- AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo") +- AC_CHECK_FILE(/etc/debian_version,with_distro="debian") +- AC_CHECK_FILE(/etc/arch-release,with_distro="arch") +- AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware") +- AC_CHECK_FILE(/etc/frugalware-release,with_distro="frugalware") +- AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="openmandriva") +- AC_CHECK_FILE(/etc/mandriva-release,with_distro="openmandriva") +- AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus") +-fi +-with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'` +- + if test "z$with_distro" = "z"; then + with_distro="unknown" + fi diff --git a/utils/lxc/patches/015-getline.patch b/utils/lxc/patches/015-getline.patch new file mode 100644 index 0000000..2dfaa9b --- /dev/null +++ b/utils/lxc/patches/015-getline.patch @@ -0,0 +1,15 @@ +--- a/src/lxc/utils.h ++++ b/src/lxc/utils.h +@@ -41,11 +41,7 @@ extern int mkdir_p(const char *dir, mode + extern char *get_rundir(void); + + /* Define getline() if missing from the C library */ +-#ifndef HAVE_GETLINE +-#ifdef HAVE_FGETLN +-#include <../include/getline.h> +-#endif +-#endif ++#include "../include/getline.h" + + /* Define setns() if missing from the C library */ + #ifndef HAVE_SETNS diff --git a/utils/lxc/patches/020-lxc-checkconfig.patch b/utils/lxc/patches/020-lxc-checkconfig.patch new file mode 100644 index 0000000..272f76b --- /dev/null +++ b/utils/lxc/patches/020-lxc-checkconfig.patch @@ -0,0 +1,20 @@ +--- a/src/lxc/lxc-checkconfig.in ++++ b/src/lxc/lxc-checkconfig.in +@@ -4,6 +4,17 @@ + : ${CONFIG:=/proc/config.gz} + : ${GREP:=zgrep} + : ${MODNAME:=configs} ++: ${ZGREP:=zgrep} ++: ${GUNZIP:=gunzip} ++ ++if [ -z $(which $ZGREP) ] && ! [ -z $(which $GUNZIP) ] && [ -x $(which $GUNZIP) ] && [ -f $CONFIG ] && [ "$CONFIG" == "/proc/config.gz" ] ; then ++ ++ CONFIG_NEW="/tmp/config-$(uname -r)" ++ $GUNZIP -c $CONFIG > $CONFIG_NEW ++ CONFIG=$CONFIG_NEW ++ ++ GREP=grep ++fi + + SETCOLOR_SUCCESS="printf \\033[1;32m" + SETCOLOR_FAILURE="printf \\033[1;31m" diff --git a/utils/lxc/patches/025-remove-unsupported-option.patch b/utils/lxc/patches/025-remove-unsupported-option.patch new file mode 100644 index 0000000..cb0a9f0 --- /dev/null +++ b/utils/lxc/patches/025-remove-unsupported-option.patch @@ -0,0 +1,19 @@ +--- a/templates/lxc-download.in ++++ b/templates/lxc-download.in +@@ -494,15 +494,7 @@ fi + # Unpack the rootfs + echo "Unpacking the rootfs" + +-EXCLUDES="" +-excludelist=$(relevant_file excludes) +-if [ -f "${excludelist}" ]; then +- while read line; do +- EXCLUDES="$EXCLUDES --exclude=$line" +- done < $excludelist +-fi +- +-tar --anchored ${EXCLUDES} --numeric-owner -xpJf \ ++tar --numeric-owner -xpJf \ + ${LXC_CACHE_PATH}/rootfs.tar.xz -C ${LXC_ROOTFS} + + mkdir -p ${LXC_ROOTFS}/dev/pts/ diff --git a/utils/lxc/patches/030-lxc-download.patch b/utils/lxc/patches/030-lxc-download.patch new file mode 100644 index 0000000..295bae0 --- /dev/null +++ b/utils/lxc/patches/030-lxc-download.patch @@ -0,0 +1,43 @@ +--- a/templates/lxc-download.in ++++ b/templates/lxc-download.in +@@ -39,7 +39,7 @@ DOWNLOAD_LIST_IMAGES="false" + DOWNLOAD_MODE="system" + DOWNLOAD_READY_GPG="false" + DOWNLOAD_RELEASE= +-DOWNLOAD_SERVER="images.linuxcontainers.org" ++DOWNLOAD_SERVER="virtualwrt.org/containers/" + DOWNLOAD_SHOW_GPG_WARNING="true" + DOWNLOAD_SHOW_HTTP_WARNING="true" + DOWNLOAD_TARGET="system" +@@ -257,14 +257,6 @@ for bin in tar xz wget; do + fi + done + +-# Check for GPG +-if [ "$DOWNLOAD_VALIDATE" = "true" ]; then +- if ! type gpg >/dev/null 2>&1; then +- echo "ERROR: Missing recommended tool: gpg" 1>&2 +- echo "You can workaround this by using --no-validate." 1>&2 +- exit 1 +- fi +-fi + + # Check that we have all variables we need + if [ -z "$LXC_NAME" ] || [ -z "$LXC_PATH" ] || [ -z "$LXC_ROOTFS" ]; then +@@ -456,16 +448,9 @@ if [ "$DOWNLOAD_USE_CACHE" = "false" ]; + echo "Downloading the rootfs" + download_file $DOWNLOAD_URL/rootfs.tar.xz \ + ${DOWNLOAD_TEMP}/rootfs.tar.xz normal +- download_sig $DOWNLOAD_URL/rootfs.tar.xz.asc \ +- ${DOWNLOAD_TEMP}/rootfs.tar.xz.asc normal +- gpg_validate ${DOWNLOAD_TEMP}/rootfs.tar.xz.asc +- + echo "Downloading the metadata" + download_file $DOWNLOAD_URL/meta.tar.xz \ + ${DOWNLOAD_TEMP}/meta.tar.xz normal +- download_sig $DOWNLOAD_URL/meta.tar.xz.asc \ +- ${DOWNLOAD_TEMP}/meta.tar.xz.asc normal +- gpg_validate ${DOWNLOAD_TEMP}/meta.tar.xz.asc + + if [ -d $LXC_CACHE_PATH ]; then + rm -Rf $LXC_CACHE_PATH diff --git a/utils/lxc/patches/035-fix-undefined-lfd.patch b/utils/lxc/patches/035-fix-undefined-lfd.patch new file mode 100644 index 0000000..42e194c --- /dev/null +++ b/utils/lxc/patches/035-fix-undefined-lfd.patch @@ -0,0 +1,20 @@ +--- a/src/lxc/bdev.c ++++ b/src/lxc/bdev.c +@@ -1939,7 +1939,7 @@ static int find_free_loopdev(int *retfd, + + static int loop_mount(struct bdev *bdev) + { +- int lfd, ffd = -1, ret = -1; ++ int lfd = -1, ffd = -1, ret = -1; + struct loop_info64 lo; + char loname[100]; + +@@ -1977,7 +1977,7 @@ out: + if (ffd > -1) + close(ffd); + if (ret < 0) { +- close(lfd); ++ if (lfd > -1) close(lfd); + bdev->lofd = -1; + } + return ret; diff --git a/utils/macchanger/Makefile b/utils/macchanger/Makefile new file mode 100644 index 0000000..2bfcbbf --- /dev/null +++ b/utils/macchanger/Makefile @@ -0,0 +1,45 @@ +# +# Copyright (C) 2006-2015 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:=macchanger +PKG_VERSION:=1.7.0 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/alobbs/macchanger/releases/download/$(PKG_VERSION)/ +PKG_MD5SUM:=ca56f16142914337391dac91603eb332 + +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Nicolas Thill + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/macchanger + SECTION:=utils + CATEGORY:=Utilities + TITLE:=utility for viewing/manipulating the MAC address + URL:=https://github.com/alobbs/macchanger/ +endef + +define Package/macchanger/description + This is a GNU/Linux utility for viewing/manipulating the MAC address + of network interfaces. +endef + +define Package/macchanger/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/macchanger $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/share + $(CP) $(PKG_INSTALL_DIR)/usr/share/macchanger $(1)/usr/share/ +endef + +$(eval $(call BuildPackage,macchanger)) diff --git a/utils/macchanger/patches/0001-fix-build-with-musl.patch b/utils/macchanger/patches/0001-fix-build-with-musl.patch new file mode 100644 index 0000000..4a30d55 --- /dev/null +++ b/utils/macchanger/patches/0001-fix-build-with-musl.patch @@ -0,0 +1,13 @@ +Index: macchanger-1.7.0/src/netinfo.c +=================================================================== +--- macchanger-1.7.0.orig/src/netinfo.c ++++ macchanger-1.7.0/src/netinfo.c +@@ -113,7 +113,7 @@ mc_net_info_get_permanent_mac (const net + epa->size = IFHWADDRLEN; + + memcpy(&req, &(net->dev), sizeof(struct ifreq)); +- req.ifr_data = (caddr_t)epa; ++ req.ifr_data = (char *)epa; + + if (ioctl(net->sock, SIOCETHTOOL, &req) < 0) { + perror ("[ERROR] Could not read permanent MAC"); diff --git a/utils/mbtools/Makefile b/utils/mbtools/Makefile new file mode 100644 index 0000000..109adc6 --- /dev/null +++ b/utils/mbtools/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2015 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:=mbtools + +PKG_VERSION:=2014-10-29 +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://github.com/webstack/mbtools +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=149e9c69cec180f18cf8781cf5285b97352bf719 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 + +PKG_FIXUP:=autoreconf +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +PKG_MAINTAINER:=Daniel Golle +PKG_LICENSE:=BSD-3-Clause +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/mbtools + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Modbus tools + DEPENDS:=+glib2 +libmodbus $(INTL_DEPENDS) +endef + +define Package/mbtools/description + Modbus tools based on libmodbus to log data fetched by a master/client or + received by a slave/server (writing of registers). mbcollect is able to act + as client or server (in TCP or RTU) +endef + +ifneq ($(INTL_FULL),) +TARGET_LDFLAGS += \ + -L$(INTL_PREFIX)/lib \ + -Wl,-rpath-link=$(STAGING_DIR)/usr/lib + +endif + +define Package/mbtools/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mbrecorder $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mbcollect $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_BUILD_DIR)/src/mbcollect.ini $(1)/etc +endef + +$(eval $(call BuildPackage,mbtools)) diff --git a/utils/mbtools/patches/100-fix-unit-test-server-return-value.patch b/utils/mbtools/patches/100-fix-unit-test-server-return-value.patch new file mode 100644 index 0000000..1ad7c12 --- /dev/null +++ b/utils/mbtools/patches/100-fix-unit-test-server-return-value.patch @@ -0,0 +1,10 @@ +Index: mbtools-2014-10-29/tests/unit-test-server.c +=================================================================== +--- mbtools-2014-10-29.orig/tests/unit-test-server.c ++++ mbtools-2014-10-29/tests/unit-test-server.c +@@ -117,4 +117,5 @@ int main(int argc, char *argv[]) + } + printf("Quit the loop: %s\n", modbus_strerror(errno)); + signal_handler(0); ++ return 0; + } diff --git a/utils/mc/Config.in b/utils/mc/Config.in new file mode 100644 index 0000000..b2c5794 --- /dev/null +++ b/utils/mc/Config.in @@ -0,0 +1,59 @@ +menu "Configuration" + depends on PACKAGE_mc + +config MC_DIFFVIEWER + bool "Enable internal diff viewer" + default n + help + This option enables the built-in diff viewer. + Disabled by default. + +config MC_EDITOR + bool "Enable internal editor" + default y + help + This option enables the built-in file editor. + Enabled by default. + +config MC_SUBSHELL + bool "Enable concurrent subshell" + default y + help + This option enables concurrent subshell support. + Enabled by default. + +config MC_LARGEFILE + bool "Enable largefile support" + default n + help + This option enables support for large files (> 2 GB). + Disabled by default. + +config MC_BACKGROUND + bool "Enable background operations" + default n + help + This option enables support for background operations which + allow to perform some tasks such as copying files in a + separate background process. Background code is known + to be less stable than the rest of the code. + Disabled by default. + +config MC_CHARSET + bool "Enable charset support" + default y + help + This option adds support for selecting character set of the text in + the internal viewer and editor and converting it on the fly. + Enabled by default. + +config MC_VFS + bool "Enable virtual filesystem support" + default n + help + This option enables the Virtual File System switch code to get + transparent access to the following file systems: + cpio, tar, fish, sfs, ftp, sftp, extfs, smb. + Disabled by default. + +endmenu diff --git a/utils/mc/Makefile b/utils/mc/Makefile new file mode 100644 index 0000000..cca1123 --- /dev/null +++ b/utils/mc/Makefile @@ -0,0 +1,127 @@ +# +# Copyright (C) 2006-2016 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:=mc +PKG_VERSION:=4.8.18 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Brenken +PKG_LICENSE:=GPL-3.0+ + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=http://ftp.midnight-commander.org/ +PKG_MD5SUM:=f7636815c987c1719c4f5de2dcd156a0e7d097b1d10e4466d2bdead343d5bece +PKG_BUILD_PARALLEL:=1 +PKG_FIXUP:=autoreconf gettext-version + +PKG_CONFIG_DEPENDS := \ + CONFIG_PACKAGE_MC \ + CONFIG_MC_DIFFVIEWER \ + CONFIG_MC_EDITOR \ + CONFIG_MC_SUBSHELL \ + CONFIG_MC_LARGEFILE \ + CONFIG_MC_BACKGROUND \ + CONFIG_MC_CHARSET \ + CONFIG_MC_VFS + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/$(PKG_NAME) + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+glib2 +libncurses +libmount +MC_VFS:libssh2 $(LIBRPC_DEPENDS) $(ICONV_DEPENDS) + TITLE:=Midnight Commander - a powerful visual file manager + URL:=https://www.midnight-commander.org/ + MENU:=1 +endef + +define Package/$(PKG_NAME)/config + source "$(SOURCE)/Config.in" +endef + +define Package/$(PKG_NAME)/description +GNU Midnight Commander is a visual file manager. +It's a feature rich full-screen text mode application that allows you to copy, +move and delete files and whole directory trees, search for files and run commands in the subshell. +Internal viewer and editor are included as well. + +endef + +CONFIGURE_ARGS += \ + --disable-doxygen-doc \ + --with-homedir=/etc/mc \ + --with-screen=ncurses \ + --without-gpm-mouse \ + --without-x \ + +CONFIGURE_VARS += \ + ac_cv_search_addwstr=no \ + +ifeq ($(CONFIG_MC_DIFFVIEWER),) +CONFIGURE_ARGS += \ + --without-diff-viewer +endif + +ifeq ($(CONFIG_MC_EDITOR),) +CONFIGURE_ARGS += \ + --without-internal-edit +endif + +ifeq ($(CONFIG_MC_SUBSHELL),) +CONFIGURE_ARGS += \ + --without-subshell +endif + +ifeq ($(CONFIG_MC_LARGEFILE),) +CONFIGURE_ARGS += \ + --disable-largefile +endif + +ifeq ($(CONFIG_MC_BACKGROUND),) +CONFIGURE_ARGS += \ + --disable-background +endif + +ifeq ($(CONFIG_MC_CHARSET),) +CONFIGURE_ARGS += \ + --disable-charset +endif + +ifeq ($(CONFIG_MC_VFS),) +CONFIGURE_ARGS += \ + --disable-vfs +endif + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mc $(1)/usr/bin + $(INSTALL_DIR) $(1)/etc/mc + $(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/mc.charsets $(1)/etc/mc + $(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/mc.default.keymap $(1)/etc/mc + $(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/mc.ext $(1)/etc/mc + $(INSTALL_DIR) $(1)/usr/share/mc/help + $(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/hlp/mc.hlp $(1)/usr/share/mc/help +ifeq ($(CONFIG_MC_DIFFVIEWER),y) + ln -sf mc $(1)/usr/bin/mcdiff +endif +ifeq ($(CONFIG_MC_EDITOR),y) + ln -sf mc $(1)/usr/bin/mcedit +endif + $(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/mc.menu $(1)/etc/mc + $(INSTALL_DIR) $(1)/etc/mc/skins + $(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/skins/default.ini $(1)/etc/mc/skins + $(INSTALL_DIR) $(1)/etc/mc/mcedit/Syntax +endef + +define Package/$(PKG_NAME)/conffiles +/etc/mc/mc.menu +/etc/mc/skins/default.ini +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/utils/mc/patches/010-subshell.patch b/utils/mc/patches/010-subshell.patch new file mode 100644 index 0000000..bd7ee35 --- /dev/null +++ b/utils/mc/patches/010-subshell.patch @@ -0,0 +1,11 @@ +--- a/src/subshell/common.c ++++ b/src/subshell/common.c +@@ -849,7 +849,7 @@ init_subshell_precmd (char *precmd, size + "else " + "[ \"${PWD##$HOME/}\" = \"$PWD\" ] && MC_PWD=\"$PWD\" || MC_PWD=\"~/${PWD##$HOME/}\"; " + "fi; " +- "echo \"$USER@$(hostname -s):$MC_PWD\"; " ++ "echo \"$USER@$HOSTNAME:$MC_PWD\"; " + "pwd>&%d; " + "kill -STOP $$; " + "}; " "PRECMD=precmd; " "PS1='$($PRECMD)$ '\n", subshell_pipe[WRITE]); diff --git a/utils/minicom/Makefile b/utils/minicom/Makefile new file mode 100644 index 0000000..b588993 --- /dev/null +++ b/utils/minicom/Makefile @@ -0,0 +1,46 @@ +# +# Copyright (C) 2006-2015 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:=minicom +PKG_VERSION:=2.7 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://alioth.debian.org/frs/download.php/file/3977/ +PKG_MD5SUM:=7044ca3e291268c33294f171d426dc2d +PKG_MAINTAINER:=Álvaro Fernández Rojas + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/nls.mk +include $(INCLUDE_DIR)/package.mk + +define Package/minicom + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=$(ICONV_DEPENDS) $(INTL_DEPENDS) +libncurses + TITLE:=Terminal emulation program + URL:=http://alioth.debian.org/projects/minicom/ + SUBMENU:=Terminal +endef + +define Package/minicom/conffiles +/etc/minirc.dfl +endef + +define Package/minicom/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ascii-xfr $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,minicom)) diff --git a/utils/minicom/patches/100-fix_iconv_include.patch b/utils/minicom/patches/100-fix_iconv_include.patch new file mode 100644 index 0000000..88190fa --- /dev/null +++ b/utils/minicom/patches/100-fix_iconv_include.patch @@ -0,0 +1,12 @@ +--- a/src/minicom.c ++++ b/src/minicom.c +@@ -31,7 +31,9 @@ + #include + #include + #include ++#ifdef HAVE_ICONV + #include ++#endif + #include + + #define EXTERN diff --git a/utils/minicom/patches/101-fix_music_includes.patch b/utils/minicom/patches/101-fix_music_includes.patch new file mode 100644 index 0000000..a74d123 --- /dev/null +++ b/utils/minicom/patches/101-fix_music_includes.patch @@ -0,0 +1,14 @@ +--- a/src/dial.c ++++ b/src/dial.c +@@ -39,11 +39,9 @@ + #include "intl.h" + + #ifdef VC_MUSIC +-# if defined(__GLIBC__) + # include + # include + # include +-# endif + #endif + + enum { CURRENT_VERSION = 6 }; diff --git a/utils/minicom/patches/102-fix_musl_compatibility.patch b/utils/minicom/patches/102-fix_musl_compatibility.patch new file mode 100644 index 0000000..4524b22 --- /dev/null +++ b/utils/minicom/patches/102-fix_musl_compatibility.patch @@ -0,0 +1,13 @@ +--- a/src/getsdir.h ++++ b/src/getsdir.h +@@ -24,6 +24,10 @@ + + #include + ++#ifndef MAXNAMLEN ++#define MAXNAMLEN 255 ++#endif ++ + typedef struct dirEntry { /* structure of data item */ + char fname[MAXNAMLEN + 1]; /* filename + terminating null */ + time_t time; /* last modification date */ diff --git a/utils/mksh/Makefile b/utils/mksh/Makefile new file mode 100644 index 0000000..445974c --- /dev/null +++ b/utils/mksh/Makefile @@ -0,0 +1,89 @@ +# +# Copyright (C) 2007-2011 OpenWrt.org +# Copyright (c) 2009-2014 Thorsten Glaser +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=mksh +PKG_VERSION:=52c +PKG_RELEASE:=1 + +PKG_MAINTAINER:=Thorsten Glaser +PKG_LICENSE:=MirOS + +PKG_SOURCE:=$(PKG_NAME)-R$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://www.mirbsd.org/MirOS/dist/mir/mksh +PKG_MD5SUM:=cc3884e02314447e7b4a3073b8d65d1e + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/mksh + SECTION:=shells + CATEGORY:=Base system + TITLE:=MirBSD Korn Shell + DEPENDS:=$(DEP) + URL:=http://mirbsd.de/mksh +endef + +define Package/mksh/description +mksh is the MirBSD enhanced version of the Public Domain Korn +shell (pdksh), a Bourne-compatible shell which is largely si- +milar to the original AT&T Korn shell; mksh is the only pdksh +derivate currently being actively developed. It includes bug +fixes and feature improvements, in order to produce a modern, +robust shell good for interactive and especially script use. +mksh has UTF-8 support (in substring operations and the Emacs +editing mode) and - while R50 corresponds to OpenBSD 5.5-cur- +rent ksh (without GNU bash-like PS1 and fancy character clas- +ses) - adheres to SUSv4 and is much more robust. The code has +been cleaned up and simplified, bugs fixed, standards compli- +ance added, and several enhancements (for extended compatibi- +lity to other modern shells - as well as a couple of its own) +are available. It has sensible defaults as usual with BSD. +endef + +define Build/Compile + # -DMKSH_SMALL=1 ⇒ reduce functionality quite a lot + # -DMKSH_ASSUME_UTF8=0 ⇒ never automatically enable + # UTF-8 mode, neither use setlocale/nl_langinfo + # nor look at $LC_* and $LANG (not recommended) + # -DMKSH_BINSHPOSIX ⇒ enable POSIX mode if called as sh + #XXX maybe change to -DMKSH_ASSUME_UTF8=1 now (which + #XXX is always assume UTF-8 mode) + # HAVE_CAN_FSTACKPROTECTORALL=0 ⇒ nuke libssp dependency + # HAVE_CAN_FSTACKPROTECTORSTRONG=0 ⇒ same, for gcc 4.9+ + cd $(PKG_BUILD_DIR); \ + CC="$(TARGET_CC)" \ + TARGET_OS="$(shell uname -s)" \ + CFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="-DMKSH_SMALL=1 -DMKSH_ASSUME_UTF8=0 -DMKSH_BINSHPOSIX" \ + HAVE_CAN_FSTACKPROTECTORALL=0 \ + HAVE_CAN_FSTACKPROTECTORSTRONG=0 \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + $(BASH) Build.sh -Q -r -c lto +endef + +define Package/mksh/postinst +#!/bin/sh +grep mksh $${IPKG_INSTROOT}/etc/shells || \ + echo "/bin/mksh" >> $${IPKG_INSTROOT}/etc/shells +endef + +define Package/mksh/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) $(PKG_BUILD_DIR)/dot.mkshrc $(1)/etc/mkshrc + $(INSTALL_DIR) $(1)/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/mksh $(1)/bin/ +endef + +define Package/mksh/conffiles +/etc/mkshrc +endef + +$(eval $(call BuildPackage,mksh)) diff --git a/utils/mksh/patches/100-dot_mkshrc b/utils/mksh/patches/100-dot_mkshrc new file mode 100644 index 0000000..7e9da8a --- /dev/null +++ b/utils/mksh/patches/100-dot_mkshrc @@ -0,0 +1,46 @@ +Refreshed for mksh-r52c, based on tg's patch + +From 23712cea8e2a623fd952eb781df0011c501703d0 Mon Sep 17 00:00:00 2001 +From: Thorsten Glaser +Date: Thu, 25 Jul 2013 22:07:33 +0200 +Subject: [PATCH] Make default mkshrc file suitable for OpenWrt environment: + +* Part of the FreeWRT patches: + - no hostname(1) + - ls(1) has no -o option +* OpenWrt and FreeWRT-1.0 fix: + - since this is not ~/.mkshrc make sure subshells find it +--- +Signed-off-by: Alif M. A. +--- a/dot.mkshrc ++++ b/dot.mkshrc +@@ -28,8 +28,9 @@ + *) return 0 ;; + esac + +-PS1='#'; (( USER_ID )) && PS1='$'; \: "${TERM:=vt100}${HOSTNAME:=$(\ulimit -c \ +- 0; hostname 2>/dev/null)}${EDITOR:=/bin/ed}${USER:=$(\ulimit -c 0; id -un \ ++PS1='#'; (( USER_ID )) && PS1='$'; \: "${HOSTNAME:=$(/dev/null)}${EDITOR:=/bin/vi}${USER:=$(\ulimit -c 0; id -un \ + 2>/dev/null || \echo \?)}${MKSH:=$(\builtin whence -p mksh)}" + HOSTNAME=${HOSTNAME%%*([ ]).*}; HOSTNAME=${HOSTNAME##*([ ])} + [[ $HOSTNAME = ?(ip6-)localhost?(6) ]] && HOSTNAME= +@@ -52,7 +53,7 @@ + \alias l='ls -F' + \alias la='l -a' + \alias ll='l -l' +-\alias lo='l -alo' ++\alias lo='l -al' + \alias doch='sudo mksh -c "$(\builtin fc -ln -1)"' + \command -v rot13 >/dev/null || \alias rot13='tr \ + abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ \ +@@ -601,4 +602,8 @@ + + \unset p + ++# we need this in OpenWrt for subshells that are not login shells ++\: ${ENV=/etc/mkshrc} ++[[ -z $ENV ]] || export ENV ++ + \: place customisations above this line diff --git a/utils/mktorrent/Makefile b/utils/mktorrent/Makefile new file mode 100644 index 0000000..2e23e23 --- /dev/null +++ b/utils/mktorrent/Makefile @@ -0,0 +1,41 @@ +# +# 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:=mktorrent +PKG_VERSION:=1.0 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Daniel Golle +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://downloads.sourceforge.net/$(PKG_NAME)/ +PKG_MD5SUM:=0da00209da96a0dc39efbb6eb5b4d8ff + +include $(INCLUDE_DIR)/package.mk + +define Package/mktorrent + SUBMENU:=BitTorrent + SECTION:=net + CATEGORY:=Network + TITLE:=mktorrent + URL:=http://mktorrent.sourceforge.net/ +endef + +define Package/mktorrent/Description + mktorrent is a simple command line utility to create BitTorrent metainfo files. +endef + + +define Package/mktorrent/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/mktorrent $(1)/usr/bin +endef + +$(eval $(call BuildPackage,mktorrent)) diff --git a/utils/mmc-utils/Makefile b/utils/mmc-utils/Makefile new file mode 100644 index 0000000..9e1d70e --- /dev/null +++ b/utils/mmc-utils/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2015-2016 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:=mmc-utils +PKG_VERSION=2016-09-11-$(PKG_SOURCE_VERSION) +PKG_RELEASE:=2 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git +PKG_SOURCE_VERSION:=2cb6695e8dec00d887bdd5309d1b57d836fcd214 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:= + +PKG_MAINTAINER:=Michael Heimpold + +PKG_BUILD_PARALLEL:=1 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/mmc-utils + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Userspace tools for MMC/SD devices + URL:=http://git.kernel.org/cgit/linux/kernel/git/cjb/mmc-utils.git +endef + +define Package/mmc-utils/description + This package contains the userspace mmc utils, the userspace + counterpart to the Linux MMC/SD subsystem. +endef + +define Build/Configure +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) CFLAGS="$(TARGET_CFLAGS) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2" \ + mmc +endef + +define Package/mmc-utils/install + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/mmc $(1)/sbin +endef + +$(eval $(call BuildPackage,mmc-utils)) diff --git a/utils/mmc-utils/patches/001-properly-set-fortify-source-in-makefile.patch b/utils/mmc-utils/patches/001-properly-set-fortify-source-in-makefile.patch new file mode 100644 index 0000000..1a20813 --- /dev/null +++ b/utils/mmc-utils/patches/001-properly-set-fortify-source-in-makefile.patch @@ -0,0 +1,9 @@ +--- a/Makefile ++++ b/Makefile +@@ -1,5 +1,5 @@ + CC ?= gcc +-AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 ++AM_CFLAGS = -D_FILE_OFFSET_BITS=64 + CFLAGS ?= -g -O2 + objects = \ + mmc.o \ diff --git a/utils/mmc-utils/patches/002-mmc-ll64.patch b/utils/mmc-utils/patches/002-mmc-ll64.patch new file mode 100644 index 0000000..7484780 --- /dev/null +++ b/utils/mmc-utils/patches/002-mmc-ll64.patch @@ -0,0 +1,12 @@ +Sent already upstream, no response yet. + +--- a/mmc.h 2016-09-11 18:01:53.000000000 +0200 ++++ b/mmc.h 2016-09-23 23:41:02.462632858 +0200 +@@ -17,7 +17,6 @@ + * those modifications are Copyright (c) 2016 SanDisk Corp. + */ + +-#include + #include + #include + diff --git a/utils/mpack/Makefile b/utils/mpack/Makefile new file mode 100644 index 0000000..c2b77eb --- /dev/null +++ b/utils/mpack/Makefile @@ -0,0 +1,45 @@ +# +# Copyright (C) 2007-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:=mpack +PKG_VERSION:=1.6 +PKG_RELEASE:=1 +PKG_LICENSE:=NLPL + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://ftp.andrew.cmu.edu/pub/mpack/ +PKG_MD5SUM:=a70fa5afa76539a9afb70b9d81568fe8 + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/mpack + SECTION:=utils + CATEGORY:=Utilities + TITLE:=mpack/munpack MIME format mail messages + URL:=http://ftp.andrew.cmu.edu/pub/mpack/ + MAINTAINER:=Dmitry V. Zimin +endef + +define Package/mpack/description + Mpack and munpack are utilities for encoding and decoding + (respectively) binary files in MIME (Multipurpose Internet Mail + Extensions) format mail messages. For compatibility with older forms + of transferring binary files, the munpack program can also decode + messages in split-uuencoded format. +endef + +define Package/mpack/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,mpack)) + diff --git a/utils/mt-st/Makefile b/utils/mt-st/Makefile new file mode 100644 index 0000000..45056eb --- /dev/null +++ b/utils/mt-st/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2015 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:=mt-st +PKG_VERSION:=1.1 +PKG_RELEASE:=1 + +PKG_SOURCE_SUBDIR:=$(PKG_NAME) +PKG_SOURCE_VERSION:=$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz +PKG_SOURCE_URL:=ftp://ftp.ibiblio.org/pub/Linux/system/backup/ +PKG_MD5SUM:=fdd5f5ec673c9f630a102ceff7612774 + +PKG_LICENSE:=GPL-2.0 + +include $(INCLUDE_DIR)/package.mk + +define Package/mt-st + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Magnetic tape control tools for Linux SCSI tapes + URL:=http://ftp.ibiblio.org/pub/Linux/system/backup/ + MAINTAINER:=Giuseppe Magnotta +endef + +define Package/mt-st/description + Includes a mt-like program supporting additional commands using ioctls + specific to the Linux SCSI tape driver (up to kernel 2.6.26), and the program + stinit to define the SCSI tape devices in system startup scripts. +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ + CC="$(TARGET_CC)" +endef + +define Package/mt-st/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/mt $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/stinit $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,mt-st)) diff --git a/utils/mysql/Makefile b/utils/mysql/Makefile new file mode 100644 index 0000000..c842230 --- /dev/null +++ b/utils/mysql/Makefile @@ -0,0 +1,189 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/uclibc++.mk + +PKG_NAME:=mysql +PKG_VERSION:=5.1.73 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=\ + http://mysql.he.net/Downloads/MySQL-5.1/ \ + http://www.linorg.usp.br/mysql/Downloads/MySQL-5.1/ \ + http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.1/ \ + http://mirror.switch.ch/ftp/mirror/mysql/Downloads/MySQL-5.1/ + +PKG_MD5SUM:=887f869bcc757957067b9198f707f32f +PKG_MAINTAINER:=Jo-Philipp Wich +PKG_LICENSE:=GPL-2.0 + +PKG_BUILD_DEPENDS:=libncurses libreadline +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +PKG_FIXUP:=libtool + +include $(INCLUDE_DIR)/package.mk + +define Package/libmysqlclient/Default + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=$(CXX_DEPENDS) +zlib + TITLE:=MySQL client library + URL:=http://dev.mysql.com/ +endef + +define Package/mysql-server + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libmysqlclient +libpthread +libncursesw +libreadline + TITLE:=MySQL Server + URL:=http://dev.mysql.com/ + SUBMENU:=database +endef + +define Package/libmysqlclient + $(call Package/libmysqlclient/Default) +endef + +define Package/libmysqlclient-r + $(call Package/libmysqlclient/Default) + TITLE += threadsafe + DEPENDS+= +libpthread +endef + +ifneq ($(CONFIG_USE_UCLIBCXX),) + TARGET_CXX=g++-uc +endif + +TARGET_CFLAGS += $(FPIC) + +CONFIGURE_ARGS += \ + --enable-shared \ + --enable-static \ + --enable-thread-safe-client \ + --disable-assembler \ + --with-pthread \ + --with-server \ + --without-mysqlmanager \ + --with-mysqld-user=root \ + --with-unix-socket-path=/tmp \ + --without-libwrap \ + --with-low-memory \ + --without-embedded-server \ + --without-query-cache \ + --without-ssl \ + --without-docs \ + --without-man \ + --without-readline \ + --without-debug \ + --with-named-thread-libs=-lpthread + +CONFIGURE_VARS += \ + mysql_cv_compress=yes \ + mysql_cv_gethostname_style=glibc2 \ + mysql_cv_gcc_atomic_builtins=yes \ + mysql_cv_gcc_atomic_builtins_pthread_t=yes \ + ac_cv_c_stack_direction=-1 + +define Build/Compile + +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \ + SUBDIRS="include" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all + $(MAKE) -C "$(PKG_BUILD_DIR)" \ + SUBDIRS="include" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + install + g++ -I $(PKG_BUILD_DIR)/include \ + -o $(PKG_BUILD_DIR)/sql/gen_lex_hash \ + $(PKG_BUILD_DIR)/sql/gen_lex_hash.cc + +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)/libmysql" \ + CC="g++" \ + CFLAGS="$(HOST_CFLAGS)" \ + CPPFLAGS="$(HOST_CFLAGS)" \ + LDFLAGS="$(HOST_LDFLAGS)" \ + conf_to_src + +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \ + SUBDIRS="libmysql" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all + $(MAKE) -C "$(PKG_BUILD_DIR)" \ + SUBDIRS="libmysql" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + install + +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \ + SUBDIRS="libmysql_r" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all + $(MAKE) -C "$(PKG_BUILD_DIR)" \ + SUBDIRS="libmysql_r" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + install + $(MAKE) -C "$(PKG_BUILD_DIR)" \ + SUBDIRS="scripts" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + bin_SCRIPTS="mysql_config" \ + install + +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all + $(MAKE) -C "$(PKG_BUILD_DIR)" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + install +endef + + +define Build/InstallDev + $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_config $(1)/usr/bin/ + ln -sf $(STAGING_DIR)/usr/bin/mysql_config $(2)/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/include/mysql $(1)/usr/include/ + # NOTE: needed for MySQL-Python + $(CP) $(PKG_BUILD_DIR)/include/mysqld_error.h $(1)/usr/include/mysql/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql $(1)/usr/lib/ + rm -f $(1)/usr/lib/mysql/libmysqlclient.la +endef + +define Package/libmysqlclient/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql/libmysqlclient.so.* $(1)/usr/lib/ +endef +define Package/libmysqlclient-r/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql/libmysqlclient_r.so.* $(1)/usr/lib/ +endef + +define Package/mysql-server/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/mysqld $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/myisamchk $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysqladmin $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysqldump $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_install_db $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/my_print_defaults $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) files/mysqld.init $(1)/etc/init.d/mysqld + $(INSTALL_CONF) conf/my.cnf $(1)/etc/ + $(INSTALL_DIR) $(1)/usr/share/mysql + $(INSTALL_DIR) $(1)/usr/share/mysql/english + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/english/errmsg.sys $(1)/usr/share/mysql/english + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/fill_help_tables.sql $(1)/usr/share/mysql/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables.sql $(1)/usr/share/mysql/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables_data.sql $(1)/usr/share/mysql/ +endef + +define Package/mysql-server/conffiles +/etc/my.cnf +endef + +$(eval $(call BuildPackage,mysql-server)) +$(eval $(call BuildPackage,libmysqlclient)) +$(eval $(call BuildPackage,libmysqlclient-r)) diff --git a/utils/mysql/conf/my.cnf b/utils/mysql/conf/my.cnf new file mode 100644 index 0000000..ec2ade2 --- /dev/null +++ b/utils/mysql/conf/my.cnf @@ -0,0 +1,54 @@ +[client] +port = 3306 +socket = /var/run/mysqld.sock + +[mysqld] +user = root +socket = /var/run/mysqld.sock +port = 3306 +basedir = /usr + +############ Don't put this on the NAND ############# +# Figure out where you are going to put the databases +# And run mysql_install_db --force +datadir = /mnt/data/mysql/ + +######### This should also not go on the NAND ####### +tmpdir = /mnt/data/tmp/ + +skip-external-locking + +bind-address = 127.0.0.1 + +# Fine Tuning +key_buffer = 16M +max_allowed_packet = 16M +thread_stack = 192K +thread_cache_size = 8 + +# Here you can see queries with especially long duration +#log_slow_queries = /var/log/mysql/mysql-slow.log +#long_query_time = 2 +#log-queries-not-using-indexes + +# The following can be used as easy to replay backup logs or for replication. +#server-id = 1 +#log_bin = /var/log/mysql/mysql-bin.log +#expire_logs_days = 10 +#max_binlog_size = 100M +#binlog_do_db = include_database_name +#binlog_ignore_db = include_database_name + + +[mysqldump] +quick +quote-names +max_allowed_packet = 16M + +[mysql] +#no-auto-rehash # faster start of mysql but no tab completition + +[isamchk] +key_buffer = 16M + + diff --git a/utils/mysql/files/mysqld.init b/utils/mysql/files/mysqld.init new file mode 100644 index 0000000..eec96c0 --- /dev/null +++ b/utils/mysql/files/mysqld.init @@ -0,0 +1,30 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2010-2011 OpenWrt.org + +START=95 +STOP=10 + +SERVICE_DAEMONIZE=1 +SERVICE_WRITE_PID=1 +SERVICE_STOP_TIME=9 + +error() { + echo "${initscript}:" "$@" 1>&2 +} + +start() { + local datadir=$(sed -n -e "s/^[[:space:]]*datadir[[:space:]]*=[[:space:]\"']*\([^[:space:]\"']*\)[[:space:]\"']*/\1/p" /etc/my.cnf) + if [ ! -d "$datadir" ]; then + error "Error: datadir '$datadir' in /etc/my.cnf doesn't exist" + return 1 + fi + if [ ! -f "$datadir/mysql/tables_priv.MYD" ]; then + error "Error: I didn't detect a privileges table, you might need to run mysql_install_db --force to initialize the system tables" + return 1 + fi + service_start /usr/bin/mysqld +} + +stop() { + service_stop /usr/bin/mysqld +} diff --git a/utils/mysql/patches/100-fix_hostname.patch b/utils/mysql/patches/100-fix_hostname.patch new file mode 100644 index 0000000..faedc27 --- /dev/null +++ b/utils/mysql/patches/100-fix_hostname.patch @@ -0,0 +1,11 @@ +--- a/scripts/mysql_install_db.sh ++++ b/scripts/mysql_install_db.sh +@@ -322,7 +322,7 @@ then + fi + + # Try to determine the hostname +-hostname=`@HOSTNAME@` ++hostname=`cat /proc/sys/kernel/hostname` + + # Check if hostname is valid + if test "$cross_bootstrap" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0 diff --git a/utils/mysql/patches/110-cross_compile.patch b/utils/mysql/patches/110-cross_compile.patch new file mode 100644 index 0000000..85d2591 --- /dev/null +++ b/utils/mysql/patches/110-cross_compile.patch @@ -0,0 +1,179 @@ +--- a/storage/innodb_plugin/plug.in ++++ b/storage/innodb_plugin/plug.in +@@ -56,10 +56,8 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [ + esac + AC_SUBST(INNODB_DYNAMIC_CFLAGS) + +- AC_MSG_CHECKING(whether GCC atomic builtins are available) +- # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not +- AC_TRY_RUN( +- [ ++ AC_CACHE_CHECK([whether GCC atomic builtins are available], ++ [mysql_cv_gcc_atomic_builtins], [AC_TRY_RUN([ + int main() + { + long x; +@@ -96,21 +94,18 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [ + + return(0); + } +- ], +- [ +- AC_DEFINE([HAVE_IB_GCC_ATOMIC_BUILTINS], [1], +- [GCC atomic builtins are available]) +- AC_MSG_RESULT(yes) +- ], +- [ +- AC_MSG_RESULT(no) +- ] +- ) ++ ], [mysql_cv_gcc_atomic_builtins=yes], ++ [mysql_cv_gcc_atomic_builtins=no], ++ [mysql_cv_gcc_atomic_builtins=no])]) ++ ++ if test "x$mysql_cv_gcc_atomic_builtins" = xyes; then ++ AC_DEFINE(HAVE_IB_GCC_ATOMIC_BUILTINS, 1, ++ [Define to 1 if compiler provides atomic builtins.]) ++ fi + +- AC_MSG_CHECKING(whether pthread_t can be used by GCC atomic builtins) +- # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not +- AC_TRY_RUN( +- [ ++ ++ AC_CACHE_CHECK([whether pthread_t can be used by GCC atomic builtins], ++ [mysql_cv_gcc_atomic_builtins_pthread_t], [AC_TRY_RUN([ + #include + #include + +@@ -127,16 +122,14 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [ + + return(0); + } +- ], +- [ +- AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_GCC], [1], +- [pthread_t can be used by GCC atomic builtins]) +- AC_MSG_RESULT(yes) +- ], +- [ +- AC_MSG_RESULT(no) +- ] +- ) ++ ], [mysql_cv_gcc_atomic_builtins_pthread_t=yes], ++ [mysql_cv_gcc_atomic_builtins_pthread_t=no], ++ [mysql_cv_gcc_atomic_builtins_pthread_t=no])]) ++ ++ if test "x$mysql_cv_gcc_atomic_builtins_pthread_t" = xyes; then ++ AC_DEFINE(HAVE_IB_ATOMIC_PTHREAD_T_GCC, 1, ++ [Define to 1 if pthread_t can be used by GCC atomic builtins]) ++ fi + + AC_MSG_CHECKING(whether Solaris libc atomic functions are available) + # Define HAVE_IB_SOLARIS_ATOMICS if _all_ of the following +@@ -156,7 +149,6 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [ + AC_DEFINE([HAVE_IB_SOLARIS_ATOMICS], [1], + [Define to 1 if Solaris libc atomic functions are available] + ) +- fi + + AC_MSG_CHECKING(whether pthread_t can be used by Solaris libc atomic functions) + # either define HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS or not +@@ -230,6 +222,8 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [ + AC_MSG_RESULT(no) + ] + ) ++ fi ++ + ]) + + # vim: set ft=config: +--- a/sql/gen_lex_hash.cc ++++ b/sql/gen_lex_hash.cc +@@ -344,55 +344,6 @@ void print_find_structs() + } + + +-static void usage(int version) +-{ +- printf("%s Ver 3.6 Distrib %s, for %s (%s)\n", +- my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); +- if (version) +- return; +- puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); +- puts("This program generates a perfect hashing function for the sql_lex.cc"); +- printf("Usage: %s [OPTIONS]\n\n", my_progname); +- my_print_help(my_long_options); +-} +- +- +-extern "C" my_bool +-get_one_option(int optid, const struct my_option *opt __attribute__((unused)), +- char *argument __attribute__((unused))) +-{ +- switch(optid) { +- case 'V': +- usage(1); +- exit(0); +- case 'I': +- case '?': +- usage(0); +- exit(0); +- case '#': +- DBUG_PUSH(argument ? argument : default_dbug_option); +- break; +- } +- return 0; +-} +- +- +-static int get_options(int argc, char **argv) +-{ +- int ho_error; +- +- if ((ho_error= handle_options(&argc, &argv, my_long_options, get_one_option))) +- exit(ho_error); +- +- if (argc >= 1) +- { +- usage(0); +- exit(1); +- } +- return(0); +-} +- +- + int check_dup_symbols(SYMBOL *s1, SYMBOL *s2) + { + if (s1->length!=s2->length || strncmp(s1->name,s2->name,s1->length)) +@@ -443,12 +394,6 @@ int check_duplicates() + + int main(int argc,char **argv) + { +- MY_INIT(argv[0]); +- DBUG_PROCESS(argv[0]); +- +- if (get_options(argc,(char **) argv)) +- exit(1); +- + /* Broken up to indicate that it's not advice to you, gentle reader. */ + printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n"); + +@@ -549,7 +494,6 @@ static SYMBOL *get_hash_symbol(const cha + }\n\ + }\n" + ); +- my_end(0); + exit(0); + } + +--- a/sql/Makefile.am ++++ b/sql/Makefile.am +@@ -26,7 +26,6 @@ INCLUDES = @ZLIB_INCLUDES@ \ + WRAPLIBS= @WRAPLIBS@ + SUBDIRS = share + libexec_PROGRAMS = mysqld +-EXTRA_PROGRAMS = gen_lex_hash + bin_PROGRAMS = mysql_tzinfo_to_sql + + noinst_LTLIBRARIES= libndb.la \ diff --git a/utils/mysql/patches/120-bison-compat.patch b/utils/mysql/patches/120-bison-compat.patch new file mode 100644 index 0000000..6c9ac94 --- /dev/null +++ b/utils/mysql/patches/120-bison-compat.patch @@ -0,0 +1,3290 @@ +--- a/sql/sql_lex.cc ++++ b/sql/sql_lex.cc +@@ -775,14 +775,13 @@ bool consume_comment(Lex_input_stream *l + (which can't be followed by a signed number) + */ + +-int MYSQLlex(void *arg, void *yythd) ++int MYSQLlex(void *arg, THD *thd) + { + reg1 uchar c= 0; + bool comment_closed; + int tokval, result_state; + uint length; + enum my_lex_states state; +- THD *thd= (THD *)yythd; + Lex_input_stream *lip= & thd->m_parser_state->m_lip; + LEX *lex= thd->lex; + YYSTYPE *yylval=(YYSTYPE*) arg; +--- a/sql/sql_lex.h ++++ b/sql/sql_lex.h +@@ -2072,7 +2072,7 @@ extern void lex_init(void); + extern void lex_free(void); + extern void lex_start(THD *thd); + extern void lex_end(LEX *lex); +-extern int MYSQLlex(void *arg, void *yythd); ++extern int MYSQLlex(void *arg, THD *thd); + + extern void trim_whitespace(CHARSET_INFO *cs, LEX_STRING *str); + +--- a/sql/sql_parse.cc ++++ b/sql/sql_parse.cc +@@ -8012,7 +8012,7 @@ bool check_host_name(LEX_STRING *str) + } + + +-extern int MYSQLparse(void *thd); // from sql_yacc.cc ++extern int MYSQLparse(THD *thd); // from sql_yacc.cc + + + /** +--- a/sql/sql_yacc.yy ++++ b/sql/sql_yacc.yy +@@ -25,17 +25,15 @@ + %{ + /* thd is passed as an argument to yyparse(), and subsequently to yylex(). + ** The type will be void*, so it must be cast to (THD*) when used. +-** Use the YYTHD macro for this. ++** Use the thd macro for this. + */ +-#define YYPARSE_PARAM yythd +-#define YYLEX_PARAM yythd +-#define YYTHD ((THD *)yythd) +-#define YYLIP (& YYTHD->m_parser_state->m_lip) ++#define YYLIP (& thd->m_parser_state->m_lip) ++#define YYPS (& thd->m_parser_state->m_yacc) + + #define MYSQL_YACC + #define YYINITDEPTH 100 + #define YYMAXDEPTH 3200 /* Because of 64K stack */ +-#define Lex (YYTHD->lex) ++#define Lex (thd->lex) + #define Select Lex->current_select + #include "mysql_priv.h" + #include "slave.h" +@@ -64,7 +62,7 @@ const LEX_STRING null_lex_str= {0,0}; + ulong val= *(F); \ + if (my_yyoverflow((B), (D), &val)) \ + { \ +- yyerror((char*) (A)); \ ++ yyerror(current_thd, (char*) (A)); \ + return 2; \ + } \ + else \ +@@ -76,7 +74,7 @@ const LEX_STRING null_lex_str= {0,0}; + #define MYSQL_YYABORT \ + do \ + { \ +- LEX::cleanup_lex_after_parse_error(YYTHD);\ ++ LEX::cleanup_lex_after_parse_error(thd); \ + YYABORT; \ + } while (0) + +@@ -159,10 +157,8 @@ void my_parse_error(const char *s) + to abort from the parser. + */ + +-void MYSQLerror(const char *s) ++void MYSQLerror(THD *thd, const char *s) + { +- THD *thd= current_thd; +- + /* + Restore the original LEX if it was replaced when parsing + a stored procedure. We must ensure that a parsing error +@@ -675,7 +671,10 @@ static bool add_create_index (LEX *lex, + bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); + %} + +-%pure_parser /* We have threads */ ++/* We have threads */ ++%define api.pure ++%parse-param { THD *thd } ++%lex-param { THD *thd } + /* + Currently there are 169 shift/reduce conflicts. + We should not introduce new conflicts any more. +@@ -1516,7 +1515,6 @@ rule: <-- starts at col 1 + query: + END_OF_INPUT + { +- THD *thd= YYTHD; + if (!thd->bootstrap && + (!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT))) + { +@@ -1530,7 +1528,7 @@ query: + { + Lex_input_stream *lip = YYLIP; + +- if ((YYTHD->client_capabilities & CLIENT_MULTI_QUERIES) && ++ if ((thd->client_capabilities & CLIENT_MULTI_QUERIES) && + ! lip->stmt_prepare_mode && + ! lip->eof()) + { +@@ -1626,7 +1624,6 @@ statement: + deallocate: + deallocate_or_drop PREPARE_SYM ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + lex->sql_command= SQLCOM_DEALLOCATE_PREPARE; + lex->prepared_stmt_name= $3; +@@ -1641,7 +1638,6 @@ deallocate_or_drop: + prepare: + PREPARE_SYM ident FROM prepare_src + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + lex->sql_command= SQLCOM_PREPARE; + lex->prepared_stmt_name= $2; +@@ -1651,14 +1647,12 @@ prepare: + prepare_src: + TEXT_STRING_sys + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + lex->prepared_stmt_code= $1; + lex->prepared_stmt_code_is_varref= FALSE; + } + | '@' ident_or_text + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + lex->prepared_stmt_code= $2; + lex->prepared_stmt_code_is_varref= TRUE; +@@ -1668,7 +1662,6 @@ prepare_src: + execute: + EXECUTE_SYM ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + lex->sql_command= SQLCOM_EXECUTE; + lex->prepared_stmt_name= $2; +@@ -1826,7 +1819,6 @@ master_file_def: + create: + CREATE opt_table_options TABLE_SYM opt_if_not_exists table_ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + lex->sql_command= SQLCOM_CREATE_TABLE; + if (!lex->select_lex.add_table_to_list(thd, $5, NULL, +@@ -1844,13 +1836,13 @@ create: + } + create2 + { +- LEX *lex= YYTHD->lex; ++ LEX *lex= thd->lex; + lex->current_select= &lex->select_lex; + if ((lex->create_info.used_fields & HA_CREATE_USED_ENGINE) && + !lex->create_info.db_type) + { +- lex->create_info.db_type= ha_default_handlerton(YYTHD); +- push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN, ++ lex->create_info.db_type= ha_default_handlerton(thd); ++ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_USING_OTHER_HANDLER, + ER(ER_WARN_USING_OTHER_HANDLER), + ha_resolve_storage_engine_name(lex->create_info.db_type), +@@ -1979,7 +1971,6 @@ server_option: + event_tail: + remember_name EVENT_SYM opt_if_not_exists sp_name + { +- THD *thd= YYTHD; + LEX *lex=Lex; + + lex->stmt_definition_begin= $1; +@@ -2046,7 +2037,7 @@ opt_ev_status: + ev_starts: + /* empty */ + { +- Item *item= new (YYTHD->mem_root) Item_func_now_local(); ++ Item *item= new (thd->mem_root) Item_func_now_local(); + if (item == NULL) + MYSQL_YYABORT; + Lex->event_parse_data->item_starts= item; +@@ -2096,7 +2087,6 @@ opt_ev_comment: + + ev_sql_stmt: + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + +@@ -2139,7 +2129,6 @@ ev_sql_stmt: + } + ev_sql_stmt_inner + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + + /* return back to the original memory root ASAP */ +@@ -2198,11 +2187,10 @@ sp_name: + $$= new sp_name($1, $3, true); + if ($$ == NULL) + MYSQL_YYABORT; +- $$->init_qname(YYTHD); ++ $$->init_qname(thd); + } + | ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + LEX_STRING db; + if (check_routine_name(&$1)) +@@ -2272,7 +2260,7 @@ call: + lex->sql_command= SQLCOM_CALL; + lex->spname= $2; + lex->value_list.empty(); +- sp_add_used_routine(lex, YYTHD, $2, TYPE_ENUM_PROCEDURE); ++ sp_add_used_routine(lex, thd, $2, TYPE_ENUM_PROCEDURE); + } + opt_sp_cparam_list {} + ; +@@ -2345,7 +2333,7 @@ sp_fdparam: + (enum enum_field_types)$3, + sp_param_in); + +- if (lex->sphead->fill_field_definition(YYTHD, lex, ++ if (lex->sphead->fill_field_definition(thd, lex, + (enum enum_field_types) $3, + &spvar->field_def)) + { +@@ -2382,7 +2370,7 @@ sp_pdparam: + (enum enum_field_types)$4, + (sp_param_mode_t)$1); + +- if (lex->sphead->fill_field_definition(YYTHD, lex, ++ if (lex->sphead->fill_field_definition(thd, lex, + (enum enum_field_types) $4, + &spvar->field_def)) + { +@@ -2445,13 +2433,12 @@ sp_decl: + { + LEX *lex= Lex; + +- lex->sphead->reset_lex(YYTHD); ++ lex->sphead->reset_lex(thd); + lex->spcont->declare_var_boundary($2); + } + type + sp_opt_default + { +- THD *thd= YYTHD; + LEX *lex= Lex; + sp_pcontext *pctx= lex->spcont; + uint num_vars= pctx->context_var_count(); +@@ -2477,7 +2464,7 @@ sp_decl: + spvar->type= var_type; + spvar->dflt= dflt_value_item; + +- if (lex->sphead->fill_field_definition(YYTHD, lex, var_type, ++ if (lex->sphead->fill_field_definition(thd, lex, var_type, + &spvar->field_def)) + { + MYSQL_YYABORT; +@@ -2501,7 +2488,7 @@ sp_decl: + } + + pctx->declare_var_boundary(0); +- if (lex->sphead->restore_lex(YYTHD)) ++ if (lex->sphead->restore_lex(thd)) + MYSQL_YYABORT; + $$.vars= $2; + $$.conds= $$.hndlrs= $$.curs= 0; +@@ -2516,7 +2503,7 @@ sp_decl: + my_error(ER_SP_DUP_COND, MYF(0), $2.str); + MYSQL_YYABORT; + } +- if(YYTHD->lex->spcont->push_cond(&$2, $5)) ++ if(thd->lex->spcont->push_cond(&$2, $5)) + MYSQL_YYABORT; + $$.vars= $$.hndlrs= $$.curs= 0; + $$.conds= 1; +@@ -2602,7 +2589,7 @@ sp_decl: + + sp_cursor_stmt: + { +- Lex->sphead->reset_lex(YYTHD); ++ Lex->sphead->reset_lex(thd); + } + select + { +@@ -2618,7 +2605,7 @@ sp_cursor_stmt: + } + lex->sp_lex_in_use= TRUE; + $$= lex; +- if (lex->sphead->restore_lex(YYTHD)) ++ if (lex->sphead->restore_lex(thd)) + MYSQL_YYABORT; + } + ; +@@ -2662,7 +2649,7 @@ sp_hcond_element: + sp_cond: + ulong_num + { /* mysql errno */ +- $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t)); ++ $$= (sp_cond_type_t *)thd->alloc(sizeof(sp_cond_type_t)); + if ($$ == NULL) + MYSQL_YYABORT; + $$->type= sp_cond_type_t::number; +@@ -2675,7 +2662,7 @@ sp_cond: + my_error(ER_SP_BAD_SQLSTATE, MYF(0), $3.str); + MYSQL_YYABORT; + } +- $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t)); ++ $$= (sp_cond_type_t *) thd->alloc(sizeof(sp_cond_type_t)); + if ($$ == NULL) + MYSQL_YYABORT; + $$->type= sp_cond_type_t::state; +@@ -2705,21 +2692,21 @@ sp_hcond: + } + | SQLWARNING_SYM /* SQLSTATEs 01??? */ + { +- $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t)); ++ $$= (sp_cond_type_t *) thd->alloc(sizeof(sp_cond_type_t)); + if ($$ == NULL) + MYSQL_YYABORT; + $$->type= sp_cond_type_t::warning; + } + | not FOUND_SYM /* SQLSTATEs 02??? */ + { +- $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t)); ++ $$= (sp_cond_type_t *) thd->alloc(sizeof(sp_cond_type_t)); + if ($$ == NULL) + MYSQL_YYABORT; + $$->type= sp_cond_type_t::notfound; + } + | SQLEXCEPTION_SYM /* All other SQLSTATEs */ + { +- $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t)); ++ $$= (sp_cond_type_t *) thd->alloc(sizeof(sp_cond_type_t)); + if ($$ == NULL) + MYSQL_YYABORT; + $$->type= sp_cond_type_t::exception; +@@ -2789,7 +2776,6 @@ sp_proc_stmt_if: + + sp_proc_stmt_statement: + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + +@@ -2798,7 +2784,6 @@ sp_proc_stmt_statement: + } + statement + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + sp_head *sp= lex->sphead; +@@ -2845,7 +2830,7 @@ sp_proc_stmt_statement: + + sp_proc_stmt_return: + RETURN_SYM +- { Lex->sphead->reset_lex(YYTHD); } ++ { Lex->sphead->reset_lex(thd); } + expr + { + LEX *lex= Lex; +@@ -2867,7 +2852,7 @@ sp_proc_stmt_return: + MYSQL_YYABORT; + sp->m_flags|= sp_head::HAS_RETURN; + } +- if (sp->restore_lex(YYTHD)) ++ if (sp->restore_lex(thd)) + MYSQL_YYABORT; + } + ; +@@ -3094,7 +3079,7 @@ sp_fetch_list: + ; + + sp_if: +- { Lex->sphead->reset_lex(YYTHD); } ++ { Lex->sphead->reset_lex(thd); } + expr THEN_SYM + { + LEX *lex= Lex; +@@ -3108,7 +3093,7 @@ sp_if: + sp->add_cont_backpatch(i) || + sp->add_instr(i)) + MYSQL_YYABORT; +- if (sp->restore_lex(YYTHD)) ++ if (sp->restore_lex(thd)) + MYSQL_YYABORT; + } + sp_proc_stmts1 +@@ -3147,7 +3132,7 @@ simple_case_stmt: + { + LEX *lex= Lex; + case_stmt_action_case(lex); +- lex->sphead->reset_lex(YYTHD); /* For expr $3 */ ++ lex->sphead->reset_lex(thd); /* For expr $3 */ + } + expr + { +@@ -3156,7 +3141,7 @@ simple_case_stmt: + MYSQL_YYABORT; + + /* For expr $3 */ +- if (lex->sphead->restore_lex(YYTHD)) ++ if (lex->sphead->restore_lex(thd)) + MYSQL_YYABORT; + } + simple_when_clause_list +@@ -3198,7 +3183,7 @@ searched_when_clause_list: + simple_when_clause: + WHEN_SYM + { +- Lex->sphead->reset_lex(YYTHD); /* For expr $3 */ ++ Lex->sphead->reset_lex(thd); /* For expr $3 */ + } + expr + { +@@ -3208,7 +3193,7 @@ simple_when_clause: + if (case_stmt_action_when(lex, $3, true)) + MYSQL_YYABORT; + /* For expr $3 */ +- if (lex->sphead->restore_lex(YYTHD)) ++ if (lex->sphead->restore_lex(thd)) + MYSQL_YYABORT; + } + THEN_SYM +@@ -3223,7 +3208,7 @@ simple_when_clause: + searched_when_clause: + WHEN_SYM + { +- Lex->sphead->reset_lex(YYTHD); /* For expr $3 */ ++ Lex->sphead->reset_lex(thd); /* For expr $3 */ + } + expr + { +@@ -3231,7 +3216,7 @@ searched_when_clause: + if (case_stmt_action_when(lex, $3, false)) + MYSQL_YYABORT; + /* For expr $3 */ +- if (lex->sphead->restore_lex(YYTHD)) ++ if (lex->sphead->restore_lex(thd)) + MYSQL_YYABORT; + } + THEN_SYM +@@ -3395,7 +3380,7 @@ sp_unlabeled_control: + MYSQL_YYABORT; + } + | WHILE_SYM +- { Lex->sphead->reset_lex(YYTHD); } ++ { Lex->sphead->reset_lex(thd); } + expr DO_SYM + { + LEX *lex= Lex; +@@ -3409,7 +3394,7 @@ sp_unlabeled_control: + sp->new_cont_backpatch(i) || + sp->add_instr(i)) + MYSQL_YYABORT; +- if (sp->restore_lex(YYTHD)) ++ if (sp->restore_lex(thd)) + MYSQL_YYABORT; + } + sp_proc_stmts1 END WHILE_SYM +@@ -3424,7 +3409,7 @@ sp_unlabeled_control: + lex->sphead->do_cont_backpatch(); + } + | REPEAT_SYM sp_proc_stmts1 UNTIL_SYM +- { Lex->sphead->reset_lex(YYTHD); } ++ { Lex->sphead->reset_lex(thd); } + expr END REPEAT_SYM + { + LEX *lex= Lex; +@@ -3436,7 +3421,7 @@ sp_unlabeled_control: + if (i == NULL || + lex->sphead->add_instr(i)) + MYSQL_YYABORT; +- if (lex->sphead->restore_lex(YYTHD)) ++ if (lex->sphead->restore_lex(thd)) + MYSQL_YYABORT; + /* We can shortcut the cont_backpatch here */ + i->m_cont_dest= ip+1; +@@ -3859,7 +3844,6 @@ create2: + create3 {} + | LIKE table_ident + { +- THD *thd= YYTHD; + TABLE_LIST *src_table; + LEX *lex= thd->lex; + +@@ -3873,7 +3857,6 @@ create2: + } + | '(' LIKE table_ident ')' + { +- THD *thd= YYTHD; + TABLE_LIST *src_table; + LEX *lex= thd->lex; + +@@ -4342,7 +4325,6 @@ part_bit_expr: + bit_expr + { + Item *part_expr= $1; +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Name_resolution_context *context= &lex->current_select->context; + TABLE_LIST *save_list= context->table_list; +@@ -4364,7 +4346,7 @@ part_bit_expr: + my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0)); + MYSQL_YYABORT; + } +- if (part_expr->fix_fields(YYTHD, (Item**)0) || ++ if (part_expr->fix_fields(thd, (Item**)0) || + ((context->table_list= save_list), FALSE) || + (!part_expr->const_item()) || + (!lex->safe_to_cache_query)) +@@ -4629,7 +4611,7 @@ create_table_option: + | TYPE_SYM opt_equal storage_engines + { + Lex->create_info.db_type= $3; +- WARN_DEPRECATED(yythd, "6.0", "TYPE=storage_engine", ++ WARN_DEPRECATED(thd, "6.0", "TYPE=storage_engine", + "'ENGINE=storage_engine'"); + Lex->create_info.used_fields|= HA_CREATE_USED_ENGINE; + } +@@ -4791,19 +4773,19 @@ default_collation: + storage_engines: + ident_or_text + { +- plugin_ref plugin= ha_resolve_by_name(YYTHD, &$1); ++ plugin_ref plugin= ha_resolve_by_name(thd, &$1); + + if (plugin) + $$= plugin_data(plugin, handlerton*); + else + { +- if (YYTHD->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION) ++ if (thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION) + { + my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str); + MYSQL_YYABORT; + } + $$= 0; +- push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN, ++ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_UNKNOWN_STORAGE_ENGINE, + ER(ER_UNKNOWN_STORAGE_ENGINE), + $1.str); +@@ -4815,7 +4797,7 @@ known_storage_engines: + ident_or_text + { + plugin_ref plugin; +- if ((plugin= ha_resolve_by_name(YYTHD, &$1))) ++ if ((plugin= ha_resolve_by_name(thd, &$1))) + $$= plugin_data(plugin, handlerton*); + else + { +@@ -5043,7 +5025,7 @@ type: + { + char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1]; + my_snprintf(buff, sizeof(buff), "YEAR(%lu)", length); +- push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_NOTE, ++ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_WARN_DEPRECATED_SYNTAX, + ER(ER_WARN_DEPRECATED_SYNTAX), + buff, "YEAR(4)"); +@@ -5057,7 +5039,7 @@ type: + { $$=MYSQL_TYPE_TIME; } + | TIMESTAMP opt_field_length + { +- if (YYTHD->variables.sql_mode & MODE_MAXDB) ++ if (thd->variables.sql_mode & MODE_MAXDB) + $$=MYSQL_TYPE_DATETIME; + else + { +@@ -5189,7 +5171,7 @@ int_type: + real_type: + REAL + { +- $$= YYTHD->variables.sql_mode & MODE_REAL_AS_FLOAT ? ++ $$= thd->variables.sql_mode & MODE_REAL_AS_FLOAT ? + MYSQL_TYPE_FLOAT : MYSQL_TYPE_DOUBLE; + } + | DOUBLE_SYM +@@ -5263,7 +5245,7 @@ attribute: + | DEFAULT now_or_signed_literal { Lex->default_value=$2; } + | ON UPDATE_SYM NOW_SYM optional_braces + { +- Item *item= new (YYTHD->mem_root) Item_func_now_local(); ++ Item *item= new (thd->mem_root) Item_func_now_local(); + if (item == NULL) + MYSQL_YYABORT; + Lex->on_update_value= item; +@@ -5312,7 +5294,7 @@ attribute: + now_or_signed_literal: + NOW_SYM optional_braces + { +- $$= new (YYTHD->mem_root) Item_func_now_local(); ++ $$= new (thd->mem_root) Item_func_now_local(); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -5673,7 +5655,6 @@ string_list: + alter: + ALTER opt_ignore TABLE_SYM table_ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + lex->name.str= 0; + lex->name.length= 0; +@@ -5799,7 +5780,7 @@ alter: + Event_parse_data. + */ + +- if (!(Lex->event_parse_data= Event_parse_data::new_instance(YYTHD))) ++ if (!(Lex->event_parse_data= Event_parse_data::new_instance(thd))) + MYSQL_YYABORT; + Lex->event_parse_data->identifier= $4; + +@@ -6192,7 +6173,6 @@ alter_list_item: + { + if (!$4) + { +- THD *thd= YYTHD; + $4= thd->variables.collation_database; + } + $5= $5 ? $5 : $4; +@@ -6556,7 +6536,7 @@ keycache_list: + assign_to_keycache: + table_ident cache_keys_spec + { +- if (!Select->add_table_to_list(YYTHD, $1, NULL, 0, TL_READ, ++ if (!Select->add_table_to_list(thd, $1, NULL, 0, TL_READ, + Select->pop_index_hints())) + MYSQL_YYABORT; + } +@@ -6585,7 +6565,7 @@ preload_list: + preload_keys: + table_ident cache_keys_spec opt_ignore_leaves + { +- if (!Select->add_table_to_list(YYTHD, $1, NULL, $3, TL_READ, ++ if (!Select->add_table_to_list(thd, $1, NULL, $3, TL_READ, + Select->pop_index_hints())) + MYSQL_YYABORT; + } +@@ -6593,7 +6573,7 @@ preload_keys: + + cache_keys_spec: + { +- Lex->select_lex.alloc_index_hints(YYTHD); ++ Lex->select_lex.alloc_index_hints(thd); + Select->set_index_hint_type(INDEX_HINT_USE, + global_system_variables.old_mode ? + INDEX_HINT_MASK_JOIN : +@@ -6813,7 +6793,6 @@ select_item_list: + | select_item + | '*' + { +- THD *thd= YYTHD; + Item *item= new (thd->mem_root) + Item_field(&thd->lex->current_select->context, + NULL, NULL, "*"); +@@ -6828,7 +6807,6 @@ select_item_list: + select_item: + remember_name select_item2 remember_end select_alias + { +- THD *thd= YYTHD; + DBUG_ASSERT($1 < $3); + + if (add_item_to_list(thd, $2)) +@@ -6929,7 +6907,7 @@ expr: + else + { + /* X OR Y */ +- $$ = new (YYTHD->mem_root) Item_cond_or($1, $3); ++ $$ = new (thd->mem_root) Item_cond_or($1, $3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -6937,7 +6915,7 @@ expr: + | expr XOR expr %prec XOR + { + /* XOR is a proprietary extension */ +- $$ = new (YYTHD->mem_root) Item_cond_xor($1, $3); ++ $$ = new (thd->mem_root) Item_cond_xor($1, $3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -6979,50 +6957,50 @@ expr: + else + { + /* X AND Y */ +- $$ = new (YYTHD->mem_root) Item_cond_and($1, $3); ++ $$ = new (thd->mem_root) Item_cond_and($1, $3); + if ($$ == NULL) + MYSQL_YYABORT; + } + } + | NOT_SYM expr %prec NOT_SYM + { +- $$= negate_expression(YYTHD, $2); ++ $$= negate_expression(thd, $2); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bool_pri IS TRUE_SYM %prec IS + { +- $$= new (YYTHD->mem_root) Item_func_istrue($1); ++ $$= new (thd->mem_root) Item_func_istrue($1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bool_pri IS not TRUE_SYM %prec IS + { +- $$= new (YYTHD->mem_root) Item_func_isnottrue($1); ++ $$= new (thd->mem_root) Item_func_isnottrue($1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bool_pri IS FALSE_SYM %prec IS + { +- $$= new (YYTHD->mem_root) Item_func_isfalse($1); ++ $$= new (thd->mem_root) Item_func_isfalse($1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bool_pri IS not FALSE_SYM %prec IS + { +- $$= new (YYTHD->mem_root) Item_func_isnotfalse($1); ++ $$= new (thd->mem_root) Item_func_isnotfalse($1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bool_pri IS UNKNOWN_SYM %prec IS + { +- $$= new (YYTHD->mem_root) Item_func_isnull($1); ++ $$= new (thd->mem_root) Item_func_isnull($1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bool_pri IS not UNKNOWN_SYM %prec IS + { +- $$= new (YYTHD->mem_root) Item_func_isnotnull($1); ++ $$= new (thd->mem_root) Item_func_isnotnull($1); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7032,19 +7010,19 @@ expr: + bool_pri: + bool_pri IS NULL_SYM %prec IS + { +- $$= new (YYTHD->mem_root) Item_func_isnull($1); ++ $$= new (thd->mem_root) Item_func_isnull($1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bool_pri IS not NULL_SYM %prec IS + { +- $$= new (YYTHD->mem_root) Item_func_isnotnull($1); ++ $$= new (thd->mem_root) Item_func_isnotnull($1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bool_pri EQUAL_SYM predicate %prec EQUAL_SYM + { +- $$= new (YYTHD->mem_root) Item_func_equal($1,$3); ++ $$= new (thd->mem_root) Item_func_equal($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7066,13 +7044,12 @@ bool_pri: + predicate: + bit_expr IN_SYM '(' subselect ')' + { +- $$= new (YYTHD->mem_root) Item_in_subselect($1, $4); ++ $$= new (thd->mem_root) Item_in_subselect($1, $4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr not IN_SYM '(' subselect ')' + { +- THD *thd= YYTHD; + Item *item= new (thd->mem_root) Item_in_subselect($1, $5); + if (item == NULL) + MYSQL_YYABORT; +@@ -7082,7 +7059,7 @@ predicate: + } + | bit_expr IN_SYM '(' expr ')' + { +- $$= handle_sql2003_note184_exception(YYTHD, $1, true, $4); ++ $$= handle_sql2003_note184_exception(thd, $1, true, $4); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7090,13 +7067,13 @@ predicate: + { + $6->push_front($4); + $6->push_front($1); +- $$= new (YYTHD->mem_root) Item_func_in(*$6); ++ $$= new (thd->mem_root) Item_func_in(*$6); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr not IN_SYM '(' expr ')' + { +- $$= handle_sql2003_note184_exception(YYTHD, $1, false, $5); ++ $$= handle_sql2003_note184_exception(thd, $1, false, $5); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7104,7 +7081,7 @@ predicate: + { + $7->push_front($5); + $7->push_front($1); +- Item_func_in *item = new (YYTHD->mem_root) Item_func_in(*$7); ++ Item_func_in *item = new (thd->mem_root) Item_func_in(*$7); + if (item == NULL) + MYSQL_YYABORT; + item->negate(); +@@ -7112,14 +7089,14 @@ predicate: + } + | bit_expr BETWEEN_SYM bit_expr AND_SYM predicate + { +- $$= new (YYTHD->mem_root) Item_func_between($1,$3,$5); ++ $$= new (thd->mem_root) Item_func_between($1,$3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate + { + Item_func_between *item; +- item= new (YYTHD->mem_root) Item_func_between($1,$4,$6); ++ item= new (thd->mem_root) Item_func_between($1,$4,$6); + if (item == NULL) + MYSQL_YYABORT; + item->negate(); +@@ -7127,42 +7104,42 @@ predicate: + } + | bit_expr SOUNDS_SYM LIKE bit_expr + { +- Item *item1= new (YYTHD->mem_root) Item_func_soundex($1); +- Item *item4= new (YYTHD->mem_root) Item_func_soundex($4); ++ Item *item1= new (thd->mem_root) Item_func_soundex($1); ++ Item *item4= new (thd->mem_root) Item_func_soundex($4); + if ((item1 == NULL) || (item4 == NULL)) + MYSQL_YYABORT; +- $$= new (YYTHD->mem_root) Item_func_eq(item1, item4); ++ $$= new (thd->mem_root) Item_func_eq(item1, item4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr LIKE simple_expr opt_escape + { +- $$= new (YYTHD->mem_root) Item_func_like($1,$3,$4,Lex->escape_used); ++ $$= new (thd->mem_root) Item_func_like($1,$3,$4,Lex->escape_used); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr not LIKE simple_expr opt_escape + { +- Item *item= new (YYTHD->mem_root) Item_func_like($1,$4,$5, ++ Item *item= new (thd->mem_root) Item_func_like($1,$4,$5, + Lex->escape_used); + if (item == NULL) + MYSQL_YYABORT; +- $$= new (YYTHD->mem_root) Item_func_not(item); ++ $$= new (thd->mem_root) Item_func_not(item); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr REGEXP bit_expr + { +- $$= new (YYTHD->mem_root) Item_func_regex($1,$3); ++ $$= new (thd->mem_root) Item_func_regex($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr not REGEXP bit_expr + { +- Item *item= new (YYTHD->mem_root) Item_func_regex($1,$4); ++ Item *item= new (thd->mem_root) Item_func_regex($1,$4); + if (item == NULL) + MYSQL_YYABORT; +- $$= negate_expression(YYTHD, item); ++ $$= negate_expression(thd, item); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7172,85 +7149,85 @@ predicate: + bit_expr: + bit_expr '|' bit_expr %prec '|' + { +- $$= new (YYTHD->mem_root) Item_func_bit_or($1,$3); ++ $$= new (thd->mem_root) Item_func_bit_or($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '&' bit_expr %prec '&' + { +- $$= new (YYTHD->mem_root) Item_func_bit_and($1,$3); ++ $$= new (thd->mem_root) Item_func_bit_and($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr SHIFT_LEFT bit_expr %prec SHIFT_LEFT + { +- $$= new (YYTHD->mem_root) Item_func_shift_left($1,$3); ++ $$= new (thd->mem_root) Item_func_shift_left($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr SHIFT_RIGHT bit_expr %prec SHIFT_RIGHT + { +- $$= new (YYTHD->mem_root) Item_func_shift_right($1,$3); ++ $$= new (thd->mem_root) Item_func_shift_right($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '+' bit_expr %prec '+' + { +- $$= new (YYTHD->mem_root) Item_func_plus($1,$3); ++ $$= new (thd->mem_root) Item_func_plus($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '-' bit_expr %prec '-' + { +- $$= new (YYTHD->mem_root) Item_func_minus($1,$3); ++ $$= new (thd->mem_root) Item_func_minus($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '+' INTERVAL_SYM expr interval %prec '+' + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($1,$4,$5,0); ++ $$= new (thd->mem_root) Item_date_add_interval($1,$4,$5,0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '-' INTERVAL_SYM expr interval %prec '-' + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($1,$4,$5,1); ++ $$= new (thd->mem_root) Item_date_add_interval($1,$4,$5,1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '*' bit_expr %prec '*' + { +- $$= new (YYTHD->mem_root) Item_func_mul($1,$3); ++ $$= new (thd->mem_root) Item_func_mul($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '/' bit_expr %prec '/' + { +- $$= new (YYTHD->mem_root) Item_func_div($1,$3); ++ $$= new (thd->mem_root) Item_func_div($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '%' bit_expr %prec '%' + { +- $$= new (YYTHD->mem_root) Item_func_mod($1,$3); ++ $$= new (thd->mem_root) Item_func_mod($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr DIV_SYM bit_expr %prec DIV_SYM + { +- $$= new (YYTHD->mem_root) Item_func_int_div($1,$3); ++ $$= new (thd->mem_root) Item_func_int_div($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr MOD_SYM bit_expr %prec MOD_SYM + { +- $$= new (YYTHD->mem_root) Item_func_mod($1,$3); ++ $$= new (thd->mem_root) Item_func_mod($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr '^' bit_expr + { +- $$= new (YYTHD->mem_root) Item_func_bit_xor($1,$3); ++ $$= new (thd->mem_root) Item_func_bit_xor($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7299,7 +7276,6 @@ simple_expr: + | function_call_conflict + | simple_expr COLLATE_SYM ident_or_text %prec NEG + { +- THD *thd= YYTHD; + Item *i1= new (thd->mem_root) Item_string($3.str, + $3.length, + thd->charset()); +@@ -7315,7 +7291,7 @@ simple_expr: + | sum_expr + | simple_expr OR_OR_SYM simple_expr + { +- $$= new (YYTHD->mem_root) Item_func_concat($1, $3); ++ $$= new (thd->mem_root) Item_func_concat($1, $3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7325,25 +7301,25 @@ simple_expr: + } + | '-' simple_expr %prec NEG + { +- $$= new (YYTHD->mem_root) Item_func_neg($2); ++ $$= new (thd->mem_root) Item_func_neg($2); + if ($$ == NULL) + MYSQL_YYABORT; + } + | '~' simple_expr %prec NEG + { +- $$= new (YYTHD->mem_root) Item_func_bit_neg($2); ++ $$= new (thd->mem_root) Item_func_bit_neg($2); + if ($$ == NULL) + MYSQL_YYABORT; + } + | not2 simple_expr %prec NEG + { +- $$= negate_expression(YYTHD, $2); ++ $$= negate_expression(thd, $2); + if ($$ == NULL) + MYSQL_YYABORT; + } + | '(' subselect ')' + { +- $$= new (YYTHD->mem_root) Item_singlerow_subselect($2); ++ $$= new (thd->mem_root) Item_singlerow_subselect($2); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7352,20 +7328,20 @@ simple_expr: + | '(' expr ',' expr_list ')' + { + $4->push_front($2); +- $$= new (YYTHD->mem_root) Item_row(*$4); ++ $$= new (thd->mem_root) Item_row(*$4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | ROW_SYM '(' expr ',' expr_list ')' + { + $5->push_front($3); +- $$= new (YYTHD->mem_root) Item_row(*$5); ++ $$= new (thd->mem_root) Item_row(*$5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | EXISTS '(' subselect ')' + { +- $$= new (YYTHD->mem_root) Item_exists_subselect($3); ++ $$= new (thd->mem_root) Item_exists_subselect($3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7374,7 +7350,7 @@ simple_expr: + | MATCH ident_list_arg AGAINST '(' bit_expr fulltext_options ')' + { + $2->push_front($5); +- Item_func_match *i1= new (YYTHD->mem_root) Item_func_match(*$2, $6); ++ Item_func_match *i1= new (thd->mem_root) Item_func_match(*$2, $6); + if (i1 == NULL) + MYSQL_YYABORT; + Select->add_ftfunc_to_list(i1); +@@ -7382,7 +7358,7 @@ simple_expr: + } + | BINARY simple_expr %prec NEG + { +- $$= create_func_cast(YYTHD, $2, ITEM_CAST_CHAR, NULL, NULL, ++ $$= create_func_cast(thd, $2, ITEM_CAST_CHAR, NULL, NULL, + &my_charset_bin); + if ($$ == NULL) + MYSQL_YYABORT; +@@ -7390,27 +7366,27 @@ simple_expr: + | CAST_SYM '(' expr AS cast_type ')' + { + LEX *lex= Lex; +- $$= create_func_cast(YYTHD, $3, $5, lex->length, lex->dec, ++ $$= create_func_cast(thd, $3, $5, lex->length, lex->dec, + lex->charset); + if ($$ == NULL) + MYSQL_YYABORT; + } + | CASE_SYM opt_expr when_list opt_else END + { +- $$= new (YYTHD->mem_root) Item_func_case(* $3, $2, $4 ); ++ $$= new (thd->mem_root) Item_func_case(* $3, $2, $4 ); + if ($$ == NULL) + MYSQL_YYABORT; + } + | CONVERT_SYM '(' expr ',' cast_type ')' + { +- $$= create_func_cast(YYTHD, $3, $5, Lex->length, Lex->dec, ++ $$= create_func_cast(thd, $3, $5, Lex->length, Lex->dec, + Lex->charset); + if ($$ == NULL) + MYSQL_YYABORT; + } + | CONVERT_SYM '(' expr USING charset_name ')' + { +- $$= new (YYTHD->mem_root) Item_func_conv_charset($3,$5); ++ $$= new (thd->mem_root) Item_func_conv_charset($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7423,14 +7399,14 @@ simple_expr: + my_error(ER_WRONG_COLUMN_NAME, MYF(0), il->my_name()->str); + MYSQL_YYABORT; + } +- $$= new (YYTHD->mem_root) Item_default_value(Lex->current_context(), ++ $$= new (thd->mem_root) Item_default_value(Lex->current_context(), + $3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | VALUES '(' simple_ident_nospvar ')' + { +- $$= new (YYTHD->mem_root) Item_insert_value(Lex->current_context(), ++ $$= new (thd->mem_root) Item_insert_value(Lex->current_context(), + $3); + if ($$ == NULL) + MYSQL_YYABORT; +@@ -7438,7 +7414,7 @@ simple_expr: + | INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM + /* we cannot put interval before - */ + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($5,$2,$3,0); ++ $$= new (thd->mem_root) Item_date_add_interval($5,$2,$3,0); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7453,19 +7429,19 @@ simple_expr: + function_call_keyword: + CHAR_SYM '(' expr_list ')' + { +- $$= new (YYTHD->mem_root) Item_func_char(*$3); ++ $$= new (thd->mem_root) Item_func_char(*$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | CHAR_SYM '(' expr_list USING charset_name ')' + { +- $$= new (YYTHD->mem_root) Item_func_char(*$3, $5); ++ $$= new (thd->mem_root) Item_func_char(*$3, $5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | CURRENT_USER optional_braces + { +- $$= new (YYTHD->mem_root) Item_func_current_user(Lex->current_context()); ++ $$= new (thd->mem_root) Item_func_current_user(Lex->current_context()); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->set_stmt_unsafe(); +@@ -7473,31 +7449,30 @@ function_call_keyword: + } + | DATE_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_date_typecast($3); ++ $$= new (thd->mem_root) Item_date_typecast($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | DAY_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_dayofmonth($3); ++ $$= new (thd->mem_root) Item_func_dayofmonth($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | HOUR_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_hour($3); ++ $$= new (thd->mem_root) Item_func_hour($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | INSERT '(' expr ',' expr ',' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_insert($3,$5,$7,$9); ++ $$= new (thd->mem_root) Item_func_insert($3,$5,$7,$9); + if ($$ == NULL) + MYSQL_YYABORT; + } + | INTERVAL_SYM '(' expr ',' expr ')' %prec INTERVAL_SYM + { +- THD *thd= YYTHD; + List *list= new (thd->mem_root) List; + if (list == NULL) + MYSQL_YYABORT; +@@ -7512,7 +7487,6 @@ function_call_keyword: + } + | INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' %prec INTERVAL_SYM + { +- THD *thd= YYTHD; + $7->push_front($5); + $7->push_front($3); + Item_row *item= new (thd->mem_root) Item_row(*$7); +@@ -7524,103 +7498,103 @@ function_call_keyword: + } + | LEFT '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_left($3,$5); ++ $$= new (thd->mem_root) Item_func_left($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | MINUTE_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_minute($3); ++ $$= new (thd->mem_root) Item_func_minute($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | MONTH_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_month($3); ++ $$= new (thd->mem_root) Item_func_month($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | RIGHT '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_right($3,$5); ++ $$= new (thd->mem_root) Item_func_right($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SECOND_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_second($3); ++ $$= new (thd->mem_root) Item_func_second($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TIME_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_time_typecast($3); ++ $$= new (thd->mem_root) Item_time_typecast($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TIMESTAMP '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_datetime_typecast($3); ++ $$= new (thd->mem_root) Item_datetime_typecast($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TIMESTAMP '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_add_time($3, $5, 1, 0); ++ $$= new (thd->mem_root) Item_func_add_time($3, $5, 1, 0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRIM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_trim($3); ++ $$= new (thd->mem_root) Item_func_trim($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRIM '(' LEADING expr FROM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_ltrim($6,$4); ++ $$= new (thd->mem_root) Item_func_ltrim($6,$4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRIM '(' TRAILING expr FROM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_rtrim($6,$4); ++ $$= new (thd->mem_root) Item_func_rtrim($6,$4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRIM '(' BOTH expr FROM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_trim($6,$4); ++ $$= new (thd->mem_root) Item_func_trim($6,$4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRIM '(' LEADING FROM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_ltrim($5); ++ $$= new (thd->mem_root) Item_func_ltrim($5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRIM '(' TRAILING FROM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_rtrim($5); ++ $$= new (thd->mem_root) Item_func_rtrim($5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRIM '(' BOTH FROM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_trim($5); ++ $$= new (thd->mem_root) Item_func_trim($5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRIM '(' expr FROM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_trim($5,$3); ++ $$= new (thd->mem_root) Item_func_trim($5,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | USER '(' ')' + { +- $$= new (YYTHD->mem_root) Item_func_user(); ++ $$= new (thd->mem_root) Item_func_user(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->set_stmt_unsafe(); +@@ -7628,7 +7602,7 @@ function_call_keyword: + } + | YEAR_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_year($3); ++ $$= new (thd->mem_root) Item_func_year($3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7649,34 +7623,34 @@ function_call_keyword: + function_call_nonkeyword: + ADDDATE_SYM '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($3, $5, ++ $$= new (thd->mem_root) Item_date_add_interval($3, $5, + INTERVAL_DAY, 0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')' + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($3, $6, $7, 0); ++ $$= new (thd->mem_root) Item_date_add_interval($3, $6, $7, 0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | CURDATE optional_braces + { +- $$= new (YYTHD->mem_root) Item_func_curdate_local(); ++ $$= new (thd->mem_root) Item_func_curdate_local(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | CURTIME optional_braces + { +- $$= new (YYTHD->mem_root) Item_func_curtime_local(); ++ $$= new (thd->mem_root) Item_func_curtime_local(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | CURTIME '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_curtime_local($3); ++ $$= new (thd->mem_root) Item_func_curtime_local($3); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; +@@ -7684,83 +7658,83 @@ function_call_nonkeyword: + | DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' + %prec INTERVAL_SYM + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($3,$6,$7,0); ++ $$= new (thd->mem_root) Item_date_add_interval($3,$6,$7,0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' + %prec INTERVAL_SYM + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($3,$6,$7,1); ++ $$= new (thd->mem_root) Item_date_add_interval($3,$6,$7,1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | EXTRACT_SYM '(' interval FROM expr ')' + { +- $$=new (YYTHD->mem_root) Item_extract( $3, $5); ++ $$=new (thd->mem_root) Item_extract( $3, $5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | GET_FORMAT '(' date_time_type ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_get_format($3, $5); ++ $$= new (thd->mem_root) Item_func_get_format($3, $5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | NOW_SYM optional_braces + { +- $$= new (YYTHD->mem_root) Item_func_now_local(); ++ $$= new (thd->mem_root) Item_func_now_local(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | NOW_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_now_local($3); ++ $$= new (thd->mem_root) Item_func_now_local($3); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | POSITION_SYM '(' bit_expr IN_SYM expr ')' + { +- $$ = new (YYTHD->mem_root) Item_func_locate($5,$3); ++ $$ = new (thd->mem_root) Item_func_locate($5,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SUBDATE_SYM '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($3, $5, ++ $$= new (thd->mem_root) Item_date_add_interval($3, $5, + INTERVAL_DAY, 1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SUBDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')' + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($3, $6, $7, 1); ++ $$= new (thd->mem_root) Item_date_add_interval($3, $6, $7, 1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SUBSTRING '(' expr ',' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_substr($3,$5,$7); ++ $$= new (thd->mem_root) Item_func_substr($3,$5,$7); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SUBSTRING '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_substr($3,$5); ++ $$= new (thd->mem_root) Item_func_substr($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SUBSTRING '(' expr FROM expr FOR_SYM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_substr($3,$5,$7); ++ $$= new (thd->mem_root) Item_func_substr($3,$5,$7); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SUBSTRING '(' expr FROM expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_substr($3,$5); ++ $$= new (thd->mem_root) Item_func_substr($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7775,9 +7749,9 @@ function_call_nonkeyword: + */ + Lex->set_stmt_unsafe(); + if (global_system_variables.sysdate_is_now == 0) +- $$= new (YYTHD->mem_root) Item_func_sysdate_local(); ++ $$= new (thd->mem_root) Item_func_sysdate_local(); + else +- $$= new (YYTHD->mem_root) Item_func_now_local(); ++ $$= new (thd->mem_root) Item_func_now_local(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; +@@ -7785,42 +7759,42 @@ function_call_nonkeyword: + | SYSDATE '(' expr ')' + { + if (global_system_variables.sysdate_is_now == 0) +- $$= new (YYTHD->mem_root) Item_func_sysdate_local($3); ++ $$= new (thd->mem_root) Item_func_sysdate_local($3); + else +- $$= new (YYTHD->mem_root) Item_func_now_local($3); ++ $$= new (thd->mem_root) Item_func_now_local($3); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | TIMESTAMP_ADD '(' interval_time_stamp ',' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_date_add_interval($7,$5,$3,0); ++ $$= new (thd->mem_root) Item_date_add_interval($7,$5,$3,0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TIMESTAMP_DIFF '(' interval_time_stamp ',' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_timestamp_diff($5,$7,$3); ++ $$= new (thd->mem_root) Item_func_timestamp_diff($5,$7,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | UTC_DATE_SYM optional_braces + { +- $$= new (YYTHD->mem_root) Item_func_curdate_utc(); ++ $$= new (thd->mem_root) Item_func_curdate_utc(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | UTC_TIME_SYM optional_braces + { +- $$= new (YYTHD->mem_root) Item_func_curtime_utc(); ++ $$= new (thd->mem_root) Item_func_curtime_utc(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | UTC_TIMESTAMP_SYM optional_braces + { +- $$= new (YYTHD->mem_root) Item_func_now_utc(); ++ $$= new (thd->mem_root) Item_func_now_utc(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; +@@ -7835,62 +7809,61 @@ function_call_nonkeyword: + function_call_conflict: + ASCII_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_ascii($3); ++ $$= new (thd->mem_root) Item_func_ascii($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | CHARSET '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_charset($3); ++ $$= new (thd->mem_root) Item_func_charset($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | COALESCE '(' expr_list ')' + { +- $$= new (YYTHD->mem_root) Item_func_coalesce(* $3); ++ $$= new (thd->mem_root) Item_func_coalesce(* $3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | COLLATION_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_collation($3); ++ $$= new (thd->mem_root) Item_func_collation($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | DATABASE '(' ')' + { +- $$= new (YYTHD->mem_root) Item_func_database(); ++ $$= new (thd->mem_root) Item_func_database(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | IF '(' expr ',' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_if($3,$5,$7); ++ $$= new (thd->mem_root) Item_func_if($3,$5,$7); + if ($$ == NULL) + MYSQL_YYABORT; + } + | MICROSECOND_SYM '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_microsecond($3); ++ $$= new (thd->mem_root) Item_func_microsecond($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | MOD_SYM '(' expr ',' expr ')' + { +- $$ = new (YYTHD->mem_root) Item_func_mod($3, $5); ++ $$ = new (thd->mem_root) Item_func_mod($3, $5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | OLD_PASSWORD '(' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_old_password($3); ++ $$= new (thd->mem_root) Item_func_old_password($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | PASSWORD '(' expr ')' + { +- THD *thd= YYTHD; + Item* i1; + if (thd->variables.old_passwords) + i1= new (thd->mem_root) Item_func_old_password($3); +@@ -7902,31 +7875,30 @@ function_call_conflict: + } + | QUARTER_SYM '(' expr ')' + { +- $$ = new (YYTHD->mem_root) Item_func_quarter($3); ++ $$ = new (thd->mem_root) Item_func_quarter($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | REPEAT_SYM '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_repeat($3,$5); ++ $$= new (thd->mem_root) Item_func_repeat($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | REPLACE '(' expr ',' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_replace($3,$5,$7); ++ $$= new (thd->mem_root) Item_func_replace($3,$5,$7); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRUNCATE_SYM '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_round($3,$5,1); ++ $$= new (thd->mem_root) Item_func_round($3,$5,1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | WEEK_SYM '(' expr ')' + { +- THD *thd= YYTHD; + Item *i1= new (thd->mem_root) Item_int((char*) "0", + thd->variables.default_week_format, + 1); +@@ -7938,7 +7910,7 @@ function_call_conflict: + } + | WEEK_SYM '(' expr ',' expr ')' + { +- $$= new (YYTHD->mem_root) Item_func_week($3,$5); ++ $$= new (thd->mem_root) Item_func_week($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -7960,52 +7932,52 @@ function_call_conflict: + geometry_function: + CONTAINS_SYM '(' expr ',' expr ')' + { +- $$= GEOM_NEW(YYTHD, ++ $$= GEOM_NEW(thd, + Item_func_spatial_rel($3, $5, + Item_func::SP_CONTAINS_FUNC)); + } + | GEOMETRYCOLLECTION '(' expr_list ')' + { +- $$= GEOM_NEW(YYTHD, ++ $$= GEOM_NEW(thd, + Item_func_spatial_collection(* $3, + Geometry::wkb_geometrycollection, + Geometry::wkb_point)); + } + | LINESTRING '(' expr_list ')' + { +- $$= GEOM_NEW(YYTHD, ++ $$= GEOM_NEW(thd, + Item_func_spatial_collection(* $3, + Geometry::wkb_linestring, + Geometry::wkb_point)); + } + | MULTILINESTRING '(' expr_list ')' + { +- $$= GEOM_NEW(YYTHD, ++ $$= GEOM_NEW(thd, + Item_func_spatial_collection(* $3, + Geometry::wkb_multilinestring, + Geometry::wkb_linestring)); + } + | MULTIPOINT '(' expr_list ')' + { +- $$= GEOM_NEW(YYTHD, ++ $$= GEOM_NEW(thd, + Item_func_spatial_collection(* $3, + Geometry::wkb_multipoint, + Geometry::wkb_point)); + } + | MULTIPOLYGON '(' expr_list ')' + { +- $$= GEOM_NEW(YYTHD, ++ $$= GEOM_NEW(thd, + Item_func_spatial_collection(* $3, + Geometry::wkb_multipolygon, + Geometry::wkb_polygon)); + } + | POINT_SYM '(' expr ',' expr ')' + { +- $$= GEOM_NEW(YYTHD, Item_func_point($3,$5)); ++ $$= GEOM_NEW(thd, Item_func_point($3,$5)); + } + | POLYGON '(' expr_list ')' + { +- $$= GEOM_NEW(YYTHD, ++ $$= GEOM_NEW(thd, + Item_func_spatial_collection(* $3, + Geometry::wkb_polygon, + Geometry::wkb_linestring)); +@@ -8043,7 +8015,6 @@ function_call_generic: + } + opt_udf_expr_list ')' + { +- THD *thd= YYTHD; + Create_func *builder; + Item *item= NULL; + +@@ -8097,7 +8068,6 @@ function_call_generic: + } + | ident '.' ident '(' opt_expr_list ')' + { +- THD *thd= YYTHD; + Create_qfunc *builder; + Item *item= NULL; + +@@ -8161,7 +8131,7 @@ opt_udf_expr_list: + udf_expr_list: + udf_expr + { +- $$= new (YYTHD->mem_root) List; ++ $$= new (thd->mem_root) List; + if ($$ == NULL) + MYSQL_YYABORT; + $$->push_back($1); +@@ -8194,7 +8164,7 @@ udf_expr: + remember_name we may get quoted or escaped names. + */ + else if ($2->type() != Item::FIELD_ITEM) +- $2->set_name($1, (uint) ($3 - $1), YYTHD->charset()); ++ $2->set_name($1, (uint) ($3 - $1), thd->charset()); + $$= $2; + } + ; +@@ -8202,46 +8172,46 @@ udf_expr: + sum_expr: + AVG_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_avg($3); ++ $$= new (thd->mem_root) Item_sum_avg($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | AVG_SYM '(' DISTINCT in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_avg_distinct($4); ++ $$= new (thd->mem_root) Item_sum_avg_distinct($4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | BIT_AND '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_and($3); ++ $$= new (thd->mem_root) Item_sum_and($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | BIT_OR '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_or($3); ++ $$= new (thd->mem_root) Item_sum_or($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | BIT_XOR '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_xor($3); ++ $$= new (thd->mem_root) Item_sum_xor($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | COUNT_SYM '(' opt_all '*' ')' + { +- Item *item= new (YYTHD->mem_root) Item_int((int32) 0L,1); ++ Item *item= new (thd->mem_root) Item_int((int32) 0L,1); + if (item == NULL) + MYSQL_YYABORT; +- $$= new (YYTHD->mem_root) Item_sum_count(item); ++ $$= new (thd->mem_root) Item_sum_count(item); + if ($$ == NULL) + MYSQL_YYABORT; + } + | COUNT_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_count($3); ++ $$= new (thd->mem_root) Item_sum_count($3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -8251,13 +8221,13 @@ sum_expr: + { Select->in_sum_expr--; } + ')' + { +- $$= new (YYTHD->mem_root) Item_sum_count_distinct(* $5); ++ $$= new (thd->mem_root) Item_sum_count_distinct(* $5); + if ($$ == NULL) + MYSQL_YYABORT; + } + | MIN_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_min($3); ++ $$= new (thd->mem_root) Item_sum_min($3); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -8268,55 +8238,55 @@ sum_expr: + */ + | MIN_SYM '(' DISTINCT in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_min($4); ++ $$= new (thd->mem_root) Item_sum_min($4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | MAX_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_max($3); ++ $$= new (thd->mem_root) Item_sum_max($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | MAX_SYM '(' DISTINCT in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_max($4); ++ $$= new (thd->mem_root) Item_sum_max($4); + if ($$ == NULL) + MYSQL_YYABORT; + } + | STD_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_std($3, 0); ++ $$= new (thd->mem_root) Item_sum_std($3, 0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | VARIANCE_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_variance($3, 0); ++ $$= new (thd->mem_root) Item_sum_variance($3, 0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | STDDEV_SAMP_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_std($3, 1); ++ $$= new (thd->mem_root) Item_sum_std($3, 1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | VAR_SAMP_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_variance($3, 1); ++ $$= new (thd->mem_root) Item_sum_variance($3, 1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SUM_SYM '(' in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_sum($3); ++ $$= new (thd->mem_root) Item_sum_sum($3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SUM_SYM '(' DISTINCT in_sum_expr ')' + { +- $$= new (YYTHD->mem_root) Item_sum_sum_distinct($4); ++ $$= new (thd->mem_root) Item_sum_sum_distinct($4); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -8328,7 +8298,7 @@ sum_expr: + { + SELECT_LEX *sel= Select; + sel->in_sum_expr--; +- $$= new (YYTHD->mem_root) ++ $$= new (thd->mem_root) + Item_func_group_concat(Lex->current_context(), $3, $5, + sel->gorder_list, $7); + if ($$ == NULL) +@@ -8357,7 +8327,7 @@ variable_aux: + ident_or_text SET_VAR expr + { + Item_func_set_user_var *item; +- $$= item= new (YYTHD->mem_root) Item_func_set_user_var($1, $3); ++ $$= item= new (thd->mem_root) Item_func_set_user_var($1, $3); + if ($$ == NULL) + MYSQL_YYABORT; + LEX *lex= Lex; +@@ -8366,7 +8336,7 @@ variable_aux: + } + | ident_or_text + { +- $$= new (YYTHD->mem_root) Item_func_get_user_var($1); ++ $$= new (thd->mem_root) Item_func_get_user_var($1); + if ($$ == NULL) + MYSQL_YYABORT; + LEX *lex= Lex; +@@ -8380,7 +8350,7 @@ variable_aux: + my_parse_error(ER(ER_SYNTAX_ERROR)); + MYSQL_YYABORT; + } +- if (!($$= get_system_var(YYTHD, $2, $3, $4))) ++ if (!($$= get_system_var(thd, $2, $3, $4))) + MYSQL_YYABORT; + if (!((Item_func_get_system_var*) $$)->is_written_to_binlog()) + Lex->set_stmt_unsafe(); +@@ -8395,7 +8365,7 @@ opt_distinct: + opt_gconcat_separator: + /* empty */ + { +- $$= new (YYTHD->mem_root) String(",", 1, &my_charset_latin1); ++ $$= new (thd->mem_root) String(",", 1, &my_charset_latin1); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -8422,9 +8392,9 @@ opt_gorder_clause: + + gorder_list: + gorder_list ',' order_ident order_dir +- { if (add_gorder_to_list(YYTHD, $3,(bool) $4)) MYSQL_YYABORT; } ++ { if (add_gorder_to_list(thd, $3,(bool) $4)) MYSQL_YYABORT; } + | order_ident order_dir +- { if (add_gorder_to_list(YYTHD, $1,(bool) $2)) MYSQL_YYABORT; } ++ { if (add_gorder_to_list(thd, $1,(bool) $2)) MYSQL_YYABORT; } + ; + + in_sum_expr: +@@ -8477,7 +8447,7 @@ opt_expr_list: + expr_list: + expr + { +- $$= new (YYTHD->mem_root) List; ++ $$= new (thd->mem_root) List; + if ($$ == NULL) + MYSQL_YYABORT; + $$->push_back($1); +@@ -8497,7 +8467,7 @@ ident_list_arg: + ident_list: + simple_ident + { +- $$= new (YYTHD->mem_root) List; ++ $$= new (thd->mem_root) List; + if ($$ == NULL) + MYSQL_YYABORT; + $$->push_back($1); +@@ -8595,7 +8565,7 @@ join_table: + { + MYSQL_YYABORT_UNLESS($1 && $3); + /* Change the current name resolution context to a local context. */ +- if (push_new_name_resolution_context(YYTHD, $1, $3)) ++ if (push_new_name_resolution_context(thd, $1, $3)) + MYSQL_YYABORT; + Select->parsing_place= IN_ON; + } +@@ -8610,7 +8580,7 @@ join_table: + { + MYSQL_YYABORT_UNLESS($1 && $3); + /* Change the current name resolution context to a local context. */ +- if (push_new_name_resolution_context(YYTHD, $1, $3)) ++ if (push_new_name_resolution_context(thd, $1, $3)) + MYSQL_YYABORT; + Select->parsing_place= IN_ON; + } +@@ -8640,7 +8610,7 @@ join_table: + { + MYSQL_YYABORT_UNLESS($1 && $5); + /* Change the current name resolution context to a local context. */ +- if (push_new_name_resolution_context(YYTHD, $1, $5)) ++ if (push_new_name_resolution_context(thd, $1, $5)) + MYSQL_YYABORT; + Select->parsing_place= IN_ON; + } +@@ -8676,7 +8646,7 @@ join_table: + { + MYSQL_YYABORT_UNLESS($1 && $5); + /* Change the current name resolution context to a local context. */ +- if (push_new_name_resolution_context(YYTHD, $1, $5)) ++ if (push_new_name_resolution_context(thd, $1, $5)) + MYSQL_YYABORT; + Select->parsing_place= IN_ON; + } +@@ -8724,7 +8694,7 @@ table_factor: + } + table_ident opt_table_alias opt_key_definition + { +- if (!($$= Select->add_table_to_list(YYTHD, $2, $3, ++ if (!($$= Select->add_table_to_list(thd, $2, $3, + Select->get_table_join_options(), + Lex->lock_option, + Select->pop_index_hints()))) +@@ -8922,7 +8892,7 @@ index_hints_list: + + opt_index_hints_list: + /* empty */ +- | { Select->alloc_index_hints(YYTHD); } index_hints_list ++ | { Select->alloc_index_hints(thd); } index_hints_list + ; + + opt_key_definition: +@@ -8931,15 +8901,15 @@ opt_key_definition: + ; + + opt_key_usage_list: +- /* empty */ { Select->add_index_hint(YYTHD, NULL, 0); } ++ /* empty */ { Select->add_index_hint(thd, NULL, 0); } + | key_usage_list {} + ; + + key_usage_element: + ident +- { Select->add_index_hint(YYTHD, $1.str, $1.length); } ++ { Select->add_index_hint(thd, $1.str, $1.length); } + | PRIMARY_SYM +- { Select->add_index_hint(YYTHD, (char *)"PRIMARY", 7); } ++ { Select->add_index_hint(thd, (char *)"PRIMARY", 7); } + ; + + key_usage_list: +@@ -8952,7 +8922,7 @@ using_list: + { + if (!($$= new List)) + MYSQL_YYABORT; +- String *s= new (YYTHD->mem_root) String((const char *) $1.str, ++ String *s= new (thd->mem_root) String((const char *) $1.str, + $1.length, + system_charset_info); + if (s == NULL) +@@ -8961,7 +8931,7 @@ using_list: + } + | using_list ',' ident + { +- String *s= new (YYTHD->mem_root) String((const char *) $3.str, ++ String *s= new (thd->mem_root) String((const char *) $3.str, + $3.length, + system_charset_info); + if (s == NULL) +@@ -9002,7 +8972,7 @@ interval_time_stamp: + implementation without changing its + resolution. + */ +- WARN_DEPRECATED(yythd, VER_CELOSIA, "FRAC_SECOND", "MICROSECOND"); ++ WARN_DEPRECATED(thd, VER_CELOSIA, "FRAC_SECOND", "MICROSECOND"); + } + ; + +@@ -9086,7 +9056,6 @@ opt_escape: + } + | /* empty */ + { +- THD *thd= YYTHD; + Lex->escape_used= FALSE; + $$= ((thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) ? + new (thd->mem_root) Item_string("", 0, &my_charset_latin1) : +@@ -9107,9 +9076,9 @@ group_clause: + + group_list: + group_list ',' order_ident order_dir +- { if (add_group_to_list(YYTHD, $3,(bool) $4)) MYSQL_YYABORT; } ++ { if (add_group_to_list(thd, $3,(bool) $4)) MYSQL_YYABORT; } + | order_ident order_dir +- { if (add_group_to_list(YYTHD, $1,(bool) $2)) MYSQL_YYABORT; } ++ { if (add_group_to_list(thd, $1,(bool) $2)) MYSQL_YYABORT; } + ; + + olap_opt: +@@ -9156,7 +9125,6 @@ alter_order_list: + alter_order_item: + simple_ident_nospvar order_dir + { +- THD *thd= YYTHD; + bool ascending= ($2 == 1) ? true : false; + if (add_order_to_list(thd, $1, ascending)) + MYSQL_YYABORT; +@@ -9209,9 +9177,9 @@ order_clause: + + order_list: + order_list ',' order_ident order_dir +- { if (add_order_to_list(YYTHD, $3,(bool) $4)) MYSQL_YYABORT; } ++ { if (add_order_to_list(thd, $3,(bool) $4)) MYSQL_YYABORT; } + | order_ident order_dir +- { if (add_order_to_list(YYTHD, $1,(bool) $2)) MYSQL_YYABORT; } ++ { if (add_order_to_list(thd, $1,(bool) $2)) MYSQL_YYABORT; } + ; + + order_dir: +@@ -9271,19 +9239,19 @@ limit_option: + } + | ULONGLONG_NUM + { +- $$= new (YYTHD->mem_root) Item_uint($1.str, $1.length); ++ $$= new (thd->mem_root) Item_uint($1.str, $1.length); + if ($$ == NULL) + MYSQL_YYABORT; + } + | LONG_NUM + { +- $$= new (YYTHD->mem_root) Item_uint($1.str, $1.length); ++ $$= new (thd->mem_root) Item_uint($1.str, $1.length); + if ($$ == NULL) + MYSQL_YYABORT; + } + | NUM + { +- $$= new (YYTHD->mem_root) Item_uint($1.str, $1.length); ++ $$= new (thd->mem_root) Item_uint($1.str, $1.length); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -9365,7 +9333,7 @@ procedure_clause: + lex->proc_list.elements=0; + lex->proc_list.first=0; + lex->proc_list.next= &lex->proc_list.first; +- Item_field *item= new (YYTHD->mem_root) ++ Item_field *item= new (thd->mem_root) + Item_field(&lex->current_select->context, + NULL, NULL, $2.str); + if (item == NULL) +@@ -9390,8 +9358,6 @@ procedure_list2: + procedure_item: + remember_name expr remember_end + { +- THD *thd= YYTHD; +- + if (add_proc_to_list(thd, $2)) + MYSQL_YYABORT; + if (!$2->name) +@@ -9560,7 +9526,6 @@ drop: + } + | DROP FUNCTION_SYM if_exists ident '.' ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + sp_name *spname; + if ($4.str && check_db_name(&$4)) +@@ -9583,7 +9548,6 @@ drop: + } + | DROP FUNCTION_SYM if_exists ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + LEX_STRING db= {0, 0}; + sp_name *spname; +@@ -9664,7 +9628,7 @@ table_list: + table_name: + table_ident + { +- if (!Select->add_table_to_list(YYTHD, $1, NULL, TL_OPTION_UPDATING)) ++ if (!Select->add_table_to_list(thd, $1, NULL, TL_OPTION_UPDATING)) + MYSQL_YYABORT; + } + ; +@@ -9677,7 +9641,7 @@ table_alias_ref_list: + table_alias_ref: + table_ident_opt_wild + { +- if (!Select->add_table_to_list(YYTHD, $1, NULL, ++ if (!Select->add_table_to_list(thd, $1, NULL, + TL_OPTION_UPDATING | TL_OPTION_ALIAS, + Lex->lock_option )) + MYSQL_YYABORT; +@@ -9868,7 +9832,7 @@ expr_or_default: + expr { $$= $1;} + | DEFAULT + { +- $$= new (YYTHD->mem_root) Item_default_value(Lex->current_context()); ++ $$= new (thd->mem_root) Item_default_value(Lex->current_context()); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -9922,7 +9886,7 @@ update_list: + update_elem: + simple_ident_nospvar equal expr_or_default + { +- if (add_item_to_list(YYTHD, $1) || add_value_to_list(YYTHD, $3)) ++ if (add_item_to_list(thd, $1) || add_value_to_list(thd, $3)) + MYSQL_YYABORT; + } + ; +@@ -9965,7 +9929,7 @@ delete: + single_multi: + FROM table_ident + { +- if (!Select->add_table_to_list(YYTHD, $2, NULL, TL_OPTION_UPDATING, ++ if (!Select->add_table_to_list(thd, $2, NULL, TL_OPTION_UPDATING, + Lex->lock_option)) + MYSQL_YYABORT; + } +@@ -9998,7 +9962,7 @@ table_wild_one: + Table_ident *ti= new Table_ident($1); + if (ti == NULL) + MYSQL_YYABORT; +- if (!Select->add_table_to_list(YYTHD, ++ if (!Select->add_table_to_list(thd, + ti, + $3, + TL_OPTION_UPDATING | TL_OPTION_ALIAS, +@@ -10007,10 +9971,10 @@ table_wild_one: + } + | ident '.' ident opt_wild opt_table_alias + { +- Table_ident *ti= new Table_ident(YYTHD, $1, $3, 0); ++ Table_ident *ti= new Table_ident(thd, $1, $3, 0); + if (ti == NULL) + MYSQL_YYABORT; +- if (!Select->add_table_to_list(YYTHD, ++ if (!Select->add_table_to_list(thd, + ti, + $5, + TL_OPTION_UPDATING | TL_OPTION_ALIAS, +@@ -10130,7 +10094,7 @@ show_param: + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_DATABASES; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_SCHEMATA)) ++ if (prepare_schema_table(thd, lex, 0, SCH_SCHEMATA)) + MYSQL_YYABORT; + } + | opt_full TABLES opt_db wild_and_where +@@ -10138,7 +10102,7 @@ show_param: + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_TABLES; + lex->select_lex.db= $3; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLE_NAMES)) ++ if (prepare_schema_table(thd, lex, 0, SCH_TABLE_NAMES)) + MYSQL_YYABORT; + } + | opt_full TRIGGERS_SYM opt_db wild_and_where +@@ -10146,7 +10110,7 @@ show_param: + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_TRIGGERS; + lex->select_lex.db= $3; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_TRIGGERS)) ++ if (prepare_schema_table(thd, lex, 0, SCH_TRIGGERS)) + MYSQL_YYABORT; + } + | EVENTS_SYM opt_db wild_and_where +@@ -10154,7 +10118,7 @@ show_param: + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_EVENTS; + lex->select_lex.db= $2; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_EVENTS)) ++ if (prepare_schema_table(thd, lex, 0, SCH_EVENTS)) + MYSQL_YYABORT; + } + | TABLE_SYM STATUS_SYM opt_db wild_and_where +@@ -10162,7 +10126,7 @@ show_param: + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_TABLE_STATUS; + lex->select_lex.db= $3; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLES)) ++ if (prepare_schema_table(thd, lex, 0, SCH_TABLES)) + MYSQL_YYABORT; + } + | OPEN_SYM TABLES opt_db wild_and_where +@@ -10170,22 +10134,22 @@ show_param: + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_OPEN_TABLES; + lex->select_lex.db= $3; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_OPEN_TABLES)) ++ if (prepare_schema_table(thd, lex, 0, SCH_OPEN_TABLES)) + MYSQL_YYABORT; + } + | opt_full PLUGIN_SYM + { + LEX *lex= Lex; +- WARN_DEPRECATED(yythd, "6.0", "SHOW PLUGIN", "'SHOW PLUGINS'"); ++ WARN_DEPRECATED(thd, "6.0", "SHOW PLUGIN", "'SHOW PLUGINS'"); + lex->sql_command= SQLCOM_SHOW_PLUGINS; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_PLUGINS)) ++ if (prepare_schema_table(thd, lex, 0, SCH_PLUGINS)) + MYSQL_YYABORT; + } + | PLUGINS_SYM + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_PLUGINS; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_PLUGINS)) ++ if (prepare_schema_table(thd, lex, 0, SCH_PLUGINS)) + MYSQL_YYABORT; + } + | ENGINE_SYM known_storage_engines show_engine_param +@@ -10198,7 +10162,7 @@ show_param: + lex->sql_command= SQLCOM_SHOW_FIELDS; + if ($5) + $4->change_db($5); +- if (prepare_schema_table(YYTHD, lex, $4, SCH_COLUMNS)) ++ if (prepare_schema_table(thd, lex, $4, SCH_COLUMNS)) + MYSQL_YYABORT; + } + | NEW_SYM MASTER_SYM FOR_SYM SLAVE +@@ -10233,7 +10197,7 @@ show_param: + lex->sql_command= SQLCOM_SHOW_KEYS; + if ($4) + $3->change_db($4); +- if (prepare_schema_table(YYTHD, lex, $3, SCH_STATISTICS)) ++ if (prepare_schema_table(thd, lex, $3, SCH_STATISTICS)) + MYSQL_YYABORT; + } + | COLUMN_SYM TYPES_SYM +@@ -10245,15 +10209,15 @@ show_param: + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES; +- WARN_DEPRECATED(yythd, "6.0", "SHOW TABLE TYPES", "'SHOW [STORAGE] ENGINES'"); +- if (prepare_schema_table(YYTHD, lex, 0, SCH_ENGINES)) ++ WARN_DEPRECATED(thd, "6.0", "SHOW TABLE TYPES", "'SHOW [STORAGE] ENGINES'"); ++ if (prepare_schema_table(thd, lex, 0, SCH_ENGINES)) + MYSQL_YYABORT; + } + | opt_storage ENGINES_SYM + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_ENGINES)) ++ if (prepare_schema_table(thd, lex, 0, SCH_ENGINES)) + MYSQL_YYABORT; + } + | AUTHORS_SYM +@@ -10285,7 +10249,7 @@ show_param: + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_PROFILE; +- if (prepare_schema_table(YYTHD, lex, NULL, SCH_PROFILES) != 0) ++ if (prepare_schema_table(thd, lex, NULL, SCH_PROFILES) != 0) + YYABORT; + } + | opt_var_type STATUS_SYM wild_and_where +@@ -10293,7 +10257,7 @@ show_param: + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_STATUS; + lex->option_type= $1; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_STATUS)) ++ if (prepare_schema_table(thd, lex, 0, SCH_STATUS)) + MYSQL_YYABORT; + } + | INNOBASE_SYM STATUS_SYM +@@ -10301,24 +10265,24 @@ show_param: + LEX *lex= Lex; + lex->sql_command = SQLCOM_SHOW_ENGINE_STATUS; + if (!(lex->create_info.db_type= +- ha_resolve_by_legacy_type(YYTHD, DB_TYPE_INNODB))) ++ ha_resolve_by_legacy_type(thd, DB_TYPE_INNODB))) + { + my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), "InnoDB"); + MYSQL_YYABORT; + } +- WARN_DEPRECATED(yythd, "6.0", "SHOW INNODB STATUS", "'SHOW ENGINE INNODB STATUS'"); ++ WARN_DEPRECATED(thd, "6.0", "SHOW INNODB STATUS", "'SHOW ENGINE INNODB STATUS'"); + } + | MUTEX_SYM STATUS_SYM + { + LEX *lex= Lex; + lex->sql_command = SQLCOM_SHOW_ENGINE_MUTEX; + if (!(lex->create_info.db_type= +- ha_resolve_by_legacy_type(YYTHD, DB_TYPE_INNODB))) ++ ha_resolve_by_legacy_type(thd, DB_TYPE_INNODB))) + { + my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), "InnoDB"); + MYSQL_YYABORT; + } +- WARN_DEPRECATED(yythd, "6.0", "SHOW MUTEX STATUS", "'SHOW ENGINE INNODB MUTEX'"); ++ WARN_DEPRECATED(thd, "6.0", "SHOW MUTEX STATUS", "'SHOW ENGINE INNODB MUTEX'"); + } + | opt_full PROCESSLIST_SYM + { Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;} +@@ -10327,21 +10291,21 @@ show_param: + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_VARIABLES; + lex->option_type= $1; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_VARIABLES)) ++ if (prepare_schema_table(thd, lex, 0, SCH_VARIABLES)) + MYSQL_YYABORT; + } + | charset wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_CHARSETS; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_CHARSETS)) ++ if (prepare_schema_table(thd, lex, 0, SCH_CHARSETS)) + MYSQL_YYABORT; + } + | COLLATION_SYM wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_COLLATIONS; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_COLLATIONS)) ++ if (prepare_schema_table(thd, lex, 0, SCH_COLLATIONS)) + MYSQL_YYABORT; + } + | GRANTS +@@ -10371,7 +10335,7 @@ show_param: + { + LEX *lex= Lex; + lex->sql_command = SQLCOM_SHOW_CREATE; +- if (!lex->select_lex.add_table_to_list(YYTHD, $3, NULL,0)) ++ if (!lex->select_lex.add_table_to_list(thd, $3, NULL,0)) + MYSQL_YYABORT; + lex->only_view= 0; + lex->create_info.storage_media= HA_SM_DEFAULT; +@@ -10380,7 +10344,7 @@ show_param: + { + LEX *lex= Lex; + lex->sql_command = SQLCOM_SHOW_CREATE; +- if (!lex->select_lex.add_table_to_list(YYTHD, $3, NULL, 0)) ++ if (!lex->select_lex.add_table_to_list(thd, $3, NULL, 0)) + MYSQL_YYABORT; + lex->only_view= 1; + } +@@ -10416,14 +10380,14 @@ show_param: + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_STATUS_PROC; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES)) ++ if (prepare_schema_table(thd, lex, 0, SCH_PROCEDURES)) + MYSQL_YYABORT; + } + | FUNCTION_SYM STATUS_SYM wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_STATUS_FUNC; +- if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES)) ++ if (prepare_schema_table(thd, lex, 0, SCH_PROCEDURES)) + MYSQL_YYABORT; + } + | PROCEDURE CODE_SYM sp_name +@@ -10501,7 +10465,7 @@ wild_and_where: + /* empty */ + | LIKE TEXT_STRING_sys + { +- Lex->wild= new (YYTHD->mem_root) String($2.str, $2.length, ++ Lex->wild= new (thd->mem_root) String($2.str, $2.length, + system_charset_info); + if (Lex->wild == NULL) + MYSQL_YYABORT; +@@ -10525,7 +10489,7 @@ describe: + lex->sql_command= SQLCOM_SHOW_FIELDS; + lex->select_lex.db= 0; + lex->verbose= 0; +- if (prepare_schema_table(YYTHD, lex, $2, SCH_COLUMNS)) ++ if (prepare_schema_table(thd, lex, $2, SCH_COLUMNS)) + MYSQL_YYABORT; + } + opt_describe_column {} +@@ -10554,7 +10518,7 @@ opt_describe_column: + | text_string { Lex->wild= $1; } + | ident + { +- Lex->wild= new (YYTHD->mem_root) String((const char*) $1.str, ++ Lex->wild= new (thd->mem_root) String((const char*) $1.str, + $1.length, + system_charset_info); + if (Lex->wild == NULL) +@@ -10697,7 +10661,6 @@ use: + load: + LOAD DATA_SYM + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + + if (lex->sphead) +@@ -10711,7 +10674,7 @@ load: + | LOAD TABLE_SYM table_ident FROM MASTER_SYM + { + LEX *lex=Lex; +- WARN_DEPRECATED(yythd, "6.0", "LOAD TABLE FROM MASTER", ++ WARN_DEPRECATED(thd, "6.0", "LOAD TABLE FROM MASTER", + "MySQL Administrator (mysqldump, mysql)"); + if (lex->sphead) + { +@@ -10719,7 +10682,7 @@ load: + MYSQL_YYABORT; + } + lex->sql_command = SQLCOM_LOAD_MASTER_TABLE; +- if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING)) ++ if (!Select->add_table_to_list(thd, $3, NULL, TL_OPTION_UPDATING)) + MYSQL_YYABORT; + } + ; +@@ -10739,7 +10702,7 @@ load_data: + opt_duplicate INTO TABLE_SYM table_ident + { + LEX *lex=Lex; +- if (!Select->add_table_to_list(YYTHD, $9, NULL, TL_OPTION_UPDATING, ++ if (!Select->add_table_to_list(thd, $9, NULL, TL_OPTION_UPDATING, + lex->lock_option)) + MYSQL_YYABORT; + lex->field_list.empty(); +@@ -10754,7 +10717,7 @@ load_data: + | FROM MASTER_SYM + { + Lex->sql_command = SQLCOM_LOAD_MASTER_DATA; +- WARN_DEPRECATED(yythd, "6.0", "LOAD DATA FROM MASTER", ++ WARN_DEPRECATED(thd, "6.0", "LOAD DATA FROM MASTER", + "mysqldump or future " + "BACKUP/RESTORE DATABASE facility"); + } +@@ -10872,7 +10835,7 @@ field_or_var: + simple_ident_nospvar {$$= $1;} + | '@' ident_or_text + { +- $$= new (YYTHD->mem_root) Item_user_var_as_out_param($2); ++ $$= new (thd->mem_root) Item_user_var_as_out_param($2); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -10889,7 +10852,6 @@ text_literal: + TEXT_STRING + { + LEX_STRING tmp; +- THD *thd= YYTHD; + CHARSET_INFO *cs_con= thd->variables.collation_connection; + CHARSET_INFO *cs_cli= thd->variables.character_set_client; + uint repertoire= thd->lex->text_string_is_7bit && +@@ -10915,7 +10877,7 @@ text_literal: + uint repertoire= Lex->text_string_is_7bit ? + MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30; + DBUG_ASSERT(my_charset_is_ascii_based(national_charset_info)); +- $$= new (YYTHD->mem_root) Item_string($1.str, $1.length, ++ $$= new (thd->mem_root) Item_string($1.str, $1.length, + national_charset_info, + DERIVATION_COERCIBLE, + repertoire); +@@ -10924,7 +10886,7 @@ text_literal: + } + | UNDERSCORE_CHARSET TEXT_STRING + { +- Item_string *str= new (YYTHD->mem_root) Item_string($2.str, ++ Item_string *str= new (thd->mem_root) Item_string($2.str, + $2.length, $1); + if (str == NULL) + MYSQL_YYABORT; +@@ -10943,7 +10905,7 @@ text_literal: + If the string has been pure ASCII so far, + check the new part. + */ +- CHARSET_INFO *cs= YYTHD->variables.collation_connection; ++ CHARSET_INFO *cs= thd->variables.collation_connection; + item->collation.repertoire|= my_string_repertoire(cs, + $2.str, + $2.length); +@@ -10954,15 +10916,15 @@ text_literal: + text_string: + TEXT_STRING_literal + { +- $$= new (YYTHD->mem_root) String($1.str, ++ $$= new (thd->mem_root) String($1.str, + $1.length, +- YYTHD->variables.collation_connection); ++ thd->variables.collation_connection); + if ($$ == NULL) + MYSQL_YYABORT; + } + | HEX_NUM + { +- Item *tmp= new (YYTHD->mem_root) Item_hex_string($1.str, $1.length); ++ Item *tmp= new (thd->mem_root) Item_hex_string($1.str, $1.length); + if (tmp == NULL) + MYSQL_YYABORT; + /* +@@ -10974,7 +10936,7 @@ text_string: + } + | BIN_NUM + { +- Item *tmp= new (YYTHD->mem_root) Item_bin_string($1.str, $1.length); ++ Item *tmp= new (thd->mem_root) Item_bin_string($1.str, $1.length); + if (tmp == NULL) + MYSQL_YYABORT; + /* +@@ -10989,7 +10951,6 @@ text_string: + param_marker: + PARAM_MARKER + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + Item_param *item; +@@ -11022,38 +10983,38 @@ literal: + | NUM_literal { $$ = $1; } + | NULL_SYM + { +- $$ = new (YYTHD->mem_root) Item_null(); ++ $$ = new (thd->mem_root) Item_null(); + if ($$ == NULL) + MYSQL_YYABORT; + YYLIP->next_state= MY_LEX_OPERATOR_OR_IDENT; + } + | FALSE_SYM + { +- $$= new (YYTHD->mem_root) Item_int((char*) "FALSE",0,1); ++ $$= new (thd->mem_root) Item_int((char*) "FALSE",0,1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRUE_SYM + { +- $$= new (YYTHD->mem_root) Item_int((char*) "TRUE",1,1); ++ $$= new (thd->mem_root) Item_int((char*) "TRUE",1,1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | HEX_NUM + { +- $$ = new (YYTHD->mem_root) Item_hex_string($1.str, $1.length); ++ $$ = new (thd->mem_root) Item_hex_string($1.str, $1.length); + if ($$ == NULL) + MYSQL_YYABORT; + } + | BIN_NUM + { +- $$= new (YYTHD->mem_root) Item_bin_string($1.str, $1.length); ++ $$= new (thd->mem_root) Item_bin_string($1.str, $1.length); + if ($$ == NULL) + MYSQL_YYABORT; + } + | UNDERSCORE_CHARSET HEX_NUM + { +- Item *tmp= new (YYTHD->mem_root) Item_hex_string($2.str, $2.length); ++ Item *tmp= new (thd->mem_root) Item_hex_string($2.str, $2.length); + if (tmp == NULL) + MYSQL_YYABORT; + /* +@@ -11064,7 +11025,7 @@ literal: + String *str= tmp->val_str((String*) 0); + + Item_string *item_str; +- item_str= new (YYTHD->mem_root) ++ item_str= new (thd->mem_root) + Item_string(NULL, /* name will be set in select_item */ + str ? str->ptr() : "", + str ? str->length() : 0, +@@ -11082,7 +11043,7 @@ literal: + } + | UNDERSCORE_CHARSET BIN_NUM + { +- Item *tmp= new (YYTHD->mem_root) Item_bin_string($2.str, $2.length); ++ Item *tmp= new (thd->mem_root) Item_bin_string($2.str, $2.length); + if (tmp == NULL) + MYSQL_YYABORT; + /* +@@ -11093,7 +11054,7 @@ literal: + String *str= tmp->val_str((String*) 0); + + Item_string *item_str; +- item_str= new (YYTHD->mem_root) ++ item_str= new (thd->mem_root) + Item_string(NULL, /* name will be set in select_item */ + str ? str->ptr() : "", + str ? str->length() : 0, +@@ -11117,7 +11078,7 @@ NUM_literal: + NUM + { + int error; +- $$= new (YYTHD->mem_root) ++ $$= new (thd->mem_root) + Item_int($1.str, + (longlong) my_strtoll10($1.str, NULL, &error), + $1.length); +@@ -11127,7 +11088,7 @@ NUM_literal: + | LONG_NUM + { + int error; +- $$= new (YYTHD->mem_root) ++ $$= new (thd->mem_root) + Item_int($1.str, + (longlong) my_strtoll10($1.str, NULL, &error), + $1.length); +@@ -11136,23 +11097,23 @@ NUM_literal: + } + | ULONGLONG_NUM + { +- $$= new (YYTHD->mem_root) Item_uint($1.str, $1.length); ++ $$= new (thd->mem_root) Item_uint($1.str, $1.length); + if ($$ == NULL) + MYSQL_YYABORT; + } + | DECIMAL_NUM + { +- $$= new (YYTHD->mem_root) Item_decimal($1.str, $1.length, +- YYTHD->charset()); +- if (($$ == NULL) || (YYTHD->is_error())) ++ $$= new (thd->mem_root) Item_decimal($1.str, $1.length, ++ thd->charset()); ++ if (($$ == NULL) || (thd->is_error())) + { + MYSQL_YYABORT; + } + } + | FLOAT_NUM + { +- $$= new (YYTHD->mem_root) Item_float($1.str, $1.length); +- if (($$ == NULL) || (YYTHD->is_error())) ++ $$= new (thd->mem_root) Item_float($1.str, $1.length); ++ if (($$ == NULL) || (thd->is_error())) + { + MYSQL_YYABORT; + } +@@ -11172,7 +11133,7 @@ table_wild: + ident '.' '*' + { + SELECT_LEX *sel= Select; +- $$= new (YYTHD->mem_root) Item_field(Lex->current_context(), ++ $$= new (thd->mem_root) Item_field(Lex->current_context(), + NullS, $1.str, "*"); + if ($$ == NULL) + MYSQL_YYABORT; +@@ -11180,7 +11141,6 @@ table_wild: + } + | ident '.' ident '.' '*' + { +- THD *thd= YYTHD; + SELECT_LEX *sel= Select; + const char* schema= thd->client_capabilities & CLIENT_NO_SCHEMA ? + NullS : $1.str; +@@ -11200,7 +11160,6 @@ order_ident: + simple_ident: + ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + sp_variable_t *spv; +@@ -11251,7 +11210,6 @@ simple_ident: + simple_ident_nospvar: + ident + { +- THD *thd= YYTHD; + SELECT_LEX *sel=Select; + if ((sel->parsing_place != IN_HAVING) || + (sel->get_in_sum_expr() > 0)) +@@ -11273,7 +11231,6 @@ simple_ident_nospvar: + simple_ident_q: + ident '.' ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + + /* +@@ -11352,7 +11309,6 @@ simple_ident_q: + } + | '.' ident '.' ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + SELECT_LEX *sel= lex->current_select; + if (sel->no_table_names_allowed) +@@ -11377,7 +11333,6 @@ simple_ident_q: + } + | ident '.' ident '.' ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + SELECT_LEX *sel= lex->current_select; + const char* schema= (thd->client_capabilities & CLIENT_NO_SCHEMA ? +@@ -11445,7 +11400,7 @@ table_ident: + } + | ident '.' ident + { +- $$= new Table_ident(YYTHD, $1,$3,0); ++ $$= new Table_ident(thd, $1,$3,0); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -11467,7 +11422,7 @@ table_ident_opt_wild: + } + | ident '.' ident opt_wild + { +- $$= new Table_ident(YYTHD, $1,$3,0); ++ $$= new Table_ident(thd, $1,$3,0); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -11477,7 +11432,7 @@ table_ident_nodb: + ident + { + LEX_STRING db={(char*) any_db,3}; +- $$= new Table_ident(YYTHD, db,$1,0); ++ $$= new Table_ident(thd, db,$1,0); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -11487,8 +11442,6 @@ IDENT_sys: + IDENT { $$= $1; } + | IDENT_QUOTED + { +- THD *thd= YYTHD; +- + if (thd->charset_is_system_charset) + { + CHARSET_INFO *cs= system_charset_info; +@@ -11516,8 +11469,6 @@ IDENT_sys: + TEXT_STRING_sys: + TEXT_STRING + { +- THD *thd= YYTHD; +- + if (thd->charset_is_system_charset) + $$= $1; + else +@@ -11532,8 +11483,6 @@ TEXT_STRING_sys: + TEXT_STRING_literal: + TEXT_STRING + { +- THD *thd= YYTHD; +- + if (thd->charset_is_collation_connection) + $$= $1; + else +@@ -11548,8 +11497,6 @@ TEXT_STRING_literal: + TEXT_STRING_filesystem: + TEXT_STRING + { +- THD *thd= YYTHD; +- + if (thd->charset_is_character_set_filesystem) + $$= $1; + else +@@ -11566,7 +11513,6 @@ ident: + IDENT_sys { $$=$1; } + | keyword + { +- THD *thd= YYTHD; + $$.str= thd->strmake($1.str, $1.length); + if ($$.str == NULL) + MYSQL_YYABORT; +@@ -11578,7 +11524,6 @@ label_ident: + IDENT_sys { $$=$1; } + | keyword_sp + { +- THD *thd= YYTHD; + $$.str= thd->strmake($1.str, $1.length); + if ($$.str == NULL) + MYSQL_YYABORT; +@@ -11595,7 +11540,6 @@ ident_or_text: + user: + ident_or_text + { +- THD *thd= YYTHD; + if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) + MYSQL_YYABORT; + $$->user = $1; +@@ -11609,7 +11553,6 @@ user: + } + | ident_or_text '@' ident_or_text + { +- THD *thd= YYTHD; + if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) + MYSQL_YYABORT; + $$->user = $1; $$->host=$3; +@@ -11628,7 +11571,7 @@ user: + } + | CURRENT_USER optional_braces + { +- if (!($$=(LEX_USER*) YYTHD->alloc(sizeof(st_lex_user)))) ++ if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) + MYSQL_YYABORT; + /* + empty LEX_USER means current_user and +@@ -11991,7 +11934,6 @@ option_value_list: + + option_type_value: + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + +@@ -12022,7 +11964,6 @@ option_type_value: + } + ext_option_value + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + +@@ -12105,7 +12046,6 @@ ext_option_value: + sys_option_value: + option_type internal_variable_name equal set_expr_or_default + { +- THD *thd= YYTHD; + LEX *lex= Lex; + LEX_STRING *name= &$2.base_name; + +@@ -12117,7 +12057,7 @@ sys_option_value: + my_parse_error(ER(ER_SYNTAX_ERROR)); + MYSQL_YYABORT; + } +- if (set_trigger_new_row(YYTHD, name, $4)) ++ if (set_trigger_new_row(thd, name, $4)) + MYSQL_YYABORT; + } + else if ($2.var) +@@ -12147,7 +12087,6 @@ sys_option_value: + } + | option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types + { +- THD *thd= YYTHD; + LEX *lex=Lex; + lex->option_type= $1; + Item *item= new (thd->mem_root) Item_int((int32) $5); +@@ -12167,7 +12106,7 @@ option_value: + '@' ident_or_text equal expr + { + Item_func_set_user_var *item; +- item= new (YYTHD->mem_root) Item_func_set_user_var($2, $4); ++ item= new (thd->mem_root) Item_func_set_user_var($2, $4); + if (item == NULL) + MYSQL_YYABORT; + set_var_user *var= new set_var_user(item); +@@ -12177,7 +12116,6 @@ option_value: + } + | '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default + { +- THD *thd= YYTHD; + struct sys_var_with_base tmp= $4; + /* Lookup if necessary: must be a system variable. */ + if (tmp.var == NULL) +@@ -12190,7 +12128,6 @@ option_value: + } + | charset old_or_new_charset_name_or_default + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + CHARSET_INFO *cs2; + cs2= $2 ? $2: global_system_variables.character_set_client; +@@ -12238,7 +12175,6 @@ option_value: + } + | PASSWORD equal text_or_password + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + LEX_USER *user; + sp_pcontext *spc= lex->spcont; +@@ -12278,7 +12214,6 @@ option_value: + internal_variable_name: + ident + { +- THD *thd= YYTHD; + sp_pcontext *spc= thd->lex->spcont; + sp_variable_t *spv; + +@@ -12337,7 +12272,7 @@ internal_variable_name: + } + else + { +- sys_var *tmp=find_sys_var(YYTHD, $3.str, $3.length); ++ sys_var *tmp=find_sys_var(thd, $3.str, $3.length); + if (!tmp) + MYSQL_YYABORT; + if (!tmp->is_struct()) +@@ -12348,7 +12283,7 @@ internal_variable_name: + } + | DEFAULT '.' ident + { +- sys_var *tmp=find_sys_var(YYTHD, $3.str, $3.length); ++ sys_var *tmp=find_sys_var(thd, $3.str, $3.length); + if (!tmp) + MYSQL_YYABORT; + if (!tmp->is_struct()) +@@ -12370,16 +12305,16 @@ text_or_password: + TEXT_STRING { $$=$1.str;} + | PASSWORD '(' TEXT_STRING ')' + { +- $$= $3.length ? YYTHD->variables.old_passwords ? +- Item_func_old_password::alloc(YYTHD, $3.str, $3.length) : +- Item_func_password::alloc(YYTHD, $3.str, $3.length) : ++ $$= $3.length ? thd->variables.old_passwords ? ++ Item_func_old_password::alloc(thd, $3.str, $3.length) : ++ Item_func_password::alloc(thd, $3.str, $3.length) : + $3.str; + if ($$ == NULL) + MYSQL_YYABORT; + } + | OLD_PASSWORD '(' TEXT_STRING ')' + { +- $$= $3.length ? Item_func_old_password::alloc(YYTHD, $3.str, ++ $$= $3.length ? Item_func_old_password::alloc(thd, $3.str, + $3.length) : + $3.str; + if ($$ == NULL) +@@ -12393,19 +12328,19 @@ set_expr_or_default: + | DEFAULT { $$=0; } + | ON + { +- $$=new (YYTHD->mem_root) Item_string("ON", 2, system_charset_info); ++ $$=new (thd->mem_root) Item_string("ON", 2, system_charset_info); + if ($$ == NULL) + MYSQL_YYABORT; + } + | ALL + { +- $$=new (YYTHD->mem_root) Item_string("ALL", 3, system_charset_info); ++ $$=new (thd->mem_root) Item_string("ALL", 3, system_charset_info); + if ($$ == NULL) + MYSQL_YYABORT; + } + | BINARY + { +- $$=new (YYTHD->mem_root) Item_string("binary", 6, system_charset_info); ++ $$=new (thd->mem_root) Item_string("binary", 6, system_charset_info); + if ($$ == NULL) + MYSQL_YYABORT; + } +@@ -12443,7 +12378,7 @@ table_lock: + table_ident opt_table_alias lock_option + { + thr_lock_type lock_type= (thr_lock_type) $3; +- if (!Select->add_table_to_list(YYTHD, $1, $2, 0, lock_type)) ++ if (!Select->add_table_to_list(thd, $1, $2, 0, lock_type)) + MYSQL_YYABORT; + /* If table is to be write locked, protect from a impending GRL. */ + if (lock_type >= TL_WRITE_ALLOW_WRITE) +@@ -12514,7 +12449,7 @@ handler: + lex->expr_allows_subselect= FALSE; + lex->sql_command = SQLCOM_HA_READ; + lex->ha_rkey_mode= HA_READ_KEY_EXACT; /* Avoid purify warnings */ +- Item *one= new (YYTHD->mem_root) Item_int((int32) 1); ++ Item *one= new (thd->mem_root) Item_int((int32) 1); + if (one == NULL) + MYSQL_YYABORT; + lex->current_select->select_limit= one; +@@ -12836,10 +12771,10 @@ grant_user: + $$=$1; $1->password=$4; + if ($4.length) + { +- if (YYTHD->variables.old_passwords) ++ if (thd->variables.old_passwords) + { + char *buff= +- (char *) YYTHD->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH_323+1); ++ (char *) thd->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH_323+1); + if (buff == NULL) + MYSQL_YYABORT; + my_make_scrambled_password_323(buff, $4.str, $4.length); +@@ -12849,7 +12784,7 @@ grant_user: + else + { + char *buff= +- (char *) YYTHD->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH+1); ++ (char *) thd->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH+1); + if (buff == NULL) + MYSQL_YYABORT; + my_make_scrambled_password(buff, $4.str, $4.length); +@@ -12881,7 +12816,7 @@ column_list: + column_list_id: + ident + { +- String *new_str = new (YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info); ++ String *new_str = new (thd->mem_root) String((const char*) $1.str,$1.length,system_charset_info); + if (new_str == NULL) + MYSQL_YYABORT; + List_iterator iter(Lex->columns); +@@ -12981,14 +12916,14 @@ opt_work: + + opt_chain: + /* empty */ +- { $$= (YYTHD->variables.completion_type == 1); } ++ { $$= (thd->variables.completion_type == 1); } + | AND_SYM NO_SYM CHAIN_SYM { $$=0; } + | AND_SYM CHAIN_SYM { $$=1; } + ; + + opt_release: + /* empty */ +- { $$= (YYTHD->variables.completion_type == 2); } ++ { $$= (thd->variables.completion_type == 2); } + | RELEASE_SYM { $$=1; } + | NO_SYM RELEASE_SYM { $$=0; } + ; +@@ -13102,7 +13037,6 @@ union_opt: + + union_order_or_limit: + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + DBUG_ASSERT(lex->current_select->linkage != GLOBAL_OPTIONS_TYPE); + SELECT_LEX *sel= lex->current_select; +@@ -13118,7 +13052,6 @@ union_order_or_limit: + } + order_or_limit + { +- THD *thd= YYTHD; + thd->lex->current_select->no_table_names_allowed= 0; + thd->where= ""; + } +@@ -13255,14 +13188,14 @@ no_definer: + from older master servers (i.e. to create non-suid trigger in this + case). + */ +- YYTHD->lex->definer= 0; ++ thd->lex->definer= 0; + } + ; + + definer: + DEFINER_SYM EQ user + { +- YYTHD->lex->definer= get_current_user(YYTHD, $3); ++ thd->lex->definer= get_current_user(thd, $3); + } + ; + +@@ -13307,7 +13240,6 @@ view_suid: + view_tail: + view_suid VIEW_SYM table_ident + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + lex->sql_command= SQLCOM_CREATE_VIEW; + /* first table in list is target VIEW name */ +@@ -13347,7 +13279,6 @@ view_select: + } + view_select_aux view_check_option + { +- THD *thd= YYTHD; + LEX *lex= Lex; + uint len= YYLIP->get_cpp_ptr() - lex->create_view_select.str; + void *create_view_select= thd->memdup(lex->create_view_select.str, len); +@@ -13403,7 +13334,6 @@ trigger_tail: + EACH_SYM + ROW_SYM + { /* $15 */ +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + sp_head *sp; +@@ -13437,8 +13367,8 @@ trigger_tail: + sp_head *sp= lex->sphead; + + lex->sql_command= SQLCOM_CREATE_TRIGGER; +- sp->set_stmt_end(YYTHD); +- sp->restore_thd_mem_root(YYTHD); ++ sp->set_stmt_end(thd); ++ sp->restore_thd_mem_root(thd); + + if (sp->is_not_allowed_in_function("trigger")) + MYSQL_YYABORT; +@@ -13448,7 +13378,7 @@ trigger_tail: + sp_proc_stmt alternatives are not saving/restoring LEX, so + lex->query_tables can be wiped out. + */ +- if (!lex->select_lex.add_table_to_list(YYTHD, $9, ++ if (!lex->select_lex.add_table_to_list(thd, $9, + (LEX_STRING*) 0, + TL_OPTION_UPDATING, + TL_IGNORE)) +@@ -13466,7 +13396,6 @@ udf_tail: + AGGREGATE_SYM remember_name FUNCTION_SYM ident + RETURNS_SYM udf_type SONAME_SYM TEXT_STRING_sys + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + if (is_native_function(thd, & $4)) + { +@@ -13484,7 +13413,6 @@ udf_tail: + | remember_name FUNCTION_SYM ident + RETURNS_SYM udf_type SONAME_SYM TEXT_STRING_sys + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + if (is_native_function(thd, & $3)) + { +@@ -13507,7 +13435,6 @@ sf_tail: + sp_name /* $3 */ + '(' /* $4 */ + { /* $5 */ +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + sp_head *sp; +@@ -13565,7 +13492,7 @@ sf_tail: + MYSQL_YYABORT; + } + +- if (sp->fill_field_definition(YYTHD, lex, ++ if (sp->fill_field_definition(thd, lex, + (enum enum_field_types) $11, + &sp->m_return_field_def)) + MYSQL_YYABORT; +@@ -13574,7 +13501,6 @@ sf_tail: + } + sp_c_chistics /* $13 */ + { /* $14 */ +- THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + +@@ -13583,7 +13509,6 @@ sf_tail: + } + sp_proc_stmt /* $15 */ + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + sp_head *sp= lex->sphead; + +@@ -13654,10 +13579,10 @@ sp_tail: + sp= new sp_head(); + if (sp == NULL) + MYSQL_YYABORT; +- sp->reset_thd_mem_root(YYTHD); ++ sp->reset_thd_mem_root(thd); + sp->init(lex); + sp->m_type= TYPE_ENUM_PROCEDURE; +- sp->init_sp_name(YYTHD, $3); ++ sp->init_sp_name(thd, $3); + + lex->sphead= sp; + } +@@ -13672,7 +13597,6 @@ sp_tail: + sp_pdparam_list + ')' + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + + lex->sphead->m_param_end= YYLIP->get_cpp_tok_start(); +@@ -13680,7 +13604,6 @@ sp_tail: + } + sp_c_chistics + { +- THD *thd= YYTHD; + LEX *lex= thd->lex; + + lex->sphead->m_chistics= &lex->sp_chistics; +@@ -13691,9 +13614,9 @@ sp_tail: + LEX *lex= Lex; + sp_head *sp= lex->sphead; + +- sp->set_stmt_end(YYTHD); ++ sp->set_stmt_end(thd); + lex->sql_command= SQLCOM_CREATE_PROCEDURE; +- sp->restore_thd_mem_root(YYTHD); ++ sp->restore_thd_mem_root(thd); + } + ; + +@@ -13730,21 +13653,21 @@ xid: + text_string + { + MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE); +- if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID)))) ++ if (!(Lex->xid=(XID *)thd->alloc(sizeof(XID)))) + MYSQL_YYABORT; + Lex->xid->set(1L, $1->ptr(), $1->length(), 0, 0); + } + | text_string ',' text_string + { + MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE); +- if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID)))) ++ if (!(Lex->xid=(XID *)thd->alloc(sizeof(XID)))) + MYSQL_YYABORT; + Lex->xid->set(1L, $1->ptr(), $1->length(), $3->ptr(), $3->length()); + } + | text_string ',' text_string ',' ulong_num + { + MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE); +- if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID)))) ++ if (!(Lex->xid=(XID *)thd->alloc(sizeof(XID)))) + MYSQL_YYABORT; + Lex->xid->set($5, $1->ptr(), $1->length(), $3->ptr(), $3->length()); + } diff --git a/utils/nano/Makefile b/utils/nano/Makefile new file mode 100644 index 0000000..10d86b0 --- /dev/null +++ b/utils/nano/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2007-2016 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:=nano +PKG_VERSION:=2.7.1 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-3.0+ +PKG_LICENSE_FILES:=COPYING + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@GNU/nano +PKG_MD5SUM:=df5cbe69831d7394c0a32fb27373ab313335ea4dc586d6f4be4081eb1de857cd + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/nano + SUBMENU:=Editors + SECTION:=utils + CATEGORY:=Utilities + TITLE:=An enhanced clone of the Pico text editor + URL:=http://www.nano-editor.org/ + MAINTAINER:=Jonathan Bennett + DEPENDS:=+libncurses +endef + +define Package/nano/description + Nano (Nano's ANOther editor, or Not ANOther editor) is an enhanced clone + of the Pico text editor. +endef + +CONFIGURE_ARGS += \ + --enable-tiny \ + --disable-glibtest \ + --disable-utf8 \ + --without-slang \ + --disable-color \ + +CONFIGURE_VARS += \ + ac_cv_header_regex_h=no \ + +define Package/nano/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,nano)) + diff --git a/utils/ncdu/Makefile b/utils/ncdu/Makefile new file mode 100644 index 0000000..fa52ff6 --- /dev/null +++ b/utils/ncdu/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2015 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:=ncdu +PKG_VERSION:=1.12 +PKG_RELEASE=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://dev.yorhel.nl/download +PKG_MD5SUM:=7365ac46c420bc511621216b1747984f + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=COPYING + +include $(INCLUDE_DIR)/package.mk + +define Package/ncdu + SUBMENU:=Filesystem + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libncurses + TITLE:=ncurses disk usage viewer + MAINTAINER:=Charles Lehner + URL:=https://dev.yorhel.nl/ncdu +endef + +define Package/ncdu/description + Ncdu is a ncurses-based du viewer. It provides a fast and easy-to-use + interface through famous du utility. It allows one to browse through the + directories and show percentages of disk usage with ncurses library. +endef + +CONFIGURE_ARGS += --with-ncurses + +define Package/ncdu/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ncdu $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,ncdu)) diff --git a/utils/ntfs-3g/Makefile b/utils/ntfs-3g/Makefile new file mode 100644 index 0000000..a68747e --- /dev/null +++ b/utils/ntfs-3g/Makefile @@ -0,0 +1,234 @@ +# +# Copyright (C) 2007-2016 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:=ntfs-3g +PKG_RELEASE:=1 + +PKG_VERSION:=2016.2.22 +PKG_SOURCE:=$(PKG_NAME)_ntfsprogs-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://www.tuxera.com/opensource/ +PKG_MD5SUM:=ccbe8672d0f757bd0c975b50aa4c512e + +PKG_LICENSE:=GPL-2.0 LGPL-2.0 +PKG_LICENSE_FILES:=COPYING COPYING.LIB + +PKG_MAINTAINER:=Ted Hess + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +# release contains fuseext/int hint +PKG_RELEASE:=$(PKG_RELEASE)$(if $(CONFIG_PACKAGE_NTFS-3G_USE_LIBFUSE),-fuseext,-fuseint) + +# define build dir, respect fuseext/int +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE) + +include $(INCLUDE_DIR)/package.mk + +define Package/ntfs-3g/common + SECTION:=utils + CATEGORY:=Utilities + URL:=http://www.tuxera.com + SUBMENU:=Filesystem + TITLE:=Stable Read/Write NTFS Driver +endef + +define Package/ntfs-3g + $(call Package/ntfs-3g/common) + DEPENDS+= +kmod-fuse +PACKAGE_NTFS-3G_USE_LIBFUSE:libfuse +libpthread +endef + +define Package/ntfs-3g/description + Ntfs-3g is a NTFS driver, which can create, remove, rename, + move files, directories, hard links, and streams. It can read + and write files, including streams and sparse files. It can + handle special files like symbolic links, devices, and FIFOs. + Moreover it can also read transparently compressed files. + + Contains: + - ntfs-3g + - ntfs-3g.probe + - mount.ntfs-3g (symlink to ntfs-3g) + +endef + +define Package/ntfs-3g/config +config PACKAGE_NTFS-3G_USE_LIBFUSE + bool "use external FUSE library, selects package libfuse" + depends on PACKAGE_ntfs-3g + ---help--- + Ntfs-3g by default uses a minimalized lite version of FUSE. + If libfuse is part of your filesystem anyway (because of sshfs, owfs + etc.) it makes sense to activate this option and save some kilobytes + of space. + +endef + +define Package/ntfs-3g-low + $(call Package/ntfs-3g/common) + TITLE:=lowntfs-3g (alternative using the fuse low-level interface) + DEPENDS+= +ntfs-3g +endef + +define Package/ntfs-3g-low/description + Contains: + - lowntfs-3g + - mount.lowntfs-3g (symlink to lowntfs-3g) + + A driver variant using the fuse low-level interface missing some of the + enhanced functionality for streams or the like. You might want to check: + http://www.tuxera.com/community/ntfs-3g-manual/ + +endef + +define Package/ntfs-3g-utils + $(call Package/ntfs-3g/common) + TITLE:=ntfs-3g utilities (extra) + DEPENDS+= +ntfs-3g +endef + +define Package/ntfs-3g-utils/description + Additional ntfs-3g utilities. Not included by default for size + considerations. + + Currently: + - ntfs-3g.secaudit + - ntfs-3g.usermap +endef + +define Package/ntfsprogs_ntfs-3g/description + Suite of NTFS utilities for doing neat things with NTFS. + Contains: + - mkntfs - Create an NTFS filesystem. + - ntfscat - Dump a file's content to the standard output. + - ntfsclone - Efficiently clone, backup, restore or rescue NTFS. + - ntfscluster - Locate the files which use the given sectors or clusters. + - ntfscmp - Compare two NTFS filesystems and tell the differences. + - ntfscp - Copy a file to an NTFS volume. + - ntfsfix - Check and fix some common errors, clear the LogFile. + - ntfsinfo - Show information about NTFS or one of the files or directories within it. + - ntfslabel - Show, or set, an NTFS filesystem's volume label. + - ntfsls - List information about files in a directory residing on an NTFS. + - ntfsresize - Resize NTFS without losing data. + - ntfsundelete - Recover deleted files from NTFS. +endef + +define Package/ntfsprogs_ntfs-3g + $(call Package/ntfs-3g/common) + TITLE:=ntfsprogs (ntfs-3g) + DEPENDS+= +ntfs-3g +libgcrypt +libuuid +endef + +CONFIGURE_ARGS += \ + --enable-shared \ + --enable-static \ + --with-uuid + +# configure/make according selection +ifdef CONFIG_PACKAGE_NTFS-3G_USE_LIBFUSE + CONFIGURE_ARGS += --with-fuse=external + TARGET_CPPFLAGS:=-I$(STAGING_DIR)/usr/include/fuse $(TARGET_CPPFLAGS) +else + CONFIGURE_ARGS += --with-fuse=internal + TARGET_CPPFLAGS:=-I../include/fuse-lite $(TARGET_CPPFLAGS) +endif + +# enable disable ntfsprogs +ifneq ($(CONFIG_PACKAGE_ntfsprogs_ntfs-3g)$(SDK)$(DEVELOPER),) + CONFIGURE_ARGS += --enable-ntfsprogs +else + CONFIGURE_ARGS += --disable-ntfsprogs +endif + +# redefine prepare to extract to our build dir +# apply patches +define Build/Prepare + rm -rf $(PKG_BUILD_DIR)/ + mkdir -p $(PKG_BUILD_DIR)/ + $(TAR) -xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip 1 + $(Build/Patch) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/ntfs-3g $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libntfs-3g.{la,a,so*} $(1)/usr/lib/ +endef + +define Package/ntfs-3g/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ntfs-3g{,.probe} $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libntfs-3g.so.* $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/sbin + $(CP) $(PKG_INSTALL_DIR)/sbin/mount.ntfs-3g $(1)/sbin/ + $(CP) $(PKG_INSTALL_DIR)/sbin/mount.ntfs-3g $(1)/sbin/mount.ntfs +endef + +define Package/ntfs-3g/postinst +#!/bin/sh +FILE="$${IPKG_INSTROOT}/etc/filesystems" +ID="ntfs-3g" + +if ! [ -f '/etc/filesystems' ]; then + echo "Create '$$FILE'." + touch "$$FILE" +fi + +if ! grep -q -e '^ntfs-3g$$' "$$FILE"; then + echo "Add '$$ID' to known filesystems." + echo "$$ID" >> "$$FILE" +fi + +endef + +define Package/ntfs-3g-low/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lowntfs-3g $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/sbin + $(CP) $(PKG_INSTALL_DIR)/sbin/mount.lowntfs-3g $(1)/sbin/ +endef + +define Package/ntfs-3g-low/postinst +#!/bin/sh +FILE="$${IPKG_INSTROOT}/etc/filesystems" +ID="lowntfs-3g" + +if ! [ -f '/etc/filesystems' ]; then + echo "Create '$$FILE'." + touch "$$FILE" +fi + +if ! grep -q -e '^ntfs-3g$$' "$$FILE"; then + echo "Add '$$ID' to known filesystems." + echo "$$ID" >> "$$FILE" +fi + +endef + +define Package/ntfs-3g-utils/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ntfs-3g.secaudit $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ntfs-3g.usermap $(1)/usr/bin +endef + +define Package/ntfsprogs_ntfs-3g/install + $(INSTALL_DIR) $(1)/sbin + $(CP) $(PKG_INSTALL_DIR)/sbin/mkfs.ntfs $(1)/sbin/ + $(INSTALL_DIR) $(1)/usr/bin + $(FIND) $(PKG_INSTALL_DIR)/usr/bin/ -type f ! -regex '.*[^/]*ntfs-3g[^/]*' -exec $(INSTALL_BIN) {} $(1)/usr/bin/ \; + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,ntfs-3g)) +$(eval $(call BuildPackage,ntfs-3g-low)) +$(eval $(call BuildPackage,ntfs-3g-utils)) +$(eval $(call BuildPackage,ntfsprogs_ntfs-3g)) diff --git a/utils/ntfs-3g/patches/001-fuseint-fix-path-mounted-on-musl.patch b/utils/ntfs-3g/patches/001-fuseint-fix-path-mounted-on-musl.patch new file mode 100644 index 0000000..577c89b --- /dev/null +++ b/utils/ntfs-3g/patches/001-fuseint-fix-path-mounted-on-musl.patch @@ -0,0 +1,30 @@ +Index: ntfs-3g-2014.2.15-1-fuseint/libfuse-lite/fusermount.c +=================================================================== +--- ntfs-3g-2014.2.15-1-fuseint.orig/libfuse-lite/fusermount.c ++++ ntfs-3g-2014.2.15-1-fuseint/libfuse-lite/fusermount.c +@@ -36,6 +36,10 @@ + + #define FUSE_DEV_NEW "/dev/fuse" + ++#ifndef _PATH_MOUNTED ++#define _PATH_MOUNTED "/proc/mounts" ++#endif ++ + #ifndef MS_DIRSYNC + #define MS_DIRSYNC 128 + #endif +Index: ntfs-3g-2014.2.15-1-fuseint/libfuse-lite/mount_util.c +=================================================================== +--- ntfs-3g-2014.2.15-1-fuseint.orig/libfuse-lite/mount_util.c ++++ ntfs-3g-2014.2.15-1-fuseint/libfuse-lite/mount_util.c +@@ -255,6 +255,10 @@ int fuse_mnt_check_fuseblk(void) + + #else /* __SOLARIS__ */ + ++#ifndef _PATH_MOUNTED ++#define _PATH_MOUNTED "/proc/mounts" ++#endif /* _PATH_MOUNTED */ ++ + static int mtab_needs_update(const char *mnt) + { + int res; diff --git a/utils/oath-toolkit/Makefile b/utils/oath-toolkit/Makefile new file mode 100644 index 0000000..014c9df --- /dev/null +++ b/utils/oath-toolkit/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2016 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:=oath-toolkit +PKG_VERSION:=2.6.2 +PKG_RELEASE:=1 +PKG_SOURCE:=oath-toolkit-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SAVANNAH/oath-toolkit +PKG_SOURCE_MD5SUM:=4a05cd4768764843bd5493609a6bdb17 +PKG_LICENSE:=LGPL-2.0+ GPL-3.0+ +PKG_LICENSE_FILES:=COPYING +PKG_INSTALL:=1 +PKG_MAINTAINER:=Fam Zheng + +include $(INCLUDE_DIR)/package.mk + +CONFIGURE_ARGS += \ + --disable-xmltest \ + --disable-pskc + +define Package/oath-toolkit + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Toolkit for building one-time password authentication + URL:=http://www.nongnu.org/oath-toolkit/index.html + DEPENDS:= +endef + +define Package/oath-toolkit/description + The OATH Toolkit provide components for building one-time password + authentication systems. It contains shared libraries, command line + tools and a PAM module. Supported technologies include the event-based + HOTP algorithm (RFC4226) and the time-based TOTP algorithm (RFC6238). +endef + +define Package/oath-toolkit/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/oathtool $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/liboath.so* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,oath-toolkit)) diff --git a/utils/open-plc-utils/Makefile b/utils/open-plc-utils/Makefile new file mode 100644 index 0000000..0cb49db --- /dev/null +++ b/utils/open-plc-utils/Makefile @@ -0,0 +1,108 @@ +# +# Copyright (C) 2013-2015 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:=open-plc-utils +PKG_VERSION:=2015-09-21 +PKG_RELEASE:=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/qca/open-plc-utils.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=885a1b7e2e663b5ab8797db6d40a0318131fdf18 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_MAINTAINER:=Florian Fainelli + +PKG_LICENSE:=ISC +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/open-plc-utils/Default + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Qualcomm Atheros Power Line Communication utilities + URL:=https://github.com/qca/open-plc-utils/blob/master/README +endef + +define Package/open-plc-utils + $(call Package/open-plc-utils/Default) + MENU:=1 +endef + +define GenPlugin + define Package/$(addprefix open-plc-utils-,$(1)) + $(call Package/open-plc-utils/Default) + DEPENDS:=open-plc-utils + TITLE:=Utility $(2) from the Open PLC utilities + endef + + define Package/$(addprefix open-plc-utils-,$(1))/description + Utility $(2) from the Open PLC utilities package. + endef +endef + +OPEN_PLC_UTILS_APPS:=efbu efeu efru efsu edru edsu nics \ + hpavkey hpavkeys rkey mac2pw mac2pwd \ + mdioblock mdioblock2 mdiodump mdiogen \ + hpav mme \ + chknvm chknvm2 nvmsplit nvmmerge \ + chkpib chkpib2 setpib getpib modpib pib2xml \ + pibcomp pibdump pibruin xml2pib psin psout pskey \ + psgraph psnotch pibrump \ + int6k int6kboot int6keth int6kf int6khost \ + int64host int6kid int6klist int6klog int6kmdio \ + int6kmdio2 int6kmod int6kstat int6ktest int6krate \ + int6krule int6ktone int6kwait CMEncrypt sada \ + coqos_add coqos_info coqos_man coqos_mod coqos_rel \ + mdustats ampboot amphost ampID amplist amprate \ + ampstat amptest amptool amptone ampwait \ + plcboot plchost plcID plclist plcrate plcrule \ + plcstat plctest plctool plctone \ + plcwait plchostd plcget plcset plcotst plcfwd \ + plcdevs plclog plcmdio16 plcmdio32 \ + config2cfg sdram \ + int6kuart int6kbaud ttysig ptsctl weeder ttysend \ + ttyrecv ttycat int6kdetect + +$(foreach a,$(OPEN_PLC_UTILS_APPS),$(eval $(call GenPlugin,$(a)))) + +ifdef CONFIG_USE_MUSL + TARGET_CFLAGS += -D__UCLIBC__ +endif + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + EXTRA_CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \ + LDFLAGS="$(TARGET_CFLAGS) $(TARGET_LDFLAGS)" \ + CROSS="$(TARGET_CROSS)" \ + ROOTFS="$(PKG_INSTALL_DIR)" \ + OWNER="$(shell id -u $(shell whoami))" \ + GROUP="$(shell id -g $(shell whoami))" \ + all install +endef + +define Package/open-plc-utils/install + true +endef + +define BuildPlugin + define Package/$(1)/install + $(INSTALL_DIR) $$(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/bin/$(subst open-plc-utils-,,$(1)) \ + $$(1)/usr/bin/ + endef + + $$(eval $$(call BuildPackage,$(1))) +endef + +$(eval $(call BuildPackage,open-plc-utils)) +$(foreach a,$(OPEN_PLC_UTILS_APPS),$(eval $(call BuildPlugin,open-plc-utils-$(a)))) diff --git a/utils/open-plc-utils/patches/100-musl-compat.patch b/utils/open-plc-utils/patches/100-musl-compat.patch new file mode 100644 index 0000000..c20c0a1 --- /dev/null +++ b/utils/open-plc-utils/patches/100-musl-compat.patch @@ -0,0 +1,33 @@ +--- a/ether/readpacket.c ++++ b/ether/readpacket.c +@@ -70,6 +70,10 @@ + #include + #include + ++#if defined (__linux__) ++#include ++#endif ++ + #include "../ether/channel.h" + #include "../tools/memory.h" + #include "../tools/error.h" +@@ -95,8 +99,6 @@ ssize_t readpacket (struct channel const + + #elif defined (__linux__) + +-#include +- + struct pollfd pollfd = + { + channel->fd, +--- a/serial/serial.c ++++ b/serial/serial.c +@@ -69,6 +69,8 @@ + + #if defined (WIN32) + #include ++#else ++#include + #endif + + /*====================================================================* diff --git a/utils/open2300/Makefile b/utils/open2300/Makefile new file mode 100644 index 0000000..2354610 --- /dev/null +++ b/utils/open2300/Makefile @@ -0,0 +1,67 @@ +# +# Copyright (C) 2010 segal.ubi.pt +# Copyright (C) 2014 nunojpg@gmail.com +# Copyright (C) 2015 dev@localnet.hu +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=open2300 +PKG_VERSION:=1.12 +PKG_RELEASE:=5 +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=COPYING + +PKG_SOURCE_PROTO:=svn +PKG_SOURCE_URL:=http://www.lavrsen.dk/svn/open2300/trunk +PKG_SOURCE_VERSION:=r12 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_CHECK_FORMAT_SECURITY:=0 + +PKG_MAINTAINER:=Gabor SZOLLOSI + +include $(INCLUDE_DIR)/package.mk + +define Package/open2300 + SECTION:=utils + CATEGORY:=Utilities + TITLE:=WS23XX weather station utilities + URL:=http://www.lavrsen.dk/foswiki/bin/view/Open2300 +endef + +define Package/open2300/description + This is an utility suite used to communicate with and collect data from a WS23XX wheather station. +endef + +MAKE_FLAGS += \ + CFLAGS="$(TARGET_CFLAGS) -DVERSION=\"$(PKG_VERSION)\"" + +define Package/open2300/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin2300 $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/cw2300 $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/dump2300 $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/fetch2300 $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/histlog2300 $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/history2300 $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/interval2300 $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/light2300 $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/log2300 $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/minmax2300 $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/open2300 $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/wu2300 $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/xml2300 $(1)/usr/bin/ + + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) ./files/open2300.conf $(1)/etc/ + + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib2300.so.1.11 $(1)/usr/lib/ + ln -sf /usr/lib/lib2300.so.1.11 $(1)/usr/lib/lib2300.so +endef + +$(eval $(call BuildPackage,open2300)) diff --git a/utils/open2300/files/open2300.conf b/utils/open2300/files/open2300.conf new file mode 100644 index 0000000..6414b49 --- /dev/null +++ b/utils/open2300/files/open2300.conf @@ -0,0 +1,65 @@ +# open2300.conf +# +# Configuration files for open2300 weather station tools +# +# Default locations in which the programs will search for this file: +# Programs search in this sequence: +# 1. Path to config file including filename given as parameter (not supported by all tools) +# 2. ./open2300.conf (current working directory) +# 3. /jffs/etc/open2300.conf (typical DD-WRT location) +# 4. /etc/open2300.conf (typical Linux location) +# +# All names are case sensitive!!! + + +# Set to your serial port and time zone +# For Windows use COM1, COM2, COM2 etc +# For Linux use /dev/ttyS0, /dev/ttyS1 etc + +SERIAL_DEVICE /dev/tts/1 # /dev/ttyS0, /dev/ttyS1, COM1, COM2 etc +TIMEZONE 1 # Hours Relative to UTC. East is positive, west is negative + + +# Units of measure (set them to your preference) +# The units of measure are ignored by wu2300 and cw2300 because both requires specific units + +WIND_SPEED m/s # select MPH (miles/hour), m/s, or km/h +TEMPERATURE C # Select C or F +RAIN mm # Select mm or IN +PRESSURE hPa # Select hPa, mb or INHG + + +#### Citizens Weather variables (used only by cw2300) +# Format for latitude is +# [2 digit degrees][2 digit minutes].[2 decimals minutes - NOT seconds][N for north or S for south] +# Format for longitude is +# [3 digit degrees][2 digit minutes].[2 decimals minutes - NOT seconds][E for east or W for west] +# Use leading zeros to get the format ####.##N (lat) and #####.##E (long) + +CITIZEN_WEATHER_ID CW0000 # CW0000 should be replaced by HAM call or actual CW number +CITIZEN_WEATHER_LATITUDE 5540.12N # DDMM.mmN or S - example 55 deg, 40.23 minutes north +CITIZEN_WEATHER_LONGITUDE 01224.60E # DDDMM.mmE or W - example 12 deg, 24.60 minutes east + +APRS_SERVER rotate.aprs.net 14580 # These are the APRS servers and ports for +APRS_SERVER first.aprs.net 14580 # Citizens Weather reporting. +APRS_SERVER second.aprs.net 14580 # They they are tried in the entered order +APRS_SERVER third.aprs.net 14580 # you may enter up to 5 alternate servers + + +#### WEATHER UNDERGROUND variables (used only by wu2300) + +WEATHER_UNDERGROUND_ID WUID # ID received from Weather Underground +WEATHER_UNDERGROUND_PASSWORD WUPASSWORD # Password for Weather Underground + + +### MYSQL Settings (only used by mysql2300) + +#MYSQL_HOST localhost # Localhost or IP address/host name +#MYSQL_USERNAME open2300 # Name of the MySQL user that has access to the database +#MYSQL_PASSWORD mysql2300 # Password for the MySQL user +#MYSQL_DATABASE open2300 # Named of your database +#MYSQL_PORT 0 # TCP/IP Port number. Zero means default + +#PGSQL_CONNECT hostaddr='127.0.0.1'dbname='open2300'user='postgres'password='sql' # Connection string +#PGSQL_TABLE weather # Table name +#PGSQL_STATION open2300 # Unique station id diff --git a/utils/open2300/patches/001-crosscompile.patch b/utils/open2300/patches/001-crosscompile.patch new file mode 100644 index 0000000..0953047 --- /dev/null +++ b/utils/open2300/patches/001-crosscompile.patch @@ -0,0 +1,139 @@ +--- a/Makefile ++++ b/Makefile +@@ -15,87 +15,82 @@ + prefix = /usr/local + exec_prefix = ${prefix} + bindir = ${exec_prefix}/bin ++libdir = ${prefix}/lib + + ######################################### + + CC = gcc +-OBJ = open2300.o rw2300.o linux2300.o win2300.o +-LOGOBJ = log2300.o rw2300.o linux2300.o win2300.o +-FETCHOBJ = fetch2300.o rw2300.o linux2300.o win2300.o +-WUOBJ = wu2300.o rw2300.o linux2300.o win2300.o +-CWOBJ = cw2300.o rw2300.o linux2300.o win2300.o +-DUMPOBJ = dump2300.o rw2300.o linux2300.o win2300.o +-HISTOBJ = history2300.o rw2300.o linux2300.o win2300.o +-HISTLOGOBJ = histlog2300.o rw2300.o linux2300.o win2300.o +-DUMPBINOBJ = bin2300.o rw2300.o linux2300.o win2300.o +-XMLOBJ = xml2300.o rw2300.o linux2300.o win2300.o +-PGSQLOBJ = pgsql2300.o rw2300.o linux2300.o win2300.o +-LIGHTOBJ = light2300.o rw2300.o linux2300.o win2300.o +-INTERVALOBJ = interval2300.o rw2300.o linux2300.o win2300.o +-MINMAXOBJ = minmax2300.o rw2300.o linux2300.o win2300.o +-MYSQLHISTLOGOBJ = mysqlhistlog2300.o rw2300.o linux2300.o win2300.o ++LIB = lib2300 ++LIB_C = rw2300.c linux2300.c ++LIBOBJ = rw2300.o linux2300.o + + VERSION = 1.11 + + CFLAGS = -Wall -O3 -DVERSION=\"$(VERSION)\" +-CC_LDFLAGS = -lm +-CC_WINFLAG = +-# For Windows - comment the two line above and un-comment the two lines below. +-#CC_LDFLAGS = -lm -lwsock32 +-#CC_WINFLAG = -mwindows ++CC_LDFLAGS = -L. -lm -l2300 ++LFLAGS = -shared -Wl,-soname + INSTALL = install ++MAKE_EXEC = $(CC) $(CFLAGS) $@.c -o $@ $(CC_LDFLAGS) + + ####### Build rules + +-all: open2300 dump2300 log2300 fetch2300 wu2300 cw2300 history2300 histlog2300 bin2300 xml2300 light2300 interval2300 minmax2300 mysql2300 mysqlhistlog2300 ++all: open2300 dump2300 log2300 fetch2300 wu2300 cw2300 history2300 histlog2300 bin2300 xml2300 light2300 interval2300 minmax2300 #mysql2300 mysqlhistlog2300 + +-open2300 : $(OBJ) +- $(CC) $(CFLAGS) -o $@ $(OBJ) $(CC_LDFLAGS) +- +-dump2300 : $(DUMPOBJ) +- $(CC) $(CFLAGS) -o $@ $(DUMPOBJ) $(CC_LDFLAGS) ++lib2300 : ++ $(CC) -c -fPIC $(CFLAGS) $(LIB_C) ++ $(CC) $(LFLAGS),$@.so -o $@.so.$(VERSION) $(LIBOBJ) ++ ln -sf $@.so.$(VERSION) $@.so ++ ++open2300 : $(LIB) ++ $(MAKE_EXEC) + +-log2300 : $(LOGOBJ) +- $(CC) $(CFLAGS) -o $@ $(LOGOBJ) $(CC_LDFLAGS) $(CC_WINFLAG) ++dump2300 : $(LIB) ++ $(MAKE_EXEC) + +-fetch2300 : $(FETCHOBJ) +- $(CC) $(CFLAGS) -o $@ $(FETCHOBJ) $(CC_LDFLAGS) ++log2300 : $(LIB) ++ $(MAKE_EXEC) + +-wu2300 : $(WUOBJ) +- $(CC) $(CFLAGS) -o $@ $(WUOBJ) $(CC_LDFLAGS) $(CC_WINFLAG) ++fetch2300 : $(LIB) ++ $(MAKE_EXEC) ++ ++srv2300 : $(LIB) ++ $(MAKE_EXEC) ++ ++wu2300 : $(LIB) ++ $(MAKE_EXEC) + +-cw2300 : $(CWOBJ) +- $(CC) $(CFLAGS) -o $@ $(CWOBJ) $(CC_LDFLAGS) $(CC_WINFLAG) ++cw2300 : $(LIB) ++ $(MAKE_EXEC) + +-history2300 : $(HISTOBJ) +- $(CC) $(CFLAGS) -o $@ $(HISTOBJ) $(CC_LDFLAGS) ++history2300 : $(LIB) ++ $(MAKE_EXEC) + +-histlog2300 : $(HISTLOGOBJ) +- $(CC) $(CFLAGS) -o $@ $(HISTLOGOBJ) $(CC_LDFLAGS) $(CC_WINFLAG) ++histlog2300 : $(LIB) ++ $(MAKE_EXEC) + +-bin2300 : $(DUMPBINOBJ) +- $(CC) $(CFLAGS) -o $@ $(DUMPBINOBJ) $(CC_LDFLAGS) ++bin2300 : $(LIB) ++ $(MAKE_EXEC) + +-xml2300 : $(XMLOBJ) +- $(CC) $(CFLAGS) -o $@ $(XMLOBJ) $(CC_LDFLAGS) $(CC_WINFLAG) ++xml2300 : $(LIB) ++ $(MAKE_EXEC) + +-mysql2300: +- $(CC) $(CFLAGS) -o mysql2300 mysql2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient ++mysql2300: $(LIB) ++ $(CC) $(CFLAGS) $@.c -o $@ -I/usr/include/mysql -L/usr/lib/mysql $(CC_LDFLAGS) -lmysqlclient + +-pgsql2300: $(PGSQLOBJ) +- $(CC) $(CFLAGS) -o $@ $(PGSQLOBJ) $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/pgsql -L/usr/lib/pgsql -lpq ++pgsql2300: $(LIB) ++ $(CC) $(CFLAGS) $@.c -o $@ -I/usr/include/pgsql -L/usr/lib/pgsql $(CC_LDFLAGS) -lpq + +-light2300: $(LIGHTOBJ) +- $(CC) $(CFLAGS) -o $@ $(LIGHTOBJ) $(CC_LDFLAGS) ++light2300: $(LIB) ++ $(MAKE_EXEC) + +-interval2300: $(INTERVALOBJ) +- $(CC) $(CFLAGS) -o $@ $(INTERVALOBJ) $(CC_LDFLAGS) ++interval2300: $(LIB) ++ $(MAKE_EXEC) + +-minmax2300: $(MINMAXOBJ) +- $(CC) $(CFLAGS) -o $@ $(MINMAXOBJ) $(CC_LDFLAGS) $(CC_WINFLAG) ++minmax2300: $(LIB) ++ $(MAKE_EXEC) + +-mysqlhistlog2300 : +- $(CC) $(CFLAGS) -o mysqlhistlog2300 mysqlhistlog2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient ++mysqlhistlog2300 : $(LIB) ++ $(CC) $(CFLAGS) $@.c -o $@ -I/usr/include/mysql -L/usr/lib/mysql $(CC_LDFLAGS) -lmysqlclient + + + install: diff --git a/utils/openobex/Makefile b/utils/openobex/Makefile new file mode 100644 index 0000000..f03b96d --- /dev/null +++ b/utils/openobex/Makefile @@ -0,0 +1,89 @@ +# +# Copyright (C) 2015 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:=openobex +PKG_VERSION:=1.7.1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-Source +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-Source.tar.gz +PKG_SOURCE_URL:=@SF/openobex +PKG_MD5SUM:=3181bfed9cb7db591605391068cb0085 + +PKG_LICENSE:=GPL-2.0+ LGPL-2.1+ +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Nicolas Thill + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/openobex/Default + TITLE:=Open Source impl of the OBject EXchange protocol + URL:=https://www.gitorious.org/openobex +endef + +define Package/openobex +$(call Package/openobex/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE+= (meta) + DEPENDS:=+openobex-apps +libopenobex +endef + +define Package/openobex-apps +$(call Package/openobex/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE+= (apps) + DEPENDS:=+libopenobex +bluez-libs +endef + +define Package/libopenobex +$(call Package/openobex/Default) + SECTION:=libs + CATEGORY:=Libraries + TITLE+= (library) + DEPENDS:=+libusb-1.0 +endef + +CMAKE_OPTIONS += \ + -DBUILD_DOCUMENTATION:BOOL=OFF \ + +MAKE_FLAGS += \ + openobex openobex-apps \ + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/openobex $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopenobex.so* $(1)/usr/lib/ + $(CP) $(PKG_BUILD_DIR)/apps/lib/libopenobex-apps-common.a $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/openobex.pc $(1)/usr/lib/pkgconfig/ +endef + +define Package/openobex/install + : +endef + +define Package/openobex-apps/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/ +endef + +define Package/libopenobex/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopenobex.so.* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,openobex)) +$(eval $(call BuildPackage,openobex-apps)) +$(eval $(call BuildPackage,libopenobex)) diff --git a/utils/openobex/patches/001-cxx.patch b/utils/openobex/patches/001-cxx.patch new file mode 100644 index 0000000..650458f --- /dev/null +++ b/utils/openobex/patches/001-cxx.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,6 @@ + cmake_minimum_required ( VERSION 2.8.5 FATAL_ERROR ) + +-project ( openobex C ) ++project ( openobex C CXX ) + + # + # The project version diff --git a/utils/openocd/Makefile b/utils/openocd/Makefile new file mode 100644 index 0000000..e18e1aa --- /dev/null +++ b/utils/openocd/Makefile @@ -0,0 +1,79 @@ +# +# Copyright (C) 2015 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:=openocd +PKG_VERSION:=v0.9.0 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://git.code.sf.net/p/openocd/code +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_MAINTAINER:=Paul Fertser + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/openocd + SECTION:=utils + CATEGORY:=Utilities + TITLE:=OpenOCD Utility + URL:=http://openocd.sf.net/ + DEPENDS:=+libusb-1.0 +libusb-compat +libftdi1 +hidapi +endef + +define Package/openocd/description +OpenOCD provides on-chip programming and debugging support with a +layered architecture of JTAG interface and TAP support including: + +- (X)SVF playback to facilitate automated boundary scan and FPGA/CPLD + programming; +- debug target support (e.g. ARM, MIPS): single-stepping, + breakpoints/watchpoints, gprof profiling, etc; +- flash chip drivers (e.g. CFI, NAND, internal flash); +- embedded TCL interpreter for easy scripting. + +Several network interfaces are available for interacting with OpenOCD: +telnet, TCL, and GDB. The GDB server enables OpenOCD to function as a +"remote target" for source-level debugging of embedded systems using +the GNU GDB program (and the others who talk GDB protocol, e.g. IDA +Pro). +endef + +CONFIGURE_ARGS += \ + --prefix="/usr" \ + --disable-werror \ + MAKEINFO=true \ + --enable-dummy \ + --enable-sysfsgpio \ + --enable-usb_blaster_libftdi \ + --enable-openjtag_ftdi \ + --enable-presto_libftdi + +define Build/Compile + +$(MAKE_VARS) \ + $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) +endef + +define Package/openocd/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_DIR) $(1)/usr/share/openocd + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/openocd $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/share/openocd/scripts $(1)/usr/share/openocd +endef + +$(eval $(call BuildPackage,openocd)) diff --git a/utils/opensc/Makefile b/utils/opensc/Makefile new file mode 100644 index 0000000..4687ac8 --- /dev/null +++ b/utils/opensc/Makefile @@ -0,0 +1,224 @@ +# +# 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:=opensc +PKG_VERSION:=0.16.0 +PKG_RELEASE:=1 +PKG_MD5SUM:=3ac8c29542bb48179e7086d35a1b8907a4e86aca3de3323c2f48bd74eaaf5729 + +PKG_LICENSE:=LGPL-2.1+ +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Daniel Golle +PKG_SOURCE_URL:=https://github.com/OpenSC/OpenSC/releases/download/$(PKG_VERSION)/ +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz + +PKG_BUILD_DEPENDS:=+libpcsclite +PKG_FIXUP:=libtool + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/libopensc + SECTION:=libs + CATEGORY:=Libraries + TITLE:=OpenSC libraries for smart cards + URL:=https://github.com/OpenSC/OpenSC/wiki + DEPENDS:=+libopenssl +libpthread +zlib + MENU:=1 +endef + +define Package/libopensc/description + OpenSC provides a set of libraries and utilities to work with smart cards. + Its main focus is on cards that support cryptographic operations, and + facilitate their use in security applications such as authentication, + mail encryption and digital signatures. +endef + +define Package/libopensc-pkcs11 + SECTION:=libs + CATEGORY:=Libraries + TITLE:=OpenSC - PKCS11 provider + URL:=https://github.com/OpenSC/OpenSC/wiki + DEPENDS:=libopensc +endef + +define Package/libopensc-pkcs11/description + OpenSC PKCS#11 provider +endef + +define Package/libpkcs11-spy + SECTION:=libs + CATEGORY:=Libraries + TITLE:=PKCS11 spying wrapper + URL:=https://github.com/OpenSC/OpenSC/wiki + DEPENDS:=+libopenssl +libpthread +endef + +define Package/libpkcs11-spy/dscription + PKCS#11 spying wrapper +endef + +define Package/opensc-utils + SECTION:=utils + CATEGORY:=Utilities + TITLE:=OpenSC - tools for smart cards + URL:=https://github.com/OpenSC/OpenSC/wiki + DEPENDS:=+libopensc + MENU:=1 +endef + +define Package/opensc-utils/description + OpenSC utilities +endef + +define ToolGen +define Package/opensc-utils-$(subst _,-,$(firstword $(subst :, ,$(1)))) + TITLE:=$(firstword $(subst :, ,$(1))) utility from opensc + URL:=https://github.com/OpenSC/OpenSC/wiki + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=opensc-utils $(wordlist 2,$(words $(subst :, ,$(1))),$(subst :, ,$(1))) +endef +endef + +define ProfileGen +define Package/libopensc-profile-$(subst _,-,$(firstword $(subst :, ,$(1)))) + TITLE:=$(firstword $(subst :, ,$(1))) card profile for opensc + URL:=https://github.com/OpenSC/OpenSC/wiki + SECTION:=lib + CATEGORY:=Libraries + DEPENDS:=libopensc +endef +endef + +TOOLS:= \ + cardos-tool \ + cryptoflex-tool \ + dnie-tool \ + eidenv \ + iasecc-tool \ + netkey-tool \ + openpgp-tool \ + opensc-tool \ + opensc-explorer:+libncurses:+libreadline \ + piv-tool \ + pkcs11-tool \ + pkcs15-crypt \ + pkcs15-init \ + pkcs15-tool \ + sc-hsm-tool \ + westcos-tool + +PROFILES:= \ + asepcos \ + authentic \ + cardos \ + cyberflex \ + entersafe \ + epass2003 \ + flex \ + gpk \ + ias_adele_admin1 \ + ias_adele_admin2 \ + ias_adele_common \ + iasecc_admin_eid \ + iasecc_generic_oberthur \ + iasecc_generic_pki \ + iasecc \ + incrypto34 \ + jcop \ + miocos \ + muscle \ + myeid \ + oberthur \ + openpgp \ + pkcs15 \ + rutoken_ecp \ + rutoken \ + sc-hsm \ + setcos \ + starcos \ + westcos + +$(foreach file,$(TOOLS),$(eval $(call ToolGen,$(file)))) +$(foreach file,$(PROFILES),$(eval $(call ProfileGen,$(file)))) + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopensc.{a,so}* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsmm-local.{a,so}* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/opensc-pkcs11.so $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkcs11-spy.so $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkcs11 + $(LN) ../pkcs11-spy.so $(1)/usr/lib/pkcs11/ + $(LN) ../opensc-pkcs11.so $(1)/usr/lib/pkcs11/ + $(INSTALL_DIR) $(1)/usr/share/opensc + $(CP) $(PKG_INSTALL_DIR)/usr/share/opensc/* $(1)/usr/share/opensc/ +endef + +define Package/libopensc/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopensc.so* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsmm-local.so* $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/etc + $(CP) $(PKG_INSTALL_DIR)/etc/opensc.conf $(1)/etc/ +endef + +define Package/libopensc-pkcs11/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/opensc-pkcs11.so $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkcs11 + $(LN) ../opensc-pkcs11.so $(1)/usr/lib/pkcs11/ +endef + +define Package/libpkcs11-spy/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkcs11-spy.so $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkcs11 + $(LN) ../pkcs11-spy.so $(1)/usr/lib/pkcs11/ +endef + +define Package/opensc-card-profiles + $(INSTALL_DIR) $(1)/usr/share/opensc + $(CP) $(PKG_INSTALL_DIR)/usr/share/opensc/* $(1)/usr/share/opensc/ +endef + +define Package/opensc-utils/install + true +endef + +define ToolInstall +define Package/opensc-utils-$(subst _,-,$(firstword $(subst :, ,$(1))))/install + $(INSTALL_DIR) $$(1)/usr/bin + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/$(firstword $(subst :, ,$(1))) \ + $$(1)/usr/bin/ +endef +endef + +define ProfileInstall +define Package/libopensc-profile-$(subst _,-,$(firstword $(subst :, ,$(1))))/install + $(INSTALL_DIR) $$(1)/usr/share/opensc + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/share/opensc/$(firstword $(subst :, ,$(1))).profile \ + $$(1)/usr/share/opensc +endef +endef + +$(foreach file,$(TOOLS),$(eval $(call ToolInstall,$(file)))) +$(foreach file,$(PROFILES),$(eval $(call ProfileInstall,$(file)))) + +$(eval $(call BuildPackage,libopensc)) +$(eval $(call BuildPackage,libopensc-pkcs11)) +$(eval $(call BuildPackage,libpkcs11-spy)) + +$(eval $(call BuildPackage,opensc-utils)) +$(foreach file,$(TOOLS),$(eval $(call BuildPackage,opensc-utils-$(subst _,-,$(firstword $(subst :, ,$(file))))))) +$(foreach file,$(PROFILES),$(eval $(call BuildPackage,libopensc-profile-$(subst _,-,$(firstword $(subst :, ,$(file))))))) diff --git a/utils/opus-tools/Makefile b/utils/opus-tools/Makefile new file mode 100644 index 0000000..e53b843 --- /dev/null +++ b/utils/opus-tools/Makefile @@ -0,0 +1,47 @@ +# +# 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:=opus-tools +PKG_VERSION:=0.1.9 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://downloads.xiph.org/releases/opus/ +PKG_MD5SUM:=20682e4d8d1ae9ec5af3cf43e808b8cb + +PKG_LICENSE:=BSD-2-Clause +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Nicolas Thill + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/opus-tools + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libogg +libopus + TITLE:=OPUS Codec tools + URL:=http://opus-codec.org/ +endef + +define Package/opus-tools/description + This package provides command-line utilities to encode, inspect, and decode + .opus files. +endef + +CONFIGURE_ARGS += \ + --without-flac \ + +define Package/opus-tools/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/opus{dec,enc,info} $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,opus-tools)) diff --git a/utils/owfs/Config.in b/utils/owfs/Config.in new file mode 100644 index 0000000..a6508e8 --- /dev/null +++ b/utils/owfs/Config.in @@ -0,0 +1,49 @@ + menu "Customize libow" + depends on PACKAGE_libow + + menu "Bus master and adapter support" + config LIBOW_MASTER_USB + bool "USB bus master support (requires libusb)" + help + Include support for USB adapters (NOT usb-serial adapters, which use + kernel driver and are supported anyway). + Turning this off will save ~13kB (and ~50kB weighting libusb dependency). + default y + + config LIBOW_MASTER_I2C + bool "I2C bus master (DS2482) support" + default y + help + Include support for I2C adapters. + Turning this feature off will save ~6kB. + + config LIBOW_MASTER_W1 + bool "Kernel W1 bus master support (requires kmod-w1)" + help + Support kernel 1-Wire bus masters (requires KConfig CONFIG_CONNECTOR=y + and CONFIG_W1_CON=y). + Turning this on will increase libow size by about 10kB. + default n + endmenu + + config LIBOW_ZEROCONF + bool "Zeroconf/bonjour support" + default y + help + Enable server process announcement using Zeroconf (Bonjour) protocol. + Turning this feature on will increase owlib size by about 12kB. + + config LIBOW_DEBUG + bool "Enable debug output (100+ kB)" + default y + help + If you don't need to debug your 1-wire network, you can save as much as + 137kB disabling debug output. + + config LIBOW_OWTRAFFIC + bool "Enable bus traffic reports" + default n + help + Enable owfs traffic monitor. It's here purely for debugging purposes. + Turning this on will increase libow size by about 3kB. + endmenu diff --git a/utils/owfs/Makefile b/utils/owfs/Makefile new file mode 100644 index 0000000..e0ac78f --- /dev/null +++ b/utils/owfs/Makefile @@ -0,0 +1,300 @@ +# +# 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:=owfs +PKG_VERSION:=2.9p5 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/$(PKG_NAME) +PKG_MD5SUM:=b5c20998e8ffc6fa3974daef99c02402 +PKG_MAINTAINER:=Jo-Philipp Wich +PKG_LICENSE:=GPL-2.0 + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +PKG_CONFIG_DEPENDS:= \ + CONFIG_LIBOW_MASTER_USB \ + CONFIG_LIBOW_MASTER_I2C \ + CONFIG_LIBOW_MASTER_W1 \ + CONFIG_LIBOW_ZEROCONF \ + CONFIG_LIBOW_DEBUG \ + CONFIG_LIBOW_OWTRAFFIC + +include $(INCLUDE_DIR)/package.mk + +# +# templates +# + +define Package/$(PKG_NAME)/Default + TITLE:=OWFS (1-Wire File System) + URL:=http://owfs.sourceforge.net/ + SECTION:=net + CATEGORY:=Network + SUBMENU:=Filesystem +endef + +define Package/$(PKG_NAME)/Default/description + OWFS is a suite of programs that designed to make the 1-wire bus and its + devices easily accessible. The underlying principle is to create a virtual + filesystem, with the unique ID being the directory, and the individual + properties of the device are represented as simple files that can be read + and written. + + Details of the individual slave or master design are hidden behind a + consistent interface. The goal is to provide an easy set of tools for a + software designer to create monitoring or control applications. There are + some performance enhancements in the implementation, including data caching, + parallel access to bus masters, and aggregation of device communication. + Still the fundemental goal has been ease of use, flexibility and correctness + rather than speed. +endef + +define Package/owfs/Server + $(call Package/owfs/Default) + DEPENDS:=+libow +libpthread +endef + +define Package/owfs/Library + $(call Package/owfs/Default) + SECTION:=libs + CATEGORY:=Libraries +endef + +define Package/owfs/Utility + $(call Package/owfs/Default) + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libow +endef + +# +# shared libraries +# + +define Package/libow + $(call Package/owfs/Library) + DEPENDS:= \ + +libpthread \ + +LIBOW_MASTER_USB:libusb-compat \ + +LIBOW_MASTER_W1:kmod-w1 + TITLE:=OWFS - common shared library +endef + +define Package/libow/config + source "$(SOURCE)/Config.in" +endef + +define Package/libow/description + $(call Package/$(PKG_NAME)/Default/description) + + This package contains the OWFS library. +endef + +define Package/libow-capi + $(call Package/owfs/Library) + DEPENDS:=+libow + TITLE:=OWFS - C-API library +endef + +define Package/libow-capi/description + $(call Package/$(PKG_NAME)/Default/description) + + This package contains the OWFS C-API library. +endef + +# +# utilities +# + +define Package/owshell + $(call Package/owfs/Utility) + TITLE:=OWFS - shell utilities + DEPENDS+= +USE_UCLIBC:librpc +endef + +define Package/owshell/description + $(call Package/$(PKG_NAME)/Default/description) + + This package contains the OWFS shell utilities. +endef + +define Package/owfs + $(call Package/owfs/Utility) + # libfuse depends on kmod-fuse, no need to declare dependency + DEPENDS+= +libfuse +fuse-utils + TITLE:=OWFS - fuse file system +endef + +define Package/owfs/description + $(call Package/$(PKG_NAME)/Default/description) + + This package contains the OWFS fuse filesystem. +endef + +# +# network daemons +# + +define Package/owhttpd + $(call Package/owfs/Server) + TITLE:=OWFS - http server +endef + +define Package/owhttpd/description + $(call Package/$(PKG_NAME)/Default/description) + + This package contains the OWFS http server. +endef + +define Package/owftpd + $(call Package/owfs/Server) + TITLE:=OWFS - ftp server +endef + +define Package/owftpd/description + $(call Package/$(PKG_NAME)/Default/description) + + This package contains the OWFS ftp server. +endef + +define Package/owserver + $(call Package/owfs/Server) + TITLE:=OWFS - network server +endef + +define Package/owserver/description + $(call Package/$(PKG_NAME)/Default/description) + + This package contains the OWFS network server. +endef + +CONFIGURE_ARGS += \ + --enable-owftpd \ + --enable-owserver \ + --enable-owhttpd \ + --enable-owfs \ + --with-fuseinclude="$(STAGING_DIR)/usr/include" \ + --with-fuselib="$(STAGING_DIR)/usr/lib" \ + --enable-shared \ + --disable-parport \ + --disable-ownet \ + --disable-owpython \ + --disable-owphp \ + --disable-owtcl \ + --disable-swig \ + $(if $(CONFIG_LIBOW_MASTER_USB),--enable-usb,--disable-usb) \ + $(if $(CONFIG_LIBOW_MASTER_W1),--enable-w1,--disable-w1) \ + $(if $(CONFIG_LIBOW_MASTER_I2C),--enable-i2c,--disable-i2c) \ + $(if $(CONFIG_LIBOW_ZEROCONF),--enable-zero,--disable-zero) \ + $(if $(CONFIG_LIBOW_DEBUG),--enable-debug,--disable-debug) \ + $(if $(CONFIG_LIBOW_OWTRAFFIC),--enable-owtraffic,--disable-owtraffic) + +CONFIGURE_VARS += \ + LDFLAGS="$(TARGET_LDFLAGS) -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -Wl,-rpath-link=$(TOOLCHAIN_DIR)/usr/lib" \ + lt_cv_sys_lib_dlsearch_path_spec="$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib" \ + lt_cv_sys_lib_search_path_spec="$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib" \ + shrext_cmds=".so" \ + +MAKE_FLAGS += \ + CC="$(TARGET_CC)" \ + HOST_CPU="$(PKGARCH)" + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/ow{capi,fs_config}.h $(STAGING_DIR)/usr/include/ + $(INSTALL_DIR) $(STAGING_DIR)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libow{,capi}*.so* $(STAGING_DIR)/usr/lib/ +endef + +define Package/owfs/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/owfs $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/owfs.conf $(1)/etc/config/owfs + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/owfs.init $(1)/etc/init.d/owfs + mkdir -p $(1)/mnt/owfs +endef + +define Package/owfs/conffiles +/etc/config/owfs +endef + +define Package/owshell/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/owget $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/owread $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/owwrite $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/owdir $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/owpresent $(1)/usr/bin/ +endef + + +define Package/owserver/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/owserver $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/owserver.conf $(1)/etc/config/owserver + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/owserver.init $(1)/etc/init.d/owserver +endef + +define Package/owserver/conffiles +/etc/config/owserver +endef + +define Package/owhttpd/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/owhttpd $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/owhttpd.conf $(1)/etc/config/owhttpd + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/owhttpd.init $(1)/etc/init.d/owhttpd +endef + +define Package/owhttpd/conffiles +/etc/config/owhttpd +endef + +define Package/owftpd/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/owftpd $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/owftpd.conf $(1)/etc/config/owftpd + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/owftpd.init $(1)/etc/init.d/owftpd +endef + +define Package/owftpd/conffiles +/etc/config/owftpd +endef + +define Package/libow/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libow-*.so.* $(1)/usr/lib/ +endef + +define Package/libow-capi/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libowcapi-*.so.* $(1)/usr/lib/ +endef + + +$(eval $(call BuildPackage,owfs)) +$(eval $(call BuildPackage,owshell)) + +$(eval $(call BuildPackage,owserver)) +$(eval $(call BuildPackage,owhttpd)) +$(eval $(call BuildPackage,owftpd)) + +$(eval $(call BuildPackage,libow)) +$(eval $(call BuildPackage,libow-capi)) diff --git a/utils/owfs/files/owfs.conf b/utils/owfs/files/owfs.conf new file mode 100644 index 0000000..b485989 --- /dev/null +++ b/utils/owfs/files/owfs.conf @@ -0,0 +1,10 @@ +config owfs 'owfs' + option enabled 0 + option user root + option readonly 0 + option mountpoint '/mnt/owfs' + option fuse_allow_other 0 + option fuse_open_opt '' + option error_level 0 + list devices '-s' + list devices 'localhost:4304' diff --git a/utils/owfs/files/owfs.init b/utils/owfs/files/owfs.init new file mode 100644 index 0000000..83c8913 --- /dev/null +++ b/utils/owfs/files/owfs.init @@ -0,0 +1,82 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2009-2015 OpenWrt.org + +START=95 +USE_PROCD=1 + +PROG=/usr/bin/owfs + +append_arg() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}" +} + +append_bool() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get_bool val "$cfg" "$var" "$def" + [ "$val" = 1 ] && procd_append_param command "$opt" +} + +append_plain() { + procd_append_param command "$1" +} + +append_param() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param "$opt" "${val:-$def}" +} + +start_instance() { + local cfg="$1" + local enabled + + config_get_bool enabled "$cfg" 'enabled' '0' + [ "$enabled" = 0 ] && return 1 + + procd_open_instance + + procd_set_param command "$PROG" --foreground --error_print=1 + + # common parameters + append_bool "$cfg" readonly "--readonly" + append_arg "$cfg" error_level "--error_level" + config_list_foreach "$cfg" options append_plain + config_list_foreach "$cfg" devices append_plain + append_param "$cfg" user user + + # owfs-specific + append_arg "$cfg" mountpoint "--mountpoint" /mnt/owfs + append_bool "$cfg" fuse_allow_other "--allow_other" + append_arg "$cfg" fuse_open_opt "--fuse_open_opt" + + # don't respawn fuse + + procd_close_instance + +} + +service_triggers() { + procd_add_reload_trigger owfs +} + +start_service() { + config_load owfs + config_foreach start_instance owfs +} diff --git a/utils/owfs/files/owftpd.conf b/utils/owfs/files/owftpd.conf new file mode 100644 index 0000000..100162e --- /dev/null +++ b/utils/owfs/files/owftpd.conf @@ -0,0 +1,8 @@ +config owftpd 'owftpd' + option enabled 0 + option user root + option readonly 0 + option port 21 + option error_level 0 + list devices '-s' + list devices 'localhost:4304' diff --git a/utils/owfs/files/owftpd.init b/utils/owfs/files/owftpd.init new file mode 100644 index 0000000..a7e17c9 --- /dev/null +++ b/utils/owfs/files/owftpd.init @@ -0,0 +1,81 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2009-2015 OpenWrt.org + +START=95 +USE_PROCD=1 + +PROG=/usr/bin/owftpd + +append_arg() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}" +} + +append_bool() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get_bool val "$cfg" "$var" "$def" + [ "$val" = 1 ] && procd_append_param command "$opt" +} + +append_plain() { + procd_append_param command "$1" +} + +append_param() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param "$opt" "${val:-$def}" +} + +start_instance() { + local cfg="$1" + local enabled + + config_get_bool enabled "$cfg" 'enabled' '0' + [ "$enabled" = 0 ] && return 1 + + procd_open_instance + + procd_set_param command "$PROG" --foreground --error_print=1 + + # common parameters + append_bool "$cfg" readonly "--readonly" + append_arg "$cfg" error_level "--error_level" + config_list_foreach "$cfg" options append_plain + config_list_foreach "$cfg" devices append_plain + append_param "$cfg" user user + + # owftpd-specific + append_arg "$cfg" port "--port" + append_arg "$cfg" max_connections "--max_connections" + + procd_set_param respawn + + procd_close_instance + +} + +service_triggers() { + procd_add_reload_trigger owftpd +} + +start_service() { + config_load owftpd + config_foreach start_instance owftpd +} diff --git a/utils/owfs/files/owhttpd.conf b/utils/owfs/files/owhttpd.conf new file mode 100644 index 0000000..a314cd1 --- /dev/null +++ b/utils/owfs/files/owhttpd.conf @@ -0,0 +1,8 @@ +config owhttpd 'owhttpd' + option enabled 0 + option user root + option readonly 0 + option port 3001 + option error_level 0 + list devices '-s' + list devices 'localhost:4304' diff --git a/utils/owfs/files/owhttpd.init b/utils/owfs/files/owhttpd.init new file mode 100644 index 0000000..868c9b4 --- /dev/null +++ b/utils/owfs/files/owhttpd.init @@ -0,0 +1,81 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2009-2015 OpenWrt.org + +START=95 +USE_PROCD=1 + +PROG=/usr/bin/owhttpd + +append_arg() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}" +} + +append_bool() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get_bool val "$cfg" "$var" "$def" + [ "$val" = 1 ] && procd_append_param command "$opt" +} + +append_plain() { + procd_append_param command "$1" +} + +append_param() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param "$opt" "${val:-$def}" +} + +start_instance() { + local cfg="$1" + local enabled + + config_get_bool enabled "$cfg" 'enabled' '0' + [ "$enabled" = 0 ] && return 1 + + procd_open_instance + + procd_set_param command "$PROG" --foreground --error_print=1 + + # common parameters + append_bool "$cfg" readonly "--readonly" + append_arg "$cfg" error_level "--error_level" + config_list_foreach "$cfg" options append_plain + config_list_foreach "$cfg" devices append_plain + append_param "$cfg" user user + + # owhttpd-specific + append_arg "$cfg" port "--port" + append_arg "$cfg" max_connections "--max_connections" + + procd_set_param respawn + + procd_close_instance + +} + +service_triggers() { + procd_add_reload_trigger owhttpd +} + +start_service() { + config_load owhttpd + config_foreach start_instance owhttpd +} diff --git a/utils/owfs/files/owserver.conf b/utils/owfs/files/owserver.conf new file mode 100644 index 0000000..ceb8a61 --- /dev/null +++ b/utils/owfs/files/owserver.conf @@ -0,0 +1,8 @@ +config owserver 'owserver' + option enabled 0 + option user root + option readonly 0 + option port 4304 + option error_level 0 + list devices '-d' + list devices '/dev/ttyUSB0' diff --git a/utils/owfs/files/owserver.init b/utils/owfs/files/owserver.init new file mode 100644 index 0000000..7f91aee --- /dev/null +++ b/utils/owfs/files/owserver.init @@ -0,0 +1,81 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2009-2015 OpenWrt.org + +START=90 +USE_PROCD=1 + +PROG=/usr/bin/owserver + +append_arg() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}" +} + +append_bool() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get_bool val "$cfg" "$var" "$def" + [ "$val" = 1 ] && procd_append_param command "$opt" +} + +append_plain() { + procd_append_param command "$1" +} + +append_param() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param "$opt" "${val:-$def}" +} + +start_instance() { + local cfg="$1" + local enabled + + config_get_bool enabled "$cfg" 'enabled' '0' + [ "$enabled" = 0 ] && return 1 + + procd_open_instance + + procd_set_param command "$PROG" --foreground --error_print=1 + + # common parameters + append_bool "$cfg" readonly "--readonly" + append_arg "$cfg" error_level "--error_level" + config_list_foreach "$cfg" options append_plain + config_list_foreach "$cfg" devices append_plain + append_param "$cfg" user user + + # owserver-specific + append_arg "$cfg" port "--port" + append_arg "$cfg" max_connections "--max_connections" + + procd_set_param respawn + + procd_close_instance + +} + +service_triggers() { + procd_add_reload_trigger owserver +} + +start_service() { + config_load owserver + config_foreach start_instance owserver +} diff --git a/utils/owfs/patches/100-fix-netlink-w1-status-message-detection.patch b/utils/owfs/patches/100-fix-netlink-w1-status-message-detection.patch new file mode 100644 index 0000000..251065f --- /dev/null +++ b/utils/owfs/patches/100-fix-netlink-w1-status-message-detection.patch @@ -0,0 +1,30 @@ +AaAA +--- a/module/owlib/src/c/ow_w1_parse.c ++++ b/module/owlib/src/c/ow_w1_parse.c +@@ -237,7 +237,7 @@ enum Netlink_Read_Status W1_Process_Resp + owfree(nlp.nlm) ; + return nrs_nodev ; + } +- if ( nrs_callback == NULL ) { // status message ++ if ( nrs_callback == NULL ) { // bus reset + owfree(nlp.nlm) ; + return nrs_complete ; + } +@@ -246,7 +246,7 @@ enum Netlink_Read_Status W1_Process_Resp + nrs_callback( &nlp, v, pn ) ; + LEVEL_DEBUG("Called nrs_callback"); + owfree(nlp.nlm) ; +- if ( nlp.cn->ack != 0 ) { ++ if ( nlp.cn->seq != nlp.cn->ack ) { + if ( nlp.w1m->type == W1_LIST_MASTERS ) { + continue ; // look for more data + } +@@ -254,7 +254,7 @@ enum Netlink_Read_Status W1_Process_Resp + continue ; // look for more data + } + } +- nrs_callback = NULL ; // now look for status message ++ return nrs_complete ; // status message + } + return nrs_timeout ; + } diff --git a/utils/owfs/patches/101-fix-no-reset-routine-segfault.patch b/utils/owfs/patches/101-fix-no-reset-routine-segfault.patch new file mode 100644 index 0000000..731c4a0 --- /dev/null +++ b/utils/owfs/patches/101-fix-no-reset-routine-segfault.patch @@ -0,0 +1,13 @@ +--- a/module/owlib/src/c/ow_reset.c ++++ b/module/owlib/src/c/ow_reset.c +@@ -21,6 +21,10 @@ RESET_TYPE BUS_reset(const struct parsed + struct connection_in * in = pn->selected_connection ; + STAT_ADD1_BUS(e_bus_resets, in); + ++ if ( in->iroutines.reset == NO_RESET_ROUTINE ) { ++ return BUS_RESET_OK; ++ } ++ + switch ( (in->iroutines.reset) (pn) ) { + case BUS_RESET_OK: + in->reconnect_state = reconnect_ok; // Flag as good! diff --git a/utils/pciutils/Makefile b/utils/pciutils/Makefile new file mode 100644 index 0000000..3f61b44 --- /dev/null +++ b/utils/pciutils/Makefile @@ -0,0 +1,73 @@ +# +# Copyright (C) 2007-2016 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:=pciutils +PKG_VERSION:=3.5.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@KERNEL/software/utils/pciutils +PKG_MD5SUM:=3a99141a9f40528d0a0035665a06dc37ddb1ae341658e51b50a76ecf86235efc +PKG_MAINTAINER:=Álvaro Fernández Rojas + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_USE_MIPS16:=0 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/pciutils + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Linux PCI Utilities + URL:=http://mj.ucw.cz/pciutils.shtml + DEPENDS:=+libkmod +zlib +endef + +define Package/pciutils/description + contains collection of programs for inspecting and manipulating configuration + of PCI devices +endef + +define Package/pciutils/postinst +#!/bin/sh +[ -z "$${IPKG_INSTROOT}" ] || \ +(cd $${PKG_ROOT}/usr/share; $${PKG_ROOT}/usr/sbin/update-pciids; rm pci.ids.gz.old) +exit 0 +endef + +MAKE_FLAGS += \ + CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \ + PREFIX="/usr" \ + HOST="$(GNU_TARGET_NAME)" \ + HWDB="no" \ + ZLIB="yes" + +ifneq ($(CONFIG_USE_GLIBC),) +TARGET_LDFLAGS += -lresolv +endif + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/lib/libpci.a $(1)/usr/lib + $(INSTALL_DIR) $(1)/usr/include/pci + $(CP) $(foreach i,pci.h config.h header.h types.h, \ + $(PKG_BUILD_DIR)/lib/$(i)) $(1)/usr/include/pci +endef + +define Package/pciutils/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{lspci,setpci,update-pciids} $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/usr/share + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/pci.ids.gz $(1)/usr/share/ +endef + +$(eval $(call BuildPackage,pciutils)) diff --git a/utils/pciutils/patches/100-remove-no-timestamping.patch b/utils/pciutils/patches/100-remove-no-timestamping.patch new file mode 100644 index 0000000..93bc85f --- /dev/null +++ b/utils/pciutils/patches/100-remove-no-timestamping.patch @@ -0,0 +1,11 @@ +--- a/update-pciids.sh ++++ b/update-pciids.sh +@@ -33,7 +33,7 @@ if which curl >/dev/null 2>&1 ; then + DL="curl -o $DEST.new $SRC" + ${quiet} && DL="$DL -s -S" + elif which wget >/dev/null 2>&1 ; then +- DL="wget --no-timestamping -O $DEST.new $SRC" ++ DL="wget -O $DEST.new $SRC" + ${quiet} && DL="$DL -q" + elif which lynx >/dev/null 2>&1 ; then + DL="eval lynx -source $SRC >$DEST.new" diff --git a/utils/pciutils/patches/101-no-strip.patch b/utils/pciutils/patches/101-no-strip.patch new file mode 100644 index 0000000..610a755 --- /dev/null +++ b/utils/pciutils/patches/101-no-strip.patch @@ -0,0 +1,11 @@ +--- a/Makefile ++++ b/Makefile +@@ -111,7 +111,7 @@ distclean: clean + install: all + # -c is ignored on Linux, but required on FreeBSD + $(DIRINSTALL) -m 755 $(DESTDIR)$(SBINDIR) $(DESTDIR)$(IDSDIR) $(DESTDIR)$(MANDIR)/man8 $(DESTDIR)$(MANDIR)/man7 +- $(INSTALL) -c -m 755 $(STRIP) lspci setpci $(DESTDIR)$(SBINDIR) ++ $(INSTALL) -c -m 755 lspci setpci $(DESTDIR)$(SBINDIR) + $(INSTALL) -c -m 755 update-pciids $(DESTDIR)$(SBINDIR) + $(INSTALL) -c -m 644 $(PCI_IDS) $(DESTDIR)$(IDSDIR) + $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(DESTDIR)$(MANDIR)/man8 diff --git a/utils/pciutils/patches/102-compressed-ids.patch b/utils/pciutils/patches/102-compressed-ids.patch new file mode 100644 index 0000000..9b31938 --- /dev/null +++ b/utils/pciutils/patches/102-compressed-ids.patch @@ -0,0 +1,31 @@ +--- a/update-pciids.sh ++++ b/update-pciids.sh +@@ -6,9 +6,8 @@ set -e + SRC="http://pci-ids.ucw.cz/v2.2/pci.ids" + DEST=pci.ids + PCI_COMPRESSED_IDS= +-GREP=grep + +-# if pci.ids is read-only (because the filesystem is read-only), ++# if pci.ids.gz is read-only (because the filesystem is read-only), + # then just skip this whole process. + if ! touch ${DEST} >/dev/null 2>&1 ; then + ${quiet} || echo "${DEST} is read-only, exiting." 1>&2 +@@ -18,7 +17,7 @@ fi + if [ "$PCI_COMPRESSED_IDS" = 1 ] ; then + DECOMP="cat" + SRC="$SRC.gz" +- GREP=zgrep ++ DEST="$DEST.gz" + elif which bzip2 >/dev/null 2>&1 ; then + DECOMP="bzip2 -d" + SRC="$SRC.bz2" +@@ -53,7 +52,7 @@ if ! $DECOMP <$DEST.new >$DEST.neww ; th + exit 1 + fi + +-if ! $GREP >/dev/null "^C " $DEST.neww ; then ++if ! zcat $DEST.neww | grep >/dev/null "^C " ; then + echo >&2 "update-pciids: missing class info, probably truncated file" + exit 1 + fi diff --git a/utils/pciutils/patches/103-relative-path-ids.patch b/utils/pciutils/patches/103-relative-path-ids.patch new file mode 100644 index 0000000..c6d6906 --- /dev/null +++ b/utils/pciutils/patches/103-relative-path-ids.patch @@ -0,0 +1,11 @@ +--- a/Makefile ++++ b/Makefile +@@ -88,7 +88,7 @@ lspci: LDLIBS+=$(LIBKMOD_LIBS) + ls-kernel.o: CFLAGS+=$(LIBKMOD_CFLAGS) + + update-pciids: update-pciids.sh +- sed <$< >$@ "s@^DEST=.*@DEST=$(IDSDIR)/$(PCI_IDS)@;s@^PCI_COMPRESSED_IDS=.*@PCI_COMPRESSED_IDS=$(PCI_COMPRESSED_IDS)@" ++ sed <$< >$@ "s@^PCI_COMPRESSED_IDS=.*@PCI_COMPRESSED_IDS=$(PCI_COMPRESSED_IDS)@" + chmod +x $@ + + # The example of use of libpci diff --git a/utils/pciutils/patches/104-resolv.patch b/utils/pciutils/patches/104-resolv.patch new file mode 100644 index 0000000..c38d1cf --- /dev/null +++ b/utils/pciutils/patches/104-resolv.patch @@ -0,0 +1,11 @@ +--- a/lib/configure ++++ b/lib/configure +@@ -57,7 +57,7 @@ echo >>$c "#define PCI_OS_`echo $sys | t + echo >$m 'WITH_LIBS=' + + echo_n "Looking for access methods..." +-LIBRESOLV=-lresolv ++LIBRESOLV= + LIBEXT=so + + case $sys in diff --git a/utils/pciutils/patches/105-fix-host.patch b/utils/pciutils/patches/105-fix-host.patch new file mode 100644 index 0000000..8df4b8c --- /dev/null +++ b/utils/pciutils/patches/105-fix-host.patch @@ -0,0 +1,11 @@ +--- a/lib/configure ++++ b/lib/configure +@@ -44,7 +44,7 @@ if [ -z "$HOST" ] ; then + fi + [ -n "$RELEASE" ] && rel="${RELEASE}" + # CAVEAT: tr on Solaris is a bit weird and the extra [] is otherwise harmless. +-host=`echo $HOST | sed -e 's/^\([^-]*\)-\([^-]*\)-\([^-]*\)-\([^-]*\)$/\1-\3/' -e 's/^\([^-]*\)-\([^-]*\)-\([^-]*\)$/\1-\2/' -e 's/^\([^-]*\)-\([^-]*\)$/\1--\2/' | tr '[A-Z]' '[a-z]'` ++host=`echo $HOST | sed -e 's/^\([^-]*\)-\([^-]*\)-\([^-]*\)-\([^-]*\)$/\1-\3/' -e 's/^\([^-]*\)-\([^-]*\)$/\1--\2/' | tr '[A-Z]' '[a-z]'` + cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` + sys=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + echo " $host $rel $cpu $sys" diff --git a/utils/pcsc-lite/Makefile b/utils/pcsc-lite/Makefile new file mode 100644 index 0000000..e8d6d9d --- /dev/null +++ b/utils/pcsc-lite/Makefile @@ -0,0 +1,101 @@ +# +# Copyright (C) 2009-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:=pcsc-lite +PKG_VERSION:=1.8.18 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=https://alioth.debian.org/frs/download.php/file/4179 +PKG_MD5SUM:=b22d32b018f6a1016adba91abfcc63876cca999daa472dd86e953ddd41d00905 +PKG_MAINTAINER:=Daniel Golle +PKG_LICENSE:=BSD-3-Clause +PKG_LICENSE_FILES:=COPYING + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/pcsc-lite/Default + TITLE:=Middleware to access a smart card using SCard API (PC/SC). + URL:=http://pcsclite.alioth.debian.org/ +endef + +define Package/pcsc-lite/Default/description + The purpose of PC/SC Lite is to provide a Windows(R) SCard + interface in a very small form factor for communicating to + smart cards and smart cards readers. +endef + +define Package/libpcsclite + $(call Package/pcsc-lite/Default) + SECTION:=libs + CATEGORY:=Libraries + TITLE+= (library) + DEPENDS:=+libusb-1.0 +libpthread +librt +endef + +define Package/libpcsclite/description + $(call Package/pcsc-lite/Default/description) + . + This package contains the PC/SC shared library. +endef + +define Package/pcscd + $(call Package/pcsc-lite/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE+= (daemon) + DEPENDS:=+libpcsclite +endef + +define Package/pcscd/description + $(call Package/pcsc-lite/Default/description) + . + This package contains the PC/SC daemon. +endef + +TARGET_CFLAGS += $(FPIC) +TARGET_LDFLAGS += -lpthread + +CONFIGURE_ARGS += \ + --disable-libudev \ + --enable-libusb \ + --enable-static \ + --enable-usbdropdir=/usr/lib/pcsc/drivers + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include/PCSC + $(CP) $(PKG_INSTALL_DIR)/usr/include/PCSC/* $(1)/usr/include/PCSC/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcsclite.{a,so*} $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpcsclite.pc $(1)/usr/lib/pkgconfig/ +endef + +define Package/libpcsclite/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcsclite.so.* $(1)/usr/lib/ +endef + +define Package/pcscd/conffiles +/etc/reader.conf.d/reader.conf +endef + +define Package/pcscd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pcscd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/pcscd.init $(1)/etc/init.d/pcscd + $(INSTALL_DIR) $(1)/etc/reader.conf.d +endef + +$(eval $(call BuildPackage,libpcsclite)) +$(eval $(call BuildPackage,pcscd)) diff --git a/utils/pcsc-lite/files/pcscd.init b/utils/pcsc-lite/files/pcscd.init new file mode 100644 index 0000000..497a740 --- /dev/null +++ b/utils/pcsc-lite/files/pcscd.init @@ -0,0 +1,15 @@ +#!/bin/sh /etc/rc.common + +START=50 + +USE_PROCD=1 + +start_service() { + procd_open_instance + procd_set_param command /usr/sbin/pcscd --foreground + procd_close_instance +} + +reload_service() { + /usr/sbin/pcscd --hotplug +} diff --git a/utils/picocom/Makefile b/utils/picocom/Makefile new file mode 100644 index 0000000..31a1ad6 --- /dev/null +++ b/utils/picocom/Makefile @@ -0,0 +1,46 @@ +# +# Copyright (C) 2006-2015 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:=picocom +PKG_VERSION:=1.7 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://picocom.googlecode.com/files +PKG_MD5SUM:=8eaba1d31407e8408674d6e57af447ef + +PKG_MAINTAINER:=Steven Barth +PKG_LICENSE:=GPL-2.0+ + +include $(INCLUDE_DIR)/package.mk + +define Package/picocom + SECTION:=utils + CATEGORY:=Utilities + TITLE:=A minimal dumb-terminal emulation program + URL:=http://code.google.com/p/picocom/ + SUBMENU:=Terminal +endef + +define Package/picocom/description + minimal dumb-terminal emulation program +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" LDFLAGS="$(TARGET_LDFLAGS)" \ + picocom +endef + +define Package/picocom/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/picocom $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,picocom)) diff --git a/utils/picocom/patches/100-musl-compat.patch b/utils/picocom/patches/100-musl-compat.patch new file mode 100644 index 0000000..5f7d750 --- /dev/null +++ b/utils/picocom/patches/100-musl-compat.patch @@ -0,0 +1,17 @@ +Index: picocom-1.7/term.c +=================================================================== +--- picocom-1.7.orig/term.c ++++ picocom-1.7/term.c +@@ -33,10 +33,11 @@ + #include + #include + #include +-#ifdef __linux__ ++#if defined(__linux__) && (defined(__GLIBC__) || defined(__UCLIBC__)) + #include + #else + #include ++#include + #endif /* of __linux__ */ + + #include "term.h" diff --git a/utils/pps-tools/Makefile b/utils/pps-tools/Makefile new file mode 100644 index 0000000..578004d --- /dev/null +++ b/utils/pps-tools/Makefile @@ -0,0 +1,49 @@ +# +# 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:=pps-tools +PKG_VERSION:=2014-08-01 +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://github.com/ago/pps-tools +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=0deb9c7e135e9380a6d09e9d2e938a146bb698c8 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 + +PKG_MAINTAINER:=Zoltan HERPAI +PKG_LICENSE:=GPL-2.0 + +include $(INCLUDE_DIR)/package.mk + +define Package/pps-tools + SECTION:=utils + CATEGORY:=Utilities + TITLE:=PPS-tools +endef + +define Package/pps-tools/description + Userland tools for GPS and DCF-77 Clock synchronization. PPS support in Kernel must be enabled. +endef + +TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/timepps.h $(1)/usr/include/ +endef + +define Package/pps-tools/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ppsctl $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ppstest $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ppswatch $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,pps-tools)) diff --git a/utils/procps-ng/Makefile b/utils/procps-ng/Makefile new file mode 100644 index 0000000..7a33d22 --- /dev/null +++ b/utils/procps-ng/Makefile @@ -0,0 +1,99 @@ +# +# Copyright (C) 2006-2015 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:=procps-ng +PKG_VERSION:=3.3.11 +PKG_RELEASE:=3 +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING COPYING.LIB + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://gitlab.com/procps-ng/procps.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=8a198e3eafbde0b627e9992b41d26e6762e4f8c7 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 +PKG_FIXUP:=autoreconf +PKG_BUILD_DEPENDS:=gettext libiconv + +include $(INCLUDE_DIR)/package.mk + +CONFIGURE_ARGS += --enable-skill + +PROCPS_APPLETS := \ + free kill pgrep pkill pmap ps pwdx skill slabtop \ + snice tload top uptime vmstat w watch + +define Package/procps-ng/Default + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libncurses + TITLE:=procps-ng utilities + URL:=https://gitlab.com/procps-ng/procps + MAINTAINER:=Gergely Kiss +endef + +define Build/Prepare + $(call Build/Prepare/Default) + echo "$(PKG_VERSION)" > "$(PKG_BUILD_DIR)/.tarball-version" +endef + +define Package/procps-ng + $(call Package/procps-ng/Default) + MENU:=1 +endef + +define Package/procps-ng/description + procps is a set of command line and full-screen utilities that provide information out of the pseudo-filesystem + most commonly located at /proc. This filesystem provides a simple interface to the kernel data structures. + The programs of procps generally concentrate on the structures that describe the processess running on the system. + + NOTE: some utilities provided by procps-ng packages (ps, uptime, kill, ...) are installed as busybox applets, by default. + Conflicting applets should be removed from the build to avoid file conflicts. +endef + +define GenPlugin + define Package/$(1) + $(call Package/procps-ng/Default) + DEPENDS:=procps-ng + TITLE:=Applet $(2) from the procps-ng package + DEFAULT:=y + endef + + define Package/$(1)/description + Installs the applet $(2). + endef +endef + +$(foreach a,$(PROCPS_APPLETS),$(eval $(call GenPlugin,procps-ng-$(a),$(a)))) + +MAKE_FLAGS += \ + CFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="$(TARGET_CPPFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + +define Package/procps-ng/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libprocps.so* $(1)/usr/lib/ +endef + +define BuildPlugin + define Package/$(1)/install + $(INSTALL_DIR) $$(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $$(1)/usr/bin/ + endef + + $$(eval $$(call BuildPackage,$(1))) +endef + +$(foreach a,$(PROCPS_APPLETS),$(eval $(call BuildPlugin,procps-ng-$(a),$(a)))) +$(eval $(call BuildPackage,procps-ng)) diff --git a/utils/procps-ng/patches/100-no-tests-docs.patch b/utils/procps-ng/patches/100-no-tests-docs.patch new file mode 100644 index 0000000..50ef7fb --- /dev/null +++ b/utils/procps-ng/patches/100-no-tests-docs.patch @@ -0,0 +1,26 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -13,10 +13,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ + + ACLOCAL_AMFLAGS = -I m4 + SUBDIRS = \ +- include \ +- man-po \ +- po \ +- testsuite ++ include + + AM_CFLAGS = -Iproc + LDADD = ./proc/libprocps.la $(CYGWINFLAGS) +--- a/configure.ac ++++ b/configure.ac +@@ -256,8 +256,5 @@ AC_CHECK_FUNCS([__fpending alarm atexit + + AC_CONFIG_FILES([Makefile + include/Makefile +- man-po/Makefile +- po/Makefile.in +- proc/libprocps.pc +- testsuite/Makefile]) ++ proc/libprocps.pc]) + AC_OUTPUT diff --git a/utils/pv/Makefile b/utils/pv/Makefile new file mode 100644 index 0000000..b28bcfe --- /dev/null +++ b/utils/pv/Makefile @@ -0,0 +1,46 @@ +# +# Copyright (C) 2008 David Cooper +# 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:=pv +PKG_VERSION:=1.5.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://www.ivarch.com/programs/sources/ +PKG_MD5SUM:=efe8e9e4cad5f3264a32258a63bf2c8e +PKG_LICENSE:=Artistic-2.0 +PKG_MAINTAINER:=Jo-Philipp Wich + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/pv + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Shell pipeline element to meter data passing through + URL:=http://www.ivarch.com/programs/pv.shtml +endef + +define Package/pv/description + Pipe Viewer is a terminal-based tool for monitoring the progress of data + through a pipeline. It can be inserted into any normal pipeline between + two processes to give a visual indication of how quickly data is passing + through, how long it has taken, how near to completion it is, and an + estimate of how long it will be until completion. +endef + +define Package/pv/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pv $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,pv)) + diff --git a/utils/qemu/Makefile b/utils/qemu/Makefile new file mode 100644 index 0000000..5990f38 --- /dev/null +++ b/utils/qemu/Makefile @@ -0,0 +1,253 @@ +# +# Copyright (C) 2016 OpenWrt.org +# Copyright (C) 2016 Yousong Zhou +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=qemu +PKG_VERSION:=2.6.2 +PKG_RELEASE:=2 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://wiki.qemu-project.org/download/ +PKG_SOURCE_MD5SUM:=bdf1f3d0c177ebeb35a079a4bc3fc74e +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=LICENSE tcg/LICENSE +PKG_MAINTAINER:=Yousong Zhou + +PKG_INSTALL:=1 +PKG_USE_MIPS16:=0 + +include $(INCLUDE_DIR)/uclibc++.mk +include $(INCLUDE_DIR)/package.mk + + +define Package/virtio-console-helper + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Helper script for vportNpn virtio-console devices +endef + +define Package/virtio-console-helper/install + $(INSTALL_DIR) $(1)/etc/hotplug.d/virtio-ports + $(INSTALL_BIN) ./files/00-virtio-ports.hotplug $(1)/etc/hotplug.d/virtio-ports/00-virtio-ports +endef + + +define Package/qemu-ga + SECTION:=utils + CATEGORY:=Utilities + TITLE:=QEMU Guest Agent + URL:=http://www.qemu.org + DEPENDS:= +glib2 +virtio-console-helper $(CXX_DEPENDS) +endef + +define Package/qemu-ga/description + This package contains the QEMU Guest Agent daemon +endef + +define Package/qemu-ga/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/qemu-ga $(1)/usr/bin + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/qemu-ga.init $(1)/etc/init.d/qemu-ga + $(INSTALL_DIR) $(1)/etc/hotplug.d/virtio-ports + $(INSTALL_BIN) ./files/10-qemu-ga.hotplug $(1)/etc/hotplug.d/virtio-ports/10-qemu-ga +endef + + +define Package/qemu-blobs + SECTION:=utils + CATEGORY:=Utilities + TITLE:=QEMU blobs of BIOS, VGA BIOS and keymaps + URL:=http://www.qemu.org + DEPENDS:= +endef + +define Package/qemu-blobs/install + $(INSTALL_DIR) $(1)/usr/share/qemu + $(CP) $(PKG_INSTALL_DIR)/usr/share/qemu/* $(1)/usr/share/qemu +endef + +define Package/qemu-bridge-helper + SECTION:=utils + CATEGORY:=Utilities + TITLE:=QEMU bridge helper + URL:=http://www.qemu.org + DEPENDS:=+glib2 $(CXX_DEPENDS) +endef + +define Package/qemu-bridge-helper/install + $(INSTALL_DIR) $(1)/usr/lib/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/qemu-bridge-helper $(1)/usr/lib + $(INSTALL_DIR) $(1)/etc/qemu + $(INSTALL_DATA) ./files/bridge.conf $(1)/etc/qemu +endef + +PKG_CONFIG_DEPENDS += CONFIG_PACKAGE_qemu-ga + +# Naming rules used in qemu Makefile.target +define qemu-prog_ + $(if $(filter %-softmmu,$(1)), \ + $(patsubst %-softmmu,qemu-system-%,$(1)), \ + $(error unknown qemu target $(1)) \ + ) +endef +qemu-prog = $(strip $(call qemu-prog_,$(1))) + +# Why libfdt was enabled for all softmmu targets: according to qemu's +# configure script, libfdt is only strictly required for the following targets +# and is optional for others. But libfdt support will be built into other +# targets when any single target enabled it. +# +# aarch64%-softmmu arm%-softmmu ppc%-softmmu microblaze%-softmmu +# +define qemu-target + PKG_CONFIG_DEPENDS += CONFIG_PACKAGE_qemu-$(1) + + define Package/qemu-$(1) + SECTION:=utils + CATEGORY:=Utilities + TITLE:=QEMU target $(1) + URL:=http://www.qemu.org + DEPENDS:= +glib2 +libpthread +zlib $(CXX_DEPENDS) \ + $(if $(filter %-softmmu,$(1)),+libncurses +libfdt +qemu-blobs) \ + @(TARGET_x86_64||TARGET_sunxi) + endef + + define Package/qemu-$(1)/description + This package contains the QEMU target $(1) + endef + + define Package/qemu-$(1)/install + $(INSTALL_DIR) $$(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(call qemu-prog,$(1)) $$(1)/usr/bin + endef + +endef + +QEMU_TARGET_LIST := \ + x86_64-softmmu \ + arm-softmmu \ + +$(foreach target,$(QEMU_TARGET_LIST), \ + $(eval $(call qemu-target,$(target))) \ +) + +# QEMU configure script does not recognize these options +CONFIGURE_ARGS:=$(filter-out \ + --target=% \ + --host=% \ + --build=% \ + --program-prefix=% \ + --program-suffix=% \ + --exec-prefix=% \ + --disable-nls \ + , $(CONFIGURE_ARGS)) + +# Tell build system of qemu to not add _FORTIFY_SOURCE options and let the base +# build system decide flavor of fortify_source to use +CONFIGURE_ARGS += \ + --cross-prefix=$(TARGET_CROSS) \ + --host-cc="$(HOSTCC)" \ + --disable-fortify-source \ + --disable-stack-protector \ + +CONFIGURE_ARGS += \ + --audio-drv-list='' \ + --disable-debug-info \ + --disable-modules \ + --disable-sdl \ + --disable-qom-cast-debug \ + --disable-virtfs \ + --disable-vnc \ + --disable-debug-tcg \ + --disable-sparse \ + --disable-strip \ + --disable-vnc-sasl \ + --disable-vnc-jpeg \ + --disable-vnc-png \ + --disable-uuid \ + --disable-vde \ + --disable-netmap \ + --disable-xen \ + --disable-xen-pci-passthrough \ + --disable-xen-pv-domain-build \ + --disable-brlapi \ + --disable-bluez \ + --disable-tcg-interpreter \ + --disable-cap-ng \ + --disable-spice \ + --disable-libiscsi \ + --disable-libnfs \ + --disable-cocoa \ + --disable-bsd-user \ + --disable-curl \ + --disable-linux-aio \ + --disable-attr \ + --disable-docs \ + --disable-opengl \ + --disable-rbd \ + --disable-xfsctl \ + --disable-smartcard \ + --disable-libusb \ + --disable-usb-redir \ + --disable-zlib-test \ + --disable-lzo \ + --disable-snappy \ + --disable-bzip2 \ + --disable-guest-agent-msi \ + --disable-tools \ + --disable-seccomp \ + --disable-glusterfs \ + --disable-archipelago \ + --disable-gtk \ + --disable-gnutls \ + --disable-nettle \ + --disable-gcrypt \ + --disable-rdma \ + --disable-vte \ + --disable-virglrenderer \ + --disable-tpm \ + --disable-libssh2 \ + --disable-vhdx \ + --disable-numa \ + --disable-tcmalloc \ + --disable-jemalloc \ + --disable-strip \ + --disable-werror \ + +QEMU_CONFIGURE_TARGET_LIST := $(foreach target,$(QEMU_TARGET_LIST),$(if $(CONFIG_PACKAGE_qemu-$(target)),$(target))) +CONFIGURE_ARGS += --target-list='$(QEMU_CONFIGURE_TARGET_LIST)' + +ifneq ($(CONFIG_PACKAGE_qemu-ga),) +CONFIGURE_ARGS += --enable-guest-agent +endif + +TARGET_LDFLAGS += -Wl,--as-needed +MAKE_VARS += V=s +# ARCH is special in qemu's build system, e.g. ARCH mips64 will be translated +# there to mips and stored in config-host.mak +MAKE_FLAGS:=$(filter-out \ + ARCH=% \ + ,$(MAKE_FLAGS)) + +QEMU_MAKE_TARGETS := \ + $(if $(CONFIG_PACKAGE_qemu-ga),qemu-ga) \ + $(if $(CONFIG_PACKAGE_qemu-bridge-helper),qemu-bridge-helper) \ + $(foreach target,$(QEMU_TARGET_LIST),$(if $(CONFIG_PACKAGE_qemu-$(target)),subdir-$(target))) \ + +define Build/Compile + $(if $(strip $(QEMU_MAKE_TARGETS)),$(call Build/Compile/Default,$(QEMU_MAKE_TARGETS))) +endef + +$(eval $(call BuildPackage,virtio-console-helper)) +$(eval $(call BuildPackage,qemu-ga)) +$(eval $(call BuildPackage,qemu-bridge-helper)) +$(eval $(call BuildPackage,qemu-blobs)) +$(foreach target,$(QEMU_TARGET_LIST), \ + $(eval $(call BuildPackage,qemu-$(target))) \ +) diff --git a/utils/qemu/files/00-virtio-ports.hotplug b/utils/qemu/files/00-virtio-ports.hotplug new file mode 100755 index 0000000..1edea39 --- /dev/null +++ b/utils/qemu/files/00-virtio-ports.hotplug @@ -0,0 +1,19 @@ +#!/bin/sh +# Copyright (C) 2016 OpenWrt.org +# Copyright (C) 2016 Yousong Zhou + +[ "$SUBSYSTEM" = "virtio-ports" ] || exit 0 + +syspath="/sys/$DEVPATH" +name="$(cat "$syspath/name" 2>/dev/null)" +[ -n "$name" ] || exit 0 + +case "$ACTION" in + "add") + mkdir -p /dev/virtio-ports + ln -s "/dev/$DEVNAME" "/dev/virtio-ports/$name" + ;; + "del") + rm -f "/dev/virtio-ports/$name" + ;; +esac diff --git a/utils/qemu/files/10-qemu-ga.hotplug b/utils/qemu/files/10-qemu-ga.hotplug new file mode 100755 index 0000000..56256ca --- /dev/null +++ b/utils/qemu/files/10-qemu-ga.hotplug @@ -0,0 +1,15 @@ +#!/bin/sh +# Copyright (C) 2016 OpenWrt.org +# Copyright (C) 2016 Yousong Zhou + +[ "$SUBSYSTEM" = "virtio-ports" ] || exit 0 + +syspath="/sys/$DEVPATH" +name="$(cat "$syspath/name" 2>/dev/null)" +[ -n "$name" ] || exit 0 + +case "$ACTION" in + "add") + /etc/init.d/qemu-ga start + ;; +esac diff --git a/utils/qemu/files/bridge.conf b/utils/qemu/files/bridge.conf new file mode 100644 index 0000000..545a163 --- /dev/null +++ b/utils/qemu/files/bridge.conf @@ -0,0 +1 @@ +allow all diff --git a/utils/qemu/files/qemu-ga.init b/utils/qemu/files/qemu-ga.init new file mode 100755 index 0000000..86c2b7e --- /dev/null +++ b/utils/qemu/files/qemu-ga.init @@ -0,0 +1,15 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2016 OpenWrt.org + +START=99 +USE_PROCD=1 + +BIN=/usr/bin/qemu-ga + +start_service() { + procd_open_instance + procd_set_param command $BIN + procd_set_param respawn + procd_set_param stderr 1 + procd_close_instance +} diff --git a/utils/qemu/patches/0001-allow-disable-fortify-source.patch b/utils/qemu/patches/0001-allow-disable-fortify-source.patch new file mode 100644 index 0000000..ef6813a --- /dev/null +++ b/utils/qemu/patches/0001-allow-disable-fortify-source.patch @@ -0,0 +1,11 @@ +--- a/configure.orig 2016-11-22 11:53:25.739180380 +0800 ++++ b/configure 2016-11-22 11:53:55.183189596 +0800 +@@ -1147,6 +1147,8 @@ for opt do + ;; + --enable-jemalloc) jemalloc="yes" + ;; ++ --disable-fortify-source) fortify_source="no" ++ ;; + *) + echo "ERROR: unknown option $opt" + echo "Try '$0 --help' for more information" diff --git a/utils/qemu/patches/0002-setting-language-type-for-_asm-files.patch b/utils/qemu/patches/0002-setting-language-type-for-_asm-files.patch new file mode 100644 index 0000000..ea6d49d --- /dev/null +++ b/utils/qemu/patches/0002-setting-language-type-for-_asm-files.patch @@ -0,0 +1,11 @@ +--- a/rules.mak.orig 2016-11-22 13:30:40.933006727 +0800 ++++ b/rules.mak 2016-11-22 13:30:47.229008698 +0800 +@@ -70,7 +70,7 @@ LINK = $(call quiet-command, $(LINKPROG) + $(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -o $@ $<," CPP $(TARGET_DIR)$@") + + %.o: %.asm +- $(call quiet-command,$(AS) $(ASFLAGS) -o $@ $<," AS $(TARGET_DIR)$@") ++ $(call quiet-command,$(AS) $(ASFLAGS) -o $@ -x assembler $<," AS $(TARGET_DIR)$@") + + %.o: %.cc + $(call quiet-command,$(CXX) $(QEMU_INCLUDES) $(QEMU_CXXFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $($@-cflags) -c -o $@ $<," CXX $(TARGET_DIR)$@") diff --git a/utils/qemu/patches/0003-disable-avx2_opt-with-musl.patch b/utils/qemu/patches/0003-disable-avx2_opt-with-musl.patch new file mode 100644 index 0000000..c52cb4c --- /dev/null +++ b/utils/qemu/patches/0003-disable-avx2_opt-with-musl.patch @@ -0,0 +1,14 @@ +--- a/configure.orig 2016-11-22 17:35:12.069598617 +0800 ++++ b/configure 2016-11-22 18:24:01.042515353 +0800 +@@ -1789,7 +1789,10 @@ static void foo(void) __attribute__((ifu + int main(void) { foo(); return 0; } + EOF + if compile_prog "-mavx2" "" ; then +- if readelf --syms $TMPE |grep "IFUNC.*foo" >/dev/null 2>&1; then ++ if readelf --program-headers $TMPE | grep -iq 'Requesting program interpreter: .*ld-musl'; then ++ # ifunc support is not available with dynamic linker of musl ++ avx2_opt="no" ++ elif readelf --syms $TMPE |grep "IFUNC.*foo" >/dev/null 2>&1; then + avx2_opt="yes" + fi + fi diff --git a/utils/qemu/patches/0004-pixman-fix-detection-of-mips-dspr2.patch b/utils/qemu/patches/0004-pixman-fix-detection-of-mips-dspr2.patch new file mode 100644 index 0000000..05e34e0 --- /dev/null +++ b/utils/qemu/patches/0004-pixman-fix-detection-of-mips-dspr2.patch @@ -0,0 +1,10 @@ +--- a/pixman/configure.ac.orig 2016-11-22 20:44:21.205150763 +0800 ++++ b/pixman/configure.ac 2016-11-22 20:44:55.505161500 +0800 +@@ -720,7 +720,6 @@ dnl Check if assembler is gas compatible + have_mips_dspr2=no + AC_MSG_CHECKING(whether to use MIPS DSPr2 assembler) + xserver_save_CFLAGS=$CFLAGS +-CFLAGS="-mdspr2 $CFLAGS" + + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ + #if !(defined(__mips__) && __mips_isa_rev >= 2) diff --git a/utils/qemu/patches/0005-pixman-arm-neon-assembler-fix.patch b/utils/qemu/patches/0005-pixman-arm-neon-assembler-fix.patch new file mode 100644 index 0000000..93c967a --- /dev/null +++ b/utils/qemu/patches/0005-pixman-arm-neon-assembler-fix.patch @@ -0,0 +1,17 @@ +--- a/pixman/pixman/pixman-private.h.orig 2016-11-22 22:10:33.574769654 +0800 ++++ b/pixman/pixman/pixman-private.h 2016-11-22 22:10:47.638774056 +0800 +@@ -1,5 +1,3 @@ +-#include +- + #ifndef PIXMAN_PRIVATE_H + #define PIXMAN_PRIVATE_H + +@@ -17,6 +15,8 @@ + + #ifndef __ASSEMBLER__ + ++#include ++ + #ifndef PACKAGE + # error config.h must be included before pixman-private.h + #endif diff --git a/utils/qemu/patches/0006-libvixl-cxx-macro-isnan.patch b/utils/qemu/patches/0006-libvixl-cxx-macro-isnan.patch new file mode 100644 index 0000000..0dae8ce --- /dev/null +++ b/utils/qemu/patches/0006-libvixl-cxx-macro-isnan.patch @@ -0,0 +1,55 @@ +--- a/disas/libvixl/vixl/utils.h.orig 2016-11-22 22:36:20.691253883 +0800 ++++ b/disas/libvixl/vixl/utils.h 2016-11-22 22:55:44.639618185 +0800 +@@ -118,11 +118,17 @@ double double_pack(uint64_t sign, uint64 + // An fpclassify() function for 16-bit half-precision floats. + int float16classify(float16 value); + ++#ifdef isnan ++#define isnan_ isnan ++#else ++#define isnan_ std::isnan ++#endif ++ + // NaN tests. + inline bool IsSignallingNaN(double num) { + const uint64_t kFP64QuietNaNMask = UINT64_C(0x0008000000000000); + uint64_t raw = double_to_rawbits(num); +- if (std::isnan(num) && ((raw & kFP64QuietNaNMask) == 0)) { ++ if (isnan_(num) && ((raw & kFP64QuietNaNMask) == 0)) { + return true; + } + return false; +@@ -132,7 +138,7 @@ inline bool IsSignallingNaN(double num) + inline bool IsSignallingNaN(float num) { + const uint32_t kFP32QuietNaNMask = 0x00400000; + uint32_t raw = float_to_rawbits(num); +- if (std::isnan(num) && ((raw & kFP32QuietNaNMask) == 0)) { ++ if (isnan_(num) && ((raw & kFP32QuietNaNMask) == 0)) { + return true; + } + return false; +@@ -148,21 +154,21 @@ inline bool IsSignallingNaN(float16 num) + + template + inline bool IsQuietNaN(T num) { +- return std::isnan(num) && !IsSignallingNaN(num); ++ return isnan_(num) && !IsSignallingNaN(num); + } + + + // Convert the NaN in 'num' to a quiet NaN. + inline double ToQuietNaN(double num) { + const uint64_t kFP64QuietNaNMask = UINT64_C(0x0008000000000000); +- VIXL_ASSERT(std::isnan(num)); ++ VIXL_ASSERT(isnan_(num)); + return rawbits_to_double(double_to_rawbits(num) | kFP64QuietNaNMask); + } + + + inline float ToQuietNaN(float num) { + const uint32_t kFP32QuietNaNMask = 0x00400000; +- VIXL_ASSERT(std::isnan(num)); ++ VIXL_ASSERT(isnan_(num)); + return rawbits_to_float(float_to_rawbits(num) | kFP32QuietNaNMask); + } + diff --git a/utils/relayctl/Makefile b/utils/relayctl/Makefile new file mode 100644 index 0000000..1d064f7 --- /dev/null +++ b/utils/relayctl/Makefile @@ -0,0 +1,47 @@ +# Copyright (C) 2016 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:=relayctl +PKG_VERSION:=0.1 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/relayctl/relayctl-$(PKG_VERSION) +PKG_MAINTAINER:=Heinrich Schuchardt +PKG_MD5SUM:=24c848e0d705421dcd6accfffa31f704 +PKG_LICENSE:=BSD-3-Clause +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/relayctl + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Simple command-line control of SainSmart USB relay boards + URL:=https://github.com/darryln/relayctl + DEPENDS:= +libftdi1 +endef + +define Package/relayctl/description + Simple command-line control of SainSmart USB relay boards based on + FTDI chips using bitbang mode. +endef + +TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/libftdi1 + +define Package/relayctl/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/lib/udev/rules.d/ + $(CP) $(PKG_BUILD_DIR)/examples/60-relayctl.rules $(1)/lib/udev/rules.d/ +endef + +$(eval $(call BuildPackage,relayctl)) diff --git a/utils/relayctl/patches/0001-ftdi1.patch b/utils/relayctl/patches/0001-ftdi1.patch new file mode 100644 index 0000000..0b08395 --- /dev/null +++ b/utils/relayctl/patches/0001-ftdi1.patch @@ -0,0 +1,26 @@ +From 13556aaf94a2b0738a835a29f76be41d775a2d33 Mon Sep 17 00:00:00 2001 +From: Heinrich Schuchardt +Date: Sun, 3 Jul 2016 15:51:43 +0200 +Subject: [PATCH] Use -lftdi1 + +Signed-off-by: Heinrich Schuchardt +--- + src/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/Makefile.am b/src/Makefile.am +index a533d5c..4dbe6b5 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -1,7 +1,7 @@ + sbin_PROGRAMS = \ + relayctl + +-relayctl_LDFLAGS = -lftdi ++relayctl_LDFLAGS = -lftdi1 + + relayctl_SOURCES = relayctl.c + +-- +2.1.4 + diff --git a/utils/rng-tools/Makefile b/utils/rng-tools/Makefile new file mode 100644 index 0000000..d698327 --- /dev/null +++ b/utils/rng-tools/Makefile @@ -0,0 +1,63 @@ +# +# Copyright (C) 2011-2015 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:=rng-tools +PKG_VERSION:=5 +PKG_RELEASE:=5 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/gkernel/rng-tools/$(PKG_VERSION)/ +PKG_MD5SUM:=6726cdc6fae1f5122463f24ae980dd68 +PKG_LICENSE:=GPLv2 +PKG_MAINTAINER:=Nathaniel Wesley Filardo + +PKG_FIXUP:=autoreconf + +PKG_BUILD_DEPENDS:=USE_UCLIBC:argp-standalone USE_MUSL:argp-standalone + +include $(INCLUDE_DIR)/package.mk + +define Package/rng-tools + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Daemon for adding entropy to kernel entropy pool + URL:=http://sourceforge.net/projects/gkernel/ +endef + +define Package/rng-tools/description +Daemon for adding entropy to kernel entropy pool. By default it uses +/dev/urandom as the source but the init script can be modified +to use a hardware source like /dev/hwrng if present +endef + +ifdef CONFIG_USE_UCLIBC +CONFIGURE_VARS += \ + LIBS="-largp" +endif + +ifdef CONFIG_USE_MUSL +CONFIGURE_VARS += \ + LIBS="-largp" +endif + +CONFIGURE_ARGS += \ + --without-libgcrypt + +define Package/rng-tools/install + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/rngd.init $(1)/etc/init.d/rngd + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) ./files/rngd.uci_defaults $(1)/etc/uci-defaults/rngd + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/rngtest $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/rngd $(1)/sbin/ +endef + +$(eval $(call BuildPackage,rng-tools)) diff --git a/utils/rng-tools/files/rngd.init b/utils/rng-tools/files/rngd.init new file mode 100644 index 0000000..c9cead3 --- /dev/null +++ b/utils/rng-tools/files/rngd.init @@ -0,0 +1,26 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2011-2014 OpenWrt.org + +START=98 + +USE_PROCD=1 +PROG=/sbin/rngd + +start_service() { + local enabled=$(uci -q get system.@rngd[0].enabled) + local precmd=$(uci -q get system.@rngd[0].precmd) + local device=$(uci -q get system.@rngd[0].device) + local watermark=$(uci -q get system.@rngd[0].fill_watermark) + + [ "$enabled" = "1" ] || return + + [ -z "$precmd" ] || ${precmd} ${device} + + [ -z "$device" ] || device="-r ${device}" + [ -z "$watermark" ] || watermark="-W ${watermark}" + + procd_open_instance + procd_set_param command "$PROG" -f ${device} ${watermark} + procd_set_param stderr 1 + procd_close_instance +} diff --git a/utils/rng-tools/files/rngd.uci_defaults b/utils/rng-tools/files/rngd.uci_defaults new file mode 100644 index 0000000..6a26cf0 --- /dev/null +++ b/utils/rng-tools/files/rngd.uci_defaults @@ -0,0 +1,8 @@ +#!/bin/sh + +uci -q show system.@rngd[0] || { + uci add system rngd + uci set system.@rngd[0].enabled=0 + uci set system.@rngd[0].device=/dev/urandom + uci commit +} diff --git a/utils/rpcd-mod-lxc/Makefile b/utils/rpcd-mod-lxc/Makefile new file mode 100644 index 0000000..154336b --- /dev/null +++ b/utils/rpcd-mod-lxc/Makefile @@ -0,0 +1,37 @@ +# +# 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:=rpcd-mod-lxc +PKG_RELEASE=20141012 + +PKG_LICENSE:=ISC + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/rpcd-mod-lxc + SECTION:=libs + CATEGORY:=Libraries + TITLE:=LXC rpcd module + DEPENDS:=+rpcd +liblxc + MAINTAINER:=Luka Perkov +endef + +define Build/Prepare + $(CP) ./files/* $(PKG_BUILD_DIR)/ +endef + +define Package/rpcd-mod-lxc/install + $(INSTALL_DIR) $(1)/usr/lib/rpcd + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/lxc.so $(1)/usr/lib/rpcd/ +endef + +$(eval $(call BuildPackage,rpcd-mod-lxc)) diff --git a/utils/rpcd-mod-lxc/files/CMakeLists.txt b/utils/rpcd-mod-lxc/files/CMakeLists.txt new file mode 100644 index 0000000..4a728a0 --- /dev/null +++ b/utils/rpcd-mod-lxc/files/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.6) +PROJECT(rpcd-mod-lxc) +ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -Wmissing-declarations) + +INCLUDE_DIRECTORIES(include) +FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib) + +SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") +SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib) + +SET(SOURCES lxc.c) + +ADD_LIBRARY(rpcd-mod-lxc SHARED ${SOURCES}) + +FIND_LIBRARY(lxc NAMES lxc liblxc) +TARGET_LINK_LIBRARIES(rpcd-mod-lxc ${lxc}) + +SET_TARGET_PROPERTIES(rpcd-mod-lxc PROPERTIES OUTPUT_NAME lxc PREFIX "") +INSTALL(TARGETS rpcd-mod-lxc LIBRARY DESTINATION lib) diff --git a/utils/rpcd-mod-lxc/files/lxc.c b/utils/rpcd-mod-lxc/files/lxc.c new file mode 100644 index 0000000..0d52f16 --- /dev/null +++ b/utils/rpcd-mod-lxc/files/lxc.c @@ -0,0 +1,504 @@ +/* + * rpcd-lxc-plugin + * + * Copyright (C) 2014 Cisco Systems, Inc. + * Author: Luka Perkov + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include + +#include + +#include + +static struct blob_buf buf; + +struct rpc_lxc { + /* ubus options */ + char *name; + char *config; + /* lxc container */ + struct lxc_container *container; +}; + +enum { + RPC_LXC_NAME, + RPC_LXC_CONFIG, + __RPC_LXC_MAX, +}; + +enum { + RPC_LXC_SHUTDOWN_NAME, + RPC_LXC_SHUTDOWN_CONFIG, + RPC_LXC_SHUTDOWN_TIMEOUT, + __RPC_LXC_SHUTDOWN_MAX, +}; + +enum { + RPC_LXC_RENAME_NAME, + RPC_LXC_RENAME_CONFIG, + RPC_LXC_RENAME_NEWNAME, + __RPC_LXC_RENAME_MAX, +}; + +enum { + RPC_LXC_CREATE_NAME, + RPC_LXC_CREATE_CONFIG, + RPC_LXC_CREATE_TEMPLATE, + RPC_LXC_CREATE_FLAGS, + RPC_LXC_CREATE_ARGS, + __RPC_LXC_CREATE_MAX, +}; + +static const struct blobmsg_policy rpc_lxc_min_policy[__RPC_LXC_MAX] = { + [RPC_LXC_NAME] = { .name = "name", .type = BLOBMSG_TYPE_STRING }, + [RPC_LXC_CONFIG] = { .name = "config", .type = BLOBMSG_TYPE_STRING }, +}; + +static const struct blobmsg_policy rpc_lxc_shutdown_policy[__RPC_LXC_SHUTDOWN_MAX] = { + [RPC_LXC_SHUTDOWN_NAME] = { .name = "name", .type = BLOBMSG_TYPE_STRING }, + [RPC_LXC_SHUTDOWN_CONFIG] = { .name = "config", .type = BLOBMSG_TYPE_STRING }, + [RPC_LXC_SHUTDOWN_TIMEOUT] = { .name = "timeout", .type = BLOBMSG_TYPE_INT32 }, +}; + +static const struct blobmsg_policy rpc_lxc_rename_policy[__RPC_LXC_RENAME_MAX] = { + [RPC_LXC_RENAME_NAME] = { .name = "name", .type = BLOBMSG_TYPE_STRING }, + [RPC_LXC_RENAME_CONFIG] = { .name = "config", .type = BLOBMSG_TYPE_STRING }, + [RPC_LXC_RENAME_NEWNAME] = { .name = "newname", .type = BLOBMSG_TYPE_STRING }, +}; + +static const struct blobmsg_policy rpc_lxc_create_policy[__RPC_LXC_CREATE_MAX] = { + [RPC_LXC_CREATE_NAME] = { .name = "name", .type = BLOBMSG_TYPE_STRING }, + [RPC_LXC_CREATE_CONFIG] = { .name = "config", .type = BLOBMSG_TYPE_STRING }, + [RPC_LXC_CREATE_TEMPLATE] = { .name = "template", .type = BLOBMSG_TYPE_STRING }, + [RPC_LXC_CREATE_FLAGS] = { .name = "flags", .type = BLOBMSG_TYPE_INT32 }, + [RPC_LXC_CREATE_ARGS] = { .name = "args", .type = BLOBMSG_TYPE_ARRAY }, +}; + +static struct rpc_lxc * +rpc_lxc_init(struct blob_attr *tb[__RPC_LXC_MAX]) +{ + struct rpc_lxc *l = NULL; + + l = calloc(1, sizeof(struct rpc_lxc)); + if (!l) return NULL; + + if (tb[RPC_LXC_NAME]) { + l->name = blobmsg_data(tb[RPC_LXC_NAME]); + } else { + goto error; + } + + if (tb[RPC_LXC_CONFIG]) { + l->config = blobmsg_data(tb[RPC_LXC_CONFIG]); + } else { + l->config = NULL; + } + + l->container = lxc_container_new(l->name, l->config); + if (!l->container) { + goto error; + } + + return l; +error: + free(l); + return NULL; +} + +static void +rpc_lxc_done(struct rpc_lxc *l) +{ + if (l) { + lxc_container_put(l->container); + free(l); + } + + return; +} + +static int +rpc_lxc_start(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__RPC_LXC_MAX]; + struct rpc_lxc *l = NULL; + int rc; + + blobmsg_parse(rpc_lxc_min_policy, __RPC_LXC_MAX, tb, blob_data(msg), blob_len(msg)); + + l = rpc_lxc_init(tb); + if (!l) return UBUS_STATUS_INVALID_ARGUMENT; + + if (l->container->is_running(l->container)) { + rc = UBUS_STATUS_UNKNOWN_ERROR; + goto out; + } + + if (!l->container->start(l->container, 0, NULL)) { + rc = UBUS_STATUS_INVALID_ARGUMENT; + goto out; + } + + rc = UBUS_STATUS_OK; +out: + rpc_lxc_done(l); + return rc; +} + + +static int +rpc_lxc_reboot(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__RPC_LXC_MAX]; + struct rpc_lxc *l = NULL; + int rc; + + blobmsg_parse(rpc_lxc_min_policy, __RPC_LXC_MAX, tb, blob_data(msg), blob_len(msg)); + + l = rpc_lxc_init(tb); + if (!l) return UBUS_STATUS_INVALID_ARGUMENT; + + if (!l->container->is_running(l->container)) { + rc = UBUS_STATUS_UNKNOWN_ERROR; + goto out; + } + + if (!l->container->reboot(l->container)) { + rc = UBUS_STATUS_INVALID_ARGUMENT; + goto out; + } + + rc = UBUS_STATUS_OK; +out: + rpc_lxc_done(l); + return rc; +} + +static int +rpc_lxc_shutdown(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__RPC_LXC_SHUTDOWN_MAX]; + struct rpc_lxc *l = NULL; + int rc; + + blobmsg_parse(rpc_lxc_shutdown_policy, __RPC_LXC_SHUTDOWN_MAX, tb, blob_data(msg), blob_len(msg)); + + l = rpc_lxc_init(tb); + if (!l) return UBUS_STATUS_INVALID_ARGUMENT; + + if (!l->container->is_running(l->container)) { + rc = UBUS_STATUS_UNKNOWN_ERROR; + goto out; + } + + /* define default timeout */ + int timeout = 30; + if (tb[RPC_LXC_SHUTDOWN_TIMEOUT]) { + timeout = blobmsg_get_u32(tb[RPC_LXC_SHUTDOWN_TIMEOUT]); + } + + if (!l->container->shutdown(l->container, timeout)) { + rc = UBUS_STATUS_UNKNOWN_ERROR; + goto out; + } + + rc = UBUS_STATUS_OK; +out: + rpc_lxc_done(l); + return rc; +} + +static int +rpc_lxc_stop(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__RPC_LXC_MAX]; + struct rpc_lxc *l = NULL; + int rc; + + blobmsg_parse(rpc_lxc_min_policy, __RPC_LXC_MAX, tb, blob_data(msg), blob_len(msg)); + + l = rpc_lxc_init(tb); + if (!l) return UBUS_STATUS_INVALID_ARGUMENT; + + if (!l->container->is_running(l->container)) { + rc = UBUS_STATUS_UNKNOWN_ERROR; + goto out; + } + + if (!l->container->stop(l->container)) { + rc = UBUS_STATUS_INVALID_ARGUMENT; + goto out; + } + + rc = UBUS_STATUS_OK; +out: + rpc_lxc_done(l); + return rc; +} + +static int +rpc_lxc_freeze(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__RPC_LXC_MAX]; + struct rpc_lxc *l = NULL; + int rc; + + blobmsg_parse(rpc_lxc_min_policy, __RPC_LXC_MAX, tb, blob_data(msg), blob_len(msg)); + + l = rpc_lxc_init(tb); + if (!l) return UBUS_STATUS_INVALID_ARGUMENT; + + if (!l->container->is_running(l->container)) { + rc = UBUS_STATUS_UNKNOWN_ERROR; + goto out; + } + + if (!l->container->freeze(l->container)) { + rc = UBUS_STATUS_INVALID_ARGUMENT; + goto out; + } + + rc = UBUS_STATUS_OK; +out: + rpc_lxc_done(l); + return rc; +} + +static int +rpc_lxc_unfreeze(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__RPC_LXC_MAX]; + struct rpc_lxc *l = NULL; + int rc; + + blobmsg_parse(rpc_lxc_min_policy, __RPC_LXC_MAX, tb, blob_data(msg), blob_len(msg)); + + l = rpc_lxc_init(tb); + if (!l) return UBUS_STATUS_INVALID_ARGUMENT; + + if (!l->container->is_running(l->container)) { + rc = UBUS_STATUS_UNKNOWN_ERROR; + goto out; + } + + if (!l->container->unfreeze(l->container)) { + rc = UBUS_STATUS_INVALID_ARGUMENT; + goto out; + } + + rc = UBUS_STATUS_OK; +out: + rpc_lxc_done(l); + return rc; +} + +static int +rpc_lxc_rename(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__RPC_LXC_RENAME_MAX]; + struct rpc_lxc *l = NULL; + int rc; + + blobmsg_parse(rpc_lxc_rename_policy, __RPC_LXC_RENAME_MAX, tb, blob_data(msg), blob_len(msg)); + + l = rpc_lxc_init(tb); + if (!l) return UBUS_STATUS_INVALID_ARGUMENT; + + if (!tb[RPC_LXC_RENAME_NEWNAME]) { + rc = UBUS_STATUS_INVALID_ARGUMENT; + goto out; + } + + if (l->container->is_running(l->container)) { + rc = UBUS_STATUS_UNKNOWN_ERROR; + goto out; + } + + char *newname = blobmsg_data(tb[RPC_LXC_RENAME_NEWNAME]); + if (!newname || !l->container->rename(l->container, newname)) { + rc = UBUS_STATUS_INVALID_ARGUMENT; + goto out; + } + + rc = UBUS_STATUS_OK; +out: + rpc_lxc_done(l); + return rc; +} + +static int +rpc_lxc_create(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__RPC_LXC_CREATE_MAX]; + struct rpc_lxc *l = NULL; + int rc; + + char *template = "none"; + int flags = 0; + char **args = NULL; + + blobmsg_parse(rpc_lxc_create_policy, __RPC_LXC_CREATE_MAX, tb, blob_data(msg), blob_len(msg)); + + l = rpc_lxc_init(tb); + if (!l) return UBUS_STATUS_INVALID_ARGUMENT; + + if (tb[RPC_LXC_CREATE_TEMPLATE]) + template = blobmsg_data(tb[RPC_LXC_CREATE_TEMPLATE]); + + if (tb[RPC_LXC_CREATE_FLAGS]) + flags = blobmsg_get_u32(tb[RPC_LXC_CREATE_FLAGS]); + + if (tb[RPC_LXC_CREATE_ARGS]) { + struct blob_attr *cur; + int num, rem; + + num = blobmsg_check_array(tb[RPC_LXC_CREATE_ARGS], BLOBMSG_TYPE_STRING); + + // trailing NULL is needed + args = calloc(num + 1, sizeof(char *)); + if (!args) { + rc = UBUS_STATUS_UNKNOWN_ERROR; + goto out; + } + + num = 0; + blobmsg_for_each_attr(cur, tb[RPC_LXC_CREATE_ARGS], rem) + { + if (blobmsg_type(cur) != BLOBMSG_TYPE_STRING) + continue; + + args[num++] = (char *) blobmsg_data(cur); + } + } + + if (!l->container->create(l->container, template, NULL, NULL, flags, args)) { + rc = UBUS_STATUS_INVALID_ARGUMENT; + goto out; + } + + rc = UBUS_STATUS_OK; +out: + rpc_lxc_done(l); + free(args); + return rc; +} + +static int +rpc_lxc_destroy(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__RPC_LXC_MAX]; + struct rpc_lxc *l = NULL; + int rc; + + blobmsg_parse(rpc_lxc_min_policy, __RPC_LXC_MAX, tb, blob_data(msg), blob_len(msg)); + + l = rpc_lxc_init(tb); + if (!l) return UBUS_STATUS_INVALID_ARGUMENT; + + if (l->container->is_running(l->container)) { + rc = UBUS_STATUS_UNKNOWN_ERROR; + goto out; + } + + if (!l->container->destroy(l->container)) { + rc = UBUS_STATUS_INVALID_ARGUMENT; + goto out; + } + + rc = UBUS_STATUS_OK; +out: + rpc_lxc_done(l); + return rc; +} + +static int +rpc_lxc_list(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + + blob_buf_init(&buf, 0); + + int rc; + char **names; + struct lxc_container **cret; + + rc = list_all_containers(NULL, &names, &cret); + if (rc == -1) + return UBUS_STATUS_UNKNOWN_ERROR; + + for (int i = 0; i < rc; i++) { + struct lxc_container *c = cret[i]; + blobmsg_add_string(&buf, names[i], c->state(c)); + + free(names[i]); + lxc_container_put(c); + } + + ubus_send_reply(ctx, req, buf.head); + + return UBUS_STATUS_OK; +} + +static int +rpc_lxc_api_init(const struct rpc_daemon_ops *o, struct ubus_context *ctx) +{ + static const struct ubus_method lxc_methods[] = { + UBUS_METHOD("start", rpc_lxc_start, rpc_lxc_min_policy), + UBUS_METHOD("reboot", rpc_lxc_reboot, rpc_lxc_min_policy), + UBUS_METHOD("shutdown", rpc_lxc_shutdown, rpc_lxc_shutdown_policy), + UBUS_METHOD("stop", rpc_lxc_stop, rpc_lxc_min_policy), + UBUS_METHOD("freeze", rpc_lxc_freeze, rpc_lxc_min_policy), + UBUS_METHOD("unfreeze", rpc_lxc_unfreeze, rpc_lxc_min_policy), + UBUS_METHOD("rename", rpc_lxc_rename, rpc_lxc_rename_policy), + UBUS_METHOD("create", rpc_lxc_create, rpc_lxc_create_policy), + UBUS_METHOD("destroy", rpc_lxc_destroy, rpc_lxc_min_policy), + UBUS_METHOD_NOARG("list", rpc_lxc_list), + }; + + static struct ubus_object_type lxc_type = + UBUS_OBJECT_TYPE("luci-rpc-lxc", lxc_methods); + + static struct ubus_object obj = { + .name = "lxc", + .type = &lxc_type, + .methods = lxc_methods, + .n_methods = ARRAY_SIZE(lxc_methods), + }; + + return ubus_add_object(ctx, &obj); +} + +struct rpc_plugin rpc_plugin = { + .init = rpc_lxc_api_init +}; diff --git a/utils/rrdtool1/Makefile b/utils/rrdtool1/Makefile new file mode 100644 index 0000000..dd221ae --- /dev/null +++ b/utils/rrdtool1/Makefile @@ -0,0 +1,135 @@ +# +# 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:=rrdtool1 +PKG_VERSION:=1.0.50 +PKG_RELEASE:=2 + +PKG_BUILD_DIR:=$(BUILD_DIR)/rrdtool-$(PKG_VERSION) +PKG_SOURCE:=rrdtool-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:= \ + http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.0.x \ + http://www.fastmirrors.org/rrdtool/rrdtool-1.0.x \ + ftp://ftp.sunet.se/pub/network/monitoring/rrdtool/rrdtool-1.0.x +PKG_MD5SUM:=c466e2e7df95fa8e318e46437da87686 +PKG_MAINTAINER:=Jo-Philipp Wich + +PKG_FIXUP:=autoreconf +PKG_CHECK_FORMAT_SECURITY:=0 + +include $(INCLUDE_DIR)/package.mk + +define Package/rrdtool1/Default + TITLE:=Round Robin Database (RRD) + URL:=http://oss.oetiker.ch/rrdtool/ +endef + +define Package/rrdtool1/description/Default + RRD is the Acronym for Round Robin Database. RRD is a system to store and + display time-series data (i.e. network bandwidth, machine-room temperature, + server load average). It stores the data in a very compact way that will + not expand over time, and it presents useful graphs by processing the data + to enforce a certain data density. It can be used either via simple wrapper + scripts (from shell or Perl) or via frontends that poll network devices and + put friendly user interface on it. + + This is version 1.0.x with cgilib-0.4, gd1.3 and libpng-1.0.9 linked into + librrd.so. The library is much smaller compared to the 1.2.x version with + separate dynamic linked libraries. +endef + +define Package/librrd1 +$(call Package/rrdtool1/Default) + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=+zlib + TITLE+= management library +endef + +define Package/librrd1/description +$(call Package/rrdtool1/description/Default) + This package contains a shared library, used by other programs. +endef + +define Package/rrdcgi1 +$(call Package/rrdtool1/Default) + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=database + DEPENDS:=+librrd1 + TITLE+= CGI graphing tool +endef + +define Package/rrdcgi1/description +$(call Package/rrdtool1/description/Default) + This package contains the rrdcgi tool used to create web pages containing + RRD graphs based on templates. +endef + +define Package/rrdtool1 +$(call Package/rrdtool1/Default) + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=database + DEPENDS:=+librrd1 + TITLE+= management tools +endef + +define Package/rrdtool1/description +$(call Package/rrdtool1/description/Default) + This package contains command line tools used to manage RRDs. +endef + +TARGET_CFLAGS += $(FPIC) --std=c99 + +CONFIGURE_ARGS += \ + $(DISABLE_NLS) \ + --enable-shared=yes \ + --enable-static=yes \ + --disable-rpath \ + --with-gnu-ld \ + --enable-local-zlib + +CONFIGURE_VARS += \ + ac_cv_path_PERL=no \ + rd_cv_ieee_works=yes \ + shrext_cmds=".so" + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + shrext_cmds=".so" \ + all install +endef + +define Package/rrdtool1/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/rrd{tool,update} $(1)/usr/bin/ +endef + +define Package/rrdcgi1/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/rrdcgi $(1)/usr/bin/ +endef + +define Package/librrd1/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/librrd.so.* $(1)/usr/lib/ +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/lib/rrdtool-1.0/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/rrd.h $(1)/usr/lib/rrdtool-1.0/include/ + $(INSTALL_DIR) $(1)/usr/lib/rrdtool-1.0/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/librrd.{a,so*} $(1)/usr/lib/rrdtool-1.0/lib/ +endef + +$(eval $(call BuildPackage,librrd1)) +$(eval $(call BuildPackage,rrdcgi1)) +$(eval $(call BuildPackage,rrdtool1)) diff --git a/utils/rrdtool1/patches/001-no_ordering_cd_joke.patch b/utils/rrdtool1/patches/001-no_ordering_cd_joke.patch new file mode 100644 index 0000000..442fe49 --- /dev/null +++ b/utils/rrdtool1/patches/001-no_ordering_cd_joke.patch @@ -0,0 +1,21 @@ +diff -urN rrdtool-1.0.50/configure rrdtool-1.0.50.new/configure +--- rrdtool-1.0.50/configure 2005-04-25 22:48:09.000000000 +0200 ++++ rrdtool-1.0.50.new/configure 2009-03-09 17:25:38.000000000 +0100 +@@ -24873,17 +24873,12 @@ + echo "${ECHO_T}and out again" >&6 + + echo $ECHO_N "ordering CD from http://people.ee.ethz.ch/~oetiker/wish $ac_c" 1>&6 +-sleep 1 + echo $ECHO_N ".$ac_c" 1>&6 +-sleep 2 + echo $ECHO_N ".$ac_c" 1>&6 +-sleep 1 + echo $ECHO_N ".$ac_c" 1>&6 +-sleep 3 + echo $ECHO_N ".$ac_c" 1>&6 + echo $ECHO_N ".$ac_c" 1>&6 + echo $ECHO_N ".$ac_c" 1>&6 +-sleep 2 + echo "$as_me:$LINENO: result: just kidding ;-)" >&5 + echo "${ECHO_T} just kidding ;-)" >&6 + echo diff --git a/utils/rrdtool1/patches/002-no_timezone.patch b/utils/rrdtool1/patches/002-no_timezone.patch new file mode 100644 index 0000000..07564b4 --- /dev/null +++ b/utils/rrdtool1/patches/002-no_timezone.patch @@ -0,0 +1,24 @@ +--- a/src/rrd_tool.c ++++ b/src/rrd_tool.c +@@ -225,11 +225,8 @@ + struct rusage myusage; + struct timeval starttime; + struct timeval currenttime; +- struct timezone tz; + +- tz.tz_minuteswest =0; +- tz.tz_dsttime=0; +- gettimeofday(&starttime,&tz); ++ gettimeofday(&starttime,NULL); + #endif + + while (fgets(aLine, sizeof(aLine)-1, stdin)){ +@@ -252,7 +249,7 @@ + + #if HAVE_GETRUSAGE + getrusage(RUSAGE_SELF,&myusage); +- gettimeofday(¤ttime,&tz); ++ gettimeofday(¤ttime,NULL); + printf("OK u:%1.2f s:%1.2f r:%1.2f\n", + (double)myusage.ru_utime.tv_sec+ + (double)myusage.ru_utime.tv_usec/1000000.0, diff --git a/utils/rrdtool1/patches/020-x86-float-cast.patch b/utils/rrdtool1/patches/020-x86-float-cast.patch new file mode 100644 index 0000000..5b8a662 --- /dev/null +++ b/utils/rrdtool1/patches/020-x86-float-cast.patch @@ -0,0 +1,13 @@ +Index: rrdtool-1.0.50/src/rrd_format.h +=================================================================== +--- rrdtool-1.0.50.orig/src/rrd_format.h ++++ rrdtool-1.0.50/src/rrd_format.h +@@ -20,7 +20,7 @@ + + #define RRD_COOKIE "RRD" + #define RRD_VERSION "0001" +-#define FLOAT_COOKIE 8.642135E130 ++#define FLOAT_COOKIE ((double)8.642135E130) + + #if defined(WIN32) + #define DNAN ((double)fmod(0.0,0.0)) diff --git a/utils/rrdtool1/patches/030-pod2man-stderr.patch b/utils/rrdtool1/patches/030-pod2man-stderr.patch new file mode 100644 index 0000000..feadf3a --- /dev/null +++ b/utils/rrdtool1/patches/030-pod2man-stderr.patch @@ -0,0 +1,11 @@ +--- rrdtool-1.0.50/doc/Makefile.am.orig 2013-11-16 11:44:50.940231208 -0500 ++++ rrdtool-1.0.50/doc/Makefile.am 2013-11-16 11:45:09.802229483 -0500 +@@ -35,7 +35,7 @@ + all-local: link txt man html + + .pod.1 .pm.1 .pl.1: +- pod2man --release=$(VERSION) --center=RRDtool $< > $@ ++ pod2man --stderr --release=$(VERSION) --center=RRDtool $< > $@ + + .1.txt: + @NROFF@ -man -Tlp $< > $@ || echo @NROFF@ failed > $@ diff --git a/utils/rtklib/Makefile b/utils/rtklib/Makefile new file mode 100644 index 0000000..9d7ed6d --- /dev/null +++ b/utils/rtklib/Makefile @@ -0,0 +1,96 @@ +# +# Copyright (C) 2014-2016 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:=rtklib +PKG_VERSION:=2.4.3_b24 +PKG_RELEASE:=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://github.com/tomojitakasu/RTKLIB.git +PKG_SOURCE_VERSION:=1cec90a9ffa424908ad1a4ca3d52f33f9b94d1f7 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_LICENSE:=BSD-2-Clause + +PKG_MAINTAINER:=Nuno Goncalves + +include $(INCLUDE_DIR)/package.mk + +define Package/rtklib/default + SUBMENU:=RTKLIB Suite + SECTION:=utils + CATEGORY:=Utilities + URL:=http://www.rtklib.com/ + DEPENDS:=+libpthread +librt +endef + +define Package/convbin +$(call Package/rtklib/default) + TITLE:=RINEX Converter +endef + +define Package/pos2kml +$(call Package/rtklib/default) + TITLE:=Solution to KML converter +endef + +define Package/rnx2rtkp +$(call Package/rtklib/default) + TITLE:=Post-Processing Analysis +endef + +define Package/rtkrcv +$(call Package/rtklib/default) + TITLE:=Real-Time Positioning +endef + +define Package/str2str +$(call Package/rtklib/default) + TITLE:=Communication Server +endef + +define Build/Compile + rm -rf $(PKG_INSTALL_DIR) + mkdir -p $(PKG_INSTALL_DIR) + $(MAKE) -C $(PKG_BUILD_DIR)/app/convbin/gcc CC="$(TARGET_CC) $(TARGET_CFLAGS)" + $(MAKE) -C $(PKG_BUILD_DIR)/app/pos2kml/gcc CC="$(TARGET_CC) $(TARGET_CFLAGS)" + $(MAKE) -C $(PKG_BUILD_DIR)/app/rnx2rtkp/gcc CC="$(TARGET_CC) $(TARGET_CFLAGS)" + $(MAKE) -C $(PKG_BUILD_DIR)/app/rtkrcv/gcc CC="$(TARGET_CC) $(TARGET_CFLAGS)" + $(MAKE) -C $(PKG_BUILD_DIR)/app/str2str/gcc CC="$(TARGET_CC) $(TARGET_CFLAGS)" +endef + +define Package/convbin/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/app/convbin/gcc/convbin $(1)/usr/bin/ +endef + +define Package/pos2kml/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/app/pos2kml/gcc/pos2kml $(1)/usr/bin/ +endef + +define Package/rnx2rtkp/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/app/rnx2rtkp/gcc/rnx2rtkp $(1)/usr/bin/ +endef + +define Package/rtkrcv/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/app/rtkrcv/gcc/rtkrcv $(1)/usr/bin/ +endef + +define Package/str2str/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/app/str2str/gcc/str2str $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,convbin)) +$(eval $(call BuildPackage,pos2kml)) +$(eval $(call BuildPackage,rnx2rtkp)) +$(eval $(call BuildPackage,rtkrcv)) +$(eval $(call BuildPackage,str2str)) diff --git a/utils/rtl-ais/Makefile b/utils/rtl-ais/Makefile new file mode 100644 index 0000000..ba45557 --- /dev/null +++ b/utils/rtl-ais/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2015 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:=rtl-ais +PKG_VERSION:=20151213 + +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/dgiardini/rtl-ais.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=b805be0164475e58a73b57763a8cbbf8a2bd0ded +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=COPYING + +PKG_MAINTAINER:=Nuno Goncalves + +include $(INCLUDE_DIR)/package.mk + +define Package/rtl-ais + SECTION:=utils + CATEGORY:=Utilities + TITLE:=rtl-sdr AIS dual channel tuner + DEPENDS:=+libpthread +librtlsdr + URL:=https://github.com/dgiardini/rtl-ais +endef + +define Package/rtl-ais/description + rtl_ais uses a rtl2832u dvb-t dongle to tune AIS (Automatic Identification + System) used on ships and by vessel traffic services +endef + +define Package/rtl-ais/conffiles +/etc/config/rtl_ais +endef + +define Package/rtl-ais/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/rtl_ais $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/rtl_ais.init $(1)/etc/init.d/rtl_ais + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/uci_rtl_ais $(1)/etc/config/rtl_ais +endef + +$(eval $(call BuildPackage,rtl-ais)) diff --git a/utils/rtl-ais/files/rtl_ais.init b/utils/rtl-ais/files/rtl_ais.init new file mode 100644 index 0000000..4900c34 --- /dev/null +++ b/utils/rtl-ais/files/rtl_ais.init @@ -0,0 +1,38 @@ +#!/bin/sh /etc/rc.common + +START=99 +USE_PROCD=1 + +PROG=/usr/bin/rtl_ais + +validate_rtl_ais_section() { + uci_validate_section "rtl_ais" "rtl_ais" "$1" \ + 'enabled:bool' \ + 'ppm:range(-100,100):0' +} + +load_rtl_ais() { + local cfg="$1" + + local enabled ppm + validate_rtl_ais_section "$cfg" || { echo "validation failed"; return 1; } + + [ "$enabled" = "1" ] || return 1 + + procd_open_instance + procd_set_param command "$PROG" -p "$ppm" + procd_set_param stdout 1 + procd_set_param stderr 1 + procd_set_param respawn + procd_close_instance +} + +start_service() { + config_load "rtl_ais" + config_foreach load_rtl_ais "rtl_ais" +} + +service_triggers() { + procd_add_reload_trigger "rtl_ais" + procd_add_validation validate_rtl_ais_section +} diff --git a/utils/rtl-ais/files/uci_rtl_ais b/utils/rtl-ais/files/uci_rtl_ais new file mode 100644 index 0000000..1b5f1ec --- /dev/null +++ b/utils/rtl-ais/files/uci_rtl_ais @@ -0,0 +1,3 @@ +config rtl_ais + option enabled 0 + option ppm 0 diff --git a/utils/rtl-sdr/Makefile b/utils/rtl-sdr/Makefile new file mode 100644 index 0000000..37e7f84 --- /dev/null +++ b/utils/rtl-sdr/Makefile @@ -0,0 +1,96 @@ +# +# Copyright (C) 2015 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:=rtl-sdr +PKG_VERSION:=0.5.3-20150608-$(PKG_SOURCE_VERSION) +PKG_RELEASE:=2 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://git.osmocom.org/rtl-sdr.git +PKG_SOURCE_VERSION:=e3c03f738f5aef4dc51e2b741fbdb542b9cc1bb1 + +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) +PKG_BUILD_PARALLEL:=1 + +CMAKE_INSTALL:=1 + +PKG_LICENSE:=GPLv2 +PKG_LICENSE_FILES:=COPYING + +PKG_MAINTAINER:=Vasilis Tsiligiannis + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/rtl-sdr/Default + TITLE:=Software Defined Radio with Realtek RTL2832U + URL:=http://sdr.osmocom.org/trac/wiki/rtl-sdr +endef + +define Package/rtl-sdr/Default/description + rtl-sdr allows DVB-T dongles based on the Realtek RTL2832U to be used as + an inexpensive SDR. +endef + +define Package/rtl-sdr + $(call Package/rtl-sdr/Default) + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+librt +libpthread +librtlsdr +endef + +define Package/rtl-sdr/description + $(call Package/rtl-sdr/Default/description) + + This package contains the utilities and daemons. +endef + +define Package/librtlsdr + $(call Package/rtl-sdr/Default) + TITLE+= shared library + SECTION:=libs + CATEGORY:=Libraries + TITLE+= library + DEPENDS:=+libusb-1.0 +endef + +define Package/librtlsdr/description + $(call Package/rtl-sdr/Default/description) + + This package contains the librtlsdr shared library. +endef + +TARGET_CFLAGS += $(FPIC) + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/librtlsdr.so* $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/librtlsdr.pc $(1)/usr/lib/pkgconfig/ +endef + +define Package/rtl-sdr/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/rtl_* $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) files/rtl_tcp.init $(1)/etc/init.d/rtl_tcp + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) files/rtl_tcp.config $(1)/etc/config/rtl_tcp +endef + +define Package/librtlsdr/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/librtlsdr.so* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,rtl-sdr)) +$(eval $(call BuildPackage,librtlsdr)) diff --git a/utils/rtl-sdr/files/rtl_tcp.config b/utils/rtl-sdr/files/rtl_tcp.config new file mode 100644 index 0000000..95998aa --- /dev/null +++ b/utils/rtl-sdr/files/rtl_tcp.config @@ -0,0 +1,12 @@ +config rtl_tcp main + option disabled '1' + option respawn '1' + option device_index '' + option address '0.0.0.0' + option port '' + option frequency '' + option gain '' + option samplerate '' + option buffers '8' + option num_linked_lists '8' + option ppm_error '' diff --git a/utils/rtl-sdr/files/rtl_tcp.init b/utils/rtl-sdr/files/rtl_tcp.init new file mode 100755 index 0000000..4204787 --- /dev/null +++ b/utils/rtl-sdr/files/rtl_tcp.init @@ -0,0 +1,64 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2016 OpenWrt.org + +START=90 +STOP=10 +USE_PROCD=1 + +append_arg() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}" +} + +append_bool() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get_bool val "$cfg" "$var" "$def" + [ "$val" = 1 ] && procd_append_param command "$opt" +} + + +start_instance() { + local cfg="$1" + local aux + + config_get_bool aux "$cfg" 'disabled' '0' + [ "$aux" = 1 ] && return 1 + + procd_open_instance + + procd_set_param command /usr/bin/rtl_tcp + append_arg "$cfg" device_index "-d" + append_arg "$cfg" address "-a" + append_arg "$cfg" port "-p" + append_arg "$cfg" frequency "-f" + append_arg "$cfg" gain "-g" + append_arg "$cfg" samplerate "-s" + append_arg "$cfg" buffers "-b" + append_arg "$cfg" num_linked_lists "-n" + append_arg "$cfg" ppm_error "-P" + + config_get_bool aux "$cfg" 'respawn' '0' + [ "$aux" = 1 ] && procd_set_param respawn + + procd_close_instance +} + +service_triggers() { + procd_add_reload_trigger "rtl_tcp" +} + +start_service() { + config_load rtl_tcp + config_foreach start_instance rtl_tcp +} diff --git a/utils/sane-backends/Makefile b/utils/sane-backends/Makefile new file mode 100644 index 0000000..0eee249 --- /dev/null +++ b/utils/sane-backends/Makefile @@ -0,0 +1,358 @@ +# +# Copyright (C) 2006-2016 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:=sane-backends +PKG_VERSION:=1.0.25 +PKG_RELEASE:=2 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://fossies.org/linux/misc \ + https://alioth.debian.org/frs/download.php/file/4146/ +PKG_MD5SUM:=f9ed5405b3c12f07c6ca51ee60225fe7 +PKG_MAINTAINER:=Luiz Angelo Daros de Luca +PKG_LICENSE:=GPL-2.0 GPL-2.0+ +PKG_LICENSE_FILES:=COPYING LICENSE + +PKG_FIXUP:=autoreconf +PKG_REMOVE_FILES:=aclocal.m4 + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +SANE_BACKENDS:= + +define Package/sane-backends/Default + TITLE:=Scanner Access Now Easy + URL:=http://www.sane-project.org/ +endef + +define Package/sane-backends/Default/description + SANE (Scanner Access Now Easy) is a universal scanner interface. +endef + +define Package/sane-backends +$(call Package/sane-backends/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE+= (drivers) + DEPENDS:=+ALL:sane-backends-all +endef + +define Package/sane-backends/description +$(call Package/sane-backends/Default/description) +. +This +endef + +define Package/sane-backends/config + menu "Select SANE backends" + depends on PACKAGE_sane-backends + + + config PACKAGE_sane-backends-all + depends on PACKAGE_sane-backends + prompt "Include all SANE backends (sane-backends-all)" + + comment "Backends" + +$(foreach backend,$(SANE_BACKENDS), \ + $(eval \ + $(call Package/Default) + $(call Package/sane-$(backend)) + )\ + config PACKAGE_sane-$(backend) + prompt "$(TITLE)" + $(foreach config_dep,\ + $(filter @%, + $(foreach v, $(DEPENDS), $(if $(findstring :,$v),,$v)) + ),\ + depends on $(strip $(subst @,,$(config_dep))) + ) +) + endmenu + +endef + +# returns conditional dependency on sane backend +# 1: backend name +# +# If there is no config deps on $(1), returns +sane-$(1). +# Otherwise, +(CONFIG1&&CONFIG2&&..):sane-$(1) +define SaneBackendDependency + $(eval \ + $(call Package/Default) + $(call Package/sane-$(1)) + FILTER_CONFIG:=$$(strip \ + $$(foreach config_dep, \ + $$(filter @%, \ + $$(foreach v, \ + $$(DEPENDS), \ + $$(if $$(findstring :,$$v),,$$v) \ + ) \ + ), \ + $$(subst @,,$$(config_dep)) \ + ) \ + ) + ifneq (,$$(FILTER_CONFIG)) + FILTER_CONFIG:=($$(subst $$(space),&&,$$(FILTER_CONFIG))): + endif + ) \ + +$(FILTER_CONFIG)sane-$(1) +endef + +define Package/sane-backends-all +$(call Package/sane-backends/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE+= (all backends) + DEPENDS:=$(foreach backend,$(SANE_BACKENDS),$(strip $(call SaneBackendDependency,$(backend)))) + HIDDEN:=1 +endef + +define Package/sane-backends-all/description +$(call Package/sane-backends/Default/description) +. +Metapackage for selecting all SANE Backends +endef + +define Package/sane-daemon +$(call Package/sane-backends/Default) + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libsane + TITLE+= (network daemon) +endef + +define Package/sane-daemon/description +$(call Package/sane-backends/Default/description) +This package contains the SANE daemon. +endef + +define Package/libsane + $(call Package/sane-backends/Default) + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=+libusb-compat + TITLE+= (libraries) +endef + +define Package/libsane/description +$(call Package/sane-backends/Default/description) +This package contains the SANE shared libraries. +endef + +define Package/sane-frontends + $(call Package/sane-backends/Default) + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libsane +libjpeg +libpng + TITLE+= (frontends) +endef + +define Package/sane-frontends/description +$(call Package/sane-backends/Default/description) +This package contains the SANE frontends. +endef + +TARGET_LDFLAGS += \ + -Wl,-rpath-link $(STAGING_DIR)/usr/lib \ + -Wl,-rpath-link $(PKG_BUILD_DIR)/backend/.libs + +CONFIGURE_ARGS+= \ + --enable-shared \ + --enable-static \ + --disable-translations \ + --disable-latex \ + --without-gphoto2 \ + --without-snmp + +CONFIGURE_VARS+= \ + ac_cv_func_mmap_fixed_mapped="yes" \ + +define Build/Configure + mkdir -p $(PKG_BUILD_DIR)/backend/.libs + $(Build/Configure/Default) +endef + +define Package/libsane/install + $(INSTALL_DIR) $(1)/usr/lib/sane/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsane.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/sane/libsane-dll.so.* $(1)/usr/lib/sane/ + $(INSTALL_DIR) $(1)/etc/sane.d/dll.d + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sane.d/dll.conf $(1)/etc/sane.d/ +endef + +define Package/libsane/conffiles +/etc/sane.d/dll.conf +endef + +define Package/sane-daemon/install + $(INSTALL_DIR) $(1)/etc/sane.d + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sane.d/saned.conf $(1)/etc/sane.d/ + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/xinetd.d + $(CP) ./files/xinet.d_sane-port $(1)/etc/xinetd.d/sane-port +endef + +define Package/sane-daemon/conffiles +/etc/sane.d/saned.conf +/etc/xinetd.d/sane-port +endef + +define Package/sane-frontends/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ +endef + +define Package/sane-backends-all/install + /bin/true +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/sane $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsane.{a,so*} $(1)/usr/lib/ +endef + +# 1: short name +# 2: description +# 3: dependencies on other packages +define SaneBackend + SANE_BACKENDS+= $(1) + + define Package/sane-$(1) + $(call Package/sane-backends/Default) + TITLE:=SANE backend (sane-$(1)) for $(2) + DEPENDS+= +libsane $(3) + HIDDEN:=1 + endef + + define Package/sane-$(1)/description + $(call Package/sane-backends/Default/description) +. +This package contains the SANE backend for $(2). + endef + + define Package/sane-$(1)/install + if [ -f "$(PKG_INSTALL_DIR)/etc/sane.d/$(1).conf" ]; then \ + $(INSTALL_DIR) $$(1)/etc/sane.d ; \ + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sane.d/$(1).conf $$(1)/etc/sane.d/; \ + fi + $(INSTALL_DIR) $$(1)/usr/lib/sane + $(CP) $(PKG_INSTALL_DIR)/usr/lib/sane/libsane-$(1).so.* $$(1)/usr/lib/sane/ + if [ -d "$(PKG_INSTALL_DIR)/usr/share/sane/$(1)" ]; then \ + $(INSTALL_DIR) $$(1)/usr/share/sane/ ; \ + $(CP) -a $(PKG_INSTALL_DIR)/usr/share/sane/$(1) $$(1)/usr/share/sane/ ; \ + fi + endef + + define Package/sane-$(1)/conffiles + /etc/sane.d/$(1).conf + endef + + $$(eval $$(call BuildPackage,sane-$(1))) +endef + +$(eval $(call BuildPackage,libsane)) +$(eval $(call BuildPackage,sane-daemon)) +$(eval $(call SaneBackend,abaton,Abaton flatbed scanners)) +$(eval $(call SaneBackend,agfafocus,AGFA Focus flatbed scanners)) +$(eval $(call SaneBackend,apple,Apple flatbed scanners)) +$(eval $(call SaneBackend,artec,Artec flatbed scanners)) +$(eval $(call SaneBackend,artec_eplus48u,Artec E+ 48U and re-badged models)) +$(eval $(call SaneBackend,as6e,Artec AS6E parallel port interface scanner)) +$(eval $(call SaneBackend,avision,Avision and Avision OEM scanners and possibly more flatbed and film scanners)) +$(eval $(call SaneBackend,bh,Bell+Howell Copiscan II series document scanners)) +$(eval $(call SaneBackend,canon,Canon SCSI scanners)) +$(eval $(call SaneBackend,canon630u,the Canon 630u USB flatbed scanner)) +$(eval $(call SaneBackend,canon_dr,Canon DR-series scanners)) +# Depends on libieee1284 +#$(eval $(call SaneBackend,canon_pp,Canon CanoScan Parallel Port flatbed scanners,+libieee1284)) +$(eval $(call SaneBackend,cardscan,Corex CardScan usb scanners)) +$(eval $(call SaneBackend,coolscan,Nikon film-scanners)) +$(eval $(call SaneBackend,coolscan2,Nikon Coolscan film scanners)) +$(eval $(call SaneBackend,coolscan3,Nikon Coolscan film scanners)) +$(eval $(call SaneBackend,dc210,Kodak DC210 Digital Camera,+libjpeg)) +$(eval $(call SaneBackend,dc240,Kodak DC240 Digital Camera,+libjpeg)) +$(eval $(call SaneBackend,dc25,Kodak DC20/DC25 Digital Cameras)) +$(eval $(call SaneBackend,dell1600n_net,Dell 1600n,+libtiff)) +$(eval $(call SaneBackend,dmc,Polaroid Digital Microscope Camera)) +$(eval $(call SaneBackend,epjitsu,Epson-based Fujitsu USB scanners)) +$(eval $(call SaneBackend,epson,EPSON scanners)) +$(eval $(call SaneBackend,epsonds,EPSON scanners,+libjpeg)) #### +$(eval $(call SaneBackend,epson2,EPSON scanners)) +$(eval $(call SaneBackend,fujitsu,Fujitsu flatbed and ADF scanners)) +$(eval $(call SaneBackend,genesys,GL646 GL841 GL843 GL847 and GL124 based USB flatbed scanners)) +#$(eval $(call SaneBackend,gphoto2,digital cameras supported by gphoto2,+libjpeg)) +$(eval $(call SaneBackend,gt68xx,GT-68XX based USB flatbed scanners)) +$(eval $(call SaneBackend,hp,HP ScanJet scanners)) +$(eval $(call SaneBackend,hp3500,Hewlett-Packard ScanJet 3500 series scanners)) +$(eval $(call SaneBackend,hp3900,RTS8822 chipset based scanners,+libtiff)) +$(eval $(call SaneBackend,hp4200,Hewlett-Packard 4200 scanners)) +$(eval $(call SaneBackend,hp5400,Hewlett-Packard 54XX scanners)) +$(eval $(call SaneBackend,hp5590,Hewlett-Packard 4500C/4570C/5500C/5550C/5590/7650 Workgroup/Document scanners)) +$(eval $(call SaneBackend,hpljm1005,Hewlett-Packard LaserJet M1005 MFP Scanner)) +# Depends on libieee1284 +#$(eval $(call SaneBackend,hpsj5s,HP ScanJet 5S sheet-fed scanner,+libieee1284)) +$(eval $(call SaneBackend,hs2p,Ricoh SCSI flatbed/ADF scanners)) +$(eval $(call SaneBackend,ibm,IBM and Ricoh SCSI flatbed scanners)) +$(eval $(call SaneBackend,kodak,big Kodak flatbed and ADF scanners)) +$(eval $(call SaneBackend,kodakaio,Kodak aio printer / scanners)) +$(eval $(call SaneBackend,kvs20xx,Panasonic KV-S20xxC USB/SCSI ADF scanners)) +$(eval $(call SaneBackend,kvs40xx,Panasonic KV-S40xxC USB/SCSI ADF scanners)) +$(eval $(call SaneBackend,kvs1025,Panasonic KV-S102xC USB ADF scanners)) +$(eval $(call SaneBackend,leo,LEO Technologies scanners)) +$(eval $(call SaneBackend,lexmark,Lexmark X1100/X1200 Series scanners)) +$(eval $(call SaneBackend,ma1509,Mustek BearPaw 1200F USB scanner)) +$(eval $(call SaneBackend,magicolor,KONICA MINOLTA magicolor scanners)) +$(eval $(call SaneBackend,matsushita,Panasonic KV-SS high speed scanners)) +$(eval $(call SaneBackend,microtek,Microtek scanners)) +$(eval $(call SaneBackend,microtek2,Microtek scanners with SCSI-2 command set)) +$(eval $(call SaneBackend,mustek,Mustek SCSI flatbed scanners and some other devices)) +# Depends on libieee1284 +#$(eval $(call SaneBackend,mustek_pp,Mustek parallel port flatbed scanners,+libieee1284)) +$(eval $(call SaneBackend,mustek_usb,Mustek USB flatbed scanners)) +$(eval $(call SaneBackend,mustek_usb2,SQ113 based USB flatbed scanners)) +$(eval $(call SaneBackend,nec,NEC scanners)) +$(eval $(call SaneBackend,net,network backend)) +$(eval $(call SaneBackend,niash,scanners based on the NIASH chipset)) +$(eval $(call SaneBackend,p5,the Primax PagePartner)) +$(eval $(call SaneBackend,pie,PIE Devcom and AdLib SCSI flatbed scanners)) +$(eval $(call SaneBackend,pieusb,PIE Devcom and AdLib SCSI flatbed scanners)) ##### +$(eval $(call SaneBackend,pixma,Canon Multi-Function Printers and CanoScan Scanners)) +$(eval $(call SaneBackend,plustek,LM983[1/2/3] based USB flatbed scanners)) +$(eval $(call SaneBackend,plustek_pp,Plustek parallel port flatbed scanners)) +$(eval $(call SaneBackend,qcam,Connectix QuickCam cameras,@(TARGET_x86||TARGET_x86_64))) +$(eval $(call SaneBackend,ricoh,Ricoh flatbed scanners)) +$(eval $(call SaneBackend,rts8891,rts8891 based scanners)) +$(eval $(call SaneBackend,s9036,Siemens 9036 flatbed scanners)) +$(eval $(call SaneBackend,sceptre,SCEPTRE scanners)) +$(eval $(call SaneBackend,sharp,SHARP scanners)) +$(eval $(call SaneBackend,sm3600,Microtek scanners with M011 USB chip)) +$(eval $(call SaneBackend,sm3840,Microtek scanners with SCAN08 USB chip)) +$(eval $(call SaneBackend,snapscan,AGFA SnapScan flatbed scanners)) +$(eval $(call SaneBackend,sp15c,Fujitsu ScanPartner 15C flatbed scanner)) +$(eval $(call SaneBackend,st400,Siemens ST/Highscan flatbed scanners)) +$(eval $(call SaneBackend,stv680,STV680 cameras)) +$(eval $(call SaneBackend,tamarack,Tamarack flatbed scanners)) +$(eval $(call SaneBackend,teco1,TECO / RELISYS scanners)) +$(eval $(call SaneBackend,teco2,TECO / RELISYS scanners)) +$(eval $(call SaneBackend,teco3,TECO / RELISYS scanners)) +$(eval $(call SaneBackend,test,testing frontends)) +$(eval $(call SaneBackend,u12,Plustek USB flatbed scanners based on older parport designs)) +$(eval $(call SaneBackend,umax,UMAX scanners)) +$(eval $(call SaneBackend,umax1220u,the UMAX Astra 1220U and similar scanners)) +$(eval $(call SaneBackend,umax_pp,Umax Astra parallel port flatbed scanners)) +$(eval $(call SaneBackend,v4l,Video for Linux API,+libv4l +libjpeg)) +$(eval $(call SaneBackend,xerox_mfp,Xerox Phaser 3200MFP device)) +$(eval $(call BuildPackage,sane-backends)) +$(eval $(call BuildPackage,sane-backends-all)) +$(eval $(call BuildPackage,sane-frontends)) diff --git a/utils/sane-backends/files/xinet.d_sane-port b/utils/sane-backends/files/xinet.d_sane-port new file mode 100644 index 0000000..9119973 --- /dev/null +++ b/utils/sane-backends/files/xinet.d_sane-port @@ -0,0 +1,14 @@ +# default: off +# description: The saned provides scanner service via the network. \ +# Applications like kooka, xsane or xscanimage can use the remote \ +# scanner. +service sane-port +{ + socket_type = stream + port = 6566 + wait = no + user = root + group = root + server = /usr/sbin/saned + disable = yes +} diff --git a/utils/sane-backends/patches/002-remove-uneeded.patch b/utils/sane-backends/patches/002-remove-uneeded.patch new file mode 100644 index 0000000..8348058 --- /dev/null +++ b/utils/sane-backends/patches/002-remove-uneeded.patch @@ -0,0 +1,11 @@ +--- a/Makefile.in ++++ b/Makefile.in +@@ -400,7 +400,7 @@ target_alias = @target_alias@ + top_build_prefix = @top_build_prefix@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ +-SUBDIRS = include lib sanei backend frontend tools doc po testsuite ++SUBDIRS = include lib sanei backend frontend + DIST_SUBDIRS = include lib sanei backend frontend tools doc po japi testsuite + dist_doc_DATA = AUTHORS ChangeLog COPYING LICENSE NEWS PROBLEMS PROJECTS \ + README README.aix README.beos README.darwin README.djpeg README.freebsd \ diff --git a/utils/sane-backends/patches/020-fix_pieusb.patch b/utils/sane-backends/patches/020-fix_pieusb.patch new file mode 100644 index 0000000..ae97040 --- /dev/null +++ b/utils/sane-backends/patches/020-fix_pieusb.patch @@ -0,0 +1,16 @@ +--- a/backend/pieusb_buffer.c ++++ b/backend/pieusb_buffer.c +@@ -104,11 +104,13 @@ + + /* When creating the release backend, make complains about unresolved external + * le16toh, although it finds the include */ ++#ifndef le16toh + #if __BYTE_ORDER == __LITTLE_ENDIAN + #define le16toh(x) (x) + #else + #define le16toh(x) __bswap_16 (x) + #endif ++#endif + + static void buffer_update_read_index(struct Pieusb_Read_Buffer* buffer, int increment); + diff --git a/utils/sane-backends/patches/030-musl.patch b/utils/sane-backends/patches/030-musl.patch new file mode 100644 index 0000000..7f0a5a2 --- /dev/null +++ b/utils/sane-backends/patches/030-musl.patch @@ -0,0 +1,73 @@ +--- a/include/sane/sanei_udp.h ++++ b/include/sane/sanei_udp.h +@@ -27,6 +27,9 @@ + #include + #include + #endif ++#ifdef HAVE_SYS_TYPES_H ++#include ++#endif + + extern SANE_Status sanei_udp_open(const char *host, int port, int *fdp); + extern SANE_Status sanei_udp_open_broadcast(int *fdp); +--- a/backend/kvs20xx_cmd.h ++++ b/backend/kvs20xx_cmd.h +@@ -9,6 +9,10 @@ + Panasonic KV-S20xx USB-SCSI scanners. + */ + ++#ifdef HAVE_SYS_TYPES_H ++#include ++#endif ++ + #define COMMAND_BLOCK 1 + #define DATA_BLOCK 2 + #define RESPONSE_BLOCK 3 +--- a/backend/kvs40xx.h ++++ b/backend/kvs40xx.h +@@ -10,6 +10,9 @@ + + #include "../include/sane/config.h" + #include ++#ifdef HAVE_SYS_TYPES_H ++#include ++#endif + + #undef BACKEND_NAME + #define BACKEND_NAME kvs40xx +--- a/backend/hp5400.c ++++ b/backend/hp5400.c +@@ -67,6 +67,9 @@ + #include /* malloc, free */ + #include /* memcpy */ + #include ++#ifdef HAVE_SYS_TYPES_H ++#include ++#endif + + + #define HP5400_CONFIG_FILE "hp5400.conf" +--- a/backend/hp5590.c ++++ b/backend/hp5590.c +@@ -48,6 +48,9 @@ + #include + #include + #include ++#ifdef HAVE_SYS_TYPES_H ++#include ++#endif + + #include "../include/sane/sane.h" + #define BACKEND_NAME hp5590 +--- a/backend/epsonds-io.c ++++ b/backend/epsonds-io.c +@@ -16,6 +16,9 @@ + #include "sane/config.h" + #include + #include /* sleep */ ++#ifdef HAVE_SYS_TYPES_H ++#include ++#endif + + #include "epsonds.h" + #include "epsonds-io.h" diff --git a/utils/sane-backends/patches/031-fix_uclibc.patch b/utils/sane-backends/patches/031-fix_uclibc.patch new file mode 100644 index 0000000..b7495a5 --- /dev/null +++ b/utils/sane-backends/patches/031-fix_uclibc.patch @@ -0,0 +1,38 @@ +--- a/configure.in ++++ b/configure.in +@@ -279,6 +279,9 @@ dnl ************************************ + dnl Checks for library functions + dnl *********************************************************************** + ++dnl Check mkostemp (missing in uclibc) ++AC_CHECK_FUNC(mkostemp) ++ + dnl Define SOCKET_LIB, NSL_LIB, BIND_LIB, and RESOLV_LIB when required + dnl for functions we use. + AC_CHECK_FUNC(gethostbyaddr,, [AC_CHECK_LIB(bind, gethostbyaddr, BIND_LIB="-lbind")]) +--- a/include/sane/config.h.in ++++ b/include/sane/config.h.in +@@ -207,6 +207,9 @@ + /* Define to 1 if you have the `mkdir' function. */ + #undef HAVE_MKDIR + ++/* Define to 1 if you have a working `mkostemp' function. */ ++#undef HAVE_MKOSTEMP ++ + /* Define to 1 if you have a working `mmap' system call. */ + #undef HAVE_MMAP + +--- a/backend/pieusb_buffer.c ++++ b/backend/pieusb_buffer.c +@@ -112,6 +112,11 @@ + #endif + #endif + ++#ifndef HAVE_MKOSTEMP ++/* uclibc might not implement mkostemp GNU extension */ ++#define mkostemp(template, flags) mkstemp(template) ++#endif ++ + static void buffer_update_read_index(struct Pieusb_Read_Buffer* buffer, int increment); + + /* READER */ diff --git a/utils/sane-backends/patches/050-remove_linked_libs_for_unused_preload.patch b/utils/sane-backends/patches/050-remove_linked_libs_for_unused_preload.patch new file mode 100644 index 0000000..bb01dd9 --- /dev/null +++ b/utils/sane-backends/patches/050-remove_linked_libs_for_unused_preload.patch @@ -0,0 +1,11 @@ +--- a/backend/Makefile.am ++++ b/backend/Makefile.am +@@ -1142,7 +1142,7 @@ EXTRA_DIST += dll.aliases + nodist_libsane_la_SOURCES = dll-s.c + libsane_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dll + libsane_la_LDFLAGS = $(DIST_LIBS_LDFLAGS) +-libsane_la_LIBADD = $(COMMON_LIBS) @PRELOADABLE_BACKENDS_ENABLED@ libdll_preload.la sane_strstatus.lo ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_pv8630.lo ../sanei/sanei_pp.lo ../sanei/sanei_thread.lo ../sanei/sanei_lm983x.lo ../sanei/sanei_access.lo ../sanei/sanei_net.lo ../sanei/sanei_wire.lo ../sanei/sanei_codec_bin.lo ../sanei/sanei_pa4s2.lo ../sanei/sanei_ab306.lo ../sanei/sanei_pio.lo ../sanei/sanei_tcp.lo ../sanei/sanei_udp.lo ../sanei/sanei_magic.lo $(DL_LIBS) $(LIBV4L_LIBS) $(MATH_LIB) $(IEEE1284_LIBS) $(TIFF_LIBS) $(JPEG_LIBS) $(GPHOTO2_LIBS) $(SOCKET_LIBS) $(USB_LIBS) $(AVAHI_LIBS) $(SCSI_LIBS) $(PTHREAD_LIBS) $(RESMGR_LIBS) ++libsane_la_LIBADD = $(COMMON_LIBS) @PRELOADABLE_BACKENDS_ENABLED@ libdll_preload.la sane_strstatus.lo ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_pv8630.lo ../sanei/sanei_pp.lo ../sanei/sanei_thread.lo ../sanei/sanei_lm983x.lo ../sanei/sanei_access.lo ../sanei/sanei_net.lo ../sanei/sanei_wire.lo ../sanei/sanei_codec_bin.lo ../sanei/sanei_pa4s2.lo ../sanei/sanei_ab306.lo ../sanei/sanei_pio.lo ../sanei/sanei_tcp.lo ../sanei/sanei_udp.lo ../sanei/sanei_magic.lo $(DL_LIBS) $(MATH_LIB) $(IEEE1284_LIBS) $(SOCKET_LIBS) $(USB_LIBS) $(PTHREAD_LIBS) $(RESMGR_LIBS) + + # WARNING: Automake is getting this wrong so have to do it ourselves. + libsane_la_DEPENDENCIES = $(COMMON_LIBS) @PRELOADABLE_BACKENDS_ENABLED@ libdll_preload.la sane_strstatus.lo ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_pv8630.lo ../sanei/sanei_pp.lo ../sanei/sanei_thread.lo ../sanei/sanei_lm983x.lo ../sanei/sanei_access.lo ../sanei/sanei_net.lo ../sanei/sanei_wire.lo ../sanei/sanei_codec_bin.lo ../sanei/sanei_pa4s2.lo ../sanei/sanei_ab306.lo ../sanei/sanei_pio.lo ../sanei/sanei_tcp.lo ../sanei/sanei_udp.lo ../sanei/sanei_magic.lo @SANEI_SANEI_JPEG_LO@ diff --git a/utils/screen/Makefile b/utils/screen/Makefile new file mode 100644 index 0000000..09e0ef9 --- /dev/null +++ b/utils/screen/Makefile @@ -0,0 +1,57 @@ +# +# Copyright (C) 2006-2015 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:=screen +PKG_VERSION:=4.3.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@GNU/screen +PKG_MD5SUM:=5bb3b0ff2674e29378c31ad3411170ad + +PKG_LICENSE:=GPL-3.0+ +PKG_LICENSE_FILES:= + +include $(INCLUDE_DIR)/package.mk + +define Package/screen + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Terminal + DEPENDS:=+libncurses + TITLE:=Full-screen terminal window manager + URL:=http://www.gnu.org/software/screen/ + MAINTAINER:=Etienne CHAMPETIER +endef + +define Package/screen/description + Screen is a full-screen window manager that multiplexes a physical + terminal between several processes, typically interactive shells. +endef + +define Build/Configure + $(call Build/Configure/Default,\ + --with-sys-screenrc=/etc/screenrc \ + ) + # XXX: memmove() works well with overlapped memory areas + echo "#define USEMEMMOVE 1" >>$(PKG_BUILD_DIR)/config.h +endef + +define Package/screen/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/screen $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) ./files/etc/screenrc $(1)/etc/screenrc +endef + +define Package/screen/conffiles +/etc/screenrc +endef + +$(eval $(call BuildPackage,screen)) diff --git a/utils/screen/files/etc/screenrc b/utils/screen/files/etc/screenrc new file mode 100644 index 0000000..3337674 --- /dev/null +++ b/utils/screen/files/etc/screenrc @@ -0,0 +1 @@ +startup_message off diff --git a/utils/screen/patches/100-cross_compile_fix.patch b/utils/screen/patches/100-cross_compile_fix.patch new file mode 100644 index 0000000..d9662b4 --- /dev/null +++ b/utils/screen/patches/100-cross_compile_fix.patch @@ -0,0 +1,64 @@ +--- a/configure ++++ b/configure +@@ -414,7 +414,7 @@ as_fn_error () + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 +- as_fn_exit $as_status ++ # as_fn_exit $as_status + } # as_fn_error + + if expr a : '\(a\)' >/dev/null 2>&1 && +@@ -5942,8 +5942,6 @@ else + fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +-test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec" +-test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow" + oldlibs="$LIBS" + LIBS="$LIBS -lsun" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking IRIX sun library..." >&5 +@@ -7024,7 +7022,7 @@ as_fn_error () + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 +- as_fn_exit $as_status ++ # as_fn_exit $as_status + } # as_fn_error + + +--- a/pty.c ++++ b/pty.c +@@ -39,9 +39,9 @@ + #endif + + /* for solaris 2.1, Unixware (SVR4.2) and possibly others */ +-#ifdef HAVE_STROPTS_H +-# include +-#endif ++//#ifdef HAVE_STROPTS_H ++//# include ++//#endif + + #if defined(sun) && defined(LOCKPTY) && !defined(TIOCEXCL) + # include +--- a/sched.h ++++ b/sched.h +@@ -27,6 +27,11 @@ + * $Id$ GNU + */ + ++#ifndef __SCHED_H ++#define __SCHED_H ++ ++#include ++ + struct event + { + struct event *next; +@@ -46,3 +51,5 @@ struct event + #define EV_READ 1 + #define EV_WRITE 2 + #define EV_ALWAYS 3 ++ ++#endif diff --git a/utils/screen/patches/110-do_not_add_srcdir_to_include_path.patch b/utils/screen/patches/110-do_not_add_srcdir_to_include_path.patch new file mode 100644 index 0000000..50d00b8 --- /dev/null +++ b/utils/screen/patches/110-do_not_add_srcdir_to_include_path.patch @@ -0,0 +1,11 @@ +--- a/Makefile.in ++++ b/Makefile.in +@@ -79,7 +79,7 @@ screen: $(OFILES) + $(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBS) + + .c.o: +- $(CC) -c -I. -I$(srcdir) $(M_CFLAGS) $(CPPFLAGS) $(DEFS) \ ++ $(CC) -c $(M_CFLAGS) $(CPPFLAGS) $(DEFS) \ + $(OPTIONS) $(CFLAGS) $< + + install_bin: .version screen diff --git a/utils/screen/patches/200-musl-compat.patch b/utils/screen/patches/200-musl-compat.patch new file mode 100644 index 0000000..cd783bd --- /dev/null +++ b/utils/screen/patches/200-musl-compat.patch @@ -0,0 +1,57 @@ +--- a/configure ++++ b/configure +@@ -4155,44 +4155,6 @@ fi + rm -f conftest* + + +-oldlibs="$LIBS" +-LIBS="$LIBS -lelf" +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking SVR4..." >&5 +-$as_echo "$as_me: checking SVR4..." >&6;} +-cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +-#include +- +-int +-main () +-{ +- +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_c_try_link "$LINENO"; then : +- ac_fn_c_check_header_mongrel "$LINENO" "dwarf.h" "ac_cv_header_dwarf_h" "$ac_includes_default" +-if test "x$ac_cv_header_dwarf_h" = xyes; then : +- $as_echo "#define SVR4 1" >>confdefs.h +- $as_echo "#define BUGGYGETLOGIN 1" >>confdefs.h +- +-else +- ac_fn_c_check_header_mongrel "$LINENO" "elf.h" "ac_cv_header_elf_h" "$ac_includes_default" +-if test "x$ac_cv_header_elf_h" = xyes; then : +- $as_echo "#define SVR4 1" >>confdefs.h +- $as_echo "#define BUGGYGETLOGIN 1" >>confdefs.h +- +-fi +- +- +-fi +- +- +- +-else +- LIBS="$oldlibs" +-fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + for ac_header in stropts.h string.h strings.h +--- a/utmp.c ++++ b/utmp.c +@@ -33,6 +33,7 @@ + #include "config.h" + #include "screen.h" + #include "extern.h" ++#include "os.h" + + #ifdef HAVE_UTEMPTER + #include diff --git a/utils/serialconsole/Makefile b/utils/serialconsole/Makefile new file mode 100644 index 0000000..fbf648e --- /dev/null +++ b/utils/serialconsole/Makefile @@ -0,0 +1,41 @@ +# +# 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:=sc +PKG_VERSION:=0.95 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/serialconsole/sc +PKG_MD5SUM:=4fe58576a5bddb9f1fb3dcfc6410b885 +PKG_MAINTAINER:=Stefan Bethke + +PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/serialconsole + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Terminal + TITLE:=Serial Console - minimal terminal program + URL:=http://sourceforge.net/projects/serialconsole/ +endef + +define Package/serialconsole/description +serialconsole (sc) is a minimal terminal program allowing to use one machine +to access the serial console of another machine. +endef + +define Package/serialconsole/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/sc $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,serialconsole)) diff --git a/utils/shadow/Makefile b/utils/shadow/Makefile new file mode 100644 index 0000000..d56be82 --- /dev/null +++ b/utils/shadow/Makefile @@ -0,0 +1,146 @@ +# +# Copyright (C) 2008-2015 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:=shadow +PKG_VERSION:=4.2.1 +PKG_RELEASE:=5 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=http://pkg-shadow.alioth.debian.org/releases +PKG_MD5SUM:=2bfafe7d4962682d31b5eba65dba4fc8 +PKG_MAINTAINER:=Steven Barth +PKG_LICENSE:=BSD-3-Clause + +PKG_FIXUP:=autoreconf +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +SHADOW_APPLETS := \ + chage groupadd groupdel groupmod groups passwd su \ + useradd userdel usermod + +CONFIGURE_ARGS += \ + --without-audit \ + --without-libpam \ + --without-selinux \ + --without-acl \ + --without-attr \ + --without-tcb \ + --without-nscd \ + --disable-subordinate-ids \ + +define Package/shadow/Default + SECTION:=utils + CATEGORY:=Utilities + TITLE:=The PLD Linux shadow utilities + URL:=http://pkg-shadow.alioth.debian.org/ +endef + +define Package/shadow + $(call Package/shadow/Default) + TITLE+= (all) + DEPENDS:=$(foreach u,$(SHADOW_APPLETS),+shadow-$(u)) + HIDDEN:=1 +endef + +define Package/shadow/description + Full versions of standard shadow utilities. Normally, you would not + use this package, since the functionality in BusyBox is more than + sufficient and much smaller. +endef + +define Package/shadow/install + true +endef + +define Package/shadow-utils + $(call Package/shadow/Default) +endef + +define Package/shadow-utils/config + menu "Select shadow utilities" + depends on PACKAGE_shadow-utils + + config shadow-all + bool "Include all PLD shadow utilities" + select PACKAGE_shadow + default y + + comment "Utilities" + + $(foreach u,$(SHADOW_APPLETS), \ + config PACKAGE_shadow-$(u) + prompt "Full PLD version of $(u) utility" + + ) + + endmenu + +endef + +Package/shadow-utils/description = $(Package/shadow/description) + +define Package/shadow-common + $(call Package/shadow/Default) + TITLE:=Shared definitions for the PLD Linux shadow utilities + DEPENDS:=$(ICONV_DEPENDS) $(INTL_DEPENDS) + HIDDEN:=1 +endef + +define GenPlugin + define Package/shadow-$(1) + $(call Package/shadow/Default) + TITLE:=Utility $(1) from the PLD Linux shadow utilities + DEPENDS:=+shadow-common + HIDDEN:=1 + endef + + define Package/shadow-$(1)/description + Full version of standard $(1) utility. Normally, you would not use this + package, since the functionality in BusyBox is more than sufficient. + endef +endef + +$(foreach u,$(SHADOW_APPLETS),$(eval $(call GenPlugin,$(u)))) + +define Package/shadow-common/conffiles +/etc/login.defs +endef + +define Package/shadow-common/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/login.defs $(1)/etc/ +endef + +define Package/shadow-utils/install + true +endef + +define BuildPlugin + define Package/shadow-$(1)/install + [ -x "$(PKG_INSTALL_DIR)/usr/sbin/$(1)" ] && { \ + $(INSTALL_DIR) $$(1)/usr/sbin; \ + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/$(1) $$(1)/usr/sbin/; \ + } || { \ + $(INSTALL_DIR) $$(1)/usr/bin; \ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin/; \ + } + endef + + $$(eval $$(call BuildPackage,shadow-$(1))) +endef + +$(foreach u,$(SHADOW_APPLETS),$(eval $(call BuildPlugin,$(u)))) + +$(eval $(call BuildPackage,shadow-utils)) +$(eval $(call BuildPackage,shadow-common)) +$(eval $(call BuildPackage,shadow)) diff --git a/utils/shadow/patches/001-busybox_ash.patch b/utils/shadow/patches/001-busybox_ash.patch new file mode 100644 index 0000000..a16dad2 --- /dev/null +++ b/utils/shadow/patches/001-busybox_ash.patch @@ -0,0 +1,11 @@ +--- a/etc/login.defs ++++ b/etc/login.defs +@@ -111,7 +111,7 @@ NOLOGINS_FILE /etc/nologin + # command as "-su". If not defined, then ps(1) will display the + # name of the shell actually being run, e.g. something like "-sh". + # +-SU_NAME su ++#SU_NAME su + + # + # *REQUIRED* diff --git a/utils/shadow/patches/002-disable-ruser-lookup.patch b/utils/shadow/patches/002-disable-ruser-lookup.patch new file mode 100644 index 0000000..a7ef1f7 --- /dev/null +++ b/utils/shadow/patches/002-disable-ruser-lookup.patch @@ -0,0 +1,10 @@ +--- a/configure.in ++++ b/configure.in +@@ -197,7 +197,6 @@ dnl XXX - quick hack, should disappear b + AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().]) + if test "$ac_cv_func_ruserok" = "yes"; then + AC_DEFINE(RLOGIN, 1, [Define if login should support the -r flag for rlogind.]) +- AC_DEFINE(RUSEROK, 0, [Define to the ruserok() "success" return value (0 or 1).]) + fi + + AC_ARG_ENABLE(shadowgrp, diff --git a/utils/shadow/patches/003-fix-disabling-subids.patch b/utils/shadow/patches/003-fix-disabling-subids.patch new file mode 100644 index 0000000..bbc65c7 --- /dev/null +++ b/utils/shadow/patches/003-fix-disabling-subids.patch @@ -0,0 +1,32 @@ +--- a/src/usermod.c ++++ b/src/usermod.c +@@ -1361,6 +1361,7 @@ static void process_flags (int argc, cha + exit (E_UID_IN_USE); + } + ++#ifdef ENABLE_SUBIDS + if ( (vflg || Vflg) + && !is_sub_uid) { + fprintf (stderr, +@@ -1376,6 +1377,7 @@ static void process_flags (int argc, cha + Prog, sub_gid_dbname (), "-w", "-W"); + exit (E_USAGE); + } ++#endif + } + + /* +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -52,7 +52,10 @@ usbin_PROGRAMS = \ + noinst_PROGRAMS = id sulogin + + suidbins = su +-suidubins = chage chfn chsh expiry gpasswd newgrp passwd newuidmap newgidmap ++suidubins = chage chfn chsh expiry gpasswd newgrp passwd ++if ENABLE_SUBIDS ++ suidubins += newuidmap newgidmap ++endif + if ACCT_TOOLS_SETUID + suidubins += chage chgpasswd chpasswd groupadd groupdel groupmod newusers useradd userdel usermod + endif diff --git a/utils/shadow/patches/004-fix-su-controoling-term.patch b/utils/shadow/patches/004-fix-su-controoling-term.patch new file mode 100644 index 0000000..4c130c7 --- /dev/null +++ b/utils/shadow/patches/004-fix-su-controoling-term.patch @@ -0,0 +1,16 @@ +--- a/src/su.c ++++ b/src/su.c +@@ -1090,8 +1090,12 @@ + + if (fd >= 0) { + err = ioctl (fd, TIOCNOTTY, (char *) 0); ++ if (-1 == err && ENOTTY == errno) { ++ /* There are no controlling terminal already */ ++ err = 0; ++ } + (void) close (fd); +- } else if (ENXIO == errno) { ++ } else if (ENXIO == errno || EACCES == errno) { + /* There are no controlling terminal already */ + err = 0; + } diff --git a/utils/sispmctl/Makefile b/utils/sispmctl/Makefile new file mode 100644 index 0000000..ad6c1e3 --- /dev/null +++ b/utils/sispmctl/Makefile @@ -0,0 +1,56 @@ +# +# 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:=sispmctl +PKG_VERSION:=3.1+20120206 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=5ff4a05a5bcb6a64a9d6f77fed47014512f66b11 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=git://git.code.sf.net/p/sispmctl/git +PKG_MAINTAINER:=Richard Kunze +PKG_LICENSE:=GPL-2.0+ + +PKG_INSTALL:=1 +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/sispmctl + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Silver Shield PM Control for Linux + URL:=http://sispmctl.sourceforge.net/ + DEPENDS:=+libusb-compat +endef + +define Package/sispmctl/description + The sispmctl tool can control Gembird SIS-PM Silver Shield + programmable power outlet strips (also known under the name + Revolt Intelli-Plug) from the command line. + . + It can be used to switch on or off any of the programmable + power sockets of the SIS-PM via USB. It can also show the + current status of each power socket, and it can handle + multiple SIS-PM devices, too. +endef + +TARGET_CFLAGS += -D_GNU_SOURCE +CONFIGURE_ARGS += \ + --enable-webless \ + --disable-dependency-tracking + +define Package/sispmctl/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,sispmctl)) diff --git a/utils/sispmctl/patches/001-fix-includes.patch b/utils/sispmctl/patches/001-fix-includes.patch new file mode 100644 index 0000000..218e22e --- /dev/null +++ b/utils/sispmctl/patches/001-fix-includes.patch @@ -0,0 +1,25 @@ +--- a/src/sispm_ctl.c ++++ b/src/sispm_ctl.c +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + #include + #include + #include "sispm_ctl.h" +--- a/src/main.c ++++ b/src/main.c +@@ -34,11 +34,11 @@ + #define __USE_XOPEN + #include + #include +-#include + #include + #include + #include + #include ++#include + + #include + diff --git a/utils/slide-switch/Makefile b/utils/slide-switch/Makefile new file mode 100644 index 0000000..c0dfef9 --- /dev/null +++ b/utils/slide-switch/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2016 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:=slide-switch +PKG_VERSION:=0.9.0 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/jefferyto/openwrt-slide-switch.git +PKG_SOURCE_VERSION:=9171c2ea9cc9cbfb6f27b7bc25a535c8c35ee534 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_BUILD_PARALLEL:=1 +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Jeffery To + +include $(INCLUDE_DIR)/package.mk + +define Package/slide-switch + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+jshn +jsonfilter + TITLE:=Translate switch position changes into normal button presses + URL:=https://github.com/jefferyto/openwrt-slide-switch +endef + +define Package/slide-switch/description +slide-switch translates slide switch position changes into normal button +presses and releases for OpenWrt / LEDE devices. +endef + +CONFIGURE_ARGS += --with-platform=$(BOARD) + +define Package/slide-switch/install + $(INSTALL_DIR) $(1)/etc/hotplug.d/button + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/hotplug.d/button/50-slide-switch $(1)/etc/hotplug.d/button + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/init.d/zzz-slide-switch $(1)/etc/init.d + if [ -d $(PKG_INSTALL_DIR)/usr/lib/slide-switch ]; then \ + $(INSTALL_DIR) $(1)/usr/lib/slide-switch; \ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/slide-switch/* $(1)/usr/lib/slide-switch; \ + fi + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/slide-switch $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/share/slide-switch + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/slide-switch/functions.sh $(1)/usr/share/slide-switch +endef + +$(eval $(call BuildPackage,slide-switch)) diff --git a/utils/smartmontools/Makefile b/utils/smartmontools/Makefile new file mode 100644 index 0000000..88d6840 --- /dev/null +++ b/utils/smartmontools/Makefile @@ -0,0 +1,91 @@ +# +# Copyright (C) 2006-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/uclibc++.mk + +PKG_NAME:=smartmontools +PKG_VERSION:=6.5 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/smartmontools +PKG_MD5SUM:=093aeec3f8f39fa9a37593c4012d3156 +PKG_MAINTAINER:=Maxim Storchak +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=COPYING + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/smartmontools/Default + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=$(CXX_DEPENDS) + TITLE:=S.M.A.R.T Monitoring + URL:=http://smartmontools.sourceforge.net/ +endef + +define Package/smartmontools + $(call Package/smartmontools/Default) + TITLE+= Tool +endef + +define Package/smartmontools/description + smartmontools contains utility programs (smartctl) to + control/monitor storage systems using the Self-Monitoring, Analysis + and Reporting Technology System (S.M.A.R.T.) built into most modern + ATA and SCSI disks. It is derived from smartsuite. +endef + +define Package/smartd + $(call Package/smartmontools/Default) + TITLE+= Daemon +endef + +define Package/smartd/description + smartmontools contains utility programs (smartd) to + control/monitor storage systems using the Self-Monitoring, Analysis + and Reporting Technology System (S.M.A.R.T.) built into most modern + ATA and SCSI disks. It is derived from smartsuite. +endef + +# uses GNU configure + +CONFIGURE_VARS += \ + CXXFLAGS="$$$$CXXFLAGS -fno-builtin -fno-rtti -nostdinc++" \ + CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/uClibc++ -I$(LINUX_DIR)/include" \ + LDFLAGS="$$$$LDFLAGS" \ + LIBS="-nodefaultlibs -lc -luClibc++ -lm $(LIBGCC_S) -lc" \ + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + BUILD_INFO='"(localbuild)"' \ + LD="$(TARGET_CXX)" +endef + +define Package/smartmontools/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/smartctl $(1)/usr/sbin/ +endef + +define Package/smartd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/smartd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) ./files/smartd.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/smartd.init $(1)/etc/init.d/smartd +endef + +define Package/smartd/conffiles +/etc/smartd.conf +endef + +$(eval $(call BuildPackage,smartmontools)) +$(eval $(call BuildPackage,smartd)) diff --git a/utils/smartmontools/files/smartd.conf b/utils/smartmontools/files/smartd.conf new file mode 100644 index 0000000..0740fcf --- /dev/null +++ b/utils/smartmontools/files/smartd.conf @@ -0,0 +1 @@ +/dev/hdb -H diff --git a/utils/smartmontools/files/smartd.init b/utils/smartmontools/files/smartd.init new file mode 100644 index 0000000..f1453f2 --- /dev/null +++ b/utils/smartmontools/files/smartd.init @@ -0,0 +1,16 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=95 + +start() { + service_start /usr/sbin/smartd -q never +} + +stop() { + service_stop /usr/sbin/smartd +} + +reload() { + service_reload /usr/sbin/smartd +} diff --git a/utils/smstools3/Makefile b/utils/smstools3/Makefile new file mode 100644 index 0000000..9df7698 --- /dev/null +++ b/utils/smstools3/Makefile @@ -0,0 +1,68 @@ +# +# 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:=smstools3 +PKG_VERSION:=3.1.15 +PKG_RELEASE:=3 + +PKG_MAINTAINER:=Gérald Kerma +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_PARALLEL:=0 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://smstools3.kekekasvi.com/packages/ +PKG_MD5SUM:=0241ef60e646fac1a06254a848e61ed7 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/smstools3 + SECTION:=utils + CATEGORY:=Utilities + TITLE:=SMS Server Tools 3 + DEPENDS:=$(ICONV_DEPENDS) + URL:=http://smstools3.kekekasvi.com/ +endef + +define Package/smstools3/description + The SMS Server Tools 3 is a SMS Gateway software which can send and receive + short messages through GSM modems and mobile phones. +endef + +TARGET_CFLAGS += -D NUMBER_OF_MODEMS=1 +TARGET_CFLAGS += $(if $(ICONV_FULL),-D USE_ICONV) +TARGET_CFLAGS += -D DISABLE_INET_SOCKET +TARGET_CFLAGS += -W -Wall +TARGET_CFLAGS += -D_FILE_OFFSET_BITS=64 + +MAKE_VARS += LFLAGS="$(TARGET_LDFLAGS) $(if $(ICONV_FULL),-liconv)" + +BINDIR=/usr/local/bin + +define Package/smstools3/configure +endef + +define Package/smstools3/install + $(INSTALL_DIR) $(1)/$(BINDIR) + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/smsd $(1)/$(BINDIR)/smsd + $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/sendsms $(1)/$(BINDIR)/sendsms + $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/sms2html $(1)/$(BINDIR)/sms2html + $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/sms2unicode $(1)/$(BINDIR)/sms2unicode + $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/unicode2sms $(1)/$(BINDIR)/unicode2sms + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DATA) -m 0755 ./files/smstools3.init $(1)/etc/init.d/smstools3 + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) -m 0755 ./files/smstools3.conf $(1)/etc/smsd.conf +endef + +$(eval $(call BuildPackage,smstools3)) diff --git a/utils/smstools3/files/smstools3.conf b/utils/smstools3/files/smstools3.conf new file mode 100644 index 0000000..c8732e3 --- /dev/null +++ b/utils/smstools3/files/smstools3.conf @@ -0,0 +1,20 @@ +# +# Description: Main configuration file for the smsd +# + +devices = GSM1 +incoming = /var/spool/sms/incoming +outgoing = /var/spool/sms/outgoing +checked = /var/spool/sms/checked +failed = /var/spool/sms/failed +sent = /var/spool/sms/sent +receive_before_send = no +autosplit = 3 + +[GSM1] +init = AT+CPMS="ME","ME","ME" +device = /dev/ttyUSB0 +incoming = yes +pin = 0000 +baudrate = 9600 + diff --git a/utils/smstools3/files/smstools3.init b/utils/smstools3/files/smstools3.init new file mode 100644 index 0000000..6598795 --- /dev/null +++ b/utils/smstools3/files/smstools3.init @@ -0,0 +1,152 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014 OpenWrt.org +# smsd initscript openwrt mod + +START=99 +STOP=99 + +EXTRA_COMMANDS="status" +EXTRA_HELP=" status View pid and service status " + +# Set USER and GROUP, if necessary: +USER="" +GROUP="" + +# If an unpriviledged user is selected, make sure that next two +# files are writable by that user: +PIDFILE="/var/run/smsd.pid" +INFOFILE="/var/run/smsd.working" +# Logfile can also be defined in here: +LOGFILE="/var/log/smsd.log" + +DAEMON=/usr/local/bin/smsd +# A program which turns power off for couple of seconds: +RESETMODEMS=/usr/local/bin/smsd_resetmodems +NAME=smsd +PSOPT="" + +# Set/edit this before starting service !!!!! +WRT_SPOOL=/var/spool + +# Maximum time to stop smsd, after that it gets killed hardly: +MAXWAIT=45 + +boot() { + start +} + +start() { + test -x $DAEMON || exit 0 + + echo "Creating minimum spool directories" + mkdir -p $WRT_SPOOL + mkdir -p $WRT_SPOOL/sms + mkdir -p $WRT_SPOOL/sms/incoming + mkdir -p $WRT_SPOOL/sms/outgoing + mkdir -p $WRT_SPOOL/sms/checked + mkdir -p $WRT_SPOOL/sms/failed + mkdir -p $WRT_SPOOL/sms/sent + + echo -n "Starting SMS Daemon: " + MSG="." + ARGS="-n MAINPROCESS -p$PIDFILE -i$INFOFILE" + [ "x$USER" != x ] && ARGS="$ARGS -u$USER" + [ "x$GROUP" != x ] && ARGS="$ARGS -g$GROUP" + [ "x$LOGFILE" != x ] && ARGS="$ARGS -l$LOGFILE" + PID=`cat $PIDFILE 2>/dev/null` + if [ "x$PID" != x ]; then + if kill -0 $PID 2>/dev/null; then + MSG=" already running ($PID)." + else + PID="" + fi + fi + if [ "x$PID" = x ]; then + if ps $PSOPT | grep $NAME | grep -v grep >/dev/null; then + MSG=" already running." + else + $DAEMON $ARGS + sleep 1 + PIDS=`ps $PSOPT | grep $NAME | grep -v grep` + [ "x$PIDS" = x ] && MSG=" failed." + fi + fi + echo "$NAME$MSG" +} + +stop() { + if ps $PSOPT | grep $NAME | grep -v grep >/dev/null; then + PID=`cat $PIDFILE 2>/dev/null` + if [ "x$PID" != x ]; then + P=`kill -0 $PID 2>/dev/null` + [ "x$P" != x ] && PID="" + fi + if [ "x$PID" != x ]; then + kill $PID + else + kill `ps $PSOPT | grep $NAME | grep -v grep | awk '{print $1}'` >/dev/null 2>&1 + fi + sleep 1 + if ps $PSOPT | grep $NAME | grep -v grep >/dev/null; then + echo "Allowing $NAME to terminate gracefully within $MAXWAIT seconds" + infofound=0 + dots=0 + seconds=0 + while ps $PSOPT | grep $NAME | grep -v grep >/dev/null; do + if [ $infofound -lt 1 ]; then + if [ -f $INFOFILE ]; then + infofound=1 + if [ $dots -gt 0 ]; then + echo "" + dots=0 + fi + $ECHO -n "$NAME is currently " + cat $INFOFILE + echo "Time counting is now disabled and we will wait until this job is complete." + fi + fi + [ $infofound -lt 1 ] && seconds=`expr $seconds + 1` + echo -n "." + dots=`expr $dots + 1` + if [ "$seconds" -ge $MAXWAIT ]; then + if [ $dots -gt 0 ]; then + echo "" + dots=0 + fi + echo "Timeout occurred, killing $NAME hardly." + kill -9 `ps $PSOPT | grep $NAME | grep -v grep | awk '{print $1}'` >/dev/null 2>&1 + [ -f $PIDFILE ] && rm $PIDFILE + seconds=0 + fi + sleep 1 + done + [ $dots -gt 0 ] && echo "" + #echo "$NAME is stopped." + fi + fi +} + +restart() { + stop + start +} + + +status() { + PID=$(cat $PIDFILE) + + test -e $PIDFILE + if [ $? == 0 ]; then + echo $NAME " running! pid $PID" + else + echo $NAME " not running !!!" + fi +} + +reset() { + $0 stop + [ -f "$RESETMODEMS" ] && "$RESETMODEMS" + sleep 30 + $0 start +} + diff --git a/utils/smstools3/patches/001-smsd.patch b/utils/smstools3/patches/001-smsd.patch new file mode 100644 index 0000000..6761661 --- /dev/null +++ b/utils/smstools3/patches/001-smsd.patch @@ -0,0 +1,13 @@ +--- a/src/smsd.c 2010-09-21 13:47:48.000000000 +0300 ++++ b/src/smsd.c 2013-03-05 05:26:26.000000000 +0300 +@@ -5200,8 +5200,8 @@ + int result = 1; + char *cmd; + char *p; +- char answer[500]; +- char buffer[600]; ++ char answer[1024]; ++ char buffer[1024]; + int fd; + int log_retry = 3; + int i; diff --git a/utils/smstools3/patches/002-Makefile.patch b/utils/smstools3/patches/002-Makefile.patch new file mode 100644 index 0000000..1e5630f --- /dev/null +++ b/utils/smstools3/patches/002-Makefile.patch @@ -0,0 +1,20 @@ +--- a/src/Makefile ++++ b/src/Makefile +@@ -1,7 +1,7 @@ + # In case of windows, use os_cygwin=yes setting in the configuration file (smsd.conf). + + # Select your setup size: +-CFLAGS = -D NUMBER_OF_MODEMS=64 ++CFLAGS ?= -D NUMBER_OF_MODEMS=64 + + # Uncomment for Solaris + # CFLAGS += -D SOLARIS +@@ -43,7 +43,7 @@ smsd: smsd.c extras.o locking.o cfgfile. + + ifneq (,$(findstring SOLARIS,$(CFLAGS))) + ifeq (,$(findstring DISABLE_INET_SOCKET,$(CFLAGS))) +-override LFLAGS += -lsocket -lnsl ++ override LFLAGS += -lsocket -lnsl + endif + endif + diff --git a/utils/sockread/Makefile b/utils/sockread/Makefile new file mode 100644 index 0000000..d3c15d4 --- /dev/null +++ b/utils/sockread/Makefile @@ -0,0 +1,35 @@ +# +# This software is licensed under the CC0-1.0 license. +# +include $(TOPDIR)/rules.mk + +PKG_NAME:=sockread +PKG_VERSION:=1.0 +PKG_RELEASE:=1 +PKG_LICENSE:=CC0-1.0 + +include $(INCLUDE_DIR)/package.mk + +define Package/sockread + SECTION:=utils + CATEGORY:=Utilities + TITLE:=sockread + MAINTAINER:=Moritz Warning +endef + +define Package/sockread/description + sockread writes and reads data from a Unix domain socket + represented as a special file on the file system. +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) + $(CP) ./src/* $(PKG_BUILD_DIR)/ +endef + +define Package/sockread/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/sockread $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,sockread)) diff --git a/utils/sockread/src/Makefile b/utils/sockread/src/Makefile new file mode 100644 index 0000000..fe4f8a7 --- /dev/null +++ b/utils/sockread/src/Makefile @@ -0,0 +1,11 @@ +CC ?= gcc +CFLAGS ?= -O2 -Wall -pedantic +CFLAGS += -std=gnu99 + +.PHONY: clean + +sockread: + $(CC) $(CFLAGS) main.c -o sockread + +clean: + rm -f sockread diff --git a/utils/sockread/src/main.c b/utils/sockread/src/main.c new file mode 100644 index 0000000..06c21de --- /dev/null +++ b/utils/sockread/src/main.c @@ -0,0 +1,63 @@ + +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) { + char buf[1024]; + ssize_t r; + + if (argc != 2) { + fprintf(stderr, "Write to and read from a Unix domain socket.\n\nUsage: %s \n", argv[0]); + return 1; + } + + size_t addrlen = strlen(argv[1]); + + /* Allocate enough space for arbitrary-length paths */ + char addrbuf[offsetof(struct sockaddr_un, sun_path) + addrlen + 1]; + memset(addrbuf, 0, sizeof(addrbuf)); + + struct sockaddr_un *addr = (struct sockaddr_un *)addrbuf; + addr->sun_family = AF_UNIX; + memcpy(addr->sun_path, argv[1], addrlen+1); + + int fd = socket(AF_UNIX, SOCK_STREAM, 0); + if (fd < 0) { + fprintf(stderr, "Failed to create socket: %s\n", strerror(errno)); + return 1; + } + + if (connect(fd, (struct sockaddr*)addr, sizeof(addrbuf)) < 0) { + fprintf(stderr, "Can't connect to `%s': %s\n", argv[1], strerror(errno)); + return 1; + } + + /* Check if stdin refers to a terminal */ + if (!isatty(fileno(stdin))) { + /* Read from stdin and write to socket */ + while (0 < (r = fread(buf, 1, sizeof(buf), stdin))) { + send(fd, buf, r, 0); + } + } + + /* Read from socket and write to stdout */ + while (1) { + r = recv(fd, buf, sizeof(buf), 0); + if (r < 0) { + fprintf(stderr, "read: %s\n", strerror(errno)); + return 1; + } + + if (r == 0) + return 0; + + fwrite(buf, r, 1, stdout); + } + + return 0; +} diff --git a/utils/spi-tools/Makefile b/utils/spi-tools/Makefile new file mode 100644 index 0000000..ca4da88 --- /dev/null +++ b/utils/spi-tools/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2014-2015 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:=spi-tools +PKG_VERSION:=1 + +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/cpb-/spi-tools.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=cc6a41fdcec60610703ba6db488c621c64952898 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_MAINTAINER:=John Crispin + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:= + +include $(INCLUDE_DIR)/package.mk + +define Package/spi-tools + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Command line SPI tools +endef + +EXTRA_CFLAGS+=-DVERSION=\"$(PKG_SOURCE_VERSION)\" + +define Build/Compile + cd $(PKG_BUILD_DIR) ; \ + $(TARGET_CC) $(TARGET_CFLAGS) $(EXTRA_CFLAGS) -Wall -Werror -o spi-config src/spi-config.c ; \ + $(TARGET_CC) $(TARGET_CFLAGS) $(EXTRA_CFLAGS) -Wall -Werror -o spi-pipe src/spi-pipe.c +endef + +define Package/spi-tools/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/spi-config $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/spi-pipe $(1)/usr/bin +endef + +$(eval $(call BuildPackage,spi-tools)) diff --git a/utils/squashfs-tools/Config.in b/utils/squashfs-tools/Config.in new file mode 100644 index 0000000..eae3ae1 --- /dev/null +++ b/utils/squashfs-tools/Config.in @@ -0,0 +1,17 @@ +config SQUASHFS_TOOLS_LZO_SUPPORT + depends on PACKAGE_squashfs-tools-mksquashfs || PACKAGE_squashfs-tools-unsquashfs + bool "Enable LZO support" + select PACKAGE_liblzo + default n + +config SQUASHFS_TOOLS_LZ4_SUPPORT + depends on PACKAGE_squashfs-tools-mksquashfs || PACKAGE_squashfs-tools-unsquashfs + bool "Enable LZ4 support" + select PACKAGE_liblz4 + default n + +config SQUASHFS_TOOLS_XZ_SUPPORT + depends on PACKAGE_squashfs-tools-mksquashfs || PACKAGE_squashfs-tools-unsquashfs + bool "Enable XZ support" + select PACKAGE_liblzma + default n diff --git a/utils/squashfs-tools/Makefile b/utils/squashfs-tools/Makefile new file mode 100644 index 0000000..b904fa4 --- /dev/null +++ b/utils/squashfs-tools/Makefile @@ -0,0 +1,87 @@ +# +# Copyright (C) 2016 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:=squashfs-tools +PKG_VERSION:=4.3 +PKG_RELEASE:=3 +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/plougher/squashfs-tools +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=9c1db6d13a51a2e009f0027ef336ce03624eac0d +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_BUILD_PARALLEL:=1 +include $(INCLUDE_DIR)/package.mk + +define Package/squashfs-tools/Default + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Filesystem + TITLE:=squashfs-tools + URL:=https://github.com/plougher/squashfs-tools + DEPENDS += +libpthread +zlib \ + +SQUASHFS_TOOLS_LZO_SUPPORT:liblzo \ + +SQUASHFS_TOOLS_LZ4_SUPPORT:liblz4 \ + +SQUASHFS_TOOLS_XZ_SUPPORT:liblzma + MAINTAINER:=Alexandru Ardelean +endef + +define Package/squashfs-tools-mksquashfs + $(call Package/squashfs-tools/Default) + TITLE+= mksquashfs +endef + +define Package/squashfs-tools-unsquashfs + $(call Package/squashfs-tools/Default) + TITLE+= unsquashfs +endef + +define Package/squashfs-tools-unsquashfs/config + source "$(SOURCE)/Config.in" +endef + +Build/Configure:= + +MAKE_FLAGS += \ + XATTR_SUPPORT= + +ifneq ($(CONFIG_SQUASHFS_TOOLS_XZ_SUPPORT),) +MAKE_FLAGS += XZ_SUPPORT=1 +endif + +ifneq ($(CONFIG_SQUASHFS_TOOLS_LZO_SUPPORT),) +MAKE_FLAGS += LZO_SUPPORT=1 +endif + +ifneq ($(CONFIG_SQUASHFS_TOOLS_LZ4_SUPPORT),) +MAKE_FLAGS += LZ4_SUPPORT=1 +endif + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR)/squashfs-tools \ + CC="$(TARGET_CC)" \ + $(MAKE_FLAGS) \ + mksquashfs unsquashfs +endef + +define Package/squashfs-tools-mksquashfs/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/squashfs-tools/mksquashfs $(1)/usr/sbin/mksquashfs +endef + +define Package/squashfs-tools-unsquashfs/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/squashfs-tools/unsquashfs $(1)/usr/sbin/unsquashfs +endef + +$(eval $(call BuildPackage,squashfs-tools-mksquashfs)) +$(eval $(call BuildPackage,squashfs-tools-unsquashfs)) diff --git a/utils/squashfs-tools/patches/0001-squashfs-tools-fix-fnmatch.h-compatibility-with-musl.patch b/utils/squashfs-tools/patches/0001-squashfs-tools-fix-fnmatch.h-compatibility-with-musl.patch new file mode 100644 index 0000000..5bfd28d --- /dev/null +++ b/utils/squashfs-tools/patches/0001-squashfs-tools-fix-fnmatch.h-compatibility-with-musl.patch @@ -0,0 +1,120 @@ +From a0c129760ca9bdc7e564ae2a508fac3799f9d39b Mon Sep 17 00:00:00 2001 +From: Alexandru Ardelean +Date: Wed, 6 Jan 2016 15:33:43 +0200 +Subject: [PATCH 1/2] squashfs-tools: with fnmatch.h compatibility with musl + +Signed-off-by: Alexandru Ardelean +--- + squashfs-tools/action.c | 2 +- + squashfs-tools/fnmatch_compat.h | 32 ++++++++++++++++++++++++++++++++ + squashfs-tools/mksquashfs.c | 2 +- + squashfs-tools/unsquashfs.c | 1 + + squashfs-tools/unsquashfs.h | 1 - + 5 files changed, 35 insertions(+), 3 deletions(-) + create mode 100644 squashfs-tools/fnmatch_compat.h + +diff --git a/squashfs-tools/action.c b/squashfs-tools/action.c +index 35889a4..4b06ccb 100644 +--- a/squashfs-tools/action.c ++++ b/squashfs-tools/action.c +@@ -31,7 +31,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -43,6 +42,7 @@ + #include "mksquashfs.h" + #include "action.h" + #include "error.h" ++#include "fnmatch_compat.h" + + /* + * code to parse actions +diff --git a/squashfs-tools/fnmatch_compat.h b/squashfs-tools/fnmatch_compat.h +new file mode 100644 +index 0000000..7b4afd8 +--- /dev/null ++++ b/squashfs-tools/fnmatch_compat.h +@@ -0,0 +1,32 @@ ++#ifndef FNMATCH_COMPAT ++#define FNMATCH_COMPAT ++/* ++ * Squashfs ++ * ++ * Copyright (c) 2015 ++ * Phillip Lougher ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * fnmatch_compat.h ++ */ ++ ++#include ++ ++#ifndef FNM_EXTMATCH ++#define FNM_EXTMATCH 0 ++#endif ++ ++#endif +diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c +index d221c35..4e7cbdd 100644 +--- a/squashfs-tools/mksquashfs.c ++++ b/squashfs-tools/mksquashfs.c +@@ -46,7 +46,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -76,6 +75,7 @@ + #include "read_fs.h" + #include "restore.h" + #include "process_fragments.h" ++#include "fnmatch_compat.h" + + int delete = FALSE; + int fd; +diff --git a/squashfs-tools/unsquashfs.c b/squashfs-tools/unsquashfs.c +index 1323dd6..2428baa 100644 +--- a/squashfs-tools/unsquashfs.c ++++ b/squashfs-tools/unsquashfs.c +@@ -30,6 +30,7 @@ + #include "xattr.h" + #include "unsquashfs_info.h" + #include "stdarg.h" ++#include "fnmatch_compat.h" + + #include + #include +diff --git a/squashfs-tools/unsquashfs.h b/squashfs-tools/unsquashfs.h +index ecd0bb4..0edbd25 100644 +--- a/squashfs-tools/unsquashfs.h ++++ b/squashfs-tools/unsquashfs.h +@@ -40,7 +40,6 @@ + #include + #include + #include +-#include + #include + #include + #include +-- +2.1.4 + diff --git a/utils/squashfs-tools/patches/0002-pseudo.c-add-explicit-stat.h-include.patch b/utils/squashfs-tools/patches/0002-pseudo.c-add-explicit-stat.h-include.patch new file mode 100644 index 0000000..8f10211 --- /dev/null +++ b/utils/squashfs-tools/patches/0002-pseudo.c-add-explicit-stat.h-include.patch @@ -0,0 +1,25 @@ +From 0ea07a1b5ddb2f2fa1358b2c1b42bcf34bbf5ee2 Mon Sep 17 00:00:00 2001 +From: Alexandru Ardelean +Date: Wed, 6 Jan 2016 15:36:48 +0200 +Subject: [PATCH 2/2] pseudo.c: add explicit include + +Signed-off-by: Alexandru Ardelean +--- + squashfs-tools/pseudo.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/squashfs-tools/pseudo.c b/squashfs-tools/pseudo.c +index f85fe60..7a26bca 100644 +--- a/squashfs-tools/pseudo.c ++++ b/squashfs-tools/pseudo.c +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + #include + + #include "pseudo.h" +-- +2.1.4 + diff --git a/utils/squashfs-tools/patches/0003-mksquashfs.c-get-inline-functions-work-with-C99.patch b/utils/squashfs-tools/patches/0003-mksquashfs.c-get-inline-functions-work-with-C99.patch new file mode 100644 index 0000000..a5bab05 --- /dev/null +++ b/utils/squashfs-tools/patches/0003-mksquashfs.c-get-inline-functions-work-with-C99.patch @@ -0,0 +1,154 @@ +From ac6268e843c43286eebff2a1052182c2393cdb2e Mon Sep 17 00:00:00 2001 +From: Roy Li +Date: Mon, 14 Sep 2015 12:31:42 +0800 +Subject: [PATCH] mksquashfs.c: get inline functions work with both gnu11 and gnu89 + +Upstream-Status: Pending + +After gcc upgraded to gcc5, and if the codes is compiled without optimization(-O0), +and the below error will happen: + +| mksquashfs.o: In function `create_inode': +| git/squashfs-tools/mksquashfs.c:897: undefined reference to `get_inode_no' +| git/squashfs-tools/mksquashfs.c:960: undefined reference to `get_parent_no' +| git/squashfs-tools/mksquashfs.c:983: undefined reference to `get_parent_no' +| mksquashfs.o: In function `reader_read_process': +| git/squashfs-tools/mksquashfs.c:2132: undefined reference to `is_fragment' +| mksquashfs.o: In function `reader_read_file': +| git/squashfs-tools/mksquashfs.c:2228: undefined reference to `is_fragment' +| mksquashfs.o: In function `dir_scan': +| git/squashfs-tools/mksquashfs.c:3101: undefined reference to `create_dir_entry' + +gcc5 defaults to -std=gnu11 instead of -std=gnu89, and it requires that exactly one C +source file has the callable copy of the inline function. Consider the following +program: + + inline int + foo (void) + { + return 42; + } + + int + main (void) + { + return foo (); + } + +The program above will not link with the C99 inline semantics, because no out-of-line +function foo is generated. To fix this, either mark the function foo as static, or +add the following declaration: + static inline int foo (void); + +more information refer to: https://gcc.gnu.org/gcc-5/porting_to.html; + +but the use of "extern inline" will lead to the compilation issue if gcc is not +gcc5, as the commit in oe-core d0af30c92fde [alsa-lib: Change function type to +"static __inline__"] + "extern __inline__ function()" is the inlined version that + can be used in this compilation unit, but there will be another + definition of this function somewhere, so compiler will not emit + any code for the function body. This causes problem in -O0, + where functions are never inlined, the function call is preserved, + but linker can't find the symbol, thus the error happens. + +so replace "inline" with "static inline" to make it work with both gnu11 and gnu89 + +Signed-off-by: Roy Li +--- + squashfs-tools/mksquashfs.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c +index d221c35..6bba1d2 100644 +--- a/squashfs-tools/mksquashfs.c ++++ b/squashfs-tools/mksquashfs.c +@@ -828,13 +828,13 @@ char *subpathname(struct dir_ent *dir_ent) + } + + +-inline unsigned int get_inode_no(struct inode_info *inode) ++static inline unsigned int get_inode_no(struct inode_info *inode) + { + return inode->inode_number; + } + + +-inline unsigned int get_parent_no(struct dir_info *dir) ++static inline unsigned int get_parent_no(struct dir_info *dir) + { + return dir->depth ? get_inode_no(dir->dir_ent->inode) : inode_no; + } +@@ -2027,7 +2027,7 @@ struct file_info *duplicate(long long file_size, long long bytes, + } + + +-inline int is_fragment(struct inode_info *inode) ++static inline int is_fragment(struct inode_info *inode) + { + off_t file_size = inode->buf.st_size; + +@@ -2996,13 +2996,13 @@ struct inode_info *lookup_inode2(struct stat *buf, int pseudo, int id) + } + + +-inline struct inode_info *lookup_inode(struct stat *buf) ++static inline struct inode_info *lookup_inode(struct stat *buf) + { + return lookup_inode2(buf, 0, 0); + } + + +-inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this) ++static inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this) + { + if (inode->inode_number == 0) { + inode->inode_number = use_this ? : inode_no ++; +@@ -3013,7 +3013,7 @@ inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this) + } + + +-inline struct dir_ent *create_dir_entry(char *name, char *source_name, ++static inline struct dir_ent *create_dir_entry(char *name, char *source_name, + char *nonstandard_pathname, struct dir_info *dir) + { + struct dir_ent *dir_ent = malloc(sizeof(struct dir_ent)); +@@ -3031,7 +3031,7 @@ inline struct dir_ent *create_dir_entry(char *name, char *source_name, + } + + +-inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir, ++static inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir, + struct inode_info *inode_info) + { + struct dir_info *dir = dir_ent->our_dir; +@@ -3047,7 +3047,7 @@ inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir, + } + + +-inline void add_dir_entry2(char *name, char *source_name, ++static inline void add_dir_entry2(char *name, char *source_name, + char *nonstandard_pathname, struct dir_info *sub_dir, + struct inode_info *inode_info, struct dir_info *dir) + { +@@ -3059,7 +3059,7 @@ inline void add_dir_entry2(char *name, char *source_name, + } + + +-inline void free_dir_entry(struct dir_ent *dir_ent) ++static inline void free_dir_entry(struct dir_ent *dir_ent) + { + if(dir_ent->name) + free(dir_ent->name); +@@ -3080,7 +3080,7 @@ inline void free_dir_entry(struct dir_ent *dir_ent) + } + + +-inline void add_excluded(struct dir_info *dir) ++static inline void add_excluded(struct dir_info *dir) + { + dir->excluded ++; + } +-- +1.9.1 + diff --git a/utils/stm32flash/Makefile b/utils/stm32flash/Makefile new file mode 100644 index 0000000..6ceb87a --- /dev/null +++ b/utils/stm32flash/Makefile @@ -0,0 +1,41 @@ +# +# Copyright (C) 2012-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:=stm32flash +PKG_VERSION:=0.4 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://releases.stm32flash.googlecode.com/git +PKG_MD5SUM:=ec9b5c8bae67f9a489786546d088bd14 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) +PKG_MAINTAINER:=Christian Pointner +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=gpl-2.0.txt +include $(INCLUDE_DIR)/package.mk + +define Package/stm32flash + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Microcontroller programming + URL:=http://code.google.com/p/stm32flash/ + TITLE:=Firmware flash tool for STM32's serial bootloader +endef + +define Package/stm32flash/description + This tool can be used to burn firmware images to STM32 ARM processors + using the built-in serial bootloader. +endef + +define Package/stm32flash/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/stm32flash $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,stm32flash)) diff --git a/utils/stoken/Makefile b/utils/stoken/Makefile new file mode 100644 index 0000000..1dc828c --- /dev/null +++ b/utils/stoken/Makefile @@ -0,0 +1,78 @@ +# +# 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:=stoken +PKG_VERSION:=0.8 +PKG_REV:=c4d79ffbf5053e44be4b64da22b1b7fb6a51daf2 +PKG_RELEASE:=2 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/cernekee/stoken.git + +PKG_SOURCE_VERSION:=$(PKG_REV) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_REV).tar.gz +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_MAINTAINER:=Florian Fainelli +PKG_LICENSE:=LGPL-2.1 +PKG_INSTALL:=1 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/stoken/Default + TITLE:=stoken is a tokencode generator compatible with RSA SecurID 128-bit (AES) + URL:=http://sourceforge.net/p/stoken/ + DEPENDS:= +libxml2 +libnettle +endef + +define Package/stoken + $(call Package/stoken/Default) + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Encryption + DEPENDS:=+libstoken + MENU:=1 +endef + +define Package/stoken/description + stoken is a tokencode generator compatible with RSA SecurID 128-bit (AES). This package contains the cli +endef + +define Package/libstoken + $(call Package/stoken/Default) + SECTION:=libs + CATEGORY:=Libraries +endef + +CONFIGURE_ARGS += \ + --with-nettle + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libstoken*.{la,a,so*} $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/stoken.pc \ + $(1)/usr/lib/pkgconfig/ +endef + +define Package/stoken/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/stoken $(1)/usr/bin/ +endef + +define Package/libstoken/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libstoken*.so* $(1)/usr/lib +endef + +$(eval $(call BuildPackage,stoken)) +$(eval $(call BuildPackage,libstoken)) diff --git a/utils/stress/Makefile b/utils/stress/Makefile new file mode 100644 index 0000000..c1fbce3 --- /dev/null +++ b/utils/stress/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2006-2015 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:=stress +PKG_VERSION:=1.0.4 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://people.seas.harvard.edu/~apw/stress/ +PKG_MD5SUM:=a607afa695a511765b40993a64c6e2f4 + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/stress + SECTION:=utils + CATEGORY:=Utilities + TITLE:=stress is a simple stress utility + URL:=http://people.seas.harvard.edu/~apw/stress/ + MAINTAINER:=Alexandru Ardelean +endef + +define Package/stress/description +stress is a simple tool that imposes certain types of compute \ stress on +UNIX-like operating systems. +endef + +CONFIGURE_ARGS += \ + --prefix="/usr" + +MAKE_FLAGS += \ + CFLAGS="$(TARGET_CFLAGS)" + +define Package/stress/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/stress $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,stress)) diff --git a/utils/sumo/Makefile b/utils/sumo/Makefile new file mode 100644 index 0000000..799d225 --- /dev/null +++ b/utils/sumo/Makefile @@ -0,0 +1,63 @@ +# +# Copyright (C) 2015-2016 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:=sumo +PKG_VERSION:=0.27.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-src-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/sumo +PKG_MD5SUM:=0bb98ab7339aea15b14b633e1b74691f +PKG_MAINTAINER:=Álvaro Fernández Rojas + +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=COPYING + +PKG_BUILD_PARALLEL:=1 +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +CONFIGURE_ARGS += \ + --with-xerces=$(STAGING_DIR)/usr \ + --disable-debug \ + --disable-dependency-tracking \ + --disable-silent-rules + +TARGET_CXXFLAGS+=-fpermissive + +define Package/sumo + SECTION:=utils + CATEGORY:=Utilities + TITLE:=SUMO - Simulation of Urban MObility + URL:=http://sumo-sim.org/ + DEPENDS:=+libstdcpp +libxerces-c +endef + +define Package/sumo/description + SUMO is a free and open traffic simulation suite which is available since 2001. + SUMO allows modelling of intermodal traffic systems including road vehicles, + public transport and pedestrians. Included with SUMO is a wealth of supporting + tools which handle tasks such as route finding, visualization, network import + and emission calculation. SUMO can be enhanced with custom models and provides + various APIs to remotely control the simulation. +endef + +define Package/sumo/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{activitygen,dfrouter,duarouter,emissionsDrivingCycle,emissionsMap,jtrrouter,marouter,netconvert,netgenerate,od2trips,polyconvert,TraCITestClient} $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sumo $(1)/usr/bin/sumo-bin + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) files/sumo.sh $(1)/usr/sbin/sumo + $(INSTALL_DIR) $(1)/usr/share/sumo + $(CP) $(PKG_BUILD_DIR)/data $(1)/usr/share/sumo/ +endef + +$(eval $(call BuildPackage,sumo)) diff --git a/utils/sumo/files/sumo.sh b/utils/sumo/files/sumo.sh new file mode 100644 index 0000000..0f0af4d --- /dev/null +++ b/utils/sumo/files/sumo.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Copyright (C) 2015 OpenWrt.org + +SUMO_HOME=/usr/share/sumo sumo-bin $@ + +exit $? diff --git a/utils/sumo/patches/100-configure_fix.patch b/utils/sumo/patches/100-configure_fix.patch new file mode 100644 index 0000000..b50048d --- /dev/null +++ b/utils/sumo/patches/100-configure_fix.patch @@ -0,0 +1,14 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -117,11 +117,6 @@ dnl - - - - - - - - - - - - - - - - - - + case "$host" in + x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux*) + dnl Make sure we are on architecture that supports SIMD +- if test x$CXX = xclang++; then +- CXXFLAGS="-msse2 $CXXFLAGS" +- else +- CXXFLAGS="-msse2 -mfpmath=sse $CXXFLAGS" +- fi + ;; + *-cygwin*) + AC_DEFINE([HAVE_CYGWIN], [1], [Define if compiling under cygwin]) diff --git a/utils/swig/Makefile b/utils/swig/Makefile new file mode 100644 index 0000000..977eaf2 --- /dev/null +++ b/utils/swig/Makefile @@ -0,0 +1,40 @@ +# +# Copyright (C) 2006-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:=swig +PKG_VERSION:=3.0.7 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/$(PKG_NAME) +PKG_MD5SUM:=7fff46c84b8c630ede5b0f0827e3d90a +PKG_INSTALL:=1 + +PKG_MAINTAINER:=John Crispin +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/package.mk + +define Package/swig + SECTION:=libs + CATEGORY:=Libraries + TITLE:=swig binding generator + BUILDONLY:=1 +endef + +HOST_CONFIGURE_ARGS+= \ + --without-pcre + +define Package/swig/description + tool that generates bindings for various languages +endef + +$(eval $(call HostBuild)) +$(eval $(call BuildPackage,swig)) diff --git a/utils/sysstat/Makefile b/utils/sysstat/Makefile new file mode 100644 index 0000000..3e9457b --- /dev/null +++ b/utils/sysstat/Makefile @@ -0,0 +1,66 @@ +# +# Copyright (C) 2015 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:=sysstat +PKG_VERSION:=11.0.4 +PKG_RELEASE:=2 + +PKG_LICENSE:=GPL-2.0 +PKG_MAINTAINER:=Marko Ratkaj + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=http://perso.orange.fr/sebastien.godard/ +PKG_MD5SUM:=df1ed75656eb06320088d54247f0e803 + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/sysstat + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Sysstat performance monitoring tools + URL:=http://pagesperso-orange.fr/sebastien.godard/index.html +endef + +define Package/sysstat/description + The sysstat utilities are a collection of performance monitoring tools for + Linux. These include sar, sadf, mpstat, iostat, pidstat and sa tools. +endef + +define Package/sysstat/conffiles +/etc/sysstat/sysstat.ioconf +/etc/sysstat/sysstat +endef + +CONFIGURE_VARS+= \ + sa_lib_dir="/usr/lib/sysstat" \ + sa_dir="/var/log/sysstat" \ + conf_dir="/etc/sysstat" + +CONFIGURE_ARGS+= \ + --disable-documentation \ + --disable-largefile \ + --disable-sensors \ + --disable-nls + +define Package/sysstat/install + $(INSTALL_DIR) $(1)/usr/lib/sysstat + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/sysstat/{sadc,sa1,sa2} $(1)/usr/lib/sysstat/ + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{sar,sadf,iostat,mpstat,pidstat} $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/sysstat + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sysstat/sysstat.ioconf $(1)/etc/sysstat/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/sysstat.config $(1)/etc/config/sysstat + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/sysstat.init $(1)/etc/init.d/sysstat +endef + +$(eval $(call BuildPackage,sysstat)) diff --git a/utils/sysstat/files/sysstat.config b/utils/sysstat/files/sysstat.config new file mode 100644 index 0000000..638b379 --- /dev/null +++ b/utils/sysstat/files/sysstat.config @@ -0,0 +1,7 @@ +config sysstat 'sysstat' + option log_history '7' + option compressafter '10' + option sadc_options '' + option sa_dir '/var/log/sysstat' + option zip 'xz' + option enabled 'true' diff --git a/utils/sysstat/files/sysstat.init b/utils/sysstat/files/sysstat.init new file mode 100755 index 0000000..a819000 --- /dev/null +++ b/utils/sysstat/files/sysstat.init @@ -0,0 +1,49 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 OpenWrt.org + +START=90 +STOP=10 + +USE_PROCD=1 +PROG=/usr/lib/sysstat/sadc +SYSSTAT_CFG="/etc/sysstat/sysstat" + +validate_sysstat_section() { + uci_validate_section sysstat sysstat "${1}" \ + 'log_history:uinteger' \ + 'compressafter:uinteger' \ + 'sadc_options:string' \ + 'sa_dir:string' \ + 'zip:string' \ + 'enabled:string' +} + +start_service() { + + local log_history compressafter sadc_options sa_dir zip enabled + + validate_sysstat_section sysstat || { + echo "validation failed" + return 1 + } + + [ -d /var/log/sysstat ] || mkdir -p /var/log/sysstat + + echo "HISTORY=$log_history" > $SYSSTAT_CFG + echo "COMPRESSAFTER=$compressafter" >> $SYSSTAT_CFG + echo "SADC_OPTIONS=\"$sadc_options\"" >> $SYSSTAT_CFG + echo "SA_DIR=\"$sa_dir\"" >> $SYSSTAT_CFG + echo "ZIP=\"$zip\"" >> $SYSSTAT_CFG + echo "ENABLED=\"$enabled\"" >> $SYSSTAT_CFG + + procd_open_instance + procd_set_param command $PROG -S DISK -F -L - + procd_set_param file $SYSSTAT_CFG + procd_close_instance +} + +service_triggers() +{ + procd_add_reload_trigger "sysstat" + procd_add_validation validate_sysstat_section +} diff --git a/utils/sysstat/patches/100-musl-compat.patch b/utils/sysstat/patches/100-musl-compat.patch new file mode 100644 index 0000000..06c7813 --- /dev/null +++ b/utils/sysstat/patches/100-musl-compat.patch @@ -0,0 +1,30 @@ +--- a/sa_common.c ++++ b/sa_common.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + #include + #include + +--- a/common.c ++++ b/common.c +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + + #include "version.h" + #include "common.h" +--- a/ioconf.c ++++ b/ioconf.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + + #include "ioconf.h" + #include "common.h" diff --git a/utils/tar/Makefile b/utils/tar/Makefile new file mode 100644 index 0000000..96a6421 --- /dev/null +++ b/utils/tar/Makefile @@ -0,0 +1,108 @@ +# +# Copyright (C) 2008-2016 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:=tar +PKG_VERSION:=1.29 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=@GNU/$(PKG_NAME) +PKG_MD5SUM:=955cd533955acb1804b83fd70218da51 +PKG_MAINTAINER:=Álvaro Fernández Rojas + +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 + +BUILD_DEPENDS:=xz + +include $(INCLUDE_DIR)/package.mk + +define Package/tar + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+PACKAGE_TAR_POSIX_ACL:libacl +PACKAGE_TAR_XATTR:libattr +PACKAGE_TAR_BZIP2:bzip2 + EXTRA_DEPENDS:=$(if $(CONFIG_PACKAGE_TAR_XZ),xz) + TITLE:=GNU tar + URL:=http://www.gnu.org/software/tar/ + MENU:=1 +endef + +define Package/tar/config + if PACKAGE_tar + config PACKAGE_TAR_POSIX_ACL + bool "tar: Enable POSIX ACL support" + default y if USE_FS_ACL_ATTR + default n + + config PACKAGE_TAR_XATTR + bool "tar: Enable extended attribute (xattr) support" + default y if USE_FS_ACL_ATTR + default n + + config PACKAGE_TAR_GZIP + bool "tar: Enable seamless gzip support" + default y + + config PACKAGE_TAR_BZIP2 + bool "tar: Enable seamless bzip2 support" + default y + + config PACKAGE_TAR_XZ + bool "tar: Enable seamless xz support" + select PACKAGE_xz-utils + select PACKAGE_xz + default y + endif +endef + +define Package/tar/description + Tar is a program for packaging a set of files as a + single archive in tar format. +endef + +define Package/tar/postinst +#!/bin/sh +if [ -e $${IPKG_INSTROOT}/bin/tar ]; then + rm -r $${IPKG_INSTROOT}/bin/tar; +fi +ln -sf /usr/bin/tar $${IPKG_INSTROOT}/bin/tar +endef + +define Package/tar/postrm +#!/bin/sh +rm $${IPKG_INSTROOT}/bin/tar +ln -s busybox $${IPKG_INSTROOT}/bin/tar +$${IPKG_INSTROOT}/bin/tar 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/bin/tar +exit 0 +endef + +CONFIGURE_ARGS += \ + $(if $(CONFIG_PACKAGE_TAR_POSIX_ACL),--with,--without)-posix-acls \ + $(if $(CONFIG_PACKAGE_TAR_XATTR),--with,--without)-xattrs \ + $(if $(CONFIG_PACKAGE_TAR_GZIP),--with-gzip=gzip,--without-gzip) \ + $(if $(CONFIG_PACKAGE_TAR_BZIP2),--with-bzip2=bzip2,--without-bzip2) \ + $(if $(CONFIG_PACKAGE_TAR_XZ),--with-xz=xz,--without-xz) \ + --without-compress \ + --without-lzip \ + --without-lzma \ + --without-lzop \ + --without-selinux + +MAKE_FLAGS += \ + CFLAGS="$(TARGET_CFLAGS)" \ + LDFLAGS="$(TARGET_LDLAGS)" + +define Package/tar/install + $(INSTALL_DIR) $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,tar)) diff --git a/utils/taskwarrior/Makefile b/utils/taskwarrior/Makefile new file mode 100644 index 0000000..a417a45 --- /dev/null +++ b/utils/taskwarrior/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 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:=taskwarrior +PKG_VERSION:=2.4.4 +PKG_RELEASE:=1 + +PKG_LICENSE:=MIT + +PKG_SOURCE:=task-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.taskwarrior.org/download/ +PKG_MD5SUM:=517450c4a23a5842df3e9905b38801b3 +PKG_MAINTAINER:=Luka Perkov + +PKG_BUILD_DIR:=$(BUILD_DIR)/task-$(PKG_VERSION) + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/taskwarrior + TITLE:=taskwarrior + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libstdcpp +libuuid +libgnutls + URL:=http://taskwarrior.org/ +endef + +TARGET_LDFLAGS += -ldl + +define Package/taskwarrior/description + taskwarrior is a command-line todo list manager +endef + +define Package/taskwarrior/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/task $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,taskwarrior)) diff --git a/utils/tcsh/Makefile b/utils/tcsh/Makefile new file mode 100644 index 0000000..7b0d188 --- /dev/null +++ b/utils/tcsh/Makefile @@ -0,0 +1,61 @@ +# +# Copyright (C) 2011-2016 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:=tcsh +PKG_VERSION:=6.20.00 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:= \ + http://ftp.funet.fi/pub/mirrors/ftp.astron.com/pub/tcsh/ \ + http://ftp.funet.fi/pub/mirrors/ftp.astron.com/pub/tcsh/old/ \ + ftp://ftp.astron.com/pub/tcsh/ \ + ftp://ftp.astron.com/pub/tcsh/old +PKG_MD5SUM:=59d40ef40a68e790d95e182069431834 + +PKG_LICENSE:=BSD-3-Clause +PKG_LICENSE_FILES:=Copyright + +PKG_MAINTAINER:=Nuno Goncalves + +include $(INCLUDE_DIR)/package.mk + +define Package/tcsh + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Shells + TITLE:=Enhanced Berkeley UNIX C shell + DEPENDS:=+libncurses + URL:=http://www.tcsh.org/ +endef + +define Package/tcsh/description + Tcsh is an enhanced, but completely compatible + version of the Berkeley UNIX C shell (csh). It + is a command language interpreter usable both + as an interactive login shell and a shell + script command processor. It includes a + command-line editor, programmable word + completion, spelling correction, a history + mechanism, job control and a C-like syntax. +endef + +define Package/tcsh/postinst +#!/bin/sh +grep tcsh $${IPKG_INSTROOT}/etc/shells || \ + echo "/bin/tcsh" >> $${IPKG_INSTROOT}/etc/shells + echo "/bin/csh" >> $${IPKG_INSTROOT}/etc/shells +endef + +define Package/tcsh/install + $(INSTALL_DIR) $(1)/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tcsh $(1)/bin/ + ln -sf tcsh $(1)/bin/csh +endef + +$(eval $(call BuildPackage,tcsh)) diff --git a/utils/tmux/Makefile b/utils/tmux/Makefile new file mode 100644 index 0000000..a66db4b --- /dev/null +++ b/utils/tmux/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2009-2016 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:=tmux +PKG_VERSION:=2.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/tmux/tmux/releases/download/$(PKG_VERSION) +PKG_MD5SUM:=bd95ee7205e489c62c616bb7af040099 +PKG_MAINTAINER:=Maxim Storchak + +PKG_LICENSE:=ISC +PKG_LICENSE_FILES:=COPYING + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/tmux + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Terminal + TITLE:=Terminal multiplexer + DEPENDS:=+libncurses +libevent2 +libpthread +librt + URL:=http://tmux.sourceforge.net/ +endef + +define Package/tmux/description + tmux is a modern, BSD-licensed alternative to GNU screen. +endef + +MAKE_FLAGS += \ + PREFIX="/usr" \ + PLATFORM="linux" + +define Package/tmux/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tmux $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,tmux)) diff --git a/utils/tmux/patches/100-b64_ntop-conflict.patch b/utils/tmux/patches/100-b64_ntop-conflict.patch new file mode 100644 index 0000000..5afc9b7 --- /dev/null +++ b/utils/tmux/patches/100-b64_ntop-conflict.patch @@ -0,0 +1,41 @@ +diff --git a/compat.h b/compat.h +index 8666a1d..2a44a2b 100644 +--- a/compat.h ++++ b/compat.h +@@ -223,7 +223,9 @@ int daemon(int, int); + #ifndef HAVE_B64_NTOP + /* b64_ntop.c */ + #undef b64_ntop /* for Cygwin */ +-int b64_ntop(const char *, size_t, char *, size_t); ++int local_b64_ntop(const char *, size_t, char *, size_t); ++#else ++#define local_b64_ntop b64_ntop + #endif + + #ifndef HAVE_FORKPTY +diff --git a/compat/b64_ntop.c b/compat/b64_ntop.c +index 2b4dc2d..a1314ca 100644 +--- a/compat/b64_ntop.c ++++ b/compat/b64_ntop.c +@@ -122,7 +122,7 @@ static const char Pad64 = '='; + */ + + int +-b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) { ++local_b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) { + size_t datalength = 0; + uint8_t input[3]; + uint8_t output[4]; +diff --git a/tty.c b/tty.c +index 7be952c..06dedab 100644 +--- a/tty.c ++++ b/tty.c +@@ -1134,7 +1134,7 @@ tty_cmd_setselection(struct tty *tty, const struct tty_ctx *ctx) + off = 4 * ((ctx->num + 2) / 3) + 1; /* storage for base64 */ + buf = xmalloc(off); + +- b64_ntop(ctx->ptr, ctx->num, buf, off); ++ local_b64_ntop(ctx->ptr, ctx->num, buf, off); + tty_putcode_ptr2(tty, TTYC_MS, "", buf); + + free(buf); diff --git a/utils/tracertools/Makefile b/utils/tracertools/Makefile new file mode 100644 index 0000000..9a0bc7a --- /dev/null +++ b/utils/tracertools/Makefile @@ -0,0 +1,42 @@ +# +# Copyright (C) 2007-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:=tracertools +PKG_VERSION:=20160308 +PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_MAINTAINER:=Daniel Golle + +PKG_LICENSE:=GPL-3.0 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/dangowrt/tracertools.git +PKG_SOURCE_VERSION:=28d0bb9a10a0b56b4964e3256135cfd152075a59 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/tracertools + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Tracer MPPT monitoring and control tools +endef + +define Package/tracertools/description + Tools for the Tracer MPPT solar charge controller. +endef + +define Package/tracertools/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tracerstat $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,tracertools)) diff --git a/utils/triggerhappy/Makefile b/utils/triggerhappy/Makefile new file mode 100644 index 0000000..97c6e90 --- /dev/null +++ b/utils/triggerhappy/Makefile @@ -0,0 +1,58 @@ +# +# Copyright (C) 2014-2015 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:=triggerhappy +PKG_VERSION:=0.3.4-151001 +PKG_REV:=7e5abc69f215678e93a6b999524981c8b40bdcd9 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=git://github.com/wertarbyte/triggerhappy +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=$(PKG_REV) + +PKG_MAINTAINER:=Ted Hess +PKG_LICENSE:=GPL-3.0+ +PKG_LICENSE_FILES:=COPYING + +include $(INCLUDE_DIR)/package.mk + +define Package/triggerhappy + SECTION:=utils + CATEGORY:=Utilities + TITLE:=handle input events and run configured programs + URL:=http://github.com/wertarbyte/triggerhappy +endef + +define Package/triggerhappy/description + triggerhappy - handle input events and run configured programs + The daemon thd can handle hotplugged input devices and is configured through + simple configuration files in /etc/triggerhappy/triggers.d/. +endef + +MAKE_FLAGS += \ + $(TARGET_CONFIGURE_OPTS) \ + $(1) + +define Package/triggerhappy/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DIR) $(1)/etc/triggerhappy + $(INSTALL_DIR) $(1)/etc/triggerhappy/triggers.d/ + $(INSTALL_DIR) $(1)/etc/hotplug.d/input/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/thd $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/th-cmd $(1)/usr/sbin + $(INSTALL_BIN) ./files/triggerhappy.init $(1)/etc/init.d/triggerhappy + $(INSTALL_BIN) ./files/triggerhappy.hotplug $(1)/etc/hotplug.d/input/10-triggerhappy + $(INSTALL_BIN) ./files/triggerhappy-example.conf $(1)/etc/triggerhappy/triggers.d/example.conf +endef + +$(eval $(call BuildPackage,triggerhappy)) diff --git a/utils/triggerhappy/files/triggerhappy-example.conf b/utils/triggerhappy/files/triggerhappy-example.conf new file mode 100644 index 0000000..3a8017a --- /dev/null +++ b/utils/triggerhappy/files/triggerhappy-example.conf @@ -0,0 +1,14 @@ +# This is an example configuration for the triggerhappy daemon (thd) +# please note that every file to be processed must end in ".conf" +# +# To view a list of supported event codes, use "thd --listevents" or +# "thd --dump /dev/input/event*" +# +# Format: +# +# +# values for key events are 1 (pressed), 0 (released) or 2 (held) +# +## control an mpd instance +# KEY_NEXTSONG 1 /usr/bin/mpc next +# KEY_PREVSONG 1 /usr/bin/mpc prev diff --git a/utils/triggerhappy/files/triggerhappy.hotplug b/utils/triggerhappy/files/triggerhappy.hotplug new file mode 100644 index 0000000..78ad349 --- /dev/null +++ b/utils/triggerhappy/files/triggerhappy.hotplug @@ -0,0 +1,15 @@ +#!/bin/sh +THD_SOCKET=/tmp/triggerhappy.socket +[ -S "$THD_SOCKET" ] || exit + +case "$ACTION" in + add) + DEVICE="/dev/$DEVNAME" + [ -c "$DEVICE" ] || exit + # offer device to triggerhappy daemon + /usr/sbin/th-cmd --socket "$THD_SOCKET" --add "$DEVICE" + ;; + remove) + # nothing to do + ;; +esac diff --git a/utils/triggerhappy/files/triggerhappy.init b/utils/triggerhappy/files/triggerhappy.init new file mode 100644 index 0000000..e846d29 --- /dev/null +++ b/utils/triggerhappy/files/triggerhappy.init @@ -0,0 +1,10 @@ +#!/bin/sh /etc/rc.common +START=93 + +start() { + /usr/sbin/thd --socket /tmp/triggerhappy.socket --triggers /etc/triggerhappy/triggers.d/ --daemon /dev/input/event* +} + +stop() { + /usr/sbin/th-cmd --socket /tmp/triggerhappy.socket --quit +} diff --git a/utils/unzip/Makefile b/utils/unzip/Makefile new file mode 100644 index 0000000..a0d0d14 --- /dev/null +++ b/utils/unzip/Makefile @@ -0,0 +1,74 @@ +# +# Copyright (C) 2006-2015 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:=unzip +PKG_REV:=60 +PKG_VERSION:=6.0 +PKG_RELEASE:=4 + +PKG_SOURCE:=$(PKG_NAME)$(PKG_REV).tar.gz +PKG_SOURCE_URL:=@SF/infozip +PKG_MD5SUM:=62b490407489521db863b523a7f86375 +PKG_MAINTAINER:=Álvaro Fernández Rojas + +PKG_LICENSE:=BSD-4-Clause +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/unzip$(PKG_REV) +PKG_CHECK_FORMAT_SECURITY:=0 + +include $(INCLUDE_DIR)/package.mk + +define Package/unzip + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:= + TITLE:=De-archiver for .zip files + URL:=http://infozip.sourceforge.net/UnZip.html + SUBMENU:=Compression +endef + +define Package/unzip/description + InfoZIP's unzip program. With the exception of multi-volume archives + (ie, .ZIP files that are split across several disks using PKZIP's /& option), + this can handle any file produced either by PKZIP, or the corresponding + InfoZIP zip program. +endef + +define Build/Configure +endef + +TARGET_CFLAGS += \ + -DNO_LCHMOD \ + -DLARGE_FILE_SUPPORT \ + -DUNICODE_WCHAR \ + -DUNICODE_SUPPORT \ + -DUTF8_MAYBE_NATIVE \ + -DZIP64_SUPPORT + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) -f unix/Makefile unzips \ + $(TARGET_CONFIGURE_OPTS) \ + prefix="$(PKG_INSTALL_DIR)/usr" \ + CFLAGS="$(TARGET_CFLAGS)" \ + CF="$(TARGET_CFLAGS) -O $(TARGET_CPPFLAGS) -I. -DUNIX" \ + CC="$(TARGET_CC)" \ + LD="$(TARGET_CC) $(TARGET_LDFLAGS)" \ + install +endef + +define Package/unzip/install + $(INSTALL_DIR) $(1)/usr/bin/ + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/{funzip,unzip,unzipsfx,zipgrep} \ + $(1)/usr/bin/ + $(LN) unzip $(1)/usr/bin/zipinfo +endef + +$(eval $(call BuildPackage,unzip)) diff --git a/utils/unzip/patches/001-CVE-2014-8139-crc-overflow.patch b/utils/unzip/patches/001-CVE-2014-8139-crc-overflow.patch new file mode 100644 index 0000000..5cae41f --- /dev/null +++ b/utils/unzip/patches/001-CVE-2014-8139-crc-overflow.patch @@ -0,0 +1,49 @@ +--- a/extract.c ++++ b/extract.c +@@ -1,5 +1,5 @@ + /* +- Copyright (c) 1990-2009 Info-ZIP. All rights reserved. ++ Copyright (c) 1990-2014 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2009-Jan-02 or later + (the contents of which are also included in unzip.h) for terms of use. +@@ -298,6 +298,8 @@ char ZCONST Far TruncNTSD[] = + #ifndef SFX + static ZCONST char Far InconsistEFlength[] = "bad extra-field entry:\n \ + EF block length (%u bytes) exceeds remaining EF data (%u bytes)\n"; ++ static ZCONST char Far TooSmallEBlength[] = "bad extra-field entry:\n \ ++ EF block length (%u bytes) invalid (< %d)\n"; + static ZCONST char Far InvalidComprDataEAs[] = + " invalid compressed data for EAs\n"; + # if (defined(WIN32) && defined(NTSD_EAS)) +@@ -2023,7 +2025,8 @@ static int TestExtraField(__G__ ef, ef_l + ebID = makeword(ef); + ebLen = (unsigned)makeword(ef+EB_LEN); + +- if (ebLen > (ef_len - EB_HEADSIZE)) { ++ if (ebLen > (ef_len - EB_HEADSIZE)) ++ { + /* Discovered some extra field inconsistency! */ + if (uO.qflag) + Info(slide, 1, ((char *)slide, "%-22s ", +@@ -2158,11 +2161,19 @@ static int TestExtraField(__G__ ef, ef_l + } + break; + case EF_PKVMS: +- if (makelong(ef+EB_HEADSIZE) != ++ if (ebLen < 4) ++ { ++ Info(slide, 1, ++ ((char *)slide, LoadFarString(TooSmallEBlength), ++ ebLen, 4)); ++ } ++ else if (makelong(ef+EB_HEADSIZE) != + crc32(CRCVAL_INITIAL, ef+(EB_HEADSIZE+4), + (extent)(ebLen-4))) ++ { + Info(slide, 1, ((char *)slide, + LoadFarString(BadCRC_EAs))); ++ } + break; + case EF_PKW32: + case EF_PKUNIX: diff --git a/utils/unzip/patches/002-CVE-2014-8140-test-compr-eb.patch b/utils/unzip/patches/002-CVE-2014-8140-test-compr-eb.patch new file mode 100644 index 0000000..fd4ef00 --- /dev/null +++ b/utils/unzip/patches/002-CVE-2014-8140-test-compr-eb.patch @@ -0,0 +1,23 @@ +--- a/extract.c ++++ b/extract.c +@@ -2232,10 +2232,17 @@ static int test_compr_eb(__G__ eb, eb_si + if (compr_offset < 4) /* field is not compressed: */ + return PK_OK; /* do nothing and signal OK */ + ++ /* Return no/bad-data error status if any problem is found: ++ * 1. eb_size is too small to hold the uncompressed size ++ * (eb_ucsize). (Else extract eb_ucsize.) ++ * 2. eb_ucsize is zero (invalid). 2014-12-04 SMS. ++ * 3. eb_ucsize is positive, but eb_size is too small to hold ++ * the compressed data header. ++ */ + if ((eb_size < (EB_UCSIZE_P + 4)) || +- ((eb_ucsize = makelong(eb+(EB_HEADSIZE+EB_UCSIZE_P))) > 0L && +- eb_size <= (compr_offset + EB_CMPRHEADLEN))) +- return IZ_EF_TRUNC; /* no compressed data! */ ++ ((eb_ucsize = makelong( eb+ (EB_HEADSIZE+ EB_UCSIZE_P))) == 0L) || ++ ((eb_ucsize > 0L) && (eb_size <= (compr_offset + EB_CMPRHEADLEN)))) ++ return IZ_EF_TRUNC; /* no/bad compressed data! */ + + if ( + #ifdef INT_16BIT diff --git a/utils/unzip/patches/003-CVE-2014-8141-getzip64data.patch b/utils/unzip/patches/003-CVE-2014-8141-getzip64data.patch new file mode 100644 index 0000000..ca52e19 --- /dev/null +++ b/utils/unzip/patches/003-CVE-2014-8141-getzip64data.patch @@ -0,0 +1,133 @@ +--- a/fileio.c ++++ b/fileio.c +@@ -176,6 +176,8 @@ static ZCONST char Far FilenameTooLongTr + #endif + static ZCONST char Far ExtraFieldTooLong[] = + "warning: extra field too long (%d). Ignoring...\n"; ++static ZCONST char Far ExtraFieldCorrupt[] = ++ "warning: extra field (type: 0x%04x) corrupt. Continuing...\n"; + + #ifdef WINDLL + static ZCONST char Far DiskFullQuery[] = +@@ -2295,7 +2297,12 @@ int do_string(__G__ length, option) /* + if (readbuf(__G__ (char *)G.extra_field, length) == 0) + return PK_EOF; + /* Looks like here is where extra fields are read */ +- getZip64Data(__G__ G.extra_field, length); ++ if (getZip64Data(__G__ G.extra_field, length) != PK_COOL) ++ { ++ Info(slide, 0x401, ((char *)slide, ++ LoadFarString( ExtraFieldCorrupt), EF_PKSZ64)); ++ error = PK_WARN; ++ } + #ifdef UNICODE_SUPPORT + G.unipath_filename = NULL; + if (G.UzO.U_flag < 2) { +--- a/process.c ++++ b/process.c +@@ -1,5 +1,5 @@ + /* +- Copyright (c) 1990-2009 Info-ZIP. All rights reserved. ++ Copyright (c) 1990-2014 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2009-Jan-02 or later + (the contents of which are also included in unzip.h) for terms of use. +@@ -1888,48 +1888,82 @@ int getZip64Data(__G__ ef_buf, ef_len) + and a 4-byte version of disk start number. + Sets both local header and central header fields. Not terribly clever, + but it means that this procedure is only called in one place. ++ ++ 2014-12-05 SMS. ++ Added checks to ensure that enough data are available before calling ++ makeint64() or makelong(). Replaced various sizeof() values with ++ simple ("4" or "8") constants. (The Zip64 structures do not depend ++ on our variable sizes.) Error handling is crude, but we should now ++ stay within the buffer. + ---------------------------------------------------------------------------*/ + ++#define Z64FLGS 0xffff ++#define Z64FLGL 0xffffffff ++ + if (ef_len == 0 || ef_buf == NULL) + return PK_COOL; + + Trace((stderr,"\ngetZip64Data: scanning extra field of length %u\n", + ef_len)); + +- while (ef_len >= EB_HEADSIZE) { ++ while (ef_len >= EB_HEADSIZE) ++ { + eb_id = makeword(EB_ID + ef_buf); + eb_len = makeword(EB_LEN + ef_buf); + +- if (eb_len > (ef_len - EB_HEADSIZE)) { +- /* discovered some extra field inconsistency! */ ++ if (eb_len > (ef_len - EB_HEADSIZE)) ++ { ++ /* Extra block length exceeds remaining extra field length. */ + Trace((stderr, + "getZip64Data: block length %u > rest ef_size %u\n", eb_len, + ef_len - EB_HEADSIZE)); + break; + } +- if (eb_id == EF_PKSZ64) { +- ++ if (eb_id == EF_PKSZ64) ++ { + int offset = EB_HEADSIZE; + +- if (G.crec.ucsize == 0xffffffff || G.lrec.ucsize == 0xffffffff){ +- G.lrec.ucsize = G.crec.ucsize = makeint64(offset + ef_buf); +- offset += sizeof(G.crec.ucsize); ++ if ((G.crec.ucsize == Z64FLGL) || (G.lrec.ucsize == Z64FLGL)) ++ { ++ if (offset+ 8 > ef_len) ++ return PK_ERR; ++ ++ G.crec.ucsize = G.lrec.ucsize = makeint64(offset + ef_buf); ++ offset += 8; + } +- if (G.crec.csize == 0xffffffff || G.lrec.csize == 0xffffffff){ +- G.csize = G.lrec.csize = G.crec.csize = makeint64(offset + ef_buf); +- offset += sizeof(G.crec.csize); ++ ++ if ((G.crec.csize == Z64FLGL) || (G.lrec.csize == Z64FLGL)) ++ { ++ if (offset+ 8 > ef_len) ++ return PK_ERR; ++ ++ G.csize = G.crec.csize = G.lrec.csize = makeint64(offset + ef_buf); ++ offset += 8; + } +- if (G.crec.relative_offset_local_header == 0xffffffff){ ++ ++ if (G.crec.relative_offset_local_header == Z64FLGL) ++ { ++ if (offset+ 8 > ef_len) ++ return PK_ERR; ++ + G.crec.relative_offset_local_header = makeint64(offset + ef_buf); +- offset += sizeof(G.crec.relative_offset_local_header); ++ offset += 8; + } +- if (G.crec.disk_number_start == 0xffff){ ++ ++ if (G.crec.disk_number_start == Z64FLGS) ++ { ++ if (offset+ 4 > ef_len) ++ return PK_ERR; ++ + G.crec.disk_number_start = (zuvl_t)makelong(offset + ef_buf); +- offset += sizeof(G.crec.disk_number_start); ++ offset += 4; + } ++#if 0 ++ break; /* Expect only one EF_PKSZ64 block. */ ++#endif /* 0 */ + } + +- /* Skip this extra field block */ ++ /* Skip this extra field block. */ + ef_buf += (eb_len + EB_HEADSIZE); + ef_len -= (eb_len + EB_HEADSIZE); + } diff --git a/utils/unzip/patches/004-CVE-2014-9636-test-compr-eb.patch b/utils/unzip/patches/004-CVE-2014-9636-test-compr-eb.patch new file mode 100644 index 0000000..3bba996 --- /dev/null +++ b/utils/unzip/patches/004-CVE-2014-9636-test-compr-eb.patch @@ -0,0 +1,25 @@ +--- a/extract.c ++++ b/extract.c +@@ -2228,6 +2228,7 @@ static int test_compr_eb(__G__ eb, eb_si + ulg eb_ucsize; + uch *eb_ucptr; + int r; ++ ush eb_compr_method; + + if (compr_offset < 4) /* field is not compressed: */ + return PK_OK; /* do nothing and signal OK */ +@@ -2244,6 +2245,14 @@ static int test_compr_eb(__G__ eb, eb_si + ((eb_ucsize > 0L) && (eb_size <= (compr_offset + EB_CMPRHEADLEN)))) + return IZ_EF_TRUNC; /* no/bad compressed data! */ + ++ /* 2014-11-03 Michal Zalewski, SMS. ++ * For STORE method, compressed and uncompressed sizes must agree. ++ * http://www.info-zip.org/phpBB3/viewtopic.php?f=7&t=450 ++ */ ++ eb_compr_method = makeword( eb + (EB_HEADSIZE + compr_offset)); ++ if ((eb_compr_method == STORED) && (eb_size - compr_offset != eb_ucsize)) ++ return PK_ERR; ++ + if ( + #ifdef INT_16BIT + (((ulg)(extent)eb_ucsize) != eb_ucsize) || diff --git a/utils/unzip/patches/005-CVE-2015-7696-heap-overflow.patch b/utils/unzip/patches/005-CVE-2015-7696-heap-overflow.patch new file mode 100644 index 0000000..df758a1 --- /dev/null +++ b/utils/unzip/patches/005-CVE-2015-7696-heap-overflow.patch @@ -0,0 +1,21 @@ +--- a/crypt.c ++++ b/crypt.c +@@ -465,7 +465,17 @@ int decrypt(__G__ passwrd) + GLOBAL(pInfo->encrypted) = FALSE; + defer_leftover_input(__G); + for (n = 0; n < RAND_HEAD_LEN; n++) { +- b = NEXTBYTE; ++ /* 2012-11-23 SMS. (OUSPG report.) ++ * Quit early if compressed size < HEAD_LEN. The resulting ++ * error message ("unable to get password") could be improved, ++ * but it's better than trying to read nonexistent data, and ++ * then continuing with a negative G.csize. (See ++ * fileio.c:readbyte()). ++ */ ++ if ((b = NEXTBYTE) == (ush)EOF) ++ { ++ return PK_ERR; ++ } + h[n] = (uch)b; + Trace((stdout, " (%02x)", h[n])); + } diff --git a/utils/unzip/patches/006-CVE-2015-7697-infinite-loop.patch b/utils/unzip/patches/006-CVE-2015-7697-infinite-loop.patch new file mode 100644 index 0000000..a8376b2 --- /dev/null +++ b/utils/unzip/patches/006-CVE-2015-7697-infinite-loop.patch @@ -0,0 +1,15 @@ +--- a/extract.c ++++ b/extract.c +@@ -2728,6 +2728,12 @@ __GDEF + int repeated_buf_err; + bz_stream bstrm; + ++ if (G.incnt <= 0 && G.csize <= 0L) { ++ /* avoid an infinite loop */ ++ Trace((stderr, "UZbunzip2() got empty input\n")); ++ return 2; ++ } ++ + #if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) + wsize = G.redirect_size, redirSlide = G.redirect_buffer; diff --git a/utils/unzip/patches/007-integer-underflow-csiz_decrypted.patch b/utils/unzip/patches/007-integer-underflow-csiz_decrypted.patch new file mode 100644 index 0000000..738ea52 --- /dev/null +++ b/utils/unzip/patches/007-integer-underflow-csiz_decrypted.patch @@ -0,0 +1,21 @@ +--- a/extract.c ++++ b/extract.c +@@ -1257,8 +1257,17 @@ static int extract_or_test_entrylist(__G + if (G.lrec.compression_method == STORED) { + zusz_t csiz_decrypted = G.lrec.csize; + +- if (G.pInfo->encrypted) ++ if (G.pInfo->encrypted) { ++ if (csiz_decrypted <= 12) { ++ /* handle the error now to prevent unsigned overflow */ ++ Info(slide, 0x401, ((char *)slide, ++ LoadFarStringSmall(ErrUnzipNoFile), ++ LoadFarString(InvalidComprData), ++ LoadFarStringSmall2(Inflate))); ++ return PK_ERR; ++ } + csiz_decrypted -= 12; ++ } + if (G.lrec.ucsize != csiz_decrypted) { + Info(slide, 0x401, ((char *)slide, + LoadFarStringSmall2(WrnStorUCSizCSizDiff), diff --git a/utils/usbmuxd/Makefile b/utils/usbmuxd/Makefile new file mode 100644 index 0000000..b05563e --- /dev/null +++ b/utils/usbmuxd/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2012-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:=usbmuxd +PKG_VERSION:=1.1.1 +PKG_RELEASE:=4 +PKG_SOURCE_PROTO:=git + +PKG_MAINTAINER:=Lukasz Baj +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING.GPLv2 + +PKG_SOURCE_URL:=https://github.com/libimobiledevice/usbmuxd.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=35e5d48f29ae03b2b9686109e4ed9ab8b9677ce8 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/usbmuxd + SECTION:=utils + CATEGORY:=Utilities + TITLE:=USB multiplexing daemon + URL:=http://www.libimobiledevice.org/ + DEPENDS:=+librt +libusb-1.0 +libusbmuxd +libopenssl +libimobiledevice +endef + +define Package/usbmuxd/description + This daemon is in charge of multiplexing connections over USB to an iPhone or + iPod touch. To users, it means you can sync your music, contacts, photos, etc. + over USB. To developers, it means you can connect to any listening localhost + socket on the device. usbmuxd is not used for tethering data transfer, which + uses a dedicated USB interface as a virtual network device. +endef + +TARGET_CFLAGS += $(FPIC) + +define Package/usbmuxd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/usbmuxd $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,usbmuxd)) diff --git a/utils/uvcdynctrl/Makefile b/utils/uvcdynctrl/Makefile new file mode 100644 index 0000000..7ab033c --- /dev/null +++ b/utils/uvcdynctrl/Makefile @@ -0,0 +1,87 @@ +# +# Copyright (C) 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:=uvcdynctrl +PKG_VERSION:=0.2.4 + +PKG_SOURCE:=libwebcam-src-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/libwebcam +PKG_MD5SUM:=31dbb5713e95a699c5fc4dbe1493f764 +PKG_MAINTAINER:=Roger D + +PKG_BUILD_DIR:=$(BUILD_DIR)/libwebcam-src-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/uvcdynctrl + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libwebcam +PACKAGE_UVCDYNCTRL_UDEV_RULE:udev + TITLE:=Manage dynamic controls in uvcvideo + URL:=http://sourceforge.net/projects/libwebcam/ + MENU:=1 +endef + +define Package/uvcdynctrl/description + The webcam-tools package contains the following two components: + - libwebcam: Webcam Library (LGPL) + - uvcdynctrl: Manage dynamic controls in uvcvideo (GPL) +endef + +define Package/uvcdynctrl/config +config PACKAGE_UVCDYNCTRL_UDEV_RULE + bool "uvcdynctrl udev rule, selects udev" + depends on PACKAGE_uvcdynctrl + default no + help + Installs an udev rule to load uvcdynctrl with dynamic controls + from xml files in /usr/share/uvcdynctrl when a webcam is attached. +endef + +define Package/libwebcam + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=+libxml2 +libiconv-full + TITLE:=Webcam library + URL:=http://sourceforge.net/projects/libwebcam/ +endef + +define Package/libwebcam/description + $(call Package/uvcdynctrl/description) +endef + +TARGET_CFLAGS += -I$(STAGING_DIR)/usr/lib/libiconv-full/include -liconv +TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib/libiconv-full/lib + +define Package/uvcdynctrl/install + $(INSTALL_DIR) $(1)/usr/{bin,share} + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/uvcdynctrl* $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/share/uvcdynctrl/ $(1)/usr/share/ + +ifeq ($(CONFIG_PACKAGE_UVCDYNCTRL_UDEV_RULE),y) + $(INSTALL_DIR) $(1)/lib/udev/rules.d + $(CP) $(PKG_INSTALL_DIR)/lib/udev/rules.d/*.rules $(1)/lib/udev/rules.d/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/udev/uvcdynctrl $(1)/lib/udev/ +endif +endef + +define Package/libwebcam/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libwebcam.so* $(1)/usr/lib/ +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/{include,lib} + $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libwebcam.{a,so*} $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,uvcdynctrl)) +$(eval $(call BuildPackage,libwebcam)) diff --git a/utils/vim/Makefile b/utils/vim/Makefile new file mode 100644 index 0000000..2e9f96a --- /dev/null +++ b/utils/vim/Makefile @@ -0,0 +1,194 @@ +# +# Copyright (C) 2015 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:=vim +PKG_VERSION:=7.4 +PKG_RELEASE:=3 +VIMVER:=74 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=ftp://ftp.vim.org/pub/vim/unix/ +PKG_MD5SUM:=607e135c559be642f210094ad023dc65 +PKG_MAINTAINER:=Marko Ratkaj + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)$(VIMVER) +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/vim/Default + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libncurses + TITLE:=Vi IMproved - enhanced vi editor + URL:=http://www.vim.org/ + SUBMENU:=Editors +endef + +define Package/vim + $(call Package/vim/Default) + TITLE+= (Tiny) +endef + +define Package/vim-full + $(call Package/vim/Default) + TITLE+= (Normal) +endef + +define Package/vim-runtime + $(call Package/vim/Default) + TITLE+= (runtime files) +endef + +define Package/vim-help + $(call Package/vim/Default) + TITLE+= (help files) +endef + +define Package/xxd + SECTION:=utils + CATEGORY:=Utilities + TITLE:=make a hexdump or do the reverse + URL:=http://www.vim.org/ +endef + +define Package/vim-full/conffiles +/usr/share/vim/vimrc +/root/.vimrc +endef + +define Package/vim/conffiles +/usr/share/vim/vimrc +/root/.vimrc +endef + +define Package/vim/description + Vim is an almost compatible version of the UNIX editor Vi. + (Tiny build) +endef + +define Package/vim-full/description + Vim is an almost compatible version of the UNIX editor Vi. + (Normal build) +endef + +define Package/vim-runtime/description + Vim is an almost compatible version of the UNIX editor Vi. + (Runtime files) +endef + +define Package/vim-help/description + Vim is an almost compatible version of the UNIX editor Vi. + (Help files) +endef + +define Package/xxd/description + xxd creates a hex dump of a given file or standard input, it can also convert + a hex dump back to its original binary form. +endef + +CONFIGURE_ARGS += \ + --disable-gui \ + --disable-gtktest \ + --disable-xim \ + --without-x \ + --disable-netbeans \ + --disable-cscope \ + --disable-gpm \ + --disable-acl \ + --with-tlib=ncurses + +CONFIGURE_VARS += \ + vim_cv_getcwd_broken=no \ + vim_cv_memmove_handles_overlap=yes \ + vim_cv_stat_ignores_slash=yes \ + vim_cv_tgetent=zero \ + vim_cv_terminfo=yes \ + vim_cv_toupper_broken=no \ + vim_cv_tty_group=root \ + vim_cv_tty_mode=0620 + +ifneq ($(CONFIG_PACKAGE_vim),) +define Build/Compile/vim + $(call Build/Configure/Default, \ + --with-features=tiny \ + --disable-multibyte \ + ) + +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" all + $(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(PKG_BUILD_DIR)/vim_tiny +endef +endif + +ifneq ($(CONFIG_PACKAGE_vim-full),) +define Build/Compile/vim-full + $(call Build/Configure/Default, \ + --with-features=normal \ + --enable-multibyte \ + ) + +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" all + $(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(PKG_BUILD_DIR)/vim_normal +endef +endif + +ifneq ($(CONFIG_PACKAGE_xxd),) +define Build/Compile/xxd + +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" all +endef +endif + +define Build/Compile/vim-runtime + $(MAKE) -C $(PKG_BUILD_DIR)/src DESTDIR="$(PKG_INSTALL_DIR)" installrtbase + (cd $(PKG_INSTALL_DIR) && tar -cf $(PKG_BUILD_DIR)/docs.tar ./usr/share/vim/vim$(VIMVER)/doc) + rm -rf $(PKG_INSTALL_DIR)/usr/share/vim/vim$(VIMVER)/doc + rm -rf $(PKG_INSTALL_DIR)/usr/man +endef + +define Build/Compile +$(call Build/Compile/vim) +$(call Build/Compile/vim-full) +$(call Build/Compile/vim-runtime) +$(call Build/Compile/xxd) +endef + +define Package/vim/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/vim_tiny $(1)/usr/bin/vim + $(INSTALL_DIR) $(1)/usr/share/vim + $(INSTALL_CONF) ./files/vimrc $(1)/usr/share/vim/ +endef + +define Package/vim-full/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/vim_normal $(1)/usr/bin/vim + $(INSTALL_DIR) $(1)/usr/share/vim + $(INSTALL_CONF) ./files/vimrc.full $(1)/usr/share/vim/vimrc +endef + +define Package/vim-runtime/install + $(CP) $(PKG_INSTALL_DIR)/* $(1) + rm -rf $(1)/usr/share/vim/vim$(VIMVER)/doc +endef + +define Package/vim-help/install + tar -C $(1) -xf $(PKG_BUILD_DIR)/docs.tar +endef + +define Package/xxd/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/xxd/xxd $(1)/usr/bin +endef + +$(eval $(call BuildPackage,vim)) +$(eval $(call BuildPackage,vim-full)) +$(eval $(call BuildPackage,vim-runtime)) +$(eval $(call BuildPackage,vim-help)) +$(eval $(call BuildPackage,xxd)) diff --git a/utils/vim/files/vimrc b/utils/vim/files/vimrc new file mode 100644 index 0000000..b8cea29 --- /dev/null +++ b/utils/vim/files/vimrc @@ -0,0 +1,12 @@ +set showcmd " show (partial) command in status line +set showmatch " show matching brackets +set incsearch " incremental search +set autowrite " automatically save before commands like :next and :make +set nocompatible " use vim defaults instead of 100% vi compatibility +set backspace=indent,eol,start " more powerful backspacing +set autoindent " always set autoindenting on +set linebreak " don't wrap words by default +set textwidth=0 " don't wrap lines by default +set ruler " show the cursor position all the time + +set backupskip+=/etc/crontabs.* " fix crontab -e diff --git a/utils/vim/files/vimrc.full b/utils/vim/files/vimrc.full new file mode 100644 index 0000000..99f737e --- /dev/null +++ b/utils/vim/files/vimrc.full @@ -0,0 +1,30 @@ +set showcmd " show (partial) command in status line +set showmatch " show matching brackets +set incsearch " incremental search +set autowrite " automatically save before commands like :next and :make +set nocompatible " use Vim defaults instead of 100% vi compatibility +set backspace=indent,eol,start " more powerful backspacing +set autoindent " always set autoindenting on +set linebreak " don't wrap words by default +set textwidth=0 " don't wrap lines by default +set ruler " show the cursor position all the time + +set backupskip+=/etc/crontabs.* " fix crontab -e + +if filereadable(expand("$VIMRUNTIME/syntax/synload.vim")) + syntax on +endif +if has("syntax") && &term =~ "xterm" + set t_Co=8 + if has("terminfo") + set t_Sf=[3%p1%dm + set t_Sb=[4%p1%dm + else + set t_Sf=[3%dm + set t_Sb=[4%dm + endif +endif + +" Uncomment out for line and/or relative numberig +" set number +" set rnu diff --git a/utils/vim/patches/001-compile.patch b/utils/vim/patches/001-compile.patch new file mode 100644 index 0000000..6740f1a --- /dev/null +++ b/utils/vim/patches/001-compile.patch @@ -0,0 +1,41 @@ +--- a/src/auto/configure ++++ b/src/auto/configure +@@ -12294,37 +12294,8 @@ _ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking uint32_t is 32 bits" >&5 + $as_echo_n "checking uint32_t is 32 bits... " >&6; } +-if test "$cross_compiling" = yes; then : +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot check uint32_t when cross-compiling." >&5 +-$as_echo "$as_me: WARNING: cannot check uint32_t when cross-compiling." >&2;} +-else +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +- +-#ifdef HAVE_STDINT_H +-# include +-#endif +-#ifdef HAVE_INTTYPES_H +-# include +-#endif +-main() { +- uint32_t nr1 = (uint32_t)-1; +- uint32_t nr2 = (uint32_t)0xffffffffUL; +- if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1); +- exit(0); +-} +-_ACEOF +-if ac_fn_c_try_run "$LINENO"; then : +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: assuming ok" >&5 + $as_echo "ok" >&6; } +-else +- as_fn_error "WRONG! uint32_t not defined correctly." "$LINENO" 5 +-fi +-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ +- conftest.$ac_objext conftest.beam conftest.$ac_ext +-fi +- +- + + bcopy_test_prog=' + #include "confdefs.h" diff --git a/utils/vim/patches/002-remove_helptags_generation.patch b/utils/vim/patches/002-remove_helptags_generation.patch new file mode 100644 index 0000000..051c8da --- /dev/null +++ b/utils/vim/patches/002-remove_helptags_generation.patch @@ -0,0 +1,10 @@ +--- a/runtime/doc/Makefile ++++ b/runtime/doc/Makefile +@@ -310,7 +310,6 @@ all: tags vim.man evim.man vimdiff.man v + # Use Vim to generate the tags file. Can only be used when Vim has been + # compiled and installed. Supports multiple languages. + vimtags: $(DOCS) +- $(VIMEXE) -u NONE -esX -c "helptags ++t ." -c quit + + # Use "doctags" to generate the tags file. Only works for English! + tags: doctags $(DOCS) diff --git a/utils/watchcat/Makefile b/utils/watchcat/Makefile new file mode 100644 index 0000000..d25c0c2 --- /dev/null +++ b/utils/watchcat/Makefile @@ -0,0 +1,45 @@ +# +# Copyright (C) 2010 segal.di.ubi.pt +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=watchcat +PKG_VERSION:=1 +PKG_RELEASE:=6 + +PKG_MAINTAINER:=Roger D +PKG_LICENSE:=GPL-2.0 + +include $(INCLUDE_DIR)/package.mk + +define Package/watchcat + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Enable the configuration of programed reboots +endef + +define Package/watchcat/description +Allows to configure a periodically reboot, or after losing internet connectivity. Configured trough UCI /etc/config/system. +endef + +define Package/watchcat/conffiles +/etc/config/system +endef + +define Build/Compile +endef + +define Package/watchcat/install + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/initd_watchcat $(1)/etc/init.d/watchcat + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) ./files/watchcat.sh $(1)/usr/bin/watchcat.sh + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) ./files/uci_defaults_watchcat $(1)/etc/uci-defaults/50-watchcat +endef + +$(eval $(call BuildPackage,watchcat)) diff --git a/utils/watchcat/files/initd_watchcat b/utils/watchcat/files/initd_watchcat new file mode 100644 index 0000000..d6f954e --- /dev/null +++ b/utils/watchcat/files/initd_watchcat @@ -0,0 +1,109 @@ +#!/bin/sh /etc/rc.common + +START=97 + +PIDFILE="/tmp/run/watchcat" + +append_string() { + local varname="$1"; local add="$2"; local separator="${3:- }"; local actual + eval "actual=\$$varname" + + new="${actual:+$actual$separator}$add" + eval "$varname=\$new" +} + +timetoseconds() { + local time=$1 + unset seconds + + { [ "$time" -ge 1 ] 2> /dev/null && seconds="$time"; } || \ + { [ "${time%s}" -ge 1 ] 2> /dev/null && seconds="${time%s}"; } || \ + { [ "${time%m}" -ge 1 ] 2> /dev/null && seconds=$((${time%m}*60)); } || \ + { [ "${time%h}" -ge 1 ] 2> /dev/null && seconds=$((${time%h}*3600)); } || \ + { [ "${time%d}" -ge 1 ] 2> /dev/null && seconds=$((${time%d}*86400)); } +} + +load_watchcat() { + config_get period $1 period + config_get mode $1 mode "always" + config_get pinghosts $1 pinghosts "8.8.8.8" + config_get pingperiod $1 pingperiod + config_get forcedelay $1 forcedelay "0" + + # Fix potential typo in mode (backward compatibility). + [ "$mode" = "allways" ] && mode="always" + + error="" + + timetoseconds "$period" + period="$seconds" + [ "$period" -ge 1 ] \ + || append_string "error" 'period is not a valid time value (ex: "30"; "4m"; "6h"; "2d")' "; " + [ "$mode" = "always" -o "$mode" = "ping" ] \ + || append_string "error" "mode must be 'always' or 'ping'" "; " + [ -n "$pinghosts" -o "$mode" = "always" ] \ + || append_string "error" "pinghosts must be set when in 'ping' mode" "; " + [ "$mode" = "ping" ] && { + if [ -n "$pingperiod" ] + then + timetoseconds "$pingperiod" + pingperiod="$seconds" + if [ "$pingperiod" -ge 0 ] + then + [ "$pingperiod" -lt "$period" ] \ + || append_string "error" "pingperiod must be less than period" "; " + else + append_string "error" 'pingperiod is not a valid time value (ex: "30"; "4m"; "6h"; "2d")' "; " + fi + else + pingperiod="$((period/20))" + fi + } + [ "$forcedelay" -ge 0 ] \ + || append_string "error" "forcedelay must be a integer greater or equal than 0, where 0 means disabled" "; " + + [ -n "$error" ] && { logger -p user.err -t "watchcat" "reboot program $1 not started - $error"; return; } + + if [ "$mode" = "always" ] + then + /usr/bin/watchcat.sh "always" "$period" "$forcedelay" & + logger -p user.info -t "watchcat" "started task (mode=$mode;period=$period;forcedelay=$forcedelay)" + else + /usr/bin/watchcat.sh "period" "$period" "$forcedelay" "$pinghosts" "$pingperiod" & + logger -p user.info -t "watchcat" "started task (mode=$mode;period=$period;pinghosts=$pinghosts;pingperiod=$pingperiod;forcedelay=$forcedelay)" + fi + + echo $! >> "${PIDFILE}.pids" +} + +stop() { + if [ -f "${PIDFILE}.pids" ] + then + logger -p user.info -t "watchcat" "stopping all tasks" + + while read pid + do + kill "$pid" + done < "${PIDFILE}.pids" + + rm "${PIDFILE}.pids" + + logger -p user.info -t "watchcat" "all tasks stopped" + else + logger -p user.info -t "watchcat" "no tasks running" + fi +} + +start() { + [ -f "${PIDFILE}.pids" ] && stop + + config_load system + if [ -n "$(uci show system.@watchcat[0])" ] # at least one watchcat section exists + then + logger -p user.info -t "watchcat" "starting all tasks" + config_foreach load_watchcat watchcat + logger -p user.info -t "watchcat" "all tasks started" + else + logger -p user.info -t "watchcat" "no tasks defined" + fi +} diff --git a/utils/watchcat/files/uci_defaults_watchcat b/utils/watchcat/files/uci_defaults_watchcat new file mode 100644 index 0000000..49def81 --- /dev/null +++ b/utils/watchcat/files/uci_defaults_watchcat @@ -0,0 +1,10 @@ +#!/bin/sh + +uci -q show system.@watchcat[0] || { + uci add system watchcat + uci set system.@watchcat[0].period=6h + uci set system.@watchcat[0].mode=ping + uci set system.@watchcat[0].pinghosts=8.8.8.8 + uci set system.@watchcat[0].forcedelay=30 + uci commit +} diff --git a/utils/watchcat/files/watchcat.sh b/utils/watchcat/files/watchcat.sh new file mode 100644 index 0000000..0fda123 --- /dev/null +++ b/utils/watchcat/files/watchcat.sh @@ -0,0 +1,77 @@ +#!/bin/sh +# +# Copyright (C) 2010 segal.di.ubi.pt +# +# This is free software, licensed under the GNU General Public License v2. +# + +mode="$1" + +# Fix potential typo in mode (backward compatibility). +[ "$mode" = "allways" ] && mode="always" + +shutdown_now() { + local forcedelay="$1" + + reboot & + + [ "$forcedelay" -ge 1 ] && { + sleep "$forcedelay" + + echo b > /proc/sysrq-trigger # Will immediately reboot the system without syncing or unmounting your disks. + } +} + +watchcat_always() { + local period="$1"; local forcedelay="$2" + + sleep "$period" && shutdown_now "$forcedelay" +} + +watchcat_ping() { + local period="$1"; local forcedelay="$2"; local pinghosts="$3"; local pingperiod="$4" + + time_now="$(cat /proc/uptime)" + time_now="${time_now%%.*}" + time_lastcheck="$time_now" + time_lastcheck_withinternet="$time_now" + + while true + do + # account for the time ping took to return. With a ping time of 5s, ping might take more than that, so it is important to avoid even more delay. + time_now="$(cat /proc/uptime)" + time_now="${time_now%%.*}" + time_diff="$((time_now-time_lastcheck))" + + [ "$time_diff" -lt "$pingperiod" ] && { + sleep_time="$((pingperiod-time_diff))" + sleep "$sleep_time" + } + + time_now="$(cat /proc/uptime)" + time_now="${time_now%%.*}" + time_lastcheck="$time_now" + + for host in "$pinghosts" + do + if ping -c 1 "$host" &> /dev/null + then + time_lastcheck_withinternet="$time_now" + else + time_diff="$((time_now-time_lastcheck_withinternet))" + logger -p daemon.info -t "watchcat[$$]" "no internet connectivity for $time_diff seconds. Reseting when reaching $period" + fi + done + + time_diff="$((time_now-time_lastcheck_withinternet))" + [ "$time_diff" -ge "$period" ] && shutdown_now "$forcedelay" + + done +} + + if [ "$mode" = "always" ] + then + watchcat_always "$2" "$3" + else + watchcat_ping "$2" "$3" "$4" "$5" + fi diff --git a/utils/wifitoggle/Makefile b/utils/wifitoggle/Makefile new file mode 100644 index 0000000..c580e97 --- /dev/null +++ b/utils/wifitoggle/Makefile @@ -0,0 +1,46 @@ +# +# Copyright (C) 2010-2014 OpenWrt.org +# Copyright (C) 2010 segal.di.ubi.pt +# Copyright (C) 2016 Karol Babioch +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=wifitoggle +PKG_VERSION:=1 +PKG_RELEASE:=5 +PKG_LICENSE:=GPL-2.0+ + +PKG_MAINTAINER:=Nuno Goncalves + +include $(INCLUDE_DIR)/package.mk + +define Package/wifitoggle + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Script to toggle Wi-Fi with a button and UCI config +endef + +define Package/wifitoggle/description +Very versatile script to toggle Wi-Fi with a button. Allows to set +timeouts, persist changes after boot, and set LEDs according to the state. +endef + +define Package/wifitoggle/conffiles +/etc/config/wifitoggle +endef + +define Build/Compile +endef + +define Package/wifitoggle/install + $(INSTALL_DIR) $(1)/etc/hotplug.d/button + $(INSTALL_BIN) ./files/wifitoggle.hotplug $(1)/etc/hotplug.d/button/50-wifitoggle + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/wifitoggle.config $(1)/etc/config/wifitoggle +endef + +$(eval $(call BuildPackage,wifitoggle)) diff --git a/utils/wifitoggle/files/wifitoggle.config b/utils/wifitoggle/files/wifitoggle.config new file mode 100755 index 0000000..a8d0906 --- /dev/null +++ b/utils/wifitoggle/files/wifitoggle.config @@ -0,0 +1,13 @@ +config wifitoggle + option button 'wps' + + option persistent '0' + option timer '600' + + #option led_sysfs 'wrt160nl:amber:wps' + # Leaving this option empty, makes sure that no LED is touched + option led_sysfs '' + option led_enable_trigger 'timer' + option led_enable_delayon '500' + option led_enable_delayoff '500' + option led_disable_default '0' diff --git a/utils/wifitoggle/files/wifitoggle.hotplug b/utils/wifitoggle/files/wifitoggle.hotplug new file mode 100755 index 0000000..295a087 --- /dev/null +++ b/utils/wifitoggle/files/wifitoggle.hotplug @@ -0,0 +1,174 @@ +# /bin/sh + +setled() { + if [ -z "${led_sysfs}" ]; then + return + elif [ -e /sys/class/leds/${led_sysfs}/brightness ] + then + [ $led_default -eq 1 ] && echo 1 >/sys/class/leds/${led_sysfs}/brightness + [ $led_default -eq 1 ] || echo 0 >/sys/class/leds/${led_sysfs}/brightness + + echo $led_trigger > /sys/class/leds/${led_sysfs}/trigger + + [ "$led_trigger" == "netdev" -a -n "$led_dev" ] && { + echo $led_dev > /sys/class/leds/${led_sysfs}/device_name + echo $led_mode > /sys/class/leds/${led_sysfs}/mode + } + + [ "$led_trigger" == "timer" ] && { + [ -n "$led_delayon" ] && echo $led_delayon > /sys/class/leds/${led_sysfs}/delay_on + [ -n "$led_delayoff" ] && echo $led_delayoff > /sys/class/leds/${led_sysfs}/delay_off + } + else + logger -p user.err -t "wifitoggle" "led: ${led_sysfs} not found" + fi +} + +load_wireless() { + disabled="$(uci get wireless.${1}.disabled)" +} + +save_wireless() { + [ "$device" = "all" -o "$device" = "${1}" ] && { + uci set "wireless.${1}.disabled=$disabled" + } +} + +setwifi() { + setled + + config_load wireless + config_foreach save_wireless wifi-device + + if ubus list network.wireless >/dev/null 2>/dev/null; then + ubus call network reload + else + wifi + fi +} + + +save_system() { + config_get sysfs $1 sysfs + [ "$sysfs" = "$led_sysfs" ] && { + uci set "system.${1}.trigger=$led_trigger" + uci set "system.${1}.dev=$led_dev" + uci set "system.${1}.mode=$led_mode" + uci set "system.${1}.default=$led_default" + uci set "system.${1}.delayon=$led_delayon" + uci set "system.${1}.delayoff=$led_delayoff" + + ledset=1 + } +} + +commit_changes() { + ledset="" + + config_load system + config_foreach save_system led + + [ "$ledset" -eq 1 ] || { + section=$(uci add system led) + uci set "system.${section}.sysfs=$led_sysfs" + uci set "system.${section}.trigger=$led_trigger" + uci set "system.${section}.dev=$led_dev" + uci set "system.${section}.mode=$led_mode" + uci set "system.${section}.default=$led_default" + uci set "system.${section}.delayon=$led_delayon" + uci set "system.${section}.delayoff=$led_delayoff" + } + + uci commit +} + +enable() { + + led_trigger="$led_enable_trigger" + led_trigger="$led_enable_trigger" + led_dev="$led_enable_dev" + led_mode="$led_enable_mode" + led_default="$led_enable_default" + led_delayon="$led_enable_delayon" + led_delayoff="$led_enable_delayoff" + disabled=0 + + setwifi + + [ "$timer" -le 0 -a "$persistent" -eq 1 ] && commit_changes + + logger -p user.info -t "wifitoggle" "device($device) enabled" + + [ "$timer" -gt 0 ] && { + sleep "$timer" && disable && rm /tmp/run/wirelesstoggle_${1}.pid & + echo $! > /tmp/run/wirelesstoggle_${1}.pid + logger -p user.info -t "wifitoggle" "auto-disable timer started($timer seconds)" + } +} + +disable() { + + led_trigger="$led_disable_trigger" + led_trigger="$led_disable_trigger" + led_dev="$led_disable_dev" + led_mode="$led_disable_mode" + led_default="$led_disable_default" + led_delayon="$led_disable_delayon" + led_delayoff="$led_disable_delayoff" + disabled=1 + + setwifi + + [ "$timer" -le 0 -a "$persistent" -eq 1 ] && commit_changes + + logger -p user.info -t "wifitoggle" "device($device) disabled" +} + + +load_wifitoggle() { + config_get device $1 device "all" + config_get button $1 button "wps" + config_get action $1 action "pressed" + config_get_bool persistent $1 persistent "0" + config_get timer $1 timer "0" + + config_get led_sysfs $1 led_sysfs + + config_get led_enable_trigger $1 led_enable_trigger "none" + config_get led_enable_dev $1 led_enable_dev + config_get led_enable_mode $1 led_enable_mode "link" + config_get_bool led_enable_default $1 led_enable_default "1" + config_get led_enable_delayon $1 led_enable_delayon + config_get led_enable_delayoff $1 led_enable_delayoff + + config_get led_disable_trigger $1 led_disable_trigger "none" + config_get led_disable_dev $1 led_disable_dev + config_get led_disable_mode $1 led_disable_mode "link" + config_get_bool led_disable_default $1 led_disable_default "0" + config_get led_disable_delayon $1 led_disable_delayon + config_get led_disable_delayoff $1 led_disable_delayoff + + [ "$ACTION" = "$action" -a "$BUTTON" = "$button" ] && { + + [ -f /tmp/run/wirelesstoggle_${1}.pid ] && read PID < /tmp/run/wirelesstoggle_${1}.pid && kill $PID && rm /tmp/run/wirelesstoggle_${1}.pid + + if [ "$device" = "all" ] + then + config_load wireless + config_foreach load_wireless wifi-device + else + disabled="$(uci get wireless."$device".disabled)" + fi + + + if [ "$disabled" = "1" ] + then + enable $1 + else + disable + fi + } +} + +config_load wifitoggle +config_foreach load_wifitoggle wifitoggle diff --git a/utils/xz/Makefile b/utils/xz/Makefile new file mode 100644 index 0000000..4f738bb --- /dev/null +++ b/utils/xz/Makefile @@ -0,0 +1,117 @@ +# +# Copyright (C) 2013-2015 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:=xz +PKG_VERSION:=5.2.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://tukaani.org/xz \ + http://fossies.org/linux/misc +PKG_MD5SUM:=f90c9a0c8b259aee2234c4e0d7fd70af + +PKG_LICENSE:=Public-Domain LGPL-2.1+ GPL-2.0+ GPL-3.0+ +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Nicolas Thill + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/xz/Default + SUBMENU:=Compression + SECTION:=utils + CATEGORY:=Utilities + URL:=http://tukaani.org/xz +endef + +define Package/xz-utils +$(call Package/xz/Default) + TITLE:=XZ Utils (meta) + MENU:=1 +endef + +define Package/liblzma +$(call Package/xz/Default) + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=+libpthread + TITLE:=liblzma library from XZ Utils +endef + +# $(1): package name & command in /usr/bin/ +# $(2): package dependencies +# $(3): symbolic links to $(1) in /usr/bin/ +define BuildSubPackage + + define Package/$(1) + $(call Package/xz/Default) + DEPENDS:=xz-utils $(2) + TITLE:=$(1) utility from XZ Utils + endef + + define Package/$(1)/description + Contains: $(1) $(3) + endef + + define Package/$(1)/install + $(INSTALL_DIR) $$(1)/usr/bin + $(CP) $(foreach f,$(1) $(3),$(PKG_INSTALL_DIR)/usr/bin/$(f)) $$(1)/usr/bin/ + endef + + $$(eval $$(call BuildPackage,$(1))) +endef + + +CONFIGURE_ARGS += \ + --enable-small \ + --enable-assume-ram=4 \ + --disable-assembler \ + --disable-werror \ + +# API uses "restrict" keyword introduced in C99 standard +TARGET_CFLAGS += \ + -std=c99 \ + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) \ + $(PKG_INSTALL_DIR)/usr/include/lzma{,.h} \ + $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/liblzma.{a,so*} \ + $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/liblzma.pc \ + $(1)/usr/lib/pkgconfig/ +endef + +define Package/xz-utils/install + true +endef + +define Package/liblzma/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblzma.so.* $(1)/usr/lib/ +endef + + +$(eval $(call BuildPackage,xz-utils)) +$(eval $(call BuildPackage,liblzma)) +$(eval $(call BuildSubPackage,lzmadec, +liblzma,)) +$(eval $(call BuildSubPackage,lzmainfo, +liblzma,)) +$(eval $(call BuildSubPackage,xz, +liblzma, lzcat lzma unlzma unxz xzcat)) +$(eval $(call BuildSubPackage,xzdec, +liblzma,)) +$(eval $(call BuildSubPackage,xzdiff, +bash +xz, lzcmp lzdiff xzcmp)) +$(eval $(call BuildSubPackage,xzgrep, +bash +xz, lzegrep lzfgrep lzgrep xzegrep xzfgrep)) +$(eval $(call BuildSubPackage,xzless, +bash +xz, lzless)) +$(eval $(call BuildSubPackage,xzmore, +bash +xz, lzmore)) diff --git a/utils/yunbridge/Makefile b/utils/yunbridge/Makefile new file mode 100644 index 0000000..ae49232 --- /dev/null +++ b/utils/yunbridge/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2006-2011 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:=yunbridge +PKG_VERSION:=160 + +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/arduino/YunBridge.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=f2042052115e71ad2c91f77e78d21db8275fcdd6 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_MAINTAINER:=John Crispin +PKG_LICENSE:=GPL-2.0 + +include $(INCLUDE_DIR)/package.mk + +define Package/yunbridge + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Arduino YUN bridge library + URL:=http://arduino.cc/ + DEPENDS:=+python +endef + +define Package/yunbridge/description + Arduino YUN bridge library +endef + +define Build/Compile + true +endef + +define Package/yunbridge/install + mkdir -p $(1)/usr/lib/python2.7/bridge + $(CP) $(PKG_BUILD_DIR)/bridge/*.py $(1)/usr/lib/python2.7/bridge/ + $(CP) ./files/* $(1) +endef + +$(eval $(call BuildPackage,yunbridge)) diff --git a/utils/yunbridge/files/etc/config/yunbridge b/utils/yunbridge/files/etc/config/yunbridge new file mode 100644 index 0000000..fe8dd28 --- /dev/null +++ b/utils/yunbridge/files/etc/config/yunbridge @@ -0,0 +1,6 @@ +config bridge config + option socket_timeout 5 + option secure_rest_api false + + # remove this line to activae the yunbridge + option disabled 1 diff --git a/utils/yunbridge/files/etc/init.d/yunbridge b/utils/yunbridge/files/etc/init.d/yunbridge new file mode 100755 index 0000000..4b48220 --- /dev/null +++ b/utils/yunbridge/files/etc/init.d/yunbridge @@ -0,0 +1,22 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2013 OpenWrt.org + +# start after and stop before networking +START=20 +STOP=89 + +USE_PROCD=1 + +service_triggers() +{ + procd_add_reload_trigger "yunbridge" +} + +start_service() +{ + [ "$(uci -q get yunbridge.config.disabled)" = "1" ] && return 0 + procd_open_instance + procd_set_param command "/sbin/yunbridge" + procd_set_param respawn + procd_close_instance +} diff --git a/utils/yunbridge/files/sbin/yunbridge b/utils/yunbridge/files/sbin/yunbridge new file mode 100755 index 0000000..c8e4812 --- /dev/null +++ b/utils/yunbridge/files/sbin/yunbridge @@ -0,0 +1,6 @@ +#!/bin/sh +stty -F /dev/ttyS0 2500000 clocal cread cs8 -cstopb -parenb +exec < /dev/ttyS0 +exec > /dev/ttyS0 +exec 2> /dev/ttyS0 +askfirst bin/ash --login diff --git a/utils/yunbridge/files/usr/bin/pretty-wifi-info.lua b/utils/yunbridge/files/usr/bin/pretty-wifi-info.lua new file mode 100755 index 0000000..d91817a --- /dev/null +++ b/utils/yunbridge/files/usr/bin/pretty-wifi-info.lua @@ -0,0 +1,75 @@ +#!/usr/bin/lua + +local function get_basic_net_info(network, iface, accumulator) + local net = network:get_network(iface) + local device = net and net:get_interface() + + if device then + accumulator["uptime"] = net:uptime() + accumulator["iface"] = device:name() + accumulator["mac"] = device:mac() + accumulator["rx_bytes"] = device:rx_bytes() + accumulator["tx_bytes"] = device:tx_bytes() + accumulator["ipaddrs"] = {} + + for _, ipaddr in ipairs(device:ipaddrs()) do + accumulator.ipaddrs[#accumulator.ipaddrs + 1] = { + addr = ipaddr:host():string(), + netmask = ipaddr:mask():string() + } + end + end +end + +local function get_wifi_info(network, iface, accumulator) + local net = network:get_wifinet(iface) + + if net then + local dev = net:get_device() + if dev then + accumulator["mode"] = net:active_mode() + accumulator["ssid"] = net:active_ssid() + accumulator["encryption"] = net:active_encryption() + accumulator["quality"] = net:signal_percent() + end + end +end + +local function collect_wifi_info() + local network = require"luci.model.network".init() + local accumulator = {} + get_basic_net_info(network, "lan", accumulator) + get_wifi_info(network, "wlan0", accumulator) + return accumulator +end + +local info = collect_wifi_info() + +print("Current WiFi configuration") +if info.ssid then + print("SSID: " .. info.ssid) +end +if info.mode then + print("Mode: " .. info.mode) +end +if info.quality then + print("Signal: " .. info.quality .. "%") +end +if info.encryption then + print("Encryption method: " .. info.encryption) +end +if info.iface then + print("Interface name: " .. info.iface) +end +if info.uptime then + print("Active for: " .. math.floor(info.uptime / 60) .. " minutes") +end +if #info.ipaddrs > 0 then + print("IP address: " .. info.ipaddrs[1].addr .. "/" .. info.ipaddrs[1].netmask) +end +if info.mac then + print("MAC address: " .. info.mac) +end +if info.rx_bytes and info.tx_bytes then + print("RX/TX: " .. math.floor(info.rx_bytes / 1024) .. "/" .. math.floor(info.tx_bytes / 1024) .. " KBs") +end diff --git a/utils/yunbridge/files/usr/lib/lua/luci/controller/arduino/index.lua b/utils/yunbridge/files/usr/lib/lua/luci/controller/arduino/index.lua new file mode 100644 index 0000000..8d3b7eb --- /dev/null +++ b/utils/yunbridge/files/usr/lib/lua/luci/controller/arduino/index.lua @@ -0,0 +1,414 @@ +--[[ +This file is part of YunWebUI. + +YunWebUI is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +As a special exception, you may use this file as part of a free software +library without restriction. Specifically, if other files instantiate +templates or use macros or inline functions from this file, or you compile +this file and link it with other files to produce an executable, this +file does not by itself cause the resulting executable to be covered by +the GNU General Public License. This exception does not however +invalidate any other reasons why the executable file might be covered by +the GNU General Public License. + +Copyright 2013 Arduino LLC (http://www.arduino.cc/) +]] + +module("luci.controller.arduino.index", package.seeall) + +local function not_nil_or_empty(value) + return value and value ~= "" +end + +local function get_first(cursor, config, type, option) + return cursor:get_first(config, type, option) +end + +local function set_first(cursor, config, type, option, value) + cursor:foreach(config, type, function(s) + if s[".type"] == type then + cursor:set(config, s[".name"], option, value) + end + end) +end + + +local function to_key_value(s) + local parts = luci.util.split(s, ":") + parts[1] = luci.util.trim(parts[1]) + parts[2] = luci.util.trim(parts[2]) + return parts[1], parts[2] +end + +function http_error(code, text) + luci.http.prepare_content("text/plain") + luci.http.status(code) + if text then + luci.http.write(text) + end +end + +function index() + function luci.dispatcher.authenticator.arduinoauth(validator, accs, default) + require("luci.controller.arduino.index") + + local user = luci.http.formvalue("username") + local pass = luci.http.formvalue("password") + local basic_auth = luci.http.getenv("HTTP_AUTHORIZATION") + + if user and validator(user, pass) then + return user + end + + if basic_auth and basic_auth ~= "" then + local decoded_basic_auth = nixio.bin.b64decode(string.sub(basic_auth, 7)) + user = string.sub(decoded_basic_auth, 0, string.find(decoded_basic_auth, ":") - 1) + pass = string.sub(decoded_basic_auth, string.find(decoded_basic_auth, ":") + 1) + end + + if user then + if #pass ~= 64 and validator(user, pass) then + return user + elseif #pass == 64 then + local uci = luci.model.uci.cursor() + uci:load("yunbridge") + local stored_encrypted_pass = uci:get_first("yunbridge", "bridge", "password") + if pass == stored_encrypted_pass then + return user + end + end + end + + luci.http.header("WWW-Authenticate", "Basic realm=\"yunbridge\"") + luci.http.status(401) + + return false + end + + local function make_entry(path, target, title, order) + local page = entry(path, target, title, order) + page.leaf = true + return page + end + + -- web panel + local webpanel = entry({ "webpanel" }, alias("webpanel", "go_to_homepage"), _("%s Web Panel") % luci.sys.hostname(), 10) + webpanel.sysauth = "root" + webpanel.sysauth_authenticator = "arduinoauth" + + make_entry({ "webpanel", "go_to_homepage" }, call("go_to_homepage"), nil) + + --api security level + local uci = luci.model.uci.cursor() + uci:load("yunbridge") + local secure_rest_api = uci:get_first("yunbridge", "bridge", "secure_rest_api") + local rest_api_sysauth = false + if secure_rest_api == "true" then + rest_api_sysauth = webpanel.sysauth + end + + --storage api + local data_api = node("data") + data_api.sysauth = rest_api_sysauth + data_api.sysauth_authenticator = webpanel.sysauth_authenticator + make_entry({ "data", "get" }, call("storage_send_request"), nil).sysauth = rest_api_sysauth + make_entry({ "data", "put" }, call("storage_send_request"), nil).sysauth = rest_api_sysauth + make_entry({ "data", "delete" }, call("storage_send_request"), nil).sysauth = rest_api_sysauth + local mailbox_api = node("mailbox") + mailbox_api.sysauth = rest_api_sysauth + mailbox_api.sysauth_authenticator = webpanel.sysauth_authenticator + make_entry({ "mailbox" }, call("build_bridge_mailbox_request"), nil).sysauth = rest_api_sysauth + + --plain socket endpoint + local plain_socket_endpoint = make_entry({ "arduino" }, call("board_plain_socket"), nil) + plain_socket_endpoint.sysauth = rest_api_sysauth + plain_socket_endpoint.sysauth_authenticator = webpanel.sysauth_authenticator +end + +function go_to_homepage() + luci.http.redirect("/index.html") +end + +local function build_bridge_request(command, params) + + local bridge_request = { + command = command + } + + if command == "raw" then + params = table.concat(params, "/") + if not_nil_or_empty(params) then + bridge_request["data"] = params + end + return bridge_request + end + + if command == "get" then + if not_nil_or_empty(params[1]) then + bridge_request["key"] = params[1] + end + return bridge_request + end + + if command == "put" and not_nil_or_empty(params[1]) and params[2] then + bridge_request["key"] = params[1] + bridge_request["value"] = params[2] + return bridge_request + end + + if command == "delete" and not_nil_or_empty(params[1]) then + bridge_request["key"] = params[1] + return bridge_request + end + + return nil +end + +local function extract_jsonp_param(query_string) + if not not_nil_or_empty(query_string) then + return nil + end + + local qs_parts = string.split(query_string, "&") + for idx, value in ipairs(qs_parts) do + if string.find(value, "jsonp") == 1 or string.find(value, "callback") == 1 then + return string.sub(value, string.find(value, "=") + 1) + end + end +end + +local function parts_after(url_part) + local url = luci.http.getenv("PATH_INFO") + local url_after_part = string.find(url, "/", string.find(url, url_part) + 1) + if not url_after_part then + return {} + end + return luci.util.split(string.sub(url, url_after_part + 1), "/") +end + +function storage_send_request() + local method = luci.http.getenv("REQUEST_METHOD") + local jsonp_callback = extract_jsonp_param(luci.http.getenv("QUERY_STRING")) + local parts = parts_after("data") + local command = parts[1] + if not command or command == "" then + luci.http.status(404) + return + end + local params = {} + for idx, param in ipairs(parts) do + if idx > 1 and not_nil_or_empty(param) then + table.insert(params, param) + end + end + + -- TODO check method? + local bridge_request = build_bridge_request(command, params) + if not bridge_request then + luci.http.status(403) + return + end + + local uci = luci.model.uci.cursor() + uci:load("yunbridge") + local socket_timeout = uci:get_first("yunbridge", "bridge", "socket_timeout", 5) + + local sock, code, msg = nixio.connect("127.0.0.1", 5700) + if not sock then + code = code or "" + msg = msg or "" + http_error(500, "nil socket, " .. code .. " " .. msg) + return + end + + sock:setopt("socket", "sndtimeo", socket_timeout) + sock:setopt("socket", "rcvtimeo", socket_timeout) + sock:setopt("tcp", "nodelay", 1) + + local json = require("luci.json") + + sock:write(json.encode(bridge_request)) + sock:writeall("\n") + + local response_text = {} + while true do + local bytes = sock:recv(4096) + if bytes and #bytes > 0 then + table.insert(response_text, bytes) + end + + local json_response = json.decode(table.concat(response_text)) + if json_response then + sock:close() + luci.http.status(200) + if jsonp_callback then + luci.http.prepare_content("application/javascript") + luci.http.write(jsonp_callback) + luci.http.write("(") + luci.http.write_json(json_response) + luci.http.write(");") + else + luci.http.prepare_content("application/json") + luci.http.write(json.encode(json_response)) + end + return + end + + if not bytes or #response_text == 0 then + sock:close() + http_error(500, "Empty response") + return + end + end + + sock:close() +end + +function board_plain_socket() + local function send_response(response_text, jsonp_callback) + if not response_text then + luci.http.status(500) + return + end + + local rows = luci.util.split(response_text, "\r\n") + if #rows == 1 or string.find(rows[1], "Status") ~= 1 then + luci.http.prepare_content("text/plain") + luci.http.status(200) + luci.http.write(response_text) + return + end + + local body_start_at_idx = -1 + local content_type = "text/plain" + for idx, row in ipairs(rows) do + if row == "" then + body_start_at_idx = idx + break + end + + local key, value = to_key_value(row) + if string.lower(key) == "status" then + luci.http.status(tonumber(value)) + elseif string.lower(key) == "content-type" then + content_type = value + else + luci.http.header(key, value) + end + end + + local response_body = table.concat(rows, "\r\n", body_start_at_idx + 1) + if content_type == "application/json" and jsonp_callback then + local json = require("luci.json") + luci.http.prepare_content("application/javascript") + luci.http.write(jsonp_callback) + luci.http.write("(") + luci.http.write_json(json.decode(response_body)) + luci.http.write(");") + else + luci.http.prepare_content(content_type) + luci.http.write(response_body) + end + end + + local method = luci.http.getenv("REQUEST_METHOD") + local jsonp_callback = extract_jsonp_param(luci.http.getenv("QUERY_STRING")) + local parts = parts_after("arduino") + local params = {} + for idx, param in ipairs(parts) do + if not_nil_or_empty(param) then + table.insert(params, param) + end + end + + if #params == 0 then + luci.http.status(404) + return + end + + params = table.concat(params, "/") + + local uci = luci.model.uci.cursor() + uci:load("yunbridge") + local socket_timeout = uci:get_first("yunbridge", "bridge", "socket_timeout", 5) + + local sock, code, msg = nixio.connect("127.0.0.1", 5555) + if not sock then + code = code or "" + msg = msg or "" + http_error(500, "Could not connect to YunServer " .. code .. " " .. msg) + return + end + + sock:setopt("socket", "sndtimeo", socket_timeout) + sock:setopt("socket", "rcvtimeo", socket_timeout) + sock:setopt("tcp", "nodelay", 1) + + sock:write(params) + sock:writeall("\r\n") + + local response_text = sock:readall() + sock:close() + + send_response(response_text, jsonp_callback) +end + +function build_bridge_mailbox_request() + local method = luci.http.getenv("REQUEST_METHOD") + local jsonp_callback = extract_jsonp_param(luci.http.getenv("QUERY_STRING")) + local parts = parts_after("mailbox") + local params = {} + for idx, param in ipairs(parts) do + if not_nil_or_empty(param) then + table.insert(params, param) + end + end + + if #params == 0 then + luci.http.status(400) + return + end + + local bridge_request = build_bridge_request("raw", params) + if not bridge_request then + luci.http.status(403) + return + end + + local uci = luci.model.uci.cursor() + uci:load("yunbridge") + local socket_timeout = uci:get_first("yunbridge", "bridge", "socket_timeout", 5) + + local sock, code, msg = nixio.connect("127.0.0.1", 5700) + if not sock then + code = code or "" + msg = msg or "" + http_error(500, "nil socket, " .. code .. " " .. msg) + return + end + + sock:setopt("socket", "sndtimeo", socket_timeout) + sock:setopt("socket", "rcvtimeo", socket_timeout) + sock:setopt("tcp", "nodelay", 1) + + local json = require("luci.json") + + sock:write(json.encode(bridge_request)) + sock:writeall("\n") + sock:close() + + luci.http.status(200) +end diff --git a/utils/yunbridge/files/usr/lib/lua/luci/sha256.lua b/utils/yunbridge/files/usr/lib/lua/luci/sha256.lua new file mode 100644 index 0000000..b5e2dea --- /dev/null +++ b/utils/yunbridge/files/usr/lib/lua/luci/sha256.lua @@ -0,0 +1,199 @@ +-- +-- Code merged by gravityscore at http://pastebin.com/gsFrNjbt +-- +-- Adaptation of the Secure Hashing Algorithm (SHA-244/256) +-- Found Here: http://lua-users.org/wiki/SecureHashAlgorithm +-- +-- Using an adapted version of the bit library +-- Found Here: https://bitbucket.org/Boolsheet/bslf/src/1ee664885805/bit.lua +-- + +module("luci.sha256", package.seeall) + +local MOD = 2 ^ 32 +local MODM = MOD - 1 + +local function memoize(f) + local mt = {} + local t = setmetatable({}, mt) + function mt:__index(k) + local v = f(k) + t[k] = v + return v + end + + return t +end + +local function make_bitop_uncached(t, m) + local function bitop(a, b) + local res, p = 0, 1 + while a ~= 0 and b ~= 0 do + local am, bm = a % m, b % m + res = res + t[am][bm] * p + a = (a - am) / m + b = (b - bm) / m + p = p * m + end + res = res + (a + b) * p + return res + end + + return bitop +end + +local function make_bitop(t) + local op1 = make_bitop_uncached(t, 2 ^ 1) + local op2 = memoize(function(a) return memoize(function(b) return op1(a, b) end) end) + return make_bitop_uncached(op2, 2 ^ (t.n or 1)) +end + +local bxor1 = make_bitop({ [0] = { [0] = 0, [1] = 1 }, [1] = { [0] = 1, [1] = 0 }, n = 4 }) + +local function bxor(a, b, c, ...) + local z = nil + if b then + a = a % MOD + b = b % MOD + z = bxor1(a, b) + if c then z = bxor(z, c, ...) end + return z + elseif a then return a % MOD + else return 0 + end +end + +local function band(a, b, c, ...) + local z + if b then + a = a % MOD + b = b % MOD + z = ((a + b) - bxor1(a, b)) / 2 + if c then z = bit32_band(z, c, ...) end + return z + elseif a then return a % MOD + else return MODM + end +end + +local function bnot(x) return (-1 - x) % MOD end + +local function rshift1(a, disp) + if disp < 0 then return lshift(a, -disp) end + return math.floor(a % 2 ^ 32 / 2 ^ disp) +end + +local function rshift(x, disp) + if disp > 31 or disp < -31 then return 0 end + return rshift1(x % MOD, disp) +end + +local function lshift(a, disp) + if disp < 0 then return rshift(a, -disp) end + return (a * 2 ^ disp) % 2 ^ 32 +end + +local function rrotate(x, disp) + x = x % MOD + disp = disp % 32 + local low = band(x, 2 ^ disp - 1) + return rshift(x, disp) + lshift(low, 32 - disp) +end + +local k = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, +} + +local function str2hexa(s) + return (string.gsub(s, ".", function(c) return string.format("%02x", string.byte(c)) end)) +end + +local function num2s(l, n) + local s = "" + for i = 1, n do + local rem = l % 256 + s = string.char(rem) .. s + l = (l - rem) / 256 + end + return s +end + +local function s232num(s, i) + local n = 0 + for i = i, i + 3 do n = n * 256 + string.byte(s, i) end + return n +end + +local function preproc(msg, len) + local extra = 64 - ((len + 9) % 64) + len = num2s(8 * len, 8) + msg = msg .. "\128" .. string.rep("\0", extra) .. len + assert(#msg % 64 == 0) + return msg +end + +local function initH256(H) + H[1] = 0x6a09e667 + H[2] = 0xbb67ae85 + H[3] = 0x3c6ef372 + H[4] = 0xa54ff53a + H[5] = 0x510e527f + H[6] = 0x9b05688c + H[7] = 0x1f83d9ab + H[8] = 0x5be0cd19 + return H +end + +local function digestblock(msg, i, H) + local w = {} + for j = 1, 16 do w[j] = s232num(msg, i + (j - 1) * 4) end + for j = 17, 64 do + local v = w[j - 15] + local s0 = bxor(rrotate(v, 7), rrotate(v, 18), rshift(v, 3)) + v = w[j - 2] + w[j] = w[j - 16] + s0 + w[j - 7] + bxor(rrotate(v, 17), rrotate(v, 19), rshift(v, 10)) + end + + local a, b, c, d, e, f, g, h = H[1], H[2], H[3], H[4], H[5], H[6], H[7], H[8] + for i = 1, 64 do + local s0 = bxor(rrotate(a, 2), rrotate(a, 13), rrotate(a, 22)) + local maj = bxor(band(a, b), band(a, c), band(b, c)) + local t2 = s0 + maj + local s1 = bxor(rrotate(e, 6), rrotate(e, 11), rrotate(e, 25)) + local ch = bxor(band(e, f), band(bnot(e), g)) + local t1 = h + s1 + ch + k[i] + w[i] + h, g, f, e, d, c, b, a = g, f, e, d + t1, c, b, a, t1 + t2 + end + + H[1] = band(H[1] + a) + H[2] = band(H[2] + b) + H[3] = band(H[3] + c) + H[4] = band(H[4] + d) + H[5] = band(H[5] + e) + H[6] = band(H[6] + f) + H[7] = band(H[7] + g) + H[8] = band(H[8] + h) +end + +function sha256(msg) + msg = preproc(msg, #msg) + local H = initH256({}) + for i = 1, #msg, 64 do digestblock(msg, i, H) end + return str2hexa(num2s(H[1], 4) .. num2s(H[2], 4) .. num2s(H[3], 4) .. num2s(H[4], 4) .. + num2s(H[5], 4) .. num2s(H[6], 4) .. num2s(H[7], 4) .. num2s(H[8], 4)) +end \ No newline at end of file diff --git a/utils/yunbridge/patches/000-scripts.patch b/utils/yunbridge/patches/000-scripts.patch new file mode 100644 index 0000000..46f21bd --- /dev/null +++ b/utils/yunbridge/patches/000-scripts.patch @@ -0,0 +1,18 @@ +--- a/bridge/packet.py ++++ b/bridge/packet.py +@@ -93,12 +93,12 @@ + + def run(self, data): + if data[0] != 'X': +- call(['/usr/bin/blink-start', '100']) ++ #call(['/usr/bin/blink-start', '100']) + return chr(1) + if data[1:4] != '100': +- call(['/usr/bin/blink-start', '100']) ++ #call(['/usr/bin/blink-start', '100']) + return chr(2) +- call(['/usr/bin/blink-stop']) ++ #call(['/usr/bin/blink-stop']) + return chr(0) + '160' # send the actual bridge version + + class PacketReader: diff --git a/utils/zile/Makefile b/utils/zile/Makefile new file mode 100644 index 0000000..0bd9487 --- /dev/null +++ b/utils/zile/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2006-2016 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:=zile +PKG_VERSION:=2.3.24 +PKG_RELEASE:=4 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@GNU/zile +PKG_MD5SUM:=fe77d801ba69e0fb9b4914a04b9ff506 +PKG_MAINTAINER:=Ted Hess + +PKG_LICENSE:=GPL-3.0+ +PKG_LICENSE_FILES:=COPYING + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/zile + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libncursesw + TITLE:=very small emacs-like editor + URL:=http://www.gnu.org/software/zile/ + SUBMENU:=Editors +endef + +define Package/zile/description + Zile is a small Emacs clone. Zile is a customizable, self-documenting + real-time display editor. Zile was written to be as similar as possible + to Emacs; every Emacs user should feel at home with Zile. +endef + +CONFIGURE_VARS += \ + gl_cv_func_getopt_gnu=yes \ + gl_cv_warn__Wmudflap=no \ + gl_cv_warn__fmudflap=no + +CONFIGURE_ARGS += \ + --with-ncursesw \ + + +define Package/zile/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,zile)) diff --git a/utils/zile/patches/010-remove_gets_definition_warning.patch b/utils/zile/patches/010-remove_gets_definition_warning.patch new file mode 100644 index 0000000..55ad2c4 --- /dev/null +++ b/utils/zile/patches/010-remove_gets_definition_warning.patch @@ -0,0 +1,11 @@ +--- a/lib/stdio.in.h ++++ b/lib/stdio.in.h +@@ -733,7 +733,7 @@ _GL_CXXALIASWARN (gets); + /* It is very rare that the developer ever has full control of stdin, + so any use of gets warrants an unconditional warning. Assume it is + always declared, since it is required by C89. */ +-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); ++#define gets(a) fgets( a, sizeof(*(a)), stdin) + #endif + + diff --git a/utils/zip/Makefile b/utils/zip/Makefile new file mode 100644 index 0000000..e1ed068 --- /dev/null +++ b/utils/zip/Makefile @@ -0,0 +1,61 @@ +# +# Copyright (C) 2007-2016 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:=zip +PKG_REV:=30 +PKG_VERSION:=3.0 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)$(PKG_REV).tar.gz +PKG_SOURCE_URL:=@SF/infozip +PKG_MD5SUM:=7b74551e63f8ee6aab6fbc86676c0d37 +PKG_MAINTAINER:=Álvaro Fernández Rojas + +PKG_LICENSE:=BSD-4-Clause +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/zip$(PKG_REV) +PKG_CHECK_FORMAT_SECURITY:=0 + +include $(INCLUDE_DIR)/package.mk + +define Package/zip + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:= + TITLE:=Archiver for .zip files + URL:=http://infozip.sourceforge.net/Zip.html + SUBMENU:=Compression +endef + +define Package/zip/description + This is InfoZIP's zip program. It produces files that are fully + compatible with the popular PKZIP program; however, the command line + options are not identical. In other words, the end result is the same, + but the methods differ. +endef + +define Build/Configure +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) -f unix/Makefile generic \ + prefix="$(PKG_INSTALL_DIR)/usr" \ + CFLAGS="$(TARGET_CFLAGS)" \ + CC="$(TARGET_CC) $(TARGET_CFLAGS) -O $(TARGET_CPPFLAGS) -I. -DUNIX $(TARGET_LDFLAGS)" \ + IZ_BZIP2="no" \ + install +endef + +define Package/zip/install + $(INSTALL_DIR) $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,zip)) diff --git a/utils/zoneinfo/Makefile b/utils/zoneinfo/Makefile new file mode 100644 index 0000000..cd334f2 --- /dev/null +++ b/utils/zoneinfo/Makefile @@ -0,0 +1,242 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# Author: Michael Geddes + +include $(TOPDIR)/rules.mk + +PKG_NAME:=zoneinfo +PKG_VERSION:=2016j +PKG_VERSION_CODE:=2016j +PKG_RELEASE:=1 + +#As i couldn't find real license used "Public Domain" +#as referense to http://www.iana.org/time-zones/repository/tz-link.html +PKG_LICENSE:=Public Domain + +PKG_SOURCE:=tzdata$(PKG_VERSION).tar.gz +PKG_SOURCE_CODE:=tzcode$(PKG_VERSION_CODE).tar.gz +PKG_SOURCE_URL:=http://www.iana.org/time-zones/repository/releases +PKG_MD5SUM:=db361d005ac8b30a2d18c5ca38d3e8ab + +include $(INCLUDE_DIR)/package.mk + +define Download/tzcode + FILE=$(PKG_SOURCE_CODE) + URL=$(PKG_SOURCE_URL) + MD5SUM:=0684b98eb184fab250b6ca946862078d +endef + +$(eval $(call Download,tzcode)) + +define Package/zoneinfo/Default + SUBMENU:=Zoneinfo + TITLE:=Zone Information + SECTION:=utils + CATEGORY:=Utilities + MAINTAINER:=Vladimir Ulrich +endef + +define Package/zoneinfo-core +$(call Package/zoneinfo/Default) + TITLE:=Zone Information (core) +endef + +define Package/zoneinfo-simple +$(call Package/zoneinfo/Default) + TITLE:=Zone Information (simple) +endef + +define Package/zoneinfo-africa +$(call Package/zoneinfo/Default) + TITLE:=Zone Information (Africa) +endef + +define Package/zoneinfo-northamerica +$(call Package/zoneinfo/Default) + TITLE:=Zone Information (NorthAmerica) +endef + +define Package/zoneinfo-southamerica +$(call Package/zoneinfo/Default) + TITLE:=Zone Information (SouthAmerica) +endef + +define Package/zoneinfo-poles +$(call Package/zoneinfo/Default) + TITLE:=Zone Information (Arctic, Antarctic) +endef + +define Package/zoneinfo-asia +$(call Package/zoneinfo/Default) + TITLE:=Zone Information (Asia) +endef + +define Package/zoneinfo-atlantic +$(call Package/zoneinfo/Default) + TITLE:=Zone Information (Atlantic) +endef + +define Package/zoneinfo-australia-nz +$(call Package/zoneinfo/Default) + TITLE:=Zone Information (Australia-NZ) +endef + +define Package/zoneinfo-pacific +$(call Package/zoneinfo/Default) + TITLE:=Zone Information (Pacific) +endef + +define Package/zoneinfo-europe +$(call Package/zoneinfo/Default) + TITLE:=Zone Information (Europe) +endef + +define Package/zoneinfo-india +$(call Package/zoneinfo/Default) + TITLE:=Zone Information (India) +endef + +define Build/Prepare + (cd $(PKG_BUILD_DIR) && tar -xzf $(DL_DIR)/$(PKG_SOURCE_CODE) && tar -xzf $(DL_DIR)/$(PKG_SOURCE)) +endef + +define Build/Compile + CFLAGS="$(HOST_CFLAGS)" \ + $(MAKE) -C $(PKG_BUILD_DIR) -f Makefile \ + $(HOST_CONFIGURE_OPTS) \ + CC="$(HOSTCC)" \ + LD="\$$$$(CC)" \ + CPPFLAGS="$(HOST_CPPFLAGS)" \ + LDFLAGS="$(HOST_LDFLAGS)" \ + TOPDIR="$(PKG_INSTALL_DIR)" \ + TZDIR="$(PKG_INSTALL_DIR)/zoneinfo" \ + install +endef + +define Package/zoneinfo-core/install + $(INSTALL_DIR) $(1)/usr/share/zoneinfo + for i in \ + CET CST6CDT EET EST EST5EDT GB-Eire Eire \ + GB GMT GMT+0 GMT-0 GMT0 Greenwich \ + HST MET MST MST7MDT \ + PRC PST8PDT ROC ROK UCT UTC \ + Universal W-SU WET Zulu Etc/* zone.tab ; do \ + $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \ + $(1)/usr/share/zoneinfo ; \ + done +endef + +define Package/zoneinfo-simple/install + $(INSTALL_DIR) $(1)/usr/share/zoneinfo + for i in Pacific/Honolulu \ + America/Anchorage America/Los_Angeles America/Denver \ + America/Chicago America/New_York America/Caracas \ + America/Sao_Paulo Europe/London Europe/Paris \ + Africa/Cairo Europe/Moscow Asia/Dubai \ + Asia/Karachi Asia/Dhaka Asia/Bankok \ + Asia/Hong_Kong Asia/Tokyo Australia/Darwin \ + Australia/Adelaide Australia/Brisbane Australia/Sydney \ + Australia/Perth Pacific/Noumea ; do \ + $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \ + $(1)/usr/share/zoneinfo ; \ + done +endef + +define Package/zoneinfo-africa/install + $(INSTALL_DIR) $(1)/usr/share/zoneinfo/Africa + $(CP) $(PKG_INSTALL_DIR)/zoneinfo/Africa/* \ + $(1)/usr/share/zoneinfo/Africa +endef + +define Package/zoneinfo-northamerica/install + $(INSTALL_DIR) $(1)/usr/share/zoneinfo + for i in US America Canada Mexico Cuba Jamaica Navajo ; do \ + $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \ + $(1)/usr/share/zoneinfo ; \ + done + rm -rf $(1)/usr/share/zoneinfo/America/Argentina +endef + +define Package/zoneinfo-southamerica/install + $(INSTALL_DIR) $(1)/usr/share/zoneinfo + for i in Brazil Chile ; do \ + $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \ + $(1)/usr/share/zoneinfo ; \ + done + $(INSTALL_DIR) $(1)/usr/share/zoneinfo/America/Argentina + $(CP) $(PKG_INSTALL_DIR)/zoneinfo/America/Argentina/* \ + $(1)/usr/share/zoneinfo/America/Argentina +endef + +define Package/zoneinfo-poles/install + $(INSTALL_DIR) $(1)/usr/share/zoneinfo + for i in Antarctica Arctic ; do \ + $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \ + $(1)/usr/share/zoneinfo ; \ + done +endef + +define Package/zoneinfo-asia/install + $(INSTALL_DIR) $(1)/usr/share/zoneinfo + for i in Asia Japan Singapore Hongkong ; do \ + $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \ + $(1)/usr/share/zoneinfo ; \ + done +endef + +define Package/zoneinfo-atlantic/install + $(INSTALL_DIR) $(1)/usr/share/zoneinfo + for i in Atlantic Iceland ; do \ + $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \ + $(1)/usr/share/zoneinfo ; \ + done +endef + +define Package/zoneinfo-australia-nz/install + $(INSTALL_DIR) $(1)/usr/share/zoneinfo + for i in NZ NZ-CHAT Australia ; do \ + $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \ + $(1)/usr/share/zoneinfo ; \ + done +endef + +define Package/zoneinfo-pacific/install + $(INSTALL_DIR) $(1)/usr/share/zoneinfo + for i in Pacific Kwajalein ; do \ + $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \ + $(1)/usr/share/zoneinfo ; \ + done +endef + +define Package/zoneinfo-europe/install + $(INSTALL_DIR) $(1)/usr/share/zoneinfo + for i in Europe Portugal Poland ; do \ + $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \ + $(1)/usr/share/zoneinfo ; \ + done +endef + +define Package/zoneinfo-india/install + $(INSTALL_DIR) $(1)/usr/share/zoneinfo + for i in Indian ; do \ + $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \ + $(1)/usr/share/zoneinfo ; \ + done +endef + +$(eval $(call BuildPackage,zoneinfo-simple)) +$(eval $(call BuildPackage,zoneinfo-core)) +$(eval $(call BuildPackage,zoneinfo-africa)) +$(eval $(call BuildPackage,zoneinfo-northamerica)) +$(eval $(call BuildPackage,zoneinfo-southamerica)) +$(eval $(call BuildPackage,zoneinfo-poles)) +$(eval $(call BuildPackage,zoneinfo-asia)) +$(eval $(call BuildPackage,zoneinfo-atlantic)) +$(eval $(call BuildPackage,zoneinfo-australia-nz)) +$(eval $(call BuildPackage,zoneinfo-pacific)) +$(eval $(call BuildPackage,zoneinfo-europe)) +$(eval $(call BuildPackage,zoneinfo-india)) diff --git a/utils/zsh/Makefile b/utils/zsh/Makefile new file mode 100644 index 0000000..8bd4fcd --- /dev/null +++ b/utils/zsh/Makefile @@ -0,0 +1,83 @@ +# +# Copyright (C) 2013-2016 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:=zsh +PKG_VERSION:=5.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@SF/zsh +PKG_MD5SUM:=afe96fde08b70e23c1cab1ca7a68fb34 +PKG_MAINTAINER:=Vadim A. Misbakh-Soloviov +PKG_LICENSE:=ZSH + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/zsh + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Shells + TITLE:=The Z shell + DEPENDS:=+libncurses +libncursesw +libpcre +librt + URL:=http://www.zsh.org/ +endef + +define Package/zsh/description + Zsh is a UNIX command interpreter (shell) usable as an interactive + login shell and as a shell script command processor. Of the standard + shells, zsh most closely resembles ksh but includes many enhancements. + Zsh has command line editing, builtin spelling correction, programmable + command completion, shell functions (with autoloading), a history + mechanism, and a host of other features. +endef + +define Build/Configure + $(call Build/Configure/Default, \ + --bindir=/bin \ + --disable-etcdir \ + --disable-gdbm \ + --enable-pcre \ + --enable-multibyte \ + --enable-function-subdirs \ + --with-tcsetpgrp \ + --with-term-lib="ncursesw", \ + zsh_cv_sys_nis=no \ + zsh_cv_sys_nis_plus=no \ + ) + # Do not install these functions: + $(SED) 's, Completion/AIX/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules + $(SED) 's, Completion/BSD/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules + $(SED) 's, Completion/Cygwin/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules + $(SED) 's, Completion/Darwin/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules + $(SED) 's, Completion/Debian/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules + $(SED) 's, Completion/Mandriva/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules + $(SED) 's, Completion/Redhat/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules + $(SED) 's, Completion/Solaris/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules + $(SED) 's, Completion/X/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules + $(SED) 's, Completion/openSUSE/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules + # After mucking with 'config.modules', one must call + $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" prep +endef + +define Package/zsh/postinst +#!/bin/sh +grep zsh $${IPKG_INSTROOT}/etc/shells || \ + echo "/bin/zsh" >> $${IPKG_INSTROOT}/etc/shells +endef + +define Package/zsh/install + $(INSTALL_DIR) $(1)/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/zsh $(1)/bin/ + $(INSTALL_DIR) $(1)/usr/share/zsh/$(PKG_VERSION) + $(CP) $(PKG_INSTALL_DIR)/usr/share/zsh/$(PKG_VERSION)/* $(1)/usr/share/zsh/$(PKG_VERSION)/ +endef + +$(eval $(call BuildPackage,zsh)) -- 2.25.1