The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Functions | Variables
rlm_sigtran.c File Reference

Implement a SCTP/M3UA/SCCP/TCAP/MAP stack. More...

#include <osmocom/core/linuxlist.h>
#include "libosmo-m3ua/include/bsc_data.h"
#include "libosmo-m3ua/include/sctp_m3ua.h"
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/util/debug.h>
#include "sigtran.h"
#include "attrs.h"
#include <assert.h>
#include <limits.h>
+ Include dependency graph for rlm_sigtran.c:

Go to the source code of this file.

Macros

#define LOG_PREFIX_ARGS   mctx->mi->name
 
#define MTP3_PC_CHECK(_x)
 

Functions

static unlang_action_t mod_authorize (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
 
static int mod_detach (module_detach_ctx_t const *mctx)
 Cleanup internal state. More...
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 
static int mod_thread_detach (module_thread_inst_ctx_t const *mctx)
 
static int mod_thread_instantiate (module_thread_inst_ctx_t const *mctx)
 
static int sigtran_sccp_sockaddr_from_conf (TALLOC_CTX *ctx, struct sockaddr_sccp *out, sigtran_sccp_address_t *conf, CONF_SECTION *cs)
 Convert our sccp address config structure into sockaddr_sccp. More...
 

Variables

unsigned int __hack_dpc
 
unsigned int __hack_opc
 
fr_dict_attr_t const * attr_auth_type
 
fr_dict_attr_t const * attr_eap_aka_sim_autn
 
fr_dict_attr_t const * attr_eap_aka_sim_ck
 
fr_dict_attr_t const * attr_eap_aka_sim_ik
 
fr_dict_attr_t const * attr_eap_aka_sim_kc
 
fr_dict_attr_t const * attr_eap_aka_sim_rand
 
fr_dict_attr_t const * attr_eap_aka_sim_sres
 
fr_dict_attr_t const * attr_eap_aka_sim_xres
 
fr_dict_t const * dict_eap_aka_sim
 
static const conf_parser_t m3ua_config []
 
static const conf_parser_t m3ua_route []
 
static fr_table_num_sorted_t const m3ua_traffic_mode_table []
 
static size_t m3ua_traffic_mode_table_len = NUM_ELEMENTS(m3ua_traffic_mode_table)
 
static const conf_parser_t map_config []
 
static const conf_parser_t module_config []
 
static const conf_parser_t mtp3_config []
 
module_rlm_t rlm_sigtran
 
fr_dict_autoload_t rlm_sigtran_dict []
 
fr_dict_attr_autoload_t rlm_sigtran_dict_attr []
 
static const conf_parser_t sccp_address []
 
static const conf_parser_t sccp_config []
 
static const conf_parser_t sccp_global_title []
 
static const conf_parser_t sctp_config []
 
static uint32_t sigtran_instances = 0
 

Detailed Description

Implement a SCTP/M3UA/SCCP/TCAP/MAP stack.

Id
9357724e28282a14838a0030728127222bbccfff

Definition in file rlm_sigtran.c.

Macro Definition Documentation

◆ LOG_PREFIX_ARGS

#define LOG_PREFIX_ARGS   mctx->mi->name

Definition at line 37 of file rlm_sigtran.c.

◆ MTP3_PC_CHECK

#define MTP3_PC_CHECK (   _x)
Value:
do { \
if (inst->conn_conf.mtp3_##_x > 16777215) { \
cf_log_err(conf, "Invalid value \"%d\" for '#_x', must be between 0-16777215", \
inst->conn_conf.mtp3_##_x); \
return -1; \
} \
__hack_##_x = inst->conn_conf.mtp3_##_x; \
} while (0)
static rs_t * conf
Definition: radsniff.c:53
eap_aka_sim_process_conf_t * inst

Function Documentation

◆ mod_authorize()

static unlang_action_t mod_authorize ( rlm_rcode_t p_result,
module_ctx_t const *  mctx,
request_t request 
)
static

Definition at line 200 of file rlm_sigtran.c.

+ Here is the call graph for this function:

◆ mod_detach()

static int mod_detach ( module_detach_ctx_t const *  mctx)
static

Cleanup internal state.

Definition at line 398 of file rlm_sigtran.c.

+ Here is the call graph for this function:

◆ mod_instantiate()

static int mod_instantiate ( module_inst_ctx_t const *  mctx)
static

Definition at line 332 of file rlm_sigtran.c.

+ Here is the call graph for this function:

◆ mod_thread_detach()

static int mod_thread_detach ( module_thread_inst_ctx_t const *  mctx)
static

Definition at line 323 of file rlm_sigtran.c.

+ Here is the call graph for this function:

◆ mod_thread_instantiate()

static int mod_thread_instantiate ( module_thread_inst_ctx_t const *  mctx)
static

Definition at line 307 of file rlm_sigtran.c.

+ Here is the call graph for this function:

◆ sigtran_sccp_sockaddr_from_conf()

static int sigtran_sccp_sockaddr_from_conf ( TALLOC_CTX *  ctx,
struct sockaddr_sccp *  out,
sigtran_sccp_address_t conf,
CONF_SECTION cs 
)
static

Convert our sccp address config structure into sockaddr_sccp.

Parameters
ctxto allocated address in.
outWhere to write the parsed data.
confto parse.
csspecifying sccp address.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 218 of file rlm_sigtran.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ __hack_dpc

unsigned int __hack_dpc

Definition at line 64 of file rlm_sigtran.c.

◆ __hack_opc

unsigned int __hack_opc

Definition at line 64 of file rlm_sigtran.c.

◆ attr_auth_type

fr_dict_attr_t const* attr_auth_type

Definition at line 185 of file rlm_sigtran.c.

◆ attr_eap_aka_sim_autn

fr_dict_attr_t const* attr_eap_aka_sim_autn

Definition at line 163 of file rlm_sigtran.c.

◆ attr_eap_aka_sim_ck

fr_dict_attr_t const* attr_eap_aka_sim_ck

Definition at line 164 of file rlm_sigtran.c.

◆ attr_eap_aka_sim_ik

fr_dict_attr_t const* attr_eap_aka_sim_ik

Definition at line 165 of file rlm_sigtran.c.

◆ attr_eap_aka_sim_kc

fr_dict_attr_t const* attr_eap_aka_sim_kc

Definition at line 171 of file rlm_sigtran.c.

◆ attr_eap_aka_sim_rand

fr_dict_attr_t const* attr_eap_aka_sim_rand

Definition at line 177 of file rlm_sigtran.c.

◆ attr_eap_aka_sim_sres

fr_dict_attr_t const* attr_eap_aka_sim_sres

Definition at line 172 of file rlm_sigtran.c.

◆ attr_eap_aka_sim_xres

fr_dict_attr_t const* attr_eap_aka_sim_xres

Definition at line 166 of file rlm_sigtran.c.

◆ dict_eap_aka_sim

fr_dict_t const* dict_eap_aka_sim

Definition at line 158 of file rlm_sigtran.c.

◆ m3ua_config

const conf_parser_t m3ua_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("link_index", rlm_sigtran_t, conn_conf.m3ua_link_index) },
{ FR_CONF_OFFSET("routing_ctx", rlm_sigtran_t, conn_conf.m3ua_routing_context) },
{ FR_CONF_OFFSET("traffic_mode", rlm_sigtran_t, conn_conf.m3ua_traffic_mode_str), .dflt = "loadshare" },
{ FR_CONF_OFFSET("ack_timeout", rlm_sigtran_t, conn_conf.m3ua_ack_timeout), .dflt = "2" },
{ FR_CONF_OFFSET("beat_interval", rlm_sigtran_t, conn_conf.m3ua_beat_interval), .dflt = "0" },
{ FR_CONF_OFFSET_IS_SET("route", 0, CONF_FLAG_SUBSECTION, rlm_sigtran_t, conn_conf.m3ua_routes), .subcs = (void const *) m3ua_route },
}
#define CONF_PARSER_TERMINATOR
Definition: cf_parse.h:627
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition: cf_parse.h:268
#define FR_CONF_OFFSET_IS_SET(_name, _type, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct,...
Definition: cf_parse.h:282
@ CONF_FLAG_SUBSECTION
Instead of putting the information into a configuration structure, the configuration file routines MA...
Definition: cf_parse.h:399
static const conf_parser_t m3ua_route[]
Definition: rlm_sigtran.c:85

