forked from DGNum/liminix
add pppoe
This commit is contained in:
parent
c6e56b1637
commit
c1835d97ee
6 changed files with 164 additions and 0 deletions
|
@ -77,6 +77,7 @@ in {
|
|||
name = "${interface.device}.odhcp";
|
||||
run = "odhcpcd ${interface.device}";
|
||||
};
|
||||
pppoe = callPackage ./networking/pppoe.nix {};
|
||||
};
|
||||
services = {
|
||||
inherit longrun oneshot bundle target;
|
||||
|
|
48
pkgs/liminix-tools/networking/pppoe.nix
Normal file
48
pkgs/liminix-tools/networking/pppoe.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
liminix
|
||||
, lib
|
||||
, busybox
|
||||
, ppp
|
||||
, pppoe
|
||||
, writeShellScript
|
||||
} :
|
||||
let
|
||||
inherit (liminix.services) longrun;
|
||||
ip-up = writeShellScript "ip-up" ''
|
||||
action=$1
|
||||
env > /run/udhcp.values
|
||||
|
||||
set_address() {
|
||||
ip address replace $ip/$mask dev $interface
|
||||
mkdir -p data/outputs
|
||||
for i in lease mask ip router siaddr dns serverid subnet opt53 interface ; do
|
||||
echo ''${!i} > data/outputs/$i
|
||||
done
|
||||
}
|
||||
case $action in
|
||||
deconfig)
|
||||
ip address flush $interface
|
||||
ip link set up dev $interface
|
||||
;;
|
||||
bound)
|
||||
# this doesn't actually replace, it adds a new address.
|
||||
set_address
|
||||
;;
|
||||
renew)
|
||||
set_address
|
||||
;;
|
||||
nak)
|
||||
echo "received NAK on $interface"
|
||||
;;
|
||||
esac
|
||||
'';
|
||||
|
||||
in
|
||||
interface: {
|
||||
synchronous ? false
|
||||
, ppp-options ? []
|
||||
, ...
|
||||
} @ args: longrun {
|
||||
name = "${interface.device}.ppppoe";
|
||||
run = "${ppp}/bin/pppd pty '${pppoe}/bin/pppoe -I ${interface.device}' ${lib.concatStringsSep " " ppp-options}" ;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue