From 23386132c92b92d5af9e4a0fe8c6b4adb0419c28 Mon Sep 17 00:00:00 2001
From: nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Date: Sat, 30 Apr 2005 22:52:49 +0000
Subject: [PATCH] revert to older version of 'ser', the new one just doesn't
 work

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@781 3c298f89-4303-0410-b956-a3cf2f4a3e73
---
 openwrt/package/ser/Makefile                  |   6 +-
 openwrt/package/ser/patches/100-sc.patch      |  54 ++++++++
 openwrt/package/ser/patches/110-locking.patch |  11 ++
 openwrt/package/ser/patches/120-main.patch    |  26 ++++
 .../{no-libfl.patch => 200-no_libfl.patch}    |  62 +++++-----
 ...me-paths.patch => 210-runtime_paths.patch} | 117 +++++++++---------
 .../ser/patches/220-default_config.patch      |  21 ++++
 7 files changed, 207 insertions(+), 90 deletions(-)
 create mode 100644 openwrt/package/ser/patches/100-sc.patch
 create mode 100644 openwrt/package/ser/patches/110-locking.patch
 create mode 100644 openwrt/package/ser/patches/120-main.patch
 rename openwrt/package/ser/patches/{no-libfl.patch => 200-no_libfl.patch} (51%)
 rename openwrt/package/ser/patches/{runtime-paths.patch => 210-runtime_paths.patch} (70%)
 create mode 100644 openwrt/package/ser/patches/220-default_config.patch

diff --git a/openwrt/package/ser/Makefile b/openwrt/package/ser/Makefile
index 59f0d9c1f..0266365cf 100644
--- a/openwrt/package/ser/Makefile
+++ b/openwrt/package/ser/Makefile
@@ -3,9 +3,9 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ser
-PKG_VERSION:=0.9.0
+PKG_VERSION:=0.8.14
 PKG_RELEASE:=1
-PKG_MD5SUM:=ae1f9b237f0006785ff22eafa1470ac4
+PKG_MD5SUM:=3e2e12c8dfbd7dad9199304093de0838
 
 PKG_SOURCE_URL:=ftp://ftp.berlios.de/pub/ser/$(PKG_VERSION)/src
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_src.tar.gz
@@ -29,10 +29,10 @@ $(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE)
 
 $(PKG_BUILD_DIR)/$(PKG_NAME): $(PKG_BUILD_DIR)/.patched
 	$(MAKE) -C $(PKG_BUILD_DIR) \
+		extra_defs="-DUSE_PTHREAD_MUTEX "  \
 		CC="$(TARGET_CC)" \
 		ARCH="$(ARCH)" \
 		COPTS="$(TARGET_CFLAGS)" \
-		modules="$(SER_MODULES)" \
 		modules all
 
 $(PKG_IPK): $(PKG_BUILD_DIR)/$(PKG_NAME)
