Date: Tue, 24 Feb 2004 11:14:59 +0100 From: Andre Oppermann <andre@freebsd.org> To: Gleb Smirnoff <glebius@cell.sick.ru> Cc: freebsd-net@freebsd.org Subject: Re: rtalloc()/rtfree() problems on CURRENT Message-ID: <403B2423.DABF2E48@freebsd.org> References: <20040224080353.GA76272@cell.sick.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
Gleb Smirnoff wrote: > > Dear sirs, > > please take a look at the following problem. I've been > successfully using the following code on STABLE and 5.1-RELEASE: > > struct route ro; > struct sockaddr_in *sin; > > bzero((caddr_t)&ro, sizeof(ro)); > sin = (struct sockaddr_in *)&ro.ro_dst; > sin->sin_len = sizeof(*sin); > sin->sin_family = AF_INET; > sin->sin_addr = fle->r.r_dst; > rtalloc(&ro); Most of the time, if you don't need a cloned route allocated, you can just use rtalloc_ign(&ro, RTF_CLONING) to just get a reference to the existing rtentry. Not allocating a new cloned route saves work and time for the rtalloc code. > if (ro.ro_rt != NULL) { > struct rtentry *rt = ro.ro_rt; > > /* here some read-only things are done with rt */ Maybe you do some nasty things to rt here? > rtfree(ro.ro_rt); > } > > But on CURRENT rtfree() causes panic. Here is backtrace: ... > Does this mean that something is broken in CURRENT or I am doing something wrong? rtalloc() and rtfree() are used quite often in the network code and otherwise work fine. The odds are high that you are doing something wrong. -- Andre
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?403B2423.DABF2E48>