Commit Graph

1460 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther 7b7eef62c1 nat: Change MGCP DLCX handling and send dummy MDCX to the BTS.
When setting a new MSC timeslot to a SCCP connection check if
any of the existing connections have this timeslot, if so we will
send a DLCX down the stream to make sure it is closed there, when
we will CRCX this new timeslot we will happily reallocate it.

When the SCCP connection goes away, or we get a DLCX from the
network, or the BSC is gone we will send a DLCX message down the
stream as well.

When we receive a CRCX from the network we will forward the CRCX
as usual and send a dummy MDCX after it.

For the DLCX and the dummy MDCX we send a custom MGCP message
that will not provoke an answer. Even if the downstream MGCP GW
will answer we will ignore it due the dummy transaction id that
is not used anywhere else.

This change should make sure that we close the dowstream endpoint
all the time, even when the DLCX arrives after the SCCP connection
is torndown.
2010-06-15 20:24:16 +08:00
Holger Hans Peter Freyther 8151973c73 nat: Move the write queue init to the allocation function
This is required for unit tests that want to queue messages
and see if we can provoke a memleak.
2010-06-15 20:24:16 +08:00
Holger Hans Peter Freyther e464ed4e7c nat: Clear the queued messages at the end
It is possible that the calls from the loop would queue
more messages for the BSC and then we would have a nice
memory leak... Move it to the bottom.
2010-06-15 20:24:16 +08:00
Holger Hans Peter Freyther a34585e296 [nat] Degrade the message to a plain debug output. 2010-06-15 20:24:16 +08:00
Holger Hans Peter Freyther 834f1df21e [nat] Fix the vty option... use the right argument. 2010-06-15 20:24:15 +08:00
Holger Hans Peter Freyther 62e5843a61 [nat] Add option to forbid the paging to the BSC.
This can be done for testing purposes and to allow making
a BTS crash that can not handle paging requests properly.
2010-06-15 20:24:15 +08:00
Holger Hans Peter Freyther b5513caaf8 [nat] Lookup by BSC Connection otherwise the point of reassigning the is defeated
When sending a MSG to the MSC try to find the to be used "src" reference
by comparing the reference on the BSC and the BSC connection. Only this
tuple needs to be unique.
Actually only when looking at the SRC REF we need to compare the BSC as the
dest reference should be unique but we are just making the check a bit stronger
to make it look symmetric.
2010-06-15 20:24:15 +08:00
Holger Hans Peter Freyther ca0c2f9d1e [nat] Slightly improve logging..
If we find the connection of a different BSC at least log the
BSCs that had duplicated references. We should also dump the
src ref and such but i am not doing this right now.
2010-06-15 20:24:15 +08:00
Holger Hans Peter Freyther a4376adb54 [nat] Ignore paging that is to page by BSS...
We do not want to handle this identity. If we can not page by
lac there is no need to page anything else.
2010-06-15 20:24:15 +08:00
Holger Hans Peter Freyther 842c0c020f [nat] Reword warning when we had a pending transaction and forget about it. 2010-06-15 20:24:15 +08:00
Holger Hans Peter Freyther d885b98a05 [nat] Cope with a bad BSC reassigning in use SRC REF
Some closed source BSC like to assign the SRC REF from a
small static pool and might reuses one we have not yet given
up on.
2010-06-15 20:24:15 +08:00
Holger Hans Peter Freyther 01a0b1b2e0 nat: Make sccp/bsc show connections more Cisco like...
Second attempt to use a syntax more comparable to 'Cisco',
I have never used such a system... let us see how this is
going.
2010-06-15 20:24:15 +08:00
Holger Hans Peter Freyther 7fc9a27bf1 nat: Do not use 0/0 for mux/timeslot by default
0 is a valid timeslot and we should not use it... use
a negative value to be save.
2010-06-15 20:24:15 +08:00
Holger Hans Peter Freyther 317ae72c47 nat: Clear the connection on a DLCX
We can forget about the timeslot/multiplex when getting
the DLCX. This way we make room for the next connection
that might need to reuse this address.
2010-06-15 20:24:15 +08:00
Holger Hans Peter Freyther 7a773696dc nat: Always initialize the out pointer...
Always initialize the pointer to a invalid value in case
we encounter a parsing error or such.
2010-06-15 20:24:14 +08:00
Holger Hans Peter Freyther 08a1b16674 nat: Return the SCCP Connection again...
We will reset the multiplex in a DLCX message and then
we can reset the multiplex as well...even if the MGCP
connection is staying open. or at least this is a theory.

