SS7 RAW Sockets
NAME
ss7raw - Linux SS7 raw sockets
SYNOPSIS
#include <sys/socket.h>
#include <netss7/ss7.h>
raw_socket = socket(PF_SS7, SOCK_RAW, protocol);
DESCRIPTION
Raw SS7 sockets permit ferry clip testing and other experimentation with the
SS7 protocols in user space. A raw SS7 socket sends ore receives SS7 PDUs
without invoking the protocol state machine at the specified
protocol level and permits simulation and protocol
testing.
Only processes with an effective user id of 0 or the
CAP_NET_RAW capability are allowed to open raw sockets.
All primitives, PDUs or errors matching the protocol
number specified for the raw socket are passed to this socket.
Raw SS7 sockets depend on the protocol specified. The
following protocol values are allowed:
SS7_PROT_LINK
-
This socket provides for the exchange of primitives and PDUs below the SS7
Link Level state machines (i.e. directly with the SS7 Link Interface). The
socket will generate its own Link Level header (FSN/FIB, BSN/BIB, and LI) when
sending PDUs on the socket unless the
SS7_HDRINCL socket
option is enabled on the socket.
Level 2 Header Fields Modified on Sending
Field | Action |
FSN/FIB | Supplied by socket |
BSN/BIB |
LI | Calculated by socket |
If
SS7_HDRINCL
is specified, all Level 2 header fields must be supplied by the user.
SS7_PROT_NTWK
-
This socket provides for the exchange of primitives and PDUs below the SS7
Network Level state machines (i.e., directly with the SS7 Link Level state
machines). The socket will generate an SS7 Routing Label when sending a PDU
unless the
SS7_HDRINCL
socket option is enabled on the socket.
Level 3 Header Fields Modified on Sending
Field | Action |
SI | Supplied by user |
NI |
MP |
DPC | Socket destination address when socket is bound, otherwise, supplied by user. |
OPC | Selected by MTP Routing |
SLS | Selected by MTP State Machine |
If
SS7_HDRINCL
is specified and the SS7 DPC has a non-zero destination address, then the
destination address of the socket is used to route the primitive or PDU.
When
MSG_DONTROUTE
is specified, the destination address should refer to the adjacent address of
a local linkset, otherwise a routing table lookup is done anyways but routes
via Signalling Transfer Points are ignored.
In OpenSS7 for Linux 2.2 all SS7 header fields and characteristics can be
controlled using SS7 socket options, sysctls and ioctls. This means that raw
SS7 sockets are usually only needed for simulation and testing.
When a packet is received, it is passed to any raw sockets which have been
bound to its protocol before it is passed to other protocol handlers (e.g.
kernel protocol modules).
ADDRESS FORMATS
Raw SS7 sockets uses the SS7 sockaddr_ss7 address structure described in
ss7(2) .
SYSCTLS
The following sysctls can be accessed by the
/proc/sys/net/ss7/*/* files or with the
sysctl(2) interface:
RAW SS7 sockets have no raw socket specific systclts at this time.
SOCKET OPTIONS
To set or get a socket option, call getsockopt(2) to
read or setsockopt(2) to write the option with the socket
family argument set to SOL_RAW . In addition, all
SOL_SS7 socket options are valid on raw sockets. For more
information see ss7(7) .
There are not socket options specific to raw SS7 sockets at this time.
IOCTLS
All of the ioctls described in socket(7) apply to SS7.
The ioctls to configure gateway screening are documented in gws(7) from the
bgws package. Ioctls to configure generic device
parameters and described in
ss7device(7) .
All of the ioctls which are described in ss7(7) are also applicable to raw
sockets.
There are no raw socket specific ioctls at this time.
ERROR HANDLING
Errors originating from the network are only passed to the user when the
socket is connected or the
SS7_RECVERR
flag is enabled. For connected sockets only
EMSGSIZE
and
EPROTO
are passed for compatibility. With
SS7_RECVERR
all network errors are saved in the error queue.
ERRORS
EMSGSIZE
-
SS7 raw sockets do not return this error. This is because it is intended
for testing and the user may send an intentionally long packet.
EPROTO
-
An error has arrived reporting a parameter problem.
EFAULT
-
An invalid memory address was supplied.
EOPNOTSUPP
-
Invalid flag has been passed to a socket call (like
MSG_OOB ).
EINVAL
-
Invalid argument.
EPERM
-
The user doen't have permission to open raw sockets. Only processes with
an effective user id of 0 or the
CAP_NET_RAW
capability can do that.
EXAMPLES
SEE ALSO
ss7(7) ,
link(7) ,
ss7device(7) ,
gws(7) ,
socket(7) ,
raw(7) ,
ip(7) ,
udp(7) ,
sysctl(2) ,
getsockopt(2) ,
setsockopt(2) ,
socket(2) ,
bind(2) ,
connect(2) ,
accept(2) ,
listen(2) ,
sendto(2) ,
sendmsg(2) ,
recvmsg(2) ,
send(2) ,
write(2) ,
ioctl(2) ,
htonl(2) .
NOTES
A raw socket can be bound to a specific local address using the
bind(2) call. If it isn't bound all packets with the
specified SS7 protocol are received. In addition a RAW socket can be bound to
a specific SS7 interface device using SO_BINDTODEVICE ; see
socket(7) . An IPPROTO_RAW socket
is send only. If you really want to receive all SS7 packets use a
packet(7) socket with the ETH_P_SS7
protocol.
If you want to receive all SNTM PDUs for an MTP socket it is often better to
use SS7_RECVERR on that particular socket; see
ss7(7) .
Raw sockets may tap all SS7 protocols in Linux, even
protocols like MTP or SCCP which have a protocol module in the kernel. In
this case the packets are passed to both the kernel module and the raw
socket(s). This should not be relied upon in portable programs, other BSD
socket implementation have differences here.
Linux never changes headers passed from the user when
SS7_HDRINCL is enabled (except for filling in some zeroed
fields as described for SS7_HDRINCL ). This may differ
from other implementations of raw sockets for SS7.
RAW sockets are generally rather unportable and should be avoided in programs
intended to be portable.
Sending on raw sockets should take the IP protocol from
sin_port ; this ability was lost in Linux 2.2. Work around
is to use IP_HDRINCL .
CAVEATS
DIAGNOSTICS
BUGS
As this is an ALPHA (experimental) release. As such, there are probably many
unknown bugs.
RESTRICTIONS
The SS7 raw packet capability was intended for testing the protocol
implementation itself. Aside from protocol testing and test or simulation
application, raw SS7 sockets serve no purpose.
AUTHOR
HISTORY
OpenSS7 was implemented first for Linux for the Linux 2.2 kernels.
REFERENCES
ITU-T Rec. Q.700, Introduction to CCITT Signalling System No. 7,
ITU-T Rec. Q.701, Functional description of the message transfer part (MTP),
ITU-T Rec. Q.702, Signalling data link,
ITU-T Rec. Q.703, Signalling link,
ITU-T Rec. Q.704, Signalling network functions and messages,
ITU-T Rec. Q.705, Signalling network structure,
ITU-T Rec. Q.706, Message transfer part signalling performance,
ITU-T Rec. Q.707, Testing and maintenance,
ITU-T Rec. Q.708, Assignment procedures for international signalling point codes,
ITU-T Rec. Q.709, Hypothetical signalling reference connection,
ITU-T Rec. Q.710, Simplified MTP for small systems
ANSI T1.110, General Information,
ANSI T1.111, Message Transfer Part (MTP)
ETSI ETS 300 008-1, Message Transfer Part (MTP),
ETSI ETS 300 008-2, Message Transfer Part (MTP),
ETSI ETS 300 336, Message Transfer Part (MTP),
ETSI ETS 300 346, Message Transfer Part (MTP)
|