From: planck kernel size experiment Subject: ipv4: stop retaining unreachable route-netlink handlers The route-netlink socket and its core dispatch table were removed earlier, but IPv4 still registered its private NEWROUTE, DELROUTE and GETROUTE handler tables. Those data references kept the parsers, dumpers and reply builders in the final image even though no request could reach them. Do not register the IPv4 tables. The logger's legacy address and route ioctls remain intact, including SIOCADDRT used for its fixed default route. Measured standalone effect on RV32: Image stayed at 1,208,504 bytes because the removed code became alignment slack; the TCP/UDP/Minix acceptance proof still passed. The slack is realized by the following FIB cuts. --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -1691,15 +1691,6 @@ static struct pernet_operations fib_net_ops = { .exit_batch = fib_net_exit_batch, }; -static const struct rtnl_msg_handler fib_rtnl_msg_handlers[] __initconst = { - {.protocol = PF_INET, .msgtype = RTM_NEWROUTE, - .doit = inet_rtm_newroute, .flags = RTNL_FLAG_DOIT_PERNET}, - {.protocol = PF_INET, .msgtype = RTM_DELROUTE, - .doit = inet_rtm_delroute, .flags = RTNL_FLAG_DOIT_PERNET}, - {.protocol = PF_INET, .msgtype = RTM_GETROUTE, .dumpit = inet_dump_fib, - .flags = RTNL_FLAG_DUMP_UNLOCKED | RTNL_FLAG_DUMP_SPLIT_NLM_DONE}, -}; - void __init ip_fib_init(void) { fib_trie_init(); @@ -1708,6 +1700,4 @@ void __init ip_fib_init(void) register_netdevice_notifier(&fib_netdev_notifier); register_inetaddr_notifier(&fib_inetaddr_notifier); - - rtnl_register_many(fib_rtnl_msg_handlers); } --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -3716,11 +3716,6 @@ static __net_initdata struct pernet_operations ipv4_inetpeer_ops = { }; #endif /* CONFIG_IP_ROUTE_CLASSID */ -static const struct rtnl_msg_handler ip_rt_rtnl_msg_handlers[] __initconst = { - {.protocol = PF_INET, .msgtype = RTM_GETROUTE, - .doit = inet_rtm_getroute, .flags = RTNL_FLAG_DOIT_UNLOCKED}, -}; - int __init ip_rt_init(void) { void *idents_hash; @@ -3776,8 +3771,6 @@ int __init ip_rt_init(void) xfrm_init(); xfrm4_init(); #endif - rtnl_register_many(ip_rt_rtnl_msg_handlers); - #ifdef CONFIG_SYSCTL register_pernet_subsys(&sysctl_route_ops); #endif