Mailing List Archive

[Fwd: Re: [zebra 19434] Re: [PATCH] fix for disappearing OSPF routes (was Re: network OSPF route does replace external OSPF route in kernel)]
Guys, FYI. If somebody else is willing to fix it then they are very
welcome. :)

-------- Original Message --------
Subject: Re: [zebra 19434] Re: [PATCH] fix for disappearing OSPF
routes (was Re: network OSPF route does replace external OSPF route in
kernel)
Date: Mon, 04 Aug 2003 12:06:02 +0300
From: Vladimir Ivaschenko <hazard@francoudi.com>
To: Hasso Tepper <hasso@estpak.ee>
References: <3EEA4074.4050308@francoudi.com>
<20030616140831.A13740@francoudi.com>
<20030616230833.B17358@francoudi.com> <200308011943.48814.hasso@estpak.ee>


Thanks, I'll take a look.

Hasso Tepper wrote:
> You introduced crash with this patch in ospfd, seems. There are
> situations where when ospf_zebra_delete is called, relevant oi
> structure doesn't exist any more. These situations are:
>
> no router ospf
> no network x.x.x.x/x area y
>
> api.ifindex = &path->oi->ifp->ifindex;
>
> With this call already freed strucure is accessed. I'm sure you know
> this code better than me and can propose better solution to avoid
> segfault :).
>
> with my best wishes,
>


--
Best Regards,
Vladimir Ivaschenko
Thunderworx - Senior Systems Engineer (RHCE)


--
Best Regards,
Vladimir Ivaschenko
Thunderworx - Senior Systems Engineer (RHCE)
Re: [Fwd: Re: [zebra 19434] Re: [PATCH] fix for disappearing OSPF routes (was Re: network OSPF route does replace external OSPF route in kernel)] [ In reply to ]
> > You introduced crash with this patch in ospfd, seems. There are
> > situations where when ospf_zebra_delete is called, relevant oi
> > structure doesn't exist any more. These situations are:
> >
> > no router ospf
> > no network x.x.x.x/x area y
> >
> > api.ifindex = &path->oi->ifp->ifindex;
> >
> > With this call already freed strucure is accessed. I'm sure you
> > know this code better than me and can propose better solution to
> > avoid segfault :).

I "fixed" it for now [cvs diff -r 1.8 -r 1.9 ospfd/ospf_zebra.c]. It's
better to have little bug than segfault IMHO. Any ideas for proper
fix are welcome of course.

--
Hasso Tepper
Elion Enterprises Ltd.
WAN administrator
Re: [Fwd: Re: [zebra 19434] Re: [PATCH] fix for disappearing OSPF routes (was Re: network OSPF route does replace external OSPF route in kernel)] [ In reply to ]
I will try to take a look this weekend and do a proper fix (don't have
time now...).

Note that the bug becomes a big one when you have a ring-type network,
whenever a switch occurs, some routes will remain in kernel table and
result in routing loops.

Hasso Tepper wrote:
>> > You introduced crash with this patch in ospfd, seems. There are
>> > situations where when ospf_zebra_delete is called, relevant oi
>> > structure doesn't exist any more. These situations are:
>> >
>> > no router ospf
>> > no network x.x.x.x/x area y
>> >
>> > api.ifindex = &path->oi->ifp->ifindex;
>> >
>> > With this call already freed strucure is accessed. I'm sure you
>> > know this code better than me and can propose better solution to
>> > avoid segfault :).
>
>
> I "fixed" it for now [cvs diff -r 1.8 -r 1.9 ospfd/ospf_zebra.c]. It's
> better to have little bug than segfault IMHO. Any ideas for proper
> fix are welcome of course.
>


--
Best Regards,
Vladimir Ivaschenko
Thunderworx - Senior Systems Engineer (RHCE)
Re: [Fwd: Re: [zebra 19434] Re: [PATCH] fix for disappearing OSPF routes (was Re: network OSPF route does replace external OSPF route in kernel)] [ In reply to ]
On Thu, Aug 07, 2003 at 02:57:51PM +0300, Vladimir Ivaschenko wrote:
> I will try to take a look this weekend and do a proper fix (don't have
> time now...).
>
> Note that the bug becomes a big one when you have a ring-type network,
> whenever a switch occurs, some routes will remain in kernel table and
> result in routing loops.

Yep. That's the reason I've switched to RIP. I used zebra's OSPF in a
star topology network for some time without much trouble. But when (for
redundancy etc.) I connected some of the stars in ring like topology
OSPF became useless.

