Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canghaiwuhen
OpenXG-RAN
Commits
9de74478
Commit
9de74478
authored
Dec 04, 2014
by
Lionel Gauthier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git-svn-id:
http://svn.eurecom.fr/openair4G/trunk@6155
818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent
ca95fb79
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
43 deletions
+52
-43
openair-cn/SGW-LITE/sgw_lite_task.c
openair-cn/SGW-LITE/sgw_lite_task.c
+27
-1
openair-cn/SGW-LITE/spgw_config.c
openair-cn/SGW-LITE/spgw_config.c
+24
-42
openair-cn/SGW-LITE/spgw_config.h
openair-cn/SGW-LITE/spgw_config.h
+1
-0
No files found.
openair-cn/SGW-LITE/sgw_lite_task.c
View file @
9de74478
...
@@ -122,8 +122,34 @@ static void *sgw_lite_intertask_interface(void *args_p)
...
@@ -122,8 +122,34 @@ static void *sgw_lite_intertask_interface(void *args_p)
int
sgw_lite_init
(
char
*
config_file_name_pP
)
int
sgw_lite_init
(
char
*
config_file_name_pP
)
{
{
SPGW_APP_DEBUG
(
"Initializing SPGW-APP task interface
\n
"
);
SPGW_APP_DEBUG
(
"Initializing SPGW-APP task interface
\n
"
);
#if defined (ENABLE_USE_GTPU_IN_KERNEL)
spgw_system
(
"rmmod iptable_raw > /dev/null 2>&1"
,
0
);
spgw_system
(
"rmmod iptable_mangle > /dev/null 2>&1"
,
0
);
spgw_system
(
"rmmod iptable_nat > /dev/null 2>&1"
,
0
);
spgw_system
(
"rmmod iptable_filter > /dev/null 2>&1"
,
0
);
spgw_system
(
"rmmod ip_tables > /dev/null 2>&1"
,
0
);
spgw_system
(
"rmmod xt_state xt_mark xt_GTPUAH xt_GTPURH xt_tcpudp xt_connmark ipt_LOG ipt_MASQUERADE > /dev/null 2>&1"
,
0
);
spgw_system
(
"rmmod x_tables > /dev/null 2>&1"
,
0
);
spgw_system
(
"rmmod nf_conntrack_netlink nfnetlink nf_nat nf_conntrack_ipv4 nf_conntrack > /dev/null 2>&1"
,
0
);
spgw_system
(
"modprobe ip_tables"
,
1
);
spgw_system
(
"modprobe x_tables"
,
1
);
spgw_system
(
"iptables -P INPUT ACCEPT"
,
0
);
spgw_system
(
"iptables -F INPUT"
,
0
);
spgw_system
(
"iptables -P OUTPUT ACCEPT"
,
0
);
spgw_system
(
"iptables -F OUTPUT"
,
0
);
spgw_system
(
"iptables -P FORWARD ACCEPT"
,
0
);
spgw_system
(
"iptables -F FORWARD"
,
0
);
spgw_system
(
"iptables -t nat -F"
,
0
);
spgw_system
(
"iptables -t mangle -F"
,
0
);
spgw_system
(
"iptables -t filter -F"
,
0
);
spgw_system
(
"iptables -t raw -F"
,
0
);
spgw_system
(
"ip route flush cache"
,
0
);
spgw_system
(
"sysctl -w net.ipv4.netfilter.ip_conntrack_max=10000"
,
0
);
spgw_system
(
"sysctl -w net.ipv4.ip_forward=1"
,
0
);
spgw_system
(
"insmod $OPENAIRCN_DIR/GTPV1-U/GTPUAH/Bin/xt_GTPUAH.ko"
,
1
);
spgw_system
(
"insmod $OPENAIRCN_DIR/GTPV1-U/GTPURH/Bin/xt_GTPURH.ko"
,
1
);
#endif
spgw_config_init
(
config_file_name_pP
,
&
spgw_config
);
spgw_config_init
(
config_file_name_pP
,
&
spgw_config
);
pgw_lite_load_pool_ip_addresses
();
pgw_lite_load_pool_ip_addresses
();
sgw_app
.
s11teid2mme_hashtable
=
hashtable_create
(
8192
,
NULL
,
NULL
);
sgw_app
.
s11teid2mme_hashtable
=
hashtable_create
(
8192
,
NULL
,
NULL
);
...
...
openair-cn/SGW-LITE/spgw_config.c
View file @
9de74478
...
@@ -130,6 +130,20 @@ sgw_ipv6_mask_in6_addr(
...
@@ -130,6 +130,20 @@ sgw_ipv6_mask_in6_addr(
}
}
}
}
int
spgw_system
(
char
*
command_pP
,
int
abort_on_errorP
)
{
int
ret
=
0
;
ret
=
system
(
"command_pP"
);
if
(
ret
<
0
)
{
SPGW_APP_ERROR
(
"ERROR in system command %s: %d
\n
"
,
command_pP
,
ret
);
if
(
abort_on_errorP
)
{
exit
(
-
1
);
// may be not exit
}
}
return
ret
;
}
int
spgw_config_init
(
char
*
lib_config_file_name_pP
,
spgw_config_t
*
config_pP
)
{
int
spgw_config_init
(
char
*
lib_config_file_name_pP
,
spgw_config_t
*
config_pP
)
{
config_t
cfg
;
config_t
cfg
;
...
@@ -175,7 +189,6 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
...
@@ -175,7 +189,6 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
pgw_lite_conf_ipv6_list_elm_t
*
ip6_ref
=
NULL
;
pgw_lite_conf_ipv6_list_elm_t
*
ip6_ref
=
NULL
;
#if defined (ENABLE_USE_GTPU_IN_KERNEL)
#if defined (ENABLE_USE_GTPU_IN_KERNEL)
char
system_cmd
[
256
];
char
system_cmd
[
256
];
int
ret
;
#endif
#endif
memset
((
char
*
)
config_pP
,
0
,
sizeof
(
spgw_config_t
));
memset
((
char
*
)
config_pP
,
0
,
sizeof
(
spgw_config_t
));
...
@@ -224,11 +237,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
...
@@ -224,11 +237,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
free
(
cidr
);
free
(
cidr
);
#if defined (ENABLE_USE_GTPU_IN_KERNEL)
#if defined (ENABLE_USE_GTPU_IN_KERNEL)
ret
=
system
(
"echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects"
);
spgw_system
(
"echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects"
,
1
);
if
(
ret
<
0
)
{
SPGW_APP_ERROR
(
"ERROR in setting echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects: %d
\n
"
,
ret
);
}
#endif
#endif
in_addr_var
.
s_addr
=
config_pP
->
sgw_config
.
ipv4
.
sgw_ipv4_address_for_S1u_S12_S4_up
;
in_addr_var
.
s_addr
=
config_pP
->
sgw_config
.
ipv4
.
sgw_ipv4_address_for_S1u_S12_S4_up
;
SPGW_APP_INFO
(
"Parsing configuration file found sgw_ipv4_address_for_S1u_S12_S4_up: %s/%d on %s
\n
"
,
SPGW_APP_INFO
(
"Parsing configuration file found sgw_ipv4_address_for_S1u_S12_S4_up: %s/%d on %s
\n
"
,
...
@@ -275,10 +284,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
...
@@ -275,10 +284,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
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
,
config_pP
->
sgw_config
.
sgw_interface_mtu_for_S1u_S12_S4_up
)
>
0
)
{
config_pP
->
sgw_config
.
sgw_interface_mtu_for_S1u_S12_S4_up
)
>
0
)
{
SPGW_APP_INFO
(
"Set S1U interface MTU: %s
\n
"
,
system_cmd
);
SPGW_APP_INFO
(
"Set S1U interface MTU: %s
\n
"
,
system_cmd
);
ret
=
system
(
system_cmd
);
spgw_system
(
system_cmd
,
1
);
if
(
ret
<
0
)
{
SPGW_APP_ERROR
(
"ERROR in setting %s: %d
\n
"
,
system_cmd
,
ret
);
}
}
else
{
}
else
{
SPGW_APP_ERROR
(
"Set S1U interface MTU
\n
"
);
SPGW_APP_ERROR
(
"Set S1U interface MTU
\n
"
);
}
}
...
@@ -298,10 +304,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
...
@@ -298,10 +304,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
"iptables -t raw -I PREROUTING -i %s --protocol udp --destination-port 2152 -j DROP"
,
"iptables -t raw -I PREROUTING -i %s --protocol udp --destination-port 2152 -j DROP"
,
config_pP
->
sgw_config
.
ipv4
.
sgw_interface_name_for_S1u_S12_S4_up
)
>
0
)
{
config_pP
->
sgw_config
.
ipv4
.
sgw_interface_name_for_S1u_S12_S4_up
)
>
0
)
{
SPGW_APP_INFO
(
"Drop uplink traffic: %s
\n
"
,
system_cmd
);
SPGW_APP_INFO
(
"Drop uplink traffic: %s
\n
"
,
system_cmd
);
ret
=
system
(
system_cmd
);
spgw_system
(
system_cmd
,
1
);
if
(
ret
<
0
)
{
SPGW_APP_ERROR
(
"ERROR in setting %s: %d
\n
"
,
system_cmd
,
ret
);
}
}
else
{
}
else
{
SPGW_APP_ERROR
(
"Drop uplink traffic
\n
"
);
SPGW_APP_ERROR
(
"Drop uplink traffic
\n
"
);
}
}
...
@@ -371,10 +374,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
...
@@ -371,10 +374,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
"iptables -t nat -A POSTROUTING -o %s ! --protocol sctp -j MASQUERADE"
,
"iptables -t nat -A POSTROUTING -o %s ! --protocol sctp -j MASQUERADE"
,
config_pP
->
pgw_config
.
ipv4
.
pgw_interface_name_for_SGI
)
>
0
)
{
config_pP
->
pgw_config
.
ipv4
.
pgw_interface_name_for_SGI
)
>
0
)
{
SPGW_APP_INFO
(
"Masquerade SGI: %s
\n
"
,
system_cmd
);
SPGW_APP_INFO
(
"Masquerade SGI: %s
\n
"
,
system_cmd
);
ret
=
system
(
system_cmd
);
spgw_system
(
system_cmd
,
1
);
if
(
ret
<
0
)
{
SPGW_APP_ERROR
(
"ERROR in setting %s: %d
\n
"
,
system_cmd
,
ret
);
}
}
else
{
}
else
{
SPGW_APP_ERROR
(
"Masquerade SGI
\n
"
);
SPGW_APP_ERROR
(
"Masquerade SGI
\n
"
);
}
}
...
@@ -389,10 +389,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
...
@@ -389,10 +389,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
"iptables -I POSTROUTING -t mangle -o %s -m mark ! --mark 0 ! --protocol sctp -j CONNMARK --save-mark"
,
"iptables -I POSTROUTING -t mangle -o %s -m mark ! --mark 0 ! --protocol sctp -j CONNMARK --save-mark"
,
config_pP
->
pgw_config
.
ipv4
.
pgw_interface_name_for_SGI
)
>
0
)
{
config_pP
->
pgw_config
.
ipv4
.
pgw_interface_name_for_SGI
)
>
0
)
{
SPGW_APP_INFO
(
"Save mark: %s
\n
"
,
system_cmd
);
SPGW_APP_INFO
(
"Save mark: %s
\n
"
,
system_cmd
);
ret
=
system
(
system_cmd
);
spgw_system
(
system_cmd
,
1
);
if
(
ret
<
0
)
{
SPGW_APP_ERROR
(
"ERROR in setting %s: %d
\n
"
,
system_cmd
,
ret
);
}
}
else
{
}
else
{
SPGW_APP_ERROR
(
"Save mark
\n
"
);
SPGW_APP_ERROR
(
"Save mark
\n
"
);
}
}
...
@@ -400,10 +397,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
...
@@ -400,10 +397,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
"iptables -I PREROUTING -t mangle -i %s ! --protocol sctp -j CONNMARK --restore-mark"
,
"iptables -I PREROUTING -t mangle -i %s ! --protocol sctp -j CONNMARK --restore-mark"
,
config_pP
->
pgw_config
.
ipv4
.
pgw_interface_name_for_SGI
)
>
0
)
{
config_pP
->
pgw_config
.
ipv4
.
pgw_interface_name_for_SGI
)
>
0
)
{
SPGW_APP_INFO
(
"Restore mark: %s
\n
"
,
system_cmd
);
SPGW_APP_INFO
(
"Restore mark: %s
\n
"
,
system_cmd
);
ret
=
system
(
system_cmd
);
spgw_system
(
system_cmd
,
1
);
if
(
ret
<
0
)
{
SPGW_APP_ERROR
(
"ERROR in setting %s: %d
\n
"
,
system_cmd
,
ret
);
}
}
else
{
}
else
{
SPGW_APP_ERROR
(
"Restore mark
\n
"
);
SPGW_APP_ERROR
(
"Restore mark
\n
"
);
}
}
...
@@ -436,10 +430,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
...
@@ -436,10 +430,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
atoken2
,
atoken2
,
config_pP
->
sgw_config
.
ipv4
.
sgw_interface_name_for_S1u_S12_S4_up
)
>
0
)
{
config_pP
->
sgw_config
.
ipv4
.
sgw_interface_name_for_S1u_S12_S4_up
)
>
0
)
{
SPGW_APP_INFO
(
"Add route: %s
\n
"
,
system_cmd
);
SPGW_APP_INFO
(
"Add route: %s
\n
"
,
system_cmd
);
ret
=
system
(
system_cmd
);
spgw_system
(
system_cmd
,
1
);
if
(
ret
<
0
)
{
SPGW_APP_ERROR
(
"ERROR in setting %s: %d
\n
"
,
system_cmd
,
ret
);
}
}
else
{
}
else
{
SPGW_APP_ERROR
(
"Add route: for %s
\n
"
,
astring
);
SPGW_APP_ERROR
(
"Add route: for %s
\n
"
,
astring
);
}
}
...
@@ -449,10 +440,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
...
@@ -449,10 +440,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
"iptables -t filter -I FORWARD -d %s/%s -j DROP"
,
"iptables -t filter -I FORWARD -d %s/%s -j DROP"
,
astring
,
atoken2
)
>
0
)
{
astring
,
atoken2
)
>
0
)
{
SPGW_APP_INFO
(
"Drop downlink traffic: %s
\n
"
,
system_cmd
);
SPGW_APP_INFO
(
"Drop downlink traffic: %s
\n
"
,
system_cmd
);
ret
=
system
(
system_cmd
);
spgw_system
(
system_cmd
,
1
);
if
(
ret
<
0
)
{
SPGW_APP_ERROR
(
"ERROR in setting %s: %d
\n
"
,
system_cmd
,
ret
);
}
}
else
{
}
else
{
SPGW_APP_ERROR
(
"Drop downlink traffic
\n
"
);
SPGW_APP_ERROR
(
"Drop downlink traffic
\n
"
);
}
}
...
@@ -460,10 +448,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
...
@@ -460,10 +448,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
"iptables -t filter -I OUTPUT -d %s/%s -j DROP"
,
"iptables -t filter -I OUTPUT -d %s/%s -j DROP"
,
astring
,
atoken2
)
>
0
)
{
astring
,
atoken2
)
>
0
)
{
SPGW_APP_INFO
(
"Drop downlink traffic: %s
\n
"
,
system_cmd
);
SPGW_APP_INFO
(
"Drop downlink traffic: %s
\n
"
,
system_cmd
);
ret
=
system
(
system_cmd
);
spgw_system
(
system_cmd
,
1
);
if
(
ret
<
0
)
{
SPGW_APP_ERROR
(
"ERROR in setting %s: %d
\n
"
,
system_cmd
,
ret
);
}
}
else
{
}
else
{
SPGW_APP_ERROR
(
"Drop downlink traffic
\n
"
);
SPGW_APP_ERROR
(
"Drop downlink traffic
\n
"
);
}
}
...
@@ -507,10 +492,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
...
@@ -507,10 +492,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
buf_in_addr
,
buf_in_addr
,
config_pP
->
sgw_config
.
ipv4
.
sgw_interface_name_for_S1u_S12_S4_up
)
>
0
)
{
config_pP
->
sgw_config
.
ipv4
.
sgw_interface_name_for_S1u_S12_S4_up
)
>
0
)
{
SPGW_APP_INFO
(
"Add route: %s
\n
"
,
system_cmd
);
SPGW_APP_INFO
(
"Add route: %s
\n
"
,
system_cmd
);
ret
=
system
(
system_cmd
);
spgw_system
(
system_cmd
,
1
);
if
(
ret
<
0
)
{
SPGW_APP_ERROR
(
"ERROR in setting %s: %d
\n
"
,
system_cmd
,
ret
);
}
}
else
{
}
else
{
SPGW_APP_ERROR
(
"Add route: for %s
\n
"
,
buf_in_addr
);
SPGW_APP_ERROR
(
"Add route: for %s
\n
"
,
buf_in_addr
);
}
}
...
...
openair-cn/SGW-LITE/spgw_config.h
View file @
9de74478
...
@@ -146,6 +146,7 @@ typedef struct spgw_config_s {
...
@@ -146,6 +146,7 @@ typedef struct spgw_config_s {
extern
spgw_config_t
spgw_config
;
extern
spgw_config_t
spgw_config
;
#endif
#endif
int
spgw_system
(
char
*
command_pP
,
int
abort_on_errorP
);
int
spgw_config_init
(
char
*
lib_config_file_name_pP
,
spgw_config_t
*
config_pP
);
int
spgw_config_init
(
char
*
lib_config_file_name_pP
,
spgw_config_t
*
config_pP
);
#endif
/* ENB_CONFIG_H_ */
#endif
/* ENB_CONFIG_H_ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment