[libss7-commits] mattf: trunk r89 - /trunk/

SVN commits to the libss7 project libss7-commits at lists.digium.com
Thu Jun 21 12:17:31 CDT 2007


Author: mattf
Date: Thu Jun 21 12:17:31 2007
New Revision: 89

URL: http://svn.digium.com/view/libss7?view=rev&rev=89
Log:
Fix for not setting dpc on call when we receive a new one.  Also, don't parse zero length messages or messages less than MTP2's minimum message size.  Remove unused default dpc code

Modified:
    trunk/isup.c
    trunk/isup.h
    trunk/mtp2.c
    trunk/mtp3.c
    trunk/ss7.c
    trunk/ss7_internal.h
    trunk/ss7linktest.c

Modified: trunk/isup.c
URL: http://svn.digium.com/view/libss7/trunk/isup.c?view=diff&rev=89&r1=88&r2=89
==============================================================================
--- trunk/isup.c (original)
+++ trunk/isup.c Thu Jun 21 12:17:31 2007
@@ -763,7 +763,7 @@
 	c->dpc = dpc;
 }
 
-static struct isup_call * isup_find_call(struct ss7 *ss7, int cic)
+static struct isup_call * isup_find_call(struct ss7 *ss7, unsigned int opc, int cic)
 {
 	struct isup_call *cur, *winner = NULL;
 
@@ -779,6 +779,7 @@
 	if (!winner) {
 		winner = __isup_new_call(ss7, 0);
 		winner->cic = cic;
+		winner->dpc = opc;
 	}
 
 	return winner;
@@ -926,7 +927,7 @@
 		rl.sls = c->cic & 0xf;
 
 	/* use CIC's DPC instead of linkset's DPC */
-	/* rl.dpc = ss7->def_dpc; */
+
 	rl.dpc = c->dpc;
 	rl.type = ss7->switchtype;
 	rlsize = set_routinglabel(rlptr, &rl);
@@ -1145,7 +1146,7 @@
 	return 0;
 }
 
-int isup_receive(struct ss7 *ss7, struct mtp2 *link, unsigned char *buf, int len)
+int isup_receive(struct ss7 *ss7, struct mtp2 *link, unsigned int opc, unsigned char *buf, int len)
 {
 	unsigned short cic;
 	struct isup_h *mh;
@@ -1207,9 +1208,10 @@
 		case ISUP_CGUA:
 		case ISUP_CGU:
 			c = __isup_new_call(ss7, 1);
+			c->dpc = opc;
 			break;
 		default:
-			c = isup_find_call(ss7, cic);
+			c = isup_find_call(ss7, opc, cic);
 	}
 
 	if (!c) {
@@ -1428,7 +1430,6 @@
 	call.cic = begincic;
 	call.range = endcic - begincic;
 	call.dpc = dpc;
-	call.dpc = dpc;
 
 	if (call.range > 31)
 		return -1;

Modified: trunk/isup.h
URL: http://svn.digium.com/view/libss7/trunk/isup.h?view=diff&rev=89&r1=88&r2=89
==============================================================================
--- trunk/isup.h (original)
+++ trunk/isup.h Thu Jun 21 12:17:31 2007
@@ -146,7 +146,7 @@
 	unsigned int dpc;
 };
 
-int isup_receive(struct ss7 *ss7, struct mtp2 *sl, unsigned char *sif, int len);
+int isup_receive(struct ss7 *ss7, struct mtp2 *sl, unsigned int opc, unsigned char *sif, int len);
 
 int isup_dump(struct ss7 *ss7, struct mtp2 *sl, unsigned char *sif, int len);
 #endif /* _SS7_ISUP_H */

Modified: trunk/mtp2.c
URL: http://svn.digium.com/view/libss7/trunk/mtp2.c?view=diff&rev=89&r1=88&r2=89
==============================================================================
--- trunk/mtp2.c (original)
+++ trunk/mtp2.c Thu Jun 21 12:17:31 2007
@@ -824,6 +824,12 @@
 	struct mtp_su_head *h = (struct mtp_su_head *)buf;
 	len -= 2; /* Strip the CRC off */
 
+	if (len < MTP2_SIZE) {
+		ss7_message(link->master, "Got message smaller than the minimum SS7 SU length.  Dropping\n");
+		return 0;
+	}
+		
+
 	mtp2_dump(link, '<', buf, len - 2);
 
 	update_txbuf(link, h->bsn);

Modified: trunk/mtp3.c
URL: http://svn.digium.com/view/libss7/trunk/mtp3.c?view=diff&rev=89&r1=88&r2=89
==============================================================================
--- trunk/mtp3.c (original)
+++ trunk/mtp3.c Thu Jun 21 12:17:31 2007
@@ -499,7 +499,7 @@
 			return std_test_receive(ss7, link, sif, siflen);
 		case SIG_ISUP:
 			/* Skip the routing label */
-			return isup_receive(ss7, link, sif + rlsize, siflen - rlsize);
+			return isup_receive(ss7, link, rl.opc, sif + rlsize, siflen - rlsize);
 		case SIG_NET_MNG:
 			return net_mng_receive(ss7, link, sif, siflen);
 		case SIG_SCCP:

Modified: trunk/ss7.c
URL: http://svn.digium.com/view/libss7/trunk/ss7.c?view=diff&rev=89&r1=88&r2=89
==============================================================================
--- trunk/ss7.c (original)
+++ trunk/ss7.c Thu Jun 21 12:17:31 2007
@@ -203,12 +203,6 @@
 int ss7_set_pc(struct ss7 *ss7, unsigned int pc)
 {
 	ss7->pc = pc;
-	return 0;
-}
-
-int ss7_set_default_dpc(struct ss7 *ss7, unsigned int pc)
-{
-	ss7->def_dpc = pc;
 	return 0;
 }
 
@@ -307,7 +301,7 @@
 		return -1;
 
 	res = read(ss7->links[winner]->fd, buf, sizeof(buf));
-	if (res < 0) {
+	if (res <= 0) {
 		return res;
 	}
 

Modified: trunk/ss7_internal.h
URL: http://svn.digium.com/view/libss7/trunk/ss7_internal.h?view=diff&rev=89&r1=88&r2=89
==============================================================================
--- trunk/ss7_internal.h (original)
+++ trunk/ss7_internal.h Thu Jun 21 12:17:31 2007
@@ -55,8 +55,6 @@
 	unsigned int switchtype;
 	unsigned int numlinks;
 
-	/* Simple "routing table" */
-	point_code def_dpc;
 	/* Our point code */
 	point_code pc;
 

Modified: trunk/ss7linktest.c
URL: http://svn.digium.com/view/libss7/trunk/ss7linktest.c?view=diff&rev=89&r1=88&r2=89
==============================================================================
--- trunk/ss7linktest.c (original)
+++ trunk/ss7linktest.c Thu Jun 21 12:17:31 2007
@@ -274,7 +274,6 @@
 
 	ss7_set_pc(ss7, opc);
 	ss7_set_adjpc(ss7, fd, dpc);
-	ss7_set_default_dpc(ss7, dpc);
 
 	if (pthread_create(&tmp, NULL, ss7_run, &linkset[0])) {
 		perror("thread(0)");




More information about the libss7-commits mailing list