  Distributed protocols are widely used to support network functions such as
clock synchronization and multicast. As the network gets larger and faster, it
is increasingly challenging for these protocols to react quickly to network
events. The theory community has made significant progress in developing
distributed message passing algorithms with improved convergence times. With
the emerging programmability at switches, it now becomes feasible to adopt and
adapt these theoretical advances for networking functions. In this paper, we
propose FRANCIS, a new framework for running message passing algorithms on
programmable switches to enable fast reactions to network events in large
networks. We introduce an execution engine with computing and communication
primitives for supporting message passing algorithms in P4 switches. We
exemplify the framework's usefulness by improving the resiliency and reaction
times of clock synchronization and source-routed multicast. In particular, our
approach allows lower clock drift than Sundial and PTP, quickly recovers from
multiple failures, and reduces the time uncertainty bound by up to 5x. Compared
with state-of-the-art multicast solutions, our approach uses packet headers up
to 33\% smaller and has an order of magnitude faster reaction time.
