aboutsummaryrefslogtreecommitdiffstats
path: root/src/links.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-01-22 21:01:23 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-01-22 21:33:18 +0100
commitf6375b49d34a6adc7eaf42ebd06ab64037df9f0a (patch)
tree23e2f178494ce97faf6ef21f0ee861ea2b3c4c93 /src/links.c
parent36260e915a23892e5275866ef943783ec6a8e404 (diff)
pcap: Allow to log on a link or linkset level
Diffstat (limited to 'src/links.c')
-rw-r--r--src/links.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/links.c b/src/links.c
index 05ac2ee..628992b 100644
--- a/src/links.c
+++ b/src/links.c
@@ -107,6 +107,7 @@ int link_init(struct bsc_data *bsc)
bsc->link_set->ni = bsc->ni_ni;
bsc->link_set->spare = bsc->ni_spare;
bsc->link_set->bsc = bsc;
+ bsc->link_set->pcap_fd = bsc->pcap_fd;
if (!bsc->src_port) {
LOGP(DINP, LOGL_ERROR, "You need to set a UDP address.\n");
@@ -121,7 +122,7 @@ int link_init(struct bsc_data *bsc)
for (i = 1; i <= bsc->udp_nr_links; ++i) {
lnk = talloc_zero(bsc->link_set, struct mtp_udp_link);
- lnk->base.pcap_fd = bsc->pcap_fd;
+ lnk->base.pcap_fd = -1;
lnk->bsc = bsc;
lnk->data = &bsc->udp_data;
lnk->link_index = i;
@@ -180,7 +181,8 @@ int link_clear_all(struct mtp_link_set *set)
int mtp_handle_pcap(struct mtp_link *link, int dir, const uint8_t *data, int len)
{
if (link->pcap_fd < 0)
- return 0;
- mtp_pcap_write_msu(link->pcap_fd, data, len);
+ mtp_pcap_write_msu(link->pcap_fd, data, len);
+ if (link->set->pcap_fd < 0)
+ mtp_pcap_write_msu(link->set->pcap_fd, data, len);
return 0;
}