RE: Patch for Apani Nortel VPN Client to build against kernel 2.6.22 help/review
From: Fortier,Vincent [Montreal]
Date: Tue Sep 11 2007 - 12:57:42 EST
> -----Message d'origine-----
> De : linux-kernel-owner@xxxxxxxxxxxxxxx
> [mailto:linux-kernel-owner@xxxxxxxxxxxxxxx] De la part de Nick Bowler
>
> I haven't read too much into the patch, but some quick
> comments. Most applies
> throughout:
>
> > +#if (LINUX_VERSION_CODE >= 0x020616)
> KERNEL_VERSION(2,6,22) is much more readable than 0x020616.
>
> > + return (struct iphdr*) skb->network_header;
> Should be return ip_hdr(skb);
>
> > + skb->network_header = skb->data;
> Should be skb_reset_network_header(skb);
>
> > + iph = skb->network_header.iph;
> Probably meant skb->nh.iph.
>
> > + if ( iph->protocol == 17 ) /* if UDP, */
> (snip)
> > + if ( iph->protocol == 6 ) /* if TCP, */
> Could use IPPROTO_UDP and IPPROTO_TCP instead of 17 and 6,
> respectively.
>
> Instead of littering the code with #if blah #else blah, you
> could also simply provide implementations for the 2.6.22
> functions #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22).
>
(Forwarding info by Samuel to lkml...)
Thanks for your comments, here is a new patch (bowler.patch) reflecting the changes you suggested. Unfortunately, and unsurprisingly for such cosmetic changes, the code still hangs.
I have added a great many debugging statements in order to pinpoint the problem (backtrace.patch); surprisingly, my custom backtraces didn't show up in the console, but a kernel call trace did (call_trace).
Here is the contents of the offending function. The {enter,exit}_func() calls are my debugging statements, and I have verified that only the else branch was compiled. As you can see, there are only function calls here, no memory manipulation nor dereferencing at all. What could possibly fail in this function? Shouldn`t the backtrace include one of the subcalls?
void nl_spin_lock_irqsave(spinlock_t *lockptr, DWORD *flagptr)
{
enter_func(__LINE__);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
assert(lockptr);
assert(flagptr);
spin_lock_irqsave((spinlock_t *)lockptr, (*flagptr));
#else
spin_lock_irq((spinlock_t *)lockptr);
#endif
exit_func(__LINE__);
}
- Samuel Gélineau
Attachment:
call_trace
Description: call_trace
Attachment:
backtrace.patch
Description: backtrace.patch
Attachment:
bowler.patch
Description: bowler.patch