Skip to content
This repository

A service-centric network stack and architecture

branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time


For more and up-to-date information, see:



The first time you check out the source code, prepare the build system:


To configure the build system (with common options):

./configure [ --enable-debug | --disable-kernel | --disable-service-router ]\

To build:


Directory structure


headers that are shared between components under src/.


source code.


library with 'common' functionality.


stack code.


stack code specific for the linux kernel.


stack code specific for user level.


user space control daemon for the stack that takes local service registrations and passes them to a controller in the network.


test programs for the stack.


daemon that translates between PF_INET and PF_SERVAL TCP socket.


tools for controlling the Serval stack.


library for communicating with and controlling Serval stacks, either locally or remotely.


socket API abstraction for client applications interacting with the user-level version of the stack.


Java bindings that make it possible to write Serval applications in Java.


Android-specific files and applications.

Cross-compile Linux kernel module


  • Kernel source code matching your cross-compile environment.
  • A tool-chain for your cross-compile architecture.

Run (./ ./configure to generate Makefiles

Enter src/stack and issue the following command (example for Android):

make serval.ko ARCH=arm CROSS_COMPILE=<Path to NDK)/build/prebuilt/darwin-x86/arm-eabi-4.4.0/bin/arm-eabi- KDIR=<Path to kernel source>

Running Serval in kernel mode

Insert the Serval kernel module:

insmod ./src/stack/serval.ko

Start servd (optional):


Wait until a service router is discovered or a timeout occurs (in which case host control mode is set).

Start an application, e.g.,:


Access internal state and debug output through /proc/net/serval/ and configuration parameters through /proc/sys/net/serval/.

When done, shut down all clients and servd, then remove Serval module:

rmmod serval

Running Serval in user-level mode

Start the user-level stack

./src/stack/serval [ -i <iface> ]

Start servd (optional):


Wait until a service router is discovered or a timeout occurs (in which case host control mode is set).

Start an application, e.g.:


Connect with telnet to for printing internal state.

Configuration Options

/proc/sys/net/serval/auto_migrate             - Enable/Disable automigration between interfaces
/proc/sys/net/serval/debug                    - Set debug level
/proc/sys/net/serval/inet_to_serval           - Enable/Disable socket hijacking, where legacy (AF_INET) sockets are turned into Serval sockets
/proc/sys/net/serval/sal_forward              - Enable/Disable forwarding in SAL
/proc/sys/net/serval/sal_max_retransmits      - Max SAL retransmits
/proc/sys/net/serval/service_resolution_mode  - Specifies which rules to use when resolving services. 0=All, 1=Demux only, 2=forward only, 3=Anycast 
/proc/sys/net/serval/udp_encap                - Enable/Disable UDP encapsulation
/proc/sys/net/serval/udp_encap_client_port    - List/set client UDP encap port
/proc/sys/net/serval/udp_encap_server_port    - List/set server UDP encap port
Something went wrong with that request. Please try again.