[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(usagi-users 03026) Re: Problem with ip6_route_add()



Hi, Bryan

If you want add a permanent route, you should set rtmsg_info to 0. and unset RTF_EXPIRES flag.
And you should assure the call to ip6_route_add succeed:

    if ((err = ip6_route_add(&rtmsg, NULL)) == -EEXIST) {
        return 0;
    }
    return err;


> Any packets bound for ptr->mn should go out the interface
> that has the address ptr->fa.
>
> -------------------------------------
> static __inline__ void local_add_mn_route(struct fa_entry *ptr) {
>   struct in6_rtmsg rtmsg;
>   struct inet6_ifaddr *addr;
>
>   addr = ipv6_get_ifaddr( &(ptr->fa), NULL);
>
>   memset(&rtmsg, 0, sizeof(struct rtmsg));
>   ipv6_addr_copy(&rtmsg.rtmsg_dst, &(ptr->mn));
>   rtmsg.rtmsg_des_len = 128;
>   ipv6_addr_copy(&rtmsg.rtmsg_src, &(prt->fa) );
>   rtmsg.rtmsg_src_len = 128;
>   rtmsg.rtmsg_metric = IP6_RT_PRIO_MIPV6;
>   rtmsg.rtmsg_ifindex = addr->idev->dev->ifindex;
>   rtmsg.rtmsg_info = 0xffffffff;
>   rtmsg.rtmsg_flags = RTF_UP | RTF_EXPIRES;
>   rtmsg.rtmsg_type = RTMSG_NEWROUTE;
>
>   ip6_route_add(&rtmsg);
> }