rtalloc()/rtfree() problems on CURRENT

Gleb Smirnoff glebius at cell.sick.ru
Tue Feb 24 00:03:58 PST 2004


  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);
        if (ro.ro_rt != NULL) {
                struct rtentry *rt = ro.ro_rt;

		/* here some read-only things are done with rt */

                rtfree(ro.ro_rt);
        }

But on CURRENT rtfree() causes panic. Here is backtrace:

#0  doadump () at /usr/src/sys/kern/kern_shutdown.c:240
#1  0xc0527749 in boot (howto=256) at /usr/src/sys/kern/kern_shutdown.c:374
#2  0xc0527b48 in __panic () at /usr/src/sys/kern/kern_shutdown.c:552
#3  0xc0678ee6 in trap_fatal (frame=0xcdae3a44, eva=0) at /usr/src/sys/i386/i386/trap.c:819
#4  0xc0678503 in trap (frame={tf_fs = 24, tf_es = 16, tf_ds = -844234736, tf_edi = -1023635456, tf_esi = 0, tf_ebp = -844219772, tf_isp = -844219792, tf_ebx = -1023665052, tf_edx = -1051741536, tf_ecx = -1051741536, tf_eax = 0, tf_trapno = 12, tf_err = 0, tf_eip = -1068166506, tf_cs = 8, tf_eflags = 65666, tf_esp = -844219736, tf_ss = -1068381542}) at /usr/src/sys/i386/i386/trap.c:250
#5  0xc0551296 in turnstile_head (ts=0x0) at /usr/src/sys/kern/subr_turnstile.c:709
#6  0xc051ca9a in _mtx_unlock_sleep (m=0xc2fc1c64, opts=0, file=0x0, line=0) at /usr/src/sys/kern/kern_mutex.c:645
#7  0xc05a3fd6 in rtfree (rt=0xc2fc1c64) at /usr/src/sys/net/route.c:289
#8  0xc2f8834b in flow_add () from /boot/kernel/ng_netflow.ko
#9  0xc2f87a08 in ng_netflow_rcvdata () from /boot/kernel/ng_netflow.ko
#10 0xc2f794c9 in ng_apply_item () from /boot/kernel/netgraph.ko
#11 0xc2f79054 in ng_snd_item () from /boot/kernel/netgraph.ko
#12 0xc2bab79e in ngt_rcvdata () from /boot/kernel/ng_tee.ko
#13 0xc2f794c9 in ng_apply_item () from /boot/kernel/netgraph.ko
#14 0xc2f7babb in ngintr () from /boot/kernel/netgraph.ko
#15 0xc05a1c2f in swi_net (dummy=0x0) at /usr/src/sys/net/netisr.c:255
#16 0xc0511048 in ithread_loop (arg=0xc14f8480) at /usr/src/sys/kern/kern_intr.c:547
#17 0xc050fca8 in fork_exit (callout=0xc0510e70 <ithread_loop>, arg=0x0, frame=0x0) at /usr/src/sys/kern/kern_fork.c:802

Does this mean that something is broken in CURRENT or I am doing something wrong?

-- 
Totus tuus, Glebius.
GLEBIUS-RIPN GLEB-RIPE


More information about the freebsd-net mailing list