[Nix-dev] [systemd] ip-up target params

Mathijs Kwik mathijs at bluescreen303.nl
Wed Sep 12 17:12:12 CEST 2012


Hi all,

Currently (with upstart), network interfaces tigger ip-up once dhcpcd
assigns them an ip-address.
Upstart triggers had an option to supply extra params, and dhcpcd's
hook used this to supply information on which interface got connected,
and - if on wireless - to which AP a connection was made.

I have a somewhat complicated networking setup, so I use these features a lot.
Depending on which wifi AP (trusted/untrusted), I enable different
firewall rules, openvpn tunnels and routes.

Now, I think I should just define systemd targets for these
environments (trusted/untrusted/home) and add the services I want to
these.
However, I need a way to tell upstart which of these targets to (de)activate.
Currently, "ip-up" is hardcoded in dhcpcd's hook, "ip-down" is
disabled (used to trigger when disconnecting wifi), and if multiple
interfaces come up, nothing will happen if the ip-up target was
already reached.

While I can just override dhcpcd's exit hook, I would like to turn
this into something a bit more generic.
Perhaps we can automatically setup targets for all interfaces nix
knows about, so people can put services "in" them.
In extension to this, a config option that optionally maps BSSID ->
targetname can be compiled into a case statement for dhcpcd.exit-hook.

Does anyone else think this is useful?
Or should I keep it out of nixos for simplicity and just tackle it in
my own config?
Please share your thoughts.

Thanks,
Mathijs


More information about the nix-dev mailing list