Re: Further XTI problems

"Brian F. G. Bidulock" <[email protected]>
Newsgroups gmane.linux.kernel.streams
Organization http://www.openss7.org/
Message-ID <[email protected]>
Robert,

Yah, it should return zero according to TPI Rev 2 as well as
XNS 5.2.  Caused by a change to the values of T_INVALID and
T_INFINITE I believe (that's my story and I'm sticking with
it).  Attached is a patch to inet.c and xnet.c.  Will be
corrected in the next release.

--brian

On Wed, 16 Feb 2005, [email protected] wrote:

> Hi,
> (more on the legacy port)
> 
> So having got to the stage where I can open a transport point, and make a
> connection using the XTI interface. I find that when i do a getinfo at this
> point I get a status of -2 in t_info->tsdu.
> 
> from the (inherited) spec I have in from of me it suggests that 'the
> transfer of normal data is not supported'. I don't understand this!
> 
> can anyone help.
> 
> many thanks
> 
> Rob
> 
> 
> _______________________________________________
> Linux-streams mailing list
> [email protected]
> http://gsyc.escet.urjc.es/mailman/listinfo/linux-streams

-- 
Brian F. G. Bidulock    ¦ The reasonable man adapts himself to the ¦
[email protected]    ¦ world; the unreasonable one persists in  ¦
http://www.openss7.org/ ¦ trying  to adapt the  world  to himself. ¦
                        ¦ Therefore  all  progress  depends on the ¦
                        ¦ unreasonable man. -- George Bernard Shaw ¦
inet.c.patch (text/plain, 5.4 KB)
Index: inet.c
===================================================================
RCS file: /u2/cvsroot/strinet/src/drivers/inet.c,v
retrieving revision 0.9.2.13
diff -u -r0.9.2.13 inet.c
--- inet.c	4 Feb 2005 08:58:40 -0000	0.9.2.13
+++ inet.c	16 Feb 2005 14:14:43 -0000
@@ -12662,7 +12662,7 @@
 STATIC int
 ss_w_data(queue_t *q, mblk_t *mp)
 {
-	int mlen, mmax;
+	long mlen, mmax;
 	struct msghdr msg;
 	ss_t *ss = PRIV(q);
 	if (ss->p.info.SERV_type == T_CLTS)
@@ -12672,10 +12672,8 @@
 	if ((1 << ss_get_state(ss)) & ~TSM_OUTDATA)
 		goto outstate;
 	mlen = msgdsize(mp);
-	mmax = ss->p.info.TIDU_size;
-	if (mmax < ss->p.info.TSDU_size && ss->p.info.TSDU_size != T_INVALID)
-		mmax = ss->p.info.ETSDU_size;
-	if (mlen > mmax)
+	if (((mmax = ss->p.info.TSDU_size) > 0 && mlen < mmax) || mmax == T_INVALID ||
+	    ((mmax = ss->p.info.TIDU_size) > 0 && mlen < mmax) || mmax == T_INVALID)
 		goto emsgsize;
 	msg.msg_name = NULL;
 	msg.msg_namelen = 0;
@@ -12684,7 +12682,7 @@
 	msg.msg_flags = (ss->p.prot.type == SOCK_SEQPACKET) ? MSG_EOR : 0;
 	return ss_sock_sendmsg(ss, mp, &msg);
       emsgsize:
-	ptrace(("%s: ERROR: message too large %d > %d\n", DRV_NAME, mlen, mmax));
+	ptrace(("%s: ERROR: message too large %ld > %ld\n", DRV_NAME, mlen, mmax));
 	goto error;
       outstate:
 	ptrace(("%s: ERROR: would place i/f out of state\n", DRV_NAME));
@@ -12706,7 +12704,7 @@
 STATIC int
 t_data_req(queue_t *q, mblk_t *mp)
 {
-	int mlen, mmax;
+	long mlen, mmax;
 	ss_t *ss = PRIV(q);
 	const struct T_data_req *p = (typeof(p)) mp->b_rptr;
 	struct msghdr msg;
@@ -12719,10 +12717,8 @@
 	if ((1 << ss_get_state(ss)) & ~TSM_OUTDATA)
 		goto outstate;
 	mlen = msgdsize(mp);
-	mmax = ss->p.info.TIDU_size;
-	if (mmax < ss->p.info.TSDU_size && ss->p.info.TSDU_size != T_INVALID)
-		mmax = ss->p.info.ETSDU_size;
-	if (mlen > mmax)
+	if (((mmax = ss->p.info.TSDU_size) > 0 && mlen < mmax) || mmax == T_INVALID ||
+	    ((mmax = ss->p.info.TIDU_size) > 0 && mlen < mmax) || mmax == T_INVALID)
 		goto emsgsize;
 	msg.msg_name = NULL;
 	msg.msg_namelen = 0;
@@ -12731,7 +12727,7 @@
 	msg.msg_flags = (ss->p.prot.type == SOCK_SEQPACKET && !p->MORE_flag) ? MSG_EOR : 0;
 	return ss_sock_sendmsg(ss, mp, &msg);
       emsgsize:
-	ptrace(("%s: ERROR: message too large %d > %d\n", DRV_NAME, mlen, mmax));
+	ptrace(("%s: ERROR: message too large %ld > %ld\n", DRV_NAME, mlen, mmax));
 	goto error;
       outstate:
 	ptrace(("%s: ERROR: would place i/f out of state\n", DRV_NAME));
@@ -12756,7 +12752,7 @@
 STATIC int
 t_exdata_req(queue_t *q, mblk_t *mp)
 {
-	int mlen, mmax;
+	long mlen, mmax;
 	ss_t *ss = PRIV(q);
 	const struct T_exdata_req *p = (typeof(p)) mp->b_rptr;
 	struct msghdr msg;
@@ -12769,10 +12765,8 @@
 	if ((1 << ss_get_state(ss)) & ~TSM_OUTDATA)
 		goto outstate;
 	mlen = msgdsize(mp);
-	mmax = ss->p.info.TIDU_size;
-	if (mmax < ss->p.info.ETSDU_size && ss->p.info.ETSDU_size != T_INVALID)
-		mmax = ss->p.info.ETSDU_size;
-	if (mlen > mmax)
+	if (((mmax = ss->p.info.ETSDU_size) > 0 && mlen < mmax) || mmax == T_INVALID ||
+	    ((mmax = ss->p.info.TIDU_size) > 0 && mlen < mmax) || mmax == T_INVALID)
 		goto emsgsize;
 	msg.msg_name = NULL;
 	msg.msg_namelen = 0;
@@ -12782,7 +12776,7 @@
 	    MSG_OOB | ((ss->p.prot.type == SOCK_SEQPACKET && !p->MORE_flag) ? MSG_EOR : 0);
 	return ss_sock_sendmsg(ss, mp, &msg);
       emsgsize:
-	ptrace(("%s: ERROR: message too large %d > %d\n", DRV_NAME, mlen, mmax));
+	ptrace(("%s: ERROR: message too large %ld > %ld\n", DRV_NAME, mlen, mmax));
 	goto error;
       outstate:
 	ptrace(("%s: ERROR: would place i/f out of state\n", DRV_NAME));
@@ -12957,6 +12951,7 @@
 STATIC int
 t_unitdata_req(queue_t *q, mblk_t *mp)
 {
+	long mmax;
 	ss_t *ss = PRIV(q);
 	size_t dlen = mp->b_cont ? msgdsize(mp->b_cont) : 0;
 	const struct T_unitdata_req *p = (typeof(p)) mp->b_rptr;
@@ -12964,7 +12959,8 @@
 		goto notsupport;
 	if (dlen == 0 && !(ss->p.info.PROVIDER_flag & T_SNDZERO))
 		goto baddata;
-	if (dlen > ss->p.info.TSDU_size || dlen > ss->p.info.TIDU_size)
+	if (((mmax = ss->p.info.TSDU_size) > 0 && dlen > mmax) || mmax == T_INVALID ||
+	    ((mmax = ss->p.info.TIDU_size) > 0 && dlen > mmax) || mmax == T_INVALID)
 		goto baddata;
 	if (ss_get_state(ss) != TS_IDLE)
 		goto outstate;
@@ -14121,7 +14117,7 @@
 	  T_INFINITE, 0xffff, T_CLTS, TS_UNBND, XPG4_1 & ~T_SNDZERO}}
 	,
 	{{PF_INET, SOCK_STREAM, IPPROTO_TCP},
-	 {T_INFO_ACK, T_INVALID, 1, T_INVALID, T_INVALID,
+	 {T_INFO_ACK, 0, 1, T_INVALID, T_INVALID,
 	  sizeof(struct sockaddr_in),
 	  T_INFINITE, 0xffff, T_COTS_ORD, TS_UNBND, XPG4_1 & ~T_SNDZERO}}
 	,
@@ -14151,12 +14147,12 @@
 	  T_INFINITE, 0xffff, T_CLTS, TS_UNBND, XPG4_1 & ~T_SNDZERO}}
 	,
 	{{PF_UNIX, SOCK_STREAM, 0},
-	 {T_INFO_ACK, T_INVALID, T_INVALID, T_INVALID, T_INVALID,
+	 {T_INFO_ACK, 0, T_INVALID, T_INVALID, T_INVALID,
 	  sizeof(struct sockaddr_un),
 	  T_INFINITE, 0xffff, T_COTS_ORD, TS_UNBND, XPG4_1 & ~T_SNDZERO}}
 	,
 	{{PF_UNIX, SOCK_STREAM, 0},
-	 {T_INFO_ACK, T_INVALID, T_INVALID, T_INVALID, T_INVALID,
+	 {T_INFO_ACK, 0, T_INVALID, T_INVALID, T_INVALID,
 	  sizeof(struct sockaddr_un),
 	  T_INFINITE, 0xffff, T_COTS, TS_UNBND, XPG4_1 & ~T_SNDZERO}}
 	,
@@ -14167,7 +14163,7 @@
 #if defined HAVE_OPENSS7_SCTP
 	,
 	{{PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP},
-	 {T_INFO_ACK, T_INVALID, T_INVALID, 536, T_INVALID,
+	 {T_INFO_ACK, T_INFINITE, T_INFINITE, 536, T_INVALID,
 	  8 * sizeof(struct sockaddr_in),
 	  T_INFINITE, 0xffff, T_COTS_ORD, TS_UNBND, XPG4_1 & ~T_SNDZERO}}
 #endif				/* defined HAVE_OPENSS7_SCTP */
xnet.c.patch (text/plain, 1.2 KB)
Index: xnet.c
===================================================================
RCS file: /u2/cvsroot/strxnet/src/lib/xnet.c,v
retrieving revision 0.9.2.8
diff -u -r0.9.2.8 xnet.c
--- xnet.c	4 Feb 2005 12:56:25 -0000	0.9.2.8
+++ xnet.c	16 Feb 2005 14:32:43 -0000
@@ -636,12 +636,13 @@
 __xnet_u_max_tsdu(struct _t_user *user)
 {
 	return ((user->info.tsdu == T_INFINITE
-		 || user->info.tsdu == T_INVALID) ? MAXINT : (user->info.tsdu >= 0 ? user->info.tsdu : 0));
+		 || user->info.tsdu == 0) ? MAXINT : (user->info.tsdu >= 0 ? user->info.tsdu : 0));
 }
 static int
 __xnet_u_max_etsdu(struct _t_user *user)
 {
-	return (user->info.etsdu == T_INFINITE ? MAXINT : (user->info.etsdu >= 0 ? user->info.etsdu : 0));
+	return ((user->info.etsdu == T_INFINITE
+		|| user->info.etsdu == 0) ? MAXINT : (user->info.etsdu >= 0 ? user->info.etsdu : 0));
 }
 static int
 __xnet_u_max_connect(struct _t_user *user)
@@ -1796,6 +1797,7 @@
 			int len;
 			switch ((len = user->info.tsdu)) {
 			case T_INFINITE:
+			case 0:
 				len = _T_DEFAULT_DATALEN;
 			default:
 				if (!(udata->udata.buf = (char *) malloc(len))) {
@@ -1807,7 +1809,6 @@
 					goto badalloc;
 				}
 				udata->udata.maxlen = len;
-			case 0:
 				break;
 			case T_INVALID:
 				if (fields != T_ALL) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.