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

<[email protected]>
Newsgroups gmane.linux.ipv6.usagi.users
Message-ID <[email protected]>


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-&gt;rtmsg_dst_len = r-&gt;rtm_dst_len;
  rtmsg-&gt;rtmsg_src_len = r-&gt;rtm_src_len;
- rtmsg-&gt;rtmsg_flags = RTF_UP;
+ rtmsg-&gt;rtmsg_flags = RTF_UP | r-&gt;rtm_flags;
  if (r-&gt;rtm_type == RTN_UNREACHABLE)
   rtmsg-&gt;rtmsg_flags |= RTF_REJECT;
 


--------------------------Hirdetés-----------------------------
INTERNETES NYELVTANULÁS!Tanulj ANGOLUL, NÉMETÜL kedvezményes áron a Médiabóval!3 Féle intenzitás; 3 Szint; Hanganyag CD-k; Ingyenes konzultáció!http://www.mediabo.hu/akcio/vipmail/jelentkezesi_lap.html
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.