[Click] set_ip_header semantics

Bart Braem bart.braem at ua.ac.be
Wed Oct 15 04:12:08 EDT 2008


Dear list,

Yesterday there was some confusion during a class regarding the  
semantics of the set_ip_header function.

Students were doing exercise where they had to change an IP header of  
a packet. What they did was use ip_header to get the current  
ip_header, take a copy of that struct, modify it and then set it with  
set_ip_header. And that did not work.

We were also confused in the beginning, until we realised the  
semantics of set_ip_header: it only sets the pointers and it does not  
copy anything. In fact, do we understand correctly that the  
set_ip_header should be treated as an annotation function and that the  
pointer set with it should lie within the packet boundaries?

We suggest to update the network header methods to better reflect  
these semantics.
We could introduce naming like set_ip_header_anno.
But we also suggest to change the call itself and use an offset  
parameter instead of a pointer to the data. This way confusion is  
impossible because it is clear that the network_header methods work on  
in-packet data.

What do you think?

Regards,
Bart and Michael
-- 
Bart Braem
PATS research group - IBBT
Dept. of Mathematics and Computer Sciences
University of Antwerp
Campus Middelheim, G3.30
Middelheimlaan 1
B-2020 Antwerpen, Belgium
Phone: +32 (0)3 265.32.91
Fax: +32 (0)3 265.37.77
Web: www.pats.ua.ac.be



More information about the click mailing list