diff --git a/openwrt/package/ser/patches/100-sc.patch b/openwrt/package/ser/patches/100-sc.patch
new file mode 100644
index 000000000..25ecb9b96
--- /dev/null
+++ b/openwrt/package/ser/patches/100-sc.patch
@@ -0,0 +1,54 @@
+--- ser-0.8.14.orig/scripts/sc	2004-07-27 11:41:40.000000000 +0200
++++ ser-0.8.14/scripts/sc	2005-02-07 23:10:30.000000000 +0100
+@@ -19,7 +19,7 @@
+ # configuration for starting/stopping ser
+ PID_FILE=/var/run/ser.pid
+ SYSLOG=1 # 0=output to console, 1=output to syslog
+-STARTOPTIONS= # for example -dddd
++STARTOPTIONS="-m 5"
+ 
+ # ser's FIFO server
+ if [ -z "$SER_FIFO" ]; then
+@@ -338,11 +338,7 @@
+ 			if [ $# -eq 2 ] ; then
+ 				fifo_cmd ul_show_contact $UL_TABLE $2
+ 			elif [ $# -eq 1 ] ; then
+-				printf "Dumping all contacts may take long: are you sure you want to proceed? [Y|N] "
+-				read answer
+-				if [ "$answer" = "y" -o "$answer" = "Y" ] ; then
+-					fifo_cmd ul_dump
+-				fi
++			        fifo_cmd ul_dump
+ 			else
+ 				echo "wrong number of params for usrloc show"
+ 				usage
+@@ -590,7 +586,7 @@
+ case $1 in
+ 
+ 	start)
+-		DIR=`dirname $0`
++		DIR=/usr/sbin
+ 		echo
+ 		printf "Starting SER : "
+ 		if [ -r $PID_FILE ] ; then
+@@ -612,6 +608,7 @@
+ 		printf "Stopping SER : "
+ 		if [ -r $PID_FILE ] ; then
+ 			kill `cat $PID_FILE`
++                        rm $PID_FILE
+ 			echo "stopped"
+ 		else
+ 			echo No PID file found!
+@@ -621,10 +618,11 @@
+ 	;;
+ 
+ 	restart)
+-	        DIR=`dirname $0`
++	        DIR=/usr/sbin
+ 		printf "Stopping SER : "
+ 		if [ -r $PID_FILE ] ; then
+ 			kill `cat $PID_FILE`
++                        rm $PID_FILE
+ 			echo "stopped"
+ 		else
+ 			echo No PID file found! SER problably not running
diff --git a/openwrt/package/ser/patches/110-locking.patch b/openwrt/package/ser/patches/110-locking.patch
new file mode 100644
index 000000000..196f71441
--- /dev/null
+++ b/openwrt/package/ser/patches/110-locking.patch
@@ -0,0 +1,11 @@
+--- ser-0.8.14.orig/locking.h	2004-07-27 01:18:35.000000000 +0200
++++ ser-0.8.14/locking.h	2004-12-26 15:39:03.000000000 +0100
+@@ -67,6 +67,8 @@
+ #define _locking_h
+ 
+ /* the order is important */
++#include <errno.h>
++#include "dprint.h"
+ #include "lock_ops.h"
+ #include "lock_alloc.h" 
+ 
diff --git a/openwrt/package/ser/patches/120-main.patch b/openwrt/package/ser/patches/120-main.patch
new file mode 100644
index 000000000..eacd0cc23
--- /dev/null
+++ b/openwrt/package/ser/patches/120-main.patch
@@ -0,0 +1,26 @@
+--- ser-0.8.14.orig/main.c	2004-06-28 17:41:21.000000000 +0200
++++ ser-0.8.14/main.c	2005-01-07 23:24:27.000000000 +0100
+@@ -1447,18 +1447,20 @@
+ 	/* seed the prng */
+ 	/* try to use /dev/random if possible */
+ 	seed=0;
++/* this read call is blocking on OpenWRT, further investigations are necessary
+ 	if ((rfd=open("/dev/random", O_RDONLY))!=-1){
+ try_again:
+ 		if (read(rfd, (void*)&seed, sizeof(seed))==-1){
+-			if (errno==EINTR) goto try_again; /* interrupted by signal */
++			if (errno==EINTR) goto try_again; 
+ 			LOG(L_WARN, "WARNING: could not read from /dev/random (%d)\n",
+ 						errno);
+ 		}
+ 		DBG("read %u from /dev/random\n", seed);
+ 			close(rfd);
+ 	}else{
+-		LOG(L_WARN, "WARNING: could not open /dev/random (%d)\n", errno);
+-	}
++*/
++		LOG(L_WARN, "WARNING: could not read from /dev/random (%d)\n", errno);
++//	}
+ 	seed+=getpid()+time(0);
+ 	DBG("seeding PRNG with %u\n", seed);
+ 	srand(seed);
diff --git a/openwrt/package/ser/patches/no-libfl.patch b/openwrt/package/ser/patches/200-no_libfl.patch
similarity index 51%
rename from openwrt/package/ser/patches/no-libfl.patch
rename to openwrt/package/ser/patches/200-no_libfl.patch
index 4a301a029..93533aba7 100644
--- a/openwrt/package/ser/patches/no-libfl.patch
+++ b/openwrt/package/ser/patches/200-no_libfl.patch
@@ -1,73 +1,75 @@
-diff -urN ser-0.9.0.old/Makefile.defs ser-0.9.0/Makefile.defs
---- ser-0.9.0.old/Makefile.defs	2004-12-16 18:50:40.000000000 +0100
-+++ ser-0.9.0/Makefile.defs	2005-03-25 15:24:03.000000000 +0100
-@@ -788,7 +788,7 @@
+Binary files ser-0.8.14.old/.cfg.lex.swp and ser-0.8.14.dev/.cfg.lex.swp differ
+diff -urN ser-0.8.14.old/Makefile.defs ser-0.8.14.dev/Makefile.defs
+--- ser-0.8.14.old/Makefile.defs	2004-07-27 13:38:33.000000000 +0200
++++ ser-0.8.14.dev/Makefile.defs	2005-05-01 01:18:12.000000000 +0200
+@@ -660,7 +660,7 @@
  endif
  YACC_FLAGS=-d -b cfg
  # on solaris add -lxnet (e.g. LIBS= -lxnet)
 -LIBS= -lfl -ldl -lresolv
-+LIBS= -ldl -lresolv
++LIBS=  -ldl -lresolv
  
  
  #os specific stuff
-@@ -826,7 +826,7 @@
+@@ -695,7 +695,7 @@
+ ifeq ($(CC_NAME), suncc)
+ 	LIBS= -lfast -ldl -lresolv
  endif
- 	OLD_SOLARIS= $(shell echo "$(OSREL)" | \
- 				sed -e 's/^5\.[0-6][^0-9]*$$/yes/' )
--	LIBS+= -L/usr/local/lib -lfl -lxnet -lnsl 
-+	LIBS+= -L/usr/local/lib -lxnet -lnsl 
- ifeq	($(OLD_SOLARIS), yes)
- 		LIBS+=-lposix4
- else
-@@ -841,9 +841,9 @@
+-	LIBS+= -L/usr/local/lib -lfl -lxnet -lrt -lnsl 
++	LIBS+= -L/usr/local/lib  -lxnet -lrt -lnsl 
+ 	# -lrt needed for sched_yield
+ endif
+ 
+@@ -705,9 +705,9 @@
  	ifneq ($(found_lock_method), yes)
  		DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
  		found_lock_method=yes
 -		LIBS= -pthread -lfl  #dlopen is in libc
-+		LIBS= -pthread  #dlopen is in libc
++		LIBS= -pthread   #dlopen is in libc
  	else
 -		LIBS= -lfl  #dlopen is in libc
-+		LIBS=  #dlopen is in libc
++		LIBS=   #dlopen is in libc
  	endif
  	YACC=yacc
  endif
-@@ -858,7 +858,7 @@
+@@ -722,7 +722,7 @@
  	# (symbols on openbsd are prefixed by "_")
  	YACC=yacc
  	# no sched_yield on openbsd unless linking with c_r (not recommended)
 -	LIBS= -lfl 
-+	LIBS= 
++	LIBS=  
  	OPENBSD_IS_AOUT= $(shell echo "$(OSREL)" | \
  				sed -e 's/^3\.[0-3][^0-9]*$$/yes/' |sed -e 's/^[0-2]\..*/yes/')
- # exception: on sparc openbsd 3.2 is elf and not aout
-@@ -885,7 +885,7 @@
+ 	
+@@ -740,7 +740,7 @@
  		found_lock_method=yes
  	endif
  	YACC=yacc
 -	LIBS= -lfl 
-+	LIBS= 
++	LIBS=  
  endif
  
  # OS X support, same as freebsd
-@@ -899,9 +899,9 @@
+@@ -754,9 +754,9 @@
  	ifneq ($(found_lock_method), yes)
  		DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
  		found_lock_method=yes
 -		LIBS= -pthread -lfl -lresolv  #dlopen is in libc
-+		LIBS= -pthread -lresolv  #dlopen is in libc
++		LIBS= -pthread  -lresolv  #dlopen is in libc
  	else
 -		LIBS= -lfl -lresolv  #dlopen is in libc
-+		LIBS= -lresolv  #dlopen is in libc
++		LIBS=  -lresolv  #dlopen is in libc
  	endif
  	LDFLAGS=        # darwin doesn't like -O2 or -E
  	MOD_LDFLAGS= -bundle -bundle_loader ../../$(MAIN_NAME)
-diff -urN ser-0.9.0.old/cfg.lex ser-0.9.0/cfg.lex
---- ser-0.9.0.old/cfg.lex	2004-11-30 17:28:23.000000000 +0100
-+++ ser-0.9.0/cfg.lex	2005-03-25 15:27:49.000000000 +0100
-@@ -90,6 +90,10 @@
- 	static char* addstr(struct str_buf *, char*, int);
- 	static void count();
+diff -urN ser-0.8.14.old/cfg.lex ser-0.8.14.dev/cfg.lex
+--- ser-0.8.14.old/cfg.lex	2004-02-12 17:17:48.000000000 +0100
++++ ser-0.8.14.dev/cfg.lex	2005-05-01 01:23:03.000000000 +0200
+@@ -71,7 +71,10 @@
  
+ 	static char* addstr(char*, char**);
+ 	static void count();
+-
 +	int yywrap(void)
 +	{
 +		return 1;
diff --git a/openwrt/package/ser/patches/runtime-paths.patch b/openwrt/package/ser/patches/210-runtime_paths.patch
similarity index 70%
rename from openwrt/package/ser/patches/runtime-paths.patch
rename to openwrt/package/ser/patches/210-runtime_paths.patch
index 483623e18..5d30e118c 100644
--- a/openwrt/package/ser/patches/runtime-paths.patch
+++ b/openwrt/package/ser/patches/210-runtime_paths.patch
@@ -1,52 +1,18 @@
-diff -urN ser-0.9.0.old/etc/ser.cfg ser-0.9.0/etc/ser.cfg
---- ser-0.9.0.old/etc/ser.cfg	2004-11-30 17:28:24.000000000 +0100
-+++ ser-0.9.0/etc/ser.cfg	2005-03-25 17:23:32.000000000 +0100
-@@ -25,20 +25,20 @@
- # ------------------ module loading ----------------------------------
- 
- # Uncomment this if you want to use SQL database
--#loadmodule "/usr/local/lib/ser/modules/mysql.so"
-+#loadmodule "/usr/lib/ser/modules/mysql.so"
- 
--loadmodule "/usr/local/lib/ser/modules/sl.so"
--loadmodule "/usr/local/lib/ser/modules/tm.so"
--loadmodule "/usr/local/lib/ser/modules/rr.so"
--loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
--loadmodule "/usr/local/lib/ser/modules/usrloc.so"
--loadmodule "/usr/local/lib/ser/modules/registrar.so"
--loadmodule "/usr/local/lib/ser/modules/textops.so"
-+loadmodule "/usr/lib/ser/modules/sl.so"
-+loadmodule "/usr/lib/ser/modules/tm.so"
-+loadmodule "/usr/lib/ser/modules/rr.so"
-+loadmodule "/usr/lib/ser/modules/maxfwd.so"
-+loadmodule "/usr/lib/ser/modules/usrloc.so"
-+loadmodule "/usr/lib/ser/modules/registrar.so"
-+loadmodule "/usr/lib/ser/modules/textops.so"
- 
- # Uncomment this if you want digest authentication
- # mysql.so must be loaded !
--#loadmodule "/usr/local/lib/ser/modules/auth.so"
--#loadmodule "/usr/local/lib/ser/modules/auth_db.so"
-+#loadmodule "/usr/lib/ser/modules/auth.so"
-+#loadmodule "/usr/lib/ser/modules/auth_db.so"
- 
- # ----------------- setting module-specific parameters ---------------
- 
-diff -urN ser-0.9.0.old/Makefile ser-0.9.0/Makefile
---- ser-0.9.0.old/Makefile	2004-12-08 20:06:12.000000000 +0100
-+++ ser-0.9.0/Makefile	2005-03-25 17:21:35.000000000 +0100
-@@ -198,8 +198,8 @@
+diff -urN ser-0.8.14.old/Makefile ser-0.8.14.dev/Makefile
+--- ser-0.8.14.old/Makefile	2004-07-27 01:18:34.000000000 +0200
++++ ser-0.8.14.dev/Makefile	2005-05-01 01:29:25.000000000 +0200
+@@ -194,8 +194,8 @@
  # binary dist. tar.gz
  .PHONY: bin
  bin:
 -	mkdir -p tmp/ser/usr/local
 -	$(MAKE) install basedir=tmp/ser prefix=/usr/local 
 +	mkdir -p tmp/ser/usr
-+	$(MAKE) install basedir=tmp/ser prefix=/usr
++	$(MAKE) install basedir=tmp/ser prefix=/usr 
  	$(TAR) -C tmp/ser/ -zcf ../$(NAME)-$(RELEASE)_$(OS)_$(ARCH).tar.gz .
  	rm -rf tmp/ser
  
-@@ -211,9 +211,9 @@
+@@ -207,9 +207,9 @@
  sunpkg:
  	mkdir -p tmp/ser
  	mkdir -p tmp/ser_sun_pkg
@@ -58,10 +24,10 @@ diff -urN ser-0.9.0.old/Makefile ser-0.9.0/Makefile
  	cd ..)
  	cat /dev/null > ../$(NAME)-$(RELEASE)-$(OS)-$(ARCH)-local
  	pkgtrans -s tmp/ser_sun_pkg/ ../$(NAME)-$(RELEASE)-$(OS)-$(ARCH)-local \
