Re: [PATCH ustream-ssl 2/2] cmake: Fail if undefined symbols are used

2023-11-11 Thread Rosen Penev
On Sat, Nov 11, 2023 at 1:35 PM Hauke Mehrtens  wrote:
>
> Make the linking of the shared library fail when undefined symbols are
> used. Linking undefined symbols in a shared library normally works and
> the linking of the binary using the shared library fails. We also
> compile some example applications and they failed already.
>
> Signed-off-by: Hauke Mehrtens 
> ---
>  CMakeLists.txt | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 2de6590..f4dca0d 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -10,6 +10,7 @@ ENDIF()
>  ADD_DEFINITIONS(-Wno-unused-parameter -Wmissing-declarations)
>
>  SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
> +SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
probably better to convert to meson, which passes this by default.
>
>  IF(MBEDTLS)
>ADD_DEFINITIONS(-DHAVE_MBEDTLS)
> --
> 2.39.2
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH 1/2] kernel: usb: Autoprobe g_serial

2023-11-11 Thread Linus Walleij
For devices using USB gadget serial we need to probe the modules
usb_f_acm and g_serial in order, then the available UDC (USB device
controller) interface will be hooked up to a serial port as
/dev/ttyGS0. (On the host side this appears as /dev/ttyACM0
when plugging in the USB cable.)

I don't quite understand why this wasn't done before for the
module explicitly called kmod-usb-serial.

Before this patch we have to enter a console and type

  modprobe g_serial

To get a serial console on /dev/ttyGS0, after this it is
automatic.

Since you might only have the serial console, it is a bit
catch 22 to have to use a serial console to activate the
serial console.

Signed-off-by: Linus Walleij 
---
 package/kernel/linux/modules/usb.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/kernel/linux/modules/usb.mk 
b/package/kernel/linux/modules/usb.mk
index 0a5f5a8993c9..f54dc4380737 100644
--- a/package/kernel/linux/modules/usb.mk
+++ b/package/kernel/linux/modules/usb.mk
@@ -207,7 +207,7 @@ define KernelPackage/usb-gadget-serial
$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_obex.ko \
$(LINUX_DIR)/drivers/usb/gadget/function/usb_f_serial.ko \
$(LINUX_DIR)/drivers/usb/gadget/legacy/g_serial.ko
-  AUTOLOAD:=$(call AutoLoad,52,usb_f_acm)
+  AUTOLOAD:=$(call AutoLoad,52,usb_f_acm g_serial)
   $(call AddDepends/usb)
 endef
 

-- 
2.34.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH 2/2] gemini: Activate serial USB console on the DNS-313

2023-11-11 Thread Linus Walleij
This brings up a serial console on the USB device port of
the DNS-313.

Signed-off-by: Linus Walleij 
---
 target/linux/gemini/Makefile   | 2 +-
 target/linux/gemini/base-files/etc/inittab | 4 
 target/linux/gemini/image/Makefile | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/target/linux/gemini/Makefile b/target/linux/gemini/Makefile
index b7f1962c9a59..238d8c4f0c4d 100644
--- a/target/linux/gemini/Makefile
+++ b/target/linux/gemini/Makefile
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
 ARCH:=arm
 BOARD:=gemini
 BOARDNAME:=Cortina Systems CS351x
-FEATURES:=squashfs pci rtc usb dt gpio display ext4 rootfs-part boot-part
+FEATURES:=squashfs pci rtc usb usbgadget dt gpio display ext4 rootfs-part 
boot-part
 CPU_TYPE:=fa526
 SUBTARGETS:=generic
 
diff --git a/target/linux/gemini/base-files/etc/inittab 
b/target/linux/gemini/base-files/etc/inittab
new file mode 100644
index ..253036402d83
--- /dev/null
+++ b/target/linux/gemini/base-files/etc/inittab
@@ -0,0 +1,4 @@
+::sysinit:/etc/init.d/rcS S boot
+::shutdown:/etc/init.d/rcS K shutdown
+::askconsole:/usr/libexec/login.sh
+ttyGS0::askfirst:/usr/libexec/login.sh
diff --git a/target/linux/gemini/image/Makefile 
b/target/linux/gemini/image/Makefile
index 3fce3172ed63..6a0397e0503f 100644
--- a/target/linux/gemini/image/Makefile
+++ b/target/linux/gemini/image/Makefile
@@ -168,7 +168,7 @@ define Device/dlink_dns-313
DEVICE_VENDOR := D-Link
DEVICE_MODEL := DNS-313 1-Bay Network Storage Enclosure
DEVICE_DTS := gemini-dlink-dns-313
-   DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
+   DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) kmod-usb-gadget 
kmod-usb-gadget-serial
BLOCKSIZE := 1k
FILESYSTEMS := ext4
IMAGES := factory.bin.gz

-- 
2.34.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH 0/2] Enable USB serial console on the D-Link DNS-313

