Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
UERANSIM
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
Libraries
UERANSIM
Commits
4d79049a
Commit
4d79049a
authored
Mar 09, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UE TUN MTU decreased to 1400
parent
05f1c4fa
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
11 deletions
+13
-11
src/ue/app/task.cpp
src/ue/app/task.cpp
+1
-1
src/ue/tun/config.cpp
src/ue/tun/config.cpp
+7
-6
src/ue/tun/config.hpp
src/ue/tun/config.hpp
+1
-1
src/ue/tun/tun.cpp
src/ue/tun/tun.cpp
+2
-2
src/ue/tun/tun.hpp
src/ue/tun/tun.hpp
+1
-1
src/utils/constants.hpp
src/utils/constants.hpp
+1
-0
No files found.
src/ue/app/task.cpp
View file @
4d79049a
...
...
@@ -202,7 +202,7 @@ void UeAppTask::setupTunInterface(const PduSession *pduSession)
std
::
string
ipAddress
=
utils
::
OctetStringToIp
(
pduSession
->
pduAddress
->
pduAddressInformation
);
bool
r
=
tun
::
TunConfigure
(
allocatedName
,
ipAddress
,
m_base
->
config
->
configureRouting
,
error
);
bool
r
=
tun
::
TunConfigure
(
allocatedName
,
ipAddress
,
cons
::
TunMtu
,
m_base
->
config
->
configureRouting
,
error
);
if
(
!
r
||
error
.
length
()
>
0
)
{
m_logger
->
err
(
"TUN configuration failure [%s]"
,
error
.
c_str
());
...
...
src/ue/tun/config.cpp
View file @
4d79049a
...
...
@@ -109,7 +109,7 @@ static const char *NextInterfaceName(const std::string &prefix)
return
nullptr
;
}
static
void
TunSetIpAndUp
(
const
char
*
ifName
,
const
char
*
ipAddr
)
static
void
TunSetIpAndUp
(
const
char
*
ifName
,
const
char
*
ipAddr
,
int
mtu
)
{
ifreq
ifr
{};
memset
(
&
ifr
,
0
,
sizeof
(
struct
ifreq
));
...
...
@@ -133,14 +133,15 @@ static void TunSetIpAndUp(const char *ifName, const char *ipAddr)
memcpy
((((
char
*
)
&
ifr
+
offsetof
(
struct
ifreq
,
ifr_addr
))),
p
,
sizeof
(
struct
sockaddr
));
if
(
ioctl
(
sockFd
,
SIOCSIFADDR
,
&
ifr
)
<
0
)
{
throw
LibError
(
"ioctl(SIOCSIFADDR)"
,
errno
);
}
if
(
ioctl
(
sockFd
,
SIOCGIFFLAGS
,
&
ifr
)
<
0
)
throw
LibError
(
"ioctl(SIOCGIFFLAGS)"
,
errno
);
ifr
.
ifr_flags
|=
IFF_UP
|
IFF_RUNNING
;
ifr
.
ifr_mtu
=
mtu
;
if
(
ioctl
(
sockFd
,
SIOCSIFMTU
,
&
ifr
)
<
0
)
throw
LibError
(
"ioctl(SIOCSIFMTU)"
,
errno
);
ifr
.
ifr_flags
|=
IFF_UP
|
IFF_RUNNING
;
if
(
ioctl
(
sockFd
,
SIOCSIFFLAGS
,
&
ifr
)
<
0
)
throw
LibError
(
"ioctl(SIOCSIFFLAGS)"
,
errno
);
...
...
@@ -349,12 +350,12 @@ int AllocateTun(const char *ifPrefix, char **allocatedName)
return
fd
;
}
void
ConfigureTun
(
const
char
*
tunName
,
const
char
*
ipAddr
,
bool
configureRoute
)
void
ConfigureTun
(
const
char
*
tunName
,
const
char
*
ipAddr
,
int
mtu
,
bool
configureRoute
)
{
// acquire the configuration lock
const
std
::
lock_guard
<
std
::
mutex
>
lock
(
configMutex
);
TunSetIpAndUp
(
tunName
,
ipAddr
);
TunSetIpAndUp
(
tunName
,
ipAddr
,
mtu
);
if
(
configureRoute
)
{
std
::
string
table_name
=
ROUTING_TABLE_PREFIX
+
std
::
string
(
tunName
);
...
...
src/ue/tun/config.hpp
View file @
4d79049a
...
...
@@ -16,6 +16,6 @@ namespace nr::ue::tun
{
int
AllocateTun
(
const
char
*
ifPrefix
,
char
**
allocatedName
);
void
ConfigureTun
(
const
char
*
tunName
,
const
char
*
ipAddr
,
bool
configureRoute
);
void
ConfigureTun
(
const
char
*
tunName
,
const
char
*
ipAddr
,
int
mtu
,
bool
configureRoute
);
}
// namespace nr::ue::tun
src/ue/tun/tun.cpp
View file @
4d79049a
...
...
@@ -32,11 +32,11 @@ int TunAllocate(const char *namePrefix, std::string &allocatedName, std::string
return
fd
;
}
bool
TunConfigure
(
const
std
::
string
&
tunName
,
const
std
::
string
&
ipAddress
,
bool
configureRouting
,
std
::
string
&
error
)
bool
TunConfigure
(
const
std
::
string
&
tunName
,
const
std
::
string
&
ipAddress
,
int
mtu
,
bool
configureRouting
,
std
::
string
&
error
)
{
try
{
tun
::
ConfigureTun
(
tunName
.
c_str
(),
ipAddress
.
c_str
(),
configureRouting
);
tun
::
ConfigureTun
(
tunName
.
c_str
(),
ipAddress
.
c_str
(),
mtu
,
configureRouting
);
}
catch
(
const
LibError
&
e
)
{
...
...
src/ue/tun/tun.hpp
View file @
4d79049a
...
...
@@ -14,6 +14,6 @@ namespace nr::ue::tun
{
int
TunAllocate
(
const
char
*
namePrefix
,
std
::
string
&
allocatedName
,
std
::
string
&
error
);
bool
TunConfigure
(
const
std
::
string
&
tunName
,
const
std
::
string
&
ipAddress
,
bool
configureRouting
,
std
::
string
&
error
);
bool
TunConfigure
(
const
std
::
string
&
tunName
,
const
std
::
string
&
ipAddress
,
int
mtu
,
bool
configureRouting
,
std
::
string
&
error
);
}
// namespace nr::ue::tun
\ No newline at end of file
src/utils/constants.hpp
View file @
4d79049a
...
...
@@ -27,6 +27,7 @@ struct cons
// TUN interface
static
constexpr
const
char
*
TunNamePrefix
=
"uesimtun"
;
static
constexpr
const
int
TunMtu
=
1400
;
// Constraints
static
constexpr
const
int
MinNodeName
=
3
;
...
...
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