日期:2014-05-16  浏览次数:20803 次

请教:2.6编译netfilter后运行死机
请教下:运行到ip_nat_setup_info的时候就死机了,那位兄弟知道什么原因阿,谢谢

static   unsigned   int
trigger_dnat(struct   sk_buff   **pskb,
unsigned   int   hooknum,
const   struct   net_device   *in,
const   struct   net_device   *out,
const   void   *targinfo,
void   *userinfo)
{
        struct   ipt_trigger   *found;
        const   struct   iphdr   *iph   =   (*pskb)-> nh.iph;
        struct   tcphdr   *tcph   =   (void   *)iph   +   iph-> ihl*4; /*   Might   be   TCP,   UDP   */
        struct   ip_conntrack   *ct;
        enum   ip_conntrack_info   ctinfo;
        struct   ip_nat_multi_range   newrange;

int   ret;

        IP_NF_ASSERT(hooknum   ==   NF_IP_PRE_ROUTING);
        /*   Check   if   the   trigger-ed   range   has   already   existed   in   'trigger_list '.   */
        found   =   LIST_FIND(&trigger_list,   trigger_in_matched,
        struct   ipt_trigger   *,   iph-> protocol,   ntohs(tcph-> dest));
printk( "ntohs:%d\n ",ntohs(tcph-> dest));

        if   (!found   ||   !found-> srcip)
{
printk( "no   match   in   the   list\n ");
return   IPT_CONTINUE; /*   We   don 't   block   any   packet.   */
}
        printk( "#############   %s   ############\n ",   __FUNCTION__);
printk( "ip:%u\n ",found-> srcip);
        found-> reply   =   1; /*   Confirm   there   has   been   a   reply   connection.   */
        ct   =   ip_conntrack_get(*pskb,   &ctinfo);
        IP_NF_ASSERT(ct   &&   (ctinfo   ==   IP_CT_NEW));

        printk( "%s:   got   ",   __FUNCTION__);
        DUMP_TUPLE(&ct-> tuplehash[IP_CT_DIR_ORIGINAL].tuple);

        /*   Alter   the   destination   of   imcoming   packet.   */
printk( "Alter   the   destination   of   imcoming   packet\n ");

        newrange   =   ((struct   ip_nat_multi_range)
        {   1,   {   {   IP_NAT_RANGE_MAP_IPS,
                          found-> srcip,   found-> srcip,
                            {0}   ,   {0}  
                      }   }   });

        /*   Hand   modified   range   to   generic   setup.   */
printk( "Hand   modified   range   to   generic   setup ");