[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(usagi-users 03026) Re: Problem with ip6_route_add()
- To: usagi-users@xxxxxxxxxxxxxx
- Subject: (usagi-users 03026) Re: Problem with ip6_route_add()
- From: peng yongchao <pengyc-1997@xxxxxxxx>
- Date: Wed, 8 Sep 2004 11:30:07 +0800
- In-reply-to: <000b01c4944d$2c9918c0$647ba8c0@bryan>
- References: <000b01c4944d$2c9918c0$647ba8c0@bryan>
- Reply-to: pengyc-1997@xxxxxxxx
- Resent-date: Wed, 8 Sep 2004 12:31:47 +0900
- Resent-from: yoshfuji@xxxxxxxxxxxxxx
- Resent-message-id: <200409081231.FMLAAB20797.usagi-users@linux-ipv6.org>
- Resent-to: usagi-users@xxxxxxxxxxxxxx (moderated)
- User-agent: KMail/1.5.4
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);
> }