Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Firmware-Developer
ffdd-bmxd
Commits
3cb23894
Verified
Commit
3cb23894
authored
Oct 26, 2019
by
Sven enniK
Browse files
remove trailing spaces
parent
365d4250
Changes
38
Expand all
Hide whitespace changes
Inline
Side-by-side
sources/CHANGELOG
View file @
3cb23894
...
...
@@ -24,24 +24,24 @@ Important changes should be listed in the following, most recent changes on top:
- decentral-openstreetmap-json-based map plugin from http://graciasensefils.net (GSF) folks
- add symbolic links from lib/bmx_*.so to lib/bmx_*/bmx_*.so.1 to
facilitate execution and debugging of local bmx libraries by
- add symbolic links from lib/bmx_*.so to lib/bmx_*/bmx_*.so.1 to
facilitate execution and debugging of local bmx libraries by
overwriting bmx plugin-library path. E.g.:
BMX_LIB_PATH=$(pwd)/lib ./bmxd -d3
- Antenna-diversity support for bmxd seems working but unfortunately there are few wireless drivers which support
my understanding of the typical antenna-diversity implementation. This is what I hoped (maybe I am wrong):
- The RX-antenna is detected on-the-fly on a per-packet basis by comparing
- Antenna-diversity support for bmxd seems working but unfortunately there are few wireless drivers which support
my understanding of the typical antenna-diversity implementation. This is what I hoped (maybe I am wrong):
- The RX-antenna is detected on-the-fly on a per-packet basis by comparing
the rcvd signal-strength via each antenna during reception of the phy-preamble.
- The TX-antenna is determined per MAC-address based on the last detected best RX-antenna for this MAC.
- Broadcast packets should be send round-robin like via each enabled TX-antenna (e.g. alternating via ant1 and ant2).
- Broadcast packets should be send round-robin like via each enabled TX-antenna (e.g. alternating via ant1 and ant2).
---------------------------------------------------------------------------------------------------
2009-08-10 - bmx_uci_config plugin for openWrt universial configuraton interface (UCI)
- plugin for dynamic interaction with uci http://downloads.openwrt.org/sources/uci-0.7.3.tar.gz
- to compile first install uci:
- to compile first install uci:
wget http://downloads.openwrt.org/sources/uci-0.7.3.tar.gz
tar xzvf uci-0.7.3.tar.gz; cd uci-0.7.3; make; sudo make install
- default configuration backend is: /etc/config/bmx
...
...
@@ -60,7 +60,7 @@ Important changes should be listed in the following, most recent changes on top:
--loop_mode / -l , make batch_mode default, -b deprecated, introduce -l for loop instead
--throw ( was --no-tunnel-rule )
--originators, --links, --hnas, --interfaces
--purge_timeout
--purge_timeout
--dad_timeout
--dev=ath0 and --dev=-ath0 (dynamically add and remove interfaces)
-X show BatMan-eXperimental help, short description and configurable values
...
...
@@ -106,11 +106,11 @@ Important changes should be listed in the following, most recent changes on top:
- data-structures
- scheduled functions
- ...
- support muting of selected debug messages
- new bit-array processing funtions
- new bit-array processing funtions
- remove usage of libpthread
...
...
sources/Makefile
View file @
3cb23894
...
...
@@ -77,14 +77,14 @@ LDFLAGS += -g3
# -static
# -pg
SRC_C
=
batman.c originator.c hna.c schedule.c plugin.c list-batman.c allocate.c avl.c profile.c control.c metrics.c posix/posix.c posix/tunnel.c linux/route.c
SRC_C
=
batman.c originator.c hna.c schedule.c plugin.c list-batman.c allocate.c avl.c profile.c control.c metrics.c posix/posix.c posix/tunnel.c linux/route.c
SRC_H
=
batman.h originator.h hna.h schedule.h plugin.h list-batman.h allocate.h avl.h profile.h control.h metrics.h vis-types.h os.h
OBJS
=
$(SRC_C:.c=.o)
SBINDIR
=
$(INSTALL_PREFIX)
/usr/sbin
BINARY_NAME
=
bmxd
all
:
all
:
$(MAKE)
$(BINARY_NAME)
# further make targets: help, libs, build_all, strip[_libs|_all], install[_libs|_all], clean[_libs|_all]
...
...
@@ -104,7 +104,7 @@ $(BINARY_NAME): $(OBJS) Makefile
strip
:
all
strip
$(BINARY_NAME)
strip
$(BINARY_NAME)
strip_libs
:
all libs
$(MAKE)
-C
lib strip
...
...
@@ -120,7 +120,7 @@ install_libs:
$(MAKE)
-C
lib
install
clean
:
rm
-f
$(BINARY_NAME)
*
.o posix/
*
.o linux/
*
.o
...
...
sources/allocate.c
View file @
3cb23894
...
...
@@ -100,8 +100,8 @@ void removeMemory( int32_t tag, int32_t freetag ) {
if
(
walker
->
counter
==
0
)
{
dbg
(
DBGL_SYS
,
DBGT_ERR
,
"Freeing more memory than was allocated: malloc tag = %d, free tag = %d"
,
dbg
(
DBGL_SYS
,
DBGT_ERR
,
"Freeing more memory than was allocated: malloc tag = %d, free tag = %d"
,
tag
,
freetag
);
cleanup_all
(
-
500069
);
...
...
@@ -116,7 +116,7 @@ void removeMemory( int32_t tag, int32_t freetag ) {
if
(
walker
==
NULL
)
{
dbg
(
DBGL_SYS
,
DBGT_ERR
,
dbg
(
DBGL_SYS
,
DBGT_ERR
,
"Freeing memory that was never allocated: malloc tag = %d, free tag = %d"
,
tag
,
freetag
);
cleanup_all
(
-
500070
);
...
...
@@ -128,7 +128,7 @@ void removeMemory( int32_t tag, int32_t freetag ) {
#if defined MEMORY_USAGE
void
debugMemory
(
struct
ctrl_node
*
cn
)
{
struct
memoryUsage
*
memoryWalker
;
dbg_printf
(
cn
,
"
\n
Memory usage information:
\n
"
);
...
...
@@ -136,13 +136,13 @@ void debugMemory( struct ctrl_node *cn ) {
for
(
memoryWalker
=
memoryList
;
memoryWalker
!=
NULL
;
memoryWalker
=
memoryWalker
->
next
)
{
if
(
memoryWalker
->
counter
!=
0
)
dbg_printf
(
cn
,
" tag: %4i, num malloc: %4i, bytes per malloc: %4i, total: %6i
\n
"
,
memoryWalker
->
tag
,
memoryWalker
->
counter
,
memoryWalker
->
length
,
dbg_printf
(
cn
,
" tag: %4i, num malloc: %4i, bytes per malloc: %4i, total: %6i
\n
"
,
memoryWalker
->
tag
,
memoryWalker
->
counter
,
memoryWalker
->
length
,
memoryWalker
->
counter
*
memoryWalker
->
length
);
}
dbg_printf
(
cn
,
"
\n
"
);
}
#endif
...
...
@@ -159,8 +159,8 @@ void checkIntegrity(void)
{
if
(
walker
->
magicNumberHeader
!=
MAGIC_NUMBER_HEADER
)
{
dbgf
(
DBGL_SYS
,
DBGT_ERR
,
"invalid magic number in header: %08x, malloc tag = %d"
,
dbgf
(
DBGL_SYS
,
DBGT_ERR
,
"invalid magic number in header: %08x, malloc tag = %d"
,
walker
->
magicNumberHeader
,
walker
->
tag
);
cleanup_all
(
-
500073
);
}
...
...
@@ -183,26 +183,26 @@ void checkIntegrity(void)
void
checkLeak
(
void
)
{
struct
chunkHeader
*
walker
;
if
(
chunkList
!=
NULL
)
{
openlog
(
"bmx"
,
LOG_PID
,
LOG_DAEMON
);
for
(
walker
=
chunkList
;
walker
!=
NULL
;
walker
=
walker
->
next
)
{
syslog
(
LOG_ERR
,
"Memory leak detected, malloc tag = %d
\n
"
,
walker
->
tag
);
fprintf
(
stderr
,
"Memory leak detected, malloc tag = %d
\n
"
,
walker
->
tag
);
}
closelog
();
}
}
void
*
debugMalloc
(
uint32_t
length
,
int32_t
tag
)
{
prof_start
(
PROF_debugMalloc
);
unsigned
char
*
memory
;
struct
chunkHeader
*
chunkHeader
;
...
...
@@ -213,7 +213,7 @@ void *debugMalloc(uint32_t length, int32_t tag) {
if
(
memory
==
NULL
)
{
dbg
(
DBGL_SYS
,
DBGT_ERR
,
"Cannot allocate %u bytes, malloc tag = %d"
,
dbg
(
DBGL_SYS
,
DBGT_ERR
,
"Cannot allocate %u bytes, malloc tag = %d"
,
(
unsigned
int
)(
length
+
sizeof
(
struct
chunkHeader
)
+
sizeof
(
magicNumberTrailor
)),
tag
);
cleanup_all
(
-
500076
);
}
...
...
@@ -242,7 +242,7 @@ void *debugMalloc(uint32_t length, int32_t tag) {
}
void
*
debugRealloc
(
void
*
memoryParameter
,
uint32_t
length
,
int32_t
tag
)
{
prof_start
(
PROF_debugRealloc
);
unsigned
char
*
memory
;
...
...
@@ -257,8 +257,8 @@ void *debugRealloc(void *memoryParameter, uint32_t length, int32_t tag) {
if
(
chunkHeader
->
magicNumberHeader
!=
MAGIC_NUMBER_HEADER
)
{
dbgf
(
DBGL_SYS
,
DBGT_ERR
,
"invalid magic number in header: %08x, malloc tag = %d"
,
dbgf
(
DBGL_SYS
,
DBGT_ERR
,
"invalid magic number in header: %08x, malloc tag = %d"
,
chunkHeader
->
magicNumberHeader
,
chunkHeader
->
tag
);
cleanup_all
(
-
500078
);
}
...
...
@@ -291,9 +291,9 @@ void *debugRealloc(void *memoryParameter, uint32_t length, int32_t tag) {
}
void
debugFree
(
void
*
memoryParameter
,
int
tag
)
{
prof_start
(
PROF_debugFree
);
unsigned
char
*
memory
;
struct
chunkHeader
*
chunkHeader
;
magicNumberTrailor
*
chunkTrailer
;
...
...
@@ -305,7 +305,7 @@ void debugFree(void *memoryParameter, int tag) {
if
(
chunkHeader
->
magicNumberHeader
!=
MAGIC_NUMBER_HEADER
)
{
dbgf
(
DBGL_SYS
,
DBGT_ERR
,
dbgf
(
DBGL_SYS
,
DBGT_ERR
,
"invalid magic number in header: %08x, malloc tag = %d, free tag = %d, malloc size = %d"
,
chunkHeader
->
magicNumberHeader
,
chunkHeader
->
tag
,
tag
,
chunkHeader
->
length
);
cleanup_all
(
-
500080
);
...
...
@@ -352,7 +352,7 @@ void debugFree(void *memoryParameter, int tag) {
#endif
free
(
chunkHeader
);
prof_stop
(
PROF_debugFree
);
}
...
...
sources/batman.c
View file @
3cb23894
...
...
@@ -43,8 +43,8 @@
uint32_t
My_pid
=
0
;
uint8_t
ext_attribute
[
EXT_TYPE_MAX
+
1
]
=
{
uint8_t
ext_attribute
[
EXT_TYPE_MAX
+
1
]
=
{
EXT_ATTR_KEEP
,
// EXT_TYPE_64B_GW
0
,
// EXT_TYPE_64B_HNA
0
,
// EXT_TYPE_64B_PIP
...
...
@@ -82,38 +82,38 @@ void batman( void ) {
batman_time_t
regular_timeout
,
statistic_timeout
;
batman_time_t
s_last_cpu_time
=
0
,
s_curr_cpu_time
=
0
;
regular_timeout
=
statistic_timeout
=
batman_time
;
on_the_fly
=
YES
;
prof_start
(
PROF_all
);
while
(
!
is_aborted
()
)
{
prof_stop
(
PROF_all
);
prof_start
(
PROF_all
);
uint32_t
wait
=
whats_next
(
);
if
(
wait
)
wait4Event
(
MIN
(
wait
,
MAX_SELECT_TIMEOUT_MS
)
);
// The regular tasks...
if
(
LESS_U32
(
regular_timeout
+
1000
,
batman_time
)
)
{
purge_orig
(
batman_time
,
NULL
);
close_ctrl_node
(
CTRL_CLEANUP
,
0
);
list_for_each
(
list_pos
,
&
dbgl_clients
[
DBGL_ALL
]
)
{
struct
ctrl_node
*
cn
=
(
list_entry
(
list_pos
,
struct
dbgl_node
,
list
))
->
cn
;
dbg_printf
(
cn
,
"------------------ DEBUG ------------------
\n
"
);
debug_send_list
(
cn
);
check_apply_parent_option
(
ADD
,
OPT_APPLY
,
0
,
get_option
(
0
,
0
,
ARG_STATUS
),
0
,
cn
);
check_apply_parent_option
(
ADD
,
OPT_APPLY
,
0
,
get_option
(
0
,
0
,
ARG_LINKS
),
0
,
cn
);
check_apply_parent_option
(
ADD
,
OPT_APPLY
,
0
,
get_option
(
0
,
0
,
ARG_ORIGINATORS
),
0
,
cn
);
...
...
@@ -125,44 +125,44 @@ void batman( void ) {
check_apply_parent_option
(
ADD
,
OPT_APPLY
,
0
,
get_option
(
0
,
0
,
ARG_SERVICES
),
0
,
cn
);
#endif
dbg_printf
(
cn
,
"--------------- END DEBUG ---------------
\n
"
);
}
/* preparing the next debug_timeout */
regular_timeout
=
batman_time
;
}
if
(
LESS_U32
(
statistic_timeout
+
5000
,
batman_time
)
)
{
// check for corrupted memory..
checkIntegrity
();
// check for changed kernel konfigurations...
check_kernel_config
(
NULL
);
// check for changed interface konfigurations...
list_for_each
(
list_pos
,
&
if_list
)
{
batman_if
=
list_entry
(
list_pos
,
struct
batman_if
,
list
);
if
(
batman_if
->
if_active
)
check_kernel_config
(
batman_if
);
}
/* generating cpu load statistics... */
s_curr_cpu_time
=
(
uint32_t
)
clock
();
s_curr_avg_cpu_load
=
(
(
s_curr_cpu_time
-
s_last_cpu_time
)
/
(
batman_time_t
)(
batman_time
-
statistic_timeout
)
);
s_last_cpu_time
=
s_curr_cpu_time
;
statistic_timeout
=
batman_time
;
}
}
prof_stop
(
PROF_all
);
...
...
@@ -172,7 +172,7 @@ void batman( void ) {
/*some static plugins*/
#ifndef NOVIS
#ifndef NOVIS
static
struct
vis_if
*
vis_if
=
NULL
;
...
...
@@ -181,20 +181,20 @@ static uint16_t vis_packet_size = 0;
static
int32_t
vis_port
=
DEF_VIS_PORT
;
static
void
send_vis_packet
(
void
*
unused
)
{
struct
vis_if
*
vis
=
vis_if
;
struct
list_head
*
list_pos
;
struct
batman_if
*
batman_if
;
//struct hna_node *hna_node;
struct
link_node
*
link_node
;
struct
list_head
*
link_pos
;
struct
list_head
*
lndev_pos
;
if
(
!
vis
||
!
vis
->
sock
)
return
;
if
(
vis_packet
)
{
debugFree
(
vis_packet
,
1102
);
vis_packet
=
NULL
;
...
...
@@ -203,7 +203,7 @@ static void send_vis_packet( void *unused ) {
vis_packet_size
=
sizeof
(
struct
vis_packet
);
vis_packet
=
debugMalloc
(
vis_packet_size
,
104
);
((
struct
vis_packet
*
)
vis_packet
)
->
sender_ip
=
primary_addr
;
((
struct
vis_packet
*
)
vis_packet
)
->
version
=
VIS_COMPAT_VERSION
;
((
struct
vis_packet
*
)
vis_packet
)
->
gw_class
=
Gateway_class
;
...
...
@@ -211,20 +211,20 @@ static void send_vis_packet( void *unused ) {
dbgf_all
(
DBGT_INFO
,
"sender_ip=%s version=%d gw_class=%d seq_range=%d"
,
ipStr
(
primary_addr
),
VIS_COMPAT_VERSION
,
Gateway_class
,
(
PROBE_RANGE
/
PROBE_TO100
));
/* iterate link list */
list_for_each
(
link_pos
,
&
link_list
)
{
link_node
=
list_entry
(
link_pos
,
struct
link_node
,
list
);
if
(
link_node
->
orig_node
->
router
==
NULL
)
continue
;
uint32_t
q_max
=
0
;
struct
vis_data
*
vis_data
=
NULL
;
list_for_each
(
lndev_pos
,
&
link_node
->
lndev_list
)
{
struct
link_node_dev
*
lndev
=
list_entry
(
lndev_pos
,
struct
link_node_dev
,
list
);
if
(
!
lndev
->
rq_sqr
.
wa_val
)
...
...
@@ -233,12 +233,12 @@ static void send_vis_packet( void *unused ) {
if
(
!
vis_data
)
{
vis_packet_size
+=
sizeof
(
struct
vis_data
);
vis_packet
=
debugRealloc
(
vis_packet
,
vis_packet_size
,
105
);
vis_data
=
(
struct
vis_data
*
)
(
vis_packet
+
vis_packet_size
-
sizeof
(
struct
vis_data
));
}
if
(
vis_data
&&
lndev
->
rq_sqr
.
wa_val
>
q_max
)
{
...
...
@@ -257,13 +257,13 @@ static void send_vis_packet( void *unused ) {
}
}
/* secondary interfaces */
list_for_each
(
list_pos
,
&
if_list
)
{
batman_if
=
list_entry
(
list_pos
,
struct
batman_if
,
list
);
if
(
((
struct
vis_packet
*
)
vis_packet
)
->
sender_ip
==
batman_if
->
if_addr
)
continue
;
...
...
@@ -271,46 +271,46 @@ static void send_vis_packet( void *unused ) {
continue
;
vis_packet_size
+=
sizeof
(
struct
vis_data
);
vis_packet
=
debugRealloc
(
vis_packet
,
vis_packet_size
,
106
);
struct
vis_data
*
vis_data
=
(
struct
vis_data
*
)
(
vis_packet
+
vis_packet_size
-
sizeof
(
struct
vis_data
));
vis_data
->
ip
=
batman_if
->
if_addr
;
vis_data
->
data
=
0
;
vis_data
->
type
=
DATA_TYPE_SEC_IF
;
dbgf_all
(
DBGT_INFO
,
"interface %s (dev=%s)"
,
ipStr
(
batman_if
->
if_addr
),
batman_if
->
dev
);
}
/*
#ifndef NOHNA
#ifndef NOHNA
// hna announcements
struct hash_it_t *hashit = NULL;
// for all hna_hash_nodes...
// for all hna_hash_nodes...
while ( (hashit = hash_iterate( hna_hash, hashit )) ) {
struct hna_hash_node *hhn = hashit->bucket->data;
if ( hhn->status == HNA_HASH_NODE_MYONE ) {
vis_packet_size += sizeof(struct vis_data);
vis_packet = debugRealloc( vis_packet, vis_packet_size, 107 );
vis_data = (struct vis_data *)(vis_packet + vis_packet_size - sizeof(struct vis_data));
vis_data->ip = hhn->key.addr;
vis_data->data = hhn->key.KEY_FIELD_ANETMASK;
vis_data->type = DATA_TYPE_HNA;
}
}
#endif
#endif
*/
if
(
vis_packet_size
==
sizeof
(
struct
vis_packet
)
)
{
debugFree
(
vis_packet
,
1107
);
...
...
@@ -322,31 +322,31 @@ static void send_vis_packet( void *unused ) {
if
(
vis_packet
!=
NULL
)
send_udp_packet
(
vis_packet
,
vis_packet_size
,
&
vis
->
addr
,
vis
->
sock
);
register_task
(
10000
,
send_vis_packet
,
NULL
);
}
static
int32_t
opt_vis
(
uint8_t
cmd
,
uint8_t
_save
,
struct
opt_type
*
opt
,
struct
opt_parent
*
patch
,
struct
ctrl_node
*
cn
)
{
uint32_t
vis_ip
=
0
;
if
(
cmd
==
OPT_CHECK
||
cmd
==
OPT_APPLY
)
{
if
(
patch
->
p_diff
==
DEL
)
vis_ip
=
0
;
else
if
(
str2netw
(
patch
->
p_val
,
&
vis_ip
,
'/'
,
cn
,
NULL
,
0
)
==
FAILURE
)
return
FAILURE
;
}
if
(
cmd
==
OPT_APPLY
&&
vis_ip
)
{
remove_task
(
send_vis_packet
,
NULL
);
if
(
vis_if
&&
vis_if
->
sock
)
close
(
vis_if
->
sock
);
if
(
!
vis_if
)
vis_if
=
debugMalloc
(
sizeof
(
struct
vis_if
),
731
);
...
...
@@ -359,30 +359,30 @@ static int32_t opt_vis ( uint8_t cmd, uint8_t _save, struct opt_type *opt, struc
register_task
(
1000
,
send_vis_packet
,
NULL
);
}
if
(
(
cmd
==
OPT_APPLY
&&
!
vis_ip
)
||
cmd
==
OPT_UNREGISTER
)
{
remove_task
(
send_vis_packet
,
NULL
);
if
(
vis_if
)
{
if
(
vis_if
->
sock
)
close
(
vis_if
->
sock
);
debugFree
(
vis_if
,
1731
);
vis_if
=
NULL
;
}
}
if
(
vis_packet
)
{
debugFree
(
vis_packet
,
1108
);
vis_packet
=
NULL
;
}
}
return
SUCCESS
;
}
...
...
@@ -391,7 +391,7 @@ static struct opt_type vis_options[]= {
// ord parent long_name shrt Attributes *ival min max default *function
{
ODI
,
5
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
"
\n
Visualization options:"
},
{
ODI
,
5
,
0
,
"vis_server"
,
's'
,
A_PS1
,
A_ADM
,
A_DYI
,
A_CFA
,
A_ANY
,
0
,
0
,
0
,
0
,
opt_vis
,
ARG_ADDR_FORM
,
"set IP of visualization server"
}
...
...
@@ -404,26 +404,26 @@ static void vis_cleanup( void ) {
static
int32_t
vis_init
(
void
)
{
register_options_array
(
vis_options
,
sizeof
(
vis_options
)
);
return
SUCCESS
;
}
struct
plugin_v1
*
vis_get_plugin_v1
(
void
)
{
static
struct
plugin_v1
vis_plugin_v1
;
memset
(
&
vis_plugin_v1
,
0
,
sizeof
(
struct
plugin_v1
)
);
vis_plugin_v1
.
plugin_version
=
PLUGIN_VERSION_01
;
vis_plugin_v1
.
plugin_size
=
sizeof
(
struct
plugin_v1
);
vis_plugin_v1
.
plugin_name
=
"bmx_vis_plugin"
;
vis_plugin_v1
.
cb_init
=
vis_init
;
vis_plugin_v1
.
cb_cleanup
=
vis_cleanup
;
return
&
vis_plugin_v1
;
}
...
...
@@ -444,33 +444,33 @@ static int32_t srv_orig_registry = FAILURE;
static
void
update_own_srv
(
uint8_t
purge
)
{
struct
list_head
*
list_pos
,
*
srv_tmp
;
struct
srv_node
*
srv_node
;