[svn-commits] mattf: branch mattf/bug13495 r249 - /team/mattf/bug13495/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Jan 6 18:36:41 CST 2009
Author: mattf
Date: Tue Jan 6 18:36:40 2009
New Revision: 249
URL: http://svn.digium.com/view/libss7?view=rev&rev=249
Log:
Masquerade functionality works in both directions. Now we have to figure out what to do about TCP link state (losing the socket fd and replacing it with a new one when the link comes up again)
Modified:
team/mattf/bug13495/isup_masq.c
team/mattf/bug13495/mtp3.c
team/mattf/bug13495/ss7.c
Modified: team/mattf/bug13495/isup_masq.c
URL: http://svn.digium.com/view/libss7/team/mattf/bug13495/isup_masq.c?view=diff&rev=249&r1=248&r2=249
==============================================================================
--- team/mattf/bug13495/isup_masq.c (original)
+++ team/mattf/bug13495/isup_masq.c Tue Jan 6 18:36:40 2009
@@ -131,15 +131,22 @@
{
unsigned char msg[1024];
int len;
- int res = -1;
+ int res = 0;
if (mtp2->tcpreadstate == TCPSTATE_NEED_LEN) {
len = get_msg_length(mtp2);
if (len < 0)
return -1;
+
+ if (len > 277) {
+ ss7_message(mtp2->master, "Got read length of %d?!\n", len);
+ return 0;
+ }
+
mtp2->tcplen = len;
mtp2->tcpreadstate = TCPSTATE_NEED_MSG;
+
} else {
len = mtp2->tcplen;
Modified: team/mattf/bug13495/mtp3.c
URL: http://svn.digium.com/view/libss7/team/mattf/bug13495/mtp3.c?view=diff&rev=249&r1=248&r2=249
==============================================================================
--- team/mattf/bug13495/mtp3.c (original)
+++ team/mattf/bug13495/mtp3.c Tue Jan 6 18:36:40 2009
@@ -1796,7 +1796,7 @@
return -1;
}
- memcpy(ss7_msg_userpart(m), msg, len);
+ memcpy(ss7_msg_userpart(m), msg + 1, len - 1);
ss7_msg_userpart_len(m, len);
Modified: team/mattf/bug13495/ss7.c
URL: http://svn.digium.com/view/libss7/team/mattf/bug13495/ss7.c?view=diff&rev=249&r1=248&r2=249
==============================================================================
--- team/mattf/bug13495/ss7.c (original)
+++ team/mattf/bug13495/ss7.c Tue Jan 6 18:36:40 2009
@@ -319,23 +319,31 @@
int ss7_pollflags(struct ss7 *ss7, int fd)
{
int i;
- int winner = -1;
+ struct mtp2 *winner = NULL;
int flags = POLLPRI | POLLIN;
for (i = 0; i < ss7->numlinks; i++) {
if (ss7->links[i]->fd == fd) {
- winner = i;
+ winner = ss7->links[i];
break;
}
}
- if (winner < 0)
- return -1;
-
- if (ss7->links[winner]->flags & MTP2_FLAG_ZAPMTP2) {
- if (ss7->links[winner]->flags & MTP2_FLAG_WRITE)
+ /* Maybe it's a lite link */
+ for (i = 0; i < ss7->numslavelinks; i++) {
+ if (ss7->slavelinks[i]->fd == fd) {
+ winner = ss7->links[i];
+ break;
+ }
+ }
+
+ if (!winner)
+ return -1;
+
+ if (winner->flags & MTP2_FLAG_ZAPMTP2) {
+ if (winner->flags & MTP2_FLAG_WRITE)
flags |= POLLOUT;
- } else if (ss7->links[winner]->flags & MTP2_FLAG_TCP) {
+ } else if (winner->flags & MTP2_FLAG_TCP) {
flags = POLLIN;
} else {
flags |= POLLOUT;
@@ -518,7 +526,7 @@
}
if (winner != -1) {
- res = isup_ip_receive(ss7->links[winner]);
+ res = isup_ip_receive(ss7->slavelinks[winner]);
}
exit:
More information about the svn-commits
mailing list