[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Regarding building of frame header in 2.2.x,



Hello friends,
  I have a program which used to get a IP packet from the kernel and check
the kind [ICMP..] of packet. If it was a ICMP or IGMP packet, I used to
call a function called SEND_PACK(). This program works fine for kernel
2.0.x but when I am porting it to 2.2.X kernel I am facing some problems.
I have explained my problem below. I request you to please help me to
solve it.
 
In kernel 2.0.x. In the SEND_PACK() function I used to call the
Device->HARD_HEADER(---) function with both the destination and source
hardware address as NULL. For this I used to get the source hardware
address filled in the same function, but the destination hardware address
used to be left unfilled. Then I used to set the SK_BUFF->ARP to 0, and
call DEV_QUEUE_XMIT(), which in turn used to call the 
Device.REBUILD_HEADER() and get the destination hardware address filed.
This used to work fine.

But as in Kernel 2.2.x the flow and the structures are changed. Hence I 
have altered the flow as,
I still call the Device.HARD_HEADER(---) with same input and get the
source hardware address filed. But as the function DEV_QUEUE_XMIT()  is no
more calling the Device.REBUILD_HEADER() hence I have called the 
Device.REBUILD_HEADER() function in my program itself. But I am doing very
big mistake here. Hence my kernel gets matashed and the system craches.

Can you please help in solving this. I have attached [the cut short]
code below. I request you to please help me.

int Send_pack(----------- ) 
{
        uint16 len; /* packet length and frame length */
        struct sk_buff *skb;

        struct rtable *rt;      
        struct ethhdr *hdr;
        unsigned char *t3;
        char *t2;
                  -
                  -
                  -  
                 rt = (struct rtable *) skb->dst; 

                if (rt)
            ip_route_output(&rt,route_addr,source_addr, 1, 0);

                skb->protocol = __constant_htons(ETH_P_IP);

                len = skb->len; 

                if ( skb->dev->hard_header) {
                   if ( skb->dev->hard_header(skb,skb->dev,ETH_P_IP,NULL,NULL,len) 
                         < 0 )
                { 
                  hdr = (struct ethhdr *)skb->data;

                  hdr->h_proto = __constant_htons(ETH_P_IP);

                  skb->dev->rebuild_header(skb)
 
                   dev_queue_xmit(skb);


                    -
                    -
                    -

***************************************************************************
Syed Khaleelulla,
Software Engineer,
Wipro Global R&D,
26, Hosur Main Road, Bommanhalli, 
Bangalore - 560068, India.
Tel: 91-80-5722293/6 Extn- 2151.
Fax: 91-80-5722696.
www.wipro.com.
The World's First SEI CMM Level 5 Software Services Company.
**************************************************************************