[e1] Enable dumping of LAPD frames again
Kill mi_set_pcap_fd from the header, introduce e1_set_pcap_fd and call it from bsc_hack.c. Hook into abis_rsl_sendmsg and _abis_nm_sendmsg for sending and e1inp_rx_ts for reading. It compiles and should not cause a regression.
This commit is contained in:
parent
66e092bbd6
commit
0469cf608b
|
@ -138,6 +138,9 @@ struct msgb *e1inp_tx_ts(struct e1inp_ts *e1i_ts,
|
||||||
/* called by driver in case some kind of link state event */
|
/* called by driver in case some kind of link state event */
|
||||||
int e1inp_event(struct e1inp_ts *ts, int evt, u_int8_t tei, u_int8_t sapi);
|
int e1inp_event(struct e1inp_ts *ts, int evt, u_int8_t tei, u_int8_t sapi);
|
||||||
|
|
||||||
|
/* Write LAPD frames to the fd. */
|
||||||
|
void e1_set_pcap_fd(int fd);
|
||||||
|
|
||||||
/* called by TRAU muxer to obtain the destination mux entity */
|
/* called by TRAU muxer to obtain the destination mux entity */
|
||||||
struct subch_mux *e1inp_get_mux(u_int8_t e1_nr, u_int8_t ts_nr);
|
struct subch_mux *e1inp_get_mux(u_int8_t e1_nr, u_int8_t ts_nr);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include "e1_input.h"
|
#include "e1_input.h"
|
||||||
|
|
||||||
int mi_setup(int cardnr, struct e1inp_line *line);
|
int mi_setup(int cardnr, struct e1inp_line *line);
|
||||||
void mi_set_pcap_fd(int fd);
|
|
||||||
int _abis_nm_sendmsg(struct msgb *msg);
|
int _abis_nm_sendmsg(struct msgb *msg);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -927,7 +927,6 @@ static int bootstrap_network(void)
|
||||||
|
|
||||||
static void create_pcap_file(char *file)
|
static void create_pcap_file(char *file)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
|
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
|
||||||
int fd = open(file, O_WRONLY|O_TRUNC|O_CREAT, mode);
|
int fd = open(file, O_WRONLY|O_TRUNC|O_CREAT, mode);
|
||||||
|
|
||||||
|
@ -936,10 +935,7 @@ static void create_pcap_file(char *file)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mi_set_pcap_fd(fd);
|
e1_set_pcap_fd(fd);
|
||||||
#else
|
|
||||||
fprintf(stderr, "PCAP support currently disabled!!\n");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_usage()
|
static void print_usage()
|
||||||
|
|
|
@ -62,7 +62,6 @@ LLIST_HEAD(e1inp_line_list);
|
||||||
/* to be implemented, e.g. by bsc_hack.c */
|
/* to be implemented, e.g. by bsc_hack.c */
|
||||||
void input_event(int event, enum e1inp_sign_type type, struct gsm_bts_trx *trx);
|
void input_event(int event, enum e1inp_sign_type type, struct gsm_bts_trx *trx);
|
||||||
|
|
||||||
#if 0
|
|
||||||
/*
|
/*
|
||||||
* pcap writing of the misdn load
|
* pcap writing of the misdn load
|
||||||
* pcap format is from http://wiki.wireshark.org/Development/LibpcapFileFormat
|
* pcap format is from http://wiki.wireshark.org/Development/LibpcapFileFormat
|
||||||
|
@ -114,7 +113,7 @@ static_assert(sizeof(struct fake_linux_lapd_header) == 16, lapd_header_size);
|
||||||
|
|
||||||
static int pcap_fd = -1;
|
static int pcap_fd = -1;
|
||||||
|
|
||||||
void mi_set_pcap_fd(int fd)
|
void e1_set_pcap_fd(int fd)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct pcap_hdr header = {
|
struct pcap_hdr header = {
|
||||||
|
@ -132,7 +131,7 @@ void mi_set_pcap_fd(int fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This currently only works for the D-Channel */
|
/* This currently only works for the D-Channel */
|
||||||
static void write_pcap_packet(int direction, struct sockaddr_mISDN* addr,
|
static void write_pcap_packet(int direction, int sapi, int tei,
|
||||||
struct msgb *msg) {
|
struct msgb *msg) {
|
||||||
if (pcap_fd < 0)
|
if (pcap_fd < 0)
|
||||||
return;
|
return;
|
||||||
|
@ -152,9 +151,9 @@ static void write_pcap_packet(int direction, struct sockaddr_mISDN* addr,
|
||||||
struct lapd_header lapd_header = {
|
struct lapd_header lapd_header = {
|
||||||
.ea1 = 0,
|
.ea1 = 0,
|
||||||
.cr = direction == PCAP_OUTPUT ? 1 : 0,
|
.cr = direction == PCAP_OUTPUT ? 1 : 0,
|
||||||
.sapi = addr->sapi & 0x3F,
|
.sapi = sapi & 0x3F,
|
||||||
.ea2 = 1,
|
.ea2 = 1,
|
||||||
.tei = addr->tei & 0x7F,
|
.tei = tei & 0x7F,
|
||||||
.control_foo = 0x03 /* UI */,
|
.control_foo = 0x03 /* UI */,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -180,7 +179,6 @@ static void write_pcap_packet(int direction, struct sockaddr_mISDN* addr,
|
||||||
ret = write(pcap_fd, msg->data + MISDN_HEADER_LEN,
|
ret = write(pcap_fd, msg->data + MISDN_HEADER_LEN,
|
||||||
msg->len - MISDN_HEADER_LEN);
|
msg->len - MISDN_HEADER_LEN);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static const char *sign_types[] = {
|
static const char *sign_types[] = {
|
||||||
[E1INP_SIGN_NONE] = "None",
|
[E1INP_SIGN_NONE] = "None",
|
||||||
|
@ -236,6 +234,9 @@ int abis_rsl_sendmsg(struct msgb *msg)
|
||||||
sign_link = msg->trx->rsl_link;
|
sign_link = msg->trx->rsl_link;
|
||||||
msgb_enqueue(&sign_link->tx_list, msg);
|
msgb_enqueue(&sign_link->tx_list, msg);
|
||||||
|
|
||||||
|
/* dump it */
|
||||||
|
write_pcap_packet(PCAP_OUTPUT, sign_link->sapi, sign_link->tei, msg);
|
||||||
|
|
||||||
/* notify the driver we have something to write */
|
/* notify the driver we have something to write */
|
||||||
e1inp_driver = sign_link->ts->line->driver;
|
e1inp_driver = sign_link->ts->line->driver;
|
||||||
e1inp_driver->want_write(sign_link->ts);
|
e1inp_driver->want_write(sign_link->ts);
|
||||||
|
@ -258,6 +259,9 @@ int _abis_nm_sendmsg(struct msgb *msg)
|
||||||
sign_link = msg->trx->bts->oml_link;
|
sign_link = msg->trx->bts->oml_link;
|
||||||
msgb_enqueue(&sign_link->tx_list, msg);
|
msgb_enqueue(&sign_link->tx_list, msg);
|
||||||
|
|
||||||
|
/* dump it */
|
||||||
|
write_pcap_packet(PCAP_OUTPUT, sign_link->sapi, sign_link->tei, msg);
|
||||||
|
|
||||||
/* notify the driver we have something to write */
|
/* notify the driver we have something to write */
|
||||||
e1inp_driver = sign_link->ts->line->driver;
|
e1inp_driver = sign_link->ts->line->driver;
|
||||||
e1inp_driver->want_write(sign_link->ts);
|
e1inp_driver->want_write(sign_link->ts);
|
||||||
|
@ -379,8 +383,8 @@ int e1inp_rx_ts(struct e1inp_ts *ts, struct msgb *msg,
|
||||||
|
|
||||||
switch (ts->type) {
|
switch (ts->type) {
|
||||||
case E1INP_TS_TYPE_SIGN:
|
case E1INP_TS_TYPE_SIGN:
|
||||||
/* FIXME: write pcap packet */
|
|
||||||
/* consult the list of signalling links */
|
/* consult the list of signalling links */
|
||||||
|
write_pcap_packet(PCAP_INPUT, sapi, tei, msg);
|
||||||
link = e1inp_lookup_sign_link(ts, tei, sapi);
|
link = e1inp_lookup_sign_link(ts, tei, sapi);
|
||||||
if (!link) {
|
if (!link) {
|
||||||
fprintf(stderr, "didn't find singalling link for "
|
fprintf(stderr, "didn't find singalling link for "
|
||||||
|
|
Loading…
Reference in New Issue