Commit Graph

129 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther db65bbd515 nat: Make queue_for_msc use the msc_con parameter, pass in the right msc_con
* Return msg'es to the right MSC Con. Right now it is nat->msc_con.
* When forwarding from BSC to MSC, use the msc_con inside the
  sccp_connections. This means we will only forward data with a
  connection to the BSC.
2010-07-05 14:30:14 +08:00
Holger Hans Peter Freyther 3a77e61033 nat: Keep track of the MSC handling the connection.
In the future we might have multiple MSCs connected
and need to dispatch it to the right one.
2010-07-05 13:33:18 +08:00
Holger Hans Peter Freyther 8330c1c386 nat: Count the number of dropped SCCP and MGCP calls as well.
Count the number of dropped calls and lost SCCP connections
due the loss of a connection to the BSC...
2010-06-17 18:29:42 +08:00
Holger Hans Peter Freyther b2c38ebb1f nat: Switch per BSC counters to the rate ctr.
This is switching the simple statistics to the rate counter
and is updating all users...
2010-06-17 18:18:12 +08:00
Holger Hans Peter Freyther 9764331062 bsc_api: Move gsm48_rcvmsg into the BSC API and dispatch.
The next step in the way to the BSC API. We have a clear a
new connection was opened signal now... and the MSC could
use it...
2010-06-17 16:41:25 +08:00
Holger Hans Peter Freyther 1398f13a64 nat: Attempt to update the VTY usage to the latest version
* Install the show commands to be available in the enable mode as well
* Provide a copyright header..
2010-06-15 20:31:35 +08:00
Holger Hans Peter Freyther 69d801e23a nat: Do not use the bssap.h include as it does not exist in this branch. 2010-06-15 20:24:21 +08:00
Holger Hans Peter Freyther 078321aaae [nat] Add ip-tos option to the nat.
This is applied to all incoming BSC connections.
2010-06-15 20:24:21 +08:00
Holger Hans Peter Freyther ca999a989d msc: Add msc ip-tos NR option for the BSC
Allow to set the TOS field via the VTY interface. The
SO_PRIORITY was not used as it has no effect on the
packets being sent (in contrast to the documentation).
2010-06-15 20:24:20 +08:00
Holger Hans Peter Freyther b71c23bb0a [nat] Make the refusal more complicated to support more MSCs
We will need to confirm the connection, then we can send the
GSM48 message, then we need to close the connection... the
embedding in the refusal method was way too easy..
2010-06-15 20:24:20 +08:00
Holger Hans Peter Freyther fa20c94456 [nat] Make create_sccp_src_ref return the SCCP Connection.
Right now it was not possible to just find a connection, by returning
the connection that is created we will have direct access to it. It
will be used by the local connection handling.
2010-06-15 20:24:20 +08:00
Holger Hans Peter Freyther e1fb5670cd [nat] Remove parameter that is never accessed directly
The msgb needs to be around when we access the parsed structure
but that needs to be guranteed by the caller handing out the parsed
structure.
2010-06-15 20:24:20 +08:00
Holger Hans Peter Freyther c58da4b374 [nat] Add the notion of a "local" connection.
A local connection is only between the MUX and the real BSC. We will
not forward anything to the MSC. This will be needed for the IMSI
filtering as sending a CREF is not liked by every BSC...
2010-06-15 20:24:20 +08:00
Holger Hans Peter Freyther 605f62a16a [nat] Do not access the con after the removal
In case of a RLC message we will destroy the SCCP connection. This means
that accessing the con and con->bsc will access old memory. Keep the status
local and move the con into an inner scope.
2010-06-15 20:24:20 +08:00
Holger Hans Peter Freyther ed775e4c1d [nat] Send a GSM48 message within the reject message 2010-06-15 20:24:20 +08:00
Holger Hans Peter Freyther 91246d724f [nat] Move the SCCP CREF handling into a new method.
We will need to generate messages with a proper reason
and it is easier to do that from a dedicated method.
2010-06-15 20:24:20 +08:00
Holger Hans Peter Freyther 234d31218f [nat] Use and print the connection type of a SCCP connection. 2010-06-15 20:24:20 +08:00
Holger Hans Peter Freyther 19c0a84fb8 [nat] Set the connection type/reason as out parameter
We are analyzing each CR message and it is nice to know the
reason these connections were created. Change the nat method.
2010-06-15 20:24:20 +08:00
Holger Hans Peter Freyther 5f10c6d6f4 [nat] Mention where the MSG is coming from. 2010-06-15 20:24:19 +08:00
Holger Hans Peter Freyther e6dfb18a79 [sccp/nat] Make it optional to send data on a SCCP Connection Refuse
This can be used to send a Location Updating Reject down to the
BSC when it is clear that a subscriber is not allowed.
2010-06-15 20:24:19 +08:00
Holger Hans Peter Freyther 1498d2e182 [nat] Separate exit2/exit3 as this can not be shared...
We have tried to send a refuse for arbitary things and ended
up with a segfault... separate the exi2 and exit3 label to have
separate exits and cleanups.
2010-06-15 20:24:19 +08:00
Holger Hans Peter Freyther e635dab52f [nat] Add a token to the nat config and handle ID GET
This allows to chain a nat with a nat by answering to the
id get code and sending the token.
2010-06-15 20:24:19 +08:00
Holger Hans Peter Freyther b4af5c9b57 nat: Introduce a nat filter that is working on the CR message.
Currently there is no implementation but the refusal code is
in place and will send a refusal back to the BSC.
2010-06-15 20:24:18 +08:00
Holger Hans Peter Freyther 2f2d3428d9 abis: Pass the abis_om_obj_inst in the nm_state_event.. 2010-06-15 20:24:18 +08:00
Holger Hans Peter Freyther 6b6ecba1a7 nat: Have a recycle timer that removes unconfirmed SCCP connections.
The MSC does not respond to a SCCP CR with Paging Response as GSM
payload, when the response comes in 'too late'. Prevent the MUX having
stale connections and start removing old connections every 20 minutes.
2010-06-15 20:24:18 +08:00
Holger Hans Peter Freyther aad82ce7ea nat: Print the MSC status with a new vty command. 2010-06-15 20:24:18 +08:00
Holger Hans Peter Freyther 569ee123a2 nat: Using the right fd can be a good idea as well 2010-06-15 20:24:17 +08:00
Holger Hans Peter Freyther 872d7683d3 nat: Fix bad bug, make sure the fd is not overwritten..
The adding of the innocent looking code was actually overwrote
the fd and then stupid things happened. Rename variables to avoid
that. rc,ret should be scratch variables...
2010-06-15 20:24:17 +08:00
Holger Hans Peter Freyther 9e938c680f nat: Use TCP_NODELAY for the connection to the BSC.
We do not want to use NAGLE for the BSC connection.
2010-06-15 20:24:17 +08:00
Holger Hans Peter Freyther 74cfab7b5d nat: Improve log messages. Refer to ip and fd. 2010-06-15 20:24:17 +08:00
Holger Hans Peter Freyther da35a8da7f nat: Make ping/pong timeout configurable. 2010-06-15 20:24:17 +08:00
Holger Hans Peter Freyther 5078871611 nat/bsc: Send PONG on PING, send PING from the BSC too
We do want to send PING/PONG in both ways to have a heartbeat
on the TCP connection. When switching over to SCTP we can rely
on the builtin heartbeat functionality.
2010-06-15 20:24:17 +08:00
Holger Hans Peter Freyther 906c15ec53 nat: Send a IPA PING down the stream and wait for the pong.
We will send a ping every 20 seconds and if we have no pong
within 5 seconds we will close down the BSC connection and
wait for a reconnect. We will start this after having
authenticated the BSC and we stop the timer when destructing
the BSC connection.
2010-06-15 20:24:17 +08:00
Holger Hans Peter Freyther 5cdcfa6224 nat: Do not allow a BSC to send auth messages twice. 2010-06-15 20:24:17 +08:00
Holger Hans Peter Freyther 19c3544f0a nat: Improve log message and refer to the BSC that was lost. 2010-06-15 20:24:17 +08:00
Holger Hans Peter Freyther 0b0b31c708 nat: Report some more contexts 2010-06-15 20:24:17 +08:00
Holger Hans Peter Freyther 2f9dcf0670 nat: Add a command to close a given BSC Connection
This can be used to clear stale connections for a given BSC
or to force a reconnect of the BSC.
2010-06-15 20:24:17 +08:00
Holger Hans Peter Freyther a1597f1b29 nat: Allocate a named context to make dumping allocations possible
This is fixing the SIGUSR1 to really report the allocated
memory on stderr.
2010-06-15 20:24:16 +08:00
Holger Hans Peter Freyther 4c683d1215 nat: Only close connections that were fully connected
Remember that we have seen a CC and have a valid destination
local reference now and only send a fake RLC to the MSC when
we had connections in this state.
2010-06-15 20:24:16 +08:00
Holger Hans Peter Freyther 9db7843c06 nat: When having a proper close down, or a short read close the connection
For now close the connection when having a short read. This might
be due a network issue (loss of segment) or similiar. As we are not
handling these issues well, let us close the connection.
2010-06-15 20:24:16 +08:00
Holger Hans Peter Freyther 9d56d0c45b nat: Handle all queueing to the MSC through the same function. 2010-06-15 20:24:16 +08:00
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 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 3d0049f4a0 nat: Increase the right counter on calls. 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