Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG UE
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
Michael Black
OpenXG UE
Commits
66aa870e
Commit
66aa870e
authored
Dec 15, 2014
by
Lionel Gauthier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git-svn-id:
http://svn.eurecom.fr/openair4G/trunk@6263
818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent
ed89de8f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
41 deletions
+15
-41
openair-cn/SGW-LITE/spgw_config.c
openair-cn/SGW-LITE/spgw_config.c
+15
-41
No files found.
openair-cn/SGW-LITE/spgw_config.c
View file @
66aa870e
...
...
@@ -154,7 +154,7 @@ int spgw_config_process(spgw_config_t* config_pP) {
if
(
strncasecmp
(
"tun"
,
config_pP
->
sgw_config
.
ipv4
.
sgw_interface_name_for_S1u_S12_S4_up
,
strlen
(
"tun"
))
==
0
)
{
if
(
snprintf
(
system_cmd
,
256
,
"ip link set %s down ;
openvpn --rmtun --dev %s
"
,
"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
)
{
...
...
@@ -164,8 +164,7 @@ int spgw_config_process(spgw_config_t* config_pP) {
ret
=
-
1
;
}
if
(
snprintf
(
system_cmd
,
256
,
"openvpn --mktun --dev %s;sync;ifconfig %s up;sync"
,
config_pP
->
sgw_config
.
ipv4
.
sgw_interface_name_for_S1u_S12_S4_up
,
"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
);
}
else
{
...
...
@@ -174,7 +173,7 @@ int spgw_config_process(spgw_config_t* config_pP) {
}
inaddr
.
s_addr
=
config_pP
->
sgw_config
.
ipv4
.
sgw_ipv4_address_for_S1u_S12_S4_up
;
if
(
snprintf
(
system_cmd
,
256
,
"ip -4 addr add %s/%d dev %s"
,
"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
)
{
...
...
@@ -183,6 +182,14 @@ int spgw_config_process(spgw_config_t* config_pP) {
SPGW_APP_ERROR
(
"Set IPv4 address on %s
\n
"
,
config_pP
->
sgw_config
.
ipv4
.
sgw_interface_name_for_S1u_S12_S4_up
);
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
);
}
else
{
SPGW_APP_ERROR
(
"ifconfig up %s
\n
"
,
config_pP
->
sgw_config
.
ipv4
.
sgw_interface_name_for_S1u_S12_S4_up
);
ret
=
-
1
;
}
if
(
snprintf
(
system_cmd
,
128
,
"iptables -t filter -I INPUT -i lo -d %s --protocol sctp -j DROP"
,
...
...
@@ -527,22 +534,6 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
#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
(
strncasecmp
(
"tun"
,
config_pP
->
sgw_config
.
ipv4
.
sgw_interface_name_for_S1u_S12_S4_up
,
strlen
(
"tun"
))
==
0
)
{
if
(
snprintf
(
system_cmd
,
256
,
"ip link set tun%d down ;openvpn --rmtun --dev tun%d"
,
tun_id
,
tun_id
)
>
0
)
{
spgw_system
(
system_cmd
,
SPGW_ABORT_ON_ERROR
);
}
else
{
SPGW_APP_ERROR
(
"Del tun%d
\n
"
,
tun_id
);
}
if
(
snprintf
(
system_cmd
,
256
,
"openvpn --mktun --dev tun%d;sync;ifconfig tun%d up;sync"
,
tun_id
,
tun_id
)
>
0
)
{
spgw_system
(
system_cmd
,
SPGW_ABORT_ON_ERROR
);
}
else
{
SPGW_APP_ERROR
(
"Create tun%d
\n
"
,
tun_id
);
}
}
else
{
if
(
snprintf
(
system_cmd
,
128
,
"ip route add %s/%s via %s dev %s"
,
astring
,
atoken2
,
...
...
@@ -552,7 +543,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
}
else
{
SPGW_APP_ERROR
(
"Add route: for %s
\n
"
,
astring
);
}
}
if
(
config_pP
->
sgw_config
.
sgw_drop_downlink_traffic
)
{
if
(
snprintf
(
system_cmd
,
128
,
...
...
@@ -573,23 +564,6 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP) {
#endif
prefix_mask
=
atoi
(
atoken2
);
if
((
prefix_mask
>=
2
)
&&
(
prefix_mask
<
32
))
{
#if defined (ENABLE_USE_GTPU_IN_KERNEL)
// TEST ONLY
if
(
strncasecmp
(
"tun"
,
config_pP
->
sgw_config
.
ipv4
.
sgw_interface_name_for_S1u_S12_S4_up
,
strlen
(
"tun"
))
==
0
)
{
memcpy
(
&
in_addr_var
,
buf_in_addr
,
sizeof
(
struct
in_addr
));
in_addr_var
.
s_addr
=
in_addr_var
.
s_addr
+
htonl
(
1
);
if
(
snprintf
(
system_cmd
,
256
,
"ip -4 addr add %s/%d dev tun%d"
,
inet_ntoa
(
in_addr_var
),
prefix_mask
,
tun_id
)
>
0
)
{
spgw_system
(
system_cmd
,
SPGW_ABORT_ON_ERROR
);
}
else
{
SPGW_APP_ERROR
(
"Set IPv4 address on tun%d
\n
"
,
tun_id
);
}
tun_id
+=
1
;
}
#endif
memcpy
(
&
addr_start
,
buf_in_addr
,
sizeof
(
struct
in_addr
));
memcpy
(
&
addr_mask
,
buf_in_addr
,
sizeof
(
struct
in_addr
));
...
...
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