synit/packaging/packages/synit-config/files/etc/syndicate/services/network.pr

53 lines
1.5 KiB
Promela
Raw Normal View History

<require-service <daemon interface-monitor>>
<require-service <milestone network>>
<depends-on <milestone network> <service-state <daemon interface-monitor> ready>>
2022-02-10 12:40:11 +00:00
<configure-interface "lo" <static "127.0.0.1/8">>
? <configure-interface ?ifname <static ?ipaddr>> [
2022-02-10 12:59:43 +00:00
! <exec ["ip" "address" "add" "dev" $ifname $ipaddr]>
?- ! <exec ["ip" "address" "del" "dev" $ifname $ipaddr] never>
]
? <configure-interface ?ifname <dhcp>> [
<require-service <daemon <udhcpc $ifname>>>
]
? <run-service <daemon <udhcpc ?ifname>>> [
2023-10-31 22:40:41 +00:00
# We use a custom script that gives mobile-data devices a sensible routing metric
<daemon <udhcpc $ifname> ["udhcpc" "-i" $ifname "-fR" "-s" "/usr/lib/synit/udhcpc.script"]>
]
<daemon interface-monitor {
argv: "/usr/lib/synit/interface-monitor"
protocol: application/syndicate
}>
? <machine-dataspace ?machine> [
? <service-object <daemon interface-monitor> ?cap> [
$cap {
machine: $machine
}
]
2022-02-10 12:40:11 +00:00
$machine ? <interface ?ifname _ _ _ _ _ _> [
$log ! <log "-" { saw-machine-interface: $ifname }>
$config [
2022-02-10 12:59:43 +00:00
! <exec ["ip" "link" "set" $ifname "up"]>
?- ! <exec ["ip" "link" "set" $ifname "down"] never>
2022-02-10 12:40:11 +00:00
]
]
$machine ? <interface ?ifname _ normal up up carrier _> [
$config <configure-interface $ifname <dhcp>>
]
2022-02-26 14:04:12 +00:00
$machine ? <interface ?ifname _ normal up unknown carrier _> [
$config <configure-interface $ifname <dhcp>>
]
2022-02-07 13:34:18 +00:00
2022-02-10 12:40:11 +00:00
$machine ? <route ?addressFamily default _ _ _ _> [
$config <default-route $addressFamily>
2022-02-07 13:34:18 +00:00
]
]