Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
opensand
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
7
Issues
7
List
Board
Labels
Milestones
External Wiki
External Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
opensand
opensand
Commits
a28db6e9
Commit
a28db6e9
authored
Feb 25, 2019
by
Francklin Simo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove lan_iface from BlockLanAdaptation
parent
4974c609
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
3 additions
and
103 deletions
+3
-103
Makefile.am
opensand-core/src/interfaces/tests/Makefile.am
+1
-0
BlockLanAdaptation.cpp
opensand-core/src/lan_adaptation/BlockLanAdaptation.cpp
+0
-84
BlockLanAdaptation.h
opensand-core/src/lan_adaptation/BlockLanAdaptation.h
+0
-17
Makefile.am
opensand-core/src/lan_adaptation/Makefile.am
+2
-2
No files found.
opensand-core/src/interfaces/tests/Makefile.am
View file @
a28db6e9
...
...
@@ -19,4 +19,5 @@ test_tap_CPPFLAGS = \
test_tap_LDFLAGS
=
test_tap_LDADD
=
\
$(top_builddir)
/src/lan_adaptation/libopensand_lan_adaptation.la
\
$(top_builddir)
/src/lan_adaptation/libopensand_bridge.la
\
-lpcap
opensand-core/src/lan_adaptation/BlockLanAdaptation.cpp
View file @
a28db6e9
...
...
@@ -38,11 +38,6 @@
#include "NetBurst.h"
#include "OpenSandFrames.h"
extern
"C"
{
#include "bridge_utils.h"
}
#include <cstdio>
#include <sys/ioctl.h>
#include <fcntl.h>
...
...
@@ -60,7 +55,6 @@ extern "C"
BlockLanAdaptation
::
BlockLanAdaptation
(
const
string
&
name
,
struct
la_specific
specific
)
:
Block
(
name
),
tuntap_iface
(
specific
.
tuntap_iface
),
lan_iface
(
specific
.
lan_iface
),
is_tap
(
false
)
{
}
...
...
@@ -70,10 +64,6 @@ BlockLanAdaptation::BlockLanAdaptation(const string &name, struct la_specific sp
*/
BlockLanAdaptation
::~
BlockLanAdaptation
()
{
if
(
this
->
is_tap
)
{
this
->
delFromBridge
();
}
}
bool
BlockLanAdaptation
::
Downward
::
onEvent
(
const
RtEvent
*
const
event
)
...
...
@@ -461,10 +451,6 @@ bool BlockLanAdaptation::allocTunTap(int &fd)
this
->
tuntap_iface
.
c_str
());
snprintf
(
ifr
.
ifr_name
,
IFNAMSIZ
,
this
->
tuntap_iface
.
c_str
());
ifr
.
ifr_flags
=
(
this
->
is_tap
?
IFF_TAP
:
IFF_TUN
);
if
(
this
->
is_tap
&&
!
this
->
addInBridge
())
{
return
false
;
}
err
=
ioctl
(
fd
,
TUNSETIFF
,
(
void
*
)
&
ifr
);
if
(
err
<
0
)
...
...
@@ -481,73 +467,3 @@ bool BlockLanAdaptation::allocTunTap(int &fd)
return
true
;
}
bool
BlockLanAdaptation
::
addInBridge
()
{
struct
ifreq
ifr_br
;
const
char
*
br
=
"opensand_br"
;
int
err
=
-
1
;
memset
(
&
ifr_br
,
0
,
sizeof
(
ifr_br
));
snprintf
(
ifr_br
.
ifr_name
,
IFNAMSIZ
,
"%s"
,
this
->
tuntap_iface
.
c_str
());
err
=
br_init
();
if
(
err
)
{
LOG
(
this
->
log_init
,
LEVEL_ERROR
,
"Failed to init bridge: %s
\n
"
,
strerror
(
errno
));
return
false
;
}
// remove interface if it is in bridge to avoid error when adding it
br_del_interface
(
br
,
this
->
lan_iface
.
c_str
());
err
=
br_add_interface
(
br
,
this
->
lan_iface
.
c_str
());
if
(
err
)
{
LOG
(
this
->
log_init
,
LEVEL_ERROR
,
"Failed to add %s interface in bridge: %s
\n
"
,
this
->
lan_iface
.
c_str
(),
strerror
(
errno
));
br_shutdown
();
return
false
;
}
br_shutdown
();
// wait for bridge to be ready
LOG
(
this
->
log_init
,
LEVEL_INFO
,
"Wait for bridge to be ready
\n
"
);
sleep
(
10
);
return
true
;
}
bool
BlockLanAdaptation
::
delFromBridge
()
{
struct
ifreq
ifr_br
;
const
char
*
br
=
"opensand_br"
;
int
err
=
-
1
;
memset
(
&
ifr_br
,
0
,
sizeof
(
ifr_br
));
snprintf
(
ifr_br
.
ifr_name
,
IFNAMSIZ
,
"%s"
,
br
);
err
=
br_init
();
if
(
err
)
{
LOG
(
this
->
log_init
,
LEVEL_ERROR
,
"Failed to init bridge: %s
\n
"
,
strerror
(
errno
));
return
false
;
}
err
=
br_del_interface
(
this
->
tuntap_iface
.
c_str
(),
this
->
lan_iface
.
c_str
());
if
(
err
)
{
LOG
(
this
->
log_init
,
LEVEL_ERROR
,
"Failed to remove %s interface from bridge: %s
\n
"
,
this
->
lan_iface
.
c_str
(),
strerror
(
errno
));
br_shutdown
();
return
false
;
}
br_shutdown
();
return
true
;
}
opensand-core/src/lan_adaptation/BlockLanAdaptation.h
View file @
a28db6e9
...
...
@@ -54,7 +54,6 @@ using std::string;
struct
la_specific
{
string
tuntap_iface
;
string
lan_iface
;
};
/**
...
...
@@ -197,8 +196,6 @@ class BlockLanAdaptation: public Block
/// The TUN/TAP interface name
string
tuntap_iface
;
/// The LAN interface name
string
lan_iface
;
/// whether we handle a TAP interface or a TUN interface
bool
is_tap
;
...
...
@@ -210,20 +207,6 @@ class BlockLanAdaptation: public Block
* @return true on success, false otherwise
*/
bool
allocTunTap
(
int
&
fd
);
/**
* @brief add LAN interface in bridge
*
* return true on success, false otherwise
*/
bool
addInBridge
();
/**
* @brief remove LAN interface from bridge
*
* return true on success, false otherwise
*/
bool
delFromBridge
();
};
#endif
opensand-core/src/lan_adaptation/Makefile.am
View file @
a28db6e9
...
...
@@ -23,8 +23,8 @@ libopensand_lan_adaptation_la_SOURCES = \
$(libopensand_lan_adaptation_la_cpp)
\
$(libopensand_lan_adaptation_la_h)
libopensand_lan_adaptation_la_LIBADD
=
\
libopensand_bridge.la
#
libopensand_lan_adaptation_la_LIBADD = \
#
libopensand_bridge.la
libopensand_lan_adaptation_la_CPPFLAGS
=
\
$(AM_CPPFLAGS)
\
...
...
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