Commit Graph

36 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther db7ba7db8b nat: Stop using the input/ipaccess.c method as it will write directly
We want to write everything through the write queue, it seemed the
easiest to copy the bytes here and feed the data into the bsc_write
method.
2010-06-15 20:24:08 +08:00
Holger Hans Peter Freyther 0fb47e0273 nat: Make it clear where we want to send these methods 2010-06-15 20:24:08 +08:00
Holger Hans Peter Freyther 747d654189 nat: Move one more area to the bsc_write method 2010-06-15 20:24:07 +08:00
Holger Hans Peter Freyther f7cb33cb33 nat: Move BSC msg sending to a new method.
Move all writes into one place so we can switch to the
write queue more easily in the future.
2010-06-15 20:24:07 +08:00
Holger Hans Peter Freyther ed07a3fc1c nat: Start using a write_queue for the BSC connection
We are still writing to the BSC directly and don't make real
use of this feature right now but we will need to do it.
2010-06-15 20:24:07 +08:00
Holger Hans Peter Freyther 6f5fbfd6bf nat: Move MSC write to the write_queue and make it non blocking
Move the MSC code to a non blocking write.
2010-06-15 20:24:07 +08:00
Holger Hans Peter Freyther 2d677c6787 nat: Rename variable from connection to listen
This is the socket we listen for incoming BSCs.
2010-06-15 20:24:07 +08:00
Holger Hans Peter Freyther df6143a08e Correct the company name. It should be On-Waves (ehf) 2010-06-15 20:24:07 +08:00
Holger Hans Peter Freyther 6c45f2e325 nat: Redo a merge with master that happend at this time. 2010-06-15 20:24:07 +08:00
Holger Hans Peter Freyther aad68b5ef8 [msc/nat] It is better to use msgb_free to free the msgb
msgb_free is currently calling talloc_free but this might
change in the future and then this code would break..
2010-06-15 20:24:07 +08:00
Holger Hans Peter Freyther a416776ee3 [nat/bsc] Fix memory leak of IPA messages...
* The read_msg method is allocating the msgb and we will
  need to free it once we are done with it.
2010-06-15 20:24:07 +08:00
Holger Hans Peter Freyther 45d1181a82 [nat] Intercept the PAGING message and then forward it to the BSCs with that LAC
* Provide access to the GSM0808 TLV attributes so we can use it in
  the nat code.
* Read the PAGING message, if it is paged by LAC we go through each
  LAC and then attempt to find the proper BSC connection and then
  send the message to that BSC.
2010-06-15 20:24:07 +08:00
Holger Hans Peter Freyther 7c11d1df1b [nat] Fix compiler warning.. 2010-06-15 20:24:07 +08:00
Holger Hans Peter Freyther aa6982445f [nat] Implement token based identification.
Based on the token the NAT/MUX is capable of figuring out
which LAC this BSC is supposed to satisfy. This will be
needed for messages like paging that can be done by LAC.
2010-06-15 20:24:07 +08:00
Holger Hans Peter Freyther 3f37b8fba3 [nat] Do not forward messages from and to BSC when it is not authenticated
* Start using the authenticated bit in the BSC connection. This means
  that currently no messages are forwarded to the MSC from unauthenticated
  BSCs.
2010-06-15 20:24:07 +08:00
Holger Hans Peter Freyther 6b8763ed9a [nat] Use default handler for SIGINT to quit the app 2010-06-15 20:24:07 +08:00
Holger Hans Peter Freyther 9a85ef3266 [nat] Add VTY support to the BSC nat application
* Create struct bsc_nat and move the various lists into this structure
* Create the VTY code
* Call the VTY init and parsing code
* Create functions to create the types..
* Add some stuff into the bsc_connection to be used for the NAT with
  proper config files. E.g. to close the connection if the BSC does not
  respond to a given command.
2010-06-15 20:24:06 +08:00
Holger Hans Peter Freyther 9f8f3d09a6 [nat] Move the structs to the header file
This way the VTY code can use the structures to implement
the show functionality.
2010-06-15 20:24:06 +08:00
Holger Hans Peter Freyther 45f7dcd9ae [nat] Make some methods static. 2010-06-15 20:24:06 +08:00
Holger Hans Peter Freyther 058eeb7ab0 [nat] Begin to patch SCCP connections
For the one MSC and n BSC case we need to patch the SCCP source
local reference on connection orientated links to avoid a clash.

