diff options
-rw-r--r-- | include/osmo-pcap/osmo_pcap_client.h | 4 | ||||
-rw-r--r-- | src/osmo_client_core.c | 6 | ||||
-rw-r--r-- | src/osmo_client_main.c | 1 |
3 files changed, 11 insertions, 0 deletions
diff --git a/include/osmo-pcap/osmo_pcap_client.h b/include/osmo-pcap/osmo_pcap_client.h index af94086..fc982f3 100644 --- a/include/osmo-pcap/osmo_pcap_client.h +++ b/include/osmo-pcap/osmo_pcap_client.h @@ -25,6 +25,7 @@ #include <inttypes.h> #include <pcap.h> +#include <osmocom/core/linuxlist.h> #include <osmocom/core/select.h> #include <osmocom/core/timer.h> #include <osmocom/core/write_queue.h> @@ -46,6 +47,8 @@ enum { }; struct osmo_pcap_client_conn { + struct llist_head entry; + char *srv_ip; int srv_port; struct osmo_wqueue wqueue; @@ -86,6 +89,7 @@ struct osmo_pcap_client { struct osmo_fd fd; struct osmo_pcap_client_conn conn; + struct llist_head conns; /* statistics */ struct rate_ctr_group *ctrg; diff --git a/src/osmo_client_core.c b/src/osmo_client_core.c index 203e6a2..b2010a9 100644 --- a/src/osmo_client_core.c +++ b/src/osmo_client_core.c @@ -155,6 +155,7 @@ static int forward_packet( static int pcap_read_cb(struct osmo_fd *fd, unsigned int what) { struct osmo_pcap_client *client = fd->data; + struct osmo_pcap_client_conn *conn; struct pcap_pkthdr hdr; const u_char *data; @@ -168,6 +169,8 @@ static int pcap_read_cb(struct osmo_fd *fd, unsigned int what) return 0; osmo_client_send_data(&client->conn, &hdr, data); + llist_for_each_entry(conn, &client->conns, entry) + osmo_client_send_data(conn, &hdr, data); return 0; } @@ -272,6 +275,7 @@ static void free_all(struct osmo_pcap_client *client) int osmo_client_capture(struct osmo_pcap_client *client, const char *device) { + struct osmo_pcap_client_conn *conn; int fd; talloc_free(client->device); @@ -316,6 +320,8 @@ int osmo_client_capture(struct osmo_pcap_client *client, const char *device) pcap_check_stats_cb(client); osmo_client_send_link(&client->conn); + llist_for_each_entry(conn, &client->conns, entry) + osmo_client_send_link(conn); if (client->filter_string) { osmo_install_filter(client); diff --git a/src/osmo_client_main.c b/src/osmo_client_main.c index 694470e..0d48e1b 100644 --- a/src/osmo_client_main.c +++ b/src/osmo_client_main.c @@ -222,6 +222,7 @@ int main(int argc, char **argv) vty_client_init(pcap_client); /* initialize the queue */ + INIT_LLIST_HEAD(&pcap_client->conns); pcap_client->conn.client = pcap_client; osmo_wqueue_init(&pcap_client->conn.wqueue, 10); pcap_client->conn.wqueue.bfd.fd = -1; |