-diff -urN ser-0.9.0.old/Makefile.defs ser-0.9.0/Makefile.defs
---- ser-0.9.0.old/Makefile.defs	2005-03-25 15:28:58.000000000 +0100
-+++ ser-0.9.0/Makefile.defs	2005-03-25 17:26:09.000000000 +0100
-@@ -68,15 +68,15 @@
+diff -urN ser-0.8.14.old/Makefile.defs ser-0.8.14.dev/Makefile.defs
+--- ser-0.8.14.old/Makefile.defs	2005-05-01 01:18:12.000000000 +0200
++++ ser-0.8.14.dev/Makefile.defs	2005-05-01 01:42:55.000000000 +0200
+@@ -64,20 +64,20 @@
  # extra CC command line options (e.g  -march=athlon-mp)
  CC_EXTRA_OPTS ?=
   # install location
@@ -81,16 +47,22 @@ diff -urN ser-0.9.0.old/Makefile.defs ser-0.9.0/Makefile.defs
  
  BASEDIR ?=
  basedir = $(BASEDIR)
-@@ -121,7 +121,7 @@
+ # install prefixes for various stuff
+-cfg-prefix = $(basedir)$(prefix)
++cfg-prefix = /
+ bin-prefix = $(basedir)$(prefix)
+ modules-prefix = $(basedir)$(prefix)
+ doc-prefix = $(basedir)$(prefix)
+@@ -117,7 +117,7 @@
  endif
  ut-prefix = bin/
  # target dirs for various stuff
 -cfg-target = $(prefix)/$(cfg-dir)
 +cfg-target = /$(cfg-dir)
- bin-target = $(prefix)/$(bin-dir)
  modules-target = $(prefix)/$(modules-dir)
- doc-target = $(prefix)/$(doc-dir)
-@@ -817,7 +817,7 @@
+ 
+ 
+@@ -688,14 +688,14 @@
  		#MOD_LDFLAGS=-g -G
  	endif
  ifneq ($(TLS),)
@@ -99,16 +71,15 @@ diff -urN ser-0.9.0.old/Makefile.defs ser-0.9.0/Makefile.defs
  endif
  	YACC=yacc
  
-@@ -826,7 +826,7 @@
+ ifeq ($(CC_NAME), suncc)
+ 	LIBS= -lfast -ldl -lresolv
  endif
