From: planck kernel size experiment Subject: ipv4: collapse unreachable advanced FIB control helpers With route netlink absent, this kernel can create routes only through its legacy ioctls and automatic address management. Neither path supplies a standalone nexthop ID or a route-metrics attribute blob. Replace the generic nexthop object engine and metrics parser with fixed-policy helpers: ordinary routes share dst_default_metrics, attribute-bearing routes are rejected, and standalone nexthop lookup cannot succeed. The route-netlink protocol parser is removed entirely because its last live caller disappeared with the handler tables. Measured standalone effect on RV32: linked sections shrank by 1,252 bytes (896 text and 356 data), while Image stayed at 1,208,504 bytes because of alignment; the TCP/UDP/Minix acceptance proof still passed. --- a/net/ipv4/Makefile +++ b/net/ipv4/Makefile @@ -17,5 +17,5 @@ obj-y := route.o inetpeer.o protocol.o \ fib_frontend.o fib_semantics.o fib_trie.o fib_notifier.o \ inet_fragment.o \ - metrics.o netlink.o nexthop.o udp_tunnel_stub.o + planck_fib_control.o udp_tunnel_stub.o obj-$(CONFIG_NET_IP_TUNNEL) += ip_tunnel.o --- /dev/null +++ b/net/ipv4/planck_fib_control.c @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Fixed policy for the ioctl-created, single-next-hop logger routes. */ + +#include +#include +#include +#include +#include + +struct dst_metrics *ip_fib_metrics_init(struct nlattr *fc_mx, int fc_mx_len, + struct netlink_ext_ack *extack) +{ + if (fc_mx || fc_mx_len) + return ERR_PTR(-EOPNOTSUPP); + return (struct dst_metrics *)&dst_default_metrics; +} + +struct nexthop *nexthop_find_by_id(struct net *net, u32 id) +{ + return NULL; +} + +int fib_check_nexthop(struct nexthop *nh, u8 scope, + struct netlink_ext_ack *extack) +{ + return -EOPNOTSUPP; +} + +void nexthop_free_rcu(struct rcu_head *head) +{ +}