(usagi-users 03560) Passing route flags from user space

[email protected]
Newsgroups gmane.linux.ipv6.usagi.users
Message-ID <[email protected]>
Sorry for the prev html mail and any duplicates :(

Hi,

I realized that in route.c the inet6_rtm_new_route() function
the inet6_rtm_to_rtmsg() does not take into account the user
supplied flags. This way it seems to be not possible to set the
RTF_DEFAULT flag of a default route (dest address being "any").
It is true that the new route will
end up in the default route list anyway but then the
ip6_route_output() function will not call rt6_best_dflt().
I relaized it when I had to modify the default route selection
algorithm. The kernel rt6_add_dflt_router() function properly
sets the RTF_DEFAULT flag but user space functions cannot
set it using netlink (e.g. iproute does not set it either).
Is it the intended behaviour? If yes, why?
Below is a one-liner patch that I use now to solve this for me.

Thanks,
Gabor Fekete

--- linux26/net/ipv6/route.c 2005-10-13 11:25:24.000000000 +0300
+++ linux26-new/net/ipv6/route.c 2005-11-16 22:37:05.000000000 +0200
@@ -1651,7 +1651,7 @@
 
  rtmsg->rtmsg_dst_len = r->rtm_dst_len;
  rtmsg->rtmsg_src_len = r->rtm_src_len;
- rtmsg->rtmsg_flags = RTF_UP;
+ rtmsg->rtmsg_flags = RTF_UP | r->rtm_flags;
  if (r->rtm_type == RTN_UNREACHABLE)
   rtmsg->rtmsg_flags |= RTF_REJECT;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.