Skip to content

Commit 88245e2

Browse files
committed
netutils/dropbear: simplify port configuration and generated headers
Generate default_options_guard.h at build time instead of committing a copy, inline the NuttX options into localoptions.h (dropping the nuttx_localoptions.h wrapper), and use upstream compat.c usershell functions instead of custom stubs. Bump the pinned Dropbear commit to 54ef47a now that the environ guard is upstream (mkj/dropbear#453) and drop that hunk from patch 0001. Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
1 parent bc982ed commit 88245e2

10 files changed

Lines changed: 84 additions & 827 deletions

netutils/dropbear/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ if(CONFIG_NETUTILS_DROPBEAR)
7878
patch -s -N -l -p1 -d "${DROPBEAR_UNPACKNAME}" -i
7979
"${CMAKE_CURRENT_SOURCE_DIR}/patch/0007-use-nuttx-unused-macro.patch"
8080
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
81+
message(STATUS "Generating default_options_guard.h")
82+
execute_process(
83+
COMMAND
84+
sh
85+
"${CMAKE_CURRENT_SOURCE_DIR}/${DROPBEAR_UNPACKNAME}/src/ifndef_wrapper.sh"
86+
INPUT_FILE
87+
"${CMAKE_CURRENT_SOURCE_DIR}/${DROPBEAR_UNPACKNAME}/src/default_options.h"
88+
OUTPUT_FILE
89+
"${CMAKE_CURRENT_SOURCE_DIR}/${DROPBEAR_UNPACKNAME}/src/default_options_guard.h"
90+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
8191
endif()
8292
endif()
8393

netutils/dropbear/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ config NETUTILS_DROPBEAR_SYSLOG
114114

115115
config NETUTILS_DROPBEAR_COMMIT
116116
string "Dropbear upstream commit"
117-
default "038f4e3e2f3b947b132a4c5ca03ba3f83b00b7d2"
117+
default "54ef47adf8c99b422be6a8f694f2866e62f88b9e"
118118
---help---
119-
Upstream Dropbear revision used by the ESP-IDF validation repo.
119+
Upstream Dropbear (mkj/dropbear) commit to download and build.
120120

121121
endif

netutils/dropbear/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ $(DROPBEAR_UNPACKNAME): $(DROPBEAR_ZIP)
165165
$(Q) $(PATCH) -s -N -l -p1 -d $(DROPBEAR_UNPACKNAME) -i $(APPDIR)$(DELIM)netutils$(DELIM)dropbear$(DELIM)patch$(DELIM)0005-use-nuttx-passwd-auth.patch; true
166166
$(Q) $(PATCH) -s -N -l -p1 -d $(DROPBEAR_UNPACKNAME) -i $(APPDIR)$(DELIM)netutils$(DELIM)dropbear$(DELIM)patch$(DELIM)0006-allow-localoptions-to-override-tracking-malloc.patch; true
167167
$(Q) $(PATCH) -s -N -l -p1 -d $(DROPBEAR_UNPACKNAME) -i $(APPDIR)$(DELIM)netutils$(DELIM)dropbear$(DELIM)patch$(DELIM)0007-use-nuttx-unused-macro.patch; true
168+
@echo "Generating default_options_guard.h"
169+
$(Q) sh $(DROPBEAR_UNPACKNAME)$(DELIM)src$(DELIM)ifndef_wrapper.sh \
170+
< $(DROPBEAR_UNPACKNAME)$(DELIM)src$(DELIM)default_options.h \
171+
> $(DROPBEAR_UNPACKNAME)$(DELIM)src$(DELIM)default_options_guard.h
168172
$(Q) touch $(DROPBEAR_UNPACKNAME)
169173

170174
ifeq ($(wildcard $(DROPBEAR_UNPACKNAME)/.git),)

netutils/dropbear/patch/0001-guard-platform-declarations.patch

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
--- a/src/includes.h
2-
+++ b/src/includes.h
3-
@@ -184,7 +184,11 @@ typedef u_int32_t uint32_t;
4-
#include <dlfcn.h>
5-
#endif
6-
7-
+#ifdef DROPBEAR_NUTTX
8-
+/* NuttX provides environ as a macro in stdlib.h. */
9-
+#else
10-
extern char** environ;
11-
+#endif
12-
13-
#include "fake-rfc2553.h"
14-
151
--- a/src/compat.c
162
+++ b/src/compat.c
173
@@ -81,6 +81,10 @@

netutils/dropbear/patch/0007-use-nuttx-unused-macro.patch

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
--- a/src/compat.c
2+
+++ b/src/compat.c
3+
@@ -89,6 +89,6 @@
4+
#ifndef HAVE_GETUSERSHELL
5+
static char **curshell, **shells, *strings;
6+
-static char **initshells();
7+
+static char **initshells(void);
8+
#endif
9+
10+
#ifndef HAVE_STRLCPY
11+
@@ -234,7 +234,7 @@
12+
curshell = initshells();
13+
}
14+
15+
-static char **initshells() {
16+
+static char **initshells(void) {
17+
static const char *okshells[] = { COMPAT_USER_SHELLS, NULL };
18+
register char **sp, *cp;
19+
register FILE *fp;
120
--- a/src/common-algo.c
221
+++ b/src/common-algo.c
322
@@ -39,16 +39,25 @@

0 commit comments

Comments
 (0)