Commit e5b66cb0 authored by Lionel Gauthier's avatar Lionel Gauthier

Rework of GTPU in kernel (now use UDP socket, kthread for rx),

No need for GTPURH kernel module (work done in GTPUAH, will change module name later).
still classification with iptables mark, conntrack.
Tested with EPC local to eNB, test with remote EPC after this commit.

Added srb1 parameters in enb config file,

Correction of mscgen traces

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7413 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 4bd766cc
......@@ -215,35 +215,12 @@ function main()
$SUDO rm -f /usr/etc/freeDiameter/epc* 2>&1
$SUDO rm -f $OPENAIR_DIR/targets/bin/xt_GTPU*.ko 2>&1
(cd $OPENAIRCN_DIR/GTPV1-U/GTPUAH && $SUDO make clean)
(cd $OPENAIRCN_DIR/GTPV1-U/GTPURH && $SUDO make clean)
$SUDO rm -f $OPENAIRCN_DIR/GTPV1-U/GTPUAH/Bin/* 2>&1
$SUDO rm -f /lib/xtables/libxt_GTPU*.so 2>&1
mkdir -m 777 -p -v build
fi
##############################################################################
# Compile kernel modules
##############################################################################
# NO CMAKE FOR THAT, THIS CODE CAN DISAPEAR
#cd $OPENAIRCN_DIR/GTPV1-U/GTPUAH;
#make
#if [ $? -ne 0 ]; then
# echo_error "Build GTPUAH module failed, exiting"
# return 1
#else
# $SUDO cp -pfv ./Bin/libxt_*.so /lib/xtables
# $SUDO cp -pfv ./Bin/*.ko $OPENAIR_TARGETS/bin
#fi
#cd $OPENAIRCN_DIR/GTPV1-U/GTPURH;
#make
#if [ $? -ne 0 ]; then
# echo_error "Build GTPURH module failed, exiting"
# return 1
#else
# $SUDO cp -pfv ./Bin/libxt_*.so /lib/xtables
# $SUDO cp -pfv ./Bin/*.ko $OPENAIR_TARGETS/bin
#fi
......@@ -272,20 +249,13 @@ function main()
compilations \
epc_build_oai xt_GTPUAH_lib \
libxt_GTPUAH_lib.so $dbin
compilations \
epc_build_oai xt_GTPURH_lib \
libxt_GTPURH_lib.so $dbin
compilations \
epc_build_oai xt_GTPURH \
CMakeFiles/xt_GTPURH/xt_GTPURH.ko $dbin
compilations \
epc_build_oai xt_GTPUAH \
CMakeFiles/xt_GTPUAH/xt_GTPUAH.ko $dbin
echo_info "Copying iptables libraries into system directory: /lib/xtables"
if [ -f $dbin/libxt_GTPURH_lib.so ] ; then
$SUDO rm -f /lib/xtables/libxt_GTPURH.so /lib/xtables/libxt_GTPUAH.so
$SUDO ln -s $dbin/libxt_GTPURH_lib.so /lib/xtables/libxt_GTPURH.so
if [ -f $dbin/libxt_GTPUAH_lib.so ] ; then
$SUDO rm -f /lib/xtables/libxt_GTPUAH.so
$SUDO ln -s $dbin/libxt_GTPUAH_lib.so /lib/xtables/libxt_GTPUAH.so
else
echo_fatal "not installed GTP-U iptables: binaries not found"
......
......@@ -92,7 +92,6 @@ S-GW :
SGW_IPV4_ADDRESS_FOR_S11 = "0.0.0.0/24";
SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP = "eth2";
SGW_INTERFACE_MTU_FOR_S1U_S12_S4_UP = 1564
SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP = "192.168.27.101/24";
# TODO PORT NUMBER
......@@ -115,7 +114,7 @@ P-GW =
PGW_IPV4_ADDRESS_FOR_S5_S8 = "0.0.0.0/24";
PGW_INTERFACE_NAME_FOR_SGI = "eth0";
PGW_IPV4_ADDRESS_FOR_SGI = "192.168.12.101/24";
PGW_IPV4_ADDRESS_FOR_SGI = "192.168.12.213/24";
# Option available only if GTPU in kernel configured
PGW_MASQUERADE_SGI = "yes";
};
......
......@@ -62,7 +62,7 @@ MME :
# max values = 999.999:65535
# maximum of 32 values, comma separated
PLMN = (
{MCC="208" ; MNC="92"; TAC = "1"; }
{MCC="208" ; MNC="93"; TAC = "1"; }
);
};
......@@ -91,9 +91,8 @@ S-GW :
SGW_INTERFACE_NAME_FOR_S11 = "none";
SGW_IPV4_ADDRESS_FOR_S11 = "0.0.0.0/24";
SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP = "tun3";
SGW_INTERFACE_MTU_FOR_S1U_S12_S4_UP = 1564
SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP = "192.188.3.3/24";
SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP = "lo";
SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP = "127.0.0.1/24";
# TODO PORT NUMBER
SGW_IPV4_PORT_FOR_S1U_S12_S4_UP = 2152;
......
......@@ -201,7 +201,7 @@ function main()
if [ $run_mscgen -eq 1 ]; then
cd $MSC_DIR
last_created_file=`ls -t mscgen* | head -1 | tr -d ':'`
$OPENAIR_DIR/targets/SCRIPTS/msc_gen.py
$OPENAIR_DIR/targets/SCRIPTS/msc_gen.py --profile E_UTRAN
sync
last_created_file2=`ls -t mscgen* | head -1 | tr -d ':'`
......
......@@ -257,7 +257,7 @@ function main()
if [ $run_mscgen -eq 1 ]; then
cd $MSC_DIR
last_created_file=`ls -t mscgen* | head -1 | tr -d ':'`
$OPENAIR_DIR/targets/SCRIPTS/msc_gen.py
$OPENAIR_DIR/targets/SCRIPTS/msc_gen.py --profile E_UTRAN
sync
last_created_file2=`ls -t mscgen* | head -1 | tr -d ':'`
......
......@@ -11,6 +11,7 @@
*/
#include <linux/module.h>
#include <linux/kallsyms.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/skbuff.h>
......@@ -20,6 +21,8 @@
#include <linux/time.h>
#include <net/checksum.h>
#include <net/ip.h>
#include <linux/in.h>
#include <linux/icmp.h>
#include <net/udp.h>
#include <net/inet_sock.h>
#include <net/route.h>
......@@ -29,9 +32,18 @@
#include <net/ipv6.h>
#include <linux/netfilter/x_tables.h>
#include <linux/netfilter_ipv4/ip_tables.h>
#ifdef CONFIG_BRIDGE_NETFILTER
# include <linux/netfilter_bridge.h>
#endif
#include <linux/kthread.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/netdevice.h>
#include <linux/delay.h>
#include <linux/inet.h>
// CONNMARK
#include <net/netfilter/nf_conntrack.h>
#include <net/netfilter/nf_conntrack_ecache.h>
#include <linux/netfilter/x_tables.h>
#include <linux/netfilter/xt_connmark.h>
#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
# define WITH_IPV6 1
#endif
......@@ -40,7 +52,9 @@
# error "Kernel version is not defined!!!! Exiting."
#endif
//#define TRACE_IN_KERN_LOG 1
#define THREAD_SOCK_NO_WAIT 1
#define TRACE_IN_KERN_LOG 1
#define TRACE_ICMP_IN_KERN_LOG 1
#if defined(TRACE_IN_KERN_LOG)
#define PR_INFO(fORMAT, aRGS...) pr_info(fORMAT, ##aRGS)
......@@ -48,48 +62,77 @@
#define PR_INFO(fORMAT, aRGS...)
#endif
#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0444)
//-----------------------------------------------------------------------------
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Pradip Biswas <pradip_biswas@polarisnetworks.net>");
MODULE_DESCRIPTION("GTPu Data Path extension on netfilter");
#define STRING_MODULE_PARM(s, v) static char* s = v; module_param(s, charp, 0000);
//-----------------------------------------------------------------------------
static char* _gtpuah_nf_inet_hook_2_string(int nf_inet_hookP);
static void _gtpuah_print_hex_octets(unsigned char* data_pP, unsigned short sizeP);
static void _gtpuah_tg4_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP);
#ifdef WITH_IPV6
static void _gtpuah_tg6_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP);
static unsigned int gtpuah_tg6(struct sk_buff *skb_pP, const struct xt_action_param *par_pP);
static unsigned int _gtpuah_tg6(struct sk_buff *skb_pP, const struct xt_action_param *par_pP);
#endif
static unsigned int gtpuah_tg4(struct sk_buff *skb_pP, const struct xt_action_param *par_pP);
static unsigned int _gtpuah_tg4(struct sk_buff *skb_pP, const struct xt_action_param *par_pP);
static int __init gtpuah_tg_init(void);
static void __exit gtpuah_tg_exit(void);
static int _udp_thread(void *data);
static int _gtpuah_ksocket_send(struct socket *sock_pP, struct sockaddr_in *addr_pP, unsigned char *gtpuh_pP, int len_gtpP, unsigned char *buf_ip_pP, int len_ipP);
static int _gtpuah_ksocket_receive(struct socket* sock_pP, struct sockaddr_in* addr_pP, unsigned char* buf_pP, int lenP);
static int _gtpuah_ksocket_process_gtp(const unsigned char * const rx_buf_pP, const int lenP, unsigned char* tx_buf_pP);
//-----------------------------------------------------------------------------
#define MODULE_NAME "GTPUAH"
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Pradip Biswas <pradip_biswas@polarisnetworks.net>");
MODULE_DESCRIPTION("GTPu Data Path extension on netfilter");
//-----------------------------------------------------------------------------
static struct xt_target gtpuah_tg_reg[] __read_mostly = {
{
.name = "GTPUAH",
.name = MODULE_NAME,
.revision = 0,
.family = NFPROTO_IPV4,
.hooks = (1 << NF_INET_POST_ROUTING) |
(1 << NF_INET_LOCAL_IN),
(1 << NF_INET_LOCAL_IN) |
(1 << NF_INET_FORWARD),
.table = "mangle",
.target = gtpuah_tg4,
.target = _gtpuah_tg4,
.targetsize = sizeof(struct xt_gtpuah_target_info),
.me = THIS_MODULE,
},
#ifdef WITH_IPV6
{
.name = "GTPUAH",
.name = MODULE_NAME,
.revision = 0,
.family = NFPROTO_IPV6,
.hooks = (1 << NF_INET_POST_ROUTING) |
(1 << NF_INET_LOCAL_IN),
(1 << NF_INET_LOCAL_IN) |
(1 << NF_INET_FORWARD),
.table = "mangle",
.target = gtpuah_tg6,
.target = _gtpuah_tg6,
.targetsize = sizeof(struct xt_gtpuah_target_info),
.me = THIS_MODULE,
},
#endif
};
#define GTP_ECHO_REQ 1
#define GTP_ECHO_RSP 2
#define GTP_ERROR_INDICATION 26
#define GTP_GPDU 255
typedef struct gtpv1u_msg_s {
unsigned char version;
unsigned char protocol_type;
unsigned char ext_hdr_flag;
unsigned char seq_num_flag;
u_int16_t npdu_num_flag;
u_int32_t msg_type;
u_int16_t msg_len;
u_int32_t teid;
u_int16_t seq_num;
unsigned char npdu_num;
unsigned char next_ext_hdr_type;
u_int32_t msg_buf_len;
u_int32_t msg_buf_offset;
struct gtpv1u_msg_s* next;
} gtpv1u_msg_t;
struct gtpuhdr {
char flags;
......@@ -97,6 +140,14 @@ struct gtpuhdr {
u_int16_t length;
u_int32_t tunid;
};
typedef struct gtpuah_sock_s {
struct task_struct *thread;
struct sockaddr_in addr;
struct socket *sock;
struct sockaddr_in addr_send;
int running;
int thread_stop_requested;
} gtpuah_sock_t;
//-----------------------------------------------------------------------------
#define GTPU_HDR_PNBIT 1
......@@ -116,12 +167,39 @@ struct gtpuhdr {
(uint8_t)((addr & 0xFF000000) >> 24)
//-----------------------------------------------------------------------------
static char _gtpuah_print_buffer[GTPUAH_2_PRINT_BUFFER_LEN];
INT_MODULE_PARM(tunnel_local, 0);
MODULE_PARM_DESC(tunnel_local, "Act as a boolean, tels if the S1U tunnel(s) are both start/end local");
INT_MODULE_PARM(gtpu_port, 2152);
MODULE_PARM_DESC(gtpu_port, "UDP port number for S1U interface (eNB and S-GW sides)");
INT_MODULE_PARM(mtu, 1564);
MODULE_PARM_DESC(mtu, "MTU of the S1U IP interface");
gtpuah_sock_t _gtpuah_sock;
INT_MODULE_PARM(gtpu_sgw_port, 2152);
MODULE_PARM_DESC(gtpu_sgw_port, "UDP port number for S1U interface (s-GW side)");
INT_MODULE_PARM(gtpu_enb_port, 2153);
MODULE_PARM_DESC(gtpu_enb_port, "UDP port number for S1U interface (eNB side)");
STRING_MODULE_PARM(sgw_addr, "127.0.0.1");
MODULE_PARM_DESC(sgw_addr, "IPv4 address of the S1U IP interface");
//-----------------------------------------------------------------------------
static char*
_gtpuah_icmph_type_2_string(uint8_t typeP)
//-----------------------------------------------------------------------------
{
switch (typeP) {
case ICMP_ECHOREPLY:return "ECHOREPLY";break;
case ICMP_DEST_UNREACH:return "DEST_UNREACH";break;
case ICMP_SOURCE_QUENCH:return "SOURCE_QUENCH";break;
case ICMP_REDIRECT:return "REDIRECT";break;
case ICMP_ECHO:return "ECHO";break;
case ICMP_TIME_EXCEEDED:return "TIME_EXCEEDED";break;
case ICMP_PARAMETERPROB:return "PARAMETERPROB";break;
case ICMP_TIMESTAMP:return "TIMESTAMP";break;
case ICMP_TIMESTAMPREPLY:return "TIMESTAMPREPLY";break;
case ICMP_INFO_REQUEST:return "INFO_REQUEST";break;
case ICMP_INFO_REPLY:return "INFO_REPLY";break;
case ICMP_ADDRESS:return "ADDRESS";break;
case ICMP_ADDRESSREPLY:return "ADDRESSREPLY";break;
default:return "TYPE?";
}
}
//-----------------------------------------------------------------------------
static char*
_gtpuah_nf_inet_hook_2_string(int nf_inet_hookP)
......@@ -216,243 +294,326 @@ _gtpuah_print_hex_octets(unsigned char* data_pP, unsigned short sizeP)
pr_info("%s",_gtpuah_print_buffer);
}
#ifdef WITH_IPV6
//-----------------------------------------------------------------------------
static void
_gtpuah_tg6_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP)
static int _udp_thread(void *data)
//-----------------------------------------------------------------------------
{
//-----------------------------------------------------------------------------
int size, tx_size;
int bufsize = 8192;
unsigned char buf[bufsize+1];
unsigned char gtp_resp[1024];
/* kernel thread initialization */
_gtpuah_sock.running = 1;
PR_INFO(MODULE_NAME": listening on port %d\n", gtpu_sgw_port);
/* main loop */
while(_gtpuah_sock.thread_stop_requested == 0){
if (kthread_should_stop()) {
_gtpuah_sock.running = 0;
PR_INFO(MODULE_NAME": kthread_stop initiated exit at %lu \n", jiffies);
return -1; //Exit from the thread. Return value will be passed to kthread_stop()
}
#if defined(THREAD_SOCK_NO_WAIT)
usleep_range(500,2000);
#endif
size = _gtpuah_ksocket_receive(_gtpuah_sock.sock, &_gtpuah_sock.addr, buf, bufsize);
if (size <= 0) {
if (size != -EAGAIN) {
pr_info(MODULE_NAME": error getting datagram, sock_recvmsg error = %d\n", size);
}
} else {
PR_INFO(MODULE_NAME": received %d bytes\n", size);
if ((tx_size = _gtpuah_ksocket_process_gtp(buf, size, gtp_resp)) > 0) {
//ksocket_send(_gtpuah_sock.sock, &_gtpuah_sock.addr_send, buf, gtp_resp, tx_size, NULL, 0));
}
}
}
_gtpuah_sock.running = 0;
if (kthread_should_stop()) {
PR_INFO(MODULE_NAME": kthread_stop initiated exit at %lu \n", jiffies);
return -1; //Exit from the thread. Return value will be passed to kthread_stop()
}
PR_INFO(MODULE_NAME": kthread do_exit()\n");
do_exit(0);
}
//-----------------------------------------------------------------------------
static void
_gtpuah_tg4_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP)
static int _gtpuah_ksocket_process_gtp(const unsigned char * const rx_buf_pP, const int lenP, unsigned char* tx_buf_pP)
//-----------------------------------------------------------------------------
{
//-----------------------------------------------------------------------------
gtpv1u_msg_t gtpv1u_msg;
uint8_t msg_type;
struct iphdr *iph_p = NULL;
struct iphdr *new_iph_p= NULL;
struct sk_buff *skb_p = NULL;
const unsigned char * rx_buf_p = rx_buf_pP;
int err = 0;
struct rtable *rt = NULL;
struct ethhdr *ethhdr_p = NULL;
struct iphdr *old_iph_p = ip_hdr(old_skb_pP);
struct iphdr *new_iph_p = NULL;
struct iphdr *tmp_iph_p = NULL;
struct udphdr *udph_p = NULL;
struct gtpuhdr *gtpuh_p = NULL;
struct sk_buff *new_skb_p = NULL;
uint16_t headroom_reqd = LL_MAX_HEADER + sizeof(struct iphdr) + sizeof(struct udphdr) + sizeof(struct gtpuhdr);
uint16_t orig_iplen = 0, udp_len = 0, ip_len = 0;
int flags = 0, offset = 0;
unsigned int addr_type = RTN_UNSPEC;
if (ip_is_fragment(ip_hdr(old_skb_pP))) {
pr_info("GTPUAH: IP fragment, dropped\n");
return;
struct flowi fl = {
.u = {
.ip4 = {
.daddr = 0,
.flowi4_tos = 0,
.flowi4_scope = RT_SCOPE_UNIVERSE,
}
if (skb_linearize(old_skb_pP) < 0) {
PR_INFO("GTPUAH: skb no linearize\n");
return;
}
};
if (old_skb_pP->mark == 0) {
PR_INFO("GTPUAH: _gtpuah_target_add force info_pP mark %u to skb_pP mark %u\n",
old_skb_pP->mark,
((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->rtun);
old_skb_pP->mark = ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->rtun;
}
msg_type = rx_buf_pP[1];
/* Keep the length of the source IP packet */
orig_iplen = ntohs(old_iph_p->tot_len);
offset = ntohs(old_iph_p->frag_off);
flags = offset & ~IP_OFFSET;
switch(msg_type) {
case GTP_ECHO_REQ:
PR_INFO(MODULE_NAME": TODO GTP ECHO_REQ, SEND TO GTPV1U TASK USER SPACE\n");
//TODO;
return 0;
break;
case GTP_ERROR_INDICATION:
PR_INFO(MODULE_NAME":TODO GTP ERROR INDICATION, SEND TO GTPV1U TASK USER SPACE\n");
//TODO;
return 0;
break;
/* Create a new copy of the original skb...can't avoid :-( */
if ((orig_iplen + sizeof(struct iphdr) + sizeof(struct udphdr) + sizeof(struct gtpuhdr)) <= mtu) {
case GTP_ECHO_RSP:
PR_INFO(MODULE_NAME":GTP ECHO_RSP, SEND TO GTPV1U TASK USER SPACE\n");
return 0;
break;
new_skb_p = alloc_skb(headroom_reqd + orig_iplen, GFP_ATOMIC);
case GTP_GPDU: {
gtpv1u_msg.version = ((*rx_buf_p) & 0xE0) >> 5;
gtpv1u_msg.protocol_type = ((*rx_buf_p) & 0x10) >> 4;
gtpv1u_msg.ext_hdr_flag = ((*rx_buf_p) & 0x04) >> 2;
gtpv1u_msg.seq_num_flag = ((*rx_buf_p) & 0x02) >> 1;
gtpv1u_msg.npdu_num_flag = ((*rx_buf_p) & 0x01);
rx_buf_p++;
if (new_skb_p == NULL) {
PR_INFO("GTPUAH: alloc_skb returned NULL\n");
return;
}
gtpv1u_msg.msg_type = *(rx_buf_p);
rx_buf_p++;
if (skb_linearize(new_skb_p) < 0) {
PR_INFO("GTPUAH: skb no linearize\n");
goto free_new_skb;
}
rx_buf_p += 2;
skb_reserve(new_skb_p, headroom_reqd + orig_iplen);
tmp_iph_p = (void *)skb_push(new_skb_p, orig_iplen);
memcpy(tmp_iph_p, old_iph_p, orig_iplen);
gtpv1u_msg.teid = ntohl(*((u_int32_t *)rx_buf_p));
rx_buf_p += 4;
/* Add GTPu header */
gtpuh_p = (struct gtpuhdr*)skb_push(new_skb_p, sizeof(struct gtpuhdr));
gtpuh_p->flags = 0x30; /* v1 and Protocol-type=GTP */
gtpuh_p->msgtype = 0xff; /* T-PDU */
gtpuh_p->length = htons(orig_iplen);
gtpuh_p->tunid = htonl(old_skb_pP->mark);
/* Add UDP header */
udp_len = sizeof(struct udphdr) + sizeof(struct gtpuhdr) + orig_iplen;
udph_p = (struct udphdr*)skb_push(new_skb_p, sizeof(struct udphdr));
udph_p->source = htons(gtpu_port);
udph_p->dest = htons(gtpu_port);
udph_p->len = htons(udp_len);
udph_p->check = 0;
udph_p->check = csum_tcpudp_magic(((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->laddr,
((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->raddr,
udp_len,
IPPROTO_UDP,
csum_partial((char*)udph_p, udp_len, 0));
skb_reset_transport_header(new_skb_p);
/* Add IP header */
ip_len = sizeof(struct iphdr) + sizeof(struct udphdr) + sizeof(struct gtpuhdr) + orig_iplen;
new_iph_p = (struct iphdr*)skb_push(new_skb_p, sizeof(struct iphdr));
new_iph_p->ihl = 5;
new_iph_p->version = 4;
new_iph_p->tos = 0;
new_iph_p->tot_len = htons(ip_len);
new_iph_p->id = (uint16_t)(((uint64_t)new_skb_p) >> 8);
new_iph_p->frag_off = 0;
new_iph_p->ttl = 64;
new_iph_p->protocol = IPPROTO_UDP;
new_iph_p->saddr = ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->laddr;
// !!!!!!!! LG TEST !!!!!!!!!!
//new_iph_p->saddr = old_iph_p->saddr;
new_iph_p->daddr = ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->raddr;
new_iph_p->check = 0;
new_iph_p->check = ip_fast_csum((unsigned char *)new_iph_p, new_iph_p->ihl);
skb_reset_network_header(new_skb_p);
// CHECKSUM_NONE, CHECKSUM_UNNECESSARY, CHECKSUM_COMPLETE, CHECKSUM_PARTIAL
new_skb_p->ip_summed = CHECKSUM_NONE;
new_skb_p->mark = old_skb_pP->mark;
switch (par_pP->hooknum) {
case NF_INET_POST_ROUTING: {
new_skb_p->pkt_type = PACKET_OTHERHOST; // PACKET_OUTGOING
#ifdef CONFIG_BRIDGE_NETFILTER
if (new_skb_p->nf_bridge != NULL && new_skb_p->nf_bridge->mask & BRNF_BRIDGED) {
addr_type = RTN_LOCAL;
new_skb_p->pkt_type =PACKET_HOST;
if(gtpv1u_msg.ext_hdr_flag || gtpv1u_msg.seq_num_flag || gtpv1u_msg.npdu_num_flag) {
gtpv1u_msg.seq_num = ntohs(*(((u_int16_t *)rx_buf_p)));
rx_buf_p += 2;
gtpv1u_msg.npdu_num = *(rx_buf_p++);
gtpv1u_msg.next_ext_hdr_type = *(rx_buf_p++);
}
#endif
gtpv1u_msg.msg_buf_offset = (u_int32_t)(rx_buf_p - rx_buf_pP);
gtpv1u_msg.msg_buf_len = lenP - gtpv1u_msg.msg_buf_offset;
gtpv1u_msg.msg_len = lenP;
if (tunnel_local == 0) {
struct flowi fl = {
.u = {
.ip4 = {
.daddr = new_iph_p->daddr,
.flowi4_tos = RT_TOS(new_iph_p->tos),
.flowi4_scope = RT_SCOPE_UNIVERSE,
}
}
};
/*pr_info("GTPUAH: PACKET -> NF_HOOK NF_INET_POST_ROUTING/%s encapsulated src: %u.%u.%u.%u dst: %u.%u.%u.%u\n",
gtpuah_tg_reg[0].table,
NIPADDR(old_iph_p->saddr),
NIPADDR(old_iph_p->daddr));*/
iph_p = (struct iphdr*)(&rx_buf_pP[gtpv1u_msg.msg_buf_offset]);
fl.u.ip4.daddr = iph_p->daddr;
fl.u.ip4.flowi4_tos = RT_TOS(iph_p->tos);
rt = ip_route_output_key(&init_net, &fl.u.ip4);
if (rt == NULL) {
PR_INFO("GTPURH: Failed to route packet to dst 0x%x.\n", fl.u.ip4.daddr);
goto free_new_skb;
PR_INFO("GTPURH: Failed to route packet to dst 0x%x. Error: (%d)\n", fl.u.ip4.daddr, err);
return NF_DROP;
}
new_skb_p->priority = rt_tos2priority(new_iph_p->tos);
skb_dst_drop(new_skb_p);
if (rt->dst.dev) {
PR_INFO("GTPUAH: dst dev name %s\n", rt->dst.dev->name);
skb_dst_set(new_skb_p, dst_clone(&rt->dst));
new_skb_p->dev = skb_dst(new_skb_p)->dev;
if (new_skb_p->len > dst_mtu(skb_dst(new_skb_p))) {
goto free_new_skb;
if (rt->dst.dev == NULL) {
pr_info("GTPURH: dst dev NULL\n");
return 0;
}
//LG TESTnf_ct_attach(new_skb_p, old_skb_pP);
PR_INFO("GTPUAH: PACKET -> NF_HOOK NF_INET_POST_ROUTING/%s mark %u encap src: %u.%u.%u.%u dst: %u.%u.%u.%u in src: %u.%u.%u.%u dst: %u.%u.%u.%u\n",
gtpuah_tg_reg[0].table,
new_skb_p->mark,
NIPADDR(old_iph_p->saddr),
NIPADDR(old_iph_p->daddr),
NIPADDR(new_iph_p->saddr),
NIPADDR(new_iph_p->daddr),
new_skb_p->len);
#if defined(TRACE_IN_KERN_LOG)
_gtpuah_print_hex_octets(
ip_hdr(new_skb_p),
headroom_reqd);
#endif
skb_p = alloc_skb(LL_MAX_HEADER + ntohs(iph_p->tot_len), GFP_ATOMIC);
if (skb_p == NULL) {
return 0;
}
skb_p->priority = rt_tos2priority(iph_p->tos);
skb_p->pkt_type = PACKET_OTHERHOST;
skb_dst_set(skb_p, dst_clone(&rt->dst));
skb_p->dev = skb_dst(skb_p)->dev;
skb_reserve(skb_p, LL_MAX_HEADER + ntohs(iph_p->tot_len));
skb_p->protocol = htons(ETH_P_IP);
new_iph_p = (void *)skb_push(skb_p, ntohs(iph_p->tot_len) - (iph_p->ihl << 2));
skb_reset_transport_header(skb_p);
new_iph_p = (void *)skb_push(skb_p, iph_p->ihl << 2);
memcpy(new_iph_p, iph_p, ntohs(iph_p->tot_len));
skb_reset_network_header(skb_p);
skb_reset_inner_network_header(skb_p);
skb_reset_inner_transport_header(skb_p);
skb_p->mark = gtpv1u_msg.teid;
new_iph_p->ttl = ip4_dst_hoplimit(skb_dst(skb_p));
skb_p->ip_summed = CHECKSUM_NONE;
if (skb_p->len > dst_mtu(skb_dst(skb_p))) {
PR_INFO("GTPURH: bad length\n");
goto free_skb;
}
ip_local_out(skb_p);
return 0;
free_skb:
pr_info("GTPURH: Dropped skb\n");
kfree_skb(skb_p);
return 0;
}
break;
ip_local_out(new_skb_p);
return;
} else {
PR_INFO("GTPURH: rt->dst.dev == NULL\n");
goto free_new_skb;
default:
PR_INFO(MODULE_NAME":ERROR GTPU msg type %u\n", msg_type);
return 0;
}
} else { // (tunnel_local)
}
new_skb_p->pkt_type = PACKET_HOST;
new_skb_p->priority = rt_tos2priority(new_iph_p->tos);
new_skb_p->protocol = htons(ETH_P_IP);
//-----------------------------------------------------------------------------
static int _gtpuah_ksocket_receive(struct socket* sock_pP, struct sockaddr_in* addr_pP, unsigned char* buf_pP, int lenP)
//-----------------------------------------------------------------------------
{
struct msghdr msg;
struct iovec iov;
mm_segment_t oldfs;
int size = 0;
// fake mac header
ethhdr_p = (struct ethhdr*)skb_push(new_skb_p, ETH_HLEN);
skb_set_mac_header(new_skb_p, 0);
memset(ethhdr_p, 0, ETH_HLEN);
ethhdr_p->h_proto = ntohs(ETH_P_IP);
if (sock_pP->sk==NULL) return 0;
//_gtpuah_print_hex_octets(new_iph_p, ip_len);
//ip_local_deliver_fn_ptr(new_skb_p);
iov.iov_base = buf_pP;
iov.iov_len = lenP;
new_skb_p->ip_summed = CHECKSUM_NONE;
skb_dst_drop(new_skb_p);
nf_reset(new_skb_p);
#if defined(THREAD_SOCK_NO_WAIT)
msg.msg_flags = MSG_DONTWAIT;
#else
msg.msg_flags = 0;
#endif
msg.msg_name = addr_pP;
msg.msg_namelen = sizeof(struct sockaddr_in);
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_control = NULL;
oldfs = get_fs();
set_fs(KERNEL_DS);
size = sock_recvmsg(sock_pP,&msg,lenP,msg.msg_flags);
set_fs(oldfs);
return size;
}
/*pr_info("GTPUAH(tun): PACKET -> NF_HOOK NF_INET_POST_ROUTING/%s encapsulated src: %u.%u.%u.%u dst: %u.%u.%u.%u\n",
gtpuah_tg_reg[0].table,
NIPADDR(old_iph_p->saddr),
NIPADDR(old_iph_p->daddr));*/
if ( dev_forward_skb(old_skb_pP->dev, new_skb_p) != NET_RX_SUCCESS) {
PR_INFO("GTPUAH(tun): dev_forward_skb failed!!!\n");
//-----------------------------------------------------------------------------
static int _gtpuah_ksocket_send(struct socket *sock_pP, struct sockaddr_in *addr_pP, unsigned char *gtpuh_pP, int len_gtpP, unsigned char *buf_ip_pP, int len_ipP)
//-----------------------------------------------------------------------------
{
struct msghdr msg;
struct iovec iov[2];
mm_segment_t oldfs;
int size = 0;
int err = 0;
int iov_index = 0;
if ( (err = sock_pP->ops->connect(sock_pP, (struct sockaddr *)addr_pP, sizeof(struct sockaddr), 0)) < 0 ) {
PR_INFO(MODULE_NAME": Could not connect to socket, error = %d\n", -err);
return 0;
}
if (sock_pP->sk == NULL) {
return 0;
}
if ((gtpuh_pP != NULL) && (len_gtpP > 0)) {
iov[iov_index].iov_base = gtpuh_pP;
iov[iov_index].iov_len = len_gtpP;
iov_index += 1;
}
return;
if ((buf_ip_pP != NULL) && (len_ipP > 0)) {
iov[iov_index].iov_base = buf_ip_pP;
iov[iov_index].iov_len = len_ipP;
iov_index += 1;
}
msg.msg_flags = 0;
msg.msg_name = addr_pP;
msg.msg_namelen = sizeof(struct sockaddr_in);
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_iov = iov;
msg.msg_iovlen = iov_index;
msg.msg_control = NULL;
oldfs = get_fs();
set_fs(KERNEL_DS);
size = sock_sendmsg(sock_pP,&msg,len_ipP+len_gtpP);
set_fs(oldfs);
return size;
}
break;
default:
PR_INFO("GTPUAH: NF_HOOK %u not processed\n", par_pP->hooknum);
goto free_new_skb;
#ifdef WITH_IPV6
//-----------------------------------------------------------------------------
static void
_gtpuah_tg6_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP)
{
//-----------------------------------------------------------------------------
}
#endif
//-----------------------------------------------------------------------------
static void
_gtpuah_tg4_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP)
{
//-----------------------------------------------------------------------------
struct iphdr *old_iph_p = ip_hdr(old_skb_pP);
struct gtpuhdr gtpuh;
uint16_t orig_iplen = 0;
// CONNMARK
enum ip_conntrack_info ctinfo;
struct nf_conn *ct = NULL;
u_int32_t newmark;
if (skb_linearize(old_skb_pP) < 0) {
PR_INFO(MODULE_NAME": skb no linearize\n");
return;
}
//----------------------------------------------------------------------------
// CONNMARK
//----------------------------------------------------------------------------
ct = nf_ct_get(old_skb_pP, &ctinfo);
if (ct == NULL) {
PR_INFO(MODULE_NAME": _gtpuah_target_add force info_pP mark %u to skb_pP mark %u\n",
old_skb_pP->mark,
((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->rtun);
old_skb_pP->mark = ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->rtun;
} else {
PR_INFO("GTPUAH: PACKET DROPPED because of mtu %u < (%u + %u)\n",
mtu, orig_iplen, headroom_reqd);
//XT_CONNMARK_RESTORE:
newmark = old_skb_pP->mark ^ ct->mark;
PR_INFO(MODULE_NAME": _gtpuah_target_add restore mark %u (skb mark %u ct mark %u) sgw addr %x\n",
newmark, old_skb_pP->mark, ct->mark,
((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->raddr);
}
free_new_skb:
pr_info("GTPUAH: PACKET DROPPED\n");
kfree_skb(new_skb_p);
orig_iplen = ntohs(old_iph_p->tot_len);
/* Add GTPu header */
gtpuh.flags = 0x30; /* v1 and Protocol-type=GTP */
gtpuh.msgtype = 0xff; /* T-PDU */
gtpuh.length = htons(orig_iplen);
gtpuh.tunid = htonl(newmark);
_gtpuah_sock.addr_send.sin_addr.s_addr = ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->raddr;
_gtpuah_ksocket_send(_gtpuah_sock.sock, &_gtpuah_sock.addr_send, (unsigned char*)&gtpuh, sizeof(gtpuh), (unsigned char*)old_iph_p, orig_iplen);
return ;
}
#ifdef WITH_IPV6
//-----------------------------------------------------------------------------
static unsigned int
gtpuah_tg6(struct sk_buff *skb_pP, const struct xt_action_param *par_pP)
_gtpuah_tg6(struct sk_buff *skb_pP, const struct xt_action_param *par_pP)
{
//-----------------------------------------------------------------------------
......@@ -473,10 +634,9 @@ gtpuah_tg6(struct sk_buff *skb_pP, const struct xt_action_param *par_pP)
//-----------------------------------------------------------------------------
static unsigned int
gtpuah_tg4(struct sk_buff *skb_pP, const struct xt_action_param *par_pP)
_gtpuah_tg4(struct sk_buff *skb_pP, const struct xt_action_param *par_pP)
{
//-----------------------------------------------------------------------------
const struct iphdr *iph_p = ip_hdr(skb_pP);
const struct xt_gtpuah_target_info *tgi_p = par_pP->targinfo;
if (tgi_p == NULL) {
......@@ -494,29 +654,110 @@ gtpuah_tg4(struct sk_buff *skb_pP, const struct xt_action_param *par_pP)
//-----------------------------------------------------------------------------
static int
__init gtpuah_tg_init(void)
//-----------------------------------------------------------------------------
{
//-----------------------------------------------------------------------------
pr_info("GTPUAH: Initializing module (KVersion: %d)\n", KVERSION);
pr_info("GTPUAH: Copyright Polaris Networks 2010-2011\n");
pr_info("GTPUAH: Modified by EURECOM Lionel GAUTHIER 2014\n");
int err;
pr_info(MODULE_NAME": Initializing module (KVersion: %d)\n", KVERSION);
pr_info(MODULE_NAME": Copyright Polaris Networks 2010-2011\n");
pr_info(MODULE_NAME": Modified by EURECOM Lionel GAUTHIER 2014\n");
#ifndef CMAKER
pr_info("GTPUAH: Compiled %s at time %s\n",__DATE__,__TIME__);
pr_info(MODULE_NAME": Compiled %s at time %s\n",__DATE__,__TIME__);
#endif
#if defined(WITH_IPV6)
pr_info("GTPURH: IPv4/IPv6 enabled\n");
pr_info(MODULE_NAME": IPv4/IPv6 enabled\n");
#else
pr_info("GTPURH: IPv4 only enabled\n");
pr_info(MODULE_NAME": IPv4 only enabled\n");
#endif
pr_info(MODULE_NAME": params gtpu_enb_port=%u, gtpu_sgw_port=%u, sgw_addr=%s\n",
gtpu_enb_port, gtpu_sgw_port, sgw_addr);
// UDP socket socket
memset(&_gtpuah_sock, 0, sizeof(gtpuah_sock_t));
/* create a socket */
if ((err = sock_create(AF_INET, SOCK_DGRAM, IPPROTO_UDP, &_gtpuah_sock.sock)) < 0 ) {
PR_INFO(": Could not create a datagram socket, error = %d\n", -ENXIO);
return err;
}
_gtpuah_sock.addr.sin_family = AF_INET;
_gtpuah_sock.addr.sin_port = htons(gtpu_sgw_port);
_gtpuah_sock.addr.sin_addr.s_addr = in_aton(sgw_addr);
_gtpuah_sock.addr_send.sin_family = AF_INET;
_gtpuah_sock.addr_send.sin_port = htons(gtpu_enb_port);
_gtpuah_sock.addr_send.sin_addr.s_addr = in_aton(sgw_addr);
_gtpuah_sock.thread_stop_requested = 0;
if ( (err = _gtpuah_sock.sock->ops->bind(_gtpuah_sock.sock, (struct sockaddr *)&_gtpuah_sock.addr, sizeof(struct sockaddr) ) ) < 0) {
pr_info(MODULE_NAME": Could not bind socket, error = %d\n", -err);
goto close_and_out;
}
if ( (err = _gtpuah_sock.sock->ops->connect(_gtpuah_sock.sock, (struct sockaddr *)&_gtpuah_sock.addr_send, sizeof(struct sockaddr), 0)) < 0 ) {
pr_info(MODULE_NAME": Could not connect to socket, error = %d\n", -err);
goto close_and_out;
}
// start kernel thread
_gtpuah_sock.thread = kthread_run((void *)_udp_thread, NULL, MODULE_NAME);
if (IS_ERR(_gtpuah_sock.thread)) {
pr_info(MODULE_NAME": unable to start kernel thread\n");
return -ENOMEM;
}
if((_gtpuah_sock.thread)) {
wake_up_process(_gtpuah_sock.thread);
}
return xt_register_targets(gtpuah_tg_reg, ARRAY_SIZE(gtpuah_tg_reg));
close_and_out:
sock_release(_gtpuah_sock.sock);
_gtpuah_sock.sock = NULL;
return err;
}
//-----------------------------------------------------------------------------
static void
__exit gtpuah_tg_exit(void)
//-----------------------------------------------------------------------------
{
//-----------------------------------------------------------------------------
int err;
int loop = 0;
if (_gtpuah_sock.thread==NULL) {
pr_info(MODULE_NAME": no kernel thread to kill\n");
} else {
if (_gtpuah_sock.running > 0) {
_gtpuah_sock.thread_stop_requested = 1;
pr_info(MODULE_NAME": exit kernel thread requested\n");
do {
pr_info(MODULE_NAME": waking up thread with datagram\n");
msleep(5);
pr_info(MODULE_NAME": waiting for thread...\n");
loop++;
} while ((_gtpuah_sock.running > 0) && (loop < 20));
if (_gtpuah_sock.running > 0) {
pr_info(MODULE_NAME": stopping kernel thread\n");
err = kthread_stop(_gtpuah_sock.thread);
if(!err) {
pr_info(MODULE_NAME": Successfully killed kernel thread!\n");
} else {
pr_info(MODULE_NAME": Unsuccessfully killed kernel thread!\n");
}
} else {
pr_info(MODULE_NAME": Found thread exited by itself\n");
}
}
}
/* free allocated resources before exit */
if (_gtpuah_sock.sock != NULL) {
sock_release(_gtpuah_sock.sock);
_gtpuah_sock.sock = NULL;
}
xt_unregister_targets(gtpuah_tg_reg, ARRAY_SIZE(gtpuah_tg_reg));
pr_info("GTPUAH: Unloading module\n");
pr_info(MODULE_NAME": Unloading module\n");
}
......
......@@ -15,6 +15,8 @@
#include <linux/init.h>
#include <linux/skbuff.h>
#include <linux/ip.h>
#include <linux/in.h>
#include <linux/icmp.h>
#include <linux/if_ether.h>
#include <linux/route.h>
#include <net/checksum.h>
......@@ -33,6 +35,7 @@
#endif
//#define TRACE_IN_KERN_LOG 1
#define TRACE_ICMP_IN_KERN_LOG 1
#if defined(TRACE_IN_KERN_LOG)
#define PR_INFO(fORMAT, aRGS...) pr_info(fORMAT, ##aRGS)
......@@ -105,11 +108,33 @@ struct gtpuhdr {
u_int32_t tunid;
};
//-----------------------------------------------------------------------------
static char*
_gtpurh_icmph_type_2_string(uint8_t typeP)
//-----------------------------------------------------------------------------
{
switch (typeP) {
case ICMP_ECHOREPLY:return "ECHOREPLY";break;
case ICMP_DEST_UNREACH:return "DEST_UNREACH";break;
case ICMP_SOURCE_QUENCH:return "SOURCE_QUENCH";break;
case ICMP_REDIRECT:return "REDIRECT";break;
case ICMP_ECHO:return "ECHO";break;
case ICMP_TIME_EXCEEDED:return "TIME_EXCEEDED";break;
case ICMP_PARAMETERPROB:return "PARAMETERPROB";break;
case ICMP_TIMESTAMP:return "TIMESTAMP";break;
case ICMP_TIMESTAMPREPLY:return "TIMESTAMPREPLY";break;
case ICMP_INFO_REQUEST:return "INFO_REQUEST";break;
case ICMP_INFO_REPLY:return "INFO_REPLY";break;
case ICMP_ADDRESS:return "ADDRESS";break;
case ICMP_ADDRESSREPLY:return "ADDRESSREPLY";break;
default:return "TYPE?";
}
}
//-----------------------------------------------------------------------------
static char*
_gtpurh_nf_inet_hook_2_string(int nf_inet_hookP)
//-----------------------------------------------------------------------------
{
//-----------------------------------------------------------------------------
switch (nf_inet_hookP) {
case NF_INET_PRE_ROUTING:
return "NF_INET_PRE_ROUTING";
......@@ -290,6 +315,9 @@ _gtpurh_tg4_rem(struct sk_buff *orig_skb_pP, const struct xt_action_param *par_p
#if defined(NEW_SKB)
struct sk_buff *new_skb_p = NULL;
struct iphdr *new_ip_p = NULL;
#endif
#if defined(TRACE_ICMP_IN_KERN_LOG)
struct icmphdr *icmph_p = NULL;
#endif
uint16_t gtp_payload_size = 0;
......@@ -487,6 +515,20 @@ _gtpurh_tg4_rem(struct sk_buff *orig_skb_pP, const struct xt_action_param *par_p
(new_skb_p->dev == NULL) ? "NULL" : new_skb_p->dev->name,
NIPADDR(new_ip_p->saddr),
NIPADDR(new_ip_p->daddr));*/
#if defined(TRACE_ICMP_IN_KERN_LOG)
if (new_ip_p->protocol == IPPROTO_ICMP) {
icmph_p = (struct icmphdr*)((uint8_t*)new_ip_p + (new_ip_p->ihl << 2));
if ((icmph_p->type == ICMP_ECHOREPLY) || (icmph_p->type == ICMP_ECHO)) {
pr_info("GTPURH: %s/%s ICMP src %u.%u.%u.%u dst %u.%u.%u.%u %s id %04X seq %u\n",
_gtpurh_nf_inet_hook_2_string(par_pP->hooknum),gtpurh_tg_reg[0].table,
NIPADDR(new_ip_p->saddr),
NIPADDR(new_ip_p->daddr),
_gtpurh_icmph_type_2_string(icmph_p->type),
ntohs(icmph_p->un.echo.id),
ntohs(icmph_p->un.echo.sequence));
}
}
#endif
ip_local_out(new_skb_p);
return NF_DROP;
free_skb:
......
......@@ -231,6 +231,11 @@ static int gtpv1u_eNB_send_init_udp(uint16_t port_number)
UDP_INIT(message_p).address = inet_ntoa(addr);
LOG_D(GTPU, "Tx UDP_INIT IP addr %s\n", UDP_INIT(message_p).address);
MSC_LOG_EVENT(
MSC_GTPU_ENB,
"0 UDP bind %s:%u",
UDP_INIT(message_p).address,
UDP_INIT(message_p).port);
return itti_send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p);
}
......@@ -333,8 +338,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req(
MSC_LOG_TX_MESSAGE(
MSC_GTPU_ENB,
MSC_PDCP_ENB,
NULL,
0,
NULL,0,
MSC_AS_TIME_FMT" DATA-REQ rb %u size %u",
0,0,
(gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4,
......
......@@ -649,7 +649,7 @@ int emm_proc_authentication(void *ctx, unsigned int ueid, int ksi,
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
"0 EMMREG_COMMON_PROC_REQ ue id %u (authentication)", ueid);
"0 EMMREG_COMMON_PROC_REQ ue id %06x (authentication)", ueid);
emm_sap_t emm_sap;
emm_sap.primitive = EMMREG_COMMON_PROC_REQ;
......@@ -756,7 +756,7 @@ int emm_proc_authentication_complete(unsigned int ueid, int emm_cause,
*/
MSC_LOG_EVENT(
MSC_NAS_EMM_MME,
"SQN SYNCH_FAILURE ue id %u", ueid);
"SQN SYNCH_FAILURE ue id %06x", ueid);
LOG_TRACE(DEBUG, "EMM-PROC - USIM has detected a mismatch in SQN Ask for a new vector");
nas_itti_auth_info_req(ueid, emm_ctx->imsi, 0, res->value);
......@@ -779,7 +779,7 @@ int emm_proc_authentication_complete(unsigned int ueid, int emm_cause,
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
"0 EMMREG_COMMON_PROC_REJ ue id %u", ueid);
"0 EMMREG_COMMON_PROC_REJ ue id %06x", ueid);
emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
......@@ -795,7 +795,7 @@ int emm_proc_authentication_complete(unsigned int ueid, int emm_cause,
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
"0 EMMREG_COMMON_PROC_CNF ue id %u", ueid);
"0 EMMREG_COMMON_PROC_CNF ue id %06x", ueid);
LOG_TRACE(DEBUG, "EMM-PROC - Notify EMM that the authentication procedure successfully completed");
emm_sap.primitive = EMMREG_COMMON_PROC_CNF;
......@@ -1448,7 +1448,7 @@ int _authentication_request(authentication_data_t *data)
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
"0 EMMAS_SECURITY_REQ ue id %u", data->ueid);
"0 EMMAS_SECURITY_REQ ue id %06x", data->ueid);
rc = emm_sap_send(&emm_sap);
......
......@@ -553,7 +553,7 @@ int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type,
MSC_NAS_EMM_MME,
MSC_NAS_ESM_MME,
NULL,0,
"0 ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ ue id %u", ueid);
"0 ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ ue id %06x", ueid);
esm_sap_t esm_sap;
esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ;
esm_sap.ueid = ueid;
......@@ -570,7 +570,7 @@ int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type,
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
"0 EMMREG_DETACH_REQ ue id %u", ueid);
"0 EMMREG_DETACH_REQ ue id %06x", ueid);
emm_sap.primitive = EMMREG_DETACH_REQ;
emm_sap.u.emm_reg.ueid = ueid;
emm_sap.u.emm_reg.ctx = emm_ctx;
......
......@@ -331,7 +331,7 @@ int emm_proc_identification(unsigned int ueid,
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
"0 EMMREG_COMMON_PROC_REQ ue id %u (identification)", ueid);
"0 EMMREG_COMMON_PROC_REQ ue id %06x (identification)", ueid);
emm_sap_t emm_sap;
emm_sap.primitive = EMMREG_COMMON_PROC_REQ;
......@@ -444,7 +444,7 @@ int emm_proc_identification_complete(unsigned int ueid, const imsi_t *imsi,
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
"0 EMMREG_COMMON_PROC_CNF ue id %u", ueid);
"0 EMMREG_COMMON_PROC_CNF ue id %06x", ueid);
emm_sap.primitive = EMMREG_COMMON_PROC_CNF;
emm_sap.u.emm_reg.ueid = ueid;
......@@ -459,7 +459,7 @@ int emm_proc_identification_complete(unsigned int ueid, const imsi_t *imsi,
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
"0 EMMREG_COMMON_PROC_REJ ue id %u", ueid);
"0 EMMREG_COMMON_PROC_REJ ue id %06x", ueid);
emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
emm_sap.u.emm_reg.ueid = ueid;
......@@ -568,7 +568,7 @@ int _identification_request(identification_data_t *data)
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
"0 EMMAS_SECURITY_REQ ue id %u", data->ueid);
"0 EMMAS_SECURITY_REQ ue id %06x", data->ueid);
emm_sap.primitive = EMMAS_SECURITY_REQ;
emm_sap.u.emm_as.u.security.guti = NULL;
......@@ -657,7 +657,7 @@ static int _identification_abort(void *args)
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
"0 EMMREG_COMMON_PROC_REJ ue id %u", ueid);
"0 EMMREG_COMMON_PROC_REJ ue id %06x", ueid);
emm_sap_t emm_sap;
emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
emm_sap.u.emm_reg.ueid = ueid;
......
......@@ -587,7 +587,7 @@ int emm_proc_security_mode_control(unsigned int ueid, int ksi,
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
"0 EMMREG_COMMON_PROC_REQ ue id %u (security mode control)", ueid);
"0 EMMREG_COMMON_PROC_REQ ue id %06x (security mode control)", ueid);
emm_sap_t emm_sap;
emm_sap.primitive = EMMREG_COMMON_PROC_REQ;
emm_sap.u.emm_reg.ueid = ueid;
......@@ -666,7 +666,7 @@ int emm_proc_security_mode_complete(unsigned int ueid)
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
"0 EMMREG_COMMON_PROC_CNF ue id %u (security mode complete)", ueid);
"0 EMMREG_COMMON_PROC_CNF ue id %06x (security mode complete)", ueid);
emm_sap.primitive = EMMREG_COMMON_PROC_CNF;
emm_sap.u.emm_reg.ueid = ueid;
emm_sap.u.emm_reg.ctx = emm_ctx;
......@@ -680,7 +680,7 @@ int emm_proc_security_mode_complete(unsigned int ueid)
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
"0 EMMREG_COMMON_PROC_REJ ue id %u (security mode complete)", ueid);
"0 EMMREG_COMMON_PROC_REJ ue id %06x (security mode complete)", ueid);
emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
emm_sap.u.emm_reg.ueid = ueid;
emm_sap.u.emm_reg.ctx = emm_ctx;
......@@ -770,7 +770,7 @@ int emm_proc_security_mode_reject(unsigned int ueid)
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
"0 EMMREG_COMMON_PROC_REJ ue id %u (security mode reject)", ueid);
"0 EMMREG_COMMON_PROC_REJ ue id %06x (security mode reject)", ueid);
emm_sap_t emm_sap;
emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
emm_sap.u.emm_reg.ueid = ueid;
......@@ -1116,7 +1116,7 @@ int _security_request(security_data_t *data, int is_new)
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
"0 EMMAS_SECURITY_REQ ue id %u", data->ueid);
"0 EMMAS_SECURITY_REQ ue id %06x", data->ueid);
rc = emm_sap_send(&emm_sap);
if (rc != RETURNerror) {
......@@ -1182,7 +1182,7 @@ static int _security_abort(void *args)
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
"0 EMMREG_COMMON_PROC_REJ ue id %u (security abort)", data->ueid);
"0 EMMREG_COMMON_PROC_REJ ue id %06x (security abort)", data->ueid);
emm_sap_t emm_sap;
emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
emm_sap.u.emm_reg.ueid = ueid;
......
......@@ -2011,7 +2011,7 @@ static int _emm_as_security_rej(const emm_as_security_t *msg,
if (msg->guti) {
MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send AUTHENTICATION_REJECT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi);
} else {
MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send AUTHENTICATION_REJECT to ue id %u ", as_msg->UEid);
MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send AUTHENTICATION_REJECT to ue id %x ", as_msg->UEid);
}
size = emm_send_authentication_reject(
&emm_msg->authentication_reject);
......@@ -2037,10 +2037,16 @@ static int _emm_as_security_rej(const emm_as_security_t *msg,
if (emm_ctx) {
emm_security_context = emm_ctx->security;
if (emm_security_context) {
nas_msg.header.sequence_number = emm_security_context->dl_count.seq_num;
LOG_TRACE(DEBUG,
"Set nas_msg.header.sequence_number -> %u",
nas_msg.header.sequence_number);
} else {
LOG_TRACE(DEBUG,
"No security context, not set nas_msg.header.sequence_number -> %u",
nas_msg.header.sequence_number);
}
}
/* Encode the NAS security message */
......@@ -2227,7 +2233,7 @@ static int _emm_as_establish_rej(const emm_as_establish_t *msg,
if (msg->UEid.guti) {
MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send ATTACH_REJECT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi);
} else {
MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send ATTACH_REJECT to ue id %u ", as_msg->UEid);
MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send ATTACH_REJECT to ue id 0x%06"PRIX32" ", as_msg->UEid);
}
size = emm_send_attach_reject(msg, &emm_msg->attach_reject);
break;
......@@ -2236,7 +2242,7 @@ static int _emm_as_establish_rej(const emm_as_establish_t *msg,
if (msg->UEid.guti) {
MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send TRACKING_AREA_UPDATE_REJECT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi);
} else {
MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send TRACKING_AREA_UPDATE_REJECT to ue id %u ", as_msg->UEid);
MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send TRACKING_AREA_UPDATE_REJECT to ue id 0x%06"PRIX32" ", as_msg->UEid);
}
size = emm_send_tracking_area_update_reject(msg,
&emm_msg->tracking_area_update_reject);
......
......@@ -955,7 +955,7 @@ int s1ap_handle_sctp_deconnection(uint32_t assoc_id)
}
MSC_LOG_EVENT(
MSC_S1AP_MME,
"Event SCTP_CLOSE_ASSOCIATION assoc_id: %d",
"0 Event SCTP_CLOSE_ASSOCIATION assoc_id: %d",
assoc_id);
STAILQ_FOREACH(ue_ref, &eNB_association->ue_list_head, ue_entries) {
......@@ -1038,7 +1038,7 @@ int s1ap_handle_new_association(sctp_new_peer_t *sctp_new_peer_p)
eNB_association->next_sctp_stream = 1;
MSC_LOG_EVENT(
MSC_S1AP_MME,
"Event SCTP_NEW_ASSOCIATION assoc_id: %d",
"0 Event SCTP_NEW_ASSOCIATION assoc_id: %d",
eNB_association->sctp_assoc_id);
return 0;
......
......@@ -756,9 +756,9 @@ sgw_lite_handle_sgi_endpoint_updated(
//if ((resp_pP->eps_bearer_id == 5) && (spgw_config.pgw_config.pgw_masquerade_SGI == 0)) {
if (resp_pP->eps_bearer_id == 5) {
ret = snprintf(cmd,
256,
"iptables -t mangle -I %s -d %u.%u.%u.%u -m mark --mark 0 -j GTPUAH --own-ip %u.%u.%u.%u --own-tun %u --peer-ip %u.%u.%u.%u --peer-tun %u --action add",
(spgw_config.sgw_config.local_to_eNB) ? "FORWARD":"POSTROUTING",
256, // mangle -I
"iptables -t mangle -A %s -d %u.%u.%u.%u -m mark --mark 0 -j GTPUAH --own-ip %u.%u.%u.%u --own-tun %u --peer-ip %u.%u.%u.%u --peer-tun %u --action add",
(spgw_config.sgw_config.local_to_eNB) ? "FORWARD":"FORWARD", // test
eps_bearer_entry_p->paa.ipv4_address[0],
eps_bearer_entry_p->paa.ipv4_address[1],
eps_bearer_entry_p->paa.ipv4_address[2],
......@@ -789,7 +789,7 @@ sgw_lite_handle_sgi_endpoint_updated(
ret = snprintf(cmd,
256,
"iptables -t mangle -I %s -d %u.%u.%u.%u -m mark --mark %u -j GTPUAH --own-ip %u.%u.%u.%u --own-tun %u --peer-ip %u.%u.%u.%u --peer-tun %u --action add",
(spgw_config.sgw_config.local_to_eNB) ? "FORWARD":"POSTROUTING",
(spgw_config.sgw_config.local_to_eNB) ? "FORWARD":"FORWARD", // test
eps_bearer_entry_p->paa.ipv4_address[0],
eps_bearer_entry_p->paa.ipv4_address[1],
eps_bearer_entry_p->paa.ipv4_address[2],
......@@ -819,40 +819,6 @@ sgw_lite_handle_sgi_endpoint_updated(
SPGW_APP_ERROR("ERROR in setting up downlink TUNNEL\n");
}
if (iptable_uplink_remove_gtpu == FALSE) {
ret = snprintf(cmd,
256,
"iptables -t raw -I %s -s %u.%u.%u.%u -d %u.%u.%u.%u -p udp --dport 2152 -j GTPURH --own-ip %u.%u.%u.%u --own-tun %u --peer-ip %u.%u.%u.%u --peer-tun %u --action remove",
(spgw_config.sgw_config.local_to_eNB) ? "OUTPUT":"PREROUTING",
eps_bearer_entry_p->enb_ip_address_for_S1u.address.ipv4_address[0],
eps_bearer_entry_p->enb_ip_address_for_S1u.address.ipv4_address[1],
eps_bearer_entry_p->enb_ip_address_for_S1u.address.ipv4_address[2],
eps_bearer_entry_p->enb_ip_address_for_S1u.address.ipv4_address[3],
sgw_app.sgw_ip_address_for_S1u_S12_S4_up & 0x000000FF,
(sgw_app.sgw_ip_address_for_S1u_S12_S4_up & 0x0000FF00) >> 8,
(sgw_app.sgw_ip_address_for_S1u_S12_S4_up & 0x00FF0000) >> 16,
(sgw_app.sgw_ip_address_for_S1u_S12_S4_up & 0xFF000000) >> 24,
sgw_app.sgw_ip_address_for_S1u_S12_S4_up & 0x000000FF,
(sgw_app.sgw_ip_address_for_S1u_S12_S4_up & 0x0000FF00) >> 8,
(sgw_app.sgw_ip_address_for_S1u_S12_S4_up & 0x00FF0000) >> 16,
(sgw_app.sgw_ip_address_for_S1u_S12_S4_up & 0xFF000000) >> 24,
eps_bearer_entry_p->s_gw_teid_for_S1u_S12_S4_up,
eps_bearer_entry_p->enb_ip_address_for_S1u.address.ipv4_address[0],
eps_bearer_entry_p->enb_ip_address_for_S1u.address.ipv4_address[1],
eps_bearer_entry_p->enb_ip_address_for_S1u.address.ipv4_address[2],
eps_bearer_entry_p->enb_ip_address_for_S1u.address.ipv4_address[3],
eps_bearer_entry_p->enb_teid_for_S1u);
if ((ret < 0) || (ret > 256)) {
SPGW_APP_ERROR("ERROR in preparing uplink tunnel, tune string length\n");
exit (-1);
}
ret = spgw_system(cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
iptable_uplink_remove_gtpu = TRUE;
}
#endif
}
MSC_LOG_TX_MESSAGE(
......
......@@ -161,50 +161,27 @@ int spgw_config_process(spgw_config_t* config_pP)
struct in_addr inaddr;
int ret = 0;
if (strncasecmp("tun",config_pP->sgw_config.ipv4.sgw_interface_name_for_S1u_S12_S4_up, strlen("tun")) == 0) {
inaddr.s_addr = config_pP->sgw_config.ipv4.sgw_ipv4_address_for_S1u_S12_S4_up;
if (strncasecmp("lo",config_pP->sgw_config.ipv4.sgw_interface_name_for_S1u_S12_S4_up, strlen("lo")) == 0) {
config_pP->sgw_config.local_to_eNB = TRUE;
if (snprintf(system_cmd, 256,
"ip link set %s down ;sync;openvpn --rmtun --dev %s;sync",
config_pP->sgw_config.ipv4.sgw_interface_name_for_S1u_S12_S4_up,
config_pP->sgw_config.ipv4.sgw_interface_name_for_S1u_S12_S4_up
) > 0) {
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Del %s\n", config_pP->sgw_config.ipv4.sgw_interface_name_for_S1u_S12_S4_up);
ret = -1;
}
if (snprintf(system_cmd, 256,
"openvpn --mktun --dev %s;sync",
config_pP->sgw_config.ipv4.sgw_interface_name_for_S1u_S12_S4_up) > 0) {
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Create %s\n", config_pP->sgw_config.ipv4.sgw_interface_name_for_S1u_S12_S4_up);
ret = -1;
}
inaddr.s_addr = config_pP->sgw_config.ipv4.sgw_ipv4_address_for_S1u_S12_S4_up;
config_pP->sgw_config.local_to_eNB = FALSE;
if (snprintf(system_cmd, 256,
"ip -4 addr add %s/%d dev %s;sync",
inet_ntoa(inaddr),
config_pP->sgw_config.ipv4.sgw_ip_netmask_for_S1u_S12_S4_up,
config_pP->sgw_config.ipv4.sgw_interface_name_for_S1u_S12_S4_up) > 0) {
"insmod $OPENAIR_TARGETS/bin/xt_GTPUAH.ko gtpu_enb_port=2152 gtpu_sgw_port=%u sgw_addr=\"%s\" ",
config_pP->sgw_config.sgw_udp_port_for_S1u_S12_S4_up,
inet_ntoa(inaddr)) > 0) {
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Set IPv4 address on %s\n", config_pP->sgw_config.ipv4.sgw_interface_name_for_S1u_S12_S4_up);
SPGW_APP_ERROR("GTPUAH kernel module\n");
ret = -1;
}
if (snprintf(system_cmd, 256,
"sync;ifconfig %s up;sync",
config_pP->sgw_config.ipv4.sgw_interface_name_for_S1u_S12_S4_up) > 0) {
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("ifconfig up %s\n", config_pP->sgw_config.ipv4.sgw_interface_name_for_S1u_S12_S4_up);
ret = -1;
}
if (config_pP->sgw_config.local_to_eNB == TRUE) {
if (snprintf(system_cmd, 256,
"iptables -t filter -I INPUT -i lo -d %s --protocol sctp -j DROP",
inet_ntoa(inaddr)) > 0) {
......@@ -224,20 +201,9 @@ int spgw_config_process(spgw_config_t* config_pP)
}
if (snprintf(system_cmd, 256,
"insmod $OPENAIR_TARGETS/bin/xt_GTPUAH.ko tunnel_local=1 gtpu_port=%u mtu=%u",
"insmod $OPENAIR_TARGETS/bin/xt_GTPUAH.ko gtpu_enb_port=2153 gtpu_sgw_port=%u sgw_addr=\"%s\" ",
config_pP->sgw_config.sgw_udp_port_for_S1u_S12_S4_up,
config_pP->sgw_config.sgw_interface_mtu_for_S1u_S12_S4_up) > 0) {
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("GTPUAH kernel module\n");
ret = -1;
}
} else {
config_pP->sgw_config.local_to_eNB = FALSE;
if (snprintf(system_cmd, 256,
"insmod $OPENAIR_TARGETS/bin/xt_GTPUAH.ko tunnel_local=0 gtpu_port=%u mtu=%u",
config_pP->sgw_config.sgw_udp_port_for_S1u_S12_S4_up,
config_pP->sgw_config.sgw_interface_mtu_for_S1u_S12_S4_up) > 0) {
inet_ntoa(inaddr)) > 0) {
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("GTPUAH kernel module\n");
......@@ -245,24 +211,11 @@ int spgw_config_process(spgw_config_t* config_pP)
}
}
spgw_system("insmod $OPENAIR_TARGETS/bin/xt_GTPURH.ko", SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
#if defined (ENABLE_USE_GTPU_IN_KERNEL)
ret += spgw_system("echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects", SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
#endif
if (snprintf(system_cmd, 256,
"ip link set dev %s mtu %u",
config_pP->sgw_config.ipv4.sgw_interface_name_for_S1u_S12_S4_up,
config_pP->sgw_config.sgw_interface_mtu_for_S1u_S12_S4_up) > 0) {
SPGW_APP_INFO("Set S1U interface MTU: %s\n",system_cmd);
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Set S1U interface MTU\n");
ret = -1;
}
if (snprintf(system_cmd, 256,
"ethtool -K %s tso off gso off gro off",
......@@ -274,46 +227,6 @@ int spgw_config_process(spgw_config_t* config_pP)
ret = -1;
}
#if defined (ENABLE_USE_GTPU_IN_KERNEL)
if (config_pP->sgw_config.local_to_eNB) {
if (snprintf(system_cmd, 256,
"iptables -I OUTPUT -t mangle -m mark ! --mark 0 -j CONNMARK --save-mark") > 0) {
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Save mark\n");
ret = -1;
}
} else {
if (snprintf(system_cmd, 256,
"iptables -I POSTROUTING -t mangle -o %s -m mark ! --mark 0 -j CONNMARK --save-mark",
config_pP->pgw_config.ipv4.pgw_interface_name_for_SGI) > 0) {
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Save mark\n");
ret = -1;
}
}
/* if (snprintf(system_cmd, 256,
"iptables -I INPUT -t mangle -i %s ! --protocol sctp -j CONNMARK --restore-mark",
config_pP->pgw_config.ipv4.pgw_interface_name_for_SGI) > 0) {
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Restore mark\n");
ret = -1;
}*/
if (snprintf(system_cmd, 256,
"iptables -I PREROUTING -t mangle -i %s ! --protocol sctp -j CONNMARK --restore-mark",
config_pP->pgw_config.ipv4.pgw_interface_name_for_SGI) > 0) {
ret += spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Restore mark\n");
ret = -1;
}
#endif
return ret;
}
......@@ -331,7 +244,6 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP)
char *sgw_ipv4_address_for_S11 = NULL;
char *sgw_drop_uplink_s1u_traffic = NULL;
char *sgw_drop_downlink_s1u_traffic = NULL;
libconfig_int sgw_interface_mtu_for_S1u_S12_S4_up = 1500;
libconfig_int sgw_udp_port_for_S1u_S12_S4_up = 2152;
config_setting_t *setting_pgw = NULL;
......@@ -364,9 +276,6 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP)
pgw_lite_conf_ipv4_list_elm_t *ip4_ref = NULL;
pgw_lite_conf_ipv6_list_elm_t *ip6_ref = NULL;
char system_cmd[256];
#if defined (ENABLE_USE_GTPU_IN_KERNEL)
int tun_id = 21;
#endif
memset((char*)config_pP, 0 , sizeof(spgw_config_t));
STAILQ_INIT(&config_pP->pgw_config.pgw_lite_ipv4_pool_list);
......@@ -446,16 +355,6 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP)
config_pP->sgw_config.ipv4.sgw_interface_name_for_S11);
}
// optional
if(config_setting_lookup_int(
subsetting,
SGW_CONFIG_STRING_SGW_INTERFACE_MTU_FOR_S1U_S12_S4_UP,
&sgw_interface_mtu_for_S1u_S12_S4_up)
) {
config_pP->sgw_config.sgw_interface_mtu_for_S1u_S12_S4_up = sgw_interface_mtu_for_S1u_S12_S4_up;
} else {
config_pP->sgw_config.sgw_interface_mtu_for_S1u_S12_S4_up = sgw_interface_mtu_for_S1u_S12_S4_up;
}
if(config_setting_lookup_int(
subsetting,
......@@ -577,25 +476,26 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP)
memcpy (&addr_start, buf_in_addr, sizeof(struct in_addr));
// valid address
atoken2 = strtok(NULL, PGW_CONFIG_STRING_IPV4_PREFIX_DELIMITER);
prefix_mask = atoi(atoken2);
#if defined (ENABLE_USE_GTPU_IN_KERNEL)
in_addr_var.s_addr = config_pP->sgw_config.ipv4.sgw_ipv4_address_for_S1u_S12_S4_up;
// if (snprintf(system_cmd, 128, "ip route add %s/%s via %s dev %s",
// astring,
// atoken2,
// inet_ntoa(in_addr_var),
// config_pP->sgw_config.ipv4.sgw_interface_name_for_S1u_S12_S4_up) > 0) {
if (snprintf(system_cmd, 128, "ip route add %s/%s dev %s",
astring,
atoken2,
config_pP->sgw_config.ipv4.sgw_interface_name_for_S1u_S12_S4_up) > 0) {
spgw_system(system_cmd, SPGW_WARN_ON_ERROR, __FILE__, __LINE__);
if (snprintf(system_cmd, 256,
"iptables -I PREROUTING -t mangle -i %s -d %s/%s ! --protocol sctp -j CONNMARK --restore-mark",
config_pP->pgw_config.ipv4.pgw_interface_name_for_SGI, astring, atoken2) > 0) {
spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Add route: for %s\n", astring);
SPGW_APP_ERROR("Restore mark\n");
}
if (snprintf(system_cmd, 256,
"iptables -I OUTPUT -t mangle -m mark -s %s/%s ! --mark 0 -j CONNMARK --save-mark",
astring, atoken2) > 0) {
spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
SPGW_APP_ERROR("Save mark\n");
}
#endif
prefix_mask = atoi(atoken2);
if ((prefix_mask >= 2)&&(prefix_mask < 32)) {
memcpy (&addr_start, buf_in_addr, sizeof(struct in_addr));
......
......@@ -47,7 +47,6 @@
#define SGW_CONFIG_STRING_SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP "SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP"
#define SGW_CONFIG_STRING_SGW_PORT_FOR_S1U_S12_S4_UP "SGW_IPV4_PORT_FOR_S1U_S12_S4_UP"
#define SGW_CONFIG_STRING_SGW_INTERFACE_NAME_FOR_S5_S8_UP "SGW_INTERFACE_NAME_FOR_S5_S8_UP"
#define SGW_CONFIG_STRING_SGW_INTERFACE_MTU_FOR_S1U_S12_S4_UP "SGW_INTERFACE_MTU_FOR_S1U_S12_S4_UP"
#define SGW_CONFIG_STRING_SGW_IPV4_ADDRESS_FOR_S5_S8_UP "SGW_IPV4_ADDRESS_FOR_S5_S8_UP"
#define SGW_CONFIG_STRING_SGW_INTERFACE_NAME_FOR_S11 "SGW_INTERFACE_NAME_FOR_S11"
#define SGW_CONFIG_STRING_SGW_IPV4_ADDRESS_FOR_S11 "SGW_IPV4_ADDRESS_FOR_S11"
......@@ -95,7 +94,6 @@ typedef struct sgw_config_s {
uint32_t sgw_ipv4_address_for_S11;
int sgw_ip_netmask_for_S11;
} ipv4;
int sgw_interface_mtu_for_S1u_S12_S4_up;
int sgw_udp_port_for_S1u_S12_S4_up;
uint8_t sgw_drop_uplink_traffic;
......
......@@ -148,12 +148,12 @@ int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB)
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
if ((phy_vars_eNB->dlsch_eNB[i]==NULL) || (phy_vars_eNB->ulsch_eNB[i]==NULL)) {
MSC_LOG_EVENT(MSC_PHY_ENB, "Failed add ue %"PRIx16" (ENOMEM)", rnti);
MSC_LOG_EVENT(MSC_PHY_ENB, "0 Failed add ue %"PRIx16" (ENOMEM)", rnti);
LOG_E(PHY,"Can't add UE, not enough memory allocated\n");
return(-1);
} else {
if (phy_vars_eNB->eNB_UE_stats[i].crnti==0) {
MSC_LOG_EVENT(MSC_PHY_ENB, "Add ue %"PRIx16" ", rnti);
MSC_LOG_EVENT(MSC_PHY_ENB, "0 Add ue %"PRIx16" ", rnti);
LOG_I(PHY,"UE_id %d associated with rnti %x\n",i, rnti);
phy_vars_eNB->dlsch_eNB[i][0]->rnti = rnti;
phy_vars_eNB->ulsch_eNB[i]->rnti = rnti;
......@@ -176,12 +176,12 @@ int32_t remove_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB, uint8_t abstraction
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
if ((phy_vars_eNB->dlsch_eNB[i]==NULL) || (phy_vars_eNB->ulsch_eNB[i]==NULL)) {
MSC_LOG_EVENT(MSC_PHY_ENB, "Failed remove ue %"PRIx16" (ENOMEM)", rnti);
MSC_LOG_EVENT(MSC_PHY_ENB, "0 Failed remove ue %"PRIx16" (ENOMEM)", rnti);
LOG_E(PHY,"Can't remove UE, not enough memory allocated\n");
return(-1);
} else {
if (phy_vars_eNB->eNB_UE_stats[i].crnti==rnti) {
MSC_LOG_EVENT(MSC_PHY_ENB, "Removed ue %"PRIx16" ", rnti);
MSC_LOG_EVENT(MSC_PHY_ENB, "0 Removed ue %"PRIx16" ", rnti);
//msg("[PHY] UE_id %d\n",i);
clean_eNb_dlsch(phy_vars_eNB->dlsch_eNB[i][0], abstraction_flag);
clean_eNb_ulsch(phy_vars_eNB->ulsch_eNB[i],abstraction_flag);
......@@ -193,7 +193,7 @@ int32_t remove_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB, uint8_t abstraction
}
}
MSC_LOG_EVENT(MSC_PHY_ENB, "Failed remove ue %"PRIx16" (not found)", rnti);
MSC_LOG_EVENT(MSC_PHY_ENB, "0 Failed remove ue %"PRIx16" (not found)", rnti);
return(-1);
}
......@@ -2788,7 +2788,7 @@ void process_HARQ_feedback(uint8_t UE_id,
LOG_W(PHY,"[eNB %d][PDSCH %x/%d] DLSCH retransmissions exhausted, dropping packet\n",phy_vars_eNB->Mod_id,
dlsch->rnti,dl_harq_pid[m]);
#endif
MSC_LOG_EVENT(MSC_PHY_ENB, "HARQ DLSCH Failed RNTI %"PRIx16" round %u",
MSC_LOG_EVENT(MSC_PHY_ENB, "0 HARQ DLSCH Failed RNTI %"PRIx16" round %u",
dlsch->rnti,
dlsch_harq_proc->round);
......@@ -3094,7 +3094,7 @@ void prach_procedures(PHY_VARS_eNB *phy_vars_eNB,uint8_t sched_subframe,uint8_t
0,subframe,0);
#endif
} else {
MSC_LOG_EVENT(MSC_PHY_ENB, "RA Failed add user, too many");
MSC_LOG_EVENT(MSC_PHY_ENB, "0 RA Failed add user, too many");
LOG_I(PHY,"[eNB %d][RAPROC] frame %d, subframe %d: Unable to add user, max user count reached\n",
phy_vars_eNB->Mod_id,frame, subframe);
}
......
......@@ -145,6 +145,13 @@
#define ENB_CONFIG_STRING_UETIMERS_N310 "ue_TimersAndConstants_n310"
#define ENB_CONFIG_STRING_UETIMERS_N311 "ue_TimersAndConstants_n311"
#define ENB_CONFIG_STRING_SRB1 "srb1_parameters"
#define ENB_CONFIG_STRING_SRB1_TIMER_POLL_RETRANSMIT "timer_poll_retransmit"
#define ENB_CONFIG_STRING_SRB1_TIMER_REORDERING "timer_reordering"
#define ENB_CONFIG_STRING_SRB1_TIMER_STATUS_PROHIBIT "timer_status_prohibit"
#define ENB_CONFIG_STRING_SRB1_POLL_PDU "poll_pdu"
#define ENB_CONFIG_STRING_SRB1_POLL_BYTE "poll_byte"
#define ENB_CONFIG_STRING_SRB1_MAX_RETX_THRESHOLD "max_retx_threshold"
#define ENB_CONFIG_STRING_MME_IP_ADDRESS "mme_ip_address"
#define ENB_CONFIG_STRING_MME_IPV4_ADDRESS "ipv4"
#define ENB_CONFIG_STRING_MME_IPV6_ADDRESS "ipv6"
......@@ -239,7 +246,7 @@ static const eutra_band_t eutra_bands[] = {
{44, 703 * MHz, 803 * MHz, 703 * MHz, 803 * MHz, TDD},
};
static Enb_properties_array_t enb_properties;
Enb_properties_array_t enb_properties;
static void enb_config_display(void)
{
......@@ -440,6 +447,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
config_setting_t *subsetting = NULL;
config_setting_t *setting_component_carriers = NULL;
config_setting_t *component_carrier = NULL;
config_setting_t *setting_srb1 = NULL;
config_setting_t *setting_mme_addresses = NULL;
config_setting_t *setting_mme_address = NULL;
config_setting_t *setting_enb = NULL;
......@@ -535,6 +543,12 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
libconfig_int ue_TimersAndConstants_n311 = 0;
libconfig_int srb1_timer_poll_retransmit = 0;
libconfig_int srb1_timer_reordering = 0;
libconfig_int srb1_timer_status_prohibit = 0;
libconfig_int srb1_poll_pdu = 0;
libconfig_int srb1_poll_byte = 0;
libconfig_int srb1_max_retx_threshold = 0;
char* ipv4 = NULL;
char* ipv6 = NULL;
......@@ -1761,6 +1775,142 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
}
}
setting_srb1 = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_SRB1);
if (setting_srb1 != NULL) {
if (!(config_setting_lookup_int(setting_srb1, ENB_CONFIG_STRING_SRB1_TIMER_POLL_RETRANSMIT, &srb1_timer_poll_retransmit)
&& config_setting_lookup_int(setting_srb1, ENB_CONFIG_STRING_SRB1_TIMER_REORDERING, &srb1_timer_reordering)
&& config_setting_lookup_int(setting_srb1, ENB_CONFIG_STRING_SRB1_TIMER_STATUS_PROHIBIT, &srb1_timer_status_prohibit)
&& config_setting_lookup_int(setting_srb1, ENB_CONFIG_STRING_SRB1_MAX_RETX_THRESHOLD, &srb1_max_retx_threshold)
&& config_setting_lookup_int(setting_srb1, ENB_CONFIG_STRING_SRB1_POLL_PDU, &srb1_poll_pdu)
&& config_setting_lookup_int(setting_srb1, ENB_CONFIG_STRING_SRB1_POLL_BYTE, &srb1_poll_byte)))
AssertError (0, parse_errors ++,
"Failed to parse eNB configuration file %s, enb %d timer_poll_retransmit, timer_reordering, ",
"timer_status_prohibit, poll_pdu, poll_byte, max_retx_threshold !\n",
lib_config_file_name_pP, i);
switch (srb1_max_retx_threshold) {
case 1: enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t1;break;
case 2: enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t2;break;
case 3: enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t3;break;
case 4: enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t4;break;
case 6: enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t6;break;
case 8: enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t8;break;
case 16: enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t16;break;
case 32: enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t32;break;
default:
AssertError (0, parse_errors ++,
"Bad config value when parsing eNB configuration file %s, enb %d srb1_max_retx_threshold %u!\n",
lib_config_file_name_pP, i, srb1_max_retx_threshold);
}
switch (srb1_poll_pdu) {
case 4: enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p4;break;
case 8: enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p8;break;
case 16: enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p16;break;
case 32: enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p32;break;
case 64: enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p64;break;
case 128: enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p128;break;
case 256: enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p256;break;
default:
if (srb1_poll_pdu >= 10000)
enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_pInfinity;
else
AssertError (0, parse_errors ++,
"Bad config value when parsing eNB configuration file %s, enb %d srb1_poll_pdu %u!\n",
lib_config_file_name_pP, i, srb1_poll_pdu);
}
enb_properties.properties[enb_properties_index]->srb1_poll_byte = srb1_poll_byte;
switch (srb1_poll_byte) {
case 25: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB25;break;
case 50: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB50;break;
case 75: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB75;break;
case 100: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB100;break;
case 125: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB125;break;
case 250: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB250;break;
case 375: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB375;break;
case 500: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB500;break;
case 750: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB750;break;
case 1000: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB1000;break;
case 1250: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB1250;break;
case 1500: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB1500;break;
case 2000: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB2000;break;
case 3000: enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kB3000;break;
default:
if (srb1_poll_byte >= 10000)
enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kBinfinity;
else
AssertError (0, parse_errors ++,
"Bad config value when parsing eNB configuration file %s, enb %d srb1_poll_byte %u!\n",
lib_config_file_name_pP, i, srb1_poll_byte);
}
if (srb1_timer_poll_retransmit <= 250) {
enb_properties.properties[enb_properties_index]->srb1_timer_poll_retransmit = (srb1_timer_poll_retransmit - 5)/5;
} else if (srb1_timer_poll_retransmit <= 500) {
enb_properties.properties[enb_properties_index]->srb1_timer_poll_retransmit = (srb1_timer_poll_retransmit - 300)/50 + 50;
} else {
AssertError (0, parse_errors ++,
"Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_poll_retransmit %u!\n",
lib_config_file_name_pP, i, srb1_timer_poll_retransmit);
}
if (srb1_timer_status_prohibit <= 250) {
enb_properties.properties[enb_properties_index]->srb1_timer_status_prohibit = srb1_timer_status_prohibit/5;
} else if ((srb1_timer_poll_retransmit >= 300) && (srb1_timer_poll_retransmit <= 500)) {
enb_properties.properties[enb_properties_index]->srb1_timer_status_prohibit = (srb1_timer_status_prohibit - 300)/50 + 51;
} else {
AssertError (0, parse_errors ++,
"Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_status_prohibit %u!\n",
lib_config_file_name_pP, i, srb1_timer_status_prohibit);
}
switch (srb1_timer_reordering) {
case 0: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms0; break;
case 5: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms5; break;
case 10: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms10; break;
case 15: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms15; break;
case 20: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms20; break;
case 25: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms25; break;
case 30: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms30; break;
case 35: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms35; break;
case 40: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms40; break;
case 45: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms45; break;
case 50: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms50; break;
case 55: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms55; break;
case 60: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms60; break;
case 65: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms65; break;
case 70: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms70; break;
case 75: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms75; break;
case 80: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms80; break;
case 85: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms85; break;
case 90: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms90; break;
case 95: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms95; break;
case 100: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms100; break;
case 110: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms110; break;
case 120: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms120; break;
case 130: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms130; break;
case 140: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms140; break;
case 150: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms150; break;
case 160: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms160; break;
case 170: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms170; break;
case 180: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms180; break;
case 190: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms190; break;
case 200: enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms200; break;
default:
AssertError (0, parse_errors ++,
"Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_reordering %u!\n",
lib_config_file_name_pP, i, srb1_timer_reordering);
}
} else {
enb_properties.properties[enb_properties_index]->srb1_timer_poll_retransmit = T_PollRetransmit_ms80;
enb_properties.properties[enb_properties_index]->srb1_timer_reordering = T_Reordering_ms35;
enb_properties.properties[enb_properties_index]->srb1_timer_status_prohibit = T_StatusProhibit_ms0;
enb_properties.properties[enb_properties_index]->srb1_poll_pdu = PollPDU_p4;
enb_properties.properties[enb_properties_index]->srb1_poll_byte = PollByte_kBinfinity;
enb_properties.properties[enb_properties_index]->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t8;
}
setting_mme_addresses = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_MME_IP_ADDRESS);
num_mme_address = config_setting_length(setting_mme_addresses);
enb_properties.properties[enb_properties_index]->nb_mme = 0;
......
......@@ -176,6 +176,12 @@ typedef struct Enb_properties_s {
long ue_TimersAndConstants_n311[1+MAX_NUM_CCs];
long srb1_timer_poll_retransmit;
long srb1_timer_reordering;
long srb1_timer_status_prohibit;
long srb1_poll_pdu;
long srb1_poll_byte;
long srb1_max_retx_threshold;
/* Nb of MME to connect to */
uint8_t nb_mme;
/* List of MME to connect to */
......
......@@ -629,6 +629,13 @@ pdcp_data_ind(
#endif
//rrc_lite_data_ind(module_id, //Modified MW - L2 Interface
MSC_LOG_TX_MESSAGE(
(ctxt_pP->enb_flag == ENB_FLAG_NO)? MSC_PDCP_UE:MSC_PDCP_ENB,
(ctxt_pP->enb_flag == ENB_FLAG_NO)? MSC_RRC_UE:MSC_RRC_ENB,
NULL,0,
PROTOCOL_PDCP_CTXT_FMT" DATA-IND len %u",
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p),
sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len);
pdcp_rrc_data_ind(ctxt_pP,
rb_id,
sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len,
......@@ -753,6 +760,14 @@ pdcp_data_ind(
#if defined(LINK_ENB_PDCP_TO_GTPV1U)
if ((TRUE == ctxt_pP->enb_flag) && (FALSE == srb_flagP)) {
MSC_LOG_TX_MESSAGE(
MSC_PDCP_ENB,
MSC_GTPU_ENB,
NULL,0,
"0 GTPV1U_ENB_TUNNEL_DATA_REQ ue %x rab %u len %u",
ctxt_pP->rnti,
rb_id + 4,
sdu_buffer_sizeP - payload_offset);
//LOG_T(PDCP,"Sending to GTPV1U %d bytes\n", sdu_buffer_sizeP - payload_offset);
gtpu_buffer_p = itti_malloc(TASK_PDCP_ENB, TASK_GTPV1_U,
sdu_buffer_sizeP - payload_offset + GTPU_HEADER_OVERHEAD_MAX);
......@@ -1564,14 +1579,14 @@ pdcp_config_set_security(
pdcp_pP->security_activated = 1;
MSC_LOG_EVENT(
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
" Set security ciph %X integ %x UE %"PRIx16" ",
"0 Set security ciph %X integ %x UE %"PRIx16" ",
pdcp_pP->cipheringAlgorithm,
pdcp_pP->integrityProtAlgorithm,
ctxt_pP->rnti);
} else {
MSC_LOG_EVENT(
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
" Set security failed UE %"PRIx16" ",
"0 Set security failed UE %"PRIx16" ",
ctxt_pP->rnti);
LOG_E(PDCP,PROTOCOL_PDCP_CTXT_FMT" bad security mode %d",
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_pP),
......
......@@ -104,13 +104,13 @@
if (pmtl_rc != 0){\
if (pmtl_rc == EBUSY) {\
MSC_LOG_EVENT((cTXT->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\
PROTOCOL_RLC_AM_MSC_FMT" Warning try lock %s busy",\
"0 "PROTOCOL_RLC_AM_MSC_FMT" Warning try lock %s busy",\
PROTOCOL_RLC_AM_MSC_ARGS(cTXT,rLC),\
#mUTEX);\
pthread_mutex_lock(mUTEX);\
} else {\
MSC_LOG_EVENT((cTXT->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\
PROTOCOL_RLC_AM_MSC_FMT" Error try lock %s %d",\
"0 "PROTOCOL_RLC_AM_MSC_FMT" Error try lock %s %d",\
PROTOCOL_RLC_AM_MSC_ARGS(cTXT,rLC),\
#mUTEX, pmtl_rc);\
}\
......
......@@ -94,13 +94,13 @@
if (pmtl_rc != 0){\
if (pmtl_rc == EBUSY) {\
MSC_LOG_EVENT((cTXT->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\
PROTOCOL_RLC_UM_MSC_FMT" Warning try lock %s busy",\
"0 "PROTOCOL_RLC_UM_MSC_FMT" Warning try lock %s busy",\
PROTOCOL_RLC_UM_MSC_ARGS(cTXT,rLC),\
#mUTEX);\
pthread_mutex_lock(mUTEX);\
} else {\
MSC_LOG_EVENT((cTXT->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\
PROTOCOL_RLC_UM_MSC_FMT" Error try lock %s %d",\
"0 "PROTOCOL_RLC_UM_MSC_FMT" Error try lock %s %d",\
PROTOCOL_RLC_UM_MSC_ARGS(cTXT,rLC),\
#mUTEX, pmtl_rc);\
}\
......
......@@ -89,6 +89,7 @@
#include "MeasObjectToAddModList.h"
#include "ReportConfigToAddModList.h"
#include "MeasIdToAddModList.h"
#include "enb_config.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
......@@ -108,6 +109,7 @@ int errno;
//#define XER_PRINT
extern Enb_properties_array_t enb_properties;
typedef struct xer_sprint_string_s {
char *string;
size_t string_size;
......@@ -1433,12 +1435,12 @@ do_RRCConnectionSetup(
SRB1_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue;
SRB1_rlc_config->choice.explicitValue.present=RLC_Config_PR_am;
SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms80;
SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p4;
SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity;
SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8;
SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35;
SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms0;
SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = enb_properties.properties[ctxt_pP->module_id]->srb1_timer_poll_retransmit;
SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = enb_properties.properties[ctxt_pP->module_id]->srb1_poll_pdu;
SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = enb_properties.properties[ctxt_pP->module_id]->srb1_poll_byte;
SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = enb_properties.properties[ctxt_pP->module_id]->srb1_max_retx_threshold;
SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = enb_properties.properties[ctxt_pP->module_id]->srb1_timer_reordering;
SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = enb_properties.properties[ctxt_pP->module_id]->srb1_timer_status_prohibit;
SRB1_lchan_config = CALLOC(1,sizeof(*SRB1_lchan_config));
SRB1_config->logicalChannelConfig = SRB1_lchan_config;
......
......@@ -186,7 +186,7 @@ void rrc_eNB_remove_ue_context(
MSC_LOG_EVENT(
MSC_RRC_ENB,
"Removed UE %x",
"0 Removed UE %"PRIx16" ",
ue_context_pP->ue_context.rnti);
rrc_eNB_free_mem_UE_context(ctxt_pP, ue_context_pP);
......
......@@ -103,6 +103,27 @@ eNBs =
}
);
srb1_parameters :
{
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
timer_poll_retransmit = 80;
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
timer_reordering = 35;
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
timer_status_prohibit = 0;
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
poll_pdu = 4;
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
poll_byte = 99999;
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
max_retx_threshold = 4;
}
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.13.11";
ipv6 = "192:168:30::17";
......
......@@ -103,6 +103,26 @@ eNBs =
}
);
srb1_parameters :
{
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
timer_poll_retransmit = 80;
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
timer_reordering = 35;
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
timer_status_prohibit = 0;
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
poll_pdu = 4;
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
poll_byte = 99999;
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
max_retx_threshold = 4;
}
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.188.2.2";
ipv6 = "192:168:30::17";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment