# dhclient-exit-hooks equivalent for rtsold



## iamGavinJ (Aug 22, 2016)

Is there a way to achieve similar functionality to dhclient-exit-hooks for IPv6?  I'm trying to update a DDNS entry when the interface receives a router announcement.

I've tried the -O <FQPN to script> option on rtsol(8) but that doesn't get invoked.  The script is owned by root and I've tried both with and without the execute bit set.

truss(1) shows no attempt to fork that script, however it does for /sbin/resolvconf.


```
#rtsol -D -O /opt/rtsold/go.sh -a
probing vtnet0
checking if vtnet0 is ready...
vtnet0 is ready
set timer for vtnet0 to 1s
New timer is 1s
timer expiration on vtnet0, state = 1
send RS on vtnet0, whose state is 2
set timer for vtnet0 to 4s
New timer is 4s
received RA from fe80::fc00:xx:xxxx:xxxx on vtnet0, state is 2
Processing RA
ndo = 0x607b90
ndo->nd_opt_type = 3
ndo->nd_opt_len = 4
ndo = 0x607bb0
ndo->nd_opt_type = 25
ndo->nd_opt_len = 3
nsbuf = 2001:19f0:300:1704::6
ndo = 0x607bc8
ndo->nd_opt_type = 5
ndo->nd_opt_len = 1
ndo = 0x607bd0
ndo->nd_opt_type = 1
ndo->nd_opt_len = 1
rsid = [vtnet0:slaac]
write to child = nameserver (11)
write to child = 2001:19f0:300:1704::6(21)
write to child =
(1)
script "/sbin/resolvconf" terminated
stop timer for vtnet0
RA expiration timer: type=25, msg=2001:19f0:300:1704::6, expire=1h0m0s
there is no timer
```


----------



## SirDice (Aug 23, 2016)

I'm not aware of something similar. Looking through resolvconf(8) however I do see another option:

```
/libexec/resolvconf
     Directory of subscribers which are run every time resolvconf adds,
     deletes or updates.

     /libexec/resolvconf/libc.d
     Directory of subscribers which are run after the libc subscriber is run.
```
These directories contain various scripts, a little light on the details in the man pages but you may be able to create a script there that does what you want.


----------



## iamGavinJ (Aug 23, 2016)

SirDice said:


> I'm not aware of something similar.


Thanks SirDice you've confirmed what I had suspected. 



SirDice said:


> Looking through resolvconf(8) however I do see another option:
> 
> ```
> /libexec/resolvconf
> ...


Unfortunately I need the script to run with every RA.  resolvconf(8) will only run if the RA contains option 25.

I'm going to look into writing a kqueue(2) filter to watch for route table/fib updates, or a bpf(4) filter for the actual RA.  I'm leaning towards the kqueue(2) solution at the moment for easy of implementation... unless you can enlighten me on their respective merits?


----------



## SirDice (Aug 23, 2016)

I'm more leaning towards devd(8). I know you can get it to trigger on a DHCP request/response but I'm not sure if it'll also work for an RA.


----------



## iamGavinJ (Aug 23, 2016)

SirDice said:


> I'm more leaning towards devd(8). I know you can get it to trigger on a DHCP request/response but I'm not sure if it'll also work for an RA.


Thanks, I'll take a look into that also.


----------

