Loosing IPv6 upstream after 30 minutes

Sorry for digging up an ancient topic. Actual problem though.
Apparently OpenWRT's IPv6 client odhcp6c expects regular RA sollicitations from upstream router. Without RA messages the default route times out after a certain time (probably 30min). After that OpenWRT apparently deletes the default route and connection is lost.

Two workarounds exist:
a) get your ISP sending RA's. See Dutch fix (in Dutch)
b) apply Steffen_Weinreich's workaround and copy odhcp6c.user in /etc/ in your router. See Steffen_Weinreich's fix

After a long conversation with my ISP this behavior seems specific to IPv6 and specific to OpenWRT. I would like to let the communtity decide whether this is a bug or not. And hey, this might be a good contribution for the IPv6 configuration page.
Credits go to the original posters :wink:

# /etc/odhcp6c.user
# https://forum.turris.cz/t/solved-loosing-ipv6-default-route-after-30-minutes/3883
# by Steffen_Weinreich
logger -t odhcp6c.user INterface $1 State $2
# log env 
env | logger -t odhcp6c.user

routing () {

    if [ "$2" = "bound" ] ; then 
        for entry in $RA_ROUTES; do
                local duplicate=0
                local addr="${entry%%/*}"
                entry="${entry#*/}"
                local mask="${entry%%,*}"
                entry="${entry#*,}"
                local gw="${entry%%,*}"
                entry="${entry#*,}"
                local valid="${entry%%,*}"
                entry="${entry#*,}"
                local metric="${entry%%,*}"

                for xentry in $RA_ROUTES; do
                        local xprefix="${xentry%%,*}"
                        xentry="${xentry#*,}"
                        local xgw="${xentry%%,*}"

                        [ -n "$gw" -a -z "$xgw" -a "$addr/$mask" = "$xprefix" ] && duplicate=1
                done

                if [ -z "$gw" -o "$duplicate" = 1 ]; then
                        # proto_add_ipv6_route "$addr" "$mask" "$gw" "$metric" "$valid" "$paddr"

                        logger -t odhcp6c.user setting route 1: ip route add "$addr"/"$mask" via "$gw" dev $1 metric "1$metric"
                        ip route add "$addr"/"$mask" via "$gw" dev $1 metric "1$metric"
                else
                        for prefix in $PREFIXES $ADDRESSES; do
                                local paddr="${prefix%%,*}"
                                logger -t odhcp6c.user setting route 2: ip route add "$addr"/"$mask" via "$gw" dev $1 metric "2$metric" from "$paddr"
                                ip route add "$addr"/"$mask" via "$gw" dev $1 metric "2$metric" from "$paddr"
                        done
                fi
        done
    fi
}

routing $1 $2