Skip to contentSkip to conversation

Machine Freeze

DISCUSSION Ricky Foo 2 participants 2 messages Jun 16, 2003 – Jun 18, 2003 netfilter

lore
Share & tools
lore

Ricky Foo

author
#0 lore raw

Hi,

Sorry. I accidentally pressed the send button before composing my mail. Please ignore the earlier mail.

My problem now is that with the following helper routine, the entire machine freezes upon loading the helper module. I have traced the problem to the line "ip_conntrack_expect_related(ct, &expect);". Everything seems in place to me. Can anyone see what is the problem?

Ricky

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

static int help_ns(const struct iphdr *iph, size_t len,
struct ip_conntrack *ct, enum ip_conntrack_info ctinfo)
{
struct udphdr *udph = (void *)iph + iph->ihl * 4;
u_int32_t udplen = len - iph->ihl * 4;
struct nbnshdr *nbnsh = (void *)udph + 8;

int dir = CTINFO2DIR(ctinfo);
struct ip_ct_netbios_udp *info = (struct ip_ct_netbios_udp
*)&ct->help.ct_ftp_info;
struct ip_conntrack_expect expect;
struct ip_ct_netbios_ns_expect

    *exp_netbios_ns_info = &expect.help.exp_netbios_ns_info;

u_int16_t sPort=NETBIOS_NS_PORT, dPort = NETBIOS_NS_PORT;

/* Can't track pre-connected streams */

	if (!info)
		return NF_ACCEPT;

if (dir != IP_CT_DIR_ORIGINAL)
return NF_ACCEPT;

/* Not whole UDP header? */
if (udplen < sizeof(struct udphdr))

 {
    printk("netbios_ns: udplen = %u\n", (unsigned)udplen);
    return NF_ACCEPT;

}

/* Checksum invalid? Ignore. */
if (csum_tcpudp_magic(iph->saddr, iph->daddr, udplen, IPPROTO_UDP,
csum_partial((char *)udph,

     udplen, 0)))
 {
    printk("netbios_ns: bad csum: %p %u %u.%u.%u.%u - %u.%u.%u.%u\n",
	       udph, udplen, NIPQUAD(iph->saddr), NIPQUAD(iph->daddr));
    return NF_ACCEPT;

}

LOCK_BH(&ip_netbios_ns_lock);
memset(&expect, 0, sizeof(expect));
/* Update netbios ns info */ exp_netbios_ns_info->trn_ID = ntohs(nbnsh->name_trn_ID);

/* Update expected stream info */
expect.tuple = ((struct ip_conntrack_tuple)

		  	{{ ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip, { htons(sPort) }},
	    	         { ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip, { 
htons(dPort) }, IPPROTO_UDP}});
 expect.mask = ((struct ip_conntrack_tuple)
					   {{ 0, { 0 } }, { 0xFFFFFFFF, { 0xFFFF }, 0xFFFF }});

expect.expectfn = NULL;

printk ("netbios_ns: expect_related: %u.%u.%u.%u:%u - %u.%u.%u.%u:%u, ",
NIPQUAD(expect.tuple.src.ip),
ntohs(expect.tuple.src.u.udp.port), NIPQUAD(expect.tuple.dst.ip),

      	    ntohs(expect.tuple.dst.u.udp.port));
 printk("trn_ID = 0x%x\n", ntohs(nbnsh->name_trn_ID));
 ip_conntrack_expect_related(ct, &expect);        // problem is 
here!!!!!!!!!!!!
	UNLOCK_BH(&ip_netbios_ns_lock);

return NF_ACCEPT;
}

_________________________________________________________________
Download Norah Jones, Eminem and more! http://www.msn.com.sg/ringtones/ at only S$36 including GST

#1 lore raw
Quoted 4 lines · Ricky Foo

My problem now is that with the following helper routine, the entire machine freezes upon loading the helper module. I have traced the problem to the line "ip_conntrack_expect_related(ct, &expect);". Everything seems in place to me. Can anyone see what is the problem?

Sorry, from reading the code I cannot really see where the problem is.

How did you trace the problem down to that line? Are you using a kernel debugger or running user-mode-linux with a tracing thread?

If you do so, you should be able to trace the problem down by single-stepping through ip_conntrack_Expect_related().

Quoted 1 line

Ricky

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie