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-17 22:23:24 +0100 |
commit | 079c85b0745f3e4371e8560db6e3b76afb054a17 (patch) | |
tree | 59b003005246adf6472fb645c72ec9070289250c | |
parent | 541fd98a3ba5e6b03ae73b55f7ea2ea18917d376 (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; |