aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/nat/bsc_mgcp_utils.c
AgeCommit message (Collapse)AuthorFilesLines
2010-04-18nat: Clear the connection on a DLCXHolger Hans Peter Freyther1-0/+1
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-04-18nat: Return the SCCP Connection again...Holger Hans Peter Freyther1-11/+11
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-04-18nat: Return the newest SCCP connection...Holger Hans Peter Freyther1-1/+5
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-04-17Use osmocore tlv definition for GSM0808.Holger Hans Peter Freyther1-0/+1
2010-04-09nat: Set a dummy bts_ip to avoid misdetection of the bts...Holger Hans Peter Freyther1-0/+1
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-04-08nat: Attempt to have a single BSC write methodHolger Hans Peter Freyther1-1/+1
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-04-07nat: Allow to realloc already allocated endpointsHolger Hans Peter Freyther1-0/+1
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-04-07nat: Attempt to make MGCP forwarding more robustHolger Hans Peter Freyther1-17/+27
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-04-06nat: Fix thinko... use the right fd to determine the IP of the btsHolger Hans Peter Freyther1-1/+1
Use the fd of the BSC Connection to determine the IP address of the BTS as we are seeing it.
2010-04-06nat: Improve the log message and print the errno/strerror(errno)Holger Hans Peter Freyther1-1/+2
2010-04-06nat: Set the MGCP audio payload to -1.Holger Hans Peter Freyther1-0/+1
This value is copied into the bts_audio_payload when allocating a BTS MGCP endpoint. For the nat we have actually no interest in patching MGCP messages. We will patch them to the network because the code will do it anyway, we will not patch things back to the BTS.
2010-04-06Revert "nat: Remember where the BTS is listening for things."Holger Hans Peter Freyther1-16/+1
Remove the code to parse port as we need to discover the BTS behind the nat and most likely it will have a different port than the one advertised by the BTS. This reverts commit c6a1fe773d16eb20d4cb1d3097761419436f4537.
2010-04-05nat: Close all endpoints used by a BSC when the BSC is goneHolger Hans Peter Freyther1-0/+18
Cleanup all endpoints that belonged to a given BSC. This is one part of the cleanup, the other is to bring down the SCCP link properly.
2010-04-05nat: Remember a pending delete on an endpoint and carry it out laterHolger Hans Peter Freyther1-0/+8
2010-04-05nat: Avoid crashing when we have no pending transactionHolger Hans Peter Freyther1-0/+3
2010-04-05nat: Logging improvement for the nat.Holger Hans Peter Freyther1-1/+2
Print some more information, e.g. when a BSC is connected and authenticated, print the SCCP ref number.
2010-04-05nat: Remember where the BTS is listening for things.Holger Hans Peter Freyther1-1/+16
Extract the port from the BSS's MGCP Gateway so we know where to forward the data to.
2010-04-05nat: No need to match \r\n when parsing the C: NHolger Hans Peter Freyther1-1/+1
2010-04-04nat: Remove the broken empty line check, follow \n vs \r\n of inputHolger Hans Peter Freyther1-9/+13
Instead of checking the token for NULL we need to check if running was set to null. Look at the data of the token and check if the line was ending with a \r\n or \n and then when rewriting a line use that line ending as well. Add a new test for that.
2010-04-04nat: Use a ptr that was allocated by tallocHolger Hans Peter Freyther1-1/+1
The endp is part of an array allocated by talloc and simple array members do not qualify as a context start address.
2010-04-04nat: Make rewrite work on string, read to a string first, copy to msgbHolger Hans Peter Freyther1-15/+18
The MGCP protocol parsing is adding '\0' to make sure we do not parse beyond where we should parse. This does not mix with strtok or similiar routines. For now we will read the msg into a global array first, then copy it to the msgb for mgcp protocol handling and if we are required to forward it to the MGCP we have a untouched copy we will modify into our own msgb.
2010-04-01nat: Return MGCP messages to the call agentHolger Hans Peter Freyther1-0/+79
Attempt to find the message by transaction id, then patch the response and use the IP/PORT of the local network, update the ci with the one from the BSC. This is currently not tracking any state of the MGCP and will not handle two bsc's... this will need to happen later. With this in we should be feature complete and now enter the mode of making all of this work reliable and fixing thinko's and other bugs.
2010-04-01nat: Handle CRCX/MDCX/DLCX at the natHolger Hans Peter Freyther1-1/+93
* Forward a rewritten msg to the BSS. We change the IP and port to point to the NAT instead of the core network. We also keep track of the BSC and the transacition id. * Handle the case where we have not found a SCCP connection and need to send a response ourselves.
2010-04-01nat: Test rewriting of MGCP messages to patch ip and portHolger Hans Peter Freyther1-0/+61
Add code to change the ip and port for audio data inside MGCP messages. This is needed because the BSS might be behind the NAT and can not reach the network directly and might be behind a nat so the announced sourceport is not the one as we see it.
2010-04-01nat: Add code to find a BSC connection by the given msc multiplexHolger Hans Peter Freyther1-0/+17
2010-03-31nat: First go at handling MGCP inside the natHolger Hans Peter Freyther1-0/+109
Listen on the MGCP gateway port and let our protocol stack handle everything for now. We will need to have some more control over things though.
2010-03-31nat: In the case of losing the MSC, reset all endpointsHolger Hans Peter Freyther1-0/+10
When losing the SCCP connection make sure that we free all endpoints. The disconnection of the BSC should already make sure they are closed but this makes sure everything is properly reset.
2010-03-30nat: Look at the assignment command and remember on which timeslot the data isHolger Hans Peter Freyther1-0/+66
This information will be needed when we are trying to forward MGCP connections to and from the BSC through the IPA protocol.