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
spbro
OpenXG-RAN
Commits
3a99fb82
Commit
3a99fb82
authored
Jul 23, 2024
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set up 4G UE addr via nas_config()
parent
2e804f53
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
138 deletions
+9
-138
openair3/NAS/UE/ESM/esm_ebr_context.c
openair3/NAS/UE/ESM/esm_ebr_context.c
+9
-138
No files found.
openair3/NAS/UE/ESM/esm_ebr_context.c
View file @
3a99fb82
...
...
@@ -45,6 +45,7 @@ Description Defines functions used to handle EPS bearer contexts.
#include "esm_ebr.h"
#include "esm_ebr_context.h"
#include "openair2/RRC/NAS/nas_config.h"
#include "emm_sap.h"
#include "system.h"
...
...
@@ -194,15 +195,6 @@ int esm_ebr_context_create(
// LG ADD TEMP
{
char
*
tmp
=
NULL
;
char
ipv4_addr
[
INET_ADDRSTRLEN
];
//char ipv6_addr[INET6_ADDRSTRLEN];
int
netmask
=
32
;
char
broadcast
[
INET_ADDRSTRLEN
];
struct
in_addr
in_addr
;
char
command_line
[
500
];
int
res
=
-
1
;
switch
(
pdn
->
type
)
{
case
NET_PDN_TYPE_IPV4V6
:
...
...
@@ -210,135 +202,14 @@ int esm_ebr_context_create(
/* TODO? */
// etc
case
NET_PDN_TYPE_IPV4
:
// in_addr is in network byte order
in_addr
.
s_addr
=
pdn
->
ip_addr
[
0
]
<<
24
|
((
pdn
->
ip_addr
[
1
]
<<
16
)
&
0x00FF0000
)
|
((
pdn
->
ip_addr
[
2
]
<<
8
)
&
0x0000FF00
)
|
(
pdn
->
ip_addr
[
3
]
&
0x000000FF
);
in_addr
.
s_addr
=
htonl
(
in_addr
.
s_addr
);
tmp
=
inet_ntoa
(
in_addr
);
//AssertFatal(tmp ,
// "error in PDN IPv4 address %x",
// in_addr.s_addr);
strcpy
(
ipv4_addr
,
tmp
);
if
(
IN_CLASSA
(
ntohl
(
in_addr
.
s_addr
)))
{
netmask
=
8
;
in_addr
.
s_addr
=
pdn
->
ip_addr
[
0
]
<<
24
|
((
255
<<
16
)
&
0x00FF0000
)
|
((
255
<<
8
)
&
0x0000FF00
)
|
(
255
&
0x000000FF
);
in_addr
.
s_addr
=
htonl
(
in_addr
.
s_addr
);
tmp
=
inet_ntoa
(
in_addr
);
// AssertFatal(tmp ,
// "error in PDN IPv4 address %x",
// in_addr.s_addr);
strcpy
(
broadcast
,
tmp
);
}
else
if
(
IN_CLASSB
(
ntohl
(
in_addr
.
s_addr
)))
{
netmask
=
16
;
in_addr
.
s_addr
=
pdn
->
ip_addr
[
0
]
<<
24
|
((
pdn
->
ip_addr
[
1
]
<<
16
)
&
0x00FF0000
)
|
((
255
<<
8
)
&
0x0000FF00
)
|
(
255
&
0x000000FF
);
in_addr
.
s_addr
=
htonl
(
in_addr
.
s_addr
);
tmp
=
inet_ntoa
(
in_addr
);
// AssertFatal(tmp ,
// "error in PDN IPv4 address %x",
// in_addr.s_addr);
strcpy
(
broadcast
,
tmp
);
}
else
if
(
IN_CLASSC
(
ntohl
(
in_addr
.
s_addr
)))
{
netmask
=
24
;
in_addr
.
s_addr
=
pdn
->
ip_addr
[
0
]
<<
24
|
((
pdn
->
ip_addr
[
1
]
<<
16
)
&
0x00FF0000
)
|
((
pdn
->
ip_addr
[
2
]
<<
8
)
&
0x0000FF00
)
|
(
255
&
0x000000FF
);
in_addr
.
s_addr
=
htonl
(
in_addr
.
s_addr
);
tmp
=
inet_ntoa
(
in_addr
);
// AssertFatal(tmp ,
// "error in PDN IPv4 address %x",
// in_addr.s_addr);
strcpy
(
broadcast
,
tmp
);
}
else
{
netmask
=
32
;
strcpy
(
broadcast
,
ipv4_addr
);
}
LOG_D
(
NAS
,
"setting commandline string: "
"ip address add %s/%d broadcast %s dev %s%d && "
"ip link set %s%d up && "
"ip rule add from %s/32 table %d && "
"ip rule add to %s/32 table %d && "
"ip route add default dev %s%d table %d"
,
ipv4_addr
,
netmask
,
broadcast
,
UE_NAS_USE_TUN
?
"oaitun_ue"
:
"oip"
,
ueid
+
1
,
UE_NAS_USE_TUN
?
"oaitun_ue"
:
"oip"
,
ueid
+
1
,
ipv4_addr
,
ueid
+
10000
,
ipv4_addr
,
ueid
+
10000
,
UE_NAS_USE_TUN
?
"oaitun_ue"
:
"oip"
,
ueid
+
1
,
ueid
+
10000
);
if
(
!
get_softmodem_params
()
->
nsa
)
{
res
=
sprintf
(
command_line
,
"ip address add %s/%d broadcast %s dev %s%d && "
"ip link set %s%d up && "
"ip rule add from %s/32 table %d && "
"ip rule add to %s/32 table %d && "
"ip route add default dev %s%d table %d"
,
ipv4_addr
,
netmask
,
broadcast
,
UE_NAS_USE_TUN
?
"oaitun_ue"
:
"oip"
,
ueid
+
1
,
UE_NAS_USE_TUN
?
"oaitun_ue"
:
"oip"
,
ueid
+
1
,
ipv4_addr
,
ueid
+
10000
,
ipv4_addr
,
ueid
+
10000
,
UE_NAS_USE_TUN
?
"oaitun_ue"
:
"oip"
,
ueid
+
1
,
ueid
+
10000
);
if
(
res
<
0
)
{
LOG_TRACE
(
WARNING
,
"ESM-PROC - Failed to system command string"
);
}
/* Calling system() here disrupts UE's realtime processing in some cases.
* This may be because of the call to fork(), which, for some
* unidentified reason, interacts badly with other (realtime) threads.
* background_system() is a replacement mechanism relying on a
* background process that does the system() and reports result to
* the parent process (lte-softmodem, oaisim, ...). The background
* process is created very early in the life of the parent process.
* The processes interact through standard pipes. See
* common/utils/system.c for details.
*/
LOG_TRACE
(
INFO
,
"ESM-PROC - executing %s "
,
command_line
);
if
(
background_system
(
command_line
)
!=
0
)
{
LOG_TRACE
(
ERROR
,
"ESM-PROC - failed command '%s'"
,
command_line
);
}
}
else
if
(
get_softmodem_params
()
->
nsa
)
{
res
=
sprintf
(
command_line
,
"ip address add %s/%d broadcast %s dev %s%d && "
"ip link set %s%d up && "
"ip rule add from %s/32 table %d && "
"ip rule add to %s/32 table %d && "
"ip route add default dev %s%d table %d"
,
ipv4_addr
,
netmask
,
broadcast
,
UE_NAS_USE_TUN
?
"oaitun_nru"
:
"oip"
,
ueid
+
1
,
UE_NAS_USE_TUN
?
"oaitun_nru"
:
"oip"
,
ueid
+
1
,
ipv4_addr
,
ueid
+
10000
,
ipv4_addr
,
ueid
+
10000
,
UE_NAS_USE_TUN
?
"oaitun_nru"
:
"oip"
,
ueid
+
1
,
ueid
+
10000
);
if
(
res
<
0
)
{
LOG_TRACE
(
WARNING
,
"ESM-PROC - Failed to system command string"
);
}
LOG_D
(
NAS
,
"Sending NAS_OAI_TUN_NSA msg to LTE UE via itti
\n
"
);
MessageDef
*
msg_p
=
itti_alloc_new_message
(
TASK_NAS_UE
,
0
,
NAS_OAI_TUN_NSA
);
memcpy
(
NAS_OAI_TUN_NSA
(
msg_p
).
buffer
,
command_line
,
sizeof
(
NAS_OAI_TUN_NSA
(
msg_p
).
buffer
));
itti_send_msg_to_task
(
TASK_RRC_UE
,
0
,
msg_p
);
}
break
;
case
NET_PDN_TYPE_IPV4
:
{
char
ip
[
20
];
char
*
ip_addr
=
pdn
->
ip_addr
;
snprintf
(
ip
,
sizeof
(
ip
),
"%d.%d.%d.%d"
,
ip_addr
[
0
],
ip_addr
[
1
],
ip_addr
[
2
],
ip_addr
[
3
]);
const
char
*
ifn
=
get_softmodem_params
()
->
nsa
?
"oaitun_nru"
:
"oaitun_ue"
;
nas_config
(
1
,
ip
,
NULL
,
ifn
);
setup_ue_ipv4_route
(
1
,
ip
,
ifn
);
}
break
;
case
NET_PDN_TYPE_IPV6
:
break
;
...
...
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