IPv6 hooks
Andrew Cooks
Thu Jul 10 08:47:09 2014
Hi
I'm using the dhcpcd.enter-hook to send dbus notifications when the ip
address changes, like so:
--snip--
log() {
date=$(date +"%Y%m%d-%H%M%S")
file="/tmp/dhcpcdlog"
echo "$date $1" >> $file
}
log "dhcpcd hook: interface:[$interface] ifcarrier:[$ifcarrier]
reason:[$reason]"
if [ "$reason" = "STATIC" ] \
|| [ "$reason" = "BOUND" ] \
|| [ "$reason" = "REBIND" ] \
|| [ "$reason" = "REBOOT" ] \
|| [ "$reason" = "IPV4LL" ]; then
log "Interface ${interface} UP. IPv4 address: ${new_ip_address}"
/path_to/config_routes.sh postup ${interface}
/path_to/config_firewall.sh dev-reconf ${interface}
dbus-send --session --type="method_call" \
--dest=com.our.application \
/ObjectName \
com.our.application.LinkUpDownMethod \
string:${interface} \
boolean:true \
string:"IPChange" \
string:${new_ip_address}
fi
--snip--
This seems to work well for IPv4, but not for IPv6. For IPv6, I get
unexpected calls for the "ROUTERADVERT" reason and I can't see a way
to detect the address change in a similar way to IPv4.
Is there a way to do this? Could someone explain it to me?
There's a diagram for the states as I currently understand it at:
https://plus.google.com/106809740510707559932/posts/3Vd4pCuiJRf
Thanks,
a.
Archive administrator: postmaster@marples.name