nat: Print the LAC that was searched for and not found.
This commit is contained in:
parent
c615c260ea
commit
979a309c94
|
@ -239,7 +239,7 @@ struct bsc_nat_parsed *bsc_nat_parse(struct msgb *msg);
|
|||
*/
|
||||
int bsc_nat_filter_ipa(int direction, struct msgb *msg, struct bsc_nat_parsed *parsed);
|
||||
int bsc_nat_vty_init(struct bsc_nat *nat);
|
||||
struct bsc_connection *bsc_nat_find_bsc(struct bsc_nat *nat, struct msgb *msg);
|
||||
struct bsc_connection *bsc_nat_find_bsc(struct bsc_nat *nat, struct msgb *msg, int *_lac);
|
||||
|
||||
/**
|
||||
* SCCP patching and handling
|
||||
|
|
|
@ -309,11 +309,13 @@ send_to_all:
|
|||
* message and then send it to the authenticated messages...
|
||||
*/
|
||||
if (parsed->ipa_proto == IPAC_PROTO_SCCP && parsed->gsm_type == BSS_MAP_MSG_PAGING) {
|
||||
bsc = bsc_nat_find_bsc(nat, msg);
|
||||
int lac;
|
||||
bsc = bsc_nat_find_bsc(nat, msg, &lac);
|
||||
if (bsc)
|
||||
bsc_send_data(bsc, msg->l2h, msgb_l2len(msg), parsed->ipa_proto);
|
||||
else
|
||||
LOGP(DNAT, LOGL_ERROR, "Could not determine BSC for paging.\n");
|
||||
LOGP(DNAT, LOGL_ERROR, "Could not determine BSC for paging on lac: %d/0x%x\n",
|
||||
lac, lac);
|
||||
|
||||
goto exit;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ void sccp_connection_destroy(struct sccp_connections *conn)
|
|||
talloc_free(conn);
|
||||
}
|
||||
|
||||
struct bsc_connection *bsc_nat_find_bsc(struct bsc_nat *nat, struct msgb *msg)
|
||||
struct bsc_connection *bsc_nat_find_bsc(struct bsc_nat *nat, struct msgb *msg, int *lac_out)
|
||||
{
|
||||
struct bsc_connection *bsc;
|
||||
int data_length;
|
||||
|
@ -133,6 +133,7 @@ struct bsc_connection *bsc_nat_find_bsc(struct bsc_nat *nat, struct msgb *msg)
|
|||
/* Currently we only handle one BSC */
|
||||
for (i = 1; i < data_length - 1; i += 2) {
|
||||
unsigned int _lac = ntohs(*(unsigned int *) &data[i]);
|
||||
*lac_out = _lac;
|
||||
llist_for_each_entry(bsc, &nat->bsc_connections, list_entry) {
|
||||
if (!bsc->cfg)
|
||||
continue;
|
||||
|
|
|
@ -329,6 +329,7 @@ static void test_contrack()
|
|||
|
||||
static void test_paging(void)
|
||||
{
|
||||
int lac;
|
||||
struct bsc_nat *nat;
|
||||
struct bsc_connection *con;
|
||||
struct bsc_nat_parsed *parsed;
|
||||
|
@ -347,7 +348,7 @@ static void test_paging(void)
|
|||
|
||||
/* Test completely bad input */
|
||||
copy_to_msg(msg, paging_by_lac_cmd, sizeof(paging_by_lac_cmd));
|
||||
if (bsc_nat_find_bsc(nat, msg) != 0) {
|
||||
if (bsc_nat_find_bsc(nat, msg, &lac) != 0) {
|
||||
fprintf(stderr, "Should have not found anything.\n");
|
||||
abort();
|
||||
}
|
||||
|
@ -355,7 +356,7 @@ static void test_paging(void)
|
|||
/* Test it by not finding it */
|
||||
copy_to_msg(msg, paging_by_lac_cmd, sizeof(paging_by_lac_cmd));
|
||||
parsed = bsc_nat_parse(msg);
|
||||
if (bsc_nat_find_bsc(nat, msg) != 0) {
|
||||
if (bsc_nat_find_bsc(nat, msg, &lac) != 0) {
|
||||
fprintf(stderr, "Should have not found aynthing.\n");
|
||||
abort();
|
||||
}
|
||||
|
@ -365,7 +366,7 @@ static void test_paging(void)
|
|||
cfg.lac = 8213;
|
||||
copy_to_msg(msg, paging_by_lac_cmd, sizeof(paging_by_lac_cmd));
|
||||
parsed = bsc_nat_parse(msg);
|
||||
if (bsc_nat_find_bsc(nat, msg) != con) {
|
||||
if (bsc_nat_find_bsc(nat, msg, &lac) != con) {
|
||||
fprintf(stderr, "Should have found it.\n");
|
||||
abort();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue