From: planck kernel size experiment Subject: fib: remove observer and netlink notification fanout No route-netlink socket, offload driver, or FIB observer exists in this fixed kernel. Route insertion nevertheless built netlink messages and traversed a generic notifier chain. Make route notifications inert, replace the IPv4 observer registration with local success stubs, and omit the now-unreferenced core notifier implementation. Route-table mutation and lookup are unchanged; only delivery to consumers that cannot exist is removed. Measured effect on RV32: linked sections shrank by 6,328 bytes and Image crossed an alignment boundary, shrinking by 8,192 bytes (1,208,504 to 1,200,312 bytes), with the TCP/UDP/Minix acceptance proof still passing. --- a/net/core/Makefile +++ b/net/core/Makefile @@ -12,7 +12,7 @@ obj-y += dev.o dev_api.o dev_addr_lists.o dst.o netevent.o \ neighbour.o rtnetlink.o utils.o link_watch.o \ dev_ioctl.o tso.o \ - fib_notifier.o xdp.o flow_offload.o gro.o \ + xdp.o flow_offload.o gro.o \ gso.o obj-$(CONFIG_NETDEV_ADDR_LIST_TEST) += dev_addr_lists_test.o --- a/net/ipv4/Makefile +++ b/net/ipv4/Makefile @@ -13,7 +13,7 @@ obj-y := route.o inetpeer.o protocol.o \ tcp_offload.o tcp_plb.o datagram.o raw.o udp.o \ udp_offload.o arp.o icmp.o devinet.o af_inet.o planck_unicast.o \ - fib_frontend.o fib_semantics.o fib_trie.o fib_notifier.o \ + fib_frontend.o fib_semantics.o fib_trie.o \ inet_fragment.o \ planck_fib_control.o udp_tunnel_stub.o --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -543,35 +543,5 @@ void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, int dst_len, u32 tb_id, const struct nl_info *info, unsigned int nlm_flags) { - struct fib_rt_info fri; - struct sk_buff *skb; - u32 seq = info->nlh ? info->nlh->nlmsg_seq : 0; - int err = -ENOBUFS; - - skb = nlmsg_new(fib_nlmsg_size(fa->fa_info), GFP_KERNEL); - if (!skb) - goto errout; - - fri.fi = fa->fa_info; - fri.tb_id = tb_id; - fri.dst = key; - fri.dst_len = dst_len; - fri.dscp = fa->fa_dscp; - fri.type = fa->fa_type; - fri.offload = READ_ONCE(fa->offload); - fri.trap = READ_ONCE(fa->trap); - fri.offload_failed = READ_ONCE(fa->offload_failed); - err = fib_dump_info(skb, info->portid, seq, event, &fri, nlm_flags); - if (err < 0) { - /* -EMSGSIZE implies BUG in fib_nlmsg_size() */ - WARN_ON(err == -EMSGSIZE); - kfree_skb(skb); - goto errout; - } - rtnl_notify(skb, info->nl_net, info->portid, RTNLGRP_IPV4_ROUTE, - info->nlh, GFP_KERNEL); - return; -errout: - rtnl_set_sk_err(info->nl_net, RTNLGRP_IPV4_ROUTE, err); } --- a/net/ipv4/planck_fib_control.c +++ b/net/ipv4/planck_fib_control.c @@ -5,6 +5,8 @@ #include #include +#include #include +#include #include struct dst_metrics *ip_fib_metrics_init(struct nlattr *fc_mx, int fc_mx_len, @@ -29,3 +31,25 @@ void nexthop_free_rcu(struct rcu_head *head) { } + +int call_fib4_notifier(struct notifier_block *nb, + enum fib_event_type event_type, + struct fib_notifier_info *info) +{ + return 0; +} + +int call_fib4_notifiers(struct net *net, enum fib_event_type event_type, + struct fib_notifier_info *info) +{ + return 0; +} + +int fib4_notifier_init(struct net *net) +{ + return 0; +} + +void fib4_notifier_exit(struct net *net) +{ +}