aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-02-17 18:41:33 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-02-17 19:34:28 +0100
commit4cee7c09018609332e057359cf8533624d64b918 (patch)
tree1765665a293e215b095290b1bea6f85ee00701ab
parent5e5758c78359d1f0a0e7dd5430a0556e3e743910 (diff)
m2ua: Start link only after we had the emergency alignment
This should avoid us getting an error as we are sending the SLTM too fast. In one way this makes sense, on the other hand we already have too many states and should remove some variables
-rw-r--r--include/sctp_m2ua.h1
-rw-r--r--src/sctp_m2ua.c10
2 files changed, 8 insertions, 3 deletions
diff --git a/include/sctp_m2ua.h b/include/sctp_m2ua.h
index 99af46e..34c8666 100644
--- a/include/sctp_m2ua.h
+++ b/include/sctp_m2ua.h
@@ -49,6 +49,7 @@ struct mtp_m2ua_link {
* what will happen to it. For load-sharing we
* will need to turn this into a list.
*/
+ int active;
int asp_active;
int established;
struct sctp_m2ua_conn *conn;
diff --git a/src/sctp_m2ua.c b/src/sctp_m2ua.c
index 113100f..9e17161 100644
--- a/src/sctp_m2ua.c
+++ b/src/sctp_m2ua.c
@@ -66,6 +66,7 @@ static void m2ua_conn_destroy(struct sctp_m2ua_conn *conn)
link_down(link->base);
link->established = 0;
link->asp_active = 0;
+ link->active = 0;
link->conn = NULL;
}
@@ -311,6 +312,10 @@ static int m2ua_handle_state_req(struct mtp_m2ua_link *link,
return -1;
}
m2ua_msg_free(conf);
+
+ LOGP(DINP, LOGL_NOTICE, "M2UA link-index %d is running.\n", link->link_index);
+ link->active = 1;
+ mtp_link_up(link->base);
break;
default:
LOGP(DINP, LOGL_ERROR, "Unknown STATE Request: %d\n", req);
@@ -341,8 +346,6 @@ static int m2ua_handle_est_req(struct mtp_m2ua_link *link,
}
link->established = 1;
- LOGP(DINP, LOGL_NOTICE, "M2UA/Link is established.\n");
- mtp_link_up(link->base);
m2ua_msg_free(conf);
return 0;
}
@@ -367,6 +370,7 @@ static int m2ua_handle_rel_req(struct mtp_m2ua_link *link,
}
link->established = 0;
+ link->active = 0;
LOGP(DINP, LOGL_NOTICE, "M2UA/Link is released.\n");
link_down(link->base);
m2ua_msg_free(conf);
@@ -564,7 +568,7 @@ static int sctp_m2ua_write(struct mtp_link *link, struct msgb *msg)
goto clean;
}
- if (!mlink->asp_active || !mlink->established) {
+ if (!mlink->asp_active || !mlink->established || !mlink->active) {
LOGP(DINP, LOGL_ERROR, "ASP not ready for %d/%s of %d/%s.\n",
link->nr, link->name, link->set->nr, link->set->name);
goto clean;