On 2011-12-15 11:17, Jan Kiszka wrote: > On 2011-12-14 15:32, Jesper Christensen wrote: >> From: Jesper B. Christensen <[email protected]> >> >> Avoid having to re-solicit hw. addresses when configuring a ip-address > 'in' or 'for' > >> the same subnet as the old ip-address. This will enable one to implement >> fast ip-failover. >> >> >> Signed-off-by: Jesper B. Christensen <[email protected]> >> --- >> Changes v2: >> * Move code to selective deletion path >> * Split up assignment >> * missing rtdev_dereference >> --- >> >> diff --git a/stack/ipv4/af_inet.c b/stack/ipv4/af_inet.c >> index 8b394be..4464608 100644 >> --- a/stack/ipv4/af_inet.c >> +++ b/stack/ipv4/af_inet.c >> @@ -239,7 +239,21 @@ static void rt_ip_ifup(struct rtnet_device *rtdev, >> int i; >> >> >> - rt_ip_route_del_all(rtdev); /* cleanup routing table */ >> + /* Only delete our own address if the new address is >> + on the same subnet */ >> + if (rtdev->broadcast_ip == up_cmd->args.up.broadcast_ip) { > Sorry, missed some important things on first run: > > if up_cmd->args.up.ip_addr == 0 || rtdev->flags & IFF_LOOPBACK, all > routes need to be removed as before. > > Also, better say "Delete only the loopback routes..." and move the > comment into the corresponding block. That makes it clearer that the > alternative is deleting all routes. > >> + rt_ip_route_del_host(rtdev->local_ip, rtdev); > This should not be executed if local_ip was 0. > >> + >> + /* Delete our loopback route for the device */ >> + tmp = rtdev_get_loopback(); >> + if (tmp != NULL) { >> + rt_ip_route_del_host(rtdev->local_ip, tmp); >> + rtdev_dereference(tmp); >> + } > Don't understand this anymore: Why do we need to remove the loopback > route like this? The above should do the trick, doesn't it? It doesn't seem like it does. rtifconfig rteth<x> down/up etc. leaves the loopback route intact on my board. Maybe you could verify this? > >> + } else { >> + rt_ip_route_del_all(rtdev); /* cleanup routing table */ >> + } >> + >> >> if (up_cmd->args.up.ip_addr != 0xFFFFFFFF) { >> rtdev->local_ip = up_cmd->args.up.ip_addr; >> > Jan >
------------------------------------------------------------------------------ Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure _______________________________________________ RTnet-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rtnet-developers

