inet6: Take route reference before announcing address
authorRoy Marples <roy@marples.name>
Fri, 16 Aug 2019 18:26:23 +0000 (19:26 +0100)
committerRoy Marples <roy@marples.name>
Fri, 16 Aug 2019 18:26:23 +0000 (19:26 +0100)
This mirrors the behaviour in rtinit_rtrequest_callback.

sys/netinet6/in6.c

index 54da554..c1152ed 100644 (file)
@@ -240,8 +240,11 @@ in6_newaddrmsg_callback(int cmd, int error, struct rt_addrinfo *rtinfo,
 {
        struct ifaddr *ifa = arg;
 
 {
        struct ifaddr *ifa = arg;
 
-       if (error == 0 && rt != NULL && mycpuid == 0)
+       if (error == 0 && rt != NULL && mycpuid == 0) {
+               ++rt->rt_refcnt;
                rt_newaddrmsg(RTM_ADD, ifa, error, rt);
                rt_newaddrmsg(RTM_ADD, ifa, error, rt);
+               --rt->rt_refcnt;
+       }
 }
 
 void
 }
 
 void