summaryrefslogtreecommitdiff
path: root/config/networking/services/igmpproxy.nix
blob: d3ac7f37aff338b8da66eea26b4a57318c64b809 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
  lib,
  pkgs,
  ...
}: let
  upstream = "wan";
  downstream = ["iot"];
  netdevServices = builtins.map (iface: "${iface}-netdev.service") ([upstream] ++ downstream);
  conf = pkgs.writeText "igmpproxy.conf" (''
      phyint ${upstream} upstream ratelimit 0 threshold 1
    ''
    + lib.concatMapStrings (iface: ''
      phyint ${iface} downstream ratelimit 0 threshold 1
    '')
    downstream);
in {
  systemd.services.igmpproxy = {
    description = "Multicast router utilizing IGMP forwarding";
    wantedBy = ["multi-user.target"];
    after = ["kea-dhcp4-server.service"] ++ netdevServices;
    bindsTo = netdevServices;
    path = [pkgs.igmpproxy];
    script = "igmpproxy -v -n ${conf}";
  };
}