diff options
-rw-r--r-- | .SRCINFO | 16 | ||||
-rw-r--r-- | PKGBUILD | 72 | ||||
-rw-r--r-- | trueport-patch-6.8.0-6.8.3-stack-smashing.patch | 167 | ||||
-rw-r--r-- | trueport-patch-signal_pending-kernel-4-11.patch | 16 | ||||
-rw-r--r-- | tty_default_permissions.patch | 70 |
5 files changed, 268 insertions, 73 deletions
@@ -1,8 +1,8 @@ # Generated by mksrcinfo v8 -# Thu Mar 16 19:00:03 UTC 2017 +# Wed Jul 5 19:19:41 UTC 2017 pkgbase = trueport pkgdesc = tty driver for Perle IOLan+ DS TS SDS STS SCS JetStream LanStream LinkStream and 3rd party serial console terminal device servers - pkgver = 6.8.0 + pkgver = 6.8.3_1 pkgrel = 1 url = http://www.perle.com/ install = trueport-install.sh @@ -11,8 +11,12 @@ pkgbase = trueport license = GPL license = custom makedepends = awk - depends = openssl + makedepends = sed + makedepends = diffutils + makedepends = patch + depends = glibc depends = systemd + depends = openssl depends = linux depends = dkms depends = linux-headers @@ -25,8 +29,12 @@ pkgbase = trueport backup = etc/trueport/sslcfg.tp source = https://www.perle.com/downloads/drivers/trueport/linux2.6/trueport-6.8.0-2.tgz source = tty_default_permissions.patch + source = trueport-patch-6.8.0-6.8.3-stack-smashing.patch + source = trueport-patch-signal_pending-kernel-4-11.patch sha256sums = c03dc972166fb693411cafcc7fb01478022dbc5da19d4db0f505591df819a72e - sha256sums = 83eddfb8616aa27c2fbf6924bb91fdb0ba366b22668f72c51219779cd1ec258b + sha256sums = 28863731fd99e447dc456312ef33e40f93623b56da0d345e45f40e238ca49639 + sha256sums = 12e94a054970784e8b75548f8a60eaa1372aeaf92adee911854db1163488c6ad + sha256sums = 76157d41c665f36eddd4063aad05e75c53881b14d6a4218982da14b6aac9836e pkgname = trueport @@ -93,27 +93,40 @@ _opt_masterttypfx='px' # default px (this isn't very useful to users) set -u pkgname='trueport' -pkgver='6.8.0' -_pkgverrel='2' +pkgver='6.8.3_1' +#_dlver="${pkgver//_/-}" +_dlver='6.8.0-2' # only use this with a version change patch set +_srcdir="${pkgname}-${_dlver%%-*}" pkgrel='1' pkgdesc='tty driver for Perle IOLan+ DS TS SDS STS SCS JetStream LanStream LinkStream and 3rd party serial console terminal device servers' _pkgdescshort='Perle TruePort driver for Ethernet serial servers' arch=('i686' 'x86_64') url='http://www.perle.com/' license=('GPL' 'custom') -depends=('openssl' 'systemd') -makedepends=('awk') +depends=('glibc' 'systemd') +if [ "${_opt_SSL}" -ne 0 ]; then + depends+=('openssl') +fi +makedepends=('awk' 'sed' 'diffutils' 'patch') conflicts=('dgrp') # running together with dgrp eventually jams up trueport backup=(etc/trueport/{config.tp,pktfwdcfg.tp,sslcfg.tp}) options=('!docs' '!emptydirs' '!strip') install="${pkgname}-install.sh" _verwatch=('https://www.perle.com/downloads/server_ds1.shtml' '\s\+<a.*trueport-linux-tgz">\([^<]\+\)<.*' 'f') source=( - "https://www.perle.com/downloads/drivers/trueport/linux2.6/${pkgname}-${pkgver}-${_pkgverrel}.tgz" + "https://www.perle.com/downloads/drivers/trueport/linux2.6/${pkgname}-${_dlver}.tgz" 'tty_default_permissions.patch' + 'trueport-patch-6.8.0-6.8.3-stack-smashing.patch' + # http://dpdk.org/dev/patchwork/patch/22003/ [dpdk-dev] kni: fix build with kernel 4.11 lib/librte_eal/linuxapp/kni/compat.h lib/librte_eal/linuxapp/kni/kni_dev.h + # http://dpdk.org/dev/patchwork/patch/22037/ + # http://rglinuxtech.com/?p=1930 + # https://forum.manjaro.org/t/error-with-rtl8812au/24066 + 'trueport-patch-signal_pending-kernel-4-11.patch' ) sha256sums=('c03dc972166fb693411cafcc7fb01478022dbc5da19d4db0f505591df819a72e' - '83eddfb8616aa27c2fbf6924bb91fdb0ba366b22668f72c51219779cd1ec258b') + '28863731fd99e447dc456312ef33e40f93623b56da0d345e45f40e238ca49639' + '12e94a054970784e8b75548f8a60eaa1372aeaf92adee911854db1163488c6ad' + '76157d41c665f36eddd4063aad05e75c53881b14d6a4218982da14b6aac9836e') if [ "${_opt_DKMS}" -ne 0 ]; then depends+=('linux' 'dkms' 'linux-headers') @@ -123,7 +136,13 @@ fi prepare() { set -u - cd "${pkgname}-${pkgver}" + cd "${_srcdir}" + + # diff -pNaru5 'trueport-6.8.0' 'trueport-6.8.3' > 'trueport-patch-6.8.0-6.8.3-stack-smashing.patch' + patch -Nup1 < '../trueport-patch-6.8.0-6.8.3-stack-smashing.patch' + # diff -pNau5 ptyx/ptys.c{.orig,} > '../trueport-patch-signal_pending-kernel-4-11.patch' + patch -Nup0 < '../trueport-patch-signal_pending-kernel-4-11.patch' + # insert parameters and make install script non interactive. sed -e 's:^\(DONE\)=.*$:'"\1='done';SSL='${_opt_SSL}':g" \ -e 's:^\(MAXINSTPORTS\)=.*$:'"DONE='done';MAXINSTPORTS='${_opt_MAXINSTPORTS}':g" \ @@ -158,17 +177,16 @@ prepare() { sed -e "s:@TRUEPORT_TTY_PERMISSIONS@:${_opt_defaultmode}:g" \ -e "s:@TRUEPORT_TTY_GROUP@:uucp:g" \ "${srcdir}/tty_default_permissions.patch" | \ - patch -b -c -p0 - # diff -c5 'trueportd.c.orig' 'trueportd.c' > '../../tty_default_permissions.patch' + patch -Nbup0 + # diff -pNau5 trueportd.c{.orig,} > '../tty_default_permissions.patch' # Then change the two @@ items above - local _mk='ma''ke' # keep git-aurcheck quiet - ${_mk} -j1 clean + 'ma'ke -s -j1 clean # keep git-aurcheck quiet set +u } build() { set -u - cd "${pkgname}-${pkgver}" + cd "${_srcdir}" local _cflags=('-s' '-g -rdynamic') #_cflags[0]+=' -fno-stack-protector' local _makeflags=('-s' '') @@ -179,19 +197,21 @@ build() { package() { set -u - cd "${pkgname}-${pkgver}" + cd "${_srcdir}" if [ "${_opt_DKMS}" -eq 0 ]; then # I don't want Linux version info showing on AUR web. After a few months 'linux<0.0.0' makes it look like an out of date package. - local _kernelversionsmall="$(pacman -Q linux)" # this differs from uname -r. pacman: 4.0, uname: 4.0.0 - _kernelversionsmall="${_kernelversionsmall#* }" - _kernelversionsmall="${_kernelversionsmall%-*}" + local _kernelversionsmall="$(uname -r)" + _kernelversionsmall="${_kernelversionsmall%%-*}" + if [ "${_kernelversionsmall%\.0\.0}" != "${_kernelversionsmall}" ]; then # trim 4.0.0 -> 4.0 + _kernelversionsmall="${_kernelversionsmall%\.0}" + fi # prevent the mksrcinfo bash emulator from getting these vars! eval 'conf''licts=("linux>${_kernelversionsmall}" "linux<${_kernelversionsmall}")' eval 'dep''ends+=("linux=${_kernelversionsmall}")' fi - make DESTDIR="${pkgdir}" install + make -s -j1 DESTDIR="${pkgdir}" install rm -f '/tmp/files' # Not used by postinstall. Probably used in the rpm_build. # Fix postinstall to generate modprobe.conf. Stop after the first section. @@ -222,9 +242,10 @@ package() { # /lib is deprecated in Arch Linux mv -f "${pkgdir}/lib" "${pkgdir}/usr/lib/" + # systemd service install -Dm644 <(cat << EOF # Automatically generated by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR -# http://aur.archlinux.org/ +# https://aur.archlinux.org/ [Unit] Description=${_pkgdescshort} @@ -244,9 +265,10 @@ EOF if [ "${_opt_DKMS}" -ne 0 ]; then rm -rf "${pkgdir}/usr/lib/modules/" + local _dkms="${pkgdir}/usr/src/${pkgname}-${pkgver}" install -Dm644 <(cat << EOF # Automatically generated by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR -# http://aur.archlinux.org/ +# https://aur.archlinux.org/ PACKAGE_NAME="${pkgname}" PACKAGE_VERSION="${pkgver}" @@ -260,11 +282,10 @@ CLEAN[0]="make -j1 -C 'ptyx' clean" # Placing the DKMS generated module in a different location than the standard install prevents conflicts when PKGBUILD _opt_DKMS is toggled DEST_MODULE_LOCATION[0]="/kernel/drivers/misc" EOF - ) "${pkgdir}/usr/src/${pkgname}-${pkgver}/dkms.conf" - install -Dpm644 ptyx/* -t "${pkgdir}/usr/src/${pkgname}-${pkgver}/ptyx/" - make -C "${pkgdir}/usr/src/${pkgname}-${pkgver}/ptyx/" clean - rm "${pkgdir}/usr/src/${pkgname}-${pkgver}/ptyx/modules.order" - install -pm644 'tp_ver.h' 'tp.h' -t "${pkgdir}/usr/src/${pkgname}-${pkgver}/" + ) "${_dkms}/dkms.conf" + install -Dpm644 ptyx/* -t "${_dkms}/ptyx/" + rm "${_dkms}/ptyx/modules.order" + install -pm644 'tp_ver.h' 'tp.h' -t "${_dkms}/" sed -e '# No DKMS instructions say to do this but it works and keeps the MAKE line real simple' \ -e 's:$(shell uname -r):$(KERNELRELEASE):g' \ -e 's:`uname -r`:$(KERNELRELEASE):g' \ @@ -272,7 +293,8 @@ EOF -e '# Fix by changing the detection var.' \ -e '# SUBDIRS makes more sense to me because I can see it in the Makefile!' \ -e 's:^ifeq ($(KERNELRELEASE):ifeq ($(SUBDIRS):g' \ - -i "${pkgdir}/usr/src/${pkgname}-${pkgver}/ptyx/Makefile" + -i "${_dkms}/ptyx/Makefile" + make -s -C "${_dkms}/ptyx/" clean fi set +u } diff --git a/trueport-patch-6.8.0-6.8.3-stack-smashing.patch b/trueport-patch-6.8.0-6.8.3-stack-smashing.patch new file mode 100644 index 000000000000..866d7e862e4d --- /dev/null +++ b/trueport-patch-6.8.0-6.8.3-stack-smashing.patch @@ -0,0 +1,167 @@ +diff -pNaru5 trueport-6.8.0/pkt_forwarding.c trueport-6.8.3/pkt_forwarding.c +--- trueport-6.8.0/pkt_forwarding.c 2016-11-03 08:53:58.000000000 -0400 ++++ trueport-6.8.3/pkt_forwarding.c 2017-05-10 15:19:10.000000000 -0400 +@@ -628,12 +628,12 @@ void forward_frame( forwarding_info_t * + if (UseNewPktFwdLogic(pInfo) ) + { + // if theres a current data length then setup data pkt count + if ( (pInfo->pCurrDataPkt != NULL) && pInfo->curr_data_count) + { +- *pInfo->pCurrDataPkt = (unsigned char)(((htons((uint16_t)pInfo->curr_data_count))>> 8) & 0xFF); +- *(pInfo->pCurrDataPkt+1) = (unsigned char)((htons((uint16_t)pInfo->curr_data_count)) & 0xFF); ++ *pInfo->pCurrDataPkt = (unsigned char)((((uint16_t)pInfo->curr_data_count)>> 8) & 0xFF); ++ *(pInfo->pCurrDataPkt+1) = (unsigned char)(((uint16_t)pInfo->curr_data_count) & 0xFF); + } + else // if no current data then strip of pkt header + { + pInfo->count -= TPPKT_HDR_SIZE; + } +diff -pNaru5 trueport-6.8.0/pkt_forwarding.h trueport-6.8.3/pkt_forwarding.h +--- trueport-6.8.0/pkt_forwarding.h 2016-11-03 08:53:58.000000000 -0400 ++++ trueport-6.8.3/pkt_forwarding.h 2017-05-10 15:19:10.000000000 -0400 +@@ -93,12 +93,12 @@ typedef struct forwarding_info { + unsigned char dscmd; // indicate in-line commands that need to put in pkt fwd buffer + + // forwarding buffer + unsigned char *char_buf_ptr; + int count; +- unsigned long data_count; // count of only the data +- unsigned long curr_data_count; // current data pkt data count when using new pkt fwd logic ++ unsigned short data_count; // count of only the data ++ unsigned short curr_data_count; // current data pkt data count when using new pkt fwd logic + unsigned char *pCurrDataPkt; // this a pointer to the current data pkt + unsigned char char_buf[MAX_PKT_FWD_BUF_SIZE]; + int write_blocked; + } forwarding_info_t; + +diff -pNaru5 trueport-6.8.0/ptyx/ptym.c trueport-6.8.3/ptyx/ptym.c +--- trueport-6.8.0/ptyx/ptym.c 2016-11-03 08:53:58.000000000 -0400 ++++ trueport-6.8.3/ptyx/ptym.c 2017-05-10 15:19:10.000000000 -0400 +@@ -392,11 +392,15 @@ static int ptyx_master_ioctl(struct tty_ + ptyx_print(PTYX_DEBUG_IOCTL, ("ptyx_master_ioctl(%d): TCGETS, SLAVE NOT OPEN, returning default termios\n", ptyx_info->line)); + // slave not open so use the slave's default termios + tmp_termios = &ptyx_info->s_driver->init_termios; + } + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)) // Greater than 2.6.23 +- if (kernel_termios_to_user_termios((struct termios2 *)arg, tmp_termios)) ++#ifdef TCGETS2 ++ if (kernel_termios_to_user_termios_1((struct termios *)arg, tmp_termios)) ++#else ++ if (kernel_termios_to_user_termios((struct termios *)arg, tmp_termios)) ++#endif + #else + if (kernel_termios_to_user_termios((struct termios *)arg, tmp_termios)) + #endif + { + ptyx_print(PTYX_DEBUG_IOCTL, ("ptyx_master_ioctl(%d): return -EFAULT\n", ptyx_info->line)); +diff -pNaru5 trueport-6.8.0/README trueport-6.8.3/README +--- trueport-6.8.0/README 2016-11-03 08:53:58.000000000 -0400 ++++ trueport-6.8.3/README 2017-05-10 15:19:10.000000000 -0400 +@@ -1,12 +1,12 @@ + ============================================================================
+ Perle TruePort Daemon and Driver for Linux
+- Copyright (C) 2004-2016, Perle Systems Limited
++ Copyright (C) 2004-2017, Perle Systems Limited
+ =============================================================================
+
+- Release : 6.8.0
+- Date : September 2016
++ Release : 6.8.3
++ Date : May 2017
+ O/S Compatibility : Linux Versions 2.6.x, 3.x, 4.x
+
+ =============================================================================
+
+ Introduction:
+@@ -134,10 +134,13 @@ Known Issues: + Release History:
+ ================
+
+ Version Description
+ ------- -----------
++6.8.3 * Fix stack corruption issue in trueportd
++6.8.2 * Fix issue with packet idle timeout forwarding option not working
++6.8.1 * Fix issue with keep alive not working correctly
+ 6.8.0 * Maintenance release
+ * fixed issue with stty settings not being sent to the IOLAN
+ 6.7.10 * Fix to work with 4.6.x kernels
+ 6.7.9 * Fix for tty lockup while waiting for the TCP connection
+ during an open.
+diff -pNaru5 trueport-6.8.0/tp.h trueport-6.8.3/tp.h +--- trueport-6.8.0/tp.h 2016-11-03 08:53:58.000000000 -0400 ++++ trueport-6.8.3/tp.h 2017-05-10 15:19:10.000000000 -0400 +@@ -1,18 +1,18 @@ + /****************************************************************** + Module: tp.h + + Description: Device Server Protocol Definitions for TruePort + +- Copyright (c) 1999-2015 Perle Systems Limited. All rights reserved. ++ Copyright (c) 1999-2017 Perle Systems Limited. All rights reserved. + + *******************************************************************/ + + #ifndef _TP_H + #define _TP_H + +-#define TP_VERSION "6.8.0" ++#define TP_VERSION "6.8.3" + + #if defined(CONFIG_PPC64) || defined(CONFIG_SPARC64) + #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) + #include <linux/soundcard.h> + #define TP_USE_SOUNDCARD_IOCTLS +diff -pNaru5 trueport-6.8.0/trueportd.c trueport-6.8.3/trueportd.c +--- trueport-6.8.0/trueportd.c 2016-11-03 08:53:58.000000000 -0400 ++++ trueport-6.8.3/trueportd.c 2017-05-10 15:19:10.000000000 -0400 +@@ -452,11 +452,11 @@ int main(int argc, char **argv) + trace(tl_error, "TCP port not specified\n"); + exit(-1); + } + + trace(tl_status, "TruePort starting Version %s on port %d", TP_VERSION, tcp_port); +- trace(tl_status, " - (c) 1999-2010, Perle Systems Limited\n" ); ++ trace(tl_status, " - (c) 1999-2017, Perle Systems Limited\n" ); + + // if client I/O type name defined then set enumeration value + if (io_type_name) + { + if (!strcmp(io_type_name, IOMBASCIIarg)) +@@ -814,14 +814,18 @@ int main(int argc, char **argv) + // only do keep alive logic if in data transfer state + if ( IsNoUDP() && (state == s_data_transfer) ) + { + // if we've already sent one without a response then close connection + // we will ignore keep-alive expiring if we are blocked on tty writes +- if (keepalive_sent && !tty_write_blocked) ++//debug-gps if (keepalive_sent && !tty_write_blocked) ++ if (keepalive_sent) + { +- trace(tl_info, "No keep-alive response, Closing connection\n"); +- close_connection(); ++ if (!tty_write_blocked) //debug-gps ++ { ++ trace(tl_info, "No keep-alive response, Closing connection\n"); ++ close_connection(); ++ } + keepalive_sent = 0; + } + else + { + ret = write_dserver_imm_ctrl(dserver_fd, DS_UDP_KEEP_ALIVE, 0); +@@ -830,11 +834,14 @@ int main(int argc, char **argv) + trace(tl_error, "Error sending Keep-alive immediate cmd, closing connection\n"); + close_connection(); + } + else + { +- keepalive_sent = 1; ++ if (!tty_write_blocked) //debug-gps ++ { ++ keepalive_sent = 1; ++ } + } + } + } + // otherwise send UDP keep-alive + // only do keep alive logic if in data transfer satae diff --git a/trueport-patch-signal_pending-kernel-4-11.patch b/trueport-patch-signal_pending-kernel-4-11.patch new file mode 100644 index 000000000000..ecd868b51806 --- /dev/null +++ b/trueport-patch-signal_pending-kernel-4-11.patch @@ -0,0 +1,16 @@ +--- ptyx/ptys.c.orig 2016-11-03 08:53:58.000000000 -0400 ++++ ptyx/ptys.c 2017-07-03 23:18:20.533207642 -0400 +@@ -24,10 +24,13 @@ + + #include <linux/module.h> /* For EXPORT_SYMBOL */ + + #include <linux/errno.h> + #include <linux/sched.h> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) ++#include <linux/sched/signal.h> ++#endif + #include <linux/interrupt.h> + #include <linux/tty.h> + #include <linux/tty_flip.h> + #include <linux/fcntl.h> + #include <linux/string.h> diff --git a/tty_default_permissions.patch b/tty_default_permissions.patch index f72fc365e2c4..173f5a8ee168 100644 --- a/tty_default_permissions.patch +++ b/tty_default_permissions.patch @@ -1,44 +1,26 @@ -*** trueportd.c.orig 2016-12-02 14:09:01.383822650 -0500 ---- trueportd.c 2016-12-02 14:10:46.453902417 -0500 -*************** -*** 1285,1301 **** - { - // if the device nodes do not exist, then create them - if( lstat( slave_ttyname, &stat_buf ) < 0 ) - { - trace( tl_status, "Creating slave device node: %s \n", slave_ttyname ); -! sprintf( buf, "mknod %s c %d %d", slave_ttyname, PTYX_SLAVE_MAJOR, minor_number ); - if( system( buf ) == -1 ) - { - trace( tl_error, "Could not create slave device node: %s\n", slave_ttyname ); - trace( tl_error, " - %s\n", strerror( errno ) ); - exit(-1); - } - } - - if( lstat( master_ttyname, &stat_buf ) < 0 ) - { - trace( tl_status, "Creating master device node: %s \n", master_ttyname ); ---- 1285,1306 ---- - { - // if the device nodes do not exist, then create them - if( lstat( slave_ttyname, &stat_buf ) < 0 ) - { - trace( tl_status, "Creating slave device node: %s \n", slave_ttyname ); -! sprintf( buf, "mknod -m@TRUEPORT_TTY_PERMISSIONS@ %s c %d %d", slave_ttyname, PTYX_SLAVE_MAJOR, minor_number ); - if( system( buf ) == -1 ) - { - trace( tl_error, "Could not create slave device node: %s\n", slave_ttyname ); - trace( tl_error, " - %s\n", strerror( errno ) ); - exit(-1); - } -+ #include <grp.h> -+ { -+ struct group *g=getgrnam("uucp"); -+ if (g) chown(slave_ttyname,-1,g->gr_gid); -+ } - } - - if( lstat( master_ttyname, &stat_buf ) < 0 ) - { - trace( tl_status, "Creating master device node: %s \n", master_ttyname ); +--- trueportd.c.orig 2017-07-03 22:10:37.742810625 -0400 ++++ trueportd.c 2017-07-03 22:10:37.752810626 -0400 +@@ -1292,17 +1292,22 @@ int open_tty() + { + // if the device nodes do not exist, then create them + if( lstat( slave_ttyname, &stat_buf ) < 0 ) + { + trace( tl_status, "Creating slave device node: %s \n", slave_ttyname ); +- sprintf( buf, "mknod %s c %d %d", slave_ttyname, PTYX_SLAVE_MAJOR, minor_number ); ++ sprintf( buf, "mknod -m@TRUEPORT_TTY_PERMISSIONS@ %s c %d %d", slave_ttyname, PTYX_SLAVE_MAJOR, minor_number ); + if( system( buf ) == -1 ) + { + trace( tl_error, "Could not create slave device node: %s\n", slave_ttyname ); + trace( tl_error, " - %s\n", strerror( errno ) ); + exit(-1); + } ++#include <grp.h> ++{ ++ struct group *g=getgrnam("@TRUEPORT_TTY_GROUP@"); ++ if (g) chown(slave_ttyname,-1,g->gr_gid); ++} + } + + if( lstat( master_ttyname, &stat_buf ) < 0 ) + { + trace( tl_status, "Creating master device node: %s \n", master_ttyname ); |