On Mon, Aug 17, 2015 at 12:34:13PM +0200, Martin Pieuchot wrote:
> Ultimately my goal is to use rt_ifa_{add,del}() instead of
> nd6_prefix_{on,off}link() but right now I need to remove the
> rt->ref_cnt--.
> @@ -1861,26 +1856,11 @@ nd6_prefix_onlink(struct nd_prefix *pr)
> info.rti_info[RTAX_NETMASK] = sin6tosa(&mask6);
>
> error = rtrequest1(RTM_ADD, &info, RTP_CONNECTED, &rt, ifp->if_rdomain);
> - if (error == 0) {
> - if (rt != NULL) /* this should be non NULL, though */
> - rt_sendmsg(rt, RTM_ADD, ifp->if_rdomain);
> + if (error == 0 && rt != NULL) {
> pr->ndpr_stateflags |= NDPRF_ONLINK;
Here you change the check for setting ndpr_stateflags from (error
== 0) to (error == 0 && rt != NULL). Although I think that both
checks have the same result, would it be better to use the same
logic as in defrouter_addreq()?
if (rt) {
rt_sendmsg(rt, RTM_ADD, ifp->if_rdomain);
rtfree(rt);
}
if (error == 0)
pr->ndpr_stateflags |= NDPRF_ONLINK;
bluhm