--dhcp-luascript=<path>
Specify a script written in Lua, to be run when leases are created, destroyed or changed. To use this option, dnsmasq must be compiled with the correct support. The Lua interpreter is initialised once, when dnsmasq starts, so that global variables persist between lease events. The Lua code must define a lease function, and may provide init and shutdown functions, which are called, without arguments when dnsmasq starts up and terminates. It may also provide a tftp function.

The lease function receives the information detailed in --dhcp-script. It gets two arguments, firstly the action, which is a string containing, "add", "old" or "del", and secondly a table of tag value pairs. The tags mostly correspond to the environment variables detailed above, for instance the tag "domain" holds the same data as the environment variable DNSMASQ_DOMAIN. There are a few extra tags which hold the data supplied as arguments to --dhcp-script. These are mac_address, ip_address and hostname for IPv4, and client_duid, ip_address and hostname for IPv6.

The tftp function is called in the same way as the lease function, and the table holds the tags destination_address, file_name and file_size.

The arp and arp-old functions are called only when enabled with --script-arp and have a table which holds the tags mac_address and client_address.