The MSC likes to leave a connection open during CallControl
when hanging up early enough in the process.
2010-06-15 20:24:14 +08:00
Holger Hans Peter Freyther eb52e89c3a nat: Return the newest SCCP connection...
In case we have a stale SCCP connection with an Endpoint that
we want to reassign...use the newest (last) occurence of that
as it is most likely the one we want to handle.
2010-06-15 20:24:14 +08:00
Holger Hans Peter Freyther 3d0049f4a0 nat: Increase the right counter on calls. 2010-06-15 20:24:14 +08:00
Holger Hans Peter Freyther 8b5100698b nat: Add new connections to the end of the list
By adding them to the end the VTY interface will only append
connections and not change the order on each invocation.
2010-06-15 20:24:14 +08:00
Holger Freyther d6b616a388 nat: Remove the SHOW_STR from none show commands. 2010-06-15 20:24:14 +08:00
Holger Hans Peter Freyther 979a309c94 nat: Print the LAC that was searched for and not found. 2010-06-15 20:24:14 +08:00
Holger Hans Peter Freyther c615c260ea nat: Mention when we do not find a BSC for a given token.
This might help to identify what is wrong with the config
of the BSC. Also using the result of TLVP_VAL as a char
pointer looks suspicious...
2010-06-15 20:24:14 +08:00
Holger Hans Peter Freyther 6d5a60041a nat: Print the IP address of the BSC that does not respond to the query. 2010-06-15 20:24:14 +08:00
Holger Hans Peter Freyther 8139553962 nat: Make the MSC configurable. 2010-06-15 20:24:14 +08:00
Holger Hans Peter Freyther a88742cf5e nat: Move MSC ip address into the config..
The address can still be specified on the cli and it will
overwrite the config in the config file.
2010-06-15 20:24:14 +08:00
Holger Hans Peter Freyther 1395948e18 Use osmocore tlv definition for GSM0808. 2010-06-15 20:24:14 +08:00
Holger Hans Peter Freyther d1278c1fc9 nat: Two fixes for the write memory case...
Add new BSCs to the tail so we keep the sort order when writing
them out to the vty, fix the LAC command.
2010-06-15 20:24:13 +08:00
Holger Hans Peter Freyther c16cf27bd5 nat: Add config option to filter/handle certain imsi'es. 2010-06-15 20:24:13 +08:00
Holger Hans Peter Freyther a4ed81c8d9 [statistics] Count the times we lost the connection to the MSC. 2010-06-15 20:24:13 +08:00
Holger Hans Peter Freyther bcfebb2c1d [nat] Add show statistics to the nat 2010-06-15 20:24:13 +08:00
Holger Hans Peter Freyther d4702862d3 [statistics] Provide basic statistics for the NAT
Count number of SCCP connections, number of BSC reconnects,
number of calls. For most of them we have a per BSC and a
global count.

Right now all structs using the counters survive until the
end of the application so we do not need to free them.
2010-06-15 20:24:13 +08:00
Holger Hans Peter Freyther 57f874ad8d [nat] Change the command strings
Put the Target/Object first... Apparently this is more what people
that know IOS expect to do.
2010-06-15 20:24:13 +08:00
Holger Hans Peter Freyther 290d84e15f nat: Set a dummy bts_ip to avoid misdetection of the bts...
It was possible that the nat detected the core network
gateway as the bts just due being the first to send data
to the port. Fix it by setting a dummy bts_ip to force
the mgcp_network code to compare the in_addr.
2010-06-15 20:24:13 +08:00
Holger Hans Peter Freyther b8a337356a nat: Handle unknown RLSD by send a RLC back to the network. 2010-06-15 20:24:13 +08:00
Holger Hans Peter Freyther 0176eb44f5 nat: Attempt to handle exceptions on the fd and trat them as connection loss 2010-06-15 20:24:13 +08:00
Holger Hans Peter Freyther 870663af20 nat: Print the IP address of the connected BSCs 2010-06-15 20:24:13 +08:00
Holger Hans Peter Freyther 02aee149f6 nat: Rename variable to make it use msc in the name 2010-06-15 20:24:13 +08:00
Holger Hans Peter Freyther 2896df7605 nat: Attempt to have a single BSC write method
This method currently prepends the IPA header and sends
the data. In the future we might be able to use SCTP for
it.

We have to remove the IPA header from the static messages
for that to work.

This code is untested.
2010-06-15 20:24:13 +08:00
Holger Hans Peter Freyther ce512c5473 nat: Rename bsc_write to bsc_send_data 2010-06-15 20:24:13 +08:00
Holger Hans Peter Freyther b752761a3d nat: Send the reset after we have received the init ack
Sending the reset right away will upset the MSC and we
need to wait for the first contact.
2010-06-15 20:24:13 +08:00
Holger Hans Peter Freyther 7cab16619e nat: Fix the reset message and prepend the IPA header 2010-06-15 20:24:12 +08:00
Holger Hans Peter Freyther bba593406b nat: Allow to realloc already allocated endpoints
E.g. when the MGCP on the BSS is not responding we could block
all of our endpoints. As we are mostly in the middle and forward
bits we will happily reallocate the endpoints.
2010-06-15 20:24:12 +08:00
Holger Hans Peter Freyther af0ff6c46a nat: Send a GSM0808 message to the MSC when we are reconnecting
The rest of the code should filter the reset ack msg. This should
make the MSC give up all resources it had allocated for us.
2010-06-15 20:24:12 +08:00
Holger Hans Peter Freyther dd16b425c8 nat: Attempt to make MGCP forwarding more robust
When not being able to allocate the msgb for the forwarded data
there is no point in keeping and preparing the transaction. So
we can move the msg creation a bit up and only do the allocations
after having done the msgb allocation.

When receiving a DLCX we will now delete the endpoint right away. This
means when a BSS does not respond to the DLCX our endpoint will not
be blocked. E.g. this could happen when the MGCP is restarting or
in similiar conditions. When the BSS is not responding we move the
burden up the chain to the CallAgent. We have to still keep track
of the transaction id and the bsc pointer to keep the mgcp forward
routine working.
2010-06-15 20:24:12 +08:00
Holger Hans Peter Freyther fb7a934cfc nat: Redo a merge with master that got lost on the cherry-pick 2010-06-15 20:24:12 +08:00
Holger Hans Peter Freyther 6b087d18f5 nat: Send a RLSD to the network for connections belonging to the BSC
Sending a RLSD with SCCP failure makes the MSC free all the resources
(MGCP, audio channels), right now we are ignoring the RLC we get from
the network and print a unhandled message.
2010-06-15 20:24:12 +08:00
Holger Hans Peter Freyther f464ea54d1 nat: Print a MSG when receiving unknown SCCP messages. 2010-06-15 20:24:12 +08:00
Holger Hans Peter Freyther 47dd4944ae nat: Store the config in the connection instead of the lac
This allows that we can print the Nr. next to the lac
and it allows us to change the lac at runtime without
reconnecting the BSC.
2010-06-15 20:24:12 +08:00
Holger Hans Peter Freyther a7c377d593 nat: Close the filedescriptor when ignoring the request. 2010-06-15 20:24:12 +08:00
Holger Hans Peter Freyther 5f291d5077 nat: Add logging commands for the nat as well. 2010-06-15 20:24:12 +08:00