HenriWahl / dhcpy6d

MAC address aware DHCPv6 server written in Python
https://dhcpy6d.de
GNU General Public License v2.0
94 stars 27 forks source link

Handling of prefix delegation when machine running dhcpy6d reboots #57

Closed FelixJacobi closed 2 years ago

FelixJacobi commented 2 years ago

Scenario: I have the following class defined in dhcpy6d:

[class_fixed_dmz]
addresses = fixed fixed_ta
interface = dmz
nameserver = fd00::53
ntp_server = 2003:a:838:8f17::1 fd59:3f01:6a1e:2017::1
advertise = addresses prefixes
call_up = sudo /usr/sbin/dhcpy6d-add-route $prefix$/$length$ $router$ dmz
call_down = sudo /usr/sbin/dhcpy6d-del-route $prefix$/$length$ $router$ dmz
filter_mac = .*

and I am using the following script as hook for the class:

router.jacobi-bs.de ~ # cat =dhcpy6d-add-route 
#!/bin/sh
set -e

NAME="$(basename "$0")"

if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]
then
  echo "Usage: $NAME PREFIX GATEWAY IFACE" >&2
  exit 1
fi

{ printf "%s called with " "$NAME:"
  printf " \"%s\"\n" -- "$@";
} | logger -t "$NAME" --socket-errors=off

ip -6 route add "$1" via "$2" dev "$3"

The routes of course are only living in memory and therefore are lost when rebooting the machine. After rebooting my router, I noticed the following things:

Should

HenriWahl commented 2 years ago

Did you set the option MANAGE_ROUTES_AT_START as in https://github.com/HenriWahl/dhcpy6d/blob/master/dhcpy6d/config.py#L218?

FelixJacobi commented 2 years ago

Ah, I didn't know that it actually exists. Will try that out.

HenriWahl commented 2 years ago

Can this issue be closed?

FelixJacobi commented 2 years ago

I think so. I had no time yet to test the option, but it looks to does the job for the case. If somethings needs to be changed, I will create a PR ;) .