[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAZheX=R-MVoa1Cgs8+=zON6ZC7Van8tH-GermuCTK1PEK-9ew@mail.gmail.com>
Date: Fri, 2 Mar 2012 16:25:25 +0500
From: Syed Muhammad Mohsin Kazmi <08beesmmkazmi@...cs.edu.pk>
To: Stephen Hemminger <shemminger@...tta.com>, netdev@...r.kernel.org
Subject: Re: data is truncated in skb
here is the code of encapsulation...!
struct sk_buff *create_trill_header(struct sk_buff *skb,bool
trill_header_ok,size_t msglen)
{
unsigned int extra_header_length;
uint16_t ether_type;
struct trill_header *push1;
struct ethhdr *push2;
struct ethhdr *push3;
ether_type = msglen > 0 ? (uint16_t)msglen : ETHERTYPE_TRILL;
extra_header_length = trill_header_ok ? 0 : sizeof (struct trill_header);
struct ethhdr *mac_header = eth_hdr(skb);
if (mac_header == NULL)
{
// error handling
printk("mac_header Error\n");
}
printk("\t\t\tOriginal Buffer\n");
trill_testing(skb);
if ( skb_headroom(skb) < 2*sizeof(struct ethhdr ) + sizeof(struct
trill_header) )
{
skb = skb_realloc_headroom(skb,34);
printk("\t\t\tHEADROOM ALLOCATION\n");
}
push2 = (struct ethhdr *)skb_push(skb,ETH_HLEN);
memcpy(push2->h_dest,mac_header->h_dest,ETH_ALEN);
memcpy(push2->h_source,mac_header->h_source,ETH_ALEN);
push2->h_proto = htons(0x0800); // ether_type IP
push1 = (struct trill_header *)skb_push(skb,extra_header_length);
push1->th_version = TRILL_PROTOCOL_VERSION;
push1->th_reserved = TRILL_RESERVED_BITS;
push1->th_multidest = TRILL_UNICAST;
push1->th_optslen_hi = 0;
push1->th_optslen_lo = 0;
push1->th_hopcount = DEFAULT_HOPCOUNT;
push1->th_egressnick = htons(0x1600);
push1->th_ingressnick = htons(0x1500);
push3 = (struct ethhdr *)skb_push(skb,ETH_HLEN);
memcpy(push3->h_dest,mac_header->h_dest,ETH_ALEN);
memcpy(push3->h_source,mac_header->h_source,ETH_ALEN);
push3->h_proto = htons(ether_type); // ether_type Trill
if(skb->data == push3)
{
skb_set_mac_header(skb,0);
skb_pull(skb,ETH_HLEN);
mac_header = eth_hdr(skb);
}
printk("\t\t\tencapsulated Buffer\n");
trill_testing(skb);
return skb;
}
On Fri, Mar 2, 2012 at 9:07 AM, Stephen Hemminger <shemminger@...tta.com> wrote:
> On Fri, 2 Mar 2012 07:17:16 +0500
> Syed Muhammad Mohsin Kazmi <08beesmmkazmi@...cs.edu.pk> wrote:
>
>> hi,
>> I have written a code which encapsulates the packets GOINGOUT or
>> OTHERHOST in bridging module. Encapsulation is done fine. But data at
>> the end of buffer is truncated by the size of encapsulation. What
>> should i do to avoid truncation of data?
>
>
> No idea. Post question and code to netdev list
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists