From 718d4ba66c8469d6f9384cb45db511e9193e2475 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 25 Feb 2011 19:47:55 +0100 Subject: sctp: Only handle traffic with the payload type of M2UA --- src/sctp_m2ua.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/sctp_m2ua.c b/src/sctp_m2ua.c index 9ffcebc..fd4aa90 100644 --- a/src/sctp_m2ua.c +++ b/src/sctp_m2ua.c @@ -30,6 +30,8 @@ #include #include +#define SCTP_PPID_M2UA 2 + static struct mtp_m2ua_link *find_m2ua_link(struct sctp_m2ua_transport *trans, int link_index) { struct mtp_m2ua_link *link; @@ -554,6 +556,12 @@ static int m2ua_conn_read(struct bsc_fd *fd) return -1; } + if (ntohl(info.sinfo_ppid) != SCTP_PPID_M2UA) { + LOGP(DINP, LOGL_ERROR, "Only M2UA is allowed on this socket.\n"); + msgb_free(msg); + return -1; + } + msgb_put(msg, rc); LOGP(DINP, LOGL_DEBUG, "Read %d on stream: %d ssn: %d assoc: %d\n", rc, info.sinfo_stream, info.sinfo_ssn, info.sinfo_assoc_id); @@ -600,7 +608,7 @@ static int sctp_m2ua_write(struct mtp_link *link, struct msgb *msg) memset(&info, 0, sizeof(info)); info.sinfo_stream = 1; info.sinfo_assoc_id = 1; - info.sinfo_ppid = htonl(2); + info.sinfo_ppid = htonl(SCTP_PPID_M2UA); m2ua_conn_send(mlink->conn, m2ua, &info); m2ua_msg_free(m2ua); -- cgit v1.2.3