2023-11-11 Thread Linus Walleij
This patch set makes it possible to plug in a USB cable
into the device USB B receptacle on the DNS-313 and
it will appear as /dev/ttyACM0 on the host and there will
be a serial console on it, at 115200 baud.

This is useful for users who don't like to solder in
their device to get a serial console.

The custom inittab is a bit ugly, but I've seen that this
seems to be what other devices do, other ideas welcome.

Signed-off-by: Linus Walleij 
---
Linus Walleij (2):
  kernel: usb: Autoprobe g_serial
  gemini: Activate serial USB console on the DNS-313

 package/kernel/linux/modules/usb.mk| 2 +-
 target/linux/gemini/Makefile   | 2 +-
 target/linux/gemini/base-files/etc/inittab | 4 
 target/linux/gemini/image/Makefile | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)
---
base-commit: b7cf706539eb3a788441c8a8debaa8c36e5c54cf
change-id: 2023-dns313-usb-serial-b9ac47e3a27e

Best regards,
-- 
Linus Walleij 


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH ustream-ssl 2/2] cmake: Fail if undefined symbols are used

2023-11-11 Thread Hauke Mehrtens
Make the linking of the shared library fail when undefined symbols are
used. Linking undefined symbols in a shared library normally works and
the linking of the binary using the shared library fails. We also
compile some example applications and they failed already.

Signed-off-by: Hauke Mehrtens 
---
 CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2de6590..f4dca0d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,7 @@ ENDIF()
 ADD_DEFINITIONS(-Wno-unused-parameter -Wmissing-declarations)
 
 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
+SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
 
 IF(MBEDTLS)
   ADD_DEFINITIONS(-DHAVE_MBEDTLS)
-- 
2.39.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH ustream-ssl 1/2] ustream-mbedtls: Add compatibility with Mbed TLS 3.0.0

2023-11-11 Thread Hauke Mehrtens
This adds support for compiling the code against Mbed TLS 3.0.0.
It still compiles against Mbed TLS 2.28.

The following changes were needed:
 * DES and 3DES was removed
 * mbedtls_pk_context->pk_info is private, use mbedtls_pk_get_type()
   to check if it was initialized
 * mbedtls_pk_parse_keyfile() now gets a random callback
 * mbedtls/certs.h contains test data and is not installed any more and
   not needed.

Signed-off-by: Hauke Mehrtens 
---
 ustream-mbedtls.c | 12 +++-
 ustream-mbedtls.h |  1 -
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ustream-mbedtls.c b/ustream-mbedtls.c
index 7fc7874..1c70cac 100644
--- a/ustream-mbedtls.c
+++ b/ustream-mbedtls.c
@@ -110,9 +110,15 @@ static const int default_ciphersuites_client[] =
AES_CBC_CIPHERS(ECDHE_ECDSA),
AES_CBC_CIPHERS(ECDHE_RSA),
AES_CBC_CIPHERS(DHE_RSA),
+/* Removed in Mbed TLS 3.0.0 */
+#ifdef MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA,
+#endif
AES_CIPHERS(RSA),
+/* Removed in Mbed TLS 3.0.0 */
+#ifdef MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA
MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA,
+#endif
0
 };
 
@@ -171,7 +177,7 @@ static void ustream_ssl_update_own_cert(struct 
ustream_ssl_ctx *ctx)
if (!ctx->cert.version)
return;
 
-   if (!ctx->key.pk_info)
+   if (mbedtls_pk_get_type(&ctx->key) == MBEDTLS_PK_NONE)
return;
 
mbedtls_ssl_conf_own_cert(&ctx->conf, &ctx->cert, &ctx->key);
@@ -206,7 +212,11 @@ __hidden int __ustream_ssl_set_key_file(struct 
ustream_ssl_ctx *ctx, const char
 {
int ret;
 
+#if (MBEDTLS_VERSION_NUMBER >= 0x0300)
+   ret = mbedtls_pk_parse_keyfile(&ctx->key, file, NULL, _random, NULL);
+#else
ret = mbedtls_pk_parse_keyfile(&ctx->key, file, NULL);
+#endif
if (ret)
return -1;
 
diff --git a/ustream-mbedtls.h b/ustream-mbedtls.h
index e622e5e..7e7c699 100644
--- a/ustream-mbedtls.h
+++ b/ustream-mbedtls.h
@@ -21,7 +21,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
2.39.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: netifd issue

2023-11-11 Thread Hannu Nyman

Felix Fietkau kirjoitti 10.11.2023 klo 16.38:

On 10.11.23 15:21, e9hack wrote:
Too fast. I did reboot with the old version again. The patched version 
does work.


Fix pushed, thanks for testing!

- Felix



Thanks,

I tested the current netifd with the fix, and it seems to work ok, again.

Please remember to backport the fixed netifd to 23.05, as currently 23.05 has 
the faulty version.



Hannu



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel