Commit Graph

2362 Commits

Author SHA1 Message Date
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 66e1ef73c8 [nat] Use the new gsm48 method to parse the MI followed by a classmark. 2010-06-15 20:24:20 +08:00
Holger Hans Peter Freyther 1f38747cf1 [nat] Let IMSI DETACH and other messages pass by. 2010-06-15 20:24:20 +08:00
Holger Hans Peter Freyther 48945b18cd [nat] Print on which BSC config this happend. 2010-06-15 20:24:20 +08:00
Holger Hans Peter Freyther f192498885 [nat] Parse the PAGING RESPONSE inside a CR message as well.
Now we are parsing a CM Service Request, Location Updating Request
and the Paging Response. For all other messages we claim to not
support it and force a refuse.
2010-06-15 20:24:20 +08:00
Holger Hans Peter Freyther 87ef2f27e4 [nat] Check proto descriptor and the message type 2010-06-15 20:24:19 +08:00
Holger Hans Peter Freyther bcb32a4ad9 [nat] Add code to filter the CM Service Request by IMSI.
The code should be shared among the GSM0408 implementation
and this one, and like the LU we are not handling a TMSI
properly as we have no idea where it is coming from.
2010-06-15 20:24:19 +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 f1012a432c [nat] Remove the imsi allow option on the nat level.
For now we have:
1.) bsc imsi deny to deny at the BSC level
2.) bsc imsi allow to allow a SIM at the BSC level
3.) nat imsi deny to deny at the global level
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 f76e7ef5e1 [bsc_msc] Move the id get response into the bsc_msc.c
Create the message in a common place and then it can be used
by tools having an a link or such.
2010-06-15 20:24:19 +08:00
Holger Hans Peter Freyther 52c4ba0309 [nat] Add a regexp test command to the VTY.
This allows to test the regexp to be used for allo/deny of
the imsi filter.
2010-06-15 20:24:19 +08:00
Holger Hans Peter Freyther a0aeaa799e [nat] Fix the regexp of the test and the command line. 2010-06-15 20:24:19 +08:00
Holger Hans Peter Freyther 3df0233e5d [nat] Fix the imsi deny config write. 2010-06-15 20:24:19 +08:00
Holger Hans Peter Freyther 9cc1b83c54 [nat] We do not want to see the actual matches. 2010-06-15 20:24:19 +08:00
Holger Hans Peter Freyther b606101011 [nat] Allow to set the description for the bsc.
This will allow to add description to each BSC.
2010-06-15 20:24:19 +08:00
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