Commit Graph

1615 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther 34a96aeb32 [nat] Implement IMSI filtering... 2010-06-15 20:24:18 +08:00
Holger Hans Peter Freyther f830322846 [nat] Fix the size check of the LU Request. 2010-06-15 20:24:18 +08:00
Holger Hans Peter Freyther 12dc89ad37 [nat] Make the string -> regexp parsing public
This way it can be used from within a test case to test
the regexps..
2010-06-15 20:24:18 +08:00
Holger Hans Peter Freyther 290ed9a98c nat: Add code to parse the SCCP optional data.
First we have the Complete Layer3 Information, then we have
the IE for the Layer3 information, then the GSM48 hdr, then
the actual content with data. Right now we are parsing the
LU but we are not filtering anything yet.
2010-06-15 20:24:18 +08:00
Holger Hans Peter Freyther 0c08db17bf nat: Start to add a test case.. with one CR message. 2010-06-15 20:24:18 +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 d8b82066fa [nat] Use A.B.C.D for the IP address
The VTY code will then be able to validate the IP Address.
2010-06-15 20:24:18 +08:00
Holger Hans Peter Freyther c89c030b10 [nat] Remove range checks inside the VTY command.
The ranges are enforced by the VTY code.
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 886d382fea nat: When we fail to reallocate... also close down the MGCP part
Give the BSC a chanche to close down MGCP ports as well.
2010-06-15 20:24:18 +08:00
Holger Hans Peter Freyther c14e09bb2d nat: Store the creation time of a sccp connection.
Generate it when creating the connection but also when
reusing an existing connection.
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 e47a91b86a bsc_msc: Add a connection timeout for the MSC.
When no one is listening our connection would get stuck
in the SYN_SENT state and we would be there forever.
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 314191d75a nat: Allow to only show statistics for a given BSC Cfg. 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 3b8798184b nat: Fix vty output for connected BSCs 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 3a347f0ace nat: Fix memory leak... in MGCP forwarding
The code needs to be refactored but this is fixing the leak for
now. We used to forward everything to the BSC but now we handle
the DLCX locally and this means we need to clear the patched
message. We should refactor it to not generate the patched msg
until a lot later.
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 b9af2fae51 nat: Do not use \n in the vty code.
When we really need a newline we need to use VTY_NEWLINE.
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 4bd2294492 nat: Print the remote reference as well. 2010-06-15 20:24:16 +08:00
Holger Hans Peter Freyther fef76122a7 nat: Release the transaction id earlier, always reset the BSC
In case we can not find the SCCP connection we still want to
free any pending transaction ids and reset the BSC inside the
endpoint. In most cases this should be already done when the
SCCP connection or the whole BSC is gone.
2010-06-15 20:24:16 +08:00
Holger Hans Peter Freyther 3d194d9986 nat: Attempt to clarify the text inside the log message. 2010-06-15 20:24:16 +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 959bbcf0e7 nat: Only send DLCX when we have send a CRCX to the BSC on this endpoint 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 ab7539cc89 nat: Use show bsc config for showing the configuration. 2010-06-15 20:24:16 +08:00
Holger Hans Peter Freyther f42f45bf6a nat: Use hex for the endpoint names 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 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 5e63f921f0 [nat] Add unit test to forward Proto Error messages back both ways. 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