diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-01-17 22:23:24 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-01-20 11:37:49 +0100 |
commit | c17852ee3499cd17ea5547ed6b87d364e08eac5e (patch) | |
tree | 01ce3c8b2d060a09c3898b5dff27aa010f8c55b0 | |
parent | e13c5aa4185ba44319813a21132b03986c5e09c8 (diff) |
m2ua: Write MTP packets to the pcap file if requested.
-rw-r--r-- | src/sctp_m2ua.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/sctp_m2ua.c b/src/sctp_m2ua.c index 2ae7316..1ebae60 100644 --- a/src/sctp_m2ua.c +++ b/src/sctp_m2ua.c @@ -19,6 +19,7 @@ #include <bsc_data.h> #include <cellmgr_debug.h> #include <mtp_data.h> +#include <mtp_pcap.h> #include <osmocore/talloc.h> @@ -296,6 +297,7 @@ static int m2ua_handle_data(struct sctp_m2ua_conn *conn, { struct msgb *msg; struct m2ua_msg_part *data; + struct mtp_link *link; data = m2ua_msg_find_tag(m2ua, M2UA_TAG_DATA); if (!data) { @@ -316,7 +318,11 @@ static int m2ua_handle_data(struct sctp_m2ua_conn *conn, msg->l2h = msgb_put(msg, data->len); memcpy(msg->l2h, data->dat, data->len); - mtp_link_set_data(conn->trans->base.the_link, msg); + + link = &conn->trans->base; + if (link->pcap_fd >= 0) + mtp_pcap_write_msu(link->pcap_fd, msg->l2h, msgb_l2len(msg)); + mtp_link_set_data(link->the_link, msg); msgb_free(msg); return 0; @@ -457,6 +463,9 @@ static int sctp_m2ua_write(struct mtp_link *link, struct msgb *msg) if (!m2ua) return -1; + if (link->pcap_fd >= 0) + mtp_pcap_write_msu(link->pcap_fd, msg->data, msg->len); + m2ua->hdr.msg_class = M2UA_CLS_MAUP; m2ua->hdr.msg_type = M2UA_MAUP_DATA; |