Scripting the Linux Routing Table with Lua


Lourival Vieira Neto
Marcel Moura
Ana Lúcia de Moura
Roberto Ierusalimschy



Session Type




Lunatik is a framework for scripting the Linux kernel with Lua [1], based on the design concept of Scriptable Operating Systems [2]. This framework was previously used for scripting Netfilter and XDP subsystems [3], allowing users to create complex network filters using Lua. For instance, it has been used for filtering L7 traffic such as HTTP and HTTPS.

In this talk we present the evolution of this framework and its usage on implementing a kernel-level adaptive routing service. This service allows the system to monitor the reliability of a network route and adjust its routing table dynamically in case of failure. For instance, a home router might use such service to fall back to the cellular network using a mobile phone as a gateway. For implementing this adaptive routing service, we relied on Lunatik libraries for binding kernel subsystems, such as netdevice notification chain, kthread, socket, RCU and FIB. This service also implements a protocol that allows nodes to advertise themselves as alternative gateways and the router to notify a node that it has been elected as the new gateway (or that the network has been reestablished and using that node as gateway is not necessary anymore).

[1] [2] [3]