[Click] Fwd: Ether Type and Spliting of Packet ( sorry for last incompelte mail)

Muddassir Khan muddassir.khan at gmail.com
Tue Aug 14 07:55:16 EDT 2007


---------- Forwarded message ----------
From: Muddassir Khan <muddassir.khan at gmail.com>
Date: Aug 14, 2007 1:34 PM
Subject: Ether Type and Spliting of Packet
To: click at pdos.csail.mit.edu

hello

I have a few questions for the click ppl

1.  I made an element which just used to check the packets ( more like a
IPclassifier but very simple)   the main purpose which still has to be
implemented is to change the ETH  Type of a speific packet.

                  it is a push element with 1 input and 2 outputs.

                 I  get a packet * p_in and i convert it ot WritablePacket *
p,
                      click_ip * ip_p;
                      click_tcp * tcph;
                      ip_p = p->ip_header()

                     if(ip_p == IP_PROTO_TCP) {
                        tcph= p->tcp_header()
                        assert(tcph)
                  }
and it gives me an assert error!! dont know y as the prototype matches teh
TCP but still there is no pointer to TCP HEADER

2.

another question i have is that to change the eth type of a packet is it
supose to look something like this :
                  click_ether *  eth_h = (click_ether *) p_in->data();
                 uint_16 new_eth_type = 0x0555;
                 eth_h = (ntohs) new_eth_type;

??

and last question i have is
if i have this TCP packet , how do i make two packets out of it,

to make a data packet out of it is easy, i can just set teh tcph->flags = 0;
and this woudl mean that all teh ACK fields are no longer in use

but to make the pure ACK packet with no data part  is difficult.
i tired to find the length of the packet header using
                               ip_header_len = p->ip_hl << 2;
                               tcp_header_len = tcph->th_off << 2;
                               ip_p->ip_len = ip_header_len +
tcp_header_len;

                              data_len = ip_len - DATA_LEN ? how do i find
this data length?

and what other changes do i have to make inorder for the packets to be
accpeted by the network.
i woudl ofcourse use the IPSETCHKSUM and TCPSETCHKSUM in this order after
teh output of this element.



Thanks alot

khan


More information about the click mailing list