dde_linux: move lxip -> legacy_lxip

move lxip stack to 'legacy_lxip' so it can be revived easily.

issue #5104
This commit is contained in:
Sebastian Sumpf 2023-08-31 14:57:23 +02:00 committed by Christian Helmuth
parent f19cd8416e
commit 360d38c36d
36 changed files with 134 additions and 21 deletions

View File

@ -1,5 +1,5 @@
LXIP_CONTRIB_DIR := $(call select_from_ports,dde_linux)/src/lib/lxip
SRC_DIR := $(REP_DIR)/src/lib/lxip
SRC_DIR := $(REP_DIR)/src/lib/legacy_lxip
# architecture-dependent includes
ifeq ($(filter-out $(SPECS),x86),)
@ -21,9 +21,9 @@ ifeq ($(filter-out $(SPECS),arm),)
ARCH_SRC_INC_DIR += $(REP_DIR)/src/include/spec/arm_v7
endif # arm_v7
endif # arm
ifeq ($(filter-out $(SPECS),arm_64),)
ARCH_SRC_INC_DIR += $(REP_DIR)/src/include/spec/arm_64
endif # arm_v7
ifeq ($(filter-out $(SPECS),arm_v8),)
ARCH_SRC_INC_DIR += $(REP_DIR)/src/include/spec/arm_v8
endif # arm_v8
#
# The order of include-search directories is important, we need to look into

View File

@ -1,6 +1,6 @@
SHARED_LIB = yes
LIB_DIR = $(REP_DIR)/src/lib/lxip
LIB_DIR = $(REP_DIR)/src/lib/legacy_lxip
LIB_INC_DIR = $(LIB_DIR)/include
LIBS += lxip_include format

View File

@ -1,7 +1,7 @@
ifeq ($(called_from_lib_mk),yes)
LXIP_CONTRIB_DIR := $(call select_from_ports,dde_linux)/src/lib/lxip
LX_EMUL_H := $(REP_DIR)/src/lib/lxip/include/lx_emul.h
LX_EMUL_H := $(REP_DIR)/src/lib/legacy_lxip/include/lx_emul.h
#
# Determine the header files included by the contrib code. For each

View File

@ -0,0 +1,113 @@
ip_config.patch
From: Sebastian Sumpf <sebastian.sumpf@genode-labs.com>
---
net/ipv4/ipconfig.c | 55 ++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 45 insertions(+), 10 deletions(-)
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 0bc7412..a92c6e3 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -133,7 +133,7 @@ int ic_proto_enabled __initdata = 0
static int ic_host_name_set __initdata; /* Host name set by us? */
__be32 ic_myaddr = NONE; /* My IP address */
-static __be32 ic_netmask = NONE; /* Netmask for local subnet */
+__be32 ic_netmask = NONE; /* Netmask for local subnet */
__be32 ic_gateway = NONE; /* Gateway IP address */
__be32 ic_addrservaddr = NONE; /* IP Address of the IP addresses'server */
@@ -153,7 +153,7 @@ static char dhcp_client_identifier[253] __initdata;
/* Persistent data: */
static int ic_proto_used; /* Protocol used, if any */
-static __be32 ic_nameservers[CONF_NAMESERVERS_MAX]; /* DNS Server IP addresses */
+__be32 ic_nameservers[CONF_NAMESERVERS_MAX]; /* DNS Server IP addresses */
static u8 ic_domain[64]; /* DNS (not NIS) domain name */
/*
@@ -435,6 +435,33 @@ static int __init ic_setup_routes(void)
return 0;
}
+static int __init ic_delete_routes(void)
+{
+ /* No need to delete device routes, only the default route... */
+
+ if (ic_gateway != NONE) {
+ struct rtentry rm;
+ int err;
+
+ memset(&rm, 0, sizeof(rm));
+ if ((ic_gateway ^ ic_myaddr) & ic_netmask) {
+ pr_err("IP-Config: Gateway not on directly connected network\n");
+ return -1;
+ }
+ set_sockaddr((struct sockaddr_in *) &rm.rt_dst, 0, 0);
+ set_sockaddr((struct sockaddr_in *) &rm.rt_genmask, 0, 0);
+ set_sockaddr((struct sockaddr_in *) &rm.rt_gateway, ic_gateway, 0);
+ rm.rt_flags = RTF_UP | RTF_GATEWAY;
+ if ((err = ic_route_ioctl(SIOCDELRT, &rm)) < 0) {
+ pr_err("IP-Config: Cannot delete default route (%d)\n",
+ err);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
/*
* Fill in default values for all missing parameters.
*/
@@ -1531,24 +1558,24 @@ static int __init ip_auto_config(void)
*/
pr_info("IP-Config: Complete:\n");
- pr_info(" device=%s, hwaddr=%*phC, ipaddr=%pI4, mask=%pI4, gw=%pI4\n",
- ic_dev->name, ic_dev->addr_len, ic_dev->dev_addr,
- &ic_myaddr, &ic_netmask, &ic_gateway);
+ pr_info(" device=%s, len=%u hwaddr=" MAC_FMT ", ipaddr=" IP_FMT ", mask=" IP_FMT " , gw=" IP_FMT "\n",
+ ic_dev->name, ic_dev->addr_len, MAC_ARG(ic_dev->dev_addr),
+ IP_ARG(ic_myaddr), IP_ARG(ic_netmask), IP_ARG(ic_gateway));
pr_info(" host=%s, domain=%s, nis-domain=%s\n",
utsname()->nodename, ic_domain, utsname()->domainname);
- pr_info(" bootserver=%pI4, rootserver=%pI4, rootpath=%s",
- &ic_servaddr, &root_server_addr, root_server_path);
+ pr_info(" bootserver=" IP_FMT ", rootserver=" IP_FMT ", rootpath=%s\n",
+ IP_ARG(ic_servaddr), IP_ARG(root_server_addr), root_server_path);
if (ic_dev_mtu)
pr_cont(", mtu=%d", ic_dev_mtu);
for (i = 0; i < CONF_NAMESERVERS_MAX; i++)
if (ic_nameservers[i] != NONE) {
- pr_info(" nameserver%u=%pI4",
- i, &ic_nameservers[i]);
+ pr_info(" nameserver%u=" IP_FMT,
+ i, IP_ARG(ic_nameservers[i]));
break;
}
for (i++; i < CONF_NAMESERVERS_MAX; i++)
if (ic_nameservers[i] != NONE)
- pr_cont(", nameserver%u=%pI4", i, &ic_nameservers[i]);
+ pr_cont(", nameserver%u=" IP_FMT, i, IP_ARG(ic_nameservers[i]));
pr_cont("\n");
#endif /* !SILENT */
@@ -1621,6 +1648,14 @@ static int __init ip_auto_config_setup(char *addrs)
ic_set_manually = 1;
ic_enable = 1;
+ ic_delete_routes();
+
+ ic_myaddr = NONE;
+ ic_netmask = NONE;
+ ic_gateway = NONE;
+ ic_servaddr = NONE;
+ ic_got_reply = 0;
+
/*
* If any dhcp, bootp etc options are set, leave autoconfig on
* and skip the below static IP processing.

View File

@ -1 +1 @@
201055ff05704fc36e572df199f52e801246f3ca
489d34e0dfdb6dd5cc3c26d1bf69f9b0f06f0a29

View File

@ -16,22 +16,22 @@ HASH_INPUT += $(REP_DIR)/lxip.list
#
# Patches
#
PATCHES += patches/lxip_icmp.patch
PATCHES += patches/lxip_ip_config.patch
PATCHES += patches/lxip_log2.patch
PATCHES += patches/lxip_netlink.patch
PATCHES += patches/lxip_request_sock.patch
PATCHES += patches/lxip_sk_wq.patch
PATCHES += patches/lxip_skbuff_cast.patch
PATCHES += patches/legacy_lxip_icmp.patch
PATCHES += patches/legacy_lxip_ip_config.patch
PATCHES += patches/legacy_lxip_log2.patch
PATCHES += patches/legacy_lxip_netlink.patch
PATCHES += patches/legacy_lxip_request_sock.patch
PATCHES += patches/legacy_lxip_sk_wq.patch
PATCHES += patches/legacy_lxip_skbuff_cast.patch
#IP stack
LXIP_OPT = -p1 -d$(SRC_DIR_LXIP)
PATCH_OPT(patches/lxip_icmp.patch) := $(LXIP_OPT)
PATCH_OPT(patches/lxip_ip_config.patch) := $(LXIP_OPT)
PATCH_OPT(patches/lxip_log2.patch) := $(LXIP_OPT)
PATCH_OPT(patches/lxip_netlink.patch) := $(LXIP_OPT)
PATCH_OPT(patches/lxip_request_sock.patch) := $(LXIP_OPT)
PATCH_OPT(patches/lxip_sk_wq.patch) := $(LXIP_OPT)
PATCH_OPT(patches/lxip_skbuff_cast.patch) := $(LXIP_OPT)
PATCH_OPT(patches/legacy_lxip_icmp.patch) := $(LXIP_OPT)
PATCH_OPT(patches/legacy_lxip_ip_config.patch) := $(LXIP_OPT)
PATCH_OPT(patches/legacy_lxip_log2.patch) := $(LXIP_OPT)
PATCH_OPT(patches/legacy_lxip_netlink.patch) := $(LXIP_OPT)
PATCH_OPT(patches/legacy_lxip_request_sock.patch) := $(LXIP_OPT)
PATCH_OPT(patches/legacy_lxip_sk_wq.patch) := $(LXIP_OPT)
PATCH_OPT(patches/legacy_lxip_skbuff_cast.patch) := $(LXIP_OPT)
# vi: set ft=make :