I hope you have nailed down the same bug.

Impatient to test your fixes,

--
Theodor Milkov Head Network Administrator
Davidov Net Phone: +359 (2) 730158
Re: [Fwd: Re: [zebra 19434] Re: [PATCH] fix for disappearing OSPF routes (was Re: network OSPF route does replace external OSPF route in kernel)] [ In reply to ]
On Thu, 7 Aug 2003, Theodor Milkov wrote:

> Yep. That's the reason I've switched to RIP. I used zebra's OSPF in
> a star topology network for some time without much trouble. But
> when (for redundancy etc.) I connected some of the stars in ring
> like topology OSPF became useless.

hmm... strange. i've had ospfd run in a ring topology, no problems
really.

> I hope you have nailed down the same bug.
>
> Impatient to test your fixes,

regards,
--
Paul Jakma paul@clubi.ie paul@jakma.org Key ID: 64A2FF6A
warning: do not ever send email to spam@dishone.st
Fortune:
If you suspect a man, don't employ him.
Re: [Fwd: Re: [zebra 19434] Re: [PATCH] fix for disappearing OSPF routes (was Re: network OSPF route does replace external OSPF route in kernel)] [ In reply to ]
Actually my patch solved the problem for me - I didn't have any
problems since then, although our rings were interrupted several times.

The only problem with the patch that I'm aware of is segfault of Zebra
when you do "no router ospf" or "no network x.x.x.x". Neither is an
actual problem for me since I use "network 0.0.0.0/0" and do not see a
need to ever do "no router ospf". If you checkout the latest CVS and
revert the latest patch to ospfd.c (v1.9) then it should work.

Theodor Milkov wrote:
> On Thu, Aug 07, 2003 at 02:57:51PM +0300, Vladimir Ivaschenko wrote:
>
>>I will try to take a look this weekend and do a proper fix (don't have
>>time now...).
>>
>>Note that the bug becomes a big one when you have a ring-type network,
>>whenever a switch occurs, some routes will remain in kernel table and
>>result in routing loops.
>
>
> Yep. That's the reason I've switched to RIP. I used zebra's OSPF in a
> star topology network for some time without much trouble. But when (for
> redundancy etc.) I connected some of the stars in ring like topology
> OSPF became useless.
>
> I hope you have nailed down the same bug.
>
> Impatient to test your fixes,
>


--
Best Regards,
Vladimir Ivaschenko
Thunderworx - Senior Systems Engineer (RHCE)
Re: [Fwd: Re: [zebra 19434] Re: [PATCH] fix for disappearing OSPF routes (was Re: network OSPF route does replace external OSPF route in kernel)] [ In reply to ]
On Thu, Aug 07, 2003 at 03:44:19PM +0100, Paul Jakma wrote:
> hmm... strange. i've had ospfd run in a ring topology, no problems
> really.

I have been running zebra.org's 0.93b from almost a year ago. May be
there are some important fixes in zebra-pj since then.

I should try the current zebra-pj and/or quagga (when it's available)
and see whether my problems are gone.

--
Theodor Milkov Head Network Administrator
Davidov Net Phone: +359 (2) 730158
Re: [Fwd: Re: [zebra 19434] Re: [PATCH] fix for disappearing OSPF routes (was Re: network OSPF route does replace external OSPF route in kernel)] [ In reply to ]
Ok, a proper fix is attached. I tested it several times on a live
ospfd and didn't get any crashes on "no router ospf"/"no network a.b.c.d".

Vladimir Ivaschenko wrote:
> I will try to take a look this weekend and do a proper fix (don't have
> time now...).
>
> Note that the bug becomes a big one when you have a ring-type network,
> whenever a switch occurs, some routes will remain in kernel table and
> result in routing loops.
>
> Hasso Tepper wrote:
>
>>> > You introduced crash with this patch in ospfd, seems. There are
>>> > situations where when ospf_zebra_delete is called, relevant oi
>>> > structure doesn't exist any more. These situations are:
>>> >
>>> > no router ospf
>>> > no network x.x.x.x/x area y
>>> >
>>> > api.ifindex = &path->oi->ifp->ifindex;
>>> >
>>> > With this call already freed strucure is accessed. I'm sure you
>>> > know this code better than me and can propose better solution to
>>> > avoid segfault :).
>>
>>
>>
>> I "fixed" it for now [cvs diff -r 1.8 -r 1.9 ospfd/ospf_zebra.c]. It's
>> better to have little bug than segfault IMHO. Any ideas for proper fix
>> are welcome of course.
>>
>
>


--
Best Regards,
Vladimir Ivaschenko
Thunderworx - Senior Systems Engineer (RHCE)
Re: [Fwd: Re: [zebra 19434] Re: [PATCH] fix for disappearing OSPF routes (was Re: network OSPF route does replace external OSPF route in kernel)] [ In reply to ]
Vladimir Ivaschenko wrote:
> Ok, a proper fix is attached. I tested it several times on a live
> ospfd and didn't get any crashes on "no router ospf"/"no network
> a.b.c.d".

I doupt that it's a proper fix. If oi is freed already then there is
no guarantee that path->oi or path->oi->ifp are NULL's. path->oi
contains pointer to already nonexistant ospf_interface structure and
path->oi->ifp could contain whatever.

--
Hasso Tepper
Elion Enterprises Ltd.
WAN administrator
Re: [Fwd: Re: [zebra 19434] Re: [PATCH] fix for disappearing OSPF routes (was Re: network OSPF route does replace external OSPF route in kernel)] [ In reply to ]
On Sun, 10 Aug 2003, Hasso Tepper wrote:

> I doupt that it's a proper fix. If oi is freed already then there
> is no guarantee that path->oi or path->oi->ifp are NULL's. path->oi
> contains pointer to already nonexistant ospf_interface structure
> and path->oi->ifp could contain whatever.

agreed.

what i'd like to know is, why do you want the interface?

regards,
--
Paul Jakma paul@clubi.ie paul@jakma.org Key ID: 64A2FF6A
warning: do not ever send email to spam@dishone.st
Fortune:
A memorandum is written not to inform the reader, but to protect the writer.
-- Dean Acheson
Re: [Fwd: Re: [zebra 19434] Re: [PATCH] fix for disappearing OSPF routes (was Re: network OSPF route does replace external OSPF route in kernel)] [ In reply to ]
Yes, you're right. For some weird reason I thought that the problem
was with ifp being freed, but in fact oi is freed.

Indeed the easiest fix seems to be to remove the code that deals with
deletion of direct routes completely, I see this is already done in
CVS. I hope that in future we won't have cases when we somehow have
multiple direct routes.

Hasso Tepper wrote:
> Vladimir Ivaschenko wrote:
>
>>Ok, a proper fix is attached. I tested it several times on a live
>>ospfd and didn't get any crashes on "no router ospf"/"no network
>>a.b.c.d".
>
>
> I doupt that it's a proper fix. If oi is freed already then there is
> no guarantee that path->oi or path->oi->ifp are NULL's. path->oi
> contains pointer to already nonexistant ospf_interface structure and
> path->oi->ifp could contain whatever.
>


--
Best Regards,
Vladimir Ivaschenko
Thunderworx - Senior Systems Engineer (RHCE)
Re: [Fwd: Re: [zebra 19434] Re: [PATCH] fix for disappearing OSPF routes (was Re: network OSPF route does replace external OSPF route in kernel)] [ In reply to ]
On Sun, 10 Aug 2003, Vladimir Ivaschenko wrote:

> Indeed the easiest fix seems to be to remove the code that deals
> with deletion of direct routes completely, I see this is already
> done in CVS.

yes. see my reply on zebra.org list.

> I hope that in future we won't have cases when we somehow have
> multiple direct routes.

yes, i'm hoping for some comment as to what the nexthop.s_addr ==
INADDR_ANY case is for. can you explain?

regards,
--
Paul Jakma paul@clubi.ie paul@jakma.org Key ID: 64A2FF6A
warning: do not ever send email to spam@dishone.st
Fortune:
"355/113 -- Not the famous irrational number PI, but an incredible simulation!"
Re: [Fwd: Re: [zebra 19434] Re: [PATCH] fix for disappearing OSPF routes (was Re: network OSPF route does replace external OSPF route in kernel)] [ In reply to ]
>>I hope that in future we won't have cases when we somehow have
>>multiple direct routes.
>
>
> yes, i'm hoping for some comment as to what the nexthop.s_addr ==
> INADDR_ANY case is for. can you explain?

I wish I could provide a good explanation. Such case exists in
ospf_zebra_add; so when I was changing ospf_zebra_delete I decided to
add that case too.

--
Best Regards,
Vladimir Ivaschenko
Thunderworx - Senior Systems Engineer (RHCE)