- 	OLD_SOLARIS= $(shell echo "$(OSREL)" | \
- 				sed -e 's/^5\.[0-6][^0-9]*$$/yes/' )
--	LIBS+= -L/usr/local/lib -lxnet -lnsl 
-+	LIBS+= -L/usr/lib -lxnet -lnsl 
- ifeq	($(OLD_SOLARIS), yes)
- 		LIBS+=-lposix4
- else
-@@ -918,7 +918,7 @@
+-	LIBS+= -L/usr/local/lib  -lxnet -lrt -lnsl 
++	LIBS+= -L/usr/lib  -lxnet -lrt -lnsl 
+ 	# -lrt needed for sched_yield
+ endif
+ 
+@@ -773,7 +773,7 @@
  
  #add libssl if needed
  ifneq ($(TLS),)
@@ -117,3 +88,35 @@ diff -urN ser-0.9.0.old/Makefile.defs ser-0.9.0/Makefile.defs
  endif
  
  ifneq ($(found_lock_method), yes)
+diff -urN ser-0.8.14.old/etc/ser.cfg ser-0.8.14.dev/etc/ser.cfg
+--- ser-0.8.14.old/etc/ser.cfg	2003-11-10 16:35:15.000000000 +0100
++++ ser-0.8.14.dev/etc/ser.cfg	2005-05-01 01:28:43.000000000 +0200
+@@ -26,19 +26,19 @@
+ # ------------------ module loading ----------------------------------
+ 
+ # Uncomment this if you want to use SQL database
+-#loadmodule "/usr/local/lib/ser/modules/mysql.so"
++#loadmodule "/usr/lib/ser/modules/mysql.so"
+ 
+-loadmodule "/usr/local/lib/ser/modules/sl.so"
+-loadmodule "/usr/local/lib/ser/modules/tm.so"
+-loadmodule "/usr/local/lib/ser/modules/rr.so"
+-loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
+-loadmodule "/usr/local/lib/ser/modules/usrloc.so"
+-loadmodule "/usr/local/lib/ser/modules/registrar.so"
++loadmodule "/usr/lib/ser/modules/sl.so"
++loadmodule "/usr/lib/ser/modules/tm.so"
++loadmodule "/usr/lib/ser/modules/rr.so"
++loadmodule "/usr/lib/ser/modules/maxfwd.so"
++loadmodule "/usr/lib/ser/modules/usrloc.so"
++loadmodule "/usr/lib/ser/modules/registrar.so"
+ 
+ # Uncomment this if you want digest authentication
+ # mysql.so must be loaded !
+-#loadmodule "/usr/local/lib/ser/modules/auth.so"
+-#loadmodule "/usr/local/lib/ser/modules/auth_db.so"
++#loadmodule "/usr/lib/ser/modules/auth.so"
++#loadmodule "/usr/lib/ser/modules/auth_db.so"
+ 
+ # ----------------- setting module-specific parameters ---------------
+ 
diff --git a/openwrt/package/ser/patches/220-default_config.patch b/openwrt/package/ser/patches/220-default_config.patch
new file mode 100644
index 000000000..7a766f220
--- /dev/null
+++ b/openwrt/package/ser/patches/220-default_config.patch
@@ -0,0 +1,21 @@
+diff -urN ser-0.8.14.old/config.h ser-0.8.14.dev/config.h
+--- ser-0.8.14.old/config.h	2004-04-27 22:28:59.000000000 +0200
++++ ser-0.8.14.dev/config.h	2005-05-01 01:48:00.000000000 +0200
+@@ -53,7 +53,7 @@
+ #define MAX_LISTEN 16
+ 
+ /* default number of child processes started */
+-#define CHILD_NO    8
++#define CHILD_NO    2
+ 
+ #define RT_NO 20 /* routing tables number */
+ #define FAILURE_RT_NO RT_NO /* on_failure routing tables number */
+@@ -117,7 +117,7 @@
+ #define PKG_MEM_POOL_SIZE 1024*1024
+ 
+ /*used if SH_MEM is defined*/
+-#define SHM_MEM_SIZE 32
++#define SHM_MEM_SIZE 8
+ 
+ #define TIMER_TICK 1
+ 
-- 
2.20.1