For simple UDT packages we just let them pass and for SCCP connection
we have to:
    1.) Create an entry on Connection Request
    2.) Patch the entry on Connection Confirm, Connection Refuse,
        Connection Release, DT1, Connect Release Complete
    3.) Remove the entry on Connection Release Complete

The current code is blocking CRs, Release Complete from the MSC, and
creates the connection state only from the BSC side. The code to
assign a source reference is taken from sccp.c and handles wrap
arounds and such properly. We rely on the SCCP parser to fill out the
place to the source reference correctly so we can easily fix it.

The whole code is young and might contain bugs we need to resolve..
2010-06-15 20:24:06 +08:00
Holger Hans Peter Freyther 38a77d0098 [nat] Send a GSM 08.08 Reset Ack to the BSC...
When the reset was filtered out to the MSC we will respond
with a GSM08.08 reset ack right away. We are using a static
acknowledge here.
2010-06-15 20:24:06 +08:00
Holger Hans Peter Freyther 1d6fb18b57 [nat] Specify the direction of the message
Do not run into the situation where we need to filter in one
direction but it should not be filtered..
2010-06-15 20:24:06 +08:00
Holger Hans Peter Freyther 0b8f69d839 [nat] Prepare more sophisicated filtering and patching
Introduce a bsc_nat_parse method to parse a IP Access method
into various parts. Write out the IPA Proto, in case SCCP is used,
store the msg type, pointers to the source/dest local reference and
other information.

Use the result of bsc_nat_parse inside the bsc_nat_filter method
to decide if the message should be dropped or not.

In the future the bsc_nat_parse result will be used for patching
SCCP references and other parts of the message.

The filter language should be able to filter the msg type of SCCP
messages and gain the "NOT" word in the filter language.
2010-06-15 20:24:06 +08:00
Holger Hans Peter Freyther 418f394b01 [nat] Make use of the LOGP macro in the code base. 2010-06-15 20:24:06 +08:00
Holger Hans Peter Freyther 600466477a [nat] Handle write errors with a warning to make the compiler happy
Make the compiler happy by checking the write error and printing
a message to the console.
2010-06-15 20:24:06 +08:00
Holger Hans Peter Freyther 6a97b8d188 [nat] Add a bsc_filter.c which will carry out the analysis and filtering
The first part is to analyze the IP Access Header and only forward
SCCP messages for now. In the future we might want to do MGCP
signalling through this protocol and connection as well and need to
update this then.
2010-06-15 20:24:06 +08:00
Holger Hans Peter Freyther d7fb9545b6 [nat] Use the right len for the packages.. 2010-06-15 20:24:06 +08:00
Holger Hans Peter Freyther 8e074ec27c [nat] Really forward the data to the BSC 2010-06-15 20:24:06 +08:00
Holger Hans Peter Freyther c7641c9a70 [nat] Make sure the ipaccess_bsc_cb will be called.. 2010-06-15 20:24:06 +08:00
Holger Hans Peter Freyther 7625506430 [nat] Unregister the fd before leaving.. 2010-06-15 20:24:05 +08:00
Holger Hans Peter Freyther 24614ad1c0 [nat] First code to simply forward data from the MSC to the real BSC
First code to simply forward the data, no filtering or patching
is in place. This will need to happen soon.
2010-06-15 20:24:05 +08:00
Holger Hans Peter Freyther 5aa25ae9e6 [nat] Turn off compiler warning... 2010-06-15 20:24:05 +08:00
Holger Hans Peter Freyther da86c0a034 [nat] Security will become important at some point... 2010-06-15 20:24:05 +08:00
Holger Hans Peter Freyther 49d8068b37 [nat] Start to listen for the incoming BTS 2010-06-15 20:24:05 +08:00
Holger Hans Peter Freyther 6ace522847 [nat] Connect to the MSC like the real BSC
Use the connect_to_msc method to connect to the MSC and
create structure to handle and forward messages to the
real BSC.
2010-06-15 20:24:05 +08:00
Holger Hans Peter Freyther 9e2c5f572a [bsc-nat] Start with a simple NAT/MUX for a BSC
Harald actually pointed out that this feature is just NAT. We want
to connect n-real BSCs to one BSC Mux. We will talk the ip.access
protocol and SCCP over of this link.

The mux will drop certain GSM messages (like the reset), it will
replace source local reference (NAT functionality) and it will handle
some GSM08.08 specially.

Get the thing started...
2010-06-15 20:24:05 +08:00