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
Firmware
Commits
d59ed38f
Commit
d59ed38f
authored
Apr 18, 2021
by
Stephan
Browse files
Merge branch 'se-bmxd-watchdog' into 'master'
bmxd watchdog; firewall; build.sh Closes
#78
See merge request
!125
parents
83a5756e
28f2cf4e
Pipeline
#1646
passed with stages
Changes
147
Pipelines
2
Expand all
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
d59ed38f
...
...
@@ -4,3 +4,4 @@ coredumps/
logs/
final_output/
upload-infos/
*.o
build.sh
View file @
d59ed38f
...
...
@@ -2,7 +2,7 @@
tabs 4
#usage: see below
SCRIPT_VERSION
=
"
9
"
SCRIPT_VERSION
=
"
10
"
#echo "ACHTUNG: aktuell stuerst firmware auf ubnt geraeten ab. Daher habe ich erstmal das bauen hier deaktiviert."
...
...
@@ -13,6 +13,16 @@ SCRIPT_VERSION="9"
# FF_BUILD_TAG
# FF_MESH_KEY
# check terms
case
"
$TERM
"
in
xterm
*
)
_TERM
=
1
;;
screen
)
_TERM
=
1
;;
vt1
*
)
_TERM
=
1
;;
*
)
_TERM
=
0
;;
esac
#change to directory where build.sh is
cd
$(
dirname
$0
)
...
...
@@ -65,6 +75,94 @@ RUN_DIR=$(pwd)
# Fuer die meisten filenamen ist das array 1 gross. aber fuer files die fuer verschiedene router
# verwendet werden, koennen mehrere eintraege sein.
############# progress bar ##########################
function
progressbar
{
#######################################
# Display a progress bar
# Arguments:
# $1 Current loop number
# $2 max. no of loops (1005)
# Returns:
# None
#######################################
title
=
"Progress :"
title_len
=
10
_cols
=
$(
tput cols
)
let
_cols
=
$_cols
-
$title_len
# Process data
let
_progress
=(
${
1
}*
100/
${
2
}*
100
)
/100
let
_done
=(
${
_progress
}*
4
)
/10
let
_left
=
$_cols
-
$_done
-20
# Build progressbar string lengths
_fill
=
$(
printf
"%
${
_done
}
s"
)
_empty
=
$(
printf
"%
${
_left
}
s"
)
# 1.2 Build progressbar strings and print the progressbar line
# 1.2.1 Output example:
# 1.2.1.1 Progress : [########################################] 100%
printf
"
\r
$title
[
${
_fill
// /#
}${
_empty
// /-
}
]
${
_progress
}
%% (
$1
/
$2
)"
# erase until end of line
tput el
}
# clean up screen and
clean_up
()
{
# reset region
if
[
-n
"
$row
"
]
;
then
printf
"
\\
033[r
\n
"
tput cup
$row
0
fi
exit
0
}
show_progress
()
{
# dont overwrite last value, when no parameter was given (window resize signal)
[
-n
"
$1
"
]
&&
_count
=
$1
[
-n
"
$2
"
]
&&
_max
=
$2
[
"
$_max
"
-eq
0
]
&&
return
row
=
$(
tput lines
)
# empty second line
tput cup 1 0
tput el
# print progress bar at top
tput cup
$((
$row
-
1
))
0
progressbar
$_count
$_max
# print empty line above
tput cup
$((
$row
-
2
))
0
tput el
# define scroll region before setting cursor. else it would overwrite progress bar
# leave out second row parameter to use max
printf
"
\\
033[0;%dr"
$((
$row
-
2
))
# set cursor into last line of region
tput cup
$((
$row
-
3
))
0
}
if
[
"
$_TERM
"
=
"1"
]
;
then
trap
clean_up SIGINT SIGTERM
trap
show_progress WINCH
fi
############# build.sh functions ####################
getTargetsJson
()
{
cat
$RUN_DIR
/
$PLATFORMS_JSON
|
sed
-n
"
...
...
@@ -194,6 +292,40 @@ listTargetsNames()
done
}
# returns number of targets in build.json
numberOfTargets
()
{
_regex
=
$1
[
-z
"
$_regex
"
]
&&
_regex
=
'.*'
OPT
=
"--raw-output"
# do not excape values
cleanJson
=
$(
getTargetsJson
)
# ignore first default entry
targetIdx
=
1
count
=
0
# run through rest of json
while
true
do
entry
=
$(
echo
"
$cleanJson
"
| jq
".[
$targetIdx
]"
)
[
"
$entry
"
=
"null"
]
&&
break
# last entry
_name
=
$(
echo
$entry
| jq
$OPT
'.name'
)
[
-z
"
$_name
"
]
&&
break
targetIdx
=
$((
targetIdx
+
1
))
# ignore targets that do not match
filterred
=
$(
echo
$_name
|
sed
-n
"/
$_regex
/p"
)
test
-z
"
$filterred
"
&&
continue
count
=
$((
$count
+
1
))
done
printf
"%d"
$count
}
search_target
()
{
target
=
$1
...
...
@@ -499,6 +631,17 @@ if [ -n "$entry" ]; then
#echo $_def_packages
fi
progress_counter
=
0
progress_max
=
$(
numberOfTargets
"
$regex
"
)
if
[
$progress_max
-eq
0
]
;
then
echo
"no target found"
clean_up
exit
1
fi
while
true
do
cd
$RUN_DIR
...
...
@@ -568,6 +711,14 @@ do
filterred
=
$(
echo
$filter_target
|
sed
-n
"/
$regex
/p"
)
test
-z
"
$filterred
"
&&
continue
if
[
"
$_TERM
"
=
"1"
]
;
then
echo
$progress_counter
$progress_max
show_progress
$progress_counter
$progress_max
progress_counter
=
$((
$progress_counter
+
1
))
echo
""
fi
config_file
=
"
$CONFIG_DIR
/
$_selector_config
/config.
$_target
.
$_subtarget
"
test
-n
"
$_variant
"
&&
config_file
=
"
$config_file
.
$_variant
"
test
-n
"
$_openwrt_variant
"
&&
config_file
=
"
$config_file
.
$_openwrt_variant
"
...
...
@@ -781,6 +932,8 @@ EOM
done
clean_up
echo
-e
$C_PURPLE
".......... complete build finished ........................"
$C_NONE
echo
""
changelog.txt
View file @
d59ed38f
2021-04-00 7.0.2
--------------------------------------------------
bmxd - add keep alive watchdog
backbone - re-add wireguard interfaces to bmxd when bmxd has restarted
firewall - enable lan gateway when router acts as public gateway
2021-02-13 7.0.1 (rc)
--------------------------------------------------
wifi - disable external wifi button
...
...
feeds/18.06/feeds-own/bmxd
0 → 120000
View file @
d59ed38f
../../common/bmxd
\ No newline at end of file
feeds/18.06/feeds-own/bmxd/sources/allocate.h
deleted
100644 → 0
View file @
83a5756e
/*
* Copyright (C) 2006 B.A.T.M.A.N. contributors:
* Thomas Lopatic, Corinna 'Elektra' Aichele, Axel Neumann, Marek Lindner
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*
*/
#ifndef _ALLOCATE_H
#define _ALLOCATE_H 1
#include <stdint.h>
void
checkIntegrity
(
void
);
void
checkLeak
(
void
);
void
*
debugMalloc
(
uint32_t
length
,
int32_t
tag
);
void
*
debugRealloc
(
void
*
memory
,
uint32_t
length
,
int32_t
tag
);
void
debugFree
(
void
*
memoryParameter
,
int32_t
tag
);
void
debugMemory
(
struct
ctrl_node
*
cn
);
#endif
feeds/18.06/feeds-own/bmxd/sources/avl.c
deleted
100644 → 0
View file @
83a5756e
/* Copyright (C) 2006 B.A.T.M.A.N. contributors:
* Axel Neumann
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*
*/
/*
* avl code inspired by:
* http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_avl.aspx
* where Julienne Walker said (web page from 28. 2. 2010 12:55):
* ...Once again, all of the code in this tutorial is in the public domain.
* You can do whatever you want with it, but I assume no responsibility
* for any damages from improper use. ;-)
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "batman.h"
#include "os.h"
#include "avl.h"
struct
avl_node
*
avl_find
(
struct
avl_tree
*
tree
,
void
*
key
)
{
struct
avl_node
*
an
=
tree
->
root
;
int
cmp
;
// Search for a dead path or a matching entry
while
(
an
&&
(
cmp
=
memcmp
(
an
->
key
,
key
,
tree
->
key_size
)
)
)
an
=
an
->
link
[
cmp
<
0
];
return
an
;
}
struct
avl_node
*
avl_next
(
struct
avl_tree
*
tree
,
void
*
key
)
{
struct
avl_node
*
an
=
tree
->
root
;
struct
avl_node
*
best
=
NULL
;
int
cmp
;
while
(
an
)
{
cmp
=
(
memcmp
(
an
->
key
,
key
,
tree
->
key_size
)
<=
0
);
if
(
an
->
link
[
cmp
])
{
best
=
cmp
?
best
:
an
;
an
=
an
->
link
[
cmp
];
}
else
{
return
cmp
?
best
:
an
;
}
}
return
NULL
;
}
struct
avl_node
*
avl_iterate
(
struct
avl_tree
*
tree
,
struct
avl_node
*
an
)
{
if
(
!
an
||
an
->
link
[
1
]
)
{
an
=
an
?
an
->
link
[
1
]
:
tree
->
root
;
while
(
an
&&
an
->
link
[
0
]
)
an
=
an
->
link
[
0
];
return
an
;
}
struct
avl_node
*
prev
=
an
;
while
((
an
=
an
->
up
))
{
if
(
an
->
link
[
0
]
==
prev
)
return
an
;
prev
=
an
;
}
return
NULL
;
}
static
struct
avl_node
*
avl_create_node
(
void
*
key
)
{
struct
avl_node
*
an
=
debugMalloc
(
sizeof
(
struct
avl_node
),
327
);
paranoia
(
-
500189
,
!
an
);
memset
(
an
,
0
,
sizeof
(
struct
avl_node
)
);
an
->
key
=
key
;
return
an
;
}
static
struct
avl_node
*
avl_rotate_single
(
struct
avl_node
*
root
,
int
dir
)
{
struct
avl_node
*
save
;
int
rlh
,
rrh
,
slh
;
/* Rotate */
save
=
root
->
link
[
!
dir
];
root
->
link
[
!
dir
]
=
save
->
link
[
dir
];
if
(
root
->
link
[
!
dir
])
root
->
link
[
!
dir
]
->
up
=
root
;
save
->
link
[
dir
]
=
root
;
if
(
root
)
root
->
up
=
save
;
/* Update balance factors */
rlh
=
avl_height
(
root
->
link
[
0
]);
rrh
=
avl_height
(
root
->
link
[
1
]);
slh
=
avl_height
(
save
->
link
[
!
dir
]);
root
->
balance
=
avl_max
(
rlh
,
rrh
)
+
1
;
save
->
balance
=
avl_max
(
slh
,
root
->
balance
)
+
1
;
return
save
;
}
static
struct
avl_node
*
avl_rotate_double
(
struct
avl_node
*
root
,
int
dir
)
{
root
->
link
[
!
dir
]
=
avl_rotate_single
(
root
->
link
[
!
dir
],
!
dir
);
if
(
root
->
link
[
!
dir
])
root
->
link
[
!
dir
]
->
up
=
root
;
return
avl_rotate_single
(
root
,
dir
);
}
void
avl_insert
(
struct
avl_tree
*
tree
,
void
*
key
)
{
if
(
tree
->
root
)
{
struct
avl_node
*
it
=
tree
->
root
;
struct
avl_node
*
up
[
AVL_MAX_HEIGHT
];
int
upd
[
AVL_MAX_HEIGHT
],
top
=
0
;
int
done
=
0
;
/* Search for an empty link, save the path */
for
(;;)
{
/* Push direction and node onto stack */
// upd[top] = memcmp(it->key, key, tree->key_size) < 0;
upd
[
top
]
=
memcmp
(
it
->
key
,
key
,
tree
->
key_size
)
<=
0
;
up
[
top
++
]
=
it
;
if
(
it
->
link
[
upd
[
top
-
1
]]
==
NULL
)
break
;
it
=
it
->
link
[
upd
[
top
-
1
]];
}
/* Insert a new node at the bottom of the tree */
it
->
link
[
upd
[
top
-
1
]]
=
avl_create_node
(
key
);
it
->
link
[
upd
[
top
-
1
]]
->
up
=
it
;
paranoia
(
-
500178
,
(
it
->
link
[
upd
[
top
-
1
]]
==
NULL
));
/* Walk back up the search path */
while
(
--
top
>=
0
&&
!
done
)
{
int
lh
,
rh
,
max
;
lh
=
avl_height
(
up
[
top
]
->
link
[
upd
[
top
]]);
rh
=
avl_height
(
up
[
top
]
->
link
[
!
upd
[
top
]]);
/* Terminate or rebalance as necessary */
if
(
lh
-
rh
==
0
)
done
=
1
;
if
(
lh
-
rh
>=
2
)
{
struct
avl_node
*
a
=
up
[
top
]
->
link
[
upd
[
top
]]
->
link
[
upd
[
top
]];
struct
avl_node
*
b
=
up
[
top
]
->
link
[
upd
[
top
]]
->
link
[
!
upd
[
top
]];
if
(
avl_height
(
a
)
>=
avl_height
(
b
))
up
[
top
]
=
avl_rotate_single
(
up
[
top
],
!
upd
[
top
]);
else
up
[
top
]
=
avl_rotate_double
(
up
[
top
],
!
upd
[
top
]);
/* Fix parent */
if
(
top
!=
0
)
{
up
[
top
-
1
]
->
link
[
upd
[
top
-
1
]]
=
up
[
top
];
up
[
top
]
->
up
=
up
[
top
-
1
];
}
else
{
tree
->
root
=
up
[
0
];
up
[
0
]
->
up
=
NULL
;
}
done
=
1
;
}
/* Update balance factors */
lh
=
avl_height
(
up
[
top
]
->
link
[
upd
[
top
]]);
rh
=
avl_height
(
up
[
top
]
->
link
[
!
upd
[
top
]]);
max
=
avl_max
(
lh
,
rh
);
up
[
top
]
->
balance
=
max
+
1
;
}
}
else
{
tree
->
root
=
avl_create_node
(
key
);
paranoia
(
-
500179
,
(
tree
->
root
==
NULL
));
}
return
;
}
void
*
avl_remove
(
struct
avl_tree
*
tree
,
void
*
key
)
{
struct
avl_node
*
it
=
tree
->
root
;
struct
avl_node
*
up
[
AVL_MAX_HEIGHT
];
int
upd
[
AVL_MAX_HEIGHT
],
top
=
0
,
cmp
;
paranoia
(
-
500182
,
!
it
);
// paranoia if not found
// while ((cmp = memcmp(it->key, key, tree->key_size)) ) {
while
((
cmp
=
memcmp
(
it
->
key
,
key
,
tree
->
key_size
))
||
(
it
->
link
[
0
]
&&
!
memcmp
(
it
->
link
[
0
]
->
key
,
key
,
tree
->
key_size
)))
{
// Push direction and node onto stack
upd
[
top
]
=
(
cmp
<
0
);
up
[
top
]
=
it
;
top
++
;
if
(
!
(
it
=
it
->
link
[(
cmp
<
0
)]))
return
NULL
;
}
// remember and return the found key. It might have been another one than intended
key
=
it
->
key
;
// Remove the node:
if
(
!
(
it
->
link
[
0
]
&&
it
->
link
[
1
]))
{
// at least one child is NULL:
// Which child is not null?
int
dir
=
!
(
it
->
link
[
0
]);
/* Fix parent */
if
(
top
)
{
up
[
top
-
1
]
->
link
[
upd
[
top
-
1
]]
=
it
->
link
[
dir
];
if
(
it
->
link
[
dir
])
it
->
link
[
dir
]
->
up
=
up
[
top
-
1
];
}
else
{
tree
->
root
=
it
->
link
[
dir
];
if
(
tree
->
root
)
tree
->
root
->
up
=
NULL
;
}
debugFree
(
it
,
1327
);
}
else
{
// both childs NOT NULL:
// Find the inorder successor
struct
avl_node
*
heir
=
it
->
link
[
1
];
// Save the path
upd
[
top
]
=
1
;
up
[
top
]
=
it
;
top
++
;
while
(
heir
->
link
[
0
])
{
upd
[
top
]
=
0
;
up
[
top
]
=
heir
;
top
++
;
heir
=
heir
->
link
[
0
];
}
// Swap data
it
->
key
=
heir
->
key
;
// Unlink successor and fix parent
up
[
top
-
1
]
->
link
[
(
up
[
top
-
1
]
==
it
)
]
=
heir
->
link
[
1
];
if
(
heir
->
link
[
1
])
heir
->
link
[
1
]
->
up
=
up
[
top
-
1
];
debugFree
(
heir
,
2327
);
}
// Walk back up the search path
while
(
--
top
>=
0
)
{
int
lh
=
avl_height
(
up
[
top
]
->
link
[
upd
[
top
]]);
int
rh
=
avl_height
(
up
[
top
]
->
link
[
!
upd
[
top
]]);
int
max
=
avl_max
(
lh
,
rh
);
/* Update balance factors */
up
[
top
]
->
balance
=
max
+
1
;
// Terminate or re-balance as necessary:
if
(
lh
-
rh
>=
0
)
// re-balance upper path...
continue
;
if
(
lh
-
rh
==
-
1
)
// balance for upper path unchanged!
break
;
if
(
!
(
up
[
top
])
||
!
(
up
[
top
]
->
link
[
!
upd
[
top
]]))
{
dbgf
(
DBGL_SYS
,
DBGT_ERR
,
"up(top) %p link %p lh %d rh %d"
,
(
void
*
)(
up
[
top
]),
(
void
*
)((
up
[
top
])
?
(
up
[
top
]
->
link
[
!
upd
[
top
]])
:
NULL
),
lh
,
rh
);
paranoia
(
-
500187
,
(
!
(
up
[
top
])));
paranoia
(
-
500188
,
(
!
(
up
[
top
]
->
link
[
!
upd
[
top
]])));
}
/*
paranoia(-500183, (lh - rh <= -3) );
paranoia(-500185, (lh - rh == 2) );
paranoia(-500186, (lh - rh >= 3) );
*/
// if (lh - rh <= -2): rebalance here and upper path
struct
avl_node
*
a
=
up
[
top
]
->
link
[
!
upd
[
top
]]
->
link
[
upd
[
top
]];
struct
avl_node
*
b
=
up
[
top
]
->
link
[
!
upd
[
top
]]
->
link
[
!
upd
[
top
]];
if
(
avl_height
(
a
)
<=
avl_height
(
b
))
up
[
top
]
=
avl_rotate_single
(
up
[
top
],
upd
[
top
]);
else
up
[
top
]
=
avl_rotate_double
(
up
[
top
],
upd
[
top
]);
// Fix parent:
if
(
top
)
{
up
[
top
-
1
]
->
link
[
upd
[
top
-
1
]]
=
up
[
top
];
up
[
top
]
->
up
=
up
[
top
-
1
];
}
else
{
tree
->
root
=
up
[
0
];