diff --git a/patches/routing/to-upstream/0001-routing-cjdns-fix-compiling-on-gcc8.patch b/patches/routing/to-upstream/0001-routing-cjdns-fix-compiling-on-gcc8.patch
new file mode 100644
index 0000000000000000000000000000000000000000..dba7dae13b63e0cac8302470608f9250f361271e
--- /dev/null
+++ b/patches/routing/to-upstream/0001-routing-cjdns-fix-compiling-on-gcc8.patch
@@ -0,0 +1,103 @@
+From 571bd42e38e60b3e2a3f5a5a1cce9b0e21a9ad13 Mon Sep 17 00:00:00 2001
+From: Tomas Zak <tomas.zak@turris.com>
+Date: Wed, 3 Jul 2024 10:48:09 +0200
+Subject: [PATCH] routing/cjdns: fix compiling on gcc8
+
+Added condition to remove -Wno_overread warning if toolchain
+is lower than version 11, based on
+recommendation (https://github.com/NixOS/nixpkgs/pull/168997)
+Added two patches from openwrt stream.
+patch3.10 (1df5290b92625823bb9725a5406383116463f3ac)
+invalid-pointer (d710a7938977c84d6ea0f74b21dc50111e5e968c)
+In previous patch there was error with empty intcmp.
+This commit fix error in in 26c38a17393e8771be6ed2cadb025c6c5e5f0b26
+Rename TARGET_CCFLAGS to EXTRA_TARGET_CFLAGS, because TARGET_CCFLAGS is for C++ stuff.
+---
+ cjdns/Makefile                              | 11 ++++++++--
+ cjdns/patches/030-fix-invalid-pointer.patch | 23 +++++++++++++++++++++
+ cjdns/patches/040-gyp-python_310.patch      | 15 ++++++++++++++
+ 3 files changed, 47 insertions(+), 2 deletions(-)
+ create mode 100644 cjdns/patches/030-fix-invalid-pointer.patch
+ create mode 100644 cjdns/patches/040-gyp-python_310.patch
+
+diff --git a/cjdns/Makefile b/cjdns/Makefile
+index 1f8592b..6458a07 100644
+--- a/cjdns/Makefile
++++ b/cjdns/Makefile
+@@ -74,14 +74,21 @@ ifneq ($(CONFIG_USE_UCLIBC),)
+ PKG_DO_VARS+= UCLIBC=1
+ endif
+ 
++# Check if version compiler is ver. 8, then overread is ignored
++TOOLCHAIN_CC=$(word 1, $(subst ., ,${GCC_VERSION}))
++ifneq ($(TOOLCHAIN_CC), 8)
++NULL :=
++EXTRA_TARGET_CFLAGS=$(NULL) -Wno-error=stringop-overread
++endif
++
+ define Build/Compile
+ 	$(INSTALL_DIR) $(PKG_BUILD_DIR)/tmp
+ 	(cd $(PKG_BUILD_DIR) && \
+ 	CROSS="true" \
+-	CC="$(TARGET_CC)" \
++	CC="$(TARGET_CC_NOCACHE)" \
+ 	AR="$(TARGET_AR)" \
+ 	RANLIB="$(TARGET_RANLIB)" \
+-	CFLAGS="$(TARGET_CFLAGS) -U_FORTIFY_SOURCE -Wno-error=array-bounds -Wno-error=stringop-overflow -Wno-error=stringop-overread" \
++	CFLAGS="$(TARGET_CFLAGS) -U_FORTIFY_SOURCE -Wno-error=array-bounds -Wno-error=stringop-overflow$(EXTRA_TARGET_CFLAGS)" \
+ 	LDFLAGS="$(TARGET_LDFLAGS)" \
+ 	SYSTEM="linux" \
+ 	TARGET_ARCH="$(CONFIG_ARCH)" \
+diff --git a/cjdns/patches/030-fix-invalid-pointer.patch b/cjdns/patches/030-fix-invalid-pointer.patch
+new file mode 100644
+index 0000000..ae988a9
+--- /dev/null
++++ b/cjdns/patches/030-fix-invalid-pointer.patch
+@@ -0,0 +1,23 @@
++--- a/net/SwitchPinger_admin.c
+++++ b/net/SwitchPinger_admin.c
++@@ -78,8 +78,10 @@ static void adminPing(Dict* args, void*
++     uint32_t timeout = (timeoutPtr) ? *timeoutPtr : DEFAULT_TIMEOUT;
++     uint64_t path;
++     String* err = NULL;
+++    String* pathNotParsable = String_CONST("path was not parsable.");
+++    String* noOpenSlots = String_CONST("no open slots to store ping, try later.");
++     if (pathStr->len != 19 || AddrTools_parsePath(&path, (uint8_t*) pathStr->bytes)) {
++-        err = String_CONST("path was not parsable.");
+++        err = pathNotParsable;
++     } else {
++         struct SwitchPinger_Ping* ping = SwitchPinger_newPing(path,
++                                                               data,
++@@ -89,7 +91,7 @@ static void adminPing(Dict* args, void*
++                                                               context->switchPinger);
++         if (keyPing && *keyPing) { ping->type = SwitchPinger_Type_KEYPING; }
++         if (!ping) {
++-            err = String_CONST("no open slots to store ping, try later.");
+++            err = noOpenSlots;
++         } else {
++             ping->onResponseContext = Allocator_clone(ping->pingAlloc, (&(struct Ping) {
++                 .context = context,
+diff --git a/cjdns/patches/040-gyp-python_310.patch b/cjdns/patches/040-gyp-python_310.patch
+new file mode 100644
+index 0000000..abff213
+--- /dev/null
++++ b/cjdns/patches/040-gyp-python_310.patch
+@@ -0,0 +1,15 @@
++--- a/node_build/dependencies/libuv/build/gyp/pylib/gyp/common.py
+++++ b/node_build/dependencies/libuv/build/gyp/pylib/gyp/common.py
++@@ -4,7 +4,11 @@
++ 
++ from __future__ import with_statement
++ 
++-import collections
+++try:
+++  # Python 3.10
+++  from six.moves import collections_abc as collections
+++except ImportError:
+++  import collections
++ import errno
++ import filecmp
++ import os.path
+-- 
+2.45.2
+