Definition at line 93 of file rlm_sigtran.c.

◆ m3ua_route

const conf_parser_t m3ua_route[]
static
Initial value:
= {
}
#define FR_CONF_OFFSET_FLAGS(_name, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition: cf_parse.h:256
@ CONF_FLAG_MULTI
CONF_PAIR can have multiple copies.
Definition: cf_parse.h:419
@ FR_TYPE_UINT32
32 Bit unsigned integer.
Definition: merged_model.c:99

Definition at line 85 of file rlm_sigtran.c.

◆ m3ua_traffic_mode_table

fr_table_num_sorted_t const m3ua_traffic_mode_table[]
static
Initial value:
= {
{ L("broadcast"), 3 },
{ L("loadshare"), 2 },
{ L("override"), 1 }
}
#define L(_str)
Helper for initialising arrays of string literals.
Definition: build.h:207

Definition at line 66 of file rlm_sigtran.c.

◆ m3ua_traffic_mode_table_len

size_t m3ua_traffic_mode_table_len = NUM_ELEMENTS(m3ua_traffic_mode_table)
static

Definition at line 71 of file rlm_sigtran.c.

◆ map_config

const conf_parser_t map_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("version", rlm_sigtran_t, conn_conf.map_version), .dflt = "2", .quote = T_BARE_WORD},
}
@ T_BARE_WORD
Definition: token.h:120

Definition at line 140 of file rlm_sigtran.c.

◆ module_config

const conf_parser_t module_config[]
static
Initial value:
= {
{ FR_CONF_POINTER("sctp", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) sctp_config },
{ FR_CONF_POINTER("m3ua", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) m3ua_config },
{ FR_CONF_POINTER("mtp3", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) mtp3_config },
{ FR_CONF_POINTER("sccp", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) sccp_config },
{ FR_CONF_POINTER("map", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) map_config },
}
#define FR_CONF_POINTER(_name, _type, _flags, _res_p)
conf_parser_t which parses a single CONF_PAIR producing a single global result
Definition: cf_parse.h:310
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition: cf_parse.h:405
static const conf_parser_t sccp_config[]
Definition: rlm_sigtran.c:130
static const conf_parser_t map_config[]
Definition: rlm_sigtran.c:140
static const conf_parser_t sctp_config[]
Definition: rlm_sigtran.c:73
static const conf_parser_t m3ua_config[]
Definition: rlm_sigtran.c:93
static const conf_parser_t mtp3_config[]
Definition: rlm_sigtran.c:105

Definition at line 146 of file rlm_sigtran.c.

◆ mtp3_config

const conf_parser_t mtp3_config[]
static
Initial value:

Definition at line 105 of file rlm_sigtran.c.

◆ rlm_sigtran

Initial value:
= {
.common = {
.name = "sigtran",
.inst_size = sizeof(rlm_sigtran_t),
.thread_inst_size = sizeof(rlm_sigtran_thread_t),
.config = module_config,
.instantiate = mod_instantiate,
.detach = mod_detach,
.thread_instantiate = mod_thread_instantiate,
.thread_detach = mod_thread_detach
},
.method_group = {
.bindings = (module_method_binding_t[]){
{ .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize },
}
}
}
#define CF_IDENT_ANY
Definition: cf_util.h:78
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition: dl_module.h:63
static int mod_detach(module_detach_ctx_t const *mctx)
Cleanup internal state.
Definition: rlm_sigtran.c:398
static unlang_action_t mod_authorize(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Definition: rlm_sigtran.c:200
static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx)
Definition: rlm_sigtran.c:307
static const conf_parser_t module_config[]
Definition: rlm_sigtran.c:146
static int mod_thread_detach(module_thread_inst_ctx_t const *mctx)
Definition: rlm_sigtran.c:323
static int mod_instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_sigtran.c:332
#define SECTION_NAME(_name1, _name2)
Define a section name consisting of a verb and a noun.
Definition: section.h:40
#define MODULE_BINDING_TERMINATOR
Terminate a module binding list.
Definition: module.h:151
Named methods exported by a module.
Definition: module.h:173
struct rlm_sigtran rlm_sigtran_t

Definition at line 425 of file rlm_sigtran.c.

◆ rlm_sigtran_dict

fr_dict_autoload_t rlm_sigtran_dict
Initial value:
= {
{ .out = &dict_eap_aka_sim, .base_dir = "eap/aka-sim", .proto = "eap-aka-sim" },
{ NULL }
}
fr_dict_t const * dict_eap_aka_sim
Definition: rlm_sigtran.c:158

Definition at line 180 of file rlm_sigtran.c.

◆ rlm_sigtran_dict_attr

fr_dict_attr_autoload_t rlm_sigtran_dict_attr
Initial value:
= {
{ .out = &attr_eap_aka_sim_autn, .name = "AUTN", .type = FR_TYPE_OCTETS, .dict = &dict_eap_aka_sim },
{ .out = &attr_eap_aka_sim_ck, .name = "CK", .type = FR_TYPE_OCTETS, .dict = &dict_eap_aka_sim },
{ .out = &attr_eap_aka_sim_ik, .name = "IK", .type = FR_TYPE_OCTETS, .dict = &dict_eap_aka_sim },
{ .out = &attr_eap_aka_sim_kc, .name = "KC", .type = FR_TYPE_OCTETS, .dict = &dict_eap_aka_sim },
{ .out = &attr_eap_aka_sim_rand, .name = "RAND", .type = FR_TYPE_OCTETS, .dict = &dict_eap_aka_sim },
{ .out = &attr_eap_aka_sim_sres, .name = "SRES", .type = FR_TYPE_OCTETS, .dict = &dict_eap_aka_sim },
{ .out = &attr_eap_aka_sim_xres, .name = "XRES", .type = FR_TYPE_OCTETS, .dict = &dict_eap_aka_sim },
{ NULL }
}
@ FR_TYPE_OCTETS
Raw octets.
Definition: merged_model.c:84
fr_dict_attr_t const * attr_eap_aka_sim_ik
Definition: rlm_sigtran.c:165
fr_dict_attr_t const * attr_eap_aka_sim_xres
Definition: rlm_sigtran.c:166
fr_dict_attr_t const * attr_eap_aka_sim_ck
Definition: rlm_sigtran.c:164
fr_dict_attr_t const * attr_eap_aka_sim_sres
Definition: rlm_sigtran.c:172
fr_dict_attr_t const * attr_eap_aka_sim_kc
Definition: rlm_sigtran.c:171
fr_dict_attr_t const * attr_eap_aka_sim_autn
Definition: rlm_sigtran.c:163
fr_dict_attr_t const * attr_eap_aka_sim_rand
Definition: rlm_sigtran.c:177

Definition at line 188 of file rlm_sigtran.c.

◆ sccp_address

const conf_parser_t sccp_address[]
static
Initial value:
= {
}
@ FR_TYPE_UINT8
8 Bit unsigned integer.
Definition: merged_model.c:97
static const conf_parser_t sccp_global_title[]
Definition: rlm_sigtran.c:112
Structure representing a complete Q.173 SCCP address.
Definition: sigtran.h:120

Definition at line 122 of file rlm_sigtran.c.

◆ sccp_config

const conf_parser_t sccp_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("ai8", rlm_sigtran_t, conn_conf.sccp_ai8) },
{ FR_CONF_OFFSET("route_on_ssn", rlm_sigtran_t, conn_conf.sccp_route_on_ssn) },
{ FR_CONF_OFFSET_SUBSECTION("called", 0, rlm_sigtran_t, conn_conf.sccp_called, sccp_address) },
{ FR_CONF_OFFSET_SUBSECTION("calling", 0, rlm_sigtran_t, conn_conf.sccp_calling, sccp_address) },
}
#define FR_CONF_OFFSET_SUBSECTION(_name, _flags, _struct, _field, _subcs)
conf_parser_t which populates a sub-struct using a CONF_SECTION
Definition: cf_parse.h:297
static const conf_parser_t sccp_address[]
Definition: rlm_sigtran.c:122

Definition at line 130 of file rlm_sigtran.c.

◆ sccp_global_title

const conf_parser_t sccp_global_title[]
static

◆ sctp_config

const conf_parser_t sctp_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET_TYPE_FLAGS("server", FR_TYPE_COMBO_IP_ADDR, 0, rlm_sigtran_t, conn_conf.sctp_dst_ipaddr) },
{ FR_CONF_OFFSET("port", rlm_sigtran_t, conn_conf.sctp_dst_port), .dflt = "2905" },
{ FR_CONF_OFFSET_TYPE_FLAGS("src_ipaddr", FR_TYPE_COMBO_IP_ADDR, 0, rlm_sigtran_t, conn_conf.sctp_src_ipaddr ) },
{ FR_CONF_OFFSET("src_port", rlm_sigtran_t, conn_conf.sctp_src_port), .dflt = "0" },
{ FR_CONF_OFFSET("timeout", rlm_sigtran_t, conn_conf.sctp_timeout), .dflt = "5" },
}
#define FR_CONF_OFFSET_TYPE_FLAGS(_name, _type, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition: cf_parse.h:241
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.
Definition: merged_model.c:91

Definition at line 73 of file rlm_sigtran.c.

◆ sigtran_instances

uint32_t sigtran_instances = 0
static

Definition at line 62 of file rlm_sigtran.c.