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

(usagi-users 04097) Re: Default Router Preference - RFC4191, default route switching



Hi,

Sorry for the delay.

Linus LÃssing <linus.luessing@xxxxxx> writes:

> I've lately been trying the Default Route Preference on a 2.6.27
> kernel, compiling a custom kernel with this option enabled.

I remember discussion on the topic on netdev leading to the following
commit which was added just after 2.6.27 was published if I am not
mistaken: 

commit 22441cfa0c70dcd457f3c081fcf285c3bd155824
Author: Pedro Ribeiro <pribeiro@xxxxxxxxxx>
Date:   Wed Oct 15 15:47:49 2008 -0700

    IPV6: Fix default gateway criteria wrt. HIGH/LOW preference radv option
    
    Problem observed:
                   In IPv6, in the presence of multiple routers candidates to
                   default gateway in one segment, each sending a different
                   value of preference, the Linux hosts connected to the
                   segment weren't selecting the right one in all the
                   combinations possible of LOW/MEDIUM/HIGH preference.
    
    This patch changes two files:
    include/linux/icmpv6.h
                   Get the "router_pref" bitfield in the right place
                   (as RFC4191 says), named the bit left with this fix as
                   "home_agent" (RFC3775 say that's his function)
    
    net/ipv6/ndisc.c
                   Corrects the binary logic behind the updating of the
                   router preference in the flags of the routing table
    
    Result:
                   With this two fixes applied, the default route used by
                   the system was to consistent with the rules mentioned
                   in RFC4191 in case of changes in the value of preference
                   in router advertisements
    
    Signed-off-by: Pedro Ribeiro <pribeiro@xxxxxxxxxx>
    Acked-by: YOSHIFUJI Hideaki <yoshfuji@xxxxxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>

> My
> intention is to keep established TCP sessions running over a certain
> prefix/subnet/default route, but when adding another router
> advertising itself via radvd with a higher preference, having new
> sessions over this new router. Is/should this be possible with IPv6
> (+RFC4191) at all? So far it looks like it works partially the way as
> intended, but not fully. And I'm wondering if I misunderstood the RFC
> somehow or if there still might be a bug in the kernel. 
>
> For the test setup, in the beginning the host with RFC4191 enabled is
> using the a router-box with a medium preference prefix / default route
> for the first connection for a netcat6 connection. Then I added
> another router with a different subnet and a higher preference to the
> same local link. The old netcat6 session still used the medium
> preference prefix / default route as expected and did not break the
> tcp sessions therefore. Then I started another netcat6: It correctly
> used the new prefix with a higher preference. However, it still uses
> the same default route, although I had explicitly set a different
> AdvRoutePreference for the default route on this second
> router. Shouldn't the new netcat connection then use the new default
> route instead (while the old one sticks to the old default route)? 

I think it should.

> The test setup looks like the following: I have a /48 subnet here with
> a router establishing the tunnel to the IPv6 PoP. Furthermore, there
> are two router boxes, each advertising a different /64 subnet from the
> /48 one via radvd (the ones I've been talking about previously). Their
> config looks like the following:
>
> ======================================
> interface br-mesh
> {
>         AdvDefaultPreference medium;
>         AdvSendAdvert on;
>         AdvManagedFlag off;
>         AdvOtherConfigFlag off;
>
>         prefix 2001:6f8:999:10::1/64
>         {
>                 AdvOnLink on;
>                 AdvAutonomous on;
>                 AdvRouterAddr on;
>         };
>         route ::/0
>         {
>                 AdvRoutePreference medium;
>         };
> };
> =====================================
>
> The second router box has a similar config, except it uses a high
> preference for the two preference settings and a 2001:6f8:999:11::1
> prefix. 
>
> The second netcat6 session could be established - though the way to
> the netcat-server goes over the first router-box (with the right
> prefix of router-box 2; the way back goes over the right, second
> router box). The connection is of course being established, as the
> router-boxes are forwarding the packets no matter if it really is
> their subnet. I tried to dissallow forwarding from the wrong subnets
> with ip6tables, but then I just get timeouts or refused connections -
> the kernel still does not switch to the higher preferenced default
> route and seems to use the first default route entry in the routing
> table instead. 
>
> Sorry for this a little bit longer mail (hope I was clear enough about
> what I had expected and what happened instead :) ).