How to check state
There are 4 states in system, check state by:
make test_state
INIT
- Config exists - False
- Config_queued exists - False
- System config exists - False
- Service running - False
CONFGENED
- Config exists - False
- Config_queued exists - True
- System config exists - False
- Service running - False
RUNNING
In this state, config and config_queued are exactly the same
- Config exists - True
- Config_queued exists - True
- System config exists - True
- Service running - True
CONFQUEUED
In this state, config and config_queued are probably NOT the same
- Config exists - True
- Config_queued exists - True
- System config exists - True
- Service running - True
Further explanation of the attributes
- Config
- Config_queued
- System config exists - When it is true, systems files were replaced by configurations that are generated by routing project
Service running - When it is true, service status is active and iptables rules exist, e.g, in dhcp ubuntu 18.04 mode, service status and iptables rules shown as below:
Service status
● routing.service - Routing Loaded: loaded (/etc/systemd/system/routing.service; enabled; vendor preset: enabled) Active: active (exited) since Mon 2018-12-17 15:35:45 CST; 52min ago Process: 1839 ExecStart=/usr/bin/make -f /etc/routing/Makefile start (code=exited, status=0/SUCCESS) Main PID: 1839 (code=exited, status=0/SUCCESS) Tasks: 0 Memory: 0B CPU: 0 CGroup: /system.slice/routing.service
iptables rules
-P POSTROUTING ACCEPT -A POSTROUTING -o enp2s0 -j MASQUERADE -P FORWARD ACCEPT -A FORWARD -i enp2s0 -o br0 -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m conntrack --ctstate NEW -j ACCEPT -A FORWARD -i enp2s0 -o br0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT -A FORWARD -i br0 -